@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/web/cedar_wasm.js
CHANGED
|
@@ -1,124 +1,80 @@
|
|
|
1
|
-
|
|
1
|
+
/* @ts-self-types="./cedar_wasm.d.ts" */
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return cachedUint8ArrayMemory0;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const cachedTextEncoder = new TextEncoder();
|
|
15
|
-
|
|
16
|
-
if (!('encodeInto' in cachedTextEncoder)) {
|
|
17
|
-
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
18
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
19
|
-
view.set(buf);
|
|
20
|
-
return {
|
|
21
|
-
read: arg.length,
|
|
22
|
-
written: buf.length
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
28
|
-
|
|
29
|
-
if (realloc === undefined) {
|
|
30
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
31
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
32
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
33
|
-
WASM_VECTOR_LEN = buf.length;
|
|
34
|
-
return ptr;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
let len = arg.length;
|
|
38
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
39
|
-
|
|
40
|
-
const mem = getUint8ArrayMemory0();
|
|
41
|
-
|
|
42
|
-
let offset = 0;
|
|
43
|
-
|
|
44
|
-
for (; offset < len; offset++) {
|
|
45
|
-
const code = arg.charCodeAt(offset);
|
|
46
|
-
if (code > 0x7F) break;
|
|
47
|
-
mem[ptr + offset] = code;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (offset !== len) {
|
|
51
|
-
if (offset !== 0) {
|
|
52
|
-
arg = arg.slice(offset);
|
|
53
|
-
}
|
|
54
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
55
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
56
|
-
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
57
|
-
|
|
58
|
-
offset += ret.written;
|
|
59
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
WASM_VECTOR_LEN = offset;
|
|
63
|
-
return ptr;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function isLikeNone(x) {
|
|
67
|
-
return x === undefined || x === null;
|
|
3
|
+
/**
|
|
4
|
+
* Check whether a context successfully parses.
|
|
5
|
+
* @param {ContextParsingCall} call
|
|
6
|
+
* @returns {CheckParseAnswer}
|
|
7
|
+
*/
|
|
8
|
+
export function checkParseContext(call) {
|
|
9
|
+
const ret = wasm.checkParseContext(call);
|
|
10
|
+
return ret;
|
|
68
11
|
}
|
|
69
12
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Check whether a set of entities successfully parses.
|
|
15
|
+
* @param {EntitiesParsingCall} call
|
|
16
|
+
* @returns {CheckParseAnswer}
|
|
17
|
+
*/
|
|
18
|
+
export function checkParseEntities(call) {
|
|
19
|
+
const ret = wasm.checkParseEntities(call);
|
|
20
|
+
return ret;
|
|
77
21
|
}
|
|
78
22
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
88
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
89
|
-
cachedTextDecoder.decode();
|
|
90
|
-
numBytesDecoded = len;
|
|
91
|
-
}
|
|
92
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
23
|
+
/**
|
|
24
|
+
* Check whether a policy set successfully parses.
|
|
25
|
+
* @param {PolicySet} policies
|
|
26
|
+
* @returns {CheckParseAnswer}
|
|
27
|
+
*/
|
|
28
|
+
export function checkParsePolicySet(policies) {
|
|
29
|
+
const ret = wasm.checkParsePolicySet(policies);
|
|
30
|
+
return ret;
|
|
93
31
|
}
|
|
94
32
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Check whether a schema successfully parses.
|
|
35
|
+
* @param {Schema} schema
|
|
36
|
+
* @returns {CheckParseAnswer}
|
|
37
|
+
*/
|
|
38
|
+
export function checkParseSchema(schema) {
|
|
39
|
+
const ret = wasm.checkParseSchema(schema);
|
|
40
|
+
return ret;
|
|
98
41
|
}
|
|
99
42
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Apply the Cedar policy formatter to a policy set in the Cedar policy format
|
|
45
|
+
* @param {FormattingCall} call
|
|
46
|
+
* @returns {FormattingAnswer}
|
|
47
|
+
*/
|
|
48
|
+
export function formatPolicies(call) {
|
|
49
|
+
const ret = wasm.formatPolicies(call);
|
|
50
|
+
return ret;
|
|
104
51
|
}
|
|
105
52
|
|
|
106
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Get language version of Cedar
|
|
55
|
+
* @returns {string}
|
|
56
|
+
*/
|
|
57
|
+
export function getCedarLangVersion() {
|
|
58
|
+
let deferred1_0;
|
|
59
|
+
let deferred1_1;
|
|
107
60
|
try {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
61
|
+
const ret = wasm.getCedarLangVersion();
|
|
62
|
+
deferred1_0 = ret[0];
|
|
63
|
+
deferred1_1 = ret[1];
|
|
64
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
65
|
+
} finally {
|
|
66
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
112
67
|
}
|
|
113
68
|
}
|
|
69
|
+
|
|
114
70
|
/**
|
|
115
71
|
* @returns {string}
|
|
116
72
|
*/
|
|
117
|
-
export function
|
|
73
|
+
export function getCedarSDKVersion() {
|
|
118
74
|
let deferred1_0;
|
|
119
75
|
let deferred1_1;
|
|
120
76
|
try {
|
|
121
|
-
const ret = wasm.
|
|
77
|
+
const ret = wasm.getCedarSDKVersion();
|
|
122
78
|
deferred1_0 = ret[0];
|
|
123
79
|
deferred1_1 = ret[1];
|
|
124
80
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
@@ -130,11 +86,11 @@ export function getCedarVersion() {
|
|
|
130
86
|
/**
|
|
131
87
|
* @returns {string}
|
|
132
88
|
*/
|
|
133
|
-
export function
|
|
89
|
+
export function getCedarVersion() {
|
|
134
90
|
let deferred1_0;
|
|
135
91
|
let deferred1_1;
|
|
136
92
|
try {
|
|
137
|
-
const ret = wasm.
|
|
93
|
+
const ret = wasm.getCedarVersion();
|
|
138
94
|
deferred1_0 = ret[0];
|
|
139
95
|
deferred1_1 = ret[1];
|
|
140
96
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
@@ -165,6 +121,66 @@ export function getValidRequestEnvsTemplate(t, s) {
|
|
|
165
121
|
return ret;
|
|
166
122
|
}
|
|
167
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Basic interface, using [`AuthorizationCall`] and [`AuthorizationAnswer`] types
|
|
126
|
+
* @param {AuthorizationCall} call
|
|
127
|
+
* @returns {AuthorizationAnswer}
|
|
128
|
+
*/
|
|
129
|
+
export function isAuthorized(call) {
|
|
130
|
+
const ret = wasm.isAuthorized(call);
|
|
131
|
+
return ret;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Takes a `PolicySet` represented as string and return the policies
|
|
136
|
+
* and templates split into vecs and sorted by id.
|
|
137
|
+
* @param {string} policyset_str
|
|
138
|
+
* @returns {PolicySetTextToPartsAnswer}
|
|
139
|
+
*/
|
|
140
|
+
export function policySetTextToParts(policyset_str) {
|
|
141
|
+
const ptr0 = passStringToWasm0(policyset_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
142
|
+
const len0 = WASM_VECTOR_LEN;
|
|
143
|
+
const ret = wasm.policySetTextToParts(ptr0, len0);
|
|
144
|
+
return ret;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Return the JSON representation of a policy.
|
|
149
|
+
* @param {Policy} policy
|
|
150
|
+
* @returns {PolicyToJsonAnswer}
|
|
151
|
+
*/
|
|
152
|
+
export function policyToJson(policy) {
|
|
153
|
+
const ret = wasm.policyToJson(policy);
|
|
154
|
+
return ret;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Return the Cedar (textual) representation of a policy.
|
|
159
|
+
* @param {Policy} policy
|
|
160
|
+
* @returns {PolicyToTextAnswer}
|
|
161
|
+
*/
|
|
162
|
+
export function policyToText(policy) {
|
|
163
|
+
const ret = wasm.policyToText(policy);
|
|
164
|
+
return ret;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Preparse and cache a policy set in thread-local storage
|
|
169
|
+
*
|
|
170
|
+
* # Errors
|
|
171
|
+
*
|
|
172
|
+
* Will return `Err` if the input cannot be parsed. Side-effect free on error.
|
|
173
|
+
* @param {string} pset_id
|
|
174
|
+
* @param {PolicySet} policies
|
|
175
|
+
* @returns {CheckParseAnswer}
|
|
176
|
+
*/
|
|
177
|
+
export function preparsePolicySet(pset_id, policies) {
|
|
178
|
+
const ptr0 = passStringToWasm0(pset_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
179
|
+
const len0 = WASM_VECTOR_LEN;
|
|
180
|
+
const ret = wasm.preparsePolicySet(ptr0, len0, policies);
|
|
181
|
+
return ret;
|
|
182
|
+
}
|
|
183
|
+
|
|
168
184
|
/**
|
|
169
185
|
* Preparse and cache a schema in thread-local storage
|
|
170
186
|
*
|
|
@@ -183,29 +199,39 @@ export function preparseSchema(schema_name, schema) {
|
|
|
183
199
|
}
|
|
184
200
|
|
|
185
201
|
/**
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
202
|
+
* Return the JSON representation of a schema.
|
|
203
|
+
* @param {Schema} schema
|
|
204
|
+
* @returns {SchemaToJsonAnswer}
|
|
205
|
+
*/
|
|
206
|
+
export function schemaToJson(schema) {
|
|
207
|
+
const ret = wasm.schemaToJson(schema);
|
|
208
|
+
return ret;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Convert a Cedar schema string to JSON format with resolved types.
|
|
189
213
|
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
214
|
+
* This function resolves ambiguous "`EntityOrCommon`" types to their specific
|
|
215
|
+
* Entity or `CommonType` classifications using the schema's type definitions.
|
|
216
|
+
* This is primarily meant to be used when working with schemas programmatically,
|
|
217
|
+
* for example when creating a schema building UI.
|
|
218
|
+
* @param {string} schema_str
|
|
219
|
+
* @returns {SchemaToJsonWithResolvedTypesAnswer}
|
|
194
220
|
*/
|
|
195
|
-
export function
|
|
196
|
-
const ptr0 = passStringToWasm0(
|
|
221
|
+
export function schemaToJsonWithResolvedTypes(schema_str) {
|
|
222
|
+
const ptr0 = passStringToWasm0(schema_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
197
223
|
const len0 = WASM_VECTOR_LEN;
|
|
198
|
-
const ret = wasm.
|
|
224
|
+
const ret = wasm.schemaToJsonWithResolvedTypes(ptr0, len0);
|
|
199
225
|
return ret;
|
|
200
226
|
}
|
|
201
227
|
|
|
202
228
|
/**
|
|
203
|
-
*
|
|
204
|
-
* @param {
|
|
205
|
-
* @returns {
|
|
229
|
+
* Return the Cedar (textual) representation of a schema.
|
|
230
|
+
* @param {Schema} schema
|
|
231
|
+
* @returns {SchemaToTextAnswer}
|
|
206
232
|
*/
|
|
207
|
-
export function
|
|
208
|
-
const ret = wasm.
|
|
233
|
+
export function schemaToText(schema) {
|
|
234
|
+
const ret = wasm.schemaToText(schema);
|
|
209
235
|
return ret;
|
|
210
236
|
}
|
|
211
237
|
|
|
@@ -223,29 +249,22 @@ export function statefulIsAuthorized(call) {
|
|
|
223
249
|
}
|
|
224
250
|
|
|
225
251
|
/**
|
|
226
|
-
*
|
|
227
|
-
* @
|
|
252
|
+
* Return the JSON representation of a template.
|
|
253
|
+
* @param {Template} template
|
|
254
|
+
* @returns {PolicyToJsonAnswer}
|
|
228
255
|
*/
|
|
229
|
-
export function
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
try {
|
|
233
|
-
const ret = wasm.getCedarLangVersion();
|
|
234
|
-
deferred1_0 = ret[0];
|
|
235
|
-
deferred1_1 = ret[1];
|
|
236
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
237
|
-
} finally {
|
|
238
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
239
|
-
}
|
|
256
|
+
export function templateToJson(template) {
|
|
257
|
+
const ret = wasm.templateToJson(template);
|
|
258
|
+
return ret;
|
|
240
259
|
}
|
|
241
260
|
|
|
242
261
|
/**
|
|
243
|
-
*
|
|
244
|
-
* @param {
|
|
245
|
-
* @returns {
|
|
262
|
+
* Return the Cedar (textual) representation of a template.
|
|
263
|
+
* @param {Template} template
|
|
264
|
+
* @returns {PolicyToTextAnswer}
|
|
246
265
|
*/
|
|
247
|
-
export function
|
|
248
|
-
const ret = wasm.
|
|
266
|
+
export function templateToText(template) {
|
|
267
|
+
const ret = wasm.templateToText(template);
|
|
249
268
|
return ret;
|
|
250
269
|
}
|
|
251
270
|
|
|
@@ -262,210 +281,204 @@ export function validate(call) {
|
|
|
262
281
|
return ret;
|
|
263
282
|
}
|
|
264
283
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
284
|
+
function __wbg_get_imports() {
|
|
285
|
+
const import0 = {
|
|
286
|
+
__proto__: null,
|
|
287
|
+
__wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
|
|
288
|
+
const ret = arg0 === undefined;
|
|
289
|
+
return ret;
|
|
290
|
+
},
|
|
291
|
+
__wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
|
|
292
|
+
const obj = arg1;
|
|
293
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
294
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
295
|
+
var len1 = WASM_VECTOR_LEN;
|
|
296
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
297
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
298
|
+
},
|
|
299
|
+
__wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
|
|
300
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
301
|
+
},
|
|
302
|
+
__wbg_parse_708461a1feddfb38: function() { return handleError(function (arg0, arg1) {
|
|
303
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
304
|
+
return ret;
|
|
305
|
+
}, arguments); },
|
|
306
|
+
__wbg_stringify_8d1cc6ff383e8bae: function() { return handleError(function (arg0) {
|
|
307
|
+
const ret = JSON.stringify(arg0);
|
|
308
|
+
return ret;
|
|
309
|
+
}, arguments); },
|
|
310
|
+
__wbindgen_init_externref_table: function() {
|
|
311
|
+
const table = wasm.__wbindgen_externrefs;
|
|
312
|
+
const offset = table.grow(4);
|
|
313
|
+
table.set(0, undefined);
|
|
314
|
+
table.set(offset + 0, undefined);
|
|
315
|
+
table.set(offset + 1, null);
|
|
316
|
+
table.set(offset + 2, true);
|
|
317
|
+
table.set(offset + 3, false);
|
|
318
|
+
},
|
|
319
|
+
};
|
|
320
|
+
return {
|
|
321
|
+
__proto__: null,
|
|
322
|
+
"./cedar_wasm_bg.js": import0,
|
|
323
|
+
};
|
|
273
324
|
}
|
|
274
325
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
*/
|
|
280
|
-
export function checkParseSchema(schema) {
|
|
281
|
-
const ret = wasm.checkParseSchema(schema);
|
|
282
|
-
return ret;
|
|
326
|
+
function addToExternrefTable0(obj) {
|
|
327
|
+
const idx = wasm.__externref_table_alloc();
|
|
328
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
329
|
+
return idx;
|
|
283
330
|
}
|
|
284
331
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
const ret = wasm.checkParsePolicySet(policies);
|
|
292
|
-
return ret;
|
|
332
|
+
let cachedDataViewMemory0 = null;
|
|
333
|
+
function getDataViewMemory0() {
|
|
334
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
335
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
336
|
+
}
|
|
337
|
+
return cachedDataViewMemory0;
|
|
293
338
|
}
|
|
294
339
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
* @returns {CheckParseAnswer}
|
|
299
|
-
*/
|
|
300
|
-
export function checkParseEntities(call) {
|
|
301
|
-
const ret = wasm.checkParseEntities(call);
|
|
302
|
-
return ret;
|
|
340
|
+
function getStringFromWasm0(ptr, len) {
|
|
341
|
+
ptr = ptr >>> 0;
|
|
342
|
+
return decodeText(ptr, len);
|
|
303
343
|
}
|
|
304
344
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
const ret = wasm.schemaToJson(schema);
|
|
312
|
-
return ret;
|
|
345
|
+
let cachedUint8ArrayMemory0 = null;
|
|
346
|
+
function getUint8ArrayMemory0() {
|
|
347
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
348
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
349
|
+
}
|
|
350
|
+
return cachedUint8ArrayMemory0;
|
|
313
351
|
}
|
|
314
352
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
return ret;
|
|
353
|
+
function handleError(f, args) {
|
|
354
|
+
try {
|
|
355
|
+
return f.apply(this, args);
|
|
356
|
+
} catch (e) {
|
|
357
|
+
const idx = addToExternrefTable0(e);
|
|
358
|
+
wasm.__wbindgen_exn_store(idx);
|
|
359
|
+
}
|
|
323
360
|
}
|
|
324
361
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
* and templates split into vecs and sorted by id.
|
|
328
|
-
* @param {string} policyset_str
|
|
329
|
-
* @returns {PolicySetTextToPartsAnswer}
|
|
330
|
-
*/
|
|
331
|
-
export function policySetTextToParts(policyset_str) {
|
|
332
|
-
const ptr0 = passStringToWasm0(policyset_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
333
|
-
const len0 = WASM_VECTOR_LEN;
|
|
334
|
-
const ret = wasm.policySetTextToParts(ptr0, len0);
|
|
335
|
-
return ret;
|
|
362
|
+
function isLikeNone(x) {
|
|
363
|
+
return x === undefined || x === null;
|
|
336
364
|
}
|
|
337
365
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
}
|
|
366
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
367
|
+
if (realloc === undefined) {
|
|
368
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
369
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
370
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
371
|
+
WASM_VECTOR_LEN = buf.length;
|
|
372
|
+
return ptr;
|
|
373
|
+
}
|
|
347
374
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
375
|
+
let len = arg.length;
|
|
376
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
377
|
+
|
|
378
|
+
const mem = getUint8ArrayMemory0();
|
|
379
|
+
|
|
380
|
+
let offset = 0;
|
|
381
|
+
|
|
382
|
+
for (; offset < len; offset++) {
|
|
383
|
+
const code = arg.charCodeAt(offset);
|
|
384
|
+
if (code > 0x7F) break;
|
|
385
|
+
mem[ptr + offset] = code;
|
|
386
|
+
}
|
|
387
|
+
if (offset !== len) {
|
|
388
|
+
if (offset !== 0) {
|
|
389
|
+
arg = arg.slice(offset);
|
|
390
|
+
}
|
|
391
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
392
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
393
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
394
|
+
|
|
395
|
+
offset += ret.written;
|
|
396
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
WASM_VECTOR_LEN = offset;
|
|
400
|
+
return ptr;
|
|
356
401
|
}
|
|
357
402
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
403
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
404
|
+
cachedTextDecoder.decode();
|
|
405
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
406
|
+
let numBytesDecoded = 0;
|
|
407
|
+
function decodeText(ptr, len) {
|
|
408
|
+
numBytesDecoded += len;
|
|
409
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
410
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
411
|
+
cachedTextDecoder.decode();
|
|
412
|
+
numBytesDecoded = len;
|
|
413
|
+
}
|
|
414
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
366
415
|
}
|
|
367
416
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
417
|
+
const cachedTextEncoder = new TextEncoder();
|
|
418
|
+
|
|
419
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
420
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
421
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
422
|
+
view.set(buf);
|
|
423
|
+
return {
|
|
424
|
+
read: arg.length,
|
|
425
|
+
written: buf.length
|
|
426
|
+
};
|
|
427
|
+
};
|
|
376
428
|
}
|
|
377
429
|
|
|
378
|
-
|
|
430
|
+
let WASM_VECTOR_LEN = 0;
|
|
431
|
+
|
|
432
|
+
let wasmModule, wasm;
|
|
433
|
+
function __wbg_finalize_init(instance, module) {
|
|
434
|
+
wasm = instance.exports;
|
|
435
|
+
wasmModule = module;
|
|
436
|
+
cachedDataViewMemory0 = null;
|
|
437
|
+
cachedUint8ArrayMemory0 = null;
|
|
438
|
+
wasm.__wbindgen_start();
|
|
439
|
+
return wasm;
|
|
440
|
+
}
|
|
379
441
|
|
|
380
442
|
async function __wbg_load(module, imports) {
|
|
381
443
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
382
444
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
383
445
|
try {
|
|
384
446
|
return await WebAssembly.instantiateStreaming(module, imports);
|
|
385
|
-
|
|
386
447
|
} catch (e) {
|
|
387
|
-
const validResponse = module.ok &&
|
|
448
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
388
449
|
|
|
389
450
|
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
390
451
|
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
391
452
|
|
|
392
|
-
} else {
|
|
393
|
-
throw e;
|
|
394
|
-
}
|
|
453
|
+
} else { throw e; }
|
|
395
454
|
}
|
|
396
455
|
}
|
|
397
456
|
|
|
398
457
|
const bytes = await module.arrayBuffer();
|
|
399
458
|
return await WebAssembly.instantiate(bytes, imports);
|
|
400
|
-
|
|
401
459
|
} else {
|
|
402
460
|
const instance = await WebAssembly.instantiate(module, imports);
|
|
403
461
|
|
|
404
462
|
if (instance instanceof WebAssembly.Instance) {
|
|
405
463
|
return { instance, module };
|
|
406
|
-
|
|
407
464
|
} else {
|
|
408
465
|
return instance;
|
|
409
466
|
}
|
|
410
467
|
}
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
function __wbg_get_imports() {
|
|
414
|
-
const imports = {};
|
|
415
|
-
imports.wbg = {};
|
|
416
|
-
imports.wbg.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
|
|
417
|
-
const ret = arg0 === undefined;
|
|
418
|
-
return ret;
|
|
419
|
-
};
|
|
420
|
-
imports.wbg.__wbg___wbindgen_string_get_e4f06c90489ad01b = function(arg0, arg1) {
|
|
421
|
-
const obj = arg1;
|
|
422
|
-
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
423
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
424
|
-
var len1 = WASM_VECTOR_LEN;
|
|
425
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
426
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
427
|
-
};
|
|
428
|
-
imports.wbg.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
|
|
429
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
430
|
-
};
|
|
431
|
-
imports.wbg.__wbg_parse_2a704d6b78abb2b8 = function() { return handleError(function (arg0, arg1) {
|
|
432
|
-
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
433
|
-
return ret;
|
|
434
|
-
}, arguments) };
|
|
435
|
-
imports.wbg.__wbg_stringify_b5fb28f6465d9c3e = function() { return handleError(function (arg0) {
|
|
436
|
-
const ret = JSON.stringify(arg0);
|
|
437
|
-
return ret;
|
|
438
|
-
}, arguments) };
|
|
439
|
-
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
440
|
-
const table = wasm.__wbindgen_externrefs;
|
|
441
|
-
const offset = table.grow(4);
|
|
442
|
-
table.set(0, undefined);
|
|
443
|
-
table.set(offset + 0, undefined);
|
|
444
|
-
table.set(offset + 1, null);
|
|
445
|
-
table.set(offset + 2, true);
|
|
446
|
-
table.set(offset + 3, false);
|
|
447
|
-
;
|
|
448
|
-
};
|
|
449
468
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
cachedDataViewMemory0 = null;
|
|
457
|
-
cachedUint8ArrayMemory0 = null;
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
wasm.__wbindgen_start();
|
|
461
|
-
return wasm;
|
|
469
|
+
function expectedResponseType(type) {
|
|
470
|
+
switch (type) {
|
|
471
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
472
|
+
}
|
|
473
|
+
return false;
|
|
474
|
+
}
|
|
462
475
|
}
|
|
463
476
|
|
|
464
477
|
function initSync(module) {
|
|
465
478
|
if (wasm !== undefined) return wasm;
|
|
466
479
|
|
|
467
480
|
|
|
468
|
-
if (
|
|
481
|
+
if (module !== undefined) {
|
|
469
482
|
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
470
483
|
({module} = module)
|
|
471
484
|
} else {
|
|
@@ -474,13 +487,10 @@ function initSync(module) {
|
|
|
474
487
|
}
|
|
475
488
|
|
|
476
489
|
const imports = __wbg_get_imports();
|
|
477
|
-
|
|
478
490
|
if (!(module instanceof WebAssembly.Module)) {
|
|
479
491
|
module = new WebAssembly.Module(module);
|
|
480
492
|
}
|
|
481
|
-
|
|
482
493
|
const instance = new WebAssembly.Instance(module, imports);
|
|
483
|
-
|
|
484
494
|
return __wbg_finalize_init(instance, module);
|
|
485
495
|
}
|
|
486
496
|
|
|
@@ -488,7 +498,7 @@ async function __wbg_init(module_or_path) {
|
|
|
488
498
|
if (wasm !== undefined) return wasm;
|
|
489
499
|
|
|
490
500
|
|
|
491
|
-
if (
|
|
501
|
+
if (module_or_path !== undefined) {
|
|
492
502
|
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
493
503
|
({module_or_path} = module_or_path)
|
|
494
504
|
} else {
|
|
@@ -496,7 +506,7 @@ async function __wbg_init(module_or_path) {
|
|
|
496
506
|
}
|
|
497
507
|
}
|
|
498
508
|
|
|
499
|
-
if (
|
|
509
|
+
if (module_or_path === undefined) {
|
|
500
510
|
module_or_path = new URL('cedar_wasm_bg.wasm', import.meta.url);
|
|
501
511
|
}
|
|
502
512
|
const imports = __wbg_get_imports();
|
|
@@ -510,5 +520,4 @@ async function __wbg_init(module_or_path) {
|
|
|
510
520
|
return __wbg_finalize_init(instance, module);
|
|
511
521
|
}
|
|
512
522
|
|
|
513
|
-
export { initSync };
|
|
514
|
-
export default __wbg_init;
|
|
523
|
+
export { initSync, __wbg_init as default };
|