wasm-cel 0.2.2 → 0.3.0
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/README.md +177 -7
- package/dist/browser.d.ts +42 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +155 -0
- package/dist/browser.js.map +1 -0
- package/dist/core.d.ts +160 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +568 -0
- package/dist/core.js.map +1 -0
- package/dist/functions.d.ts +12 -13
- package/dist/functions.d.ts.map +1 -1
- package/dist/functions.js +4 -15
- package/dist/functions.js.map +1 -1
- package/dist/index.d.ts +2 -160
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -595
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +12 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +73 -0
- package/dist/node.js.map +1 -0
- package/dist/types.d.ts +6 -4
- package/dist/types.d.ts.map +1 -1
- package/main.wasm +0 -0
- package/package.json +18 -4
package/dist/core.js
ADDED
|
@@ -0,0 +1,568 @@
|
|
|
1
|
+
// Init function that will be set by the environment-specific entry point
|
|
2
|
+
let initFn = null;
|
|
3
|
+
/**
|
|
4
|
+
* Set the initialization function (called by node.ts or browser.ts)
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export function setInitFunction(fn) {
|
|
8
|
+
initFn = fn;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Call the initialization function
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
async function init() {
|
|
15
|
+
if (!initFn) {
|
|
16
|
+
throw new Error("WASM module not initialized. Please call init() first. In Node.js, this happens automatically. In browsers, you must call init(wasmBytes) with the WASM module bytes.");
|
|
17
|
+
}
|
|
18
|
+
await initFn();
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Serialize a CEL type definition to a format that can be sent to Go
|
|
22
|
+
*/
|
|
23
|
+
function serializeTypeDef(type) {
|
|
24
|
+
if (typeof type === "string") {
|
|
25
|
+
return type;
|
|
26
|
+
}
|
|
27
|
+
if (typeof type === "object" && type !== null) {
|
|
28
|
+
if ("kind" in type) {
|
|
29
|
+
if (type.kind === "list") {
|
|
30
|
+
return {
|
|
31
|
+
kind: "list",
|
|
32
|
+
elementType: serializeTypeDef(type.elementType),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
if (type.kind === "map") {
|
|
36
|
+
return {
|
|
37
|
+
kind: "map",
|
|
38
|
+
keyType: serializeTypeDef(type.keyType),
|
|
39
|
+
valueType: serializeTypeDef(type.valueType),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return "dyn"; // Fallback to dynamic type
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Serialize function definitions for transmission to Go
|
|
48
|
+
*/
|
|
49
|
+
// Counter for generating unique implementation IDs
|
|
50
|
+
let implIDCounter = 0;
|
|
51
|
+
function expandFunctionDefinitions(functions) {
|
|
52
|
+
const expanded = [];
|
|
53
|
+
const visit = (fn) => {
|
|
54
|
+
expanded.push(fn);
|
|
55
|
+
if (fn.overloads && fn.overloads.length > 0) {
|
|
56
|
+
for (const overload of fn.overloads) {
|
|
57
|
+
visit(overload);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
for (const fn of functions) {
|
|
62
|
+
visit(fn);
|
|
63
|
+
}
|
|
64
|
+
return expanded;
|
|
65
|
+
}
|
|
66
|
+
function serializeFunctionDefs(functions) {
|
|
67
|
+
const flattened = expandFunctionDefinitions(functions);
|
|
68
|
+
return flattened.map((fn, index) => {
|
|
69
|
+
// Generate a unique implementation ID
|
|
70
|
+
const implID = `${fn.name}_${index}_${++implIDCounter}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
|
|
71
|
+
// Register the JavaScript function implementation
|
|
72
|
+
const globalObj = typeof globalThis !== "undefined" ? globalThis : global;
|
|
73
|
+
if (typeof globalObj.registerCELFunction === "function") {
|
|
74
|
+
const registerResult = globalObj.registerCELFunction(implID, fn.impl);
|
|
75
|
+
if (registerResult.error) {
|
|
76
|
+
throw new Error(`Failed to register function ${fn.name}: ${registerResult.error}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
throw new Error("registerCELFunction not available. Make sure WASM is initialized.");
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
name: fn.name,
|
|
84
|
+
params: fn.params.map((param) => ({
|
|
85
|
+
name: param.name,
|
|
86
|
+
type: serializeTypeDef(param.type),
|
|
87
|
+
optional: param.optional,
|
|
88
|
+
})),
|
|
89
|
+
returnType: serializeTypeDef(fn.returnType),
|
|
90
|
+
implID,
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
// FinalizationRegistry for automatic cleanup
|
|
95
|
+
// This provides best-effort cleanup when objects are garbage collected
|
|
96
|
+
const programRegistry = typeof FinalizationRegistry !== "undefined"
|
|
97
|
+
? new FinalizationRegistry((programID) => {
|
|
98
|
+
// Best-effort cleanup when program is garbage collected
|
|
99
|
+
try {
|
|
100
|
+
const globalObj = typeof globalThis !== "undefined" ? globalThis : global;
|
|
101
|
+
if (typeof globalObj.destroyProgram === "function") {
|
|
102
|
+
globalObj.destroyProgram(programID);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
// Ignore errors during finalization - this is best-effort only
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
: null;
|
|
110
|
+
const envRegistry = typeof FinalizationRegistry !== "undefined"
|
|
111
|
+
? new FinalizationRegistry((envID) => {
|
|
112
|
+
// Best-effort cleanup when environment is garbage collected
|
|
113
|
+
try {
|
|
114
|
+
const globalObj = typeof globalThis !== "undefined" ? globalThis : global;
|
|
115
|
+
if (typeof globalObj.destroyEnv === "function") {
|
|
116
|
+
globalObj.destroyEnv(envID);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
catch (err) {
|
|
120
|
+
// Ignore errors during finalization - this is best-effort only
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
: null;
|
|
124
|
+
/**
|
|
125
|
+
* A compiled CEL program that can be evaluated with variables
|
|
126
|
+
*/
|
|
127
|
+
export class Program {
|
|
128
|
+
constructor(programID) {
|
|
129
|
+
this.destroyed = false;
|
|
130
|
+
this.programID = programID;
|
|
131
|
+
// Register for automatic cleanup via FinalizationRegistry
|
|
132
|
+
if (programRegistry) {
|
|
133
|
+
programRegistry.register(this, programID);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Evaluate the compiled program with the given variables
|
|
138
|
+
* @param vars - Variables to use in the evaluation
|
|
139
|
+
* @returns Promise resolving to the evaluation result
|
|
140
|
+
* @throws Error if evaluation fails or program has been destroyed
|
|
141
|
+
*/
|
|
142
|
+
async eval(vars = null) {
|
|
143
|
+
if (this.destroyed) {
|
|
144
|
+
throw new Error("Program has been destroyed");
|
|
145
|
+
}
|
|
146
|
+
await init();
|
|
147
|
+
return new Promise((resolve, reject) => {
|
|
148
|
+
try {
|
|
149
|
+
const globalObj = typeof globalThis !== "undefined" ? globalThis : global;
|
|
150
|
+
const result = globalObj.evalProgram(this.programID, vars || {});
|
|
151
|
+
if (result.error) {
|
|
152
|
+
reject(new Error(result.error));
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
resolve(result.result);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
catch (err) {
|
|
159
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
160
|
+
reject(new Error(`WASM call failed: ${error.message}`));
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Destroy this program and free associated WASM resources.
|
|
166
|
+
* After calling destroy(), this program instance should not be used.
|
|
167
|
+
* If FinalizationRegistry is available, resources will be automatically
|
|
168
|
+
* cleaned up when the object is garbage collected, but explicit cleanup
|
|
169
|
+
* is recommended.
|
|
170
|
+
*/
|
|
171
|
+
destroy() {
|
|
172
|
+
if (this.destroyed) {
|
|
173
|
+
return; // Already destroyed, no-op
|
|
174
|
+
}
|
|
175
|
+
try {
|
|
176
|
+
const globalObj = typeof globalThis !== "undefined" ? globalThis : global;
|
|
177
|
+
if (typeof globalObj.destroyProgram === "function") {
|
|
178
|
+
const result = globalObj.destroyProgram(this.programID);
|
|
179
|
+
if (result.error) {
|
|
180
|
+
// Log but don't throw - cleanup should be best-effort
|
|
181
|
+
console.warn(`Failed to destroy program: ${result.error}`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
catch (err) {
|
|
186
|
+
// Log but don't throw - cleanup should be best-effort
|
|
187
|
+
console.warn(`Error destroying program: ${err}`);
|
|
188
|
+
}
|
|
189
|
+
finally {
|
|
190
|
+
this.destroyed = true;
|
|
191
|
+
// Unregister from FinalizationRegistry since we've explicitly cleaned up
|
|
192
|
+
if (programRegistry) {
|
|
193
|
+
programRegistry.unregister(this);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* A CEL environment that holds variable declarations and function definitions
|
|
200
|
+
*/
|
|
201
|
+
export class Env {
|
|
202
|
+
constructor(envID) {
|
|
203
|
+
this.destroyed = false;
|
|
204
|
+
this.envID = envID;
|
|
205
|
+
// Register for automatic cleanup via FinalizationRegistry
|
|
206
|
+
if (envRegistry) {
|
|
207
|
+
envRegistry.register(this, envID);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Get the environment ID (useful for debugging or advanced use cases)
|
|
212
|
+
*/
|
|
213
|
+
getID() {
|
|
214
|
+
return this.envID;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Create a new CEL environment
|
|
218
|
+
* @param options - Options including variable declarations, function definitions, and environment options
|
|
219
|
+
* @returns Promise resolving to a new Env instance
|
|
220
|
+
* @throws Error if environment creation fails
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* ```typescript
|
|
224
|
+
* const env = await Env.new({
|
|
225
|
+
* variables: [
|
|
226
|
+
* { name: "x", type: "int" },
|
|
227
|
+
* { name: "y", type: "int" }
|
|
228
|
+
* ],
|
|
229
|
+
* functions: [
|
|
230
|
+
* CELFunction.new("add")
|
|
231
|
+
* .param("a", "int")
|
|
232
|
+
* .param("b", "int")
|
|
233
|
+
* .returns("int")
|
|
234
|
+
* .implement((a, b) => a + b)
|
|
235
|
+
* ],
|
|
236
|
+
* options: [
|
|
237
|
+
* Options.optionalTypes()
|
|
238
|
+
* ]
|
|
239
|
+
* });
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
static async new(options) {
|
|
243
|
+
await init();
|
|
244
|
+
// Serialize variable declarations
|
|
245
|
+
const varDecls = (options?.variables || []).map((v) => ({
|
|
246
|
+
name: v.name,
|
|
247
|
+
type: serializeTypeDef(v.type),
|
|
248
|
+
}));
|
|
249
|
+
// Serialize function definitions if provided
|
|
250
|
+
let serializedFuncDefs = null;
|
|
251
|
+
if (options?.functions && options.functions.length > 0) {
|
|
252
|
+
serializedFuncDefs = serializeFunctionDefs(options.functions);
|
|
253
|
+
}
|
|
254
|
+
// INTERNAL: Create environment first without options, then extend if needed
|
|
255
|
+
// This allows complex options to perform JavaScript-side setup before being applied
|
|
256
|
+
const env = await new Promise((resolve, reject) => {
|
|
257
|
+
try {
|
|
258
|
+
const globalObj = typeof globalThis !== "undefined" ? globalThis : global;
|
|
259
|
+
const result = globalObj.createEnv(varDecls, serializedFuncDefs);
|
|
260
|
+
if (result.error) {
|
|
261
|
+
reject(new Error(result.error));
|
|
262
|
+
}
|
|
263
|
+
else if (!result.envID) {
|
|
264
|
+
reject(new Error("Environment creation failed: no envID returned"));
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
resolve(new Env(result.envID));
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
catch (err) {
|
|
271
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
272
|
+
reject(new Error(`WASM call failed: ${error.message}`));
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
// INTERNAL: If options were provided, extend the environment
|
|
276
|
+
// This allows options to perform JavaScript-side setup (like registering functions)
|
|
277
|
+
if (options?.options && options.options.length > 0) {
|
|
278
|
+
await env._extendWithOptions(options.options);
|
|
279
|
+
}
|
|
280
|
+
return env;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Compile a CEL expression in this environment
|
|
284
|
+
* @param expr - The CEL expression to compile
|
|
285
|
+
* @returns Promise resolving to a compiled Program
|
|
286
|
+
* @throws Error if compilation fails or environment has been destroyed
|
|
287
|
+
*
|
|
288
|
+
* @example
|
|
289
|
+
* ```typescript
|
|
290
|
+
* const env = await Env.new({
|
|
291
|
+
* variables: [{ name: "x", type: "int" }]
|
|
292
|
+
* });
|
|
293
|
+
* const program = await env.compile("x + 10");
|
|
294
|
+
* const result = await program.eval({ x: 5 });
|
|
295
|
+
* console.log(result); // 15
|
|
296
|
+
* ```
|
|
297
|
+
*/
|
|
298
|
+
async compile(expr) {
|
|
299
|
+
if (this.destroyed) {
|
|
300
|
+
throw new Error("Environment has been destroyed");
|
|
301
|
+
}
|
|
302
|
+
await init();
|
|
303
|
+
if (typeof expr !== "string") {
|
|
304
|
+
throw new Error("Expression must be a string");
|
|
305
|
+
}
|
|
306
|
+
return new Promise((resolve, reject) => {
|
|
307
|
+
try {
|
|
308
|
+
const globalObj = typeof globalThis !== "undefined" ? globalThis : global;
|
|
309
|
+
const result = globalObj.compileExpr(this.envID, expr);
|
|
310
|
+
if (result.error) {
|
|
311
|
+
reject(new Error(result.error));
|
|
312
|
+
}
|
|
313
|
+
else if (!result.programID) {
|
|
314
|
+
reject(new Error("Compilation failed: no programID returned"));
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
resolve(new Program(result.programID));
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
catch (err) {
|
|
321
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
322
|
+
reject(new Error(`WASM call failed: ${error.message}`));
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Compile a CEL expression with detailed results including warnings and issues
|
|
328
|
+
* @param expr - The CEL expression to compile
|
|
329
|
+
* @returns Promise resolving to detailed compilation results
|
|
330
|
+
* @throws Error if environment has been destroyed
|
|
331
|
+
*
|
|
332
|
+
* @example
|
|
333
|
+
* ```typescript
|
|
334
|
+
* const result = await env.compileDetailed("x + y");
|
|
335
|
+
* if (result.success) {
|
|
336
|
+
* console.log("Compiled successfully");
|
|
337
|
+
* if (result.issues.length > 0) {
|
|
338
|
+
* console.log("Warnings:", result.issues);
|
|
339
|
+
* }
|
|
340
|
+
* const evalResult = await result.program.eval({ x: 10, y: 20 });
|
|
341
|
+
* } else {
|
|
342
|
+
* console.log("Compilation failed:", result.error);
|
|
343
|
+
* console.log("All issues:", result.issues);
|
|
344
|
+
* }
|
|
345
|
+
* ```
|
|
346
|
+
*/
|
|
347
|
+
async compileDetailed(expr) {
|
|
348
|
+
if (this.destroyed) {
|
|
349
|
+
throw new Error("Environment has been destroyed");
|
|
350
|
+
}
|
|
351
|
+
await init();
|
|
352
|
+
if (typeof expr !== "string") {
|
|
353
|
+
throw new Error("Expression must be a string");
|
|
354
|
+
}
|
|
355
|
+
return new Promise((resolve) => {
|
|
356
|
+
try {
|
|
357
|
+
const globalObj = typeof globalThis !== "undefined" ? globalThis : global;
|
|
358
|
+
const result = globalObj.compileExprDetailed(this.envID, expr);
|
|
359
|
+
if (result.error && !result.programID) {
|
|
360
|
+
// Compilation failed completely
|
|
361
|
+
resolve({
|
|
362
|
+
success: false,
|
|
363
|
+
error: result.error,
|
|
364
|
+
issues: result.issues || [],
|
|
365
|
+
program: undefined,
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
else if (result.programID) {
|
|
369
|
+
// Compilation succeeded (possibly with warnings)
|
|
370
|
+
resolve({
|
|
371
|
+
success: true,
|
|
372
|
+
error: undefined,
|
|
373
|
+
issues: result.issues || [],
|
|
374
|
+
program: new Program(result.programID),
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
// Unexpected state
|
|
379
|
+
resolve({
|
|
380
|
+
success: false,
|
|
381
|
+
error: "Compilation failed: no programID returned",
|
|
382
|
+
issues: result.issues || [],
|
|
383
|
+
program: undefined,
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
catch (err) {
|
|
388
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
389
|
+
resolve({
|
|
390
|
+
success: false,
|
|
391
|
+
error: `WASM call failed: ${error.message}`,
|
|
392
|
+
issues: [],
|
|
393
|
+
program: undefined,
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Typecheck a CEL expression in this environment without compiling it
|
|
400
|
+
* @param expr - The CEL expression to typecheck
|
|
401
|
+
* @returns Promise resolving to the type information
|
|
402
|
+
* @throws Error if typechecking fails or environment has been destroyed
|
|
403
|
+
*
|
|
404
|
+
* @example
|
|
405
|
+
* ```typescript
|
|
406
|
+
* const env = await Env.new({
|
|
407
|
+
* variables: [{ name: "x", type: "int" }, { name: "y", type: "int" }]
|
|
408
|
+
* });
|
|
409
|
+
* const typeInfo = await env.typecheck("x + y");
|
|
410
|
+
* console.log(typeInfo.type); // "int"
|
|
411
|
+
*
|
|
412
|
+
* const listType = await env.typecheck("[1, 2, 3]");
|
|
413
|
+
* console.log(listType.type); // { kind: "list", elementType: "int" }
|
|
414
|
+
* ```
|
|
415
|
+
*/
|
|
416
|
+
async typecheck(expr) {
|
|
417
|
+
if (this.destroyed) {
|
|
418
|
+
throw new Error("Environment has been destroyed");
|
|
419
|
+
}
|
|
420
|
+
await init();
|
|
421
|
+
if (typeof expr !== "string") {
|
|
422
|
+
throw new Error("Expression must be a string");
|
|
423
|
+
}
|
|
424
|
+
return new Promise((resolve, reject) => {
|
|
425
|
+
try {
|
|
426
|
+
const globalObj = typeof globalThis !== "undefined" ? globalThis : global;
|
|
427
|
+
const result = globalObj.typecheckExpr(this.envID, expr);
|
|
428
|
+
if (result.error) {
|
|
429
|
+
reject(new Error(result.error));
|
|
430
|
+
}
|
|
431
|
+
else if (result.type === undefined) {
|
|
432
|
+
reject(new Error("Typecheck failed: no type returned"));
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
resolve({ type: result.type });
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
catch (err) {
|
|
439
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
440
|
+
reject(new Error(`WASM call failed: ${error.message}`));
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Extend this environment with additional CEL environment options
|
|
446
|
+
* @param options - Array of CEL environment option configurations or complex options with setup
|
|
447
|
+
* @returns Promise that resolves when the environment has been extended
|
|
448
|
+
* @throws Error if extension fails or environment has been destroyed
|
|
449
|
+
*
|
|
450
|
+
* @example
|
|
451
|
+
* ```typescript
|
|
452
|
+
* const env = await Env.new({
|
|
453
|
+
* variables: [{ name: "x", type: "int" }]
|
|
454
|
+
* });
|
|
455
|
+
*
|
|
456
|
+
* // Add options after creation
|
|
457
|
+
* await env.extend([Options.optionalTypes()]);
|
|
458
|
+
* ```
|
|
459
|
+
*/
|
|
460
|
+
async extend(options) {
|
|
461
|
+
return this._extendWithOptions(options);
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Internal method to extend environment with options
|
|
465
|
+
* This method delegates to options that implement OptionWithSetup for complex operations
|
|
466
|
+
* @private
|
|
467
|
+
*/
|
|
468
|
+
async _extendWithOptions(options) {
|
|
469
|
+
if (this.destroyed) {
|
|
470
|
+
throw new Error("Environment has been destroyed");
|
|
471
|
+
}
|
|
472
|
+
await init();
|
|
473
|
+
if (!options || options.length === 0) {
|
|
474
|
+
return; // Nothing to extend
|
|
475
|
+
}
|
|
476
|
+
// Process options: delegate to options that can handle their own setup
|
|
477
|
+
const processedOptions = [];
|
|
478
|
+
for (const option of options) {
|
|
479
|
+
// Check if this option implements OptionWithSetup
|
|
480
|
+
if ("setupAndProcess" in option &&
|
|
481
|
+
typeof option.setupAndProcess === "function") {
|
|
482
|
+
// Let the option handle its own complex setup operations
|
|
483
|
+
const setupEnv = {
|
|
484
|
+
getID: () => this.getID(),
|
|
485
|
+
registerFunction: async (name, impl) => {
|
|
486
|
+
if (this.destroyed) {
|
|
487
|
+
throw new Error("Environment has been destroyed");
|
|
488
|
+
}
|
|
489
|
+
// Generate a unique implementation ID for this function
|
|
490
|
+
const implID = `${name}_${this.envID}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
|
|
491
|
+
// Register the JavaScript function implementation
|
|
492
|
+
const globalObj = typeof globalThis !== "undefined" ? globalThis : global;
|
|
493
|
+
if (typeof globalObj.registerCELFunction === "function") {
|
|
494
|
+
const registerResult = globalObj.registerCELFunction(implID, impl);
|
|
495
|
+
if (registerResult.error) {
|
|
496
|
+
throw new Error(`Failed to register function ${name}: ${registerResult.error}`);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
throw new Error("registerCELFunction not available. Make sure WASM is initialized.");
|
|
501
|
+
}
|
|
502
|
+
// Return the actual implementation ID that was registered
|
|
503
|
+
return implID;
|
|
504
|
+
},
|
|
505
|
+
};
|
|
506
|
+
const processedOption = await option.setupAndProcess(setupEnv);
|
|
507
|
+
processedOptions.push(processedOption);
|
|
508
|
+
}
|
|
509
|
+
else {
|
|
510
|
+
// Simple option configuration, pass through directly
|
|
511
|
+
processedOptions.push(option);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
const serializedOptions = JSON.stringify(processedOptions);
|
|
515
|
+
return new Promise((resolve, reject) => {
|
|
516
|
+
try {
|
|
517
|
+
const globalObj = typeof globalThis !== "undefined" ? globalThis : global;
|
|
518
|
+
const result = globalObj.extendEnv(this.envID, serializedOptions);
|
|
519
|
+
if (result.error) {
|
|
520
|
+
reject(new Error(result.error));
|
|
521
|
+
}
|
|
522
|
+
else {
|
|
523
|
+
resolve();
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
catch (err) {
|
|
527
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
528
|
+
reject(new Error(`WASM call failed: ${error.message}`));
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Destroy this environment and free associated WASM resources.
|
|
534
|
+
* This will also clean up any registered JavaScript functions associated
|
|
535
|
+
* with this environment.
|
|
536
|
+
* After calling destroy(), this environment instance should not be used.
|
|
537
|
+
* If FinalizationRegistry is available, resources will be automatically
|
|
538
|
+
* cleaned up when the object is garbage collected, but explicit cleanup
|
|
539
|
+
* is recommended.
|
|
540
|
+
*/
|
|
541
|
+
destroy() {
|
|
542
|
+
if (this.destroyed) {
|
|
543
|
+
return; // Already destroyed, no-op
|
|
544
|
+
}
|
|
545
|
+
try {
|
|
546
|
+
const globalObj = typeof globalThis !== "undefined" ? globalThis : global;
|
|
547
|
+
if (typeof globalObj.destroyEnv === "function") {
|
|
548
|
+
const result = globalObj.destroyEnv(this.envID);
|
|
549
|
+
if (result.error) {
|
|
550
|
+
// Log but don't throw - cleanup should be best-effort
|
|
551
|
+
console.warn(`Failed to destroy environment: ${result.error}`);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
catch (err) {
|
|
556
|
+
// Log but don't throw - cleanup should be best-effort
|
|
557
|
+
console.warn(`Error destroying environment: ${err}`);
|
|
558
|
+
}
|
|
559
|
+
finally {
|
|
560
|
+
this.destroyed = true;
|
|
561
|
+
// Unregister from FinalizationRegistry since we've explicitly cleaned up
|
|
562
|
+
if (envRegistry) {
|
|
563
|
+
envRegistry.unregister(this);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
//# sourceMappingURL=core.js.map
|
package/dist/core.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../lib/core.ts"],"names":[],"mappings":"AAOA,yEAAyE;AACzE,IAAI,MAAM,GAAiC,IAAI,CAAC;AAEhD;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,EAAuB;IACrD,MAAM,GAAG,EAAE,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,uKAAuK,CACxK,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,EAAE,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,SAAS,gBAAgB,CAAC,IAAgB;IACxC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAC9C,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;YACnB,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;gBACzB,OAAO;oBACL,IAAI,EAAE,MAAM;oBACZ,WAAW,EAAE,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC;iBAChD,CAAC;YACJ,CAAC;YACD,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;gBACxB,OAAO;oBACL,IAAI,EAAE,KAAK;oBACX,OAAO,EAAE,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC;oBACvC,SAAS,EAAE,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC;iBAC5C,CAAC;YACJ,CAAC;QACH,CAA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QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,sDAAsD;YACtD,OAAO,CAAC,IAAI,CAAC,iCAAiC,GAAG,EAAE,CAAC,CAAC;QACvD,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,yEAAyE;YACzE,IAAI,WAAW,EAAE,CAAC;gBAChB,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
package/dist/functions.d.ts
CHANGED
|
@@ -32,7 +32,9 @@ type ExtractParamTypes<P extends readonly CELFunctionParam[]> = {
|
|
|
32
32
|
* .implement((a, b) => a + b);
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
|
-
|
|
35
|
+
type BuilderStage = "params" | "returns";
|
|
36
|
+
export declare class CELFunction<Stage extends BuilderStage = "params", Params extends readonly CELFunctionParam[] = readonly [], ReturnType extends CELTypeDef = "dyn"> {
|
|
37
|
+
private readonly stageMarker;
|
|
36
38
|
private name;
|
|
37
39
|
private readonly params;
|
|
38
40
|
private returnType;
|
|
@@ -52,30 +54,27 @@ export declare class CELFunction<Params extends readonly CELFunctionParam[] = re
|
|
|
52
54
|
* .implement((a, b) => a + b);
|
|
53
55
|
* ```
|
|
54
56
|
*/
|
|
55
|
-
static new(name: string): CELFunction<readonly [], "dyn">;
|
|
57
|
+
static new(name: string): CELFunction<"params", readonly [], "dyn">;
|
|
56
58
|
/**
|
|
57
59
|
* Add a parameter to the function
|
|
58
60
|
*/
|
|
59
|
-
param<T extends CELTypeDef>(name: string, type: T, optional?: boolean): CELFunction<[
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
optional: boolean;
|
|
65
|
-
}
|
|
66
|
-
], ReturnType>;
|
|
61
|
+
param<T extends CELTypeDef>(this: CELFunction<"params", Params, ReturnType>, name: string, type: T, optional?: boolean): CELFunction<"params", readonly [...Params, {
|
|
62
|
+
name: string;
|
|
63
|
+
type: T;
|
|
64
|
+
optional: boolean;
|
|
65
|
+
}], ReturnType>;
|
|
67
66
|
/**
|
|
68
67
|
* Set the return type of the function
|
|
69
68
|
*/
|
|
70
|
-
returns<T extends CELTypeDef>(type: T): CELFunction<Params, T>;
|
|
69
|
+
returns<T extends CELTypeDef>(this: CELFunction<"params", Params, ReturnType>, type: T): CELFunction<"returns", Params, T>;
|
|
71
70
|
/**
|
|
72
71
|
* Set the implementation function and return the final definition
|
|
73
72
|
*/
|
|
74
|
-
implement(impl: (...args: ExtractParamTypes<Params>) => CELTypeToTS<ReturnType>): CELFunctionDefinition;
|
|
73
|
+
implement(this: CELFunction<"returns", Params, ReturnType>, impl: (...args: ExtractParamTypes<Params>) => CELTypeToTS<ReturnType>): CELFunctionDefinition;
|
|
75
74
|
/**
|
|
76
75
|
* Add an overload variant of this function
|
|
77
76
|
*/
|
|
78
|
-
overload(overload: CELFunctionDefinition):
|
|
77
|
+
overload(this: CELFunction<"returns", Params, ReturnType>, overload: CELFunctionDefinition): CELFunction<"returns", Params, ReturnType>;
|
|
79
78
|
}
|
|
80
79
|
/**
|
|
81
80
|
* Helper function to create a list type
|
package/dist/functions.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../lib/functions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,qBAAqB,EACrB,gBAAgB,EAChB,UAAU,EACX,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,KAAK,WAAW,CACd,CAAC,SAAS,UAAU,EACpB,KAAK,SAAS,SAAS,OAAO,EAAE,GAAG,EAAE,IACnC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,GACzB,GAAG,GACH,CAAC,SAAS,MAAM,GACd,OAAO,GACP,CAAC,SAAS,KAAK,GAAG,MAAM,GAAG,QAAQ,GACjC,MAAM,GACN,CAAC,SAAS,QAAQ,GAChB,MAA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