@json-eval-rs/bundler 0.0.29

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.
@@ -0,0 +1,501 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Get the library version
5
+ */
6
+ export function getVersion(): string;
7
+ /**
8
+ * Get library version (alias)
9
+ */
10
+ export function version(): string;
11
+ /**
12
+ * Initialize the library (sets up panic hook)
13
+ */
14
+ export function init(): void;
15
+ /**
16
+ * WebAssembly wrapper for JSONEval
17
+ */
18
+ export class JSONEvalWasm {
19
+ free(): void;
20
+ [Symbol.dispose](): void;
21
+ /**
22
+ * Create a new JSONEval instance
23
+ *
24
+ * @param schema - JSON schema string
25
+ * @param context - Optional context data JSON string
26
+ * @param data - Optional initial data JSON string
27
+ */
28
+ constructor(schema: string, context?: string | null, data?: string | null);
29
+ /**
30
+ * Create a new JSONEval instance from MessagePack-encoded schema
31
+ *
32
+ * @param schemaMsgpack - MessagePack-encoded schema bytes (Uint8Array)
33
+ * @param context - Optional context data JSON string
34
+ * @param data - Optional initial data JSON string
35
+ */
36
+ static newFromMsgpack(schema_msgpack: Uint8Array, context?: string | null, data?: string | null): JSONEvalWasm;
37
+ /**
38
+ * Create a new JSONEval instance from a cached ParsedSchema
39
+ *
40
+ * @param cacheKey - Cache key to lookup in the global ParsedSchemaCache
41
+ * @param context - Optional context data JSON string
42
+ * @param data - Optional initial data JSON string
43
+ */
44
+ static newFromCache(cache_key: string, context?: string | null, data?: string | null): JSONEvalWasm;
45
+ /**
46
+ * Evaluate schema with provided data (does not return schema - use getEvaluatedSchema() for that)
47
+ *
48
+ * @param data - JSON data string
49
+ * @param context - Optional context data JSON string
50
+ * @throws Error if evaluation fails
51
+ */
52
+ evaluate(data: string, context?: string | null): void;
53
+ /**
54
+ * Evaluate and return as JsValue for direct JavaScript object access
55
+ *
56
+ * @param data - JSON data string
57
+ * @param context - Optional context data JSON string
58
+ * @returns Evaluated schema as JavaScript object
59
+ */
60
+ evaluateJS(data: string, context?: string | null): any;
61
+ /**
62
+ * Evaluate dependents when a field changes (returns array of changes as JSON string)
63
+ *
64
+ * @param changedPath - Path of the field that changed
65
+ * @param data - Optional updated JSON data string
66
+ * @param context - Optional context data JSON string
67
+ * @returns Array of dependent change objects as JSON string
68
+ */
69
+ evaluateDependents(changed_path: string, data?: string | null, context?: string | null): string;
70
+ /**
71
+ * Evaluate dependents and return as JavaScript object
72
+ *
73
+ * @param changedPathsJson - JSON array of field paths that changed
74
+ * @param data - Optional updated JSON data string
75
+ * @param context - Optional context data JSON string
76
+ * @param reEvaluate - If true, performs full evaluation after processing dependents
77
+ * @returns Array of dependent change objects as JavaScript object
78
+ */
79
+ evaluateDependentsJS(changed_paths_json: string, data: string | null | undefined, context: string | null | undefined, re_evaluate: boolean): any;
80
+ /**
81
+ * Compile and run JSON logic from a JSON logic string
82
+ * @param logic_str - JSON logic expression as a string
83
+ * @param data - Optional JSON data string
84
+ * @param context - Optional JSON context string
85
+ * @returns Result as JavaScript object
86
+ */
87
+ compileAndRunLogic(logic_str: string, data?: string | null, context?: string | null): any;
88
+ /**
89
+ * Compile JSON logic and return a global ID
90
+ * @param logic_str - JSON logic expression as a string
91
+ * @returns Compiled logic ID as number (u64)
92
+ */
93
+ compileLogic(logic_str: string): number;
94
+ /**
95
+ * Run pre-compiled logic by ID
96
+ * @param logic_id - Compiled logic ID from compileLogic
97
+ * @param data - Optional JSON data string
98
+ * @param context - Optional JSON context string
99
+ * @returns Result as JavaScript object
100
+ */
101
+ runLogic(logic_id: number, data?: string | null, context?: string | null): any;
102
+ /**
103
+ * Validate data against schema rules
104
+ *
105
+ * @param data - JSON data string
106
+ * @param context - Optional context data JSON string
107
+ * @returns ValidationResult
108
+ */
109
+ validate(data: string, context?: string | null): ValidationResult;
110
+ /**
111
+ * Validate data and return as plain JavaScript object (Worker-safe)
112
+ *
113
+ * @param data - JSON data string
114
+ * @param context - Optional context data JSON string
115
+ * @returns Plain JavaScript object with validation result
116
+ */
117
+ validateJS(data: string, context?: string | null): any;
118
+ /**
119
+ * Validate data against schema rules with optional path filtering
120
+ *
121
+ * @param data - JSON data string
122
+ * @param context - Optional context data JSON string
123
+ * @param paths - Optional array of paths to validate (null for all)
124
+ * @returns ValidationResult
125
+ */
126
+ validatePaths(data: string, context?: string | null, paths?: string[] | null): ValidationResult;
127
+ /**
128
+ * Validate with path filtering and return as plain JavaScript object (Worker-safe)
129
+ *
130
+ * @param data - JSON data string
131
+ * @param context - Optional context data JSON string
132
+ * @param paths - Optional array of paths to validate (null for all)
133
+ * @returns Plain JavaScript object with validation result
134
+ */
135
+ validatePathsJS(data: string, context?: string | null, paths?: string[] | null): any;
136
+ /**
137
+ * Get the evaluated schema with optional layout resolution
138
+ *
139
+ * @param skipLayout - Whether to skip layout resolution
140
+ * @returns Evaluated schema as JSON string
141
+ */
142
+ getEvaluatedSchema(skip_layout: boolean): string;
143
+ /**
144
+ * Get the evaluated schema as JavaScript object
145
+ *
146
+ * @param skipLayout - Whether to skip layout resolution
147
+ * @returns Evaluated schema as JavaScript object
148
+ */
149
+ getEvaluatedSchemaJS(skip_layout: boolean): any;
150
+ /**
151
+ * Get the evaluated schema in MessagePack format
152
+ *
153
+ * @param skipLayout - Whether to skip layout resolution
154
+ * @returns Evaluated schema as MessagePack bytes (Uint8Array)
155
+ *
156
+ * # Zero-Copy Optimization
157
+ *
158
+ * This method returns MessagePack binary data with minimal copying:
159
+ * 1. Serializes schema to Vec<u8> in Rust (unavoidable)
160
+ * 2. wasm-bindgen transfers Vec<u8> to JS as Uint8Array (optimized)
161
+ * 3. Result is a Uint8Array view (minimal overhead)
162
+ *
163
+ * MessagePack format is 20-50% smaller than JSON, ideal for web/WASM.
164
+ */
165
+ getEvaluatedSchemaMsgpack(skip_layout: boolean): Uint8Array;
166
+ /**
167
+ * Get all schema values (evaluations ending with .value)
168
+ * Mutates internal data by overriding with values from value evaluations
169
+ *
170
+ * @returns Modified data as JavaScript object
171
+ */
172
+ getSchemaValue(): any;
173
+ /**
174
+ * Get the evaluated schema without $params field
175
+ *
176
+ * @param skipLayout - Whether to skip layout resolution
177
+ * @returns Evaluated schema as JSON string
178
+ */
179
+ getEvaluatedSchemaWithoutParams(skip_layout: boolean): string;
180
+ /**
181
+ * Get the evaluated schema without $params as JavaScript object
182
+ *
183
+ * @param skipLayout - Whether to skip layout resolution
184
+ * @returns Evaluated schema as JavaScript object
185
+ */
186
+ getEvaluatedSchemaWithoutParamsJS(skip_layout: boolean): any;
187
+ /**
188
+ * Get a value from the evaluated schema using dotted path notation
189
+ *
190
+ * @param path - Dotted path to the value (e.g., "properties.field.value")
191
+ * @param skipLayout - Whether to skip layout resolution
192
+ * @returns Value as JSON string or null if not found
193
+ */
194
+ getEvaluatedSchemaByPath(path: string, skip_layout: boolean): string | undefined;
195
+ /**
196
+ * Get a value from the evaluated schema using dotted path notation as JavaScript object
197
+ *
198
+ * @param path - Dotted path to the value (e.g., "properties.field.value")
199
+ * @param skipLayout - Whether to skip layout resolution
200
+ * @returns Value as JavaScript object or null if not found
201
+ */
202
+ getEvaluatedSchemaByPathJS(path: string, skip_layout: boolean): any;
203
+ /**
204
+ * Get values from evaluated schema using multiple dotted paths
205
+ * @param pathsJson - JSON array of dotted paths
206
+ * @param skipLayout - Whether to skip layout resolution
207
+ * @param format - Return format (0=Nested, 1=Flat, 2=Array)
208
+ * @returns Data in specified format as JSON string
209
+ */
210
+ getEvaluatedSchemaByPaths(paths_json: string, skip_layout: boolean, format: number): string;
211
+ /**
212
+ * Get values from evaluated schema using multiple dotted paths (JS object)
213
+ * @param pathsJson - JSON array of dotted paths
214
+ * @param skipLayout - Whether to skip layout resolution
215
+ * @param format - Return format (0=Nested, 1=Flat, 2=Array)
216
+ * @returns Data in specified format as JavaScript object
217
+ */
218
+ getEvaluatedSchemaByPathsJS(paths_json: string, skip_layout: boolean, format: number): any;
219
+ /**
220
+ * Get a value from the schema using dotted path notation
221
+ *
222
+ * @param path - Dotted path to the value (e.g., "properties.field.value")
223
+ * @returns Value as JSON string or null if not found
224
+ */
225
+ getSchemaByPath(path: string): string | undefined;
226
+ /**
227
+ * Get a value from the schema using dotted path notation as JavaScript object
228
+ *
229
+ * @param path - Dotted path to the value (e.g., "properties.field.value")
230
+ * @returns Value as JavaScript object or null if not found
231
+ */
232
+ getSchemaByPathJS(path: string): any;
233
+ /**
234
+ * Get values from schema using multiple dotted paths
235
+ * @param pathsJson - JSON array of dotted paths
236
+ * @param format - Return format (0=Nested, 1=Flat, 2=Array)
237
+ * @returns Data in specified format as JSON string
238
+ */
239
+ getSchemaByPaths(paths_json: string, format: number): string;
240
+ /**
241
+ * Get values from schema using multiple dotted paths (JS object)
242
+ * @param pathsJson - JSON array of dotted paths
243
+ * @param format - Return format (0=Nested, 1=Flat, 2=Array)
244
+ * @returns Data in specified format as JavaScript object
245
+ */
246
+ getSchemaByPathsJS(paths_json: string, format: number): any;
247
+ /**
248
+ * Reload schema with new data
249
+ *
250
+ * @param schema - New JSON schema string
251
+ * @param context - Optional context data JSON string
252
+ * @param data - Optional initial data JSON string
253
+ */
254
+ reloadSchema(schema: string, context?: string | null, data?: string | null): void;
255
+ /**
256
+ * Reload schema from MessagePack-encoded bytes
257
+ *
258
+ * @param schemaMsgpack - MessagePack-encoded schema bytes (Uint8Array)
259
+ * @param context - Optional context data JSON string
260
+ * @param data - Optional initial data JSON string
261
+ */
262
+ reloadSchemaMsgpack(schema_msgpack: Uint8Array, context?: string | null, data?: string | null): void;
263
+ /**
264
+ * Reload schema from ParsedSchemaCache using a cache key
265
+ *
266
+ * @param cacheKey - Cache key to lookup in the global ParsedSchemaCache
267
+ * @param context - Optional context data JSON string
268
+ * @param data - Optional initial data JSON string
269
+ */
270
+ reloadSchemaFromCache(cache_key: string, context?: string | null, data?: string | null): void;
271
+ /**
272
+ * Get cache statistics
273
+ *
274
+ * @returns Cache statistics as JavaScript object with hits, misses, and entries
275
+ */
276
+ cacheStats(): any;
277
+ /**
278
+ * Clear the evaluation cache
279
+ */
280
+ clearCache(): void;
281
+ /**
282
+ * Get the number of cached entries
283
+ *
284
+ * @returns Number of cached entries
285
+ */
286
+ cacheLen(): number;
287
+ /**
288
+ * Enable evaluation caching
289
+ * Useful for reusing JSONEval instances with different data
290
+ */
291
+ enableCache(): void;
292
+ /**
293
+ * Disable evaluation caching
294
+ * Useful for web API usage where each request creates a new JSONEval instance
295
+ * Improves performance by skipping cache operations that have no benefit for single-use instances
296
+ */
297
+ disableCache(): void;
298
+ /**
299
+ * Check if evaluation caching is enabled
300
+ *
301
+ * @returns true if caching is enabled, false otherwise
302
+ */
303
+ isCacheEnabled(): boolean;
304
+ /**
305
+ * Resolve layout with optional evaluation
306
+ *
307
+ * @param evaluate - If true, runs evaluation before resolving layout
308
+ * @throws Error if resolve fails
309
+ */
310
+ resolveLayout(evaluate: boolean): void;
311
+ /**
312
+ * Evaluate a subform with data
313
+ *
314
+ * @param subformPath - Path to the subform (e.g., "#/riders")
315
+ * @param data - JSON data string for the subform
316
+ * @param context - Optional context data JSON string
317
+ * @throws Error if evaluation fails
318
+ */
319
+ evaluateSubform(subform_path: string, data: string, context?: string | null): void;
320
+ /**
321
+ * Validate subform data against its schema rules
322
+ *
323
+ * @param subformPath - Path to the subform
324
+ * @param data - JSON data string for the subform
325
+ * @param context - Optional context data JSON string
326
+ * @returns ValidationResult
327
+ */
328
+ validateSubform(subform_path: string, data: string, context?: string | null): ValidationResult;
329
+ /**
330
+ * Evaluate dependents in subform when a field changes
331
+ *
332
+ * @param subformPath - Path to the subform
333
+ * @param changedPath - Path of the field that changed
334
+ * @param data - Optional updated JSON data string
335
+ * @param context - Optional context data JSON string
336
+ * @returns Array of dependent change objects as JSON string
337
+ */
338
+ evaluateDependentsSubform(subform_path: string, changed_path: string, data?: string | null, context?: string | null): string;
339
+ /**
340
+ * Evaluate dependents in subform and return as JavaScript object
341
+ *
342
+ * @param subformPath - Path to the subform
343
+ * @param changedPath - Path of the field that changed
344
+ * @param data - Optional updated JSON data string
345
+ * @param context - Optional context data JSON string
346
+ * @returns Array of dependent change objects as JavaScript object
347
+ */
348
+ evaluateDependentsSubformJS(subform_path: string, changed_path: string, data?: string | null, context?: string | null): any;
349
+ /**
350
+ * Resolve layout for subform
351
+ *
352
+ * @param subformPath - Path to the subform
353
+ * @param evaluate - If true, runs evaluation before resolving layout
354
+ * @throws Error if resolve fails
355
+ */
356
+ resolveLayoutSubform(subform_path: string, evaluate: boolean): void;
357
+ /**
358
+ * Get evaluated schema from subform
359
+ *
360
+ * @param subformPath - Path to the subform
361
+ * @param resolveLayout - Whether to resolve layout
362
+ * @returns Evaluated schema as JSON string
363
+ */
364
+ getEvaluatedSchemaSubform(subform_path: string, resolve_layout: boolean): string;
365
+ /**
366
+ * Get evaluated schema from subform as JavaScript object
367
+ *
368
+ * @param subformPath - Path to the subform
369
+ * @param resolveLayout - Whether to resolve layout
370
+ * @returns Evaluated schema as JavaScript object
371
+ */
372
+ getEvaluatedSchemaSubformJS(subform_path: string, resolve_layout: boolean): any;
373
+ /**
374
+ * Get schema value from subform (all .value fields)
375
+ *
376
+ * @param subformPath - Path to the subform
377
+ * @returns Modified data as JavaScript object
378
+ */
379
+ getSchemaValueSubform(subform_path: string): any;
380
+ /**
381
+ * Get evaluated schema without $params from subform
382
+ *
383
+ * @param subformPath - Path to the subform
384
+ * @param resolveLayout - Whether to resolve layout
385
+ * @returns Evaluated schema as JSON string
386
+ */
387
+ getEvaluatedSchemaWithoutParamsSubform(subform_path: string, resolve_layout: boolean): string;
388
+ /**
389
+ * Get evaluated schema without $params from subform as JavaScript object
390
+ *
391
+ * @param subformPath - Path to the subform
392
+ * @param resolveLayout - Whether to resolve layout
393
+ * @returns Evaluated schema as JavaScript object
394
+ */
395
+ getEvaluatedSchemaWithoutParamsSubformJS(subform_path: string, resolve_layout: boolean): any;
396
+ /**
397
+ * Get evaluated schema by specific path from subform
398
+ *
399
+ * @param subformPath - Path to the subform
400
+ * @param schemaPath - Dotted path to the value within the subform
401
+ * @param skipLayout - Whether to skip layout resolution
402
+ * @returns Value as JSON string or null if not found
403
+ */
404
+ getEvaluatedSchemaByPathSubform(subform_path: string, schema_path: string, skip_layout: boolean): string | undefined;
405
+ /**
406
+ * Get evaluated schema by specific path from subform as JavaScript object
407
+ *
408
+ * @param subformPath - Path to the subform
409
+ * @param schemaPath - Dotted path to the value within the subform
410
+ * @param skipLayout - Whether to skip layout resolution
411
+ * @returns Value as JavaScript object or null if not found
412
+ */
413
+ getEvaluatedSchemaByPathSubformJS(subform_path: string, schema_path: string, skip_layout: boolean): any;
414
+ /**
415
+ * Get values from the evaluated schema of a subform using multiple dotted path notations (returns JSON string)
416
+ * @param subformPath - Path to the subform
417
+ * @param pathsJson - JSON array of dotted paths
418
+ * @param skipLayout - Whether to skip layout resolution
419
+ * @param format - Return format (0=Nested, 1=Flat, 2=Array)
420
+ * @returns Data in specified format as JSON string
421
+ */
422
+ getEvaluatedSchemaByPathsSubform(subform_path: string, paths_json: string, skip_layout: boolean, format: number): string;
423
+ /**
424
+ * Get values from the evaluated schema of a subform using multiple dotted path notations (returns JS object)
425
+ * @param subformPath - Path to the subform
426
+ * @param pathsJson - JSON array of dotted paths
427
+ * @param skipLayout - Whether to skip layout resolution
428
+ * @param format - Return format (0=Nested, 1=Flat, 2=Array)
429
+ * @returns Data in specified format as JavaScript object
430
+ */
431
+ getEvaluatedSchemaByPathsSubformJS(subform_path: string, paths_json: string, skip_layout: boolean, format: number): any;
432
+ /**
433
+ * Get schema by specific path from subform (returns JSON string)
434
+ * @param subformPath - Path to the subform
435
+ * @param schemaPath - Path within the subform
436
+ * @returns Value as JSON string or null if not found
437
+ */
438
+ getSchemaByPathSubform(subform_path: string, schema_path: string): string | undefined;
439
+ /**
440
+ * Get schema by specific path from subform (returns JS object)
441
+ * @param subformPath - Path to the subform
442
+ * @param schemaPath - Path within the subform
443
+ * @returns Value as JavaScript object or null if not found
444
+ */
445
+ getSchemaByPathSubformJS(subform_path: string, schema_path: string): any;
446
+ /**
447
+ * Get schema by multiple paths from subform
448
+ * @param subformPath - Path to the subform
449
+ * @param pathsJson - JSON array of dotted paths
450
+ * @param format - Return format (0=Nested, 1=Flat, 2=Array)
451
+ * @returns Data in specified format as JSON string
452
+ */
453
+ getSchemaByPathsSubform(subform_path: string, paths_json: string, format: number): string;
454
+ /**
455
+ * Get schema by multiple paths from subform (JS object)
456
+ * @param subformPath - Path to the subform
457
+ * @param pathsJson - JSON array of dotted paths
458
+ * @param format - Return format (0=Nested, 1=Flat, 2=Array)
459
+ * @returns Data in specified format as JavaScript object
460
+ */
461
+ getSchemaByPathsSubformJS(subform_path: string, paths_json: string, format: number): any;
462
+ /**
463
+ * Get list of available subform paths
464
+ *
465
+ * @returns Array of subform paths
466
+ */
467
+ getSubformPaths(): string[];
468
+ /**
469
+ * Check if a subform exists at the given path
470
+ *
471
+ * @param subformPath - Path to check
472
+ * @returns True if subform exists, false otherwise
473
+ */
474
+ hasSubform(subform_path: string): boolean;
475
+ }
476
+ /**
477
+ * Validation error for JavaScript
478
+ */
479
+ export class ValidationError {
480
+ private constructor();
481
+ free(): void;
482
+ [Symbol.dispose](): void;
483
+ readonly path: string;
484
+ readonly rule_type: string;
485
+ readonly message: string;
486
+ readonly code: string | undefined;
487
+ readonly pattern: string | undefined;
488
+ readonly field_value: string | undefined;
489
+ readonly data: any;
490
+ }
491
+ /**
492
+ * Validation result for JavaScript
493
+ */
494
+ export class ValidationResult {
495
+ private constructor();
496
+ free(): void;
497
+ [Symbol.dispose](): void;
498
+ toJSON(): any;
499
+ readonly has_error: boolean;
500
+ readonly errors: ValidationError[];
501
+ }
@@ -0,0 +1,5 @@
1
+ import * as wasm from "./json_eval_rs_bg.wasm";
2
+ export * from "./json_eval_rs_bg.js";
3
+ import { __wbg_set_wasm } from "./json_eval_rs_bg.js";
4
+ __wbg_set_wasm(wasm);
5
+ wasm.__wbindgen_start();