forked from jsonata-js/jsonata
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jsonata.d.ts
40 lines (34 loc) · 1.11 KB
/
jsonata.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Type definitions for jsonata 1.7
// Project: https://github.com/jsonata-js/jsonata
// Definitions by: Nick <https://github.com/nick121212> and Michael M. Tiller <https://github.com/xogeny>
declare function jsonata(str: string): jsonata.Expression;
declare namespace jsonata {
interface ExprNode {
type: string;
value: any;
position: number;
}
interface JsonataError extends Error {
code: string;
position: number;
token: string;
}
interface Environment {
bind(name: string, value: any): void;
lookup(name: string): any;
readonly timestamp: Date;
readonly async: boolean;
}
interface Focus {
readonly environment: Environment;
readonly input: any;
}
interface Expression {
evaluate(input: any, bindings?: Record<string, any>): any;
evaluate(input: any, bindings: Record<string, any> | undefined, callback: (err: JsonataError, resp: any) => void): void;
assign(name: string, value: any): void;
registerFunction(name: string, implementation: (this: Focus, ...args: any[]) => any, signature?: string): void;
ast(): ExprNode;
}
}
export = jsonata;