@cedar-policy/cedar-wasm 4.6.1 → 4.8.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/esm/cedar_wasm.d.ts +168 -168
- package/esm/cedar_wasm_bg.js +126 -126
- package/esm/cedar_wasm_bg.wasm +0 -0
- package/esm/cedar_wasm_bg.wasm.d.ts +6 -6
- package/esm/package.json +1 -1
- package/nodejs/cedar_wasm.d.ts +168 -168
- package/nodejs/cedar_wasm.js +118 -118
- package/nodejs/cedar_wasm_bg.wasm +0 -0
- package/nodejs/cedar_wasm_bg.wasm.d.ts +6 -6
- package/nodejs/package.json +1 -1
- package/package.json +1 -1
- package/web/cedar_wasm.d.ts +174 -174
- package/web/cedar_wasm.js +124 -132
- package/web/cedar_wasm_bg.wasm +0 -0
- package/web/cedar_wasm_bg.wasm.d.ts +6 -6
- package/web/package.json +1 -1
package/nodejs/cedar_wasm.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
let imports = {};
|
|
3
3
|
imports['__wbindgen_placeholder__'] = module.exports;
|
|
4
4
|
|
|
5
|
+
let WASM_VECTOR_LEN = 0;
|
|
6
|
+
|
|
5
7
|
let cachedUint8ArrayMemory0 = null;
|
|
6
8
|
|
|
7
9
|
function getUint8ArrayMemory0() {
|
|
@@ -11,36 +13,6 @@ function getUint8ArrayMemory0() {
|
|
|
11
13
|
return cachedUint8ArrayMemory0;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
15
|
-
|
|
16
|
-
cachedTextDecoder.decode();
|
|
17
|
-
|
|
18
|
-
function decodeText(ptr, len) {
|
|
19
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function getStringFromWasm0(ptr, len) {
|
|
23
|
-
ptr = ptr >>> 0;
|
|
24
|
-
return decodeText(ptr, len);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function addToExternrefTable0(obj) {
|
|
28
|
-
const idx = wasm.__externref_table_alloc();
|
|
29
|
-
wasm.__wbindgen_export_2.set(idx, obj);
|
|
30
|
-
return idx;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function handleError(f, args) {
|
|
34
|
-
try {
|
|
35
|
-
return f.apply(this, args);
|
|
36
|
-
} catch (e) {
|
|
37
|
-
const idx = addToExternrefTable0(e);
|
|
38
|
-
wasm.__wbindgen_exn_store(idx);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
let WASM_VECTOR_LEN = 0;
|
|
43
|
-
|
|
44
16
|
const cachedTextEncoder = new TextEncoder();
|
|
45
17
|
|
|
46
18
|
if (!('encodeInto' in cachedTextEncoder)) {
|
|
@@ -105,6 +77,34 @@ function getDataViewMemory0() {
|
|
|
105
77
|
}
|
|
106
78
|
return cachedDataViewMemory0;
|
|
107
79
|
}
|
|
80
|
+
|
|
81
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
82
|
+
|
|
83
|
+
cachedTextDecoder.decode();
|
|
84
|
+
|
|
85
|
+
function decodeText(ptr, len) {
|
|
86
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function getStringFromWasm0(ptr, len) {
|
|
90
|
+
ptr = ptr >>> 0;
|
|
91
|
+
return decodeText(ptr, len);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function addToExternrefTable0(obj) {
|
|
95
|
+
const idx = wasm.__externref_table_alloc();
|
|
96
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
97
|
+
return idx;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function handleError(f, args) {
|
|
101
|
+
try {
|
|
102
|
+
return f.apply(this, args);
|
|
103
|
+
} catch (e) {
|
|
104
|
+
const idx = addToExternrefTable0(e);
|
|
105
|
+
wasm.__wbindgen_exn_store(idx);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
108
|
/**
|
|
109
109
|
* @returns {string}
|
|
110
110
|
*/
|
|
@@ -159,6 +159,23 @@ exports.getValidRequestEnvsTemplate = function(t, s) {
|
|
|
159
159
|
return ret;
|
|
160
160
|
};
|
|
161
161
|
|
|
162
|
+
/**
|
|
163
|
+
* Preparse and cache a schema in thread-local storage
|
|
164
|
+
*
|
|
165
|
+
* # Errors
|
|
166
|
+
*
|
|
167
|
+
* Will return `Err` if the input cannot be parsed. Side-effect free on error.
|
|
168
|
+
* @param {string} schema_name
|
|
169
|
+
* @param {Schema} schema
|
|
170
|
+
* @returns {CheckParseAnswer}
|
|
171
|
+
*/
|
|
172
|
+
exports.preparseSchema = function(schema_name, schema) {
|
|
173
|
+
const ptr0 = passStringToWasm0(schema_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
174
|
+
const len0 = WASM_VECTOR_LEN;
|
|
175
|
+
const ret = wasm.preparseSchema(ptr0, len0, schema);
|
|
176
|
+
return ret;
|
|
177
|
+
};
|
|
178
|
+
|
|
162
179
|
/**
|
|
163
180
|
* Preparse and cache a policy set in thread-local storage
|
|
164
181
|
*
|
|
@@ -200,29 +217,52 @@ exports.statefulIsAuthorized = function(call) {
|
|
|
200
217
|
};
|
|
201
218
|
|
|
202
219
|
/**
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
|
|
220
|
+
* Get language version of Cedar
|
|
221
|
+
* @returns {string}
|
|
222
|
+
*/
|
|
223
|
+
exports.getCedarLangVersion = function() {
|
|
224
|
+
let deferred1_0;
|
|
225
|
+
let deferred1_1;
|
|
226
|
+
try {
|
|
227
|
+
const ret = wasm.getCedarLangVersion();
|
|
228
|
+
deferred1_0 = ret[0];
|
|
229
|
+
deferred1_1 = ret[1];
|
|
230
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
231
|
+
} finally {
|
|
232
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Apply the Cedar policy formatter to a policy set in the Cedar policy format
|
|
238
|
+
* @param {FormattingCall} call
|
|
239
|
+
* @returns {FormattingAnswer}
|
|
240
|
+
*/
|
|
241
|
+
exports.formatPolicies = function(call) {
|
|
242
|
+
const ret = wasm.formatPolicies(call);
|
|
243
|
+
return ret;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Parse a policy set and optionally validate it against a provided schema
|
|
206
248
|
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
* @param {
|
|
210
|
-
* @returns {
|
|
249
|
+
* This is the basic validator interface, using [`ValidationCall`] and
|
|
250
|
+
* [`ValidationAnswer`] types
|
|
251
|
+
* @param {ValidationCall} call
|
|
252
|
+
* @returns {ValidationAnswer}
|
|
211
253
|
*/
|
|
212
|
-
exports.
|
|
213
|
-
const
|
|
214
|
-
const len0 = WASM_VECTOR_LEN;
|
|
215
|
-
const ret = wasm.preparseSchema(ptr0, len0, schema);
|
|
254
|
+
exports.validate = function(call) {
|
|
255
|
+
const ret = wasm.validate(call);
|
|
216
256
|
return ret;
|
|
217
257
|
};
|
|
218
258
|
|
|
219
259
|
/**
|
|
220
|
-
* Check whether a
|
|
221
|
-
* @param {
|
|
260
|
+
* Check whether a context successfully parses.
|
|
261
|
+
* @param {ContextParsingCall} call
|
|
222
262
|
* @returns {CheckParseAnswer}
|
|
223
263
|
*/
|
|
224
|
-
exports.
|
|
225
|
-
const ret = wasm.
|
|
264
|
+
exports.checkParseContext = function(call) {
|
|
265
|
+
const ret = wasm.checkParseContext(call);
|
|
226
266
|
return ret;
|
|
227
267
|
};
|
|
228
268
|
|
|
@@ -247,22 +287,22 @@ exports.checkParsePolicySet = function(policies) {
|
|
|
247
287
|
};
|
|
248
288
|
|
|
249
289
|
/**
|
|
250
|
-
* Check whether a
|
|
251
|
-
* @param {
|
|
290
|
+
* Check whether a set of entities successfully parses.
|
|
291
|
+
* @param {EntitiesParsingCall} call
|
|
252
292
|
* @returns {CheckParseAnswer}
|
|
253
293
|
*/
|
|
254
|
-
exports.
|
|
255
|
-
const ret = wasm.
|
|
294
|
+
exports.checkParseEntities = function(call) {
|
|
295
|
+
const ret = wasm.checkParseEntities(call);
|
|
256
296
|
return ret;
|
|
257
297
|
};
|
|
258
298
|
|
|
259
299
|
/**
|
|
260
|
-
* Return the
|
|
261
|
-
* @param {
|
|
262
|
-
* @returns {
|
|
300
|
+
* Return the JSON representation of a schema.
|
|
301
|
+
* @param {Schema} schema
|
|
302
|
+
* @returns {SchemaToJsonAnswer}
|
|
263
303
|
*/
|
|
264
|
-
exports.
|
|
265
|
-
const ret = wasm.
|
|
304
|
+
exports.schemaToJson = function(schema) {
|
|
305
|
+
const ret = wasm.schemaToJson(schema);
|
|
266
306
|
return ret;
|
|
267
307
|
};
|
|
268
308
|
|
|
@@ -276,16 +316,6 @@ exports.schemaToText = function(schema) {
|
|
|
276
316
|
return ret;
|
|
277
317
|
};
|
|
278
318
|
|
|
279
|
-
/**
|
|
280
|
-
* Return the JSON representation of a template.
|
|
281
|
-
* @param {Template} template
|
|
282
|
-
* @returns {PolicyToJsonAnswer}
|
|
283
|
-
*/
|
|
284
|
-
exports.templateToJson = function(template) {
|
|
285
|
-
const ret = wasm.templateToJson(template);
|
|
286
|
-
return ret;
|
|
287
|
-
};
|
|
288
|
-
|
|
289
319
|
/**
|
|
290
320
|
* Takes a `PolicySet` represented as string and return the policies
|
|
291
321
|
* and templates split into vecs and sorted by id.
|
|
@@ -300,12 +330,12 @@ exports.policySetTextToParts = function(policyset_str) {
|
|
|
300
330
|
};
|
|
301
331
|
|
|
302
332
|
/**
|
|
303
|
-
* Return the
|
|
304
|
-
* @param {
|
|
305
|
-
* @returns {
|
|
333
|
+
* Return the Cedar (textual) representation of a policy.
|
|
334
|
+
* @param {Policy} policy
|
|
335
|
+
* @returns {PolicyToTextAnswer}
|
|
306
336
|
*/
|
|
307
|
-
exports.
|
|
308
|
-
const ret = wasm.
|
|
337
|
+
exports.policyToText = function(policy) {
|
|
338
|
+
const ret = wasm.policyToText(policy);
|
|
309
339
|
return ret;
|
|
310
340
|
};
|
|
311
341
|
|
|
@@ -330,61 +360,21 @@ exports.templateToText = function(template) {
|
|
|
330
360
|
};
|
|
331
361
|
|
|
332
362
|
/**
|
|
333
|
-
*
|
|
334
|
-
* @
|
|
335
|
-
|
|
336
|
-
exports.getCedarLangVersion = function() {
|
|
337
|
-
let deferred1_0;
|
|
338
|
-
let deferred1_1;
|
|
339
|
-
try {
|
|
340
|
-
const ret = wasm.getCedarLangVersion();
|
|
341
|
-
deferred1_0 = ret[0];
|
|
342
|
-
deferred1_1 = ret[1];
|
|
343
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
344
|
-
} finally {
|
|
345
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
346
|
-
}
|
|
347
|
-
};
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* Apply the Cedar policy formatter to a policy set in the Cedar policy format
|
|
351
|
-
* @param {FormattingCall} call
|
|
352
|
-
* @returns {FormattingAnswer}
|
|
353
|
-
*/
|
|
354
|
-
exports.formatPolicies = function(call) {
|
|
355
|
-
const ret = wasm.formatPolicies(call);
|
|
356
|
-
return ret;
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* Parse a policy set and optionally validate it against a provided schema
|
|
361
|
-
*
|
|
362
|
-
* This is the basic validator interface, using [`ValidationCall`] and
|
|
363
|
-
* [`ValidationAnswer`] types
|
|
364
|
-
* @param {ValidationCall} call
|
|
365
|
-
* @returns {ValidationAnswer}
|
|
363
|
+
* Return the JSON representation of a template.
|
|
364
|
+
* @param {Template} template
|
|
365
|
+
* @returns {PolicyToJsonAnswer}
|
|
366
366
|
*/
|
|
367
|
-
exports.
|
|
368
|
-
const ret = wasm.
|
|
367
|
+
exports.templateToJson = function(template) {
|
|
368
|
+
const ret = wasm.templateToJson(template);
|
|
369
369
|
return ret;
|
|
370
370
|
};
|
|
371
371
|
|
|
372
|
-
exports.
|
|
373
|
-
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
374
|
-
return ret;
|
|
375
|
-
}, arguments) };
|
|
376
|
-
|
|
377
|
-
exports.__wbg_stringify_b98c93d0a190446a = function() { return handleError(function (arg0) {
|
|
378
|
-
const ret = JSON.stringify(arg0);
|
|
379
|
-
return ret;
|
|
380
|
-
}, arguments) };
|
|
381
|
-
|
|
382
|
-
exports.__wbg_wbindgenisundefined_c4b71d073b92f3c5 = function(arg0) {
|
|
372
|
+
exports.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
|
|
383
373
|
const ret = arg0 === undefined;
|
|
384
374
|
return ret;
|
|
385
375
|
};
|
|
386
376
|
|
|
387
|
-
exports.
|
|
377
|
+
exports.__wbg___wbindgen_string_get_e4f06c90489ad01b = function(arg0, arg1) {
|
|
388
378
|
const obj = arg1;
|
|
389
379
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
390
380
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -393,12 +383,22 @@ exports.__wbg_wbindgenstringget_0f16a6ddddef376f = function(arg0, arg1) {
|
|
|
393
383
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
394
384
|
};
|
|
395
385
|
|
|
396
|
-
exports.
|
|
386
|
+
exports.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
|
|
397
387
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
398
388
|
};
|
|
399
389
|
|
|
390
|
+
exports.__wbg_parse_2a704d6b78abb2b8 = function() { return handleError(function (arg0, arg1) {
|
|
391
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
392
|
+
return ret;
|
|
393
|
+
}, arguments) };
|
|
394
|
+
|
|
395
|
+
exports.__wbg_stringify_b5fb28f6465d9c3e = function() { return handleError(function (arg0) {
|
|
396
|
+
const ret = JSON.stringify(arg0);
|
|
397
|
+
return ret;
|
|
398
|
+
}, arguments) };
|
|
399
|
+
|
|
400
400
|
exports.__wbindgen_init_externref_table = function() {
|
|
401
|
-
const table = wasm.
|
|
401
|
+
const table = wasm.__wbindgen_externrefs;
|
|
402
402
|
const offset = table.grow(4);
|
|
403
403
|
table.set(0, undefined);
|
|
404
404
|
table.set(offset + 0, undefined);
|
|
Binary file
|
|
@@ -9,11 +9,13 @@ export const isAuthorized: (a: any) => any;
|
|
|
9
9
|
export const preparsePolicySet: (a: number, b: number, c: any) => any;
|
|
10
10
|
export const preparseSchema: (a: number, b: number, c: any) => any;
|
|
11
11
|
export const statefulIsAuthorized: (a: any) => any;
|
|
12
|
+
export const getCedarLangVersion: () => [number, number];
|
|
13
|
+
export const formatPolicies: (a: any) => any;
|
|
14
|
+
export const validate: (a: any) => any;
|
|
12
15
|
export const checkParseContext: (a: any) => any;
|
|
13
16
|
export const checkParseEntities: (a: any) => any;
|
|
14
17
|
export const checkParsePolicySet: (a: any) => any;
|
|
15
18
|
export const checkParseSchema: (a: any) => any;
|
|
16
|
-
export const getCedarLangVersion: () => [number, number];
|
|
17
19
|
export const policySetTextToParts: (a: number, b: number) => any;
|
|
18
20
|
export const policyToJson: (a: any) => any;
|
|
19
21
|
export const policyToText: (a: any) => any;
|
|
@@ -21,12 +23,10 @@ export const schemaToJson: (a: any) => any;
|
|
|
21
23
|
export const schemaToText: (a: any) => any;
|
|
22
24
|
export const templateToJson: (a: any) => any;
|
|
23
25
|
export const templateToText: (a: any) => any;
|
|
24
|
-
export const formatPolicies: (a: any) => any;
|
|
25
|
-
export const validate: (a: any) => any;
|
|
26
|
-
export const __wbindgen_exn_store: (a: number) => void;
|
|
27
|
-
export const __externref_table_alloc: () => number;
|
|
28
|
-
export const __wbindgen_export_2: WebAssembly.Table;
|
|
29
26
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
30
27
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
28
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
29
|
+
export const __externref_table_alloc: () => number;
|
|
30
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
31
31
|
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
32
32
|
export const __wbindgen_start: () => void;
|
package/nodejs/package.json
CHANGED