@json-eval-rs/webcore 0.0.44 → 0.0.46

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/index.d.ts DELETED
@@ -1,379 +0,0 @@
1
- /**
2
- * @json-eval-rs/webcore - TypeScript definitions
3
- */
4
-
5
- /**
6
- * Get the library version from the WASM module
7
- * @param wasmModule - WASM module
8
- * @returns Version string
9
- */
10
- export function getVersion(wasmModule: any): string;
11
-
12
- /**
13
- * Return format for path-based methods
14
- */
15
- export enum ReturnFormat {
16
- /** Nested object preserving the path hierarchy (default) */
17
- Nested = 0,
18
- /** Flat object with dotted keys */
19
- Flat = 1,
20
- /** Array of values in the order of requested paths */
21
- Array = 2
22
- }
23
-
24
- /**
25
- * Validation error for a specific field
26
- */
27
- export interface ValidationError {
28
- /** Field path with the error */
29
- path: string;
30
- /** Type of validation rule that failed (e.g., 'required', 'min', 'max', 'pattern') */
31
- rule_type: string;
32
- /** Error message */
33
- message: string;
34
- /** Optional error code */
35
- code?: string;
36
- /** Optional regex pattern (for pattern validation errors) */
37
- pattern?: string;
38
- /** Optional field value that failed validation (as string) */
39
- field_value?: string;
40
- /** Optional additional data context for the error */
41
- data?: any;
42
- }
43
-
44
- /**
45
- * Result of validation operation
46
- */
47
- export interface ValidationResult {
48
- /** Whether any validation errors occurred */
49
- has_error: boolean;
50
- /** Array of validation errors */
51
- errors: ValidationError[];
52
- }
53
-
54
- /**
55
- * Dependent field change from evaluateDependents
56
- */
57
- export interface DependentChange {
58
- /** Path of the dependent field (in dot notation) */
59
- $ref: string;
60
- /** Schema definition of the changed field */
61
- $field?: any;
62
- /** Schema definition of the parent field */
63
- $parentField: any;
64
- /** Whether this is a transitive dependency */
65
- transitive: boolean;
66
- /** If true, the field was cleared */
67
- clear?: boolean;
68
- /** New value of the field (if changed) */
69
- value?: any;
70
- }
71
-
72
- /**
73
- * Options for creating a JSONEval instance
74
- */
75
- export interface JSONEvalOptions {
76
- /** JSON schema object */
77
- schema: any;
78
- /** Optional context data */
79
- context?: any;
80
- /** Optional initial data */
81
- data?: any;
82
- /** WASM module instance */
83
- wasmModule?: any;
84
- }
85
-
86
- /**
87
- * Options for validation
88
- */
89
- export interface ValidateOptions {
90
- /** JSON data to validate */
91
- data: any;
92
- /** Optional context data */
93
- context?: any;
94
- }
95
-
96
- /**
97
- * Options for evaluation
98
- */
99
- export interface EvaluateOptions {
100
- /** JSON data to evaluate */
101
- data: any;
102
- /** Optional context data */
103
- context?: any;
104
- /** Optional array of paths for selective evaluation */
105
- paths?: string[];
106
- }
107
-
108
- /**
109
- * Options for evaluating dependents
110
- */
111
- export interface EvaluateDependentsOptions {
112
- /** Array of field paths that changed */
113
- changedPaths: string[];
114
- /** Updated JSON data */
115
- data?: any;
116
- /** Optional context data */
117
- context?: any;
118
- /** If true, performs full evaluation after processing dependents */
119
- reEvaluate?: boolean;
120
- }
121
-
122
- /**
123
- * Options for getting evaluated schema
124
- */
125
- export interface GetEvaluatedSchemaOptions {
126
- /** Whether to skip layout resolution */
127
- skipLayout?: boolean;
128
- }
129
-
130
- /**
131
- * Options for getting a value by path from evaluated schema
132
- */
133
- export interface GetValueByPathOptions {
134
- /** Dotted path to the value */
135
- path: string;
136
- /** Whether to skip layout resolution */
137
- skipLayout?: boolean;
138
- }
139
-
140
- /**
141
- * Options for getting values by multiple paths from evaluated schema
142
- */
143
- export interface GetValueByPathsOptions {
144
- /** Array of dotted paths to retrieve */
145
- paths: string[];
146
- /** Whether to skip layout resolution */
147
- skipLayout?: boolean;
148
- /** Return format (Nested, Flat, or Array) */
149
- format?: ReturnFormat;
150
- }
151
-
152
- /**
153
- * Options for getting a value by path from schema
154
- */
155
- export interface GetSchemaByPathOptions {
156
- /** Dotted path to the value */
157
- path: string;
158
- }
159
-
160
- /**
161
- * Options for getting values by multiple paths from schema
162
- */
163
- export interface GetSchemaByPathsOptions {
164
- /** Array of dotted paths to retrieve */
165
- paths: string[];
166
- /** Return format (Nested, Flat, or Array) */
167
- format?: ReturnFormat;
168
- }
169
-
170
- /**
171
- * Options for reloading schema
172
- */
173
- export interface ReloadSchemaOptions {
174
- /** New JSON schema */
175
- schema: any;
176
- /** Optional new context */
177
- context?: any;
178
- /** Optional new data */
179
- data?: any;
180
- }
181
-
182
- /**
183
- * Cache statistics
184
- */
185
- export interface CacheStats {
186
- /** Number of cache hits */
187
- hits: number;
188
- /** Number of cache misses */
189
- misses: number;
190
- /** Number of cached entries */
191
- entries: number;
192
- }
193
-
194
- /**
195
- * Options for evaluating a subform
196
- */
197
- export interface EvaluateSubformOptions {
198
- /** Path to the subform */
199
- subformPath: string;
200
- /** JSON data to evaluate */
201
- data: any;
202
- /** Optional context data */
203
- context?: any;
204
- /** Optional array of paths to evaluate */
205
- paths?: string[];
206
- }
207
-
208
- /**
209
- * Options for validating a subform
210
- */
211
- export interface ValidateSubformOptions {
212
- /** Path to the subform */
213
- subformPath: string;
214
- /** JSON data to validate */
215
- data: any;
216
- /** Optional context data */
217
- context?: any;
218
- }
219
-
220
- /**
221
- * Options for evaluating dependents in a subform
222
- */
223
- export interface EvaluateDependentsSubformOptions {
224
- /** Path to the subform */
225
- subformPath: string;
226
- /** Array of field paths that changed */
227
- changedPaths: string[];
228
- /** Updated JSON data */
229
- data?: any;
230
- /** Optional context data */
231
- context?: any;
232
- /** If true, performs full evaluation after processing dependents */
233
- reEvaluate?: boolean;
234
- }
235
-
236
- /**
237
- * Options for resolving layout in a subform
238
- */
239
- export interface ResolveLayoutSubformOptions {
240
- /** Path to the subform */
241
- subformPath: string;
242
- /** Whether to evaluate after resolving layout */
243
- evaluate?: boolean;
244
- }
245
-
246
- /**
247
- * Options for getting evaluated schema from a subform
248
- */
249
- export interface GetEvaluatedSchemaSubformOptions {
250
- /** Path to the subform */
251
- subformPath: string;
252
- /** Whether to resolve layout */
253
- resolveLayout?: boolean;
254
- }
255
-
256
- /**
257
- * Options for getting schema value from a subform
258
- */
259
- export interface GetSchemaValueSubformOptions {
260
- /** Path to the subform */
261
- subformPath: string;
262
- }
263
-
264
- /**
265
- * Options for getting evaluated schema by path from a subform
266
- */
267
- export interface GetEvaluatedSchemaByPathSubformOptions {
268
- /** Path to the subform */
269
- subformPath: string;
270
- /** Dotted path to the value within the subform */
271
- schemaPath: string;
272
- /** Whether to skip layout resolution */
273
- skipLayout?: boolean;
274
- }
275
-
276
- /**
277
- * Options for getting evaluated schema by multiple paths from a subform
278
- */
279
- export interface GetEvaluatedSchemaByPathsSubformOptions {
280
- /** Path to the subform */
281
- subformPath: string;
282
- /** Array of dotted paths to retrieve within the subform */
283
- schemaPaths: string[];
284
- /** Whether to skip layout resolution */
285
- skipLayout?: boolean;
286
- /** Return format (Nested, Flat, or Array) */
287
- format?: ReturnFormat;
288
- }
289
-
290
- /**
291
- * Options for getting schema by path from a subform
292
- */
293
- export interface GetSchemaByPathSubformOptions {
294
- /** Path to the subform */
295
- subformPath: string;
296
- /** Dotted path to the value within the subform */
297
- schemaPath: string;
298
- }
299
-
300
- /**
301
- * Options for getting schema by multiple paths from a subform
302
- */
303
- export interface GetSchemaByPathsSubformOptions {
304
- /** Path to the subform */
305
- subformPath: string;
306
- /** Array of dotted paths to retrieve within the subform */
307
- schemaPaths: string[];
308
- /** Return format (Nested, Flat, or Array) */
309
- format?: ReturnFormat;
310
- }
311
-
312
- /**
313
- * Options for compiling and running logic
314
- */
315
- export interface CompileAndRunLogicOptions {
316
- /** Logic expression as string or object */
317
- logicStr: string | object;
318
- /** Optional data context */
319
- data?: any;
320
- /** Optional context data */
321
- context?: any;
322
- }
323
-
324
- export class JSONEval {
325
- constructor(options: JSONEvalOptions);
326
- static fromCache(cacheKey: string, context?: any, data?: any): JSONEval;
327
- init(): Promise<void>;
328
- validate(options: ValidateOptions): Promise<ValidationResult>;
329
- evaluate(options: EvaluateOptions): Promise<any>;
330
- evaluateDependents(options: EvaluateDependentsOptions): Promise<DependentChange[]>;
331
- compileAndRunLogic(options: CompileAndRunLogicOptions): Promise<any>;
332
- compileLogic(logicStr: string | object): Promise<number>;
333
- runLogic(logicId: number, data?: any, context?: any): Promise<any>;
334
- getEvaluatedSchema(options?: GetEvaluatedSchemaOptions): Promise<any>;
335
- getSchemaValue(): Promise<any>;
336
- getEvaluatedSchemaWithoutParams(options?: GetEvaluatedSchemaOptions): Promise<any>;
337
- getValueByPath(options: GetValueByPathOptions): Promise<any | null>;
338
- getEvaluatedSchemaByPath(options: GetValueByPathOptions): Promise<any | null>;
339
- getEvaluatedSchemaByPaths(options: GetValueByPathsOptions): Promise<any>;
340
- getSchemaByPath(options: GetSchemaByPathOptions): Promise<any | null>;
341
- getSchemaByPaths(options: GetSchemaByPathsOptions): Promise<any>;
342
- reloadSchema(options: ReloadSchemaOptions): Promise<void>;
343
- reloadSchemaMsgpack(schemaMsgpack: Uint8Array, context?: any, data?: any): Promise<void>;
344
- reloadSchemaFromCache(cacheKey: string, context?: any, data?: any): Promise<void>;
345
- cacheStats(): Promise<CacheStats>;
346
- clearCache(): Promise<void>;
347
- cacheLen(): Promise<number>;
348
- enableCache(): Promise<void>;
349
- disableCache(): Promise<void>;
350
- isCacheEnabled(): boolean;
351
-
352
- // Subform methods
353
- evaluateSubform(options: EvaluateSubformOptions): Promise<void>;
354
- validateSubform(options: ValidateSubformOptions): Promise<ValidationResult>;
355
- evaluateDependentsSubform(options: EvaluateDependentsSubformOptions): Promise<DependentChange[]>;
356
- resolveLayoutSubform(options: ResolveLayoutSubformOptions): Promise<void>;
357
- getEvaluatedSchemaSubform(options: GetEvaluatedSchemaSubformOptions): Promise<any>;
358
- getSchemaValueSubform(options: GetSchemaValueSubformOptions): Promise<any>;
359
- getEvaluatedSchemaWithoutParamsSubform(options: GetEvaluatedSchemaSubformOptions): Promise<any>;
360
- getEvaluatedSchemaByPathSubform(options: GetEvaluatedSchemaByPathSubformOptions): Promise<any | null>;
361
- getEvaluatedSchemaByPathsSubform(options: GetEvaluatedSchemaByPathsSubformOptions): Promise<any>;
362
- getSchemaByPathSubform(options: GetSchemaByPathSubformOptions): Promise<any | null>;
363
- getSchemaByPathsSubform(options: GetSchemaByPathsSubformOptions): Promise<any>;
364
- getSubformPaths(): Promise<string[]>;
365
- hasSubform(subformPath: string): Promise<boolean>;
366
-
367
- /**
368
- * Set timezone offset for datetime operations (TODAY, NOW)
369
- * @param offsetMinutes - Timezone offset in minutes from UTC (e.g., 420 for UTC+7, -300 for UTC-5)
370
- * Pass null or undefined to reset to UTC
371
- */
372
- setTimezoneOffset(offsetMinutes: number | null | undefined): void;
373
-
374
- free(): void;
375
- }
376
-
377
- export function version(wasmModule?: any): Promise<string>;
378
-
379
- export default JSONEval;