-
Notifications
You must be signed in to change notification settings - Fork 225
/
Copy pathjsonata.d.ts
72 lines (65 loc) · 1.81 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// 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, options?: jsonata.JsonataOptions): jsonata.Expression;
declare namespace jsonata {
interface JsonataOptions {
recover?: boolean,
RegexEngine?: RegExp
}
interface ExprNode {
type:
| "binary"
| "unary"
| "function"
| "partial"
| "lambda"
| "condition"
| "transform"
| "block"
| "name"
| "parent"
| "string"
| "number"
| "value"
| "wildcard"
| "descendant"
| "variable"
| "regexp"
| "operator"
| "error";
value?: any;
position?: number;
arguments?: ExprNode[];
name?: string;
procedure?: ExprNode;
steps?: ExprNode[];
expressions?: ExprNode[];
stages?: ExprNode[];
lhs?: ExprNode | ExprNode[];
rhs?: ExprNode;
}
interface JsonataError extends Error {
code: string;
position: number;
token: string;
}
interface Environment {
bind(name: string | symbol, value: any): void;
lookup(name: string | symbol): any;
readonly timestamp: Date;
readonly async: boolean;
}
interface Focus {
readonly environment: Environment;
readonly input: any;
}
interface Expression {
evaluate(input: any, bindings?: Record<string, any>): Promise<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;