@seljs/schema 1.0.0 → 1.0.1-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +0 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.mts +2 -0
- package/dist/types.d.cts +214 -0
- package/dist/types.d.mts +214 -0
- package/package.json +16 -9
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -1
- package/dist/types.d.ts +0 -211
- package/dist/types.d.ts.map +0 -1
- /package/dist/{types.js → index.mjs} +0 -0
package/dist/index.cjs
ADDED
|
File without changes
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { ContractSchema, FunctionSchema, MacroSchema, MethodSchema, ParamSchema, SELSchema, TypeRef, TypeSchema, VariableSchema } from "./types.cjs";
|
|
2
|
+
export { ContractSchema, FunctionSchema, MacroSchema, MethodSchema, ParamSchema, SELSchema, TypeRef, TypeSchema, VariableSchema };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { ContractSchema, FunctionSchema, MacroSchema, MethodSchema, ParamSchema, SELSchema, TypeRef, TypeSchema, VariableSchema } from "./types.mjs";
|
|
2
|
+
export { ContractSchema, FunctionSchema, MacroSchema, MethodSchema, ParamSchema, SELSchema, TypeRef, TypeSchema, VariableSchema };
|
package/dist/types.d.cts
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { AbiFunction } from "abitype";
|
|
2
|
+
|
|
3
|
+
//#region src/types.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Type reference string used throughout the schema.
|
|
6
|
+
* These are CEL type names like "int", "string", "bool", or custom types defined in the schema.
|
|
7
|
+
* For parameterized types, use CEL syntax (e.g., "list<sol_address>").
|
|
8
|
+
*/
|
|
9
|
+
type TypeRef = string;
|
|
10
|
+
/**
|
|
11
|
+
* Root schema type for SEL expression language.
|
|
12
|
+
* Contains all contracts, variables, types, functions, and macros available in a SEL environment.
|
|
13
|
+
*/
|
|
14
|
+
interface SELSchema {
|
|
15
|
+
/**
|
|
16
|
+
* Schema format version
|
|
17
|
+
*/
|
|
18
|
+
version: string;
|
|
19
|
+
/**
|
|
20
|
+
* Available contracts and their methods
|
|
21
|
+
*/
|
|
22
|
+
contracts: ContractSchema[];
|
|
23
|
+
/**
|
|
24
|
+
* Variables available in expressions (e.g., "user", "blockNumber")
|
|
25
|
+
*/
|
|
26
|
+
variables: VariableSchema[];
|
|
27
|
+
/**
|
|
28
|
+
* Type definitions (primitives, structs, enums)
|
|
29
|
+
*/
|
|
30
|
+
types: TypeSchema[];
|
|
31
|
+
/**
|
|
32
|
+
* Built-in CEL functions
|
|
33
|
+
*/
|
|
34
|
+
functions: FunctionSchema[];
|
|
35
|
+
/**
|
|
36
|
+
* CEL macros (all, exists, map, filter, etc.)
|
|
37
|
+
*/
|
|
38
|
+
macros: MacroSchema[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Schema for a contract with available methods.
|
|
42
|
+
* Methods are view/pure functions that can be called in CEL expressions.
|
|
43
|
+
*/
|
|
44
|
+
interface ContractSchema {
|
|
45
|
+
/**
|
|
46
|
+
* Identifier used in expressions: erc20.balanceOf(...)
|
|
47
|
+
*/
|
|
48
|
+
name: string;
|
|
49
|
+
/**
|
|
50
|
+
* Contract address (for display/documentation)
|
|
51
|
+
*/
|
|
52
|
+
address: `0x${string}`;
|
|
53
|
+
/**
|
|
54
|
+
* Human-readable description
|
|
55
|
+
*/
|
|
56
|
+
description?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Available methods (view/pure functions only)
|
|
59
|
+
*/
|
|
60
|
+
methods: MethodSchema[];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Schema for a contract method.
|
|
64
|
+
* Represents a view or pure function that can be called in CEL expressions.
|
|
65
|
+
*/
|
|
66
|
+
interface MethodSchema {
|
|
67
|
+
/**
|
|
68
|
+
* Method name: "balanceOf"
|
|
69
|
+
*/
|
|
70
|
+
name: string;
|
|
71
|
+
/**
|
|
72
|
+
* From NatSpec @notice or custom
|
|
73
|
+
*/
|
|
74
|
+
description?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Method parameters
|
|
77
|
+
*/
|
|
78
|
+
params: ParamSchema[];
|
|
79
|
+
/** Raw ABI function entry for viem encoding/decoding */
|
|
80
|
+
abi: AbiFunction;
|
|
81
|
+
/**
|
|
82
|
+
* Return type reference
|
|
83
|
+
*/
|
|
84
|
+
returns: TypeRef;
|
|
85
|
+
/**
|
|
86
|
+
* For autocomplete grouping
|
|
87
|
+
*/
|
|
88
|
+
category?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Schema for a method parameter or type field.
|
|
92
|
+
* Used in methods, structs, and function signatures.
|
|
93
|
+
*/
|
|
94
|
+
interface ParamSchema {
|
|
95
|
+
/**
|
|
96
|
+
* Parameter name: "owner"
|
|
97
|
+
*/
|
|
98
|
+
name: string;
|
|
99
|
+
/**
|
|
100
|
+
* Type reference: "address", "uint256", etc.
|
|
101
|
+
*/
|
|
102
|
+
type: TypeRef;
|
|
103
|
+
/**
|
|
104
|
+
* From NatSpec @param or custom
|
|
105
|
+
*/
|
|
106
|
+
description?: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Schema for a variable available in CEL expressions.
|
|
110
|
+
* Represents runtime context values like "user", "blockNumber", etc.
|
|
111
|
+
*/
|
|
112
|
+
interface VariableSchema {
|
|
113
|
+
/**
|
|
114
|
+
* Variable name available in expressions
|
|
115
|
+
*/
|
|
116
|
+
name: string;
|
|
117
|
+
/**
|
|
118
|
+
* Type reference
|
|
119
|
+
*/
|
|
120
|
+
type: TypeRef;
|
|
121
|
+
/**
|
|
122
|
+
* Description for hover/documentation
|
|
123
|
+
*/
|
|
124
|
+
description?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Example value for documentation
|
|
127
|
+
*/
|
|
128
|
+
example?: string;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Schema for a type definition.
|
|
132
|
+
* These are reusable types that can be used in method signatures, variable types, and function signatures.
|
|
133
|
+
*/
|
|
134
|
+
interface TypeSchema {
|
|
135
|
+
/**
|
|
136
|
+
* Type name
|
|
137
|
+
*/
|
|
138
|
+
name: string;
|
|
139
|
+
/**
|
|
140
|
+
* Type category
|
|
141
|
+
*/
|
|
142
|
+
kind: "primitive" | "struct";
|
|
143
|
+
/**
|
|
144
|
+
* For structs: field definitions
|
|
145
|
+
*/
|
|
146
|
+
fields?: ParamSchema[];
|
|
147
|
+
/**
|
|
148
|
+
* Description
|
|
149
|
+
*/
|
|
150
|
+
description?: string;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Schema for a built-in CEL function.
|
|
154
|
+
*
|
|
155
|
+
* Functions are either **free functions** (`size(list)`) or
|
|
156
|
+
* **receiver methods** (`string.startsWith(prefix)`).
|
|
157
|
+
* When `receiverType` is set, the function is a method that can only be
|
|
158
|
+
* called on expressions of that type using dot-syntax.
|
|
159
|
+
*/
|
|
160
|
+
interface FunctionSchema {
|
|
161
|
+
/**
|
|
162
|
+
* Function name: "size", "string", "int", "startsWith"
|
|
163
|
+
*/
|
|
164
|
+
name: string;
|
|
165
|
+
/**
|
|
166
|
+
* Function signature for display
|
|
167
|
+
*
|
|
168
|
+
* e.g., "size(list<T>): int" | "string.startsWith(prefix): bool"
|
|
169
|
+
*/
|
|
170
|
+
signature: string;
|
|
171
|
+
/**
|
|
172
|
+
* Description
|
|
173
|
+
*/
|
|
174
|
+
description?: string;
|
|
175
|
+
/**
|
|
176
|
+
* Parameter documentation (excludes the receiver for methods)
|
|
177
|
+
*/
|
|
178
|
+
params: ParamSchema[];
|
|
179
|
+
/**
|
|
180
|
+
* Return type
|
|
181
|
+
*/
|
|
182
|
+
returns: TypeRef;
|
|
183
|
+
/**
|
|
184
|
+
* When set, this function is a receiver method on the given type.
|
|
185
|
+
* E.g., `receiverType: "string"` means it is called as `expr.name(...)`.
|
|
186
|
+
*/
|
|
187
|
+
receiverType?: TypeRef;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Schema for a CEL macro.
|
|
191
|
+
* Macros are syntactic sugar that expand to function calls.
|
|
192
|
+
*/
|
|
193
|
+
interface MacroSchema {
|
|
194
|
+
/**
|
|
195
|
+
* Macro name: "all", "exists", "map", "filter"
|
|
196
|
+
*/
|
|
197
|
+
name: string;
|
|
198
|
+
/**
|
|
199
|
+
* Usage pattern
|
|
200
|
+
*
|
|
201
|
+
* e.g., "list.all(x, predicate)" | "list.map(x, transform)"
|
|
202
|
+
*/
|
|
203
|
+
pattern: string;
|
|
204
|
+
/**
|
|
205
|
+
* Description
|
|
206
|
+
*/
|
|
207
|
+
description?: string;
|
|
208
|
+
/**
|
|
209
|
+
* Example
|
|
210
|
+
*/
|
|
211
|
+
example?: string;
|
|
212
|
+
}
|
|
213
|
+
//#endregion
|
|
214
|
+
export { ContractSchema, FunctionSchema, MacroSchema, MethodSchema, ParamSchema, SELSchema, TypeRef, TypeSchema, VariableSchema };
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { AbiFunction } from "abitype";
|
|
2
|
+
|
|
3
|
+
//#region src/types.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Type reference string used throughout the schema.
|
|
6
|
+
* These are CEL type names like "int", "string", "bool", or custom types defined in the schema.
|
|
7
|
+
* For parameterized types, use CEL syntax (e.g., "list<sol_address>").
|
|
8
|
+
*/
|
|
9
|
+
type TypeRef = string;
|
|
10
|
+
/**
|
|
11
|
+
* Root schema type for SEL expression language.
|
|
12
|
+
* Contains all contracts, variables, types, functions, and macros available in a SEL environment.
|
|
13
|
+
*/
|
|
14
|
+
interface SELSchema {
|
|
15
|
+
/**
|
|
16
|
+
* Schema format version
|
|
17
|
+
*/
|
|
18
|
+
version: string;
|
|
19
|
+
/**
|
|
20
|
+
* Available contracts and their methods
|
|
21
|
+
*/
|
|
22
|
+
contracts: ContractSchema[];
|
|
23
|
+
/**
|
|
24
|
+
* Variables available in expressions (e.g., "user", "blockNumber")
|
|
25
|
+
*/
|
|
26
|
+
variables: VariableSchema[];
|
|
27
|
+
/**
|
|
28
|
+
* Type definitions (primitives, structs, enums)
|
|
29
|
+
*/
|
|
30
|
+
types: TypeSchema[];
|
|
31
|
+
/**
|
|
32
|
+
* Built-in CEL functions
|
|
33
|
+
*/
|
|
34
|
+
functions: FunctionSchema[];
|
|
35
|
+
/**
|
|
36
|
+
* CEL macros (all, exists, map, filter, etc.)
|
|
37
|
+
*/
|
|
38
|
+
macros: MacroSchema[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Schema for a contract with available methods.
|
|
42
|
+
* Methods are view/pure functions that can be called in CEL expressions.
|
|
43
|
+
*/
|
|
44
|
+
interface ContractSchema {
|
|
45
|
+
/**
|
|
46
|
+
* Identifier used in expressions: erc20.balanceOf(...)
|
|
47
|
+
*/
|
|
48
|
+
name: string;
|
|
49
|
+
/**
|
|
50
|
+
* Contract address (for display/documentation)
|
|
51
|
+
*/
|
|
52
|
+
address: `0x${string}`;
|
|
53
|
+
/**
|
|
54
|
+
* Human-readable description
|
|
55
|
+
*/
|
|
56
|
+
description?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Available methods (view/pure functions only)
|
|
59
|
+
*/
|
|
60
|
+
methods: MethodSchema[];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Schema for a contract method.
|
|
64
|
+
* Represents a view or pure function that can be called in CEL expressions.
|
|
65
|
+
*/
|
|
66
|
+
interface MethodSchema {
|
|
67
|
+
/**
|
|
68
|
+
* Method name: "balanceOf"
|
|
69
|
+
*/
|
|
70
|
+
name: string;
|
|
71
|
+
/**
|
|
72
|
+
* From NatSpec @notice or custom
|
|
73
|
+
*/
|
|
74
|
+
description?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Method parameters
|
|
77
|
+
*/
|
|
78
|
+
params: ParamSchema[];
|
|
79
|
+
/** Raw ABI function entry for viem encoding/decoding */
|
|
80
|
+
abi: AbiFunction;
|
|
81
|
+
/**
|
|
82
|
+
* Return type reference
|
|
83
|
+
*/
|
|
84
|
+
returns: TypeRef;
|
|
85
|
+
/**
|
|
86
|
+
* For autocomplete grouping
|
|
87
|
+
*/
|
|
88
|
+
category?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Schema for a method parameter or type field.
|
|
92
|
+
* Used in methods, structs, and function signatures.
|
|
93
|
+
*/
|
|
94
|
+
interface ParamSchema {
|
|
95
|
+
/**
|
|
96
|
+
* Parameter name: "owner"
|
|
97
|
+
*/
|
|
98
|
+
name: string;
|
|
99
|
+
/**
|
|
100
|
+
* Type reference: "address", "uint256", etc.
|
|
101
|
+
*/
|
|
102
|
+
type: TypeRef;
|
|
103
|
+
/**
|
|
104
|
+
* From NatSpec @param or custom
|
|
105
|
+
*/
|
|
106
|
+
description?: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Schema for a variable available in CEL expressions.
|
|
110
|
+
* Represents runtime context values like "user", "blockNumber", etc.
|
|
111
|
+
*/
|
|
112
|
+
interface VariableSchema {
|
|
113
|
+
/**
|
|
114
|
+
* Variable name available in expressions
|
|
115
|
+
*/
|
|
116
|
+
name: string;
|
|
117
|
+
/**
|
|
118
|
+
* Type reference
|
|
119
|
+
*/
|
|
120
|
+
type: TypeRef;
|
|
121
|
+
/**
|
|
122
|
+
* Description for hover/documentation
|
|
123
|
+
*/
|
|
124
|
+
description?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Example value for documentation
|
|
127
|
+
*/
|
|
128
|
+
example?: string;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Schema for a type definition.
|
|
132
|
+
* These are reusable types that can be used in method signatures, variable types, and function signatures.
|
|
133
|
+
*/
|
|
134
|
+
interface TypeSchema {
|
|
135
|
+
/**
|
|
136
|
+
* Type name
|
|
137
|
+
*/
|
|
138
|
+
name: string;
|
|
139
|
+
/**
|
|
140
|
+
* Type category
|
|
141
|
+
*/
|
|
142
|
+
kind: "primitive" | "struct";
|
|
143
|
+
/**
|
|
144
|
+
* For structs: field definitions
|
|
145
|
+
*/
|
|
146
|
+
fields?: ParamSchema[];
|
|
147
|
+
/**
|
|
148
|
+
* Description
|
|
149
|
+
*/
|
|
150
|
+
description?: string;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Schema for a built-in CEL function.
|
|
154
|
+
*
|
|
155
|
+
* Functions are either **free functions** (`size(list)`) or
|
|
156
|
+
* **receiver methods** (`string.startsWith(prefix)`).
|
|
157
|
+
* When `receiverType` is set, the function is a method that can only be
|
|
158
|
+
* called on expressions of that type using dot-syntax.
|
|
159
|
+
*/
|
|
160
|
+
interface FunctionSchema {
|
|
161
|
+
/**
|
|
162
|
+
* Function name: "size", "string", "int", "startsWith"
|
|
163
|
+
*/
|
|
164
|
+
name: string;
|
|
165
|
+
/**
|
|
166
|
+
* Function signature for display
|
|
167
|
+
*
|
|
168
|
+
* e.g., "size(list<T>): int" | "string.startsWith(prefix): bool"
|
|
169
|
+
*/
|
|
170
|
+
signature: string;
|
|
171
|
+
/**
|
|
172
|
+
* Description
|
|
173
|
+
*/
|
|
174
|
+
description?: string;
|
|
175
|
+
/**
|
|
176
|
+
* Parameter documentation (excludes the receiver for methods)
|
|
177
|
+
*/
|
|
178
|
+
params: ParamSchema[];
|
|
179
|
+
/**
|
|
180
|
+
* Return type
|
|
181
|
+
*/
|
|
182
|
+
returns: TypeRef;
|
|
183
|
+
/**
|
|
184
|
+
* When set, this function is a receiver method on the given type.
|
|
185
|
+
* E.g., `receiverType: "string"` means it is called as `expr.name(...)`.
|
|
186
|
+
*/
|
|
187
|
+
receiverType?: TypeRef;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Schema for a CEL macro.
|
|
191
|
+
* Macros are syntactic sugar that expand to function calls.
|
|
192
|
+
*/
|
|
193
|
+
interface MacroSchema {
|
|
194
|
+
/**
|
|
195
|
+
* Macro name: "all", "exists", "map", "filter"
|
|
196
|
+
*/
|
|
197
|
+
name: string;
|
|
198
|
+
/**
|
|
199
|
+
* Usage pattern
|
|
200
|
+
*
|
|
201
|
+
* e.g., "list.all(x, predicate)" | "list.map(x, transform)"
|
|
202
|
+
*/
|
|
203
|
+
pattern: string;
|
|
204
|
+
/**
|
|
205
|
+
* Description
|
|
206
|
+
*/
|
|
207
|
+
description?: string;
|
|
208
|
+
/**
|
|
209
|
+
* Example
|
|
210
|
+
*/
|
|
211
|
+
example?: string;
|
|
212
|
+
}
|
|
213
|
+
//#endregion
|
|
214
|
+
export { ContractSchema, FunctionSchema, MacroSchema, MethodSchema, ParamSchema, SELSchema, TypeRef, TypeSchema, VariableSchema };
|
package/package.json
CHANGED
|
@@ -1,31 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seljs/schema",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1-beta.9",
|
|
4
|
+
"repository": {
|
|
5
|
+
"url": "https://github.com/abinnovision/seljs"
|
|
6
|
+
},
|
|
4
7
|
"license": "Apache-2.0",
|
|
5
8
|
"author": {
|
|
6
9
|
"name": "abi group GmbH",
|
|
7
10
|
"email": "info@abigroup.io",
|
|
8
11
|
"url": "https://abigroup.io/"
|
|
9
12
|
},
|
|
10
|
-
"repository": {
|
|
11
|
-
"url": "https://github.com/abinnovision/seljs"
|
|
12
|
-
},
|
|
13
13
|
"type": "module",
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
|
-
"import":
|
|
17
|
-
|
|
16
|
+
"import": {
|
|
17
|
+
"types": "./dist/index.d.mts",
|
|
18
|
+
"default": "./dist/index.mjs"
|
|
19
|
+
},
|
|
20
|
+
"require": {
|
|
21
|
+
"types": "./dist/index.d.cts",
|
|
22
|
+
"default": "./dist/index.cjs"
|
|
23
|
+
}
|
|
18
24
|
},
|
|
19
25
|
"./schema.json": "./dist/sel-schema.json"
|
|
20
26
|
},
|
|
21
|
-
"main": "./dist/index.
|
|
22
|
-
"types": "./dist/index.d.
|
|
27
|
+
"main": "./dist/index.cjs",
|
|
28
|
+
"types": "./dist/index.d.cts",
|
|
23
29
|
"files": [
|
|
24
30
|
"dist",
|
|
25
31
|
"LICENSE.md"
|
|
26
32
|
],
|
|
27
33
|
"scripts": {
|
|
28
|
-
"build": "
|
|
34
|
+
"build": "tsdown && tsx scripts/generate-json-schema.ts",
|
|
29
35
|
"format:check": "prettier --check '{{src,scripts}/**/*,*}.{{t,j}s{,x},json{,5},md,y{,a}ml}'",
|
|
30
36
|
"format:fix": "prettier --write '{{src,scripts}/**/*,*}.{{t,j}s{,x},json{,5},md,y{,a}ml}'",
|
|
31
37
|
"lint:check": "eslint '{{src,scripts}/**/*,*}.{t,j}s{,x}'",
|
|
@@ -51,6 +57,7 @@
|
|
|
51
57
|
"eslint": "^9.39.4",
|
|
52
58
|
"prettier": "^3.8.1",
|
|
53
59
|
"ts-json-schema-generator": "^2.9.0",
|
|
60
|
+
"tsdown": "^0.21.3",
|
|
54
61
|
"tsx": "^4.21.0",
|
|
55
62
|
"typescript": "^5.9.3",
|
|
56
63
|
"vitest": "^4.0.18"
|
package/dist/index.d.ts
DELETED
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
package/dist/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./types.js";
|
package/dist/types.d.ts
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import type { AbiFunction } from "abitype";
|
|
2
|
-
/**
|
|
3
|
-
* Type reference string used throughout the schema.
|
|
4
|
-
* These are CEL type names like "int", "string", "bool", or custom types defined in the schema.
|
|
5
|
-
* For parameterized types, use CEL syntax (e.g., "list<sol_address>").
|
|
6
|
-
*/
|
|
7
|
-
export type TypeRef = string;
|
|
8
|
-
/**
|
|
9
|
-
* Root schema type for SEL expression language.
|
|
10
|
-
* Contains all contracts, variables, types, functions, and macros available in a SEL environment.
|
|
11
|
-
*/
|
|
12
|
-
export interface SELSchema {
|
|
13
|
-
/**
|
|
14
|
-
* Schema format version
|
|
15
|
-
*/
|
|
16
|
-
version: string;
|
|
17
|
-
/**
|
|
18
|
-
* Available contracts and their methods
|
|
19
|
-
*/
|
|
20
|
-
contracts: ContractSchema[];
|
|
21
|
-
/**
|
|
22
|
-
* Variables available in expressions (e.g., "user", "blockNumber")
|
|
23
|
-
*/
|
|
24
|
-
variables: VariableSchema[];
|
|
25
|
-
/**
|
|
26
|
-
* Type definitions (primitives, structs, enums)
|
|
27
|
-
*/
|
|
28
|
-
types: TypeSchema[];
|
|
29
|
-
/**
|
|
30
|
-
* Built-in CEL functions
|
|
31
|
-
*/
|
|
32
|
-
functions: FunctionSchema[];
|
|
33
|
-
/**
|
|
34
|
-
* CEL macros (all, exists, map, filter, etc.)
|
|
35
|
-
*/
|
|
36
|
-
macros: MacroSchema[];
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Schema for a contract with available methods.
|
|
40
|
-
* Methods are view/pure functions that can be called in CEL expressions.
|
|
41
|
-
*/
|
|
42
|
-
export interface ContractSchema {
|
|
43
|
-
/**
|
|
44
|
-
* Identifier used in expressions: erc20.balanceOf(...)
|
|
45
|
-
*/
|
|
46
|
-
name: string;
|
|
47
|
-
/**
|
|
48
|
-
* Contract address (for display/documentation)
|
|
49
|
-
*/
|
|
50
|
-
address: `0x${string}`;
|
|
51
|
-
/**
|
|
52
|
-
* Human-readable description
|
|
53
|
-
*/
|
|
54
|
-
description?: string;
|
|
55
|
-
/**
|
|
56
|
-
* Available methods (view/pure functions only)
|
|
57
|
-
*/
|
|
58
|
-
methods: MethodSchema[];
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Schema for a contract method.
|
|
62
|
-
* Represents a view or pure function that can be called in CEL expressions.
|
|
63
|
-
*/
|
|
64
|
-
export interface MethodSchema {
|
|
65
|
-
/**
|
|
66
|
-
* Method name: "balanceOf"
|
|
67
|
-
*/
|
|
68
|
-
name: string;
|
|
69
|
-
/**
|
|
70
|
-
* From NatSpec @notice or custom
|
|
71
|
-
*/
|
|
72
|
-
description?: string;
|
|
73
|
-
/**
|
|
74
|
-
* Method parameters
|
|
75
|
-
*/
|
|
76
|
-
params: ParamSchema[];
|
|
77
|
-
/** Raw ABI function entry for viem encoding/decoding */
|
|
78
|
-
abi: AbiFunction;
|
|
79
|
-
/**
|
|
80
|
-
* Return type reference
|
|
81
|
-
*/
|
|
82
|
-
returns: TypeRef;
|
|
83
|
-
/**
|
|
84
|
-
* For autocomplete grouping
|
|
85
|
-
*/
|
|
86
|
-
category?: string;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Schema for a method parameter or type field.
|
|
90
|
-
* Used in methods, structs, and function signatures.
|
|
91
|
-
*/
|
|
92
|
-
export interface ParamSchema {
|
|
93
|
-
/**
|
|
94
|
-
* Parameter name: "owner"
|
|
95
|
-
*/
|
|
96
|
-
name: string;
|
|
97
|
-
/**
|
|
98
|
-
* Type reference: "address", "uint256", etc.
|
|
99
|
-
*/
|
|
100
|
-
type: TypeRef;
|
|
101
|
-
/**
|
|
102
|
-
* From NatSpec @param or custom
|
|
103
|
-
*/
|
|
104
|
-
description?: string;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Schema for a variable available in CEL expressions.
|
|
108
|
-
* Represents runtime context values like "user", "blockNumber", etc.
|
|
109
|
-
*/
|
|
110
|
-
export interface VariableSchema {
|
|
111
|
-
/**
|
|
112
|
-
* Variable name available in expressions
|
|
113
|
-
*/
|
|
114
|
-
name: string;
|
|
115
|
-
/**
|
|
116
|
-
* Type reference
|
|
117
|
-
*/
|
|
118
|
-
type: TypeRef;
|
|
119
|
-
/**
|
|
120
|
-
* Description for hover/documentation
|
|
121
|
-
*/
|
|
122
|
-
description?: string;
|
|
123
|
-
/**
|
|
124
|
-
* Example value for documentation
|
|
125
|
-
*/
|
|
126
|
-
example?: string;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Schema for a type definition.
|
|
130
|
-
* These are reusable types that can be used in method signatures, variable types, and function signatures.
|
|
131
|
-
*/
|
|
132
|
-
export interface TypeSchema {
|
|
133
|
-
/**
|
|
134
|
-
* Type name
|
|
135
|
-
*/
|
|
136
|
-
name: string;
|
|
137
|
-
/**
|
|
138
|
-
* Type category
|
|
139
|
-
*/
|
|
140
|
-
kind: "primitive" | "struct";
|
|
141
|
-
/**
|
|
142
|
-
* For structs: field definitions
|
|
143
|
-
*/
|
|
144
|
-
fields?: ParamSchema[];
|
|
145
|
-
/**
|
|
146
|
-
* Description
|
|
147
|
-
*/
|
|
148
|
-
description?: string;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Schema for a built-in CEL function.
|
|
152
|
-
*
|
|
153
|
-
* Functions are either **free functions** (`size(list)`) or
|
|
154
|
-
* **receiver methods** (`string.startsWith(prefix)`).
|
|
155
|
-
* When `receiverType` is set, the function is a method that can only be
|
|
156
|
-
* called on expressions of that type using dot-syntax.
|
|
157
|
-
*/
|
|
158
|
-
export interface FunctionSchema {
|
|
159
|
-
/**
|
|
160
|
-
* Function name: "size", "string", "int", "startsWith"
|
|
161
|
-
*/
|
|
162
|
-
name: string;
|
|
163
|
-
/**
|
|
164
|
-
* Function signature for display
|
|
165
|
-
*
|
|
166
|
-
* e.g., "size(list<T>): int" | "string.startsWith(prefix): bool"
|
|
167
|
-
*/
|
|
168
|
-
signature: string;
|
|
169
|
-
/**
|
|
170
|
-
* Description
|
|
171
|
-
*/
|
|
172
|
-
description?: string;
|
|
173
|
-
/**
|
|
174
|
-
* Parameter documentation (excludes the receiver for methods)
|
|
175
|
-
*/
|
|
176
|
-
params: ParamSchema[];
|
|
177
|
-
/**
|
|
178
|
-
* Return type
|
|
179
|
-
*/
|
|
180
|
-
returns: TypeRef;
|
|
181
|
-
/**
|
|
182
|
-
* When set, this function is a receiver method on the given type.
|
|
183
|
-
* E.g., `receiverType: "string"` means it is called as `expr.name(...)`.
|
|
184
|
-
*/
|
|
185
|
-
receiverType?: TypeRef;
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Schema for a CEL macro.
|
|
189
|
-
* Macros are syntactic sugar that expand to function calls.
|
|
190
|
-
*/
|
|
191
|
-
export interface MacroSchema {
|
|
192
|
-
/**
|
|
193
|
-
* Macro name: "all", "exists", "map", "filter"
|
|
194
|
-
*/
|
|
195
|
-
name: string;
|
|
196
|
-
/**
|
|
197
|
-
* Usage pattern
|
|
198
|
-
*
|
|
199
|
-
* e.g., "list.all(x, predicate)" | "list.map(x, transform)"
|
|
200
|
-
*/
|
|
201
|
-
pattern: string;
|
|
202
|
-
/**
|
|
203
|
-
* Description
|
|
204
|
-
*/
|
|
205
|
-
description?: string;
|
|
206
|
-
/**
|
|
207
|
-
* Example
|
|
208
|
-
*/
|
|
209
|
-
example?: string;
|
|
210
|
-
}
|
|
211
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B;;;GAGG;AACH,MAAM,WAAW,SAAS;IACzB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,cAAc,EAAE,CAAC;IAE5B;;OAEG;IACH,SAAS,EAAE,cAAc,EAAE,CAAC;IAE5B;;OAEG;IACH,KAAK,EAAE,UAAU,EAAE,CAAC;IAEpB;;OAEG;IACH,SAAS,EAAE,cAAc,EAAE,CAAC;IAE5B;;OAEG;IACH,MAAM,EAAE,WAAW,EAAE,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;IAEvB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,OAAO,EAAE,YAAY,EAAE,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC5B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,MAAM,EAAE,WAAW,EAAE,CAAC;IAEtB,wDAAwD;IACxD,GAAG,EAAE,WAAW,CAAC;IAEjB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC3B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IAEd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IAEd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IAC1B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,WAAW,GAAG,QAAQ,CAAC;IAE7B;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IAEvB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC9B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,MAAM,EAAE,WAAW,EAAE,CAAC;IAEtB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC3B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
File without changes
|