@janssenproject/cedarling_wasm 0.0.307 → 0.0.308

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/cedarling_wasm.js CHANGED
@@ -1,281 +1,4 @@
1
- let wasm;
2
-
3
- function addToExternrefTable0(obj) {
4
- const idx = wasm.__externref_table_alloc();
5
- wasm.__wbindgen_externrefs.set(idx, obj);
6
- return idx;
7
- }
8
-
9
- function _assertClass(instance, klass) {
10
- if (!(instance instanceof klass)) {
11
- throw new Error(`expected instance of ${klass.name}`);
12
- }
13
- }
14
-
15
- const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
16
- ? { register: () => {}, unregister: () => {} }
17
- : new FinalizationRegistry(state => state.dtor(state.a, state.b));
18
-
19
- function debugString(val) {
20
- // primitive types
21
- const type = typeof val;
22
- if (type == 'number' || type == 'boolean' || val == null) {
23
- return `${val}`;
24
- }
25
- if (type == 'string') {
26
- return `"${val}"`;
27
- }
28
- if (type == 'symbol') {
29
- const description = val.description;
30
- if (description == null) {
31
- return 'Symbol';
32
- } else {
33
- return `Symbol(${description})`;
34
- }
35
- }
36
- if (type == 'function') {
37
- const name = val.name;
38
- if (typeof name == 'string' && name.length > 0) {
39
- return `Function(${name})`;
40
- } else {
41
- return 'Function';
42
- }
43
- }
44
- // objects
45
- if (Array.isArray(val)) {
46
- const length = val.length;
47
- let debug = '[';
48
- if (length > 0) {
49
- debug += debugString(val[0]);
50
- }
51
- for(let i = 1; i < length; i++) {
52
- debug += ', ' + debugString(val[i]);
53
- }
54
- debug += ']';
55
- return debug;
56
- }
57
- // Test for built-in
58
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
59
- let className;
60
- if (builtInMatches && builtInMatches.length > 1) {
61
- className = builtInMatches[1];
62
- } else {
63
- // Failed to match the standard '[object ClassName]'
64
- return toString.call(val);
65
- }
66
- if (className == 'Object') {
67
- // we're a user defined class or Object
68
- // JSON.stringify avoids problems with cycles, and is generally much
69
- // easier than looping through ownProperties of `val`.
70
- try {
71
- return 'Object(' + JSON.stringify(val) + ')';
72
- } catch (_) {
73
- return 'Object';
74
- }
75
- }
76
- // errors
77
- if (val instanceof Error) {
78
- return `${val.name}: ${val.message}\n${val.stack}`;
79
- }
80
- // TODO we could test for more things here, like `Set`s and `Map`s.
81
- return className;
82
- }
83
-
84
- function getArrayJsValueFromWasm0(ptr, len) {
85
- ptr = ptr >>> 0;
86
- const mem = getDataViewMemory0();
87
- const result = [];
88
- for (let i = ptr; i < ptr + 4 * len; i += 4) {
89
- result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
90
- }
91
- wasm.__externref_drop_slice(ptr, len);
92
- return result;
93
- }
94
-
95
- function getArrayU8FromWasm0(ptr, len) {
96
- ptr = ptr >>> 0;
97
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
98
- }
99
-
100
- let cachedDataViewMemory0 = null;
101
- function getDataViewMemory0() {
102
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
103
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
104
- }
105
- return cachedDataViewMemory0;
106
- }
107
-
108
- function getStringFromWasm0(ptr, len) {
109
- ptr = ptr >>> 0;
110
- return decodeText(ptr, len);
111
- }
112
-
113
- let cachedUint8ArrayMemory0 = null;
114
- function getUint8ArrayMemory0() {
115
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
116
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
117
- }
118
- return cachedUint8ArrayMemory0;
119
- }
120
-
121
- function handleError(f, args) {
122
- try {
123
- return f.apply(this, args);
124
- } catch (e) {
125
- const idx = addToExternrefTable0(e);
126
- wasm.__wbindgen_exn_store(idx);
127
- }
128
- }
129
-
130
- function isLikeNone(x) {
131
- return x === undefined || x === null;
132
- }
133
-
134
- function makeMutClosure(arg0, arg1, dtor, f) {
135
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
136
- const real = (...args) => {
137
-
138
- // First up with a closure we increment the internal reference
139
- // count. This ensures that the Rust closure environment won't
140
- // be deallocated while we're invoking it.
141
- state.cnt++;
142
- const a = state.a;
143
- state.a = 0;
144
- try {
145
- return f(a, state.b, ...args);
146
- } finally {
147
- state.a = a;
148
- real._wbg_cb_unref();
149
- }
150
- };
151
- real._wbg_cb_unref = () => {
152
- if (--state.cnt === 0) {
153
- state.dtor(state.a, state.b);
154
- state.a = 0;
155
- CLOSURE_DTORS.unregister(state);
156
- }
157
- };
158
- CLOSURE_DTORS.register(real, state, state);
159
- return real;
160
- }
161
-
162
- function passStringToWasm0(arg, malloc, realloc) {
163
- if (realloc === undefined) {
164
- const buf = cachedTextEncoder.encode(arg);
165
- const ptr = malloc(buf.length, 1) >>> 0;
166
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
167
- WASM_VECTOR_LEN = buf.length;
168
- return ptr;
169
- }
170
-
171
- let len = arg.length;
172
- let ptr = malloc(len, 1) >>> 0;
173
-
174
- const mem = getUint8ArrayMemory0();
175
-
176
- let offset = 0;
177
-
178
- for (; offset < len; offset++) {
179
- const code = arg.charCodeAt(offset);
180
- if (code > 0x7F) break;
181
- mem[ptr + offset] = code;
182
- }
183
- if (offset !== len) {
184
- if (offset !== 0) {
185
- arg = arg.slice(offset);
186
- }
187
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
188
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
189
- const ret = cachedTextEncoder.encodeInto(arg, view);
190
-
191
- offset += ret.written;
192
- ptr = realloc(ptr, len, offset, 1) >>> 0;
193
- }
194
-
195
- WASM_VECTOR_LEN = offset;
196
- return ptr;
197
- }
198
-
199
- function takeFromExternrefTable0(idx) {
200
- const value = wasm.__wbindgen_externrefs.get(idx);
201
- wasm.__externref_table_dealloc(idx);
202
- return value;
203
- }
204
-
205
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
206
- cachedTextDecoder.decode();
207
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
208
- let numBytesDecoded = 0;
209
- function decodeText(ptr, len) {
210
- numBytesDecoded += len;
211
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
212
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
213
- cachedTextDecoder.decode();
214
- numBytesDecoded = len;
215
- }
216
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
217
- }
218
-
219
- const cachedTextEncoder = new TextEncoder();
220
-
221
- if (!('encodeInto' in cachedTextEncoder)) {
222
- cachedTextEncoder.encodeInto = function (arg, view) {
223
- const buf = cachedTextEncoder.encode(arg);
224
- view.set(buf);
225
- return {
226
- read: arg.length,
227
- written: buf.length
228
- };
229
- }
230
- }
231
-
232
- let WASM_VECTOR_LEN = 0;
233
-
234
- function wasm_bindgen__convert__closures_____invoke__h7f8b71809a8d7577(arg0, arg1, arg2) {
235
- wasm.wasm_bindgen__convert__closures_____invoke__h7f8b71809a8d7577(arg0, arg1, arg2);
236
- }
237
-
238
- function wasm_bindgen__convert__closures_____invoke__h5208add59d64c287(arg0, arg1) {
239
- wasm.wasm_bindgen__convert__closures_____invoke__h5208add59d64c287(arg0, arg1);
240
- }
241
-
242
- function wasm_bindgen__convert__closures_____invoke__h3a7d0d99d266e2f8(arg0, arg1, arg2, arg3) {
243
- wasm.wasm_bindgen__convert__closures_____invoke__h3a7d0d99d266e2f8(arg0, arg1, arg2, arg3);
244
- }
245
-
246
- const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
247
-
248
- const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
249
-
250
- const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
251
-
252
- const AuthorizeResultFinalization = (typeof FinalizationRegistry === 'undefined')
253
- ? { register: () => {}, unregister: () => {} }
254
- : new FinalizationRegistry(ptr => wasm.__wbg_authorizeresult_free(ptr >>> 0, 1));
255
-
256
- const AuthorizeResultResponseFinalization = (typeof FinalizationRegistry === 'undefined')
257
- ? { register: () => {}, unregister: () => {} }
258
- : new FinalizationRegistry(ptr => wasm.__wbg_authorizeresultresponse_free(ptr >>> 0, 1));
259
-
260
- const CedarlingFinalization = (typeof FinalizationRegistry === 'undefined')
261
- ? { register: () => {}, unregister: () => {} }
262
- : new FinalizationRegistry(ptr => wasm.__wbg_cedarling_free(ptr >>> 0, 1));
263
-
264
- const DiagnosticsFinalization = (typeof FinalizationRegistry === 'undefined')
265
- ? { register: () => {}, unregister: () => {} }
266
- : new FinalizationRegistry(ptr => wasm.__wbg_diagnostics_free(ptr >>> 0, 1));
267
-
268
- const JsJsonLogicFinalization = (typeof FinalizationRegistry === 'undefined')
269
- ? { register: () => {}, unregister: () => {} }
270
- : new FinalizationRegistry(ptr => wasm.__wbg_jsjsonlogic_free(ptr >>> 0, 1));
271
-
272
- const MultiIssuerAuthorizeResultFinalization = (typeof FinalizationRegistry === 'undefined')
273
- ? { register: () => {}, unregister: () => {} }
274
- : new FinalizationRegistry(ptr => wasm.__wbg_multiissuerauthorizeresult_free(ptr >>> 0, 1));
275
-
276
- const PolicyEvaluationErrorFinalization = (typeof FinalizationRegistry === 'undefined')
277
- ? { register: () => {}, unregister: () => {} }
278
- : new FinalizationRegistry(ptr => wasm.__wbg_policyevaluationerror_free(ptr >>> 0, 1));
1
+ /* @ts-self-types="./cedarling_wasm.d.ts" */
279
2
 
280
3
  /**
281
4
  * A WASM wrapper for the Rust `cedarling::AuthorizeResult` struct.
@@ -300,45 +23,31 @@ export class AuthorizeResult {
300
23
  wasm.__wbg_authorizeresult_free(ptr, 0);
301
24
  }
302
25
  /**
303
- * Result of authorization where principal is `Jans::Workload`
304
- * @returns {AuthorizeResultResponse | undefined}
305
- */
306
- get workload() {
307
- const ret = wasm.__wbg_get_authorizeresult_workload(this.__wbg_ptr);
308
- return ret === 0 ? undefined : AuthorizeResultResponse.__wrap(ret);
309
- }
310
- /**
311
- * Result of authorization where principal is `Jans::Workload`
312
- * @param {AuthorizeResultResponse | null} [arg0]
26
+ * Convert `AuthorizeResult` to json string value
27
+ * @returns {string}
313
28
  */
314
- set workload(arg0) {
315
- let ptr0 = 0;
316
- if (!isLikeNone(arg0)) {
317
- _assertClass(arg0, AuthorizeResultResponse);
318
- ptr0 = arg0.__destroy_into_raw();
29
+ json_string() {
30
+ let deferred1_0;
31
+ let deferred1_1;
32
+ try {
33
+ const ret = wasm.authorizeresult_json_string(this.__wbg_ptr);
34
+ deferred1_0 = ret[0];
35
+ deferred1_1 = ret[1];
36
+ return getStringFromWasm0(ret[0], ret[1]);
37
+ } finally {
38
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
319
39
  }
320
- wasm.__wbg_set_authorizeresult_workload(this.__wbg_ptr, ptr0);
321
40
  }
322
41
  /**
323
- * Result of authorization where principal is `Jans::User`
42
+ * @param {string} principal
324
43
  * @returns {AuthorizeResultResponse | undefined}
325
44
  */
326
- get person() {
327
- const ret = wasm.__wbg_get_authorizeresult_person(this.__wbg_ptr);
45
+ principal(principal) {
46
+ const ptr0 = passStringToWasm0(principal, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
47
+ const len0 = WASM_VECTOR_LEN;
48
+ const ret = wasm.authorizeresult_principal(this.__wbg_ptr, ptr0, len0);
328
49
  return ret === 0 ? undefined : AuthorizeResultResponse.__wrap(ret);
329
50
  }
330
- /**
331
- * Result of authorization where principal is `Jans::User`
332
- * @param {AuthorizeResultResponse | null} [arg0]
333
- */
334
- set person(arg0) {
335
- let ptr0 = 0;
336
- if (!isLikeNone(arg0)) {
337
- _assertClass(arg0, AuthorizeResultResponse);
338
- ptr0 = arg0.__destroy_into_raw();
339
- }
340
- wasm.__wbg_set_authorizeresult_person(this.__wbg_ptr, ptr0);
341
- }
342
51
  /**
343
52
  * Result of authorization
344
53
  * true means `ALLOW`
@@ -352,15 +61,12 @@ export class AuthorizeResult {
352
61
  return ret !== 0;
353
62
  }
354
63
  /**
355
- * Result of authorization
356
- * true means `ALLOW`
357
- * false means `Deny`
358
- *
359
- * this field is [`bool`] type to be compatible with [authzen Access Evaluation Decision](https://openid.github.io/authzen/#section-6.2.1).
360
- * @param {boolean} arg0
64
+ * Result of authorization where principal is `Jans::User`
65
+ * @returns {AuthorizeResultResponse | undefined}
361
66
  */
362
- set decision(arg0) {
363
- wasm.__wbg_set_authorizeresult_decision(this.__wbg_ptr, arg0);
67
+ get person() {
68
+ const ret = wasm.__wbg_get_authorizeresult_person(this.__wbg_ptr);
69
+ return ret === 0 ? undefined : AuthorizeResultResponse.__wrap(ret);
364
70
  }
365
71
  /**
366
72
  * Request ID of the authorization request
@@ -378,6 +84,37 @@ export class AuthorizeResult {
378
84
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
379
85
  }
380
86
  }
87
+ /**
88
+ * Result of authorization where principal is `Jans::Workload`
89
+ * @returns {AuthorizeResultResponse | undefined}
90
+ */
91
+ get workload() {
92
+ const ret = wasm.__wbg_get_authorizeresult_workload(this.__wbg_ptr);
93
+ return ret === 0 ? undefined : AuthorizeResultResponse.__wrap(ret);
94
+ }
95
+ /**
96
+ * Result of authorization
97
+ * true means `ALLOW`
98
+ * false means `Deny`
99
+ *
100
+ * this field is [`bool`] type to be compatible with [authzen Access Evaluation Decision](https://openid.github.io/authzen/#section-6.2.1).
101
+ * @param {boolean} arg0
102
+ */
103
+ set decision(arg0) {
104
+ wasm.__wbg_set_authorizeresult_decision(this.__wbg_ptr, arg0);
105
+ }
106
+ /**
107
+ * Result of authorization where principal is `Jans::User`
108
+ * @param {AuthorizeResultResponse | null} [arg0]
109
+ */
110
+ set person(arg0) {
111
+ let ptr0 = 0;
112
+ if (!isLikeNone(arg0)) {
113
+ _assertClass(arg0, AuthorizeResultResponse);
114
+ ptr0 = arg0.__destroy_into_raw();
115
+ }
116
+ wasm.__wbg_set_authorizeresult_person(this.__wbg_ptr, ptr0);
117
+ }
381
118
  /**
382
119
  * Request ID of the authorization request
383
120
  * @param {string} arg0
@@ -388,30 +125,16 @@ export class AuthorizeResult {
388
125
  wasm.__wbg_set_authorizeresult_request_id(this.__wbg_ptr, ptr0, len0);
389
126
  }
390
127
  /**
391
- * Convert `AuthorizeResult` to json string value
392
- * @returns {string}
393
- */
394
- json_string() {
395
- let deferred1_0;
396
- let deferred1_1;
397
- try {
398
- const ret = wasm.authorizeresult_json_string(this.__wbg_ptr);
399
- deferred1_0 = ret[0];
400
- deferred1_1 = ret[1];
401
- return getStringFromWasm0(ret[0], ret[1]);
402
- } finally {
403
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
404
- }
405
- }
406
- /**
407
- * @param {string} principal
408
- * @returns {AuthorizeResultResponse | undefined}
128
+ * Result of authorization where principal is `Jans::Workload`
129
+ * @param {AuthorizeResultResponse | null} [arg0]
409
130
  */
410
- principal(principal) {
411
- const ptr0 = passStringToWasm0(principal, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
412
- const len0 = WASM_VECTOR_LEN;
413
- const ret = wasm.authorizeresult_principal(this.__wbg_ptr, ptr0, len0);
414
- return ret === 0 ? undefined : AuthorizeResultResponse.__wrap(ret);
131
+ set workload(arg0) {
132
+ let ptr0 = 0;
133
+ if (!isLikeNone(arg0)) {
134
+ _assertClass(arg0, AuthorizeResultResponse);
135
+ ptr0 = arg0.__destroy_into_raw();
136
+ }
137
+ wasm.__wbg_set_authorizeresult_workload(this.__wbg_ptr, ptr0);
415
138
  }
416
139
  }
417
140
  if (Symbol.dispose) AuthorizeResult.prototype[Symbol.dispose] = AuthorizeResult.prototype.free;
@@ -478,26 +201,6 @@ export class Cedarling {
478
201
  const ptr = this.__destroy_into_raw();
479
202
  wasm.__wbg_cedarling_free(ptr, 0);
480
203
  }
481
- /**
482
- * Create a new instance of the Cedarling application.
483
- * Assume that config is `Object`
484
- * @param {object} config
485
- * @returns {Promise<Cedarling>}
486
- */
487
- static new(config) {
488
- const ret = wasm.cedarling_new(config);
489
- return ret;
490
- }
491
- /**
492
- * Create a new instance of the Cedarling application.
493
- * Assume that config is `Map`
494
- * @param {Map<any, any>} config
495
- * @returns {Promise<Cedarling>}
496
- */
497
- static new_from_map(config) {
498
- const ret = wasm.cedarling_new_from_map(config);
499
- return ret;
500
- }
501
204
  /**
502
205
  * Authorize request
503
206
  * makes authorization decision based on the [`Request`]
@@ -508,16 +211,6 @@ export class Cedarling {
508
211
  const ret = wasm.cedarling_authorize(this.__wbg_ptr, request);
509
212
  return ret;
510
213
  }
511
- /**
512
- * Authorize request for unsigned principals.
513
- * makes authorization decision based on the [`RequestUnsigned`]
514
- * @param {any} request
515
- * @returns {Promise<AuthorizeResult>}
516
- */
517
- authorize_unsigned(request) {
518
- const ret = wasm.cedarling_authorize_unsigned(this.__wbg_ptr, request);
519
- return ret;
520
- }
521
214
  /**
522
215
  * Authorize multi-issuer request.
523
216
  * Makes authorization decision based on multiple JWT tokens from different issuers
@@ -529,16 +222,14 @@ export class Cedarling {
529
222
  return ret;
530
223
  }
531
224
  /**
532
- * Get logs and remove them from the storage.
533
- * Returns `Array` of `Map`
534
- * @returns {Array<any>}
225
+ * Authorize request for unsigned principals.
226
+ * makes authorization decision based on the [`RequestUnsigned`]
227
+ * @param {any} request
228
+ * @returns {Promise<AuthorizeResult>}
535
229
  */
536
- pop_logs() {
537
- const ret = wasm.cedarling_pop_logs(this.__wbg_ptr);
538
- if (ret[2]) {
539
- throw takeFromExternrefTable0(ret[1]);
540
- }
541
- return takeFromExternrefTable0(ret[0]);
230
+ authorize_unsigned(request) {
231
+ const ret = wasm.cedarling_authorize_unsigned(this.__wbg_ptr, request);
232
+ return ret;
542
233
  }
543
234
  /**
544
235
  * Get specific log entry.
@@ -564,23 +255,6 @@ export class Cedarling {
564
255
  const ret = wasm.cedarling_get_log_ids(this.__wbg_ptr);
565
256
  return ret;
566
257
  }
567
- /**
568
- * Get logs by tag, like `log_kind` or `log level`.
569
- * Tag can be `log_kind`, `log_level`.
570
- * @param {string} tag
571
- * @returns {any[]}
572
- */
573
- get_logs_by_tag(tag) {
574
- const ptr0 = passStringToWasm0(tag, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
575
- const len0 = WASM_VECTOR_LEN;
576
- const ret = wasm.cedarling_get_logs_by_tag(this.__wbg_ptr, ptr0, len0);
577
- if (ret[3]) {
578
- throw takeFromExternrefTable0(ret[2]);
579
- }
580
- var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
581
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
582
- return v2;
583
- }
584
258
  /**
585
259
  * Get logs by request_id.
586
260
  * Return log entries that match the given request_id.
@@ -619,6 +293,55 @@ export class Cedarling {
619
293
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
620
294
  return v3;
621
295
  }
296
+ /**
297
+ * Get logs by tag, like `log_kind` or `log level`.
298
+ * Tag can be `log_kind`, `log_level`.
299
+ * @param {string} tag
300
+ * @returns {any[]}
301
+ */
302
+ get_logs_by_tag(tag) {
303
+ const ptr0 = passStringToWasm0(tag, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
304
+ const len0 = WASM_VECTOR_LEN;
305
+ const ret = wasm.cedarling_get_logs_by_tag(this.__wbg_ptr, ptr0, len0);
306
+ if (ret[3]) {
307
+ throw takeFromExternrefTable0(ret[2]);
308
+ }
309
+ var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
310
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
311
+ return v2;
312
+ }
313
+ /**
314
+ * Create a new instance of the Cedarling application.
315
+ * Assume that config is `Object`
316
+ * @param {object} config
317
+ * @returns {Promise<Cedarling>}
318
+ */
319
+ static new(config) {
320
+ const ret = wasm.cedarling_new(config);
321
+ return ret;
322
+ }
323
+ /**
324
+ * Create a new instance of the Cedarling application.
325
+ * Assume that config is `Map`
326
+ * @param {Map<any, any>} config
327
+ * @returns {Promise<Cedarling>}
328
+ */
329
+ static new_from_map(config) {
330
+ const ret = wasm.cedarling_new_from_map(config);
331
+ return ret;
332
+ }
333
+ /**
334
+ * Get logs and remove them from the storage.
335
+ * Returns `Array` of `Map`
336
+ * @returns {Array<any>}
337
+ */
338
+ pop_logs() {
339
+ const ret = wasm.cedarling_pop_logs(this.__wbg_ptr);
340
+ if (ret[2]) {
341
+ throw takeFromExternrefTable0(ret[1]);
342
+ }
343
+ return takeFromExternrefTable0(ret[0]);
344
+ }
622
345
  /**
623
346
  * Closes the connections to the Lock Server and pushes all available logs.
624
347
  * @returns {Promise<void>}
@@ -654,6 +377,17 @@ export class Diagnostics {
654
377
  const ptr = this.__destroy_into_raw();
655
378
  wasm.__wbg_diagnostics_free(ptr, 0);
656
379
  }
380
+ /**
381
+ * Errors that occurred during authorization. The errors should be
382
+ * treated as unordered, since policies may be evaluated in any order.
383
+ * @returns {PolicyEvaluationError[]}
384
+ */
385
+ get errors() {
386
+ const ret = wasm.diagnostics_errors(this.__wbg_ptr);
387
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
388
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
389
+ return v1;
390
+ }
657
391
  /**
658
392
  * `PolicyId`s of the policies that contributed to the decision.
659
393
  * If no policies applied to the request, this set will be empty.
@@ -667,17 +401,6 @@ export class Diagnostics {
667
401
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
668
402
  return v1;
669
403
  }
670
- /**
671
- * Errors that occurred during authorization. The errors should be
672
- * treated as unordered, since policies may be evaluated in any order.
673
- * @returns {PolicyEvaluationError[]}
674
- */
675
- get errors() {
676
- const ret = wasm.diagnostics_errors(this.__wbg_ptr);
677
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
678
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
679
- return v1;
680
- }
681
404
  }
682
405
  if (Symbol.dispose) Diagnostics.prototype[Symbol.dispose] = Diagnostics.prototype.free;
683
406
 
@@ -692,12 +415,6 @@ export class JsJsonLogic {
692
415
  const ptr = this.__destroy_into_raw();
693
416
  wasm.__wbg_jsjsonlogic_free(ptr, 0);
694
417
  }
695
- constructor() {
696
- const ret = wasm.jsjsonlogic_new();
697
- this.__wbg_ptr = ret >>> 0;
698
- JsJsonLogicFinalization.register(this, this.__wbg_ptr, this);
699
- return this;
700
- }
701
418
  /**
702
419
  * @param {any} logic
703
420
  * @param {any} data
@@ -710,182 +427,1042 @@ export class JsJsonLogic {
710
427
  }
711
428
  return takeFromExternrefTable0(ret[0]);
712
429
  }
430
+ constructor() {
431
+ const ret = wasm.jsjsonlogic_new();
432
+ this.__wbg_ptr = ret >>> 0;
433
+ JsJsonLogicFinalization.register(this, this.__wbg_ptr, this);
434
+ return this;
435
+ }
436
+ }
437
+ if (Symbol.dispose) JsJsonLogic.prototype[Symbol.dispose] = JsJsonLogic.prototype.free;
438
+
439
+ /**
440
+ * A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
441
+ * Represents the result of a multi-issuer authorization request.
442
+ */
443
+ export class MultiIssuerAuthorizeResult {
444
+ static __wrap(ptr) {
445
+ ptr = ptr >>> 0;
446
+ const obj = Object.create(MultiIssuerAuthorizeResult.prototype);
447
+ obj.__wbg_ptr = ptr;
448
+ MultiIssuerAuthorizeResultFinalization.register(obj, obj.__wbg_ptr, obj);
449
+ return obj;
450
+ }
451
+ __destroy_into_raw() {
452
+ const ptr = this.__wbg_ptr;
453
+ this.__wbg_ptr = 0;
454
+ MultiIssuerAuthorizeResultFinalization.unregister(this);
455
+ return ptr;
456
+ }
457
+ free() {
458
+ const ptr = this.__destroy_into_raw();
459
+ wasm.__wbg_multiissuerauthorizeresult_free(ptr, 0);
460
+ }
461
+ /**
462
+ * Result of authorization
463
+ * true means `ALLOW`
464
+ * false means `Deny`
465
+ * @returns {boolean}
466
+ */
467
+ get decision() {
468
+ const ret = wasm.__wbg_get_multiissuerauthorizeresult_decision(this.__wbg_ptr);
469
+ return ret !== 0;
470
+ }
471
+ /**
472
+ * Request ID of the authorization request
473
+ * @returns {string}
474
+ */
475
+ get request_id() {
476
+ let deferred1_0;
477
+ let deferred1_1;
478
+ try {
479
+ const ret = wasm.__wbg_get_multiissuerauthorizeresult_request_id(this.__wbg_ptr);
480
+ deferred1_0 = ret[0];
481
+ deferred1_1 = ret[1];
482
+ return getStringFromWasm0(ret[0], ret[1]);
483
+ } finally {
484
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
485
+ }
486
+ }
487
+ /**
488
+ * Result of Cedar policy authorization
489
+ * @returns {AuthorizeResultResponse}
490
+ */
491
+ get response() {
492
+ const ret = wasm.__wbg_get_multiissuerauthorizeresult_response(this.__wbg_ptr);
493
+ return AuthorizeResultResponse.__wrap(ret);
494
+ }
495
+ /**
496
+ * Convert `MultiIssuerAuthorizeResult` to json string value
497
+ * @returns {string}
498
+ */
499
+ json_string() {
500
+ let deferred1_0;
501
+ let deferred1_1;
502
+ try {
503
+ const ret = wasm.multiissuerauthorizeresult_json_string(this.__wbg_ptr);
504
+ deferred1_0 = ret[0];
505
+ deferred1_1 = ret[1];
506
+ return getStringFromWasm0(ret[0], ret[1]);
507
+ } finally {
508
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
509
+ }
510
+ }
511
+ /**
512
+ * Result of authorization
513
+ * true means `ALLOW`
514
+ * false means `Deny`
515
+ * @param {boolean} arg0
516
+ */
517
+ set decision(arg0) {
518
+ wasm.__wbg_set_multiissuerauthorizeresult_decision(this.__wbg_ptr, arg0);
519
+ }
520
+ /**
521
+ * Request ID of the authorization request
522
+ * @param {string} arg0
523
+ */
524
+ set request_id(arg0) {
525
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
526
+ const len0 = WASM_VECTOR_LEN;
527
+ wasm.__wbg_set_multiissuerauthorizeresult_request_id(this.__wbg_ptr, ptr0, len0);
528
+ }
529
+ /**
530
+ * Result of Cedar policy authorization
531
+ * @param {AuthorizeResultResponse} arg0
532
+ */
533
+ set response(arg0) {
534
+ _assertClass(arg0, AuthorizeResultResponse);
535
+ var ptr0 = arg0.__destroy_into_raw();
536
+ wasm.__wbg_set_multiissuerauthorizeresult_response(this.__wbg_ptr, ptr0);
537
+ }
713
538
  }
714
- if (Symbol.dispose) JsJsonLogic.prototype[Symbol.dispose] = JsJsonLogic.prototype.free;
539
+ if (Symbol.dispose) MultiIssuerAuthorizeResult.prototype[Symbol.dispose] = MultiIssuerAuthorizeResult.prototype.free;
715
540
 
716
541
  /**
717
- * A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
718
- * Represents the result of a multi-issuer authorization request.
542
+ * PolicyEvaluationError
543
+ * =====================
544
+ *
545
+ * Represents an error that occurred when evaluating a Cedar policy.
719
546
  */
720
- export class MultiIssuerAuthorizeResult {
547
+ export class PolicyEvaluationError {
721
548
  static __wrap(ptr) {
722
549
  ptr = ptr >>> 0;
723
- const obj = Object.create(MultiIssuerAuthorizeResult.prototype);
550
+ const obj = Object.create(PolicyEvaluationError.prototype);
724
551
  obj.__wbg_ptr = ptr;
725
- MultiIssuerAuthorizeResultFinalization.register(obj, obj.__wbg_ptr, obj);
552
+ PolicyEvaluationErrorFinalization.register(obj, obj.__wbg_ptr, obj);
726
553
  return obj;
727
554
  }
728
555
  __destroy_into_raw() {
729
556
  const ptr = this.__wbg_ptr;
730
557
  this.__wbg_ptr = 0;
731
- MultiIssuerAuthorizeResultFinalization.unregister(this);
558
+ PolicyEvaluationErrorFinalization.unregister(this);
732
559
  return ptr;
733
560
  }
734
561
  free() {
735
562
  const ptr = this.__destroy_into_raw();
736
- wasm.__wbg_multiissuerauthorizeresult_free(ptr, 0);
563
+ wasm.__wbg_policyevaluationerror_free(ptr, 0);
737
564
  }
738
565
  /**
739
- * Result of Cedar policy authorization
740
- * @returns {AuthorizeResultResponse}
566
+ * Underlying evaluation error string representation
567
+ * @returns {string}
741
568
  */
742
- get response() {
743
- const ret = wasm.__wbg_get_multiissuerauthorizeresult_response(this.__wbg_ptr);
744
- return AuthorizeResultResponse.__wrap(ret);
569
+ get error() {
570
+ let deferred1_0;
571
+ let deferred1_1;
572
+ try {
573
+ const ret = wasm.policyevaluationerror_error(this.__wbg_ptr);
574
+ deferred1_0 = ret[0];
575
+ deferred1_1 = ret[1];
576
+ return getStringFromWasm0(ret[0], ret[1]);
577
+ } finally {
578
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
579
+ }
745
580
  }
746
581
  /**
747
- * Result of Cedar policy authorization
748
- * @param {AuthorizeResultResponse} arg0
582
+ * Id of the policy with an error
583
+ * @returns {string}
749
584
  */
750
- set response(arg0) {
751
- _assertClass(arg0, AuthorizeResultResponse);
752
- var ptr0 = arg0.__destroy_into_raw();
753
- wasm.__wbg_set_multiissuerauthorizeresult_response(this.__wbg_ptr, ptr0);
585
+ get id() {
586
+ let deferred1_0;
587
+ let deferred1_1;
588
+ try {
589
+ const ret = wasm.policyevaluationerror_id(this.__wbg_ptr);
590
+ deferred1_0 = ret[0];
591
+ deferred1_1 = ret[1];
592
+ return getStringFromWasm0(ret[0], ret[1]);
593
+ } finally {
594
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
595
+ }
754
596
  }
755
- /**
756
- * Result of authorization
757
- * true means `ALLOW`
758
- * false means `Deny`
759
- * @returns {boolean}
760
- */
761
- get decision() {
762
- const ret = wasm.__wbg_get_multiissuerauthorizeresult_decision(this.__wbg_ptr);
763
- return ret !== 0;
597
+ }
598
+ if (Symbol.dispose) PolicyEvaluationError.prototype[Symbol.dispose] = PolicyEvaluationError.prototype.free;
599
+
600
+ /**
601
+ * Create a new instance of the Cedarling application.
602
+ * This function can take as config parameter the eather `Map` other `Object`
603
+ * @param {any} config
604
+ * @returns {Promise<Cedarling>}
605
+ */
606
+ export function init(config) {
607
+ const ret = wasm.init(config);
608
+ return ret;
609
+ }
610
+
611
+ /**
612
+ * Create a new instance of the Cedarling application from archive bytes.
613
+ *
614
+ * This function allows loading a policy store from a Cedar Archive (.cjar)
615
+ * that was fetched with custom logic (e.g., with authentication headers).
616
+ *
617
+ * # Arguments
618
+ * * `config` - Bootstrap configuration (Map or Object). Policy store config is ignored.
619
+ * * `archive_bytes` - The .cjar archive bytes (Uint8Array)
620
+ *
621
+ * # Example
622
+ * ```javascript
623
+ * const response = await fetch(url, { headers: { Authorization: 'Bearer ...' } });
624
+ * const bytes = new Uint8Array(await response.arrayBuffer());
625
+ * const cedarling = await init_from_archive_bytes(config, bytes);
626
+ * ```
627
+ * @param {any} config
628
+ * @param {Uint8Array} archive_bytes
629
+ * @returns {Promise<Cedarling>}
630
+ */
631
+ export function init_from_archive_bytes(config, archive_bytes) {
632
+ const ret = wasm.init_from_archive_bytes(config, archive_bytes);
633
+ return ret;
634
+ }
635
+
636
+ function __wbg_get_imports() {
637
+ const import0 = {
638
+ __proto__: null,
639
+ __wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
640
+ const ret = Error(getStringFromWasm0(arg0, arg1));
641
+ return ret;
642
+ },
643
+ __wbg_Number_04624de7d0e8332d: function(arg0) {
644
+ const ret = Number(arg0);
645
+ return ret;
646
+ },
647
+ __wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {
648
+ const ret = String(arg1);
649
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
650
+ const len1 = WASM_VECTOR_LEN;
651
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
652
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
653
+ },
654
+ __wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2: function(arg0, arg1) {
655
+ const v = arg1;
656
+ const ret = typeof(v) === 'bigint' ? v : undefined;
657
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
658
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
659
+ },
660
+ __wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(arg0) {
661
+ const v = arg0;
662
+ const ret = typeof(v) === 'boolean' ? v : undefined;
663
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
664
+ },
665
+ __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
666
+ const ret = debugString(arg1);
667
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
668
+ const len1 = WASM_VECTOR_LEN;
669
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
670
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
671
+ },
672
+ __wbg___wbindgen_in_47fa6863be6f2f25: function(arg0, arg1) {
673
+ const ret = arg0 in arg1;
674
+ return ret;
675
+ },
676
+ __wbg___wbindgen_is_bigint_31b12575b56f32fc: function(arg0) {
677
+ const ret = typeof(arg0) === 'bigint';
678
+ return ret;
679
+ },
680
+ __wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {
681
+ const ret = typeof(arg0) === 'function';
682
+ return ret;
683
+ },
684
+ __wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
685
+ const val = arg0;
686
+ const ret = typeof(val) === 'object' && val !== null;
687
+ return ret;
688
+ },
689
+ __wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {
690
+ const ret = typeof(arg0) === 'string';
691
+ return ret;
692
+ },
693
+ __wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
694
+ const ret = arg0 === undefined;
695
+ return ret;
696
+ },
697
+ __wbg___wbindgen_jsval_eq_11888390b0186270: function(arg0, arg1) {
698
+ const ret = arg0 === arg1;
699
+ return ret;
700
+ },
701
+ __wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811: function(arg0, arg1) {
702
+ const ret = arg0 == arg1;
703
+ return ret;
704
+ },
705
+ __wbg___wbindgen_number_get_8ff4255516ccad3e: function(arg0, arg1) {
706
+ const obj = arg1;
707
+ const ret = typeof(obj) === 'number' ? obj : undefined;
708
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
709
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
710
+ },
711
+ __wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
712
+ const obj = arg1;
713
+ const ret = typeof(obj) === 'string' ? obj : undefined;
714
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
715
+ var len1 = WASM_VECTOR_LEN;
716
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
717
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
718
+ },
719
+ __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
720
+ throw new Error(getStringFromWasm0(arg0, arg1));
721
+ },
722
+ __wbg__wbg_cb_unref_d9b87ff7982e3b21: function(arg0) {
723
+ arg0._wbg_cb_unref();
724
+ },
725
+ __wbg_abort_2f0584e03e8e3950: function(arg0) {
726
+ arg0.abort();
727
+ },
728
+ __wbg_abort_d549b92d3c665de1: function(arg0, arg1) {
729
+ arg0.abort(arg1);
730
+ },
731
+ __wbg_append_a992ccc37aa62dc4: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
732
+ arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
733
+ }, arguments); },
734
+ __wbg_arrayBuffer_bb54076166006c39: function() { return handleError(function (arg0) {
735
+ const ret = arg0.arrayBuffer();
736
+ return ret;
737
+ }, arguments); },
738
+ __wbg_authorizeresult_new: function(arg0) {
739
+ const ret = AuthorizeResult.__wrap(arg0);
740
+ return ret;
741
+ },
742
+ __wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {
743
+ const ret = arg0.call(arg1);
744
+ return ret;
745
+ }, arguments); },
746
+ __wbg_call_4708e0c13bdc8e95: function() { return handleError(function (arg0, arg1, arg2) {
747
+ const ret = arg0.call(arg1, arg2);
748
+ return ret;
749
+ }, arguments); },
750
+ __wbg_cedarling_new: function(arg0) {
751
+ const ret = Cedarling.__wrap(arg0);
752
+ return ret;
753
+ },
754
+ __wbg_clearTimeout_42d9ccd50822fd3a: function(arg0) {
755
+ const ret = clearTimeout(arg0);
756
+ return ret;
757
+ },
758
+ __wbg_crypto_86f2631e91b51511: function(arg0) {
759
+ const ret = arg0.crypto;
760
+ return ret;
761
+ },
762
+ __wbg_debug_8b4b5465cbd54cd3: function(arg0) {
763
+ console.debug(...arg0);
764
+ },
765
+ __wbg_done_57b39ecd9addfe81: function(arg0) {
766
+ const ret = arg0.done;
767
+ return ret;
768
+ },
769
+ __wbg_entries_200a450561fa274f: function(arg0) {
770
+ const ret = arg0.entries();
771
+ return ret;
772
+ },
773
+ __wbg_entries_58c7934c745daac7: function(arg0) {
774
+ const ret = Object.entries(arg0);
775
+ return ret;
776
+ },
777
+ __wbg_error_62201eec3c0d66f9: function(arg0) {
778
+ console.error(...arg0);
779
+ },
780
+ __wbg_fetch_6bbc32f991730587: function(arg0) {
781
+ const ret = fetch(arg0);
782
+ return ret;
783
+ },
784
+ __wbg_fetch_afb6a4b6cacf876d: function(arg0, arg1) {
785
+ const ret = arg0.fetch(arg1);
786
+ return ret;
787
+ },
788
+ __wbg_fromEntries_7fb5bc874dbe50d5: function() { return handleError(function (arg0) {
789
+ const ret = Object.fromEntries(arg0);
790
+ return ret;
791
+ }, arguments); },
792
+ __wbg_getRandomValues_1c61fac11405ffdc: function() { return handleError(function (arg0, arg1) {
793
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
794
+ }, arguments); },
795
+ __wbg_getRandomValues_b3f15fcbfabb0f8b: function() { return handleError(function (arg0, arg1) {
796
+ arg0.getRandomValues(arg1);
797
+ }, arguments); },
798
+ __wbg_getTime_1e3cd1391c5c3995: function(arg0) {
799
+ const ret = arg0.getTime();
800
+ return ret;
801
+ },
802
+ __wbg_getTimezoneOffset_81776d10a4ec18a8: function(arg0) {
803
+ const ret = arg0.getTimezoneOffset();
804
+ return ret;
805
+ },
806
+ __wbg_get_9b94d73e6221f75c: function(arg0, arg1) {
807
+ const ret = arg0[arg1 >>> 0];
808
+ return ret;
809
+ },
810
+ __wbg_get_b3ed3ad4be2bc8ac: function() { return handleError(function (arg0, arg1) {
811
+ const ret = Reflect.get(arg0, arg1);
812
+ return ret;
813
+ }, arguments); },
814
+ __wbg_get_with_ref_key_1dc361bd10053bfe: function(arg0, arg1) {
815
+ const ret = arg0[arg1];
816
+ return ret;
817
+ },
818
+ __wbg_has_d4e53238966c12b6: function() { return handleError(function (arg0, arg1) {
819
+ const ret = Reflect.has(arg0, arg1);
820
+ return ret;
821
+ }, arguments); },
822
+ __wbg_headers_59a2938db9f80985: function(arg0) {
823
+ const ret = arg0.headers;
824
+ return ret;
825
+ },
826
+ __wbg_info_eb43cb09e10f8150: function(arg0) {
827
+ console.info(...arg0);
828
+ },
829
+ __wbg_instanceof_ArrayBuffer_c367199e2fa2aa04: function(arg0) {
830
+ let result;
831
+ try {
832
+ result = arg0 instanceof ArrayBuffer;
833
+ } catch (_) {
834
+ result = false;
835
+ }
836
+ const ret = result;
837
+ return ret;
838
+ },
839
+ __wbg_instanceof_Array_d9eac779cd191cbc: function(arg0) {
840
+ let result;
841
+ try {
842
+ result = arg0 instanceof Array;
843
+ } catch (_) {
844
+ result = false;
845
+ }
846
+ const ret = result;
847
+ return ret;
848
+ },
849
+ __wbg_instanceof_Map_53af74335dec57f4: function(arg0) {
850
+ let result;
851
+ try {
852
+ result = arg0 instanceof Map;
853
+ } catch (_) {
854
+ result = false;
855
+ }
856
+ const ret = result;
857
+ return ret;
858
+ },
859
+ __wbg_instanceof_Response_ee1d54d79ae41977: function(arg0) {
860
+ let result;
861
+ try {
862
+ result = arg0 instanceof Response;
863
+ } catch (_) {
864
+ result = false;
865
+ }
866
+ const ret = result;
867
+ return ret;
868
+ },
869
+ __wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {
870
+ let result;
871
+ try {
872
+ result = arg0 instanceof Uint8Array;
873
+ } catch (_) {
874
+ result = false;
875
+ }
876
+ const ret = result;
877
+ return ret;
878
+ },
879
+ __wbg_isArray_d314bb98fcf08331: function(arg0) {
880
+ const ret = Array.isArray(arg0);
881
+ return ret;
882
+ },
883
+ __wbg_isSafeInteger_bfbc7332a9768d2a: function(arg0) {
884
+ const ret = Number.isSafeInteger(arg0);
885
+ return ret;
886
+ },
887
+ __wbg_iterator_6ff6560ca1568e55: function() {
888
+ const ret = Symbol.iterator;
889
+ return ret;
890
+ },
891
+ __wbg_keys_b50a709a76add04e: function(arg0) {
892
+ const ret = Object.keys(arg0);
893
+ return ret;
894
+ },
895
+ __wbg_length_32ed9a279acd054c: function(arg0) {
896
+ const ret = arg0.length;
897
+ return ret;
898
+ },
899
+ __wbg_length_35a7bace40f36eac: function(arg0) {
900
+ const ret = arg0.length;
901
+ return ret;
902
+ },
903
+ __wbg_log_aa96eafb763b3303: function(arg0) {
904
+ console.log(...arg0);
905
+ },
906
+ __wbg_msCrypto_d562bbe83e0d4b91: function(arg0) {
907
+ const ret = arg0.msCrypto;
908
+ return ret;
909
+ },
910
+ __wbg_multiissuerauthorizeresult_new: function(arg0) {
911
+ const ret = MultiIssuerAuthorizeResult.__wrap(arg0);
912
+ return ret;
913
+ },
914
+ __wbg_new_0_73afc35eb544e539: function() {
915
+ const ret = new Date();
916
+ return ret;
917
+ },
918
+ __wbg_new_245cd5c49157e602: function(arg0) {
919
+ const ret = new Date(arg0);
920
+ return ret;
921
+ },
922
+ __wbg_new_361308b2356cecd0: function() {
923
+ const ret = new Object();
924
+ return ret;
925
+ },
926
+ __wbg_new_3eb36ae241fe6f44: function() {
927
+ const ret = new Array();
928
+ return ret;
929
+ },
930
+ __wbg_new_64284bd487f9d239: function() { return handleError(function () {
931
+ const ret = new Headers();
932
+ return ret;
933
+ }, arguments); },
934
+ __wbg_new_b5d9e2fb389fef91: function(arg0, arg1) {
935
+ try {
936
+ var state0 = {a: arg0, b: arg1};
937
+ var cb0 = (arg0, arg1) => {
938
+ const a = state0.a;
939
+ state0.a = 0;
940
+ try {
941
+ return wasm_bindgen__convert__closures_____invoke__h0faf1ddcbd616c7a(a, state0.b, arg0, arg1);
942
+ } finally {
943
+ state0.a = a;
944
+ }
945
+ };
946
+ const ret = new Promise(cb0);
947
+ return ret;
948
+ } finally {
949
+ state0.a = state0.b = 0;
950
+ }
951
+ },
952
+ __wbg_new_b949e7f56150a5d1: function() { return handleError(function () {
953
+ const ret = new AbortController();
954
+ return ret;
955
+ }, arguments); },
956
+ __wbg_new_dca287b076112a51: function() {
957
+ const ret = new Map();
958
+ return ret;
959
+ },
960
+ __wbg_new_dd2b680c8bf6ae29: function(arg0) {
961
+ const ret = new Uint8Array(arg0);
962
+ return ret;
963
+ },
964
+ __wbg_new_from_slice_a3d2629dc1826784: function(arg0, arg1) {
965
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
966
+ return ret;
967
+ },
968
+ __wbg_new_no_args_1c7c842f08d00ebb: function(arg0, arg1) {
969
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
970
+ return ret;
971
+ },
972
+ __wbg_new_with_args_7bba34e94b1cfa40: function(arg0, arg1, arg2, arg3) {
973
+ const ret = new Function(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
974
+ return ret;
975
+ },
976
+ __wbg_new_with_length_a2c39cbe88fd8ff1: function(arg0) {
977
+ const ret = new Uint8Array(arg0 >>> 0);
978
+ return ret;
979
+ },
980
+ __wbg_new_with_str_and_init_a61cbc6bdef21614: function() { return handleError(function (arg0, arg1, arg2) {
981
+ const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
982
+ return ret;
983
+ }, arguments); },
984
+ __wbg_next_3482f54c49e8af19: function() { return handleError(function (arg0) {
985
+ const ret = arg0.next();
986
+ return ret;
987
+ }, arguments); },
988
+ __wbg_next_418f80d8f5303233: function(arg0) {
989
+ const ret = arg0.next;
990
+ return ret;
991
+ },
992
+ __wbg_node_e1f24f89a7336c2e: function(arg0) {
993
+ const ret = arg0.node;
994
+ return ret;
995
+ },
996
+ __wbg_policyevaluationerror_new: function(arg0) {
997
+ const ret = PolicyEvaluationError.__wrap(arg0);
998
+ return ret;
999
+ },
1000
+ __wbg_process_3975fd6c72f520aa: function(arg0) {
1001
+ const ret = arg0.process;
1002
+ return ret;
1003
+ },
1004
+ __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
1005
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1006
+ },
1007
+ __wbg_push_8ffdcb2063340ba5: function(arg0, arg1) {
1008
+ const ret = arg0.push(arg1);
1009
+ return ret;
1010
+ },
1011
+ __wbg_queueMicrotask_0aa0a927f78f5d98: function(arg0) {
1012
+ const ret = arg0.queueMicrotask;
1013
+ return ret;
1014
+ },
1015
+ __wbg_queueMicrotask_5bb536982f78a56f: function(arg0) {
1016
+ queueMicrotask(arg0);
1017
+ },
1018
+ __wbg_randomFillSync_f8c153b79f285817: function() { return handleError(function (arg0, arg1) {
1019
+ arg0.randomFillSync(arg1);
1020
+ }, arguments); },
1021
+ __wbg_require_b74f47fc2d022fd6: function() { return handleError(function () {
1022
+ const ret = module.require;
1023
+ return ret;
1024
+ }, arguments); },
1025
+ __wbg_resolve_002c4b7d9d8f6b64: function(arg0) {
1026
+ const ret = Promise.resolve(arg0);
1027
+ return ret;
1028
+ },
1029
+ __wbg_setTimeout_4ec014681668a581: function(arg0, arg1) {
1030
+ const ret = setTimeout(arg0, arg1);
1031
+ return ret;
1032
+ },
1033
+ __wbg_set_1eb0999cf5d27fc8: function(arg0, arg1, arg2) {
1034
+ const ret = arg0.set(arg1, arg2);
1035
+ return ret;
1036
+ },
1037
+ __wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {
1038
+ arg0[arg1] = arg2;
1039
+ },
1040
+ __wbg_set_6cb8631f80447a67: function() { return handleError(function (arg0, arg1, arg2) {
1041
+ const ret = Reflect.set(arg0, arg1, arg2);
1042
+ return ret;
1043
+ }, arguments); },
1044
+ __wbg_set_body_9a7e00afe3cfe244: function(arg0, arg1) {
1045
+ arg0.body = arg1;
1046
+ },
1047
+ __wbg_set_cache_315a3ed773a41543: function(arg0, arg1) {
1048
+ arg0.cache = __wbindgen_enum_RequestCache[arg1];
1049
+ },
1050
+ __wbg_set_credentials_c4a58d2e05ef24fb: function(arg0, arg1) {
1051
+ arg0.credentials = __wbindgen_enum_RequestCredentials[arg1];
1052
+ },
1053
+ __wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
1054
+ arg0[arg1 >>> 0] = arg2;
1055
+ },
1056
+ __wbg_set_headers_cfc5f4b2c1f20549: function(arg0, arg1) {
1057
+ arg0.headers = arg1;
1058
+ },
1059
+ __wbg_set_method_c3e20375f5ae7fac: function(arg0, arg1, arg2) {
1060
+ arg0.method = getStringFromWasm0(arg1, arg2);
1061
+ },
1062
+ __wbg_set_mode_b13642c312648202: function(arg0, arg1) {
1063
+ arg0.mode = __wbindgen_enum_RequestMode[arg1];
1064
+ },
1065
+ __wbg_set_signal_f2d3f8599248896d: function(arg0, arg1) {
1066
+ arg0.signal = arg1;
1067
+ },
1068
+ __wbg_signal_d1285ecab4ebc5ad: function(arg0) {
1069
+ const ret = arg0.signal;
1070
+ return ret;
1071
+ },
1072
+ __wbg_static_accessor_GLOBAL_12837167ad935116: function() {
1073
+ const ret = typeof global === 'undefined' ? null : global;
1074
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1075
+ },
1076
+ __wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f: function() {
1077
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1078
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1079
+ },
1080
+ __wbg_static_accessor_SELF_a621d3dfbb60d0ce: function() {
1081
+ const ret = typeof self === 'undefined' ? null : self;
1082
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1083
+ },
1084
+ __wbg_static_accessor_WINDOW_f8727f0cf888e0bd: function() {
1085
+ const ret = typeof window === 'undefined' ? null : window;
1086
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1087
+ },
1088
+ __wbg_status_89d7e803db911ee7: function(arg0) {
1089
+ const ret = arg0.status;
1090
+ return ret;
1091
+ },
1092
+ __wbg_stringify_8d1cc6ff383e8bae: function() { return handleError(function (arg0) {
1093
+ const ret = JSON.stringify(arg0);
1094
+ return ret;
1095
+ }, arguments); },
1096
+ __wbg_subarray_a96e1fef17ed23cb: function(arg0, arg1, arg2) {
1097
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1098
+ return ret;
1099
+ },
1100
+ __wbg_text_083b8727c990c8c0: function() { return handleError(function (arg0) {
1101
+ const ret = arg0.text();
1102
+ return ret;
1103
+ }, arguments); },
1104
+ __wbg_then_0d9fe2c7b1857d32: function(arg0, arg1, arg2) {
1105
+ const ret = arg0.then(arg1, arg2);
1106
+ return ret;
1107
+ },
1108
+ __wbg_then_b9e7b3b5f1a9e1b5: function(arg0, arg1) {
1109
+ const ret = arg0.then(arg1);
1110
+ return ret;
1111
+ },
1112
+ __wbg_trace_21a493b80d415f00: function(arg0) {
1113
+ console.trace(...arg0);
1114
+ },
1115
+ __wbg_url_c484c26b1fbf5126: function(arg0, arg1) {
1116
+ const ret = arg1.url;
1117
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1118
+ const len1 = WASM_VECTOR_LEN;
1119
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1120
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1121
+ },
1122
+ __wbg_value_0546255b415e96c1: function(arg0) {
1123
+ const ret = arg0.value;
1124
+ return ret;
1125
+ },
1126
+ __wbg_versions_4e31226f5e8dc909: function(arg0) {
1127
+ const ret = arg0.versions;
1128
+ return ret;
1129
+ },
1130
+ __wbg_warn_f3657073f42e55b4: function(arg0) {
1131
+ console.warn(...arg0);
1132
+ },
1133
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1134
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 553, function: Function { arguments: [], shim_idx: 554, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1135
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h093a13d1206f793f, wasm_bindgen__convert__closures_____invoke__h07e5bc5e1bd52c7a);
1136
+ return ret;
1137
+ },
1138
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
1139
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 597, function: Function { arguments: [Externref], shim_idx: 598, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1140
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h203c69ac48ff2433, wasm_bindgen__convert__closures_____invoke__h409efd46af9acece);
1141
+ return ret;
1142
+ },
1143
+ __wbindgen_cast_0000000000000003: function(arg0) {
1144
+ // Cast intrinsic for `F64 -> Externref`.
1145
+ const ret = arg0;
1146
+ return ret;
1147
+ },
1148
+ __wbindgen_cast_0000000000000004: function(arg0) {
1149
+ // Cast intrinsic for `I64 -> Externref`.
1150
+ const ret = arg0;
1151
+ return ret;
1152
+ },
1153
+ __wbindgen_cast_0000000000000005: function(arg0, arg1) {
1154
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
1155
+ const ret = getArrayU8FromWasm0(arg0, arg1);
1156
+ return ret;
1157
+ },
1158
+ __wbindgen_cast_0000000000000006: function(arg0, arg1) {
1159
+ // Cast intrinsic for `Ref(String) -> Externref`.
1160
+ const ret = getStringFromWasm0(arg0, arg1);
1161
+ return ret;
1162
+ },
1163
+ __wbindgen_cast_0000000000000007: function(arg0) {
1164
+ // Cast intrinsic for `U64 -> Externref`.
1165
+ const ret = BigInt.asUintN(64, arg0);
1166
+ return ret;
1167
+ },
1168
+ __wbindgen_init_externref_table: function() {
1169
+ const table = wasm.__wbindgen_externrefs;
1170
+ const offset = table.grow(4);
1171
+ table.set(0, undefined);
1172
+ table.set(offset + 0, undefined);
1173
+ table.set(offset + 1, null);
1174
+ table.set(offset + 2, true);
1175
+ table.set(offset + 3, false);
1176
+ },
1177
+ };
1178
+ return {
1179
+ __proto__: null,
1180
+ "./cedarling_wasm_bg.js": import0,
1181
+ };
1182
+ }
1183
+
1184
+ function wasm_bindgen__convert__closures_____invoke__h07e5bc5e1bd52c7a(arg0, arg1) {
1185
+ wasm.wasm_bindgen__convert__closures_____invoke__h07e5bc5e1bd52c7a(arg0, arg1);
1186
+ }
1187
+
1188
+ function wasm_bindgen__convert__closures_____invoke__h409efd46af9acece(arg0, arg1, arg2) {
1189
+ wasm.wasm_bindgen__convert__closures_____invoke__h409efd46af9acece(arg0, arg1, arg2);
1190
+ }
1191
+
1192
+ function wasm_bindgen__convert__closures_____invoke__h0faf1ddcbd616c7a(arg0, arg1, arg2, arg3) {
1193
+ wasm.wasm_bindgen__convert__closures_____invoke__h0faf1ddcbd616c7a(arg0, arg1, arg2, arg3);
1194
+ }
1195
+
1196
+
1197
+ const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
1198
+
1199
+
1200
+ const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
1201
+
1202
+
1203
+ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
1204
+ const AuthorizeResultFinalization = (typeof FinalizationRegistry === 'undefined')
1205
+ ? { register: () => {}, unregister: () => {} }
1206
+ : new FinalizationRegistry(ptr => wasm.__wbg_authorizeresult_free(ptr >>> 0, 1));
1207
+ const AuthorizeResultResponseFinalization = (typeof FinalizationRegistry === 'undefined')
1208
+ ? { register: () => {}, unregister: () => {} }
1209
+ : new FinalizationRegistry(ptr => wasm.__wbg_authorizeresultresponse_free(ptr >>> 0, 1));
1210
+ const CedarlingFinalization = (typeof FinalizationRegistry === 'undefined')
1211
+ ? { register: () => {}, unregister: () => {} }
1212
+ : new FinalizationRegistry(ptr => wasm.__wbg_cedarling_free(ptr >>> 0, 1));
1213
+ const DiagnosticsFinalization = (typeof FinalizationRegistry === 'undefined')
1214
+ ? { register: () => {}, unregister: () => {} }
1215
+ : new FinalizationRegistry(ptr => wasm.__wbg_diagnostics_free(ptr >>> 0, 1));
1216
+ const JsJsonLogicFinalization = (typeof FinalizationRegistry === 'undefined')
1217
+ ? { register: () => {}, unregister: () => {} }
1218
+ : new FinalizationRegistry(ptr => wasm.__wbg_jsjsonlogic_free(ptr >>> 0, 1));
1219
+ const MultiIssuerAuthorizeResultFinalization = (typeof FinalizationRegistry === 'undefined')
1220
+ ? { register: () => {}, unregister: () => {} }
1221
+ : new FinalizationRegistry(ptr => wasm.__wbg_multiissuerauthorizeresult_free(ptr >>> 0, 1));
1222
+ const PolicyEvaluationErrorFinalization = (typeof FinalizationRegistry === 'undefined')
1223
+ ? { register: () => {}, unregister: () => {} }
1224
+ : new FinalizationRegistry(ptr => wasm.__wbg_policyevaluationerror_free(ptr >>> 0, 1));
1225
+
1226
+ function addToExternrefTable0(obj) {
1227
+ const idx = wasm.__externref_table_alloc();
1228
+ wasm.__wbindgen_externrefs.set(idx, obj);
1229
+ return idx;
1230
+ }
1231
+
1232
+ function _assertClass(instance, klass) {
1233
+ if (!(instance instanceof klass)) {
1234
+ throw new Error(`expected instance of ${klass.name}`);
1235
+ }
1236
+ }
1237
+
1238
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
1239
+ ? { register: () => {}, unregister: () => {} }
1240
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
1241
+
1242
+ function debugString(val) {
1243
+ // primitive types
1244
+ const type = typeof val;
1245
+ if (type == 'number' || type == 'boolean' || val == null) {
1246
+ return `${val}`;
1247
+ }
1248
+ if (type == 'string') {
1249
+ return `"${val}"`;
1250
+ }
1251
+ if (type == 'symbol') {
1252
+ const description = val.description;
1253
+ if (description == null) {
1254
+ return 'Symbol';
1255
+ } else {
1256
+ return `Symbol(${description})`;
1257
+ }
764
1258
  }
765
- /**
766
- * Result of authorization
767
- * true means `ALLOW`
768
- * false means `Deny`
769
- * @param {boolean} arg0
770
- */
771
- set decision(arg0) {
772
- wasm.__wbg_set_multiissuerauthorizeresult_decision(this.__wbg_ptr, arg0);
1259
+ if (type == 'function') {
1260
+ const name = val.name;
1261
+ if (typeof name == 'string' && name.length > 0) {
1262
+ return `Function(${name})`;
1263
+ } else {
1264
+ return 'Function';
1265
+ }
773
1266
  }
774
- /**
775
- * Request ID of the authorization request
776
- * @returns {string}
777
- */
778
- get request_id() {
779
- let deferred1_0;
780
- let deferred1_1;
781
- try {
782
- const ret = wasm.__wbg_get_multiissuerauthorizeresult_request_id(this.__wbg_ptr);
783
- deferred1_0 = ret[0];
784
- deferred1_1 = ret[1];
785
- return getStringFromWasm0(ret[0], ret[1]);
786
- } finally {
787
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1267
+ // objects
1268
+ if (Array.isArray(val)) {
1269
+ const length = val.length;
1270
+ let debug = '[';
1271
+ if (length > 0) {
1272
+ debug += debugString(val[0]);
788
1273
  }
1274
+ for(let i = 1; i < length; i++) {
1275
+ debug += ', ' + debugString(val[i]);
1276
+ }
1277
+ debug += ']';
1278
+ return debug;
789
1279
  }
790
- /**
791
- * Request ID of the authorization request
792
- * @param {string} arg0
793
- */
794
- set request_id(arg0) {
795
- const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
796
- const len0 = WASM_VECTOR_LEN;
797
- wasm.__wbg_set_multiissuerauthorizeresult_request_id(this.__wbg_ptr, ptr0, len0);
1280
+ // Test for built-in
1281
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1282
+ let className;
1283
+ if (builtInMatches && builtInMatches.length > 1) {
1284
+ className = builtInMatches[1];
1285
+ } else {
1286
+ // Failed to match the standard '[object ClassName]'
1287
+ return toString.call(val);
798
1288
  }
799
- /**
800
- * Convert `MultiIssuerAuthorizeResult` to json string value
801
- * @returns {string}
802
- */
803
- json_string() {
804
- let deferred1_0;
805
- let deferred1_1;
1289
+ if (className == 'Object') {
1290
+ // we're a user defined class or Object
1291
+ // JSON.stringify avoids problems with cycles, and is generally much
1292
+ // easier than looping through ownProperties of `val`.
806
1293
  try {
807
- const ret = wasm.multiissuerauthorizeresult_json_string(this.__wbg_ptr);
808
- deferred1_0 = ret[0];
809
- deferred1_1 = ret[1];
810
- return getStringFromWasm0(ret[0], ret[1]);
811
- } finally {
812
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1294
+ return 'Object(' + JSON.stringify(val) + ')';
1295
+ } catch (_) {
1296
+ return 'Object';
813
1297
  }
814
1298
  }
1299
+ // errors
1300
+ if (val instanceof Error) {
1301
+ return `${val.name}: ${val.message}\n${val.stack}`;
1302
+ }
1303
+ // TODO we could test for more things here, like `Set`s and `Map`s.
1304
+ return className;
815
1305
  }
816
- if (Symbol.dispose) MultiIssuerAuthorizeResult.prototype[Symbol.dispose] = MultiIssuerAuthorizeResult.prototype.free;
817
1306
 
818
- /**
819
- * PolicyEvaluationError
820
- * =====================
821
- *
822
- * Represents an error that occurred when evaluating a Cedar policy.
823
- */
824
- export class PolicyEvaluationError {
825
- static __wrap(ptr) {
826
- ptr = ptr >>> 0;
827
- const obj = Object.create(PolicyEvaluationError.prototype);
828
- obj.__wbg_ptr = ptr;
829
- PolicyEvaluationErrorFinalization.register(obj, obj.__wbg_ptr, obj);
830
- return obj;
1307
+ function getArrayJsValueFromWasm0(ptr, len) {
1308
+ ptr = ptr >>> 0;
1309
+ const mem = getDataViewMemory0();
1310
+ const result = [];
1311
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
1312
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
831
1313
  }
832
- __destroy_into_raw() {
833
- const ptr = this.__wbg_ptr;
834
- this.__wbg_ptr = 0;
835
- PolicyEvaluationErrorFinalization.unregister(this);
836
- return ptr;
1314
+ wasm.__externref_drop_slice(ptr, len);
1315
+ return result;
1316
+ }
1317
+
1318
+ function getArrayU8FromWasm0(ptr, len) {
1319
+ ptr = ptr >>> 0;
1320
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1321
+ }
1322
+
1323
+ let cachedDataViewMemory0 = null;
1324
+ function getDataViewMemory0() {
1325
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1326
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
837
1327
  }
838
- free() {
839
- const ptr = this.__destroy_into_raw();
840
- wasm.__wbg_policyevaluationerror_free(ptr, 0);
1328
+ return cachedDataViewMemory0;
1329
+ }
1330
+
1331
+ function getStringFromWasm0(ptr, len) {
1332
+ ptr = ptr >>> 0;
1333
+ return decodeText(ptr, len);
1334
+ }
1335
+
1336
+ let cachedUint8ArrayMemory0 = null;
1337
+ function getUint8ArrayMemory0() {
1338
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1339
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
841
1340
  }
842
- /**
843
- * Id of the policy with an error
844
- * @returns {string}
845
- */
846
- get id() {
847
- let deferred1_0;
848
- let deferred1_1;
1341
+ return cachedUint8ArrayMemory0;
1342
+ }
1343
+
1344
+ function handleError(f, args) {
1345
+ try {
1346
+ return f.apply(this, args);
1347
+ } catch (e) {
1348
+ const idx = addToExternrefTable0(e);
1349
+ wasm.__wbindgen_exn_store(idx);
1350
+ }
1351
+ }
1352
+
1353
+ function isLikeNone(x) {
1354
+ return x === undefined || x === null;
1355
+ }
1356
+
1357
+ function makeMutClosure(arg0, arg1, dtor, f) {
1358
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
1359
+ const real = (...args) => {
1360
+
1361
+ // First up with a closure we increment the internal reference
1362
+ // count. This ensures that the Rust closure environment won't
1363
+ // be deallocated while we're invoking it.
1364
+ state.cnt++;
1365
+ const a = state.a;
1366
+ state.a = 0;
849
1367
  try {
850
- const ret = wasm.policyevaluationerror_id(this.__wbg_ptr);
851
- deferred1_0 = ret[0];
852
- deferred1_1 = ret[1];
853
- return getStringFromWasm0(ret[0], ret[1]);
1368
+ return f(a, state.b, ...args);
854
1369
  } finally {
855
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1370
+ state.a = a;
1371
+ real._wbg_cb_unref();
1372
+ }
1373
+ };
1374
+ real._wbg_cb_unref = () => {
1375
+ if (--state.cnt === 0) {
1376
+ state.dtor(state.a, state.b);
1377
+ state.a = 0;
1378
+ CLOSURE_DTORS.unregister(state);
856
1379
  }
1380
+ };
1381
+ CLOSURE_DTORS.register(real, state, state);
1382
+ return real;
1383
+ }
1384
+
1385
+ function passStringToWasm0(arg, malloc, realloc) {
1386
+ if (realloc === undefined) {
1387
+ const buf = cachedTextEncoder.encode(arg);
1388
+ const ptr = malloc(buf.length, 1) >>> 0;
1389
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1390
+ WASM_VECTOR_LEN = buf.length;
1391
+ return ptr;
857
1392
  }
858
- /**
859
- * Underlying evaluation error string representation
860
- * @returns {string}
861
- */
862
- get error() {
863
- let deferred1_0;
864
- let deferred1_1;
865
- try {
866
- const ret = wasm.policyevaluationerror_error(this.__wbg_ptr);
867
- deferred1_0 = ret[0];
868
- deferred1_1 = ret[1];
869
- return getStringFromWasm0(ret[0], ret[1]);
870
- } finally {
871
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1393
+
1394
+ let len = arg.length;
1395
+ let ptr = malloc(len, 1) >>> 0;
1396
+
1397
+ const mem = getUint8ArrayMemory0();
1398
+
1399
+ let offset = 0;
1400
+
1401
+ for (; offset < len; offset++) {
1402
+ const code = arg.charCodeAt(offset);
1403
+ if (code > 0x7F) break;
1404
+ mem[ptr + offset] = code;
1405
+ }
1406
+ if (offset !== len) {
1407
+ if (offset !== 0) {
1408
+ arg = arg.slice(offset);
872
1409
  }
1410
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1411
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1412
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1413
+
1414
+ offset += ret.written;
1415
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1416
+ }
1417
+
1418
+ WASM_VECTOR_LEN = offset;
1419
+ return ptr;
1420
+ }
1421
+
1422
+ function takeFromExternrefTable0(idx) {
1423
+ const value = wasm.__wbindgen_externrefs.get(idx);
1424
+ wasm.__externref_table_dealloc(idx);
1425
+ return value;
1426
+ }
1427
+
1428
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1429
+ cachedTextDecoder.decode();
1430
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1431
+ let numBytesDecoded = 0;
1432
+ function decodeText(ptr, len) {
1433
+ numBytesDecoded += len;
1434
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1435
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1436
+ cachedTextDecoder.decode();
1437
+ numBytesDecoded = len;
873
1438
  }
1439
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
874
1440
  }
875
- if (Symbol.dispose) PolicyEvaluationError.prototype[Symbol.dispose] = PolicyEvaluationError.prototype.free;
876
1441
 
877
- /**
878
- * Create a new instance of the Cedarling application.
879
- * This function can take as config parameter the eather `Map` other `Object`
880
- * @param {any} config
881
- * @returns {Promise<Cedarling>}
882
- */
883
- export function init(config) {
884
- const ret = wasm.init(config);
885
- return ret;
1442
+ const cachedTextEncoder = new TextEncoder();
1443
+
1444
+ if (!('encodeInto' in cachedTextEncoder)) {
1445
+ cachedTextEncoder.encodeInto = function (arg, view) {
1446
+ const buf = cachedTextEncoder.encode(arg);
1447
+ view.set(buf);
1448
+ return {
1449
+ read: arg.length,
1450
+ written: buf.length
1451
+ };
1452
+ };
886
1453
  }
887
1454
 
888
- const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
1455
+ let WASM_VECTOR_LEN = 0;
1456
+
1457
+ let wasmModule, wasm;
1458
+ function __wbg_finalize_init(instance, module) {
1459
+ wasm = instance.exports;
1460
+ wasmModule = module;
1461
+ cachedDataViewMemory0 = null;
1462
+ cachedUint8ArrayMemory0 = null;
1463
+ wasm.__wbindgen_start();
1464
+ return wasm;
1465
+ }
889
1466
 
890
1467
  async function __wbg_load(module, imports) {
891
1468
  if (typeof Response === 'function' && module instanceof Response) {
@@ -893,14 +1470,12 @@ async function __wbg_load(module, imports) {
893
1470
  try {
894
1471
  return await WebAssembly.instantiateStreaming(module, imports);
895
1472
  } catch (e) {
896
- const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
1473
+ const validResponse = module.ok && expectedResponseType(module.type);
897
1474
 
898
1475
  if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
899
1476
  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);
900
1477
 
901
- } else {
902
- throw e;
903
- }
1478
+ } else { throw e; }
904
1479
  }
905
1480
  }
906
1481
 
@@ -915,569 +1490,20 @@ async function __wbg_load(module, imports) {
915
1490
  return instance;
916
1491
  }
917
1492
  }
918
- }
919
1493
 
920
- function __wbg_get_imports() {
921
- const imports = {};
922
- imports.wbg = {};
923
- imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
924
- const ret = Error(getStringFromWasm0(arg0, arg1));
925
- return ret;
926
- };
927
- imports.wbg.__wbg_Number_2d1dcfcf4ec51736 = function(arg0) {
928
- const ret = Number(arg0);
929
- return ret;
930
- };
931
- imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
932
- const ret = String(arg1);
933
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
934
- const len1 = WASM_VECTOR_LEN;
935
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
936
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
937
- };
938
- imports.wbg.__wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d = function(arg0, arg1) {
939
- const v = arg1;
940
- const ret = typeof(v) === 'bigint' ? v : undefined;
941
- getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
942
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
943
- };
944
- imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
945
- const v = arg0;
946
- const ret = typeof(v) === 'boolean' ? v : undefined;
947
- return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
948
- };
949
- imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
950
- const ret = debugString(arg1);
951
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
952
- const len1 = WASM_VECTOR_LEN;
953
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
954
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
955
- };
956
- imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
957
- const ret = arg0 in arg1;
958
- return ret;
959
- };
960
- imports.wbg.__wbg___wbindgen_is_bigint_0e1a2e3f55cfae27 = function(arg0) {
961
- const ret = typeof(arg0) === 'bigint';
962
- return ret;
963
- };
964
- imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
965
- const ret = typeof(arg0) === 'function';
966
- return ret;
967
- };
968
- imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
969
- const val = arg0;
970
- const ret = typeof(val) === 'object' && val !== null;
971
- return ret;
972
- };
973
- imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
974
- const ret = typeof(arg0) === 'string';
975
- return ret;
976
- };
977
- imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
978
- const ret = arg0 === undefined;
979
- return ret;
980
- };
981
- imports.wbg.__wbg___wbindgen_jsval_eq_b6101cc9cef1fe36 = function(arg0, arg1) {
982
- const ret = arg0 === arg1;
983
- return ret;
984
- };
985
- imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
986
- const ret = arg0 == arg1;
987
- return ret;
988
- };
989
- imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
990
- const obj = arg1;
991
- const ret = typeof(obj) === 'number' ? obj : undefined;
992
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
993
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
994
- };
995
- imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
996
- const obj = arg1;
997
- const ret = typeof(obj) === 'string' ? obj : undefined;
998
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
999
- var len1 = WASM_VECTOR_LEN;
1000
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1001
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1002
- };
1003
- imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
1004
- throw new Error(getStringFromWasm0(arg0, arg1));
1005
- };
1006
- imports.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7 = function(arg0) {
1007
- arg0._wbg_cb_unref();
1008
- };
1009
- imports.wbg.__wbg_abort_07646c894ebbf2bd = function(arg0) {
1010
- arg0.abort();
1011
- };
1012
- imports.wbg.__wbg_abort_399ecbcfd6ef3c8e = function(arg0, arg1) {
1013
- arg0.abort(arg1);
1014
- };
1015
- imports.wbg.__wbg_append_c5cbdf46455cc776 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
1016
- arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
1017
- }, arguments) };
1018
- imports.wbg.__wbg_arrayBuffer_c04af4fce566092d = function() { return handleError(function (arg0) {
1019
- const ret = arg0.arrayBuffer();
1020
- return ret;
1021
- }, arguments) };
1022
- imports.wbg.__wbg_authorizeresult_new = function(arg0) {
1023
- const ret = AuthorizeResult.__wrap(arg0);
1024
- return ret;
1025
- };
1026
- imports.wbg.__wbg_call_3020136f7a2d6e44 = function() { return handleError(function (arg0, arg1, arg2) {
1027
- const ret = arg0.call(arg1, arg2);
1028
- return ret;
1029
- }, arguments) };
1030
- imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
1031
- const ret = arg0.call(arg1);
1032
- return ret;
1033
- }, arguments) };
1034
- imports.wbg.__wbg_cedarling_new = function(arg0) {
1035
- const ret = Cedarling.__wrap(arg0);
1036
- return ret;
1037
- };
1038
- imports.wbg.__wbg_clearTimeout_b716ecb44bea14ed = function(arg0) {
1039
- const ret = clearTimeout(arg0);
1040
- return ret;
1041
- };
1042
- imports.wbg.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
1043
- const ret = arg0.crypto;
1044
- return ret;
1045
- };
1046
- imports.wbg.__wbg_debug_24d884048190fccc = function(arg0) {
1047
- console.debug(...arg0);
1048
- };
1049
- imports.wbg.__wbg_done_62ea16af4ce34b24 = function(arg0) {
1050
- const ret = arg0.done;
1051
- return ret;
1052
- };
1053
- imports.wbg.__wbg_entries_83c79938054e065f = function(arg0) {
1054
- const ret = Object.entries(arg0);
1055
- return ret;
1056
- };
1057
- imports.wbg.__wbg_entries_9af46b7eaf7dfefa = function(arg0) {
1058
- const ret = arg0.entries();
1059
- return ret;
1060
- };
1061
- imports.wbg.__wbg_error_98d791de55bc7c97 = function(arg0) {
1062
- console.error(...arg0);
1063
- };
1064
- imports.wbg.__wbg_fetch_7fb7602a1bf647ec = function(arg0) {
1065
- const ret = fetch(arg0);
1066
- return ret;
1067
- };
1068
- imports.wbg.__wbg_fetch_90447c28cc0b095e = function(arg0, arg1) {
1069
- const ret = arg0.fetch(arg1);
1070
- return ret;
1071
- };
1072
- imports.wbg.__wbg_fromEntries_743eaaa008e6db37 = function() { return handleError(function (arg0) {
1073
- const ret = Object.fromEntries(arg0);
1074
- return ret;
1075
- }, arguments) };
1076
- imports.wbg.__wbg_getRandomValues_1c61fac11405ffdc = function() { return handleError(function (arg0, arg1) {
1077
- globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
1078
- }, arguments) };
1079
- imports.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
1080
- arg0.getRandomValues(arg1);
1081
- }, arguments) };
1082
- imports.wbg.__wbg_getTime_ad1e9878a735af08 = function(arg0) {
1083
- const ret = arg0.getTime();
1084
- return ret;
1085
- };
1086
- imports.wbg.__wbg_getTimezoneOffset_45389e26d6f46823 = function(arg0) {
1087
- const ret = arg0.getTimezoneOffset();
1088
- return ret;
1089
- };
1090
- imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
1091
- const ret = arg0[arg1 >>> 0];
1092
- return ret;
1093
- };
1094
- imports.wbg.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) {
1095
- const ret = Reflect.get(arg0, arg1);
1096
- return ret;
1097
- }, arguments) };
1098
- imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
1099
- const ret = arg0[arg1];
1100
- return ret;
1101
- };
1102
- imports.wbg.__wbg_has_0e670569d65d3a45 = function() { return handleError(function (arg0, arg1) {
1103
- const ret = Reflect.has(arg0, arg1);
1104
- return ret;
1105
- }, arguments) };
1106
- imports.wbg.__wbg_headers_654c30e1bcccc552 = function(arg0) {
1107
- const ret = arg0.headers;
1108
- return ret;
1109
- };
1110
- imports.wbg.__wbg_info_e951478d580c1573 = function(arg0) {
1111
- console.info(...arg0);
1112
- };
1113
- imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
1114
- let result;
1115
- try {
1116
- result = arg0 instanceof ArrayBuffer;
1117
- } catch (_) {
1118
- result = false;
1119
- }
1120
- const ret = result;
1121
- return ret;
1122
- };
1123
- imports.wbg.__wbg_instanceof_Array_bc64f5da83077362 = function(arg0) {
1124
- let result;
1125
- try {
1126
- result = arg0 instanceof Array;
1127
- } catch (_) {
1128
- result = false;
1129
- }
1130
- const ret = result;
1131
- return ret;
1132
- };
1133
- imports.wbg.__wbg_instanceof_Map_084be8da74364158 = function(arg0) {
1134
- let result;
1135
- try {
1136
- result = arg0 instanceof Map;
1137
- } catch (_) {
1138
- result = false;
1139
- }
1140
- const ret = result;
1141
- return ret;
1142
- };
1143
- imports.wbg.__wbg_instanceof_Response_cd74d1c2ac92cb0b = function(arg0) {
1144
- let result;
1145
- try {
1146
- result = arg0 instanceof Response;
1147
- } catch (_) {
1148
- result = false;
1149
- }
1150
- const ret = result;
1151
- return ret;
1152
- };
1153
- imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
1154
- let result;
1155
- try {
1156
- result = arg0 instanceof Uint8Array;
1157
- } catch (_) {
1158
- result = false;
1159
- }
1160
- const ret = result;
1161
- return ret;
1162
- };
1163
- imports.wbg.__wbg_isArray_51fd9e6422c0a395 = function(arg0) {
1164
- const ret = Array.isArray(arg0);
1165
- return ret;
1166
- };
1167
- imports.wbg.__wbg_isSafeInteger_ae7d3f054d55fa16 = function(arg0) {
1168
- const ret = Number.isSafeInteger(arg0);
1169
- return ret;
1170
- };
1171
- imports.wbg.__wbg_iterator_27b7c8b35ab3e86b = function() {
1172
- const ret = Symbol.iterator;
1173
- return ret;
1174
- };
1175
- imports.wbg.__wbg_keys_f5c6002ff150fc6c = function(arg0) {
1176
- const ret = Object.keys(arg0);
1177
- return ret;
1178
- };
1179
- imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
1180
- const ret = arg0.length;
1181
- return ret;
1182
- };
1183
- imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
1184
- const ret = arg0.length;
1185
- return ret;
1186
- };
1187
- imports.wbg.__wbg_log_3f650af133a6de58 = function(arg0) {
1188
- console.log(...arg0);
1189
- };
1190
- imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
1191
- const ret = arg0.msCrypto;
1192
- return ret;
1193
- };
1194
- imports.wbg.__wbg_multiissuerauthorizeresult_new = function(arg0) {
1195
- const ret = MultiIssuerAuthorizeResult.__wrap(arg0);
1196
- return ret;
1197
- };
1198
- imports.wbg.__wbg_new_0_23cedd11d9b40c9d = function() {
1199
- const ret = new Date();
1200
- return ret;
1201
- };
1202
- imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
1203
- const ret = new Object();
1204
- return ret;
1205
- };
1206
- imports.wbg.__wbg_new_25f239778d6112b9 = function() {
1207
- const ret = new Array();
1208
- return ret;
1209
- };
1210
- imports.wbg.__wbg_new_3c79b3bb1b32b7d3 = function() { return handleError(function () {
1211
- const ret = new Headers();
1212
- return ret;
1213
- }, arguments) };
1214
- imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
1215
- const ret = new Uint8Array(arg0);
1216
- return ret;
1217
- };
1218
- imports.wbg.__wbg_new_881a222c65f168fc = function() { return handleError(function () {
1219
- const ret = new AbortController();
1220
- return ret;
1221
- }, arguments) };
1222
- imports.wbg.__wbg_new_b2db8aa2650f793a = function(arg0) {
1223
- const ret = new Date(arg0);
1224
- return ret;
1225
- };
1226
- imports.wbg.__wbg_new_b546ae120718850e = function() {
1227
- const ret = new Map();
1228
- return ret;
1229
- };
1230
- imports.wbg.__wbg_new_ff12d2b041fb48f1 = function(arg0, arg1) {
1231
- try {
1232
- var state0 = {a: arg0, b: arg1};
1233
- var cb0 = (arg0, arg1) => {
1234
- const a = state0.a;
1235
- state0.a = 0;
1236
- try {
1237
- return wasm_bindgen__convert__closures_____invoke__h3a7d0d99d266e2f8(a, state0.b, arg0, arg1);
1238
- } finally {
1239
- state0.a = a;
1240
- }
1241
- };
1242
- const ret = new Promise(cb0);
1243
- return ret;
1244
- } finally {
1245
- state0.a = state0.b = 0;
1494
+ function expectedResponseType(type) {
1495
+ switch (type) {
1496
+ case 'basic': case 'cors': case 'default': return true;
1246
1497
  }
1247
- };
1248
- imports.wbg.__wbg_new_from_slice_f9c22b9153b26992 = function(arg0, arg1) {
1249
- const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
1250
- return ret;
1251
- };
1252
- imports.wbg.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
1253
- const ret = new Function(getStringFromWasm0(arg0, arg1));
1254
- return ret;
1255
- };
1256
- imports.wbg.__wbg_new_with_args_df9e7125ffe55248 = function(arg0, arg1, arg2, arg3) {
1257
- const ret = new Function(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
1258
- return ret;
1259
- };
1260
- imports.wbg.__wbg_new_with_length_aa5eaf41d35235e5 = function(arg0) {
1261
- const ret = new Uint8Array(arg0 >>> 0);
1262
- return ret;
1263
- };
1264
- imports.wbg.__wbg_new_with_str_and_init_c5748f76f5108934 = function() { return handleError(function (arg0, arg1, arg2) {
1265
- const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
1266
- return ret;
1267
- }, arguments) };
1268
- imports.wbg.__wbg_next_138a17bbf04e926c = function(arg0) {
1269
- const ret = arg0.next;
1270
- return ret;
1271
- };
1272
- imports.wbg.__wbg_next_3cfe5c0fe2a4cc53 = function() { return handleError(function (arg0) {
1273
- const ret = arg0.next();
1274
- return ret;
1275
- }, arguments) };
1276
- imports.wbg.__wbg_node_905d3e251edff8a2 = function(arg0) {
1277
- const ret = arg0.node;
1278
- return ret;
1279
- };
1280
- imports.wbg.__wbg_policyevaluationerror_new = function(arg0) {
1281
- const ret = PolicyEvaluationError.__wrap(arg0);
1282
- return ret;
1283
- };
1284
- imports.wbg.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
1285
- const ret = arg0.process;
1286
- return ret;
1287
- };
1288
- imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
1289
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1290
- };
1291
- imports.wbg.__wbg_push_7d9be8f38fc13975 = function(arg0, arg1) {
1292
- const ret = arg0.push(arg1);
1293
- return ret;
1294
- };
1295
- imports.wbg.__wbg_queueMicrotask_9b549dfce8865860 = function(arg0) {
1296
- const ret = arg0.queueMicrotask;
1297
- return ret;
1298
- };
1299
- imports.wbg.__wbg_queueMicrotask_fca69f5bfad613a5 = function(arg0) {
1300
- queueMicrotask(arg0);
1301
- };
1302
- imports.wbg.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
1303
- arg0.randomFillSync(arg1);
1304
- }, arguments) };
1305
- imports.wbg.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
1306
- const ret = module.require;
1307
- return ret;
1308
- }, arguments) };
1309
- imports.wbg.__wbg_resolve_fd5bfbaa4ce36e1e = function(arg0) {
1310
- const ret = Promise.resolve(arg0);
1311
- return ret;
1312
- };
1313
- imports.wbg.__wbg_setTimeout_4302406184dcc5be = function(arg0, arg1) {
1314
- const ret = setTimeout(arg0, arg1);
1315
- return ret;
1316
- };
1317
- imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
1318
- arg0[arg1] = arg2;
1319
- };
1320
- imports.wbg.__wbg_set_781438a03c0c3c81 = function() { return handleError(function (arg0, arg1, arg2) {
1321
- const ret = Reflect.set(arg0, arg1, arg2);
1322
- return ret;
1323
- }, arguments) };
1324
- imports.wbg.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
1325
- arg0[arg1 >>> 0] = arg2;
1326
- };
1327
- imports.wbg.__wbg_set_body_8e743242d6076a4f = function(arg0, arg1) {
1328
- arg0.body = arg1;
1329
- };
1330
- imports.wbg.__wbg_set_cache_0e437c7c8e838b9b = function(arg0, arg1) {
1331
- arg0.cache = __wbindgen_enum_RequestCache[arg1];
1332
- };
1333
- imports.wbg.__wbg_set_credentials_55ae7c3c106fd5be = function(arg0, arg1) {
1334
- arg0.credentials = __wbindgen_enum_RequestCredentials[arg1];
1335
- };
1336
- imports.wbg.__wbg_set_efaaf145b9377369 = function(arg0, arg1, arg2) {
1337
- const ret = arg0.set(arg1, arg2);
1338
- return ret;
1339
- };
1340
- imports.wbg.__wbg_set_headers_5671cf088e114d2b = function(arg0, arg1) {
1341
- arg0.headers = arg1;
1342
- };
1343
- imports.wbg.__wbg_set_method_76c69e41b3570627 = function(arg0, arg1, arg2) {
1344
- arg0.method = getStringFromWasm0(arg1, arg2);
1345
- };
1346
- imports.wbg.__wbg_set_mode_611016a6818fc690 = function(arg0, arg1) {
1347
- arg0.mode = __wbindgen_enum_RequestMode[arg1];
1348
- };
1349
- imports.wbg.__wbg_set_signal_e89be862d0091009 = function(arg0, arg1) {
1350
- arg0.signal = arg1;
1351
- };
1352
- imports.wbg.__wbg_signal_3c14fbdc89694b39 = function(arg0) {
1353
- const ret = arg0.signal;
1354
- return ret;
1355
- };
1356
- imports.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
1357
- const ret = typeof global === 'undefined' ? null : global;
1358
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1359
- };
1360
- imports.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
1361
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
1362
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1363
- };
1364
- imports.wbg.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
1365
- const ret = typeof self === 'undefined' ? null : self;
1366
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1367
- };
1368
- imports.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
1369
- const ret = typeof window === 'undefined' ? null : window;
1370
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1371
- };
1372
- imports.wbg.__wbg_status_9bfc680efca4bdfd = function(arg0) {
1373
- const ret = arg0.status;
1374
- return ret;
1375
- };
1376
- imports.wbg.__wbg_stringify_655a6390e1f5eb6b = function() { return handleError(function (arg0) {
1377
- const ret = JSON.stringify(arg0);
1378
- return ret;
1379
- }, arguments) };
1380
- imports.wbg.__wbg_subarray_845f2f5bce7d061a = function(arg0, arg1, arg2) {
1381
- const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1382
- return ret;
1383
- };
1384
- imports.wbg.__wbg_text_51046bb33d257f63 = function() { return handleError(function (arg0) {
1385
- const ret = arg0.text();
1386
- return ret;
1387
- }, arguments) };
1388
- imports.wbg.__wbg_then_429f7caf1026411d = function(arg0, arg1, arg2) {
1389
- const ret = arg0.then(arg1, arg2);
1390
- return ret;
1391
- };
1392
- imports.wbg.__wbg_then_4f95312d68691235 = function(arg0, arg1) {
1393
- const ret = arg0.then(arg1);
1394
- return ret;
1395
- };
1396
- imports.wbg.__wbg_trace_b213249bfc587469 = function(arg0) {
1397
- console.trace(...arg0);
1398
- };
1399
- imports.wbg.__wbg_url_b6d11838a4f95198 = function(arg0, arg1) {
1400
- const ret = arg1.url;
1401
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1402
- const len1 = WASM_VECTOR_LEN;
1403
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1404
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1405
- };
1406
- imports.wbg.__wbg_value_57b7b035e117f7ee = function(arg0) {
1407
- const ret = arg0.value;
1408
- return ret;
1409
- };
1410
- imports.wbg.__wbg_versions_c01dfd4722a88165 = function(arg0) {
1411
- const ret = arg0.versions;
1412
- return ret;
1413
- };
1414
- imports.wbg.__wbg_warn_14a9fd75d0abe5d7 = function(arg0) {
1415
- console.warn(...arg0);
1416
- };
1417
- imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
1418
- // Cast intrinsic for `Ref(String) -> Externref`.
1419
- const ret = getStringFromWasm0(arg0, arg1);
1420
- return ret;
1421
- };
1422
- imports.wbg.__wbindgen_cast_2fb66661e8d075cf = function(arg0, arg1) {
1423
- // Cast intrinsic for `Closure(Closure { dtor_idx: 553, function: Function { arguments: [Externref], shim_idx: 554, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1424
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h8554173f80599467, wasm_bindgen__convert__closures_____invoke__h7f8b71809a8d7577);
1425
- return ret;
1426
- };
1427
- imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
1428
- // Cast intrinsic for `U64 -> Externref`.
1429
- const ret = BigInt.asUintN(64, arg0);
1430
- return ret;
1431
- };
1432
- imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
1433
- // Cast intrinsic for `I64 -> Externref`.
1434
- const ret = arg0;
1435
- return ret;
1436
- };
1437
- imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
1438
- // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
1439
- const ret = getArrayU8FromWasm0(arg0, arg1);
1440
- return ret;
1441
- };
1442
- imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
1443
- // Cast intrinsic for `F64 -> Externref`.
1444
- const ret = arg0;
1445
- return ret;
1446
- };
1447
- imports.wbg.__wbindgen_cast_f0904d98c773eedb = function(arg0, arg1) {
1448
- // Cast intrinsic for `Closure(Closure { dtor_idx: 508, function: Function { arguments: [], shim_idx: 509, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1449
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h8ab080f6f46e974c, wasm_bindgen__convert__closures_____invoke__h5208add59d64c287);
1450
- return ret;
1451
- };
1452
- imports.wbg.__wbindgen_init_externref_table = function() {
1453
- const table = wasm.__wbindgen_externrefs;
1454
- const offset = table.grow(4);
1455
- table.set(0, undefined);
1456
- table.set(offset + 0, undefined);
1457
- table.set(offset + 1, null);
1458
- table.set(offset + 2, true);
1459
- table.set(offset + 3, false);
1460
- };
1461
-
1462
- return imports;
1463
- }
1464
-
1465
- function __wbg_finalize_init(instance, module) {
1466
- wasm = instance.exports;
1467
- __wbg_init.__wbindgen_wasm_module = module;
1468
- cachedDataViewMemory0 = null;
1469
- cachedUint8ArrayMemory0 = null;
1470
-
1471
-
1472
- wasm.__wbindgen_start();
1473
- return wasm;
1498
+ return false;
1499
+ }
1474
1500
  }
1475
1501
 
1476
1502
  function initSync(module) {
1477
1503
  if (wasm !== undefined) return wasm;
1478
1504
 
1479
1505
 
1480
- if (typeof module !== 'undefined') {
1506
+ if (module !== undefined) {
1481
1507
  if (Object.getPrototypeOf(module) === Object.prototype) {
1482
1508
  ({module} = module)
1483
1509
  } else {
@@ -1497,7 +1523,7 @@ async function __wbg_init(module_or_path) {
1497
1523
  if (wasm !== undefined) return wasm;
1498
1524
 
1499
1525
 
1500
- if (typeof module_or_path !== 'undefined') {
1526
+ if (module_or_path !== undefined) {
1501
1527
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1502
1528
  ({module_or_path} = module_or_path)
1503
1529
  } else {
@@ -1505,7 +1531,7 @@ async function __wbg_init(module_or_path) {
1505
1531
  }
1506
1532
  }
1507
1533
 
1508
- if (typeof module_or_path === 'undefined') {
1534
+ if (module_or_path === undefined) {
1509
1535
  module_or_path = new URL('cedarling_wasm_bg.wasm', import.meta.url);
1510
1536
  }
1511
1537
  const imports = __wbg_get_imports();
@@ -1519,5 +1545,4 @@ async function __wbg_init(module_or_path) {
1519
1545
  return __wbg_finalize_init(instance, module);
1520
1546
  }
1521
1547
 
1522
- export { initSync };
1523
- export default __wbg_init;
1548
+ export { initSync, __wbg_init as default };