@goplasmatic/datalogic 4.0.8 → 4.0.12
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/bundler/datalogic_wasm.d.ts +26 -20
- package/bundler/datalogic_wasm.js +5 -1
- package/bundler/datalogic_wasm_bg.js +164 -172
- package/bundler/datalogic_wasm_bg.wasm +0 -0
- package/nodejs/datalogic_wasm.d.ts +26 -20
- package/nodejs/datalogic_wasm.js +183 -184
- package/nodejs/datalogic_wasm_bg.wasm +0 -0
- package/package.json +1 -1
- package/web/datalogic_wasm.d.ts +52 -46
- package/web/datalogic_wasm.js +219 -215
- package/web/datalogic_wasm_bg.wasm +0 -0
|
@@ -1,27 +1,33 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* A compiled JSONLogic rule that can be evaluated multiple times.
|
|
6
|
+
*
|
|
7
|
+
* Use this when you need to evaluate the same logic against different data,
|
|
8
|
+
* as it avoids re-parsing the logic on each evaluation.
|
|
9
|
+
*/
|
|
4
10
|
export class CompiledRule {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
11
|
+
free(): void;
|
|
12
|
+
[Symbol.dispose](): void;
|
|
13
|
+
/**
|
|
14
|
+
* Evaluate the compiled rule against data.
|
|
15
|
+
*
|
|
16
|
+
* # Arguments
|
|
17
|
+
* * `data` - JSON string containing the data to evaluate against
|
|
18
|
+
*
|
|
19
|
+
* # Returns
|
|
20
|
+
* JSON string result or error message
|
|
21
|
+
*/
|
|
22
|
+
evaluate(data: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Create a new CompiledRule from a JSONLogic expression.
|
|
25
|
+
*
|
|
26
|
+
* # Arguments
|
|
27
|
+
* * `logic` - JSON string containing the JSONLogic expression
|
|
28
|
+
* * `preserve_structure` - If true, preserves object structure for JSON templates with embedded JSONLogic
|
|
29
|
+
*/
|
|
30
|
+
constructor(logic: string, preserve_structure: boolean);
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
/**
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
/* @ts-self-types="./datalogic_wasm.d.ts" */
|
|
2
|
+
|
|
1
3
|
import * as wasm from "./datalogic_wasm_bg.wasm";
|
|
2
|
-
export * from "./datalogic_wasm_bg.js";
|
|
3
4
|
import { __wbg_set_wasm } from "./datalogic_wasm_bg.js";
|
|
4
5
|
__wbg_set_wasm(wasm);
|
|
5
6
|
wasm.__wbindgen_start();
|
|
7
|
+
export {
|
|
8
|
+
CompiledRule, evaluate, evaluate_with_trace, init
|
|
9
|
+
} from "./datalogic_wasm_bg.js";
|
|
@@ -1,127 +1,3 @@
|
|
|
1
|
-
let wasm;
|
|
2
|
-
export function __wbg_set_wasm(val) {
|
|
3
|
-
wasm = val;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
function addHeapObject(obj) {
|
|
7
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
8
|
-
const idx = heap_next;
|
|
9
|
-
heap_next = heap[idx];
|
|
10
|
-
|
|
11
|
-
heap[idx] = obj;
|
|
12
|
-
return idx;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function dropObject(idx) {
|
|
16
|
-
if (idx < 132) return;
|
|
17
|
-
heap[idx] = heap_next;
|
|
18
|
-
heap_next = idx;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
let cachedDataViewMemory0 = null;
|
|
22
|
-
function getDataViewMemory0() {
|
|
23
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
24
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
25
|
-
}
|
|
26
|
-
return cachedDataViewMemory0;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function getStringFromWasm0(ptr, len) {
|
|
30
|
-
ptr = ptr >>> 0;
|
|
31
|
-
return decodeText(ptr, len);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
let cachedUint8ArrayMemory0 = null;
|
|
35
|
-
function getUint8ArrayMemory0() {
|
|
36
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
37
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
38
|
-
}
|
|
39
|
-
return cachedUint8ArrayMemory0;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function getObject(idx) { return heap[idx]; }
|
|
43
|
-
|
|
44
|
-
let heap = new Array(128).fill(undefined);
|
|
45
|
-
heap.push(undefined, null, true, false);
|
|
46
|
-
|
|
47
|
-
let heap_next = heap.length;
|
|
48
|
-
|
|
49
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
50
|
-
if (realloc === undefined) {
|
|
51
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
52
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
53
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
54
|
-
WASM_VECTOR_LEN = buf.length;
|
|
55
|
-
return ptr;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
let len = arg.length;
|
|
59
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
60
|
-
|
|
61
|
-
const mem = getUint8ArrayMemory0();
|
|
62
|
-
|
|
63
|
-
let offset = 0;
|
|
64
|
-
|
|
65
|
-
for (; offset < len; offset++) {
|
|
66
|
-
const code = arg.charCodeAt(offset);
|
|
67
|
-
if (code > 0x7F) break;
|
|
68
|
-
mem[ptr + offset] = code;
|
|
69
|
-
}
|
|
70
|
-
if (offset !== len) {
|
|
71
|
-
if (offset !== 0) {
|
|
72
|
-
arg = arg.slice(offset);
|
|
73
|
-
}
|
|
74
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
75
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
76
|
-
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
77
|
-
|
|
78
|
-
offset += ret.written;
|
|
79
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
WASM_VECTOR_LEN = offset;
|
|
83
|
-
return ptr;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function takeObject(idx) {
|
|
87
|
-
const ret = getObject(idx);
|
|
88
|
-
dropObject(idx);
|
|
89
|
-
return ret;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
93
|
-
cachedTextDecoder.decode();
|
|
94
|
-
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
95
|
-
let numBytesDecoded = 0;
|
|
96
|
-
function decodeText(ptr, len) {
|
|
97
|
-
numBytesDecoded += len;
|
|
98
|
-
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
99
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
100
|
-
cachedTextDecoder.decode();
|
|
101
|
-
numBytesDecoded = len;
|
|
102
|
-
}
|
|
103
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const cachedTextEncoder = new TextEncoder();
|
|
107
|
-
|
|
108
|
-
if (!('encodeInto' in cachedTextEncoder)) {
|
|
109
|
-
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
110
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
111
|
-
view.set(buf);
|
|
112
|
-
return {
|
|
113
|
-
read: arg.length,
|
|
114
|
-
written: buf.length
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
let WASM_VECTOR_LEN = 0;
|
|
120
|
-
|
|
121
|
-
const CompiledRuleFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
122
|
-
? { register: () => {}, unregister: () => {} }
|
|
123
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_compiledrule_free(ptr >>> 0, 1));
|
|
124
|
-
|
|
125
1
|
/**
|
|
126
2
|
* A compiled JSONLogic rule that can be evaluated multiple times.
|
|
127
3
|
*
|
|
@@ -139,34 +15,6 @@ export class CompiledRule {
|
|
|
139
15
|
const ptr = this.__destroy_into_raw();
|
|
140
16
|
wasm.__wbg_compiledrule_free(ptr, 0);
|
|
141
17
|
}
|
|
142
|
-
/**
|
|
143
|
-
* Create a new CompiledRule from a JSONLogic expression.
|
|
144
|
-
*
|
|
145
|
-
* # Arguments
|
|
146
|
-
* * `logic` - JSON string containing the JSONLogic expression
|
|
147
|
-
* * `preserve_structure` - If true, preserves object structure for JSON templates with embedded JSONLogic
|
|
148
|
-
* @param {string} logic
|
|
149
|
-
* @param {boolean} preserve_structure
|
|
150
|
-
*/
|
|
151
|
-
constructor(logic, preserve_structure) {
|
|
152
|
-
try {
|
|
153
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
154
|
-
const ptr0 = passStringToWasm0(logic, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
155
|
-
const len0 = WASM_VECTOR_LEN;
|
|
156
|
-
wasm.compiledrule_new(retptr, ptr0, len0, preserve_structure);
|
|
157
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
158
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
159
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
160
|
-
if (r2) {
|
|
161
|
-
throw takeObject(r1);
|
|
162
|
-
}
|
|
163
|
-
this.__wbg_ptr = r0 >>> 0;
|
|
164
|
-
CompiledRuleFinalization.register(this, this.__wbg_ptr, this);
|
|
165
|
-
return this;
|
|
166
|
-
} finally {
|
|
167
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
18
|
/**
|
|
171
19
|
* Evaluate the compiled rule against data.
|
|
172
20
|
*
|
|
@@ -204,6 +52,34 @@ export class CompiledRule {
|
|
|
204
52
|
wasm.__wbindgen_export(deferred3_0, deferred3_1, 1);
|
|
205
53
|
}
|
|
206
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Create a new CompiledRule from a JSONLogic expression.
|
|
57
|
+
*
|
|
58
|
+
* # Arguments
|
|
59
|
+
* * `logic` - JSON string containing the JSONLogic expression
|
|
60
|
+
* * `preserve_structure` - If true, preserves object structure for JSON templates with embedded JSONLogic
|
|
61
|
+
* @param {string} logic
|
|
62
|
+
* @param {boolean} preserve_structure
|
|
63
|
+
*/
|
|
64
|
+
constructor(logic, preserve_structure) {
|
|
65
|
+
try {
|
|
66
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
67
|
+
const ptr0 = passStringToWasm0(logic, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
68
|
+
const len0 = WASM_VECTOR_LEN;
|
|
69
|
+
wasm.compiledrule_new(retptr, ptr0, len0, preserve_structure);
|
|
70
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
71
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
72
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
73
|
+
if (r2) {
|
|
74
|
+
throw takeObject(r1);
|
|
75
|
+
}
|
|
76
|
+
this.__wbg_ptr = r0 >>> 0;
|
|
77
|
+
CompiledRuleFinalization.register(this, this.__wbg_ptr, this);
|
|
78
|
+
return this;
|
|
79
|
+
} finally {
|
|
80
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
207
83
|
}
|
|
208
84
|
if (Symbol.dispose) CompiledRule.prototype[Symbol.dispose] = CompiledRule.prototype.free;
|
|
209
85
|
|
|
@@ -317,11 +193,9 @@ export function evaluate_with_trace(logic, data, preserve_structure) {
|
|
|
317
193
|
export function init() {
|
|
318
194
|
wasm.init();
|
|
319
195
|
}
|
|
320
|
-
|
|
321
|
-
export function __wbg___wbindgen_throw_dd24417ed36fc46e(arg0, arg1) {
|
|
196
|
+
export function __wbg___wbindgen_throw_be289d5034ed271b(arg0, arg1) {
|
|
322
197
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
323
|
-
}
|
|
324
|
-
|
|
198
|
+
}
|
|
325
199
|
export function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) {
|
|
326
200
|
let deferred0_0;
|
|
327
201
|
let deferred0_1;
|
|
@@ -332,37 +206,155 @@ export function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) {
|
|
|
332
206
|
} finally {
|
|
333
207
|
wasm.__wbindgen_export(deferred0_0, deferred0_1, 1);
|
|
334
208
|
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
export function __wbg_getTime_ad1e9878a735af08(arg0) {
|
|
209
|
+
}
|
|
210
|
+
export function __wbg_getTime_1e3cd1391c5c3995(arg0) {
|
|
338
211
|
const ret = getObject(arg0).getTime();
|
|
339
212
|
return ret;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
export function __wbg_new_0_23cedd11d9b40c9d() {
|
|
213
|
+
}
|
|
214
|
+
export function __wbg_new_0_73afc35eb544e539() {
|
|
343
215
|
const ret = new Date();
|
|
344
216
|
return addHeapObject(ret);
|
|
345
|
-
}
|
|
346
|
-
|
|
217
|
+
}
|
|
347
218
|
export function __wbg_new_8a6f238a6ece86ea() {
|
|
348
219
|
const ret = new Error();
|
|
349
220
|
return addHeapObject(ret);
|
|
350
|
-
}
|
|
351
|
-
|
|
221
|
+
}
|
|
352
222
|
export function __wbg_stack_0ed75d68575b0f3c(arg0, arg1) {
|
|
353
223
|
const ret = getObject(arg1).stack;
|
|
354
224
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
355
225
|
const len1 = WASM_VECTOR_LEN;
|
|
356
226
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
357
227
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
|
|
228
|
+
}
|
|
229
|
+
export function __wbindgen_cast_0000000000000001(arg0, arg1) {
|
|
361
230
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
362
231
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
363
232
|
return addHeapObject(ret);
|
|
364
|
-
}
|
|
365
|
-
|
|
233
|
+
}
|
|
366
234
|
export function __wbindgen_object_drop_ref(arg0) {
|
|
367
235
|
takeObject(arg0);
|
|
368
|
-
}
|
|
236
|
+
}
|
|
237
|
+
const CompiledRuleFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
238
|
+
? { register: () => {}, unregister: () => {} }
|
|
239
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_compiledrule_free(ptr >>> 0, 1));
|
|
240
|
+
|
|
241
|
+
function addHeapObject(obj) {
|
|
242
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
243
|
+
const idx = heap_next;
|
|
244
|
+
heap_next = heap[idx];
|
|
245
|
+
|
|
246
|
+
heap[idx] = obj;
|
|
247
|
+
return idx;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function dropObject(idx) {
|
|
251
|
+
if (idx < 132) return;
|
|
252
|
+
heap[idx] = heap_next;
|
|
253
|
+
heap_next = idx;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
let cachedDataViewMemory0 = null;
|
|
257
|
+
function getDataViewMemory0() {
|
|
258
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
259
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
260
|
+
}
|
|
261
|
+
return cachedDataViewMemory0;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function getStringFromWasm0(ptr, len) {
|
|
265
|
+
ptr = ptr >>> 0;
|
|
266
|
+
return decodeText(ptr, len);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
let cachedUint8ArrayMemory0 = null;
|
|
270
|
+
function getUint8ArrayMemory0() {
|
|
271
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
272
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
273
|
+
}
|
|
274
|
+
return cachedUint8ArrayMemory0;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function getObject(idx) { return heap[idx]; }
|
|
278
|
+
|
|
279
|
+
let heap = new Array(128).fill(undefined);
|
|
280
|
+
heap.push(undefined, null, true, false);
|
|
281
|
+
|
|
282
|
+
let heap_next = heap.length;
|
|
283
|
+
|
|
284
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
285
|
+
if (realloc === undefined) {
|
|
286
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
287
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
288
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
289
|
+
WASM_VECTOR_LEN = buf.length;
|
|
290
|
+
return ptr;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
let len = arg.length;
|
|
294
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
295
|
+
|
|
296
|
+
const mem = getUint8ArrayMemory0();
|
|
297
|
+
|
|
298
|
+
let offset = 0;
|
|
299
|
+
|
|
300
|
+
for (; offset < len; offset++) {
|
|
301
|
+
const code = arg.charCodeAt(offset);
|
|
302
|
+
if (code > 0x7F) break;
|
|
303
|
+
mem[ptr + offset] = code;
|
|
304
|
+
}
|
|
305
|
+
if (offset !== len) {
|
|
306
|
+
if (offset !== 0) {
|
|
307
|
+
arg = arg.slice(offset);
|
|
308
|
+
}
|
|
309
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
310
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
311
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
312
|
+
|
|
313
|
+
offset += ret.written;
|
|
314
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
WASM_VECTOR_LEN = offset;
|
|
318
|
+
return ptr;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function takeObject(idx) {
|
|
322
|
+
const ret = getObject(idx);
|
|
323
|
+
dropObject(idx);
|
|
324
|
+
return ret;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
328
|
+
cachedTextDecoder.decode();
|
|
329
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
330
|
+
let numBytesDecoded = 0;
|
|
331
|
+
function decodeText(ptr, len) {
|
|
332
|
+
numBytesDecoded += len;
|
|
333
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
334
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
335
|
+
cachedTextDecoder.decode();
|
|
336
|
+
numBytesDecoded = len;
|
|
337
|
+
}
|
|
338
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
const cachedTextEncoder = new TextEncoder();
|
|
342
|
+
|
|
343
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
344
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
345
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
346
|
+
view.set(buf);
|
|
347
|
+
return {
|
|
348
|
+
read: arg.length,
|
|
349
|
+
written: buf.length
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
let WASM_VECTOR_LEN = 0;
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
let wasm;
|
|
358
|
+
export function __wbg_set_wasm(val) {
|
|
359
|
+
wasm = val;
|
|
360
|
+
}
|
|
Binary file
|
|
@@ -1,27 +1,33 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* A compiled JSONLogic rule that can be evaluated multiple times.
|
|
6
|
+
*
|
|
7
|
+
* Use this when you need to evaluate the same logic against different data,
|
|
8
|
+
* as it avoids re-parsing the logic on each evaluation.
|
|
9
|
+
*/
|
|
4
10
|
export class CompiledRule {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
11
|
+
free(): void;
|
|
12
|
+
[Symbol.dispose](): void;
|
|
13
|
+
/**
|
|
14
|
+
* Evaluate the compiled rule against data.
|
|
15
|
+
*
|
|
16
|
+
* # Arguments
|
|
17
|
+
* * `data` - JSON string containing the data to evaluate against
|
|
18
|
+
*
|
|
19
|
+
* # Returns
|
|
20
|
+
* JSON string result or error message
|
|
21
|
+
*/
|
|
22
|
+
evaluate(data: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Create a new CompiledRule from a JSONLogic expression.
|
|
25
|
+
*
|
|
26
|
+
* # Arguments
|
|
27
|
+
* * `logic` - JSON string containing the JSONLogic expression
|
|
28
|
+
* * `preserve_structure` - If true, preserves object structure for JSON templates with embedded JSONLogic
|
|
29
|
+
*/
|
|
30
|
+
constructor(logic: string, preserve_structure: boolean);
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
/**
|