@cedar-policy/cedar-wasm 4.8.0 → 4.9.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 +276 -242
- package/esm/cedar_wasm.js +5 -1
- package/esm/cedar_wasm_bg.js +255 -252
- package/esm/cedar_wasm_bg.wasm +0 -0
- package/esm/cedar_wasm_bg.wasm.d.ts +8 -7
- package/esm/package.json +5 -1
- package/nodejs/cedar_wasm.d.ts +276 -242
- package/nodejs/cedar_wasm.js +319 -285
- package/nodejs/cedar_wasm_bg.wasm +0 -0
- package/nodejs/cedar_wasm_bg.wasm.d.ts +8 -7
- package/nodejs/package.json +5 -1
- package/package.json +5 -1
- package/web/cedar_wasm.d.ts +335 -299
- package/web/cedar_wasm.js +303 -294
- package/web/cedar_wasm_bg.wasm +0 -0
- package/web/cedar_wasm_bg.wasm.d.ts +8 -7
- package/web/package.json +5 -1
package/esm/cedar_wasm_bg.js
CHANGED
|
@@ -1,128 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
let cachedUint8ArrayMemory0 = null;
|
|
10
|
-
|
|
11
|
-
function getUint8ArrayMemory0() {
|
|
12
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
13
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
14
|
-
}
|
|
15
|
-
return cachedUint8ArrayMemory0;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const cachedTextEncoder = new TextEncoder();
|
|
19
|
-
|
|
20
|
-
if (!('encodeInto' in cachedTextEncoder)) {
|
|
21
|
-
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
22
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
23
|
-
view.set(buf);
|
|
24
|
-
return {
|
|
25
|
-
read: arg.length,
|
|
26
|
-
written: buf.length
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
32
|
-
|
|
33
|
-
if (realloc === undefined) {
|
|
34
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
35
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
36
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
37
|
-
WASM_VECTOR_LEN = buf.length;
|
|
38
|
-
return ptr;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
let len = arg.length;
|
|
42
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
43
|
-
|
|
44
|
-
const mem = getUint8ArrayMemory0();
|
|
45
|
-
|
|
46
|
-
let offset = 0;
|
|
47
|
-
|
|
48
|
-
for (; offset < len; offset++) {
|
|
49
|
-
const code = arg.charCodeAt(offset);
|
|
50
|
-
if (code > 0x7F) break;
|
|
51
|
-
mem[ptr + offset] = code;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (offset !== len) {
|
|
55
|
-
if (offset !== 0) {
|
|
56
|
-
arg = arg.slice(offset);
|
|
57
|
-
}
|
|
58
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
59
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
60
|
-
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
61
|
-
|
|
62
|
-
offset += ret.written;
|
|
63
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
WASM_VECTOR_LEN = offset;
|
|
67
|
-
return ptr;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function isLikeNone(x) {
|
|
71
|
-
return x === undefined || x === null;
|
|
1
|
+
/**
|
|
2
|
+
* Check whether a context successfully parses.
|
|
3
|
+
* @param {ContextParsingCall} call
|
|
4
|
+
* @returns {CheckParseAnswer}
|
|
5
|
+
*/
|
|
6
|
+
export function checkParseContext(call) {
|
|
7
|
+
const ret = wasm.checkParseContext(call);
|
|
8
|
+
return ret;
|
|
72
9
|
}
|
|
73
10
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Check whether a set of entities successfully parses.
|
|
13
|
+
* @param {EntitiesParsingCall} call
|
|
14
|
+
* @returns {CheckParseAnswer}
|
|
15
|
+
*/
|
|
16
|
+
export function checkParseEntities(call) {
|
|
17
|
+
const ret = wasm.checkParseEntities(call);
|
|
18
|
+
return ret;
|
|
81
19
|
}
|
|
82
20
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
92
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
93
|
-
cachedTextDecoder.decode();
|
|
94
|
-
numBytesDecoded = len;
|
|
95
|
-
}
|
|
96
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
21
|
+
/**
|
|
22
|
+
* Check whether a policy set successfully parses.
|
|
23
|
+
* @param {PolicySet} policies
|
|
24
|
+
* @returns {CheckParseAnswer}
|
|
25
|
+
*/
|
|
26
|
+
export function checkParsePolicySet(policies) {
|
|
27
|
+
const ret = wasm.checkParsePolicySet(policies);
|
|
28
|
+
return ret;
|
|
97
29
|
}
|
|
98
30
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Check whether a schema successfully parses.
|
|
33
|
+
* @param {Schema} schema
|
|
34
|
+
* @returns {CheckParseAnswer}
|
|
35
|
+
*/
|
|
36
|
+
export function checkParseSchema(schema) {
|
|
37
|
+
const ret = wasm.checkParseSchema(schema);
|
|
38
|
+
return ret;
|
|
102
39
|
}
|
|
103
40
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Apply the Cedar policy formatter to a policy set in the Cedar policy format
|
|
43
|
+
* @param {FormattingCall} call
|
|
44
|
+
* @returns {FormattingAnswer}
|
|
45
|
+
*/
|
|
46
|
+
export function formatPolicies(call) {
|
|
47
|
+
const ret = wasm.formatPolicies(call);
|
|
48
|
+
return ret;
|
|
108
49
|
}
|
|
109
50
|
|
|
110
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Get language version of Cedar
|
|
53
|
+
* @returns {string}
|
|
54
|
+
*/
|
|
55
|
+
export function getCedarLangVersion() {
|
|
56
|
+
let deferred1_0;
|
|
57
|
+
let deferred1_1;
|
|
111
58
|
try {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
59
|
+
const ret = wasm.getCedarLangVersion();
|
|
60
|
+
deferred1_0 = ret[0];
|
|
61
|
+
deferred1_1 = ret[1];
|
|
62
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
63
|
+
} finally {
|
|
64
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
116
65
|
}
|
|
117
66
|
}
|
|
67
|
+
|
|
118
68
|
/**
|
|
119
69
|
* @returns {string}
|
|
120
70
|
*/
|
|
121
|
-
export function
|
|
71
|
+
export function getCedarSDKVersion() {
|
|
122
72
|
let deferred1_0;
|
|
123
73
|
let deferred1_1;
|
|
124
74
|
try {
|
|
125
|
-
const ret = wasm.
|
|
75
|
+
const ret = wasm.getCedarSDKVersion();
|
|
126
76
|
deferred1_0 = ret[0];
|
|
127
77
|
deferred1_1 = ret[1];
|
|
128
78
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
@@ -134,11 +84,11 @@ export function getCedarVersion() {
|
|
|
134
84
|
/**
|
|
135
85
|
* @returns {string}
|
|
136
86
|
*/
|
|
137
|
-
export function
|
|
87
|
+
export function getCedarVersion() {
|
|
138
88
|
let deferred1_0;
|
|
139
89
|
let deferred1_1;
|
|
140
90
|
try {
|
|
141
|
-
const ret = wasm.
|
|
91
|
+
const ret = wasm.getCedarVersion();
|
|
142
92
|
deferred1_0 = ret[0];
|
|
143
93
|
deferred1_1 = ret[1];
|
|
144
94
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
@@ -169,40 +119,6 @@ export function getValidRequestEnvsTemplate(t, s) {
|
|
|
169
119
|
return ret;
|
|
170
120
|
}
|
|
171
121
|
|
|
172
|
-
/**
|
|
173
|
-
* Preparse and cache a schema in thread-local storage
|
|
174
|
-
*
|
|
175
|
-
* # Errors
|
|
176
|
-
*
|
|
177
|
-
* Will return `Err` if the input cannot be parsed. Side-effect free on error.
|
|
178
|
-
* @param {string} schema_name
|
|
179
|
-
* @param {Schema} schema
|
|
180
|
-
* @returns {CheckParseAnswer}
|
|
181
|
-
*/
|
|
182
|
-
export function preparseSchema(schema_name, schema) {
|
|
183
|
-
const ptr0 = passStringToWasm0(schema_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
184
|
-
const len0 = WASM_VECTOR_LEN;
|
|
185
|
-
const ret = wasm.preparseSchema(ptr0, len0, schema);
|
|
186
|
-
return ret;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Preparse and cache a policy set in thread-local storage
|
|
191
|
-
*
|
|
192
|
-
* # Errors
|
|
193
|
-
*
|
|
194
|
-
* Will return `Err` if the input cannot be parsed. Side-effect free on error.
|
|
195
|
-
* @param {string} pset_id
|
|
196
|
-
* @param {PolicySet} policies
|
|
197
|
-
* @returns {CheckParseAnswer}
|
|
198
|
-
*/
|
|
199
|
-
export function preparsePolicySet(pset_id, policies) {
|
|
200
|
-
const ptr0 = passStringToWasm0(pset_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
201
|
-
const len0 = WASM_VECTOR_LEN;
|
|
202
|
-
const ret = wasm.preparsePolicySet(ptr0, len0, policies);
|
|
203
|
-
return ret;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
122
|
/**
|
|
207
123
|
* Basic interface, using [`AuthorizationCall`] and [`AuthorizationAnswer`] types
|
|
208
124
|
* @param {AuthorizationCall} call
|
|
@@ -214,95 +130,69 @@ export function isAuthorized(call) {
|
|
|
214
130
|
}
|
|
215
131
|
|
|
216
132
|
/**
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
* @param {StatefulAuthorizationCall} call
|
|
222
|
-
* @returns {AuthorizationAnswer}
|
|
223
|
-
*/
|
|
224
|
-
export function statefulIsAuthorized(call) {
|
|
225
|
-
const ret = wasm.statefulIsAuthorized(call);
|
|
226
|
-
return ret;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Get language version of Cedar
|
|
231
|
-
* @returns {string}
|
|
232
|
-
*/
|
|
233
|
-
export function getCedarLangVersion() {
|
|
234
|
-
let deferred1_0;
|
|
235
|
-
let deferred1_1;
|
|
236
|
-
try {
|
|
237
|
-
const ret = wasm.getCedarLangVersion();
|
|
238
|
-
deferred1_0 = ret[0];
|
|
239
|
-
deferred1_1 = ret[1];
|
|
240
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
241
|
-
} finally {
|
|
242
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Apply the Cedar policy formatter to a policy set in the Cedar policy format
|
|
248
|
-
* @param {FormattingCall} call
|
|
249
|
-
* @returns {FormattingAnswer}
|
|
250
|
-
*/
|
|
251
|
-
export function formatPolicies(call) {
|
|
252
|
-
const ret = wasm.formatPolicies(call);
|
|
253
|
-
return ret;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Parse a policy set and optionally validate it against a provided schema
|
|
258
|
-
*
|
|
259
|
-
* This is the basic validator interface, using [`ValidationCall`] and
|
|
260
|
-
* [`ValidationAnswer`] types
|
|
261
|
-
* @param {ValidationCall} call
|
|
262
|
-
* @returns {ValidationAnswer}
|
|
133
|
+
* Takes a `PolicySet` represented as string and return the policies
|
|
134
|
+
* and templates split into vecs and sorted by id.
|
|
135
|
+
* @param {string} policyset_str
|
|
136
|
+
* @returns {PolicySetTextToPartsAnswer}
|
|
263
137
|
*/
|
|
264
|
-
export function
|
|
265
|
-
const
|
|
138
|
+
export function policySetTextToParts(policyset_str) {
|
|
139
|
+
const ptr0 = passStringToWasm0(policyset_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
140
|
+
const len0 = WASM_VECTOR_LEN;
|
|
141
|
+
const ret = wasm.policySetTextToParts(ptr0, len0);
|
|
266
142
|
return ret;
|
|
267
143
|
}
|
|
268
144
|
|
|
269
145
|
/**
|
|
270
|
-
*
|
|
271
|
-
* @param {
|
|
272
|
-
* @returns {
|
|
146
|
+
* Return the JSON representation of a policy.
|
|
147
|
+
* @param {Policy} policy
|
|
148
|
+
* @returns {PolicyToJsonAnswer}
|
|
273
149
|
*/
|
|
274
|
-
export function
|
|
275
|
-
const ret = wasm.
|
|
150
|
+
export function policyToJson(policy) {
|
|
151
|
+
const ret = wasm.policyToJson(policy);
|
|
276
152
|
return ret;
|
|
277
153
|
}
|
|
278
154
|
|
|
279
155
|
/**
|
|
280
|
-
*
|
|
281
|
-
* @param {
|
|
282
|
-
* @returns {
|
|
156
|
+
* Return the Cedar (textual) representation of a policy.
|
|
157
|
+
* @param {Policy} policy
|
|
158
|
+
* @returns {PolicyToTextAnswer}
|
|
283
159
|
*/
|
|
284
|
-
export function
|
|
285
|
-
const ret = wasm.
|
|
160
|
+
export function policyToText(policy) {
|
|
161
|
+
const ret = wasm.policyToText(policy);
|
|
286
162
|
return ret;
|
|
287
163
|
}
|
|
288
164
|
|
|
289
165
|
/**
|
|
290
|
-
*
|
|
166
|
+
* Preparse and cache a policy set in thread-local storage
|
|
167
|
+
*
|
|
168
|
+
* # Errors
|
|
169
|
+
*
|
|
170
|
+
* Will return `Err` if the input cannot be parsed. Side-effect free on error.
|
|
171
|
+
* @param {string} pset_id
|
|
291
172
|
* @param {PolicySet} policies
|
|
292
173
|
* @returns {CheckParseAnswer}
|
|
293
174
|
*/
|
|
294
|
-
export function
|
|
295
|
-
const
|
|
175
|
+
export function preparsePolicySet(pset_id, policies) {
|
|
176
|
+
const ptr0 = passStringToWasm0(pset_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
177
|
+
const len0 = WASM_VECTOR_LEN;
|
|
178
|
+
const ret = wasm.preparsePolicySet(ptr0, len0, policies);
|
|
296
179
|
return ret;
|
|
297
180
|
}
|
|
298
181
|
|
|
299
182
|
/**
|
|
300
|
-
*
|
|
301
|
-
*
|
|
183
|
+
* Preparse and cache a schema in thread-local storage
|
|
184
|
+
*
|
|
185
|
+
* # Errors
|
|
186
|
+
*
|
|
187
|
+
* Will return `Err` if the input cannot be parsed. Side-effect free on error.
|
|
188
|
+
* @param {string} schema_name
|
|
189
|
+
* @param {Schema} schema
|
|
302
190
|
* @returns {CheckParseAnswer}
|
|
303
191
|
*/
|
|
304
|
-
export function
|
|
305
|
-
const
|
|
192
|
+
export function preparseSchema(schema_name, schema) {
|
|
193
|
+
const ptr0 = passStringToWasm0(schema_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
194
|
+
const len0 = WASM_VECTOR_LEN;
|
|
195
|
+
const ret = wasm.preparseSchema(ptr0, len0, schema);
|
|
306
196
|
return ret;
|
|
307
197
|
}
|
|
308
198
|
|
|
@@ -317,45 +207,52 @@ export function schemaToJson(schema) {
|
|
|
317
207
|
}
|
|
318
208
|
|
|
319
209
|
/**
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
210
|
+
* Convert a Cedar schema string to JSON format with resolved types.
|
|
211
|
+
*
|
|
212
|
+
* This function resolves ambiguous "`EntityOrCommon`" types to their specific
|
|
213
|
+
* Entity or `CommonType` classifications using the schema's type definitions.
|
|
214
|
+
* This is primarily meant to be used when working with schemas programmatically,
|
|
215
|
+
* for example when creating a schema building UI.
|
|
216
|
+
* @param {string} schema_str
|
|
217
|
+
* @returns {SchemaToJsonWithResolvedTypesAnswer}
|
|
323
218
|
*/
|
|
324
|
-
export function
|
|
325
|
-
const
|
|
219
|
+
export function schemaToJsonWithResolvedTypes(schema_str) {
|
|
220
|
+
const ptr0 = passStringToWasm0(schema_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
221
|
+
const len0 = WASM_VECTOR_LEN;
|
|
222
|
+
const ret = wasm.schemaToJsonWithResolvedTypes(ptr0, len0);
|
|
326
223
|
return ret;
|
|
327
224
|
}
|
|
328
225
|
|
|
329
226
|
/**
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
* @
|
|
333
|
-
* @returns {PolicySetTextToPartsAnswer}
|
|
227
|
+
* Return the Cedar (textual) representation of a schema.
|
|
228
|
+
* @param {Schema} schema
|
|
229
|
+
* @returns {SchemaToTextAnswer}
|
|
334
230
|
*/
|
|
335
|
-
export function
|
|
336
|
-
const
|
|
337
|
-
const len0 = WASM_VECTOR_LEN;
|
|
338
|
-
const ret = wasm.policySetTextToParts(ptr0, len0);
|
|
231
|
+
export function schemaToText(schema) {
|
|
232
|
+
const ret = wasm.schemaToText(schema);
|
|
339
233
|
return ret;
|
|
340
234
|
}
|
|
341
235
|
|
|
342
236
|
/**
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
*
|
|
237
|
+
* Stateful authorization using preparsed schemas and policy sets.
|
|
238
|
+
*
|
|
239
|
+
* This function works like [`is_authorized`] but retrieves schemas and policy sets
|
|
240
|
+
* from thread-local cache instead of parsing them on each call.
|
|
241
|
+
* @param {StatefulAuthorizationCall} call
|
|
242
|
+
* @returns {AuthorizationAnswer}
|
|
346
243
|
*/
|
|
347
|
-
export function
|
|
348
|
-
const ret = wasm.
|
|
244
|
+
export function statefulIsAuthorized(call) {
|
|
245
|
+
const ret = wasm.statefulIsAuthorized(call);
|
|
349
246
|
return ret;
|
|
350
247
|
}
|
|
351
248
|
|
|
352
249
|
/**
|
|
353
|
-
* Return the JSON representation of a
|
|
354
|
-
* @param {
|
|
250
|
+
* Return the JSON representation of a template.
|
|
251
|
+
* @param {Template} template
|
|
355
252
|
* @returns {PolicyToJsonAnswer}
|
|
356
253
|
*/
|
|
357
|
-
export function
|
|
358
|
-
const ret = wasm.
|
|
254
|
+
export function templateToJson(template) {
|
|
255
|
+
const ret = wasm.templateToJson(template);
|
|
359
256
|
return ret;
|
|
360
257
|
}
|
|
361
258
|
|
|
@@ -370,43 +267,40 @@ export function templateToText(template) {
|
|
|
370
267
|
}
|
|
371
268
|
|
|
372
269
|
/**
|
|
373
|
-
*
|
|
374
|
-
*
|
|
375
|
-
*
|
|
270
|
+
* Parse a policy set and optionally validate it against a provided schema
|
|
271
|
+
*
|
|
272
|
+
* This is the basic validator interface, using [`ValidationCall`] and
|
|
273
|
+
* [`ValidationAnswer`] types
|
|
274
|
+
* @param {ValidationCall} call
|
|
275
|
+
* @returns {ValidationAnswer}
|
|
376
276
|
*/
|
|
377
|
-
export function
|
|
378
|
-
const ret = wasm.
|
|
277
|
+
export function validate(call) {
|
|
278
|
+
const ret = wasm.validate(call);
|
|
379
279
|
return ret;
|
|
380
280
|
}
|
|
381
|
-
|
|
382
|
-
export function __wbg___wbindgen_is_undefined_2d472862bd29a478(arg0) {
|
|
281
|
+
export function __wbg___wbindgen_is_undefined_9e4d92534c42d778(arg0) {
|
|
383
282
|
const ret = arg0 === undefined;
|
|
384
283
|
return ret;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
export function __wbg___wbindgen_string_get_e4f06c90489ad01b(arg0, arg1) {
|
|
284
|
+
}
|
|
285
|
+
export function __wbg___wbindgen_string_get_72fb696202c56729(arg0, arg1) {
|
|
388
286
|
const obj = arg1;
|
|
389
287
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
390
288
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
391
289
|
var len1 = WASM_VECTOR_LEN;
|
|
392
290
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
393
291
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
export function __wbg___wbindgen_throw_b855445ff6a94295(arg0, arg1) {
|
|
292
|
+
}
|
|
293
|
+
export function __wbg___wbindgen_throw_be289d5034ed271b(arg0, arg1) {
|
|
397
294
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
export function __wbg_parse_2a704d6b78abb2b8() { return handleError(function (arg0, arg1) {
|
|
295
|
+
}
|
|
296
|
+
export function __wbg_parse_708461a1feddfb38() { return handleError(function (arg0, arg1) {
|
|
401
297
|
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
402
298
|
return ret;
|
|
403
|
-
}, arguments) }
|
|
404
|
-
|
|
405
|
-
export function __wbg_stringify_b5fb28f6465d9c3e() { return handleError(function (arg0) {
|
|
299
|
+
}, arguments); }
|
|
300
|
+
export function __wbg_stringify_8d1cc6ff383e8bae() { return handleError(function (arg0) {
|
|
406
301
|
const ret = JSON.stringify(arg0);
|
|
407
302
|
return ret;
|
|
408
|
-
}, arguments) }
|
|
409
|
-
|
|
303
|
+
}, arguments); }
|
|
410
304
|
export function __wbindgen_init_externref_table() {
|
|
411
305
|
const table = wasm.__wbindgen_externrefs;
|
|
412
306
|
const offset = table.grow(4);
|
|
@@ -415,6 +309,115 @@ export function __wbindgen_init_externref_table() {
|
|
|
415
309
|
table.set(offset + 1, null);
|
|
416
310
|
table.set(offset + 2, true);
|
|
417
311
|
table.set(offset + 3, false);
|
|
418
|
-
|
|
419
|
-
|
|
312
|
+
}
|
|
313
|
+
function addToExternrefTable0(obj) {
|
|
314
|
+
const idx = wasm.__externref_table_alloc();
|
|
315
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
316
|
+
return idx;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
let cachedDataViewMemory0 = null;
|
|
320
|
+
function getDataViewMemory0() {
|
|
321
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
322
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
323
|
+
}
|
|
324
|
+
return cachedDataViewMemory0;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function getStringFromWasm0(ptr, len) {
|
|
328
|
+
ptr = ptr >>> 0;
|
|
329
|
+
return decodeText(ptr, len);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
let cachedUint8ArrayMemory0 = null;
|
|
333
|
+
function getUint8ArrayMemory0() {
|
|
334
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
335
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
336
|
+
}
|
|
337
|
+
return cachedUint8ArrayMemory0;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
function handleError(f, args) {
|
|
341
|
+
try {
|
|
342
|
+
return f.apply(this, args);
|
|
343
|
+
} catch (e) {
|
|
344
|
+
const idx = addToExternrefTable0(e);
|
|
345
|
+
wasm.__wbindgen_exn_store(idx);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
420
348
|
|
|
349
|
+
function isLikeNone(x) {
|
|
350
|
+
return x === undefined || x === null;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
354
|
+
if (realloc === undefined) {
|
|
355
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
356
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
357
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
358
|
+
WASM_VECTOR_LEN = buf.length;
|
|
359
|
+
return ptr;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
let len = arg.length;
|
|
363
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
364
|
+
|
|
365
|
+
const mem = getUint8ArrayMemory0();
|
|
366
|
+
|
|
367
|
+
let offset = 0;
|
|
368
|
+
|
|
369
|
+
for (; offset < len; offset++) {
|
|
370
|
+
const code = arg.charCodeAt(offset);
|
|
371
|
+
if (code > 0x7F) break;
|
|
372
|
+
mem[ptr + offset] = code;
|
|
373
|
+
}
|
|
374
|
+
if (offset !== len) {
|
|
375
|
+
if (offset !== 0) {
|
|
376
|
+
arg = arg.slice(offset);
|
|
377
|
+
}
|
|
378
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
379
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
380
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
381
|
+
|
|
382
|
+
offset += ret.written;
|
|
383
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
WASM_VECTOR_LEN = offset;
|
|
387
|
+
return ptr;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
391
|
+
cachedTextDecoder.decode();
|
|
392
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
393
|
+
let numBytesDecoded = 0;
|
|
394
|
+
function decodeText(ptr, len) {
|
|
395
|
+
numBytesDecoded += len;
|
|
396
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
397
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
398
|
+
cachedTextDecoder.decode();
|
|
399
|
+
numBytesDecoded = len;
|
|
400
|
+
}
|
|
401
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
const cachedTextEncoder = new TextEncoder();
|
|
405
|
+
|
|
406
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
407
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
408
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
409
|
+
view.set(buf);
|
|
410
|
+
return {
|
|
411
|
+
read: arg.length,
|
|
412
|
+
written: buf.length
|
|
413
|
+
};
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
let WASM_VECTOR_LEN = 0;
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
let wasm;
|
|
421
|
+
export function __wbg_set_wasm(val) {
|
|
422
|
+
wasm = val;
|
|
423
|
+
}
|
package/esm/cedar_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -5,24 +5,25 @@ export const getCedarSDKVersion: () => [number, number];
|
|
|
5
5
|
export const getValidRequestEnvsPolicy: (a: any, b: any) => any;
|
|
6
6
|
export const getValidRequestEnvsTemplate: (a: any, b: any) => any;
|
|
7
7
|
export const getCedarVersion: () => [number, number];
|
|
8
|
-
export const isAuthorized: (a: any) => any;
|
|
9
|
-
export const preparsePolicySet: (a: number, b: number, c: any) => any;
|
|
10
|
-
export const preparseSchema: (a: number, b: number, c: any) => any;
|
|
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;
|
|
15
8
|
export const checkParseContext: (a: any) => any;
|
|
16
9
|
export const checkParseEntities: (a: any) => any;
|
|
17
10
|
export const checkParsePolicySet: (a: any) => any;
|
|
18
11
|
export const checkParseSchema: (a: any) => any;
|
|
12
|
+
export const validate: (a: any) => any;
|
|
19
13
|
export const policySetTextToParts: (a: number, b: number) => any;
|
|
20
14
|
export const policyToJson: (a: any) => any;
|
|
21
15
|
export const policyToText: (a: any) => any;
|
|
22
16
|
export const schemaToJson: (a: any) => any;
|
|
17
|
+
export const schemaToJsonWithResolvedTypes: (a: number, b: number) => any;
|
|
23
18
|
export const schemaToText: (a: any) => any;
|
|
24
19
|
export const templateToJson: (a: any) => any;
|
|
25
20
|
export const templateToText: (a: any) => any;
|
|
21
|
+
export const getCedarLangVersion: () => [number, number];
|
|
22
|
+
export const formatPolicies: (a: any) => any;
|
|
23
|
+
export const isAuthorized: (a: any) => any;
|
|
24
|
+
export const preparsePolicySet: (a: number, b: number, c: any) => any;
|
|
25
|
+
export const preparseSchema: (a: number, b: number, c: any) => any;
|
|
26
|
+
export const statefulIsAuthorized: (a: any) => any;
|
|
26
27
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
27
28
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
28
29
|
export const __wbindgen_exn_store: (a: number) => void;
|
package/esm/package.json
CHANGED
|
@@ -2,8 +2,12 @@
|
|
|
2
2
|
"name": "@cedar-policy/cedar-wasm",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "Wasm bindings and typescript types for Cedar lib",
|
|
5
|
-
"version": "4.
|
|
5
|
+
"version": "4.9.0",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/cedar-policy/cedar"
|
|
10
|
+
},
|
|
7
11
|
"files": [
|
|
8
12
|
"cedar_wasm_bg.wasm",
|
|
9
13
|
"cedar_wasm.js",
|