@json-eval-rs/node 0.0.42 → 0.0.45
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.d.ts +25 -0
- package/dist/index.js +39 -0
- package/package.json +8 -5
- package/pkg/json_eval_rs.d.ts +4 -4
- package/pkg/json_eval_rs.js +12 -12
- package/pkg/json_eval_rs_bg.wasm +0 -0
- package/index.d.ts +0 -136
- package/index.js +0 -45
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @json-eval-rs/node
|
|
3
|
+
* JSON Eval RS for Node.js and Server-Side Rendering (SSR)
|
|
4
|
+
*/
|
|
5
|
+
import { JSONEvalCore, JSONEvalOptions } from '@json-eval-rs/webcore';
|
|
6
|
+
/**
|
|
7
|
+
* JSONEval class with Node.js WASM pre-configured
|
|
8
|
+
*/
|
|
9
|
+
export declare class JSONEval extends JSONEvalCore {
|
|
10
|
+
constructor(options: JSONEvalOptions);
|
|
11
|
+
/**
|
|
12
|
+
* Create a new JSONEval instance from a cached ParsedSchema
|
|
13
|
+
* @param cacheKey - Cache key to lookup in ParsedSchemaCache
|
|
14
|
+
* @param context - Optional context data
|
|
15
|
+
* @param data - Optional initial data
|
|
16
|
+
* @returns New instance
|
|
17
|
+
*/
|
|
18
|
+
static fromCache(cacheKey: string, context?: any, data?: any): JSONEval;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get library version
|
|
22
|
+
*/
|
|
23
|
+
export declare function version(): string;
|
|
24
|
+
export * from '@json-eval-rs/webcore';
|
|
25
|
+
export default JSONEval;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @json-eval-rs/node
|
|
3
|
+
* JSON Eval RS for Node.js and Server-Side Rendering (SSR)
|
|
4
|
+
*/
|
|
5
|
+
import { JSONEvalCore, getVersion } from '@json-eval-rs/webcore';
|
|
6
|
+
// @ts-ignore - implicitly loaded, file exists after build
|
|
7
|
+
import * as wasm from '../pkg/json_eval_rs.js';
|
|
8
|
+
/**
|
|
9
|
+
* JSONEval class with Node.js WASM pre-configured
|
|
10
|
+
*/
|
|
11
|
+
export class JSONEval extends JSONEvalCore {
|
|
12
|
+
constructor(options) {
|
|
13
|
+
super(wasm, options);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Create a new JSONEval instance from a cached ParsedSchema
|
|
17
|
+
* @param cacheKey - Cache key to lookup in ParsedSchemaCache
|
|
18
|
+
* @param context - Optional context data
|
|
19
|
+
* @param data - Optional initial data
|
|
20
|
+
* @returns New instance
|
|
21
|
+
*/
|
|
22
|
+
static fromCache(cacheKey, context, data) {
|
|
23
|
+
return new JSONEval({
|
|
24
|
+
schema: cacheKey,
|
|
25
|
+
context,
|
|
26
|
+
data,
|
|
27
|
+
fromCache: true
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get library version
|
|
33
|
+
*/
|
|
34
|
+
export function version() {
|
|
35
|
+
return getVersion(wasm);
|
|
36
|
+
}
|
|
37
|
+
// Re-export types for convenience
|
|
38
|
+
export * from '@json-eval-rs/webcore';
|
|
39
|
+
export default JSONEval;
|
package/package.json
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@json-eval-rs/node",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.45",
|
|
4
4
|
"description": "JSON Eval RS for Node.js and Server-Side Rendering with ergonomic API",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"types": "index.d.ts",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"files": [
|
|
9
|
-
"
|
|
10
|
-
"index.d.ts",
|
|
9
|
+
"dist",
|
|
11
10
|
"pkg/*.js",
|
|
12
11
|
"pkg/*.wasm",
|
|
13
12
|
"pkg/*.d.ts"
|
|
14
13
|
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"prepack": "npm run build"
|
|
17
|
+
},
|
|
15
18
|
"keywords": [
|
|
16
19
|
"json",
|
|
17
20
|
"json-logic",
|
package/pkg/json_eval_rs.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Get the library version
|
|
5
|
-
*/
|
|
6
|
-
export function getVersion(): string;
|
|
7
3
|
/**
|
|
8
4
|
* Get library version (alias)
|
|
9
5
|
*/
|
|
@@ -12,6 +8,10 @@ export function version(): string;
|
|
|
12
8
|
* Initialize the library (sets up panic hook)
|
|
13
9
|
*/
|
|
14
10
|
export function init(): void;
|
|
11
|
+
/**
|
|
12
|
+
* Get the library version
|
|
13
|
+
*/
|
|
14
|
+
export function getVersion(): string;
|
|
15
15
|
/**
|
|
16
16
|
* WebAssembly wrapper for JSONEval
|
|
17
17
|
*/
|
package/pkg/json_eval_rs.js
CHANGED
|
@@ -208,10 +208,10 @@ function passArrayJsValueToWasm0(array, malloc) {
|
|
|
208
208
|
return ptr;
|
|
209
209
|
}
|
|
210
210
|
/**
|
|
211
|
-
* Get
|
|
211
|
+
* Get library version (alias)
|
|
212
212
|
* @returns {string}
|
|
213
213
|
*/
|
|
214
|
-
exports.
|
|
214
|
+
exports.version = function() {
|
|
215
215
|
let deferred1_0;
|
|
216
216
|
let deferred1_1;
|
|
217
217
|
try {
|
|
@@ -229,10 +229,17 @@ exports.getVersion = function() {
|
|
|
229
229
|
};
|
|
230
230
|
|
|
231
231
|
/**
|
|
232
|
-
*
|
|
232
|
+
* Initialize the library (sets up panic hook)
|
|
233
|
+
*/
|
|
234
|
+
exports.init = function() {
|
|
235
|
+
wasm.init();
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Get the library version
|
|
233
240
|
* @returns {string}
|
|
234
241
|
*/
|
|
235
|
-
exports.
|
|
242
|
+
exports.getVersion = function() {
|
|
236
243
|
let deferred1_0;
|
|
237
244
|
let deferred1_1;
|
|
238
245
|
try {
|
|
@@ -249,13 +256,6 @@ exports.version = function() {
|
|
|
249
256
|
}
|
|
250
257
|
};
|
|
251
258
|
|
|
252
|
-
/**
|
|
253
|
-
* Initialize the library (sets up panic hook)
|
|
254
|
-
*/
|
|
255
|
-
exports.init = function() {
|
|
256
|
-
wasm.init();
|
|
257
|
-
};
|
|
258
|
-
|
|
259
259
|
function passArray8ToWasm0(arg, malloc) {
|
|
260
260
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
261
261
|
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
@@ -2176,7 +2176,7 @@ exports.__wbg_getTime_6bb3f64e0f18f817 = function(arg0) {
|
|
|
2176
2176
|
return ret;
|
|
2177
2177
|
};
|
|
2178
2178
|
|
|
2179
|
-
exports.
|
|
2179
|
+
exports.__wbg_log_e4f27879ca4994b8 = function(arg0, arg1) {
|
|
2180
2180
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
2181
2181
|
};
|
|
2182
2182
|
|
package/pkg/json_eval_rs_bg.wasm
CHANGED
|
Binary file
|
package/index.d.ts
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @json-eval-rs/node - TypeScript definitions
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Get the library version
|
|
7
|
-
* @returns Version string
|
|
8
|
-
*/
|
|
9
|
-
export function version(): string;
|
|
10
|
-
|
|
11
|
-
export interface ValidationError {
|
|
12
|
-
path: string;
|
|
13
|
-
rule_type: string;
|
|
14
|
-
message: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface ValidationResult {
|
|
18
|
-
has_error: boolean;
|
|
19
|
-
errors: ValidationError[];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface JSONEvalOptions {
|
|
23
|
-
schema: any;
|
|
24
|
-
context?: any;
|
|
25
|
-
data?: any;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface ValidateOptions {
|
|
29
|
-
data: any;
|
|
30
|
-
context?: any;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface EvaluateOptions {
|
|
34
|
-
data: any;
|
|
35
|
-
context?: any;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface EvaluateDependentsOptions {
|
|
39
|
-
changedPath: string;
|
|
40
|
-
data?: any;
|
|
41
|
-
context?: any;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface GetEvaluatedSchemaOptions {
|
|
45
|
-
skipLayout?: boolean;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface GetValueByPathOptions {
|
|
49
|
-
path: string;
|
|
50
|
-
skipLayout?: boolean;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface ReloadSchemaOptions {
|
|
54
|
-
schema: any;
|
|
55
|
-
context?: any;
|
|
56
|
-
data?: any;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export interface CacheStats {
|
|
60
|
-
hits: number;
|
|
61
|
-
misses: number;
|
|
62
|
-
entries: number;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface EvaluateSubformOptions {
|
|
66
|
-
subformPath: string;
|
|
67
|
-
data: any;
|
|
68
|
-
context?: any;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface ValidateSubformOptions {
|
|
72
|
-
subformPath: string;
|
|
73
|
-
data: any;
|
|
74
|
-
context?: any;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export interface EvaluateDependentsSubformOptions {
|
|
78
|
-
subformPath: string;
|
|
79
|
-
changedPath: string;
|
|
80
|
-
data?: any;
|
|
81
|
-
context?: any;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export interface ResolveLayoutSubformOptions {
|
|
85
|
-
subformPath: string;
|
|
86
|
-
evaluate?: boolean;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export interface GetEvaluatedSchemaSubformOptions {
|
|
90
|
-
subformPath: string;
|
|
91
|
-
resolveLayout?: boolean;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export interface GetSchemaValueSubformOptions {
|
|
95
|
-
subformPath: string;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export interface GetEvaluatedSchemaByPathSubformOptions {
|
|
99
|
-
subformPath: string;
|
|
100
|
-
schemaPath: string;
|
|
101
|
-
skipLayout?: boolean;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export class JSONEval {
|
|
105
|
-
constructor(options: JSONEvalOptions);
|
|
106
|
-
init(): Promise<void>;
|
|
107
|
-
validate(options: ValidateOptions): Promise<ValidationResult>;
|
|
108
|
-
evaluate(options: EvaluateOptions): Promise<any>;
|
|
109
|
-
evaluateDependents(options: EvaluateDependentsOptions): Promise<any>;
|
|
110
|
-
getEvaluatedSchema(options?: GetEvaluatedSchemaOptions): Promise<any>;
|
|
111
|
-
getSchemaValue(): Promise<any>;
|
|
112
|
-
getEvaluatedSchemaWithoutParams(options?: GetEvaluatedSchemaOptions): Promise<any>;
|
|
113
|
-
getValueByPath(options: GetValueByPathOptions): Promise<any | null>;
|
|
114
|
-
reloadSchema(options: ReloadSchemaOptions): Promise<void>;
|
|
115
|
-
cacheStats(): Promise<CacheStats>;
|
|
116
|
-
clearCache(): Promise<void>;
|
|
117
|
-
cacheLen(): Promise<number>;
|
|
118
|
-
|
|
119
|
-
// Subform methods
|
|
120
|
-
evaluateSubform(options: EvaluateSubformOptions): Promise<void>;
|
|
121
|
-
validateSubform(options: ValidateSubformOptions): Promise<ValidationResult>;
|
|
122
|
-
evaluateDependentsSubform(options: EvaluateDependentsSubformOptions): Promise<any>;
|
|
123
|
-
resolveLayoutSubform(options: ResolveLayoutSubformOptions): Promise<void>;
|
|
124
|
-
getEvaluatedSchemaSubform(options: GetEvaluatedSchemaSubformOptions): Promise<any>;
|
|
125
|
-
getSchemaValueSubform(options: GetSchemaValueSubformOptions): Promise<any>;
|
|
126
|
-
getEvaluatedSchemaWithoutParamsSubform(options: GetEvaluatedSchemaSubformOptions): Promise<any>;
|
|
127
|
-
getEvaluatedSchemaByPathSubform(options: GetEvaluatedSchemaByPathSubformOptions): Promise<any | null>;
|
|
128
|
-
getSubformPaths(): Promise<string[]>;
|
|
129
|
-
hasSubform(subformPath: string): Promise<boolean>;
|
|
130
|
-
|
|
131
|
-
free(): void;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export function version(): string;
|
|
135
|
-
|
|
136
|
-
export default JSONEval;
|
package/index.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @json-eval-rs/node
|
|
3
|
-
* JSON Eval RS for Node.js and Server-Side Rendering (SSR)
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { JSONEvalCore, getVersion } from '@json-eval-rs/webcore';
|
|
7
|
-
import * as wasm from './pkg/json_eval_rs.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* JSONEval class with Node.js WASM pre-configured
|
|
11
|
-
*/
|
|
12
|
-
export class JSONEval extends JSONEvalCore {
|
|
13
|
-
constructor(options) {
|
|
14
|
-
super(wasm, options);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Create a new JSONEval instance from a cached ParsedSchema
|
|
19
|
-
* @param {string} cacheKey - Cache key to lookup in ParsedSchemaCache
|
|
20
|
-
* @param {object} [context] - Optional context data
|
|
21
|
-
* @param {object} [data] - Optional initial data
|
|
22
|
-
* @returns {JSONEval} New instance
|
|
23
|
-
*/
|
|
24
|
-
static fromCache(cacheKey, context, data) {
|
|
25
|
-
return new JSONEval({
|
|
26
|
-
schema: cacheKey,
|
|
27
|
-
context,
|
|
28
|
-
data,
|
|
29
|
-
fromCache: true
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Get library version
|
|
36
|
-
* @returns {string}
|
|
37
|
-
*/
|
|
38
|
-
export function version() {
|
|
39
|
-
return getVersion(wasm);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Re-export types for convenience
|
|
43
|
-
export * from '@json-eval-rs/webcore';
|
|
44
|
-
|
|
45
|
-
export default JSONEval;
|