@janssenproject/cedarling_wasm 2.0.0 → 2.0.1

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,275 +1,10 @@
1
- let wasm;
1
+ /* @ts-self-types="./cedarling_wasm.d.ts" */
2
2
 
3
- const heap = new Array(128).fill(undefined);
4
-
5
- heap.push(undefined, null, true, false);
6
-
7
- function getObject(idx) { return heap[idx]; }
8
-
9
- let WASM_VECTOR_LEN = 0;
10
-
11
- let cachedUint8ArrayMemory0 = null;
12
-
13
- function getUint8ArrayMemory0() {
14
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
15
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
16
- }
17
- return cachedUint8ArrayMemory0;
18
- }
19
-
20
- const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
21
-
22
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
23
- ? function (arg, view) {
24
- return cachedTextEncoder.encodeInto(arg, view);
25
- }
26
- : function (arg, view) {
27
- const buf = cachedTextEncoder.encode(arg);
28
- view.set(buf);
29
- return {
30
- read: arg.length,
31
- written: buf.length
32
- };
33
- });
34
-
35
- function passStringToWasm0(arg, malloc, realloc) {
36
-
37
- if (realloc === undefined) {
38
- const buf = cachedTextEncoder.encode(arg);
39
- const ptr = malloc(buf.length, 1) >>> 0;
40
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
41
- WASM_VECTOR_LEN = buf.length;
42
- return ptr;
43
- }
44
-
45
- let len = arg.length;
46
- let ptr = malloc(len, 1) >>> 0;
47
-
48
- const mem = getUint8ArrayMemory0();
49
-
50
- let offset = 0;
51
-
52
- for (; offset < len; offset++) {
53
- const code = arg.charCodeAt(offset);
54
- if (code > 0x7F) break;
55
- mem[ptr + offset] = code;
56
- }
57
-
58
- if (offset !== len) {
59
- if (offset !== 0) {
60
- arg = arg.slice(offset);
61
- }
62
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
63
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
64
- const ret = encodeString(arg, view);
65
-
66
- offset += ret.written;
67
- ptr = realloc(ptr, len, offset, 1) >>> 0;
68
- }
69
-
70
- WASM_VECTOR_LEN = offset;
71
- return ptr;
72
- }
73
-
74
- let cachedDataViewMemory0 = null;
75
-
76
- function getDataViewMemory0() {
77
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
78
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
79
- }
80
- return cachedDataViewMemory0;
81
- }
82
-
83
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
84
-
85
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
86
-
87
- function getStringFromWasm0(ptr, len) {
88
- ptr = ptr >>> 0;
89
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
90
- }
91
-
92
- let heap_next = heap.length;
93
-
94
- function addHeapObject(obj) {
95
- if (heap_next === heap.length) heap.push(heap.length + 1);
96
- const idx = heap_next;
97
- heap_next = heap[idx];
98
-
99
- heap[idx] = obj;
100
- return idx;
101
- }
102
-
103
- function handleError(f, args) {
104
- try {
105
- return f.apply(this, args);
106
- } catch (e) {
107
- wasm.__wbindgen_export_2(addHeapObject(e));
108
- }
109
- }
110
-
111
- function dropObject(idx) {
112
- if (idx < 132) return;
113
- heap[idx] = heap_next;
114
- heap_next = idx;
115
- }
116
-
117
- function takeObject(idx) {
118
- const ret = getObject(idx);
119
- dropObject(idx);
120
- return ret;
121
- }
122
-
123
- function isLikeNone(x) {
124
- return x === undefined || x === null;
125
- }
126
-
127
- const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
128
- ? { register: () => {}, unregister: () => {} }
129
- : new FinalizationRegistry(state => {
130
- wasm.__wbindgen_export_3.get(state.dtor)(state.a, state.b)
131
- });
132
-
133
- function makeMutClosure(arg0, arg1, dtor, f) {
134
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
135
- const real = (...args) => {
136
- // First up with a closure we increment the internal reference
137
- // count. This ensures that the Rust closure environment won't
138
- // be deallocated while we're invoking it.
139
- state.cnt++;
140
- const a = state.a;
141
- state.a = 0;
142
- try {
143
- return f(a, state.b, ...args);
144
- } finally {
145
- if (--state.cnt === 0) {
146
- wasm.__wbindgen_export_3.get(state.dtor)(a, state.b);
147
- CLOSURE_DTORS.unregister(state);
148
- } else {
149
- state.a = a;
150
- }
151
- }
152
- };
153
- real.original = state;
154
- CLOSURE_DTORS.register(real, state, state);
155
- return real;
156
- }
157
-
158
- function debugString(val) {
159
- // primitive types
160
- const type = typeof val;
161
- if (type == 'number' || type == 'boolean' || val == null) {
162
- return `${val}`;
163
- }
164
- if (type == 'string') {
165
- return `"${val}"`;
166
- }
167
- if (type == 'symbol') {
168
- const description = val.description;
169
- if (description == null) {
170
- return 'Symbol';
171
- } else {
172
- return `Symbol(${description})`;
173
- }
174
- }
175
- if (type == 'function') {
176
- const name = val.name;
177
- if (typeof name == 'string' && name.length > 0) {
178
- return `Function(${name})`;
179
- } else {
180
- return 'Function';
181
- }
182
- }
183
- // objects
184
- if (Array.isArray(val)) {
185
- const length = val.length;
186
- let debug = '[';
187
- if (length > 0) {
188
- debug += debugString(val[0]);
189
- }
190
- for(let i = 1; i < length; i++) {
191
- debug += ', ' + debugString(val[i]);
192
- }
193
- debug += ']';
194
- return debug;
195
- }
196
- // Test for built-in
197
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
198
- let className;
199
- if (builtInMatches && builtInMatches.length > 1) {
200
- className = builtInMatches[1];
201
- } else {
202
- // Failed to match the standard '[object ClassName]'
203
- return toString.call(val);
204
- }
205
- if (className == 'Object') {
206
- // we're a user defined class or Object
207
- // JSON.stringify avoids problems with cycles, and is generally much
208
- // easier than looping through ownProperties of `val`.
209
- try {
210
- return 'Object(' + JSON.stringify(val) + ')';
211
- } catch (_) {
212
- return 'Object';
213
- }
214
- }
215
- // errors
216
- if (val instanceof Error) {
217
- return `${val.name}: ${val.message}\n${val.stack}`;
218
- }
219
- // TODO we could test for more things here, like `Set`s and `Map`s.
220
- return className;
221
- }
222
- /**
223
- * Create a new instance of the Cedarling application.
224
- * This function can take as config parameter the eather `Map` other `Object`
225
- * @param {any} config
226
- * @returns {Promise<Cedarling>}
227
- */
228
- export function init(config) {
229
- const ret = wasm.init(addHeapObject(config));
230
- return takeObject(ret);
231
- }
232
-
233
- function getArrayJsValueFromWasm0(ptr, len) {
234
- ptr = ptr >>> 0;
235
- const mem = getDataViewMemory0();
236
- const result = [];
237
- for (let i = ptr; i < ptr + 4 * len; i += 4) {
238
- result.push(takeObject(mem.getUint32(i, true)));
239
- }
240
- return result;
241
- }
242
-
243
- function _assertClass(instance, klass) {
244
- if (!(instance instanceof klass)) {
245
- throw new Error(`expected instance of ${klass.name}`);
246
- }
247
- }
248
- function __wbg_adapter_48(arg0, arg1) {
249
- wasm.__wbindgen_export_5(arg0, arg1);
250
- }
251
-
252
- function __wbg_adapter_51(arg0, arg1, arg2) {
253
- wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2));
254
- }
255
-
256
- function __wbg_adapter_173(arg0, arg1, arg2, arg3) {
257
- wasm.__wbindgen_export_7(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
258
- }
259
-
260
- const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
261
-
262
- const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
263
-
264
- const AuthorizeResultFinalization = (typeof FinalizationRegistry === 'undefined')
265
- ? { register: () => {}, unregister: () => {} }
266
- : new FinalizationRegistry(ptr => wasm.__wbg_authorizeresult_free(ptr >>> 0, 1));
267
3
  /**
268
4
  * A WASM wrapper for the Rust `cedarling::AuthorizeResult` struct.
269
5
  * Represents the result of an authorization request.
270
6
  */
271
7
  export class AuthorizeResult {
272
-
273
8
  static __wrap(ptr) {
274
9
  ptr = ptr >>> 0;
275
10
  const obj = Object.create(AuthorizeResult.prototype);
@@ -277,57 +12,31 @@ export class AuthorizeResult {
277
12
  AuthorizeResultFinalization.register(obj, obj.__wbg_ptr, obj);
278
13
  return obj;
279
14
  }
280
-
281
15
  __destroy_into_raw() {
282
16
  const ptr = this.__wbg_ptr;
283
17
  this.__wbg_ptr = 0;
284
18
  AuthorizeResultFinalization.unregister(this);
285
19
  return ptr;
286
20
  }
287
-
288
21
  free() {
289
22
  const ptr = this.__destroy_into_raw();
290
23
  wasm.__wbg_authorizeresult_free(ptr, 0);
291
24
  }
292
25
  /**
293
- * Result of authorization where principal is `Jans::Workload`
294
- * @returns {AuthorizeResultResponse | undefined}
295
- */
296
- get workload() {
297
- const ret = wasm.__wbg_get_authorizeresult_workload(this.__wbg_ptr);
298
- return ret === 0 ? undefined : AuthorizeResultResponse.__wrap(ret);
299
- }
300
- /**
301
- * Result of authorization where principal is `Jans::Workload`
302
- * @param {AuthorizeResultResponse | null} [arg0]
303
- */
304
- set workload(arg0) {
305
- let ptr0 = 0;
306
- if (!isLikeNone(arg0)) {
307
- _assertClass(arg0, AuthorizeResultResponse);
308
- ptr0 = arg0.__destroy_into_raw();
309
- }
310
- wasm.__wbg_set_authorizeresult_workload(this.__wbg_ptr, ptr0);
311
- }
312
- /**
313
- * Result of authorization where principal is `Jans::User`
314
- * @returns {AuthorizeResultResponse | undefined}
315
- */
316
- get person() {
317
- const ret = wasm.__wbg_get_authorizeresult_person(this.__wbg_ptr);
318
- return ret === 0 ? undefined : AuthorizeResultResponse.__wrap(ret);
319
- }
320
- /**
321
- * Result of authorization where principal is `Jans::User`
322
- * @param {AuthorizeResultResponse | null} [arg0]
26
+ * Convert `AuthorizeResult` to json string value
27
+ * @returns {string}
323
28
  */
324
- set person(arg0) {
325
- let ptr0 = 0;
326
- if (!isLikeNone(arg0)) {
327
- _assertClass(arg0, AuthorizeResultResponse);
328
- 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);
329
39
  }
330
- wasm.__wbg_set_authorizeresult_person(this.__wbg_ptr, ptr0);
331
40
  }
332
41
  /**
333
42
  * Result of authorization
@@ -341,17 +50,6 @@ export class AuthorizeResult {
341
50
  const ret = wasm.__wbg_get_authorizeresult_decision(this.__wbg_ptr);
342
51
  return ret !== 0;
343
52
  }
344
- /**
345
- * Result of authorization
346
- * true means `ALLOW`
347
- * false means `Deny`
348
- *
349
- * this field is [`bool`] type to be compatible with [authzen Access Evaluation Decision](https://openid.github.io/authzen/#section-6.2.1).
350
- * @param {boolean} arg0
351
- */
352
- set decision(arg0) {
353
- wasm.__wbg_set_authorizeresult_decision(this.__wbg_ptr, arg0);
354
- }
355
53
  /**
356
54
  * Request ID of the authorization request
357
55
  * @returns {string}
@@ -360,68 +58,59 @@ export class AuthorizeResult {
360
58
  let deferred1_0;
361
59
  let deferred1_1;
362
60
  try {
363
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
364
- wasm.__wbg_get_authorizeresult_request_id(retptr, this.__wbg_ptr);
365
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
366
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
367
- deferred1_0 = r0;
368
- deferred1_1 = r1;
369
- return getStringFromWasm0(r0, r1);
61
+ const ret = wasm.__wbg_get_authorizeresult_request_id(this.__wbg_ptr);
62
+ deferred1_0 = ret[0];
63
+ deferred1_1 = ret[1];
64
+ return getStringFromWasm0(ret[0], ret[1]);
370
65
  } finally {
371
- wasm.__wbindgen_add_to_stack_pointer(16);
372
- wasm.__wbindgen_export_4(deferred1_0, deferred1_1, 1);
66
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
373
67
  }
374
68
  }
375
69
  /**
376
- * Request ID of the authorization request
377
- * @param {string} arg0
70
+ * Cedar authorization response for the request.
71
+ * @returns {AuthorizeResultResponse}
378
72
  */
379
- set request_id(arg0) {
380
- const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
381
- const len0 = WASM_VECTOR_LEN;
382
- wasm.__wbg_set_authorizeresult_request_id(this.__wbg_ptr, ptr0, len0);
73
+ get response() {
74
+ const ret = wasm.__wbg_get_authorizeresult_response(this.__wbg_ptr);
75
+ return AuthorizeResultResponse.__wrap(ret);
383
76
  }
384
77
  /**
385
- * Convert `AuthorizeResult` to json string value
386
- * @returns {string}
387
- */
388
- json_string() {
389
- let deferred1_0;
390
- let deferred1_1;
391
- try {
392
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
393
- wasm.authorizeresult_json_string(retptr, this.__wbg_ptr);
394
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
395
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
396
- deferred1_0 = r0;
397
- deferred1_1 = r1;
398
- return getStringFromWasm0(r0, r1);
399
- } finally {
400
- wasm.__wbindgen_add_to_stack_pointer(16);
401
- wasm.__wbindgen_export_4(deferred1_0, deferred1_1, 1);
402
- }
78
+ * Result of authorization
79
+ * true means `ALLOW`
80
+ * false means `Deny`
81
+ *
82
+ * this field is [`bool`] type to be compatible with [authzen Access Evaluation Decision](https://openid.github.io/authzen/#section-6.2.1).
83
+ * @param {boolean} arg0
84
+ */
85
+ set decision(arg0) {
86
+ wasm.__wbg_set_authorizeresult_decision(this.__wbg_ptr, arg0);
403
87
  }
404
88
  /**
405
- * @param {string} principal
406
- * @returns {AuthorizeResultResponse | undefined}
89
+ * Request ID of the authorization request
90
+ * @param {string} arg0
407
91
  */
408
- principal(principal) {
409
- const ptr0 = passStringToWasm0(principal, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
92
+ set request_id(arg0) {
93
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
410
94
  const len0 = WASM_VECTOR_LEN;
411
- const ret = wasm.authorizeresult_principal(this.__wbg_ptr, ptr0, len0);
412
- return ret === 0 ? undefined : AuthorizeResultResponse.__wrap(ret);
95
+ wasm.__wbg_set_authorizeresult_request_id(this.__wbg_ptr, ptr0, len0);
96
+ }
97
+ /**
98
+ * Cedar authorization response for the request.
99
+ * @param {AuthorizeResultResponse} arg0
100
+ */
101
+ set response(arg0) {
102
+ _assertClass(arg0, AuthorizeResultResponse);
103
+ var ptr0 = arg0.__destroy_into_raw();
104
+ wasm.__wbg_set_authorizeresult_response(this.__wbg_ptr, ptr0);
413
105
  }
414
106
  }
107
+ if (Symbol.dispose) AuthorizeResult.prototype[Symbol.dispose] = AuthorizeResult.prototype.free;
415
108
 
416
- const AuthorizeResultResponseFinalization = (typeof FinalizationRegistry === 'undefined')
417
- ? { register: () => {}, unregister: () => {} }
418
- : new FinalizationRegistry(ptr => wasm.__wbg_authorizeresultresponse_free(ptr >>> 0, 1));
419
109
  /**
420
110
  * A WASM wrapper for the Rust `cedar_policy::Response` struct.
421
111
  * Represents the result of an authorization request.
422
112
  */
423
113
  export class AuthorizeResultResponse {
424
-
425
114
  static __wrap(ptr) {
426
115
  ptr = ptr >>> 0;
427
116
  const obj = Object.create(AuthorizeResultResponse.prototype);
@@ -429,14 +118,12 @@ export class AuthorizeResultResponse {
429
118
  AuthorizeResultResponseFinalization.register(obj, obj.__wbg_ptr, obj);
430
119
  return obj;
431
120
  }
432
-
433
121
  __destroy_into_raw() {
434
122
  const ptr = this.__wbg_ptr;
435
123
  this.__wbg_ptr = 0;
436
124
  AuthorizeResultResponseFinalization.unregister(this);
437
125
  return ptr;
438
126
  }
439
-
440
127
  free() {
441
128
  const ptr = this.__destroy_into_raw();
442
129
  wasm.__wbg_authorizeresultresponse_free(ptr, 0);
@@ -458,15 +145,12 @@ export class AuthorizeResultResponse {
458
145
  return Diagnostics.__wrap(ret);
459
146
  }
460
147
  }
148
+ if (Symbol.dispose) AuthorizeResultResponse.prototype[Symbol.dispose] = AuthorizeResultResponse.prototype.free;
461
149
 
462
- const CedarlingFinalization = (typeof FinalizationRegistry === 'undefined')
463
- ? { register: () => {}, unregister: () => {} }
464
- : new FinalizationRegistry(ptr => wasm.__wbg_cedarling_free(ptr >>> 0, 1));
465
150
  /**
466
151
  * The instance of the Cedarling application.
467
152
  */
468
153
  export class Cedarling {
469
-
470
154
  static __wrap(ptr) {
471
155
  ptr = ptr >>> 0;
472
156
  const obj = Object.create(Cedarling.prototype);
@@ -474,77 +158,130 @@ export class Cedarling {
474
158
  CedarlingFinalization.register(obj, obj.__wbg_ptr, obj);
475
159
  return obj;
476
160
  }
477
-
478
161
  __destroy_into_raw() {
479
162
  const ptr = this.__wbg_ptr;
480
163
  this.__wbg_ptr = 0;
481
164
  CedarlingFinalization.unregister(this);
482
165
  return ptr;
483
166
  }
484
-
485
167
  free() {
486
168
  const ptr = this.__destroy_into_raw();
487
169
  wasm.__wbg_cedarling_free(ptr, 0);
488
170
  }
489
171
  /**
490
- * Create a new instance of the Cedarling application.
491
- * Assume that config is `Object`
492
- * @param {object} config
493
- * @returns {Promise<Cedarling>}
494
- */
495
- static new(config) {
496
- const ret = wasm.cedarling_new(addHeapObject(config));
497
- return takeObject(ret);
498
- }
499
- /**
500
- * Create a new instance of the Cedarling application.
501
- * Assume that config is `Map`
502
- * @param {Map<any, any>} config
503
- * @returns {Promise<Cedarling>}
172
+ * Authorize multi-issuer request.
173
+ * Makes authorization decision based on multiple JWT tokens from different issuers
174
+ * @param {any} request
175
+ * @returns {Promise<MultiIssuerAuthorizeResult>}
504
176
  */
505
- static new_from_map(config) {
506
- const ret = wasm.cedarling_new_from_map(addHeapObject(config));
507
- return takeObject(ret);
177
+ authorize_multi_issuer(request) {
178
+ const ret = wasm.cedarling_authorize_multi_issuer(this.__wbg_ptr, request);
179
+ return ret;
508
180
  }
509
181
  /**
510
- * Authorize request
511
- * makes authorization decision based on the [`Request`]
182
+ * Authorize an unsigned request carrying an optional single principal.
183
+ * Makes an authorization decision based on the [`RequestUnsigned`].
184
+ *
185
+ * When `principal` is omitted / `null` on the JS side the core uses Cedar
186
+ * partial evaluation; residual-dependent requests fail closed with
187
+ * `Decision::Deny` and surface residual policy ids in
188
+ * `response.diagnostics.reason`.
512
189
  * @param {any} request
513
190
  * @returns {Promise<AuthorizeResult>}
514
191
  */
515
- authorize(request) {
516
- const ret = wasm.cedarling_authorize(this.__wbg_ptr, addHeapObject(request));
517
- return takeObject(ret);
192
+ authorize_unsigned(request) {
193
+ const ret = wasm.cedarling_authorize_unsigned(this.__wbg_ptr, request);
194
+ return ret;
518
195
  }
519
196
  /**
520
- * Authorize request for unsigned principals.
521
- * makes authorization decision based on the [`RequestUnsigned`]
522
- * @param {any} request
523
- * @returns {Promise<AuthorizeResult>}
197
+ * Clear all entries from the data store.
198
+ *
199
+ * # Example
200
+ *
201
+ * ```javascript
202
+ * cedarling.clear_data_ctx();
203
+ * console.log("All data entries cleared");
204
+ * ```
524
205
  */
525
- authorize_unsigned(request) {
526
- const ret = wasm.cedarling_authorize_unsigned(this.__wbg_ptr, addHeapObject(request));
527
- return takeObject(ret);
206
+ clear_data_ctx() {
207
+ const ret = wasm.cedarling_clear_data_ctx(this.__wbg_ptr);
208
+ if (ret[1]) {
209
+ throw takeFromExternrefTable0(ret[0]);
210
+ }
528
211
  }
529
212
  /**
530
- * Get logs and remove them from the storage.
531
- * Returns `Array` of `Map`
213
+ * Get trusted issuer identifiers that failed to load.
214
+ *
215
+ * # Example
216
+ *
217
+ * ```javascript
218
+ * const ids = cedarling.failed_trusted_issuer_ids();
219
+ * ```
532
220
  * @returns {Array<any>}
533
221
  */
534
- pop_logs() {
535
- try {
536
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
537
- wasm.cedarling_pop_logs(retptr, this.__wbg_ptr);
538
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
539
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
540
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
541
- if (r2) {
542
- throw takeObject(r1);
543
- }
544
- return takeObject(r0);
545
- } finally {
546
- wasm.__wbindgen_add_to_stack_pointer(16);
222
+ failed_trusted_issuer_ids() {
223
+ const ret = wasm.cedarling_failed_trusted_issuer_ids(this.__wbg_ptr);
224
+ return ret;
225
+ }
226
+ /**
227
+ * Get a value from the data store by key.
228
+ * Returns null if the key doesn't exist or the entry has expired.
229
+ *
230
+ * # Arguments
231
+ *
232
+ * * `key` - A string key for the data entry to retrieve
233
+ *
234
+ * # Example
235
+ *
236
+ * ```javascript
237
+ * const value = cedarling.get_data_ctx("user:123");
238
+ * if (value !== null) {
239
+ * console.log(value.name); // "John"
240
+ * }
241
+ * ```
242
+ * @param {string} key
243
+ * @returns {any}
244
+ */
245
+ get_data_ctx(key) {
246
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
247
+ const len0 = WASM_VECTOR_LEN;
248
+ const ret = wasm.cedarling_get_data_ctx(this.__wbg_ptr, ptr0, len0);
249
+ if (ret[2]) {
250
+ throw takeFromExternrefTable0(ret[1]);
251
+ }
252
+ return takeFromExternrefTable0(ret[0]);
253
+ }
254
+ /**
255
+ * Get a data entry with full metadata by key.
256
+ * Returns null if the key doesn't exist or the entry has expired.
257
+ *
258
+ * # Arguments
259
+ *
260
+ * * `key` - A string key for the data entry to retrieve
261
+ *
262
+ * # Example
263
+ *
264
+ * ```javascript
265
+ * const entry = cedarling.get_data_entry_ctx("user:123");
266
+ * if (entry !== null) {
267
+ * console.log(entry.key); // "user:123"
268
+ * console.log(entry.value); // { name: "John", age: 30 }
269
+ * console.log(entry.data_type); // "Record"
270
+ * console.log(entry.created_at); // "2024-01-01T12:00:00Z"
271
+ * console.log(entry.access_count); // 5
272
+ * }
273
+ * ```
274
+ * @param {string} key
275
+ * @returns {DataEntry | undefined}
276
+ */
277
+ get_data_entry_ctx(key) {
278
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
279
+ const len0 = WASM_VECTOR_LEN;
280
+ const ret = wasm.cedarling_get_data_entry_ctx(this.__wbg_ptr, ptr0, len0);
281
+ if (ret[2]) {
282
+ throw takeFromExternrefTable0(ret[1]);
547
283
  }
284
+ return ret[0] === 0 ? undefined : DataEntry.__wrap(ret[0]);
548
285
  }
549
286
  /**
550
287
  * Get specific log entry.
@@ -553,21 +290,13 @@ export class Cedarling {
553
290
  * @returns {any}
554
291
  */
555
292
  get_log_by_id(id) {
556
- try {
557
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
558
- const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
559
- const len0 = WASM_VECTOR_LEN;
560
- wasm.cedarling_get_log_by_id(retptr, this.__wbg_ptr, ptr0, len0);
561
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
562
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
563
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
564
- if (r2) {
565
- throw takeObject(r1);
566
- }
567
- return takeObject(r0);
568
- } finally {
569
- wasm.__wbindgen_add_to_stack_pointer(16);
293
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
294
+ const len0 = WASM_VECTOR_LEN;
295
+ const ret = wasm.cedarling_get_log_by_id(this.__wbg_ptr, ptr0, len0);
296
+ if (ret[2]) {
297
+ throw takeFromExternrefTable0(ret[1]);
570
298
  }
299
+ return takeFromExternrefTable0(ret[0]);
571
300
  }
572
301
  /**
573
302
  * Returns a list of all log ids.
@@ -576,33 +305,7 @@ export class Cedarling {
576
305
  */
577
306
  get_log_ids() {
578
307
  const ret = wasm.cedarling_get_log_ids(this.__wbg_ptr);
579
- return takeObject(ret);
580
- }
581
- /**
582
- * Get logs by tag, like `log_kind` or `log level`.
583
- * Tag can be `log_kind`, `log_level`.
584
- * @param {string} tag
585
- * @returns {any[]}
586
- */
587
- get_logs_by_tag(tag) {
588
- try {
589
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
590
- const ptr0 = passStringToWasm0(tag, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
591
- const len0 = WASM_VECTOR_LEN;
592
- wasm.cedarling_get_logs_by_tag(retptr, this.__wbg_ptr, ptr0, len0);
593
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
594
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
595
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
596
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
597
- if (r3) {
598
- throw takeObject(r2);
599
- }
600
- var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
601
- wasm.__wbindgen_export_4(r0, r1 * 4, 4);
602
- return v2;
603
- } finally {
604
- wasm.__wbindgen_add_to_stack_pointer(16);
605
- }
308
+ return ret;
606
309
  }
607
310
  /**
608
311
  * Get logs by request_id.
@@ -611,24 +314,15 @@ export class Cedarling {
611
314
  * @returns {any[]}
612
315
  */
613
316
  get_logs_by_request_id(request_id) {
614
- try {
615
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
616
- const ptr0 = passStringToWasm0(request_id, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
617
- const len0 = WASM_VECTOR_LEN;
618
- wasm.cedarling_get_logs_by_request_id(retptr, this.__wbg_ptr, ptr0, len0);
619
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
620
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
621
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
622
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
623
- if (r3) {
624
- throw takeObject(r2);
625
- }
626
- var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
627
- wasm.__wbindgen_export_4(r0, r1 * 4, 4);
628
- return v2;
629
- } finally {
630
- wasm.__wbindgen_add_to_stack_pointer(16);
317
+ const ptr0 = passStringToWasm0(request_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
318
+ const len0 = WASM_VECTOR_LEN;
319
+ const ret = wasm.cedarling_get_logs_by_request_id(this.__wbg_ptr, ptr0, len0);
320
+ if (ret[3]) {
321
+ throw takeFromExternrefTable0(ret[2]);
631
322
  }
323
+ var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
324
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
325
+ return v2;
632
326
  }
633
327
  /**
634
328
  * Get log by request_id and tag, like composite key `request_id` + `log_kind`.
@@ -639,214 +333,1952 @@ export class Cedarling {
639
333
  * @returns {any[]}
640
334
  */
641
335
  get_logs_by_request_id_and_tag(request_id, tag) {
642
- try {
643
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
644
- const ptr0 = passStringToWasm0(request_id, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
645
- const len0 = WASM_VECTOR_LEN;
646
- const ptr1 = passStringToWasm0(tag, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
647
- const len1 = WASM_VECTOR_LEN;
648
- wasm.cedarling_get_logs_by_request_id_and_tag(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
649
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
650
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
651
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
652
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
653
- if (r3) {
654
- throw takeObject(r2);
655
- }
656
- var v3 = getArrayJsValueFromWasm0(r0, r1).slice();
657
- wasm.__wbindgen_export_4(r0, r1 * 4, 4);
658
- return v3;
659
- } finally {
660
- wasm.__wbindgen_add_to_stack_pointer(16);
336
+ const ptr0 = passStringToWasm0(request_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
337
+ const len0 = WASM_VECTOR_LEN;
338
+ const ptr1 = passStringToWasm0(tag, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
339
+ const len1 = WASM_VECTOR_LEN;
340
+ const ret = wasm.cedarling_get_logs_by_request_id_and_tag(this.__wbg_ptr, ptr0, len0, ptr1, len1);
341
+ if (ret[3]) {
342
+ throw takeFromExternrefTable0(ret[2]);
343
+ }
344
+ var v3 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
345
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
346
+ return v3;
347
+ }
348
+ /**
349
+ * Get logs by tag, like `log_kind` or `log level`.
350
+ * Tag can be `log_kind`, `log_level`.
351
+ * @param {string} tag
352
+ * @returns {any[]}
353
+ */
354
+ get_logs_by_tag(tag) {
355
+ const ptr0 = passStringToWasm0(tag, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
356
+ const len0 = WASM_VECTOR_LEN;
357
+ const ret = wasm.cedarling_get_logs_by_tag(this.__wbg_ptr, ptr0, len0);
358
+ if (ret[3]) {
359
+ throw takeFromExternrefTable0(ret[2]);
360
+ }
361
+ var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
362
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
363
+ return v2;
364
+ }
365
+ /**
366
+ * Get statistics about the data store.
367
+ *
368
+ * # Example
369
+ *
370
+ * ```javascript
371
+ * const stats = cedarling.get_stats_ctx();
372
+ * console.log(`Entries: ${stats.entry_count}/${stats.max_entries || 'unlimited'}`);
373
+ * console.log(`Capacity: ${stats.capacity_usage_percent.toFixed(2)}%`);
374
+ * console.log(`Total size: ${stats.total_size_bytes} bytes`);
375
+ * ```
376
+ * @returns {DataStoreStats}
377
+ */
378
+ get_stats_ctx() {
379
+ const ret = wasm.cedarling_get_stats_ctx(this.__wbg_ptr);
380
+ if (ret[2]) {
381
+ throw takeFromExternrefTable0(ret[1]);
382
+ }
383
+ return DataStoreStats.__wrap(ret[0]);
384
+ }
385
+ /**
386
+ * Check whether a trusted issuer was loaded by `iss` claim.
387
+ *
388
+ * # Arguments
389
+ *
390
+ * * `iss_claim` - Issuer `iss` claim value to check.
391
+ *
392
+ * # Example
393
+ *
394
+ * ```javascript
395
+ * const ok = cedarling.is_trusted_issuer_loaded_by_iss("https://issuer.example.org");
396
+ * ```
397
+ * @param {string} iss_claim
398
+ * @returns {boolean}
399
+ */
400
+ is_trusted_issuer_loaded_by_iss(iss_claim) {
401
+ const ptr0 = passStringToWasm0(iss_claim, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
402
+ const len0 = WASM_VECTOR_LEN;
403
+ const ret = wasm.cedarling_is_trusted_issuer_loaded_by_iss(this.__wbg_ptr, ptr0, len0);
404
+ return ret !== 0;
405
+ }
406
+ /**
407
+ * Check whether a trusted issuer was loaded by issuer identifier.
408
+ *
409
+ * # Arguments
410
+ *
411
+ * * `issuer_id` - Trusted issuer identifier to check.
412
+ *
413
+ * # Example
414
+ *
415
+ * ```javascript
416
+ * const ok = cedarling.is_trusted_issuer_loaded_by_name("issuer_id");
417
+ * ```
418
+ * @param {string} issuer_id
419
+ * @returns {boolean}
420
+ */
421
+ is_trusted_issuer_loaded_by_name(issuer_id) {
422
+ const ptr0 = passStringToWasm0(issuer_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
423
+ const len0 = WASM_VECTOR_LEN;
424
+ const ret = wasm.cedarling_is_trusted_issuer_loaded_by_name(this.__wbg_ptr, ptr0, len0);
425
+ return ret !== 0;
426
+ }
427
+ /**
428
+ * List all entries with their metadata.
429
+ * Returns an array of DataEntry objects.
430
+ *
431
+ * # Example
432
+ *
433
+ * ```javascript
434
+ * const entries = cedarling.list_data_ctx();
435
+ * entries.forEach(entry => {
436
+ * console.log(`${entry.key}: ${entry.data_type} (accessed ${entry.access_count} times)`);
437
+ * });
438
+ * ```
439
+ * @returns {Array<any>}
440
+ */
441
+ list_data_ctx() {
442
+ const ret = wasm.cedarling_list_data_ctx(this.__wbg_ptr);
443
+ if (ret[2]) {
444
+ throw takeFromExternrefTable0(ret[1]);
445
+ }
446
+ return takeFromExternrefTable0(ret[0]);
447
+ }
448
+ /**
449
+ * Get trusted issuer identifiers loaded successfully.
450
+ *
451
+ * # Example
452
+ *
453
+ * ```javascript
454
+ * const ids = cedarling.loaded_trusted_issuer_ids();
455
+ * ```
456
+ * @returns {Array<any>}
457
+ */
458
+ loaded_trusted_issuer_ids() {
459
+ const ret = wasm.cedarling_loaded_trusted_issuer_ids(this.__wbg_ptr);
460
+ return ret;
461
+ }
462
+ /**
463
+ * Get the number of trusted issuers loaded successfully.
464
+ *
465
+ * # Example
466
+ *
467
+ * ```javascript
468
+ * const loadedCount = cedarling.loaded_trusted_issuers_count();
469
+ * ```
470
+ * @returns {number}
471
+ */
472
+ loaded_trusted_issuers_count() {
473
+ const ret = wasm.cedarling_loaded_trusted_issuers_count(this.__wbg_ptr);
474
+ return ret >>> 0;
475
+ }
476
+ /**
477
+ * Create a new instance of the Cedarling application.
478
+ * Assume that config is `Object`
479
+ * @param {object} config
480
+ * @returns {Promise<Cedarling>}
481
+ */
482
+ static new(config) {
483
+ const ret = wasm.cedarling_new(config);
484
+ return ret;
485
+ }
486
+ /**
487
+ * Create a new instance of the Cedarling application.
488
+ * Assume that config is `Map`
489
+ * @param {Map<any, any>} config
490
+ * @returns {Promise<Cedarling>}
491
+ */
492
+ static new_from_map(config) {
493
+ const ret = wasm.cedarling_new_from_map(config);
494
+ return ret;
495
+ }
496
+ /**
497
+ * Get logs and remove them from the storage.
498
+ * Returns `Array` of `Map`
499
+ * @returns {Array<any>}
500
+ */
501
+ pop_logs() {
502
+ const ret = wasm.cedarling_pop_logs(this.__wbg_ptr);
503
+ if (ret[2]) {
504
+ throw takeFromExternrefTable0(ret[1]);
505
+ }
506
+ return takeFromExternrefTable0(ret[0]);
507
+ }
508
+ /**
509
+ * Push a value into the data store with an optional TTL.
510
+ * If the key already exists, the value will be replaced.
511
+ * If TTL is not provided, the default TTL from configuration is used.
512
+ *
513
+ * # Arguments
514
+ *
515
+ * * `key` - A string key for the data entry (must not be empty)
516
+ * * `value` - The value to store (any JSON-serializable JavaScript value: object, array, string, number, boolean)
517
+ * * `ttl_secs` - Optional TTL in seconds (undefined/null uses default from config)
518
+ *
519
+ * # Example
520
+ *
521
+ * ```javascript
522
+ * cedarling.push_data_ctx("user:123", { name: "John", age: 30 }, 3600);
523
+ * cedarling.push_data_ctx("config", { setting: "value" }); // Uses default TTL
524
+ * ```
525
+ * @param {string} key
526
+ * @param {any} value
527
+ * @param {bigint | null} [ttl_secs]
528
+ */
529
+ push_data_ctx(key, value, ttl_secs) {
530
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
531
+ const len0 = WASM_VECTOR_LEN;
532
+ const ret = wasm.cedarling_push_data_ctx(this.__wbg_ptr, ptr0, len0, value, !isLikeNone(ttl_secs), isLikeNone(ttl_secs) ? BigInt(0) : ttl_secs);
533
+ if (ret[1]) {
534
+ throw takeFromExternrefTable0(ret[0]);
535
+ }
536
+ }
537
+ /**
538
+ * Remove a value from the data store by key.
539
+ * Returns true if the key existed and was removed, false otherwise.
540
+ *
541
+ * # Arguments
542
+ *
543
+ * * `key` - A string key for the data entry to remove
544
+ *
545
+ * # Example
546
+ *
547
+ * ```javascript
548
+ * const removed = cedarling.remove_data_ctx("user:123");
549
+ * if (removed) {
550
+ * console.log("Entry was successfully removed");
551
+ * }
552
+ * ```
553
+ * @param {string} key
554
+ * @returns {boolean}
555
+ */
556
+ remove_data_ctx(key) {
557
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
558
+ const len0 = WASM_VECTOR_LEN;
559
+ const ret = wasm.cedarling_remove_data_ctx(this.__wbg_ptr, ptr0, len0);
560
+ if (ret[2]) {
561
+ throw takeFromExternrefTable0(ret[1]);
661
562
  }
563
+ return ret[0] !== 0;
564
+ }
565
+ /**
566
+ * Closes the connections to the Lock Server and pushes all available logs.
567
+ * @returns {Promise<void>}
568
+ */
569
+ shut_down() {
570
+ const ret = wasm.cedarling_shut_down(this.__wbg_ptr);
571
+ return ret;
572
+ }
573
+ /**
574
+ * Get the total number of trusted issuer entries discovered.
575
+ *
576
+ * # Example
577
+ *
578
+ * ```javascript
579
+ * const total = cedarling.total_issuers();
580
+ * ```
581
+ * @returns {number}
582
+ */
583
+ total_issuers() {
584
+ const ret = wasm.cedarling_total_issuers(this.__wbg_ptr);
585
+ return ret >>> 0;
662
586
  }
663
587
  }
588
+ if (Symbol.dispose) Cedarling.prototype[Symbol.dispose] = Cedarling.prototype.free;
664
589
 
665
- const DiagnosticsFinalization = (typeof FinalizationRegistry === 'undefined')
666
- ? { register: () => {}, unregister: () => {} }
667
- : new FinalizationRegistry(ptr => wasm.__wbg_diagnostics_free(ptr >>> 0, 1));
668
590
  /**
669
- * Diagnostics
670
- * ===========
671
- *
672
- * Provides detailed information about how a policy decision was made, including policies that contributed to the decision and any errors encountered during evaluation.
591
+ * A WASM wrapper for the Rust `cedarling::DataEntry` struct.
592
+ * Represents a data entry in the DataStore with value and metadata.
673
593
  */
674
- export class Diagnostics {
675
-
594
+ export class DataEntry {
676
595
  static __wrap(ptr) {
677
596
  ptr = ptr >>> 0;
678
- const obj = Object.create(Diagnostics.prototype);
597
+ const obj = Object.create(DataEntry.prototype);
679
598
  obj.__wbg_ptr = ptr;
680
- DiagnosticsFinalization.register(obj, obj.__wbg_ptr, obj);
599
+ DataEntryFinalization.register(obj, obj.__wbg_ptr, obj);
681
600
  return obj;
682
601
  }
683
-
684
602
  __destroy_into_raw() {
685
603
  const ptr = this.__wbg_ptr;
686
604
  this.__wbg_ptr = 0;
687
- DiagnosticsFinalization.unregister(this);
605
+ DataEntryFinalization.unregister(this);
688
606
  return ptr;
689
607
  }
690
-
691
608
  free() {
692
609
  const ptr = this.__destroy_into_raw();
693
- wasm.__wbg_diagnostics_free(ptr, 0);
610
+ wasm.__wbg_dataentry_free(ptr, 0);
694
611
  }
695
612
  /**
696
- * `PolicyId`s of the policies that contributed to the decision.
697
- * If no policies applied to the request, this set will be empty.
698
- *
699
- * The ids should be treated as unordered,
700
- * @returns {string[]}
613
+ * Convert `DataEntry` to json string value
614
+ * @returns {string}
701
615
  */
702
- get reason() {
616
+ json_string() {
617
+ let deferred1_0;
618
+ let deferred1_1;
703
619
  try {
704
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
705
- wasm.diagnostics_reason(retptr, this.__wbg_ptr);
706
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
707
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
708
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
709
- wasm.__wbindgen_export_4(r0, r1 * 4, 4);
710
- return v1;
620
+ const ret = wasm.dataentry_json_string(this.__wbg_ptr);
621
+ deferred1_0 = ret[0];
622
+ deferred1_1 = ret[1];
623
+ return getStringFromWasm0(ret[0], ret[1]);
711
624
  } finally {
712
- wasm.__wbindgen_add_to_stack_pointer(16);
625
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
713
626
  }
714
627
  }
715
628
  /**
716
- * Errors that occurred during authorization. The errors should be
717
- * treated as unordered, since policies may be evaluated in any order.
718
- * @returns {PolicyEvaluationError[]}
629
+ * Get the value stored in this entry as a JavaScript object
630
+ * @returns {any}
719
631
  */
720
- get errors() {
721
- try {
722
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
723
- wasm.diagnostics_errors(retptr, this.__wbg_ptr);
724
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
725
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
726
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
727
- wasm.__wbindgen_export_4(r0, r1 * 4, 4);
728
- return v1;
729
- } finally {
730
- wasm.__wbindgen_add_to_stack_pointer(16);
632
+ value() {
633
+ const ret = wasm.dataentry_value(this.__wbg_ptr);
634
+ if (ret[2]) {
635
+ throw takeFromExternrefTable0(ret[1]);
731
636
  }
637
+ return takeFromExternrefTable0(ret[0]);
732
638
  }
733
- }
734
-
735
- const JsJsonLogicFinalization = (typeof FinalizationRegistry === 'undefined')
736
- ? { register: () => {}, unregister: () => {} }
737
- : new FinalizationRegistry(ptr => wasm.__wbg_jsjsonlogic_free(ptr >>> 0, 1));
738
-
739
- export class JsJsonLogic {
740
-
741
- __destroy_into_raw() {
639
+ /**
640
+ * Number of times this entry has been accessed
641
+ * @returns {bigint}
642
+ */
643
+ get access_count() {
644
+ const ret = wasm.__wbg_get_dataentry_access_count(this.__wbg_ptr);
645
+ return BigInt.asUintN(64, ret);
646
+ }
647
+ /**
648
+ * Timestamp when this entry was created (RFC 3339 format)
649
+ * @returns {string}
650
+ */
651
+ get created_at() {
652
+ let deferred1_0;
653
+ let deferred1_1;
654
+ try {
655
+ const ret = wasm.__wbg_get_dataentry_created_at(this.__wbg_ptr);
656
+ deferred1_0 = ret[0];
657
+ deferred1_1 = ret[1];
658
+ return getStringFromWasm0(ret[0], ret[1]);
659
+ } finally {
660
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
661
+ }
662
+ }
663
+ /**
664
+ * The inferred Cedar type of the value
665
+ * @returns {string}
666
+ */
667
+ get data_type() {
668
+ let deferred1_0;
669
+ let deferred1_1;
670
+ try {
671
+ const ret = wasm.__wbg_get_dataentry_data_type(this.__wbg_ptr);
672
+ deferred1_0 = ret[0];
673
+ deferred1_1 = ret[1];
674
+ return getStringFromWasm0(ret[0], ret[1]);
675
+ } finally {
676
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
677
+ }
678
+ }
679
+ /**
680
+ * Timestamp when this entry expires (RFC 3339 format), or null if no TTL
681
+ * @returns {string | undefined}
682
+ */
683
+ get expires_at() {
684
+ const ret = wasm.__wbg_get_dataentry_expires_at(this.__wbg_ptr);
685
+ let v1;
686
+ if (ret[0] !== 0) {
687
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
688
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
689
+ }
690
+ return v1;
691
+ }
692
+ /**
693
+ * The key for this entry
694
+ * @returns {string}
695
+ */
696
+ get key() {
697
+ let deferred1_0;
698
+ let deferred1_1;
699
+ try {
700
+ const ret = wasm.__wbg_get_dataentry_key(this.__wbg_ptr);
701
+ deferred1_0 = ret[0];
702
+ deferred1_1 = ret[1];
703
+ return getStringFromWasm0(ret[0], ret[1]);
704
+ } finally {
705
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
706
+ }
707
+ }
708
+ /**
709
+ * Number of times this entry has been accessed
710
+ * @param {bigint} arg0
711
+ */
712
+ set access_count(arg0) {
713
+ wasm.__wbg_set_dataentry_access_count(this.__wbg_ptr, arg0);
714
+ }
715
+ /**
716
+ * Timestamp when this entry was created (RFC 3339 format)
717
+ * @param {string} arg0
718
+ */
719
+ set created_at(arg0) {
720
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
721
+ const len0 = WASM_VECTOR_LEN;
722
+ wasm.__wbg_set_dataentry_created_at(this.__wbg_ptr, ptr0, len0);
723
+ }
724
+ /**
725
+ * The inferred Cedar type of the value
726
+ * @param {string} arg0
727
+ */
728
+ set data_type(arg0) {
729
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
730
+ const len0 = WASM_VECTOR_LEN;
731
+ wasm.__wbg_set_dataentry_data_type(this.__wbg_ptr, ptr0, len0);
732
+ }
733
+ /**
734
+ * Timestamp when this entry expires (RFC 3339 format), or null if no TTL
735
+ * @param {string | null} [arg0]
736
+ */
737
+ set expires_at(arg0) {
738
+ var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
739
+ var len0 = WASM_VECTOR_LEN;
740
+ wasm.__wbg_set_dataentry_expires_at(this.__wbg_ptr, ptr0, len0);
741
+ }
742
+ /**
743
+ * The key for this entry
744
+ * @param {string} arg0
745
+ */
746
+ set key(arg0) {
747
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
748
+ const len0 = WASM_VECTOR_LEN;
749
+ wasm.__wbg_set_dataentry_key(this.__wbg_ptr, ptr0, len0);
750
+ }
751
+ }
752
+ if (Symbol.dispose) DataEntry.prototype[Symbol.dispose] = DataEntry.prototype.free;
753
+
754
+ /**
755
+ * A WASM wrapper for the Rust `cedarling::DataStoreStats` struct.
756
+ * Statistics about the DataStore.
757
+ */
758
+ export class DataStoreStats {
759
+ static __wrap(ptr) {
760
+ ptr = ptr >>> 0;
761
+ const obj = Object.create(DataStoreStats.prototype);
762
+ obj.__wbg_ptr = ptr;
763
+ DataStoreStatsFinalization.register(obj, obj.__wbg_ptr, obj);
764
+ return obj;
765
+ }
766
+ __destroy_into_raw() {
767
+ const ptr = this.__wbg_ptr;
768
+ this.__wbg_ptr = 0;
769
+ DataStoreStatsFinalization.unregister(this);
770
+ return ptr;
771
+ }
772
+ free() {
773
+ const ptr = this.__destroy_into_raw();
774
+ wasm.__wbg_datastorestats_free(ptr, 0);
775
+ }
776
+ /**
777
+ * Convert `DataStoreStats` to json string value
778
+ * @returns {string}
779
+ */
780
+ json_string() {
781
+ let deferred1_0;
782
+ let deferred1_1;
783
+ try {
784
+ const ret = wasm.datastorestats_json_string(this.__wbg_ptr);
785
+ deferred1_0 = ret[0];
786
+ deferred1_1 = ret[1];
787
+ return getStringFromWasm0(ret[0], ret[1]);
788
+ } finally {
789
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
790
+ }
791
+ }
792
+ /**
793
+ * Average size per entry in bytes (0 if no entries)
794
+ * @returns {number}
795
+ */
796
+ get avg_entry_size_bytes() {
797
+ const ret = wasm.__wbg_get_datastorestats_avg_entry_size_bytes(this.__wbg_ptr);
798
+ return ret >>> 0;
799
+ }
800
+ /**
801
+ * Percentage of capacity used (0.0-100.0, based on entry count)
802
+ * @returns {number}
803
+ */
804
+ get capacity_usage_percent() {
805
+ const ret = wasm.__wbg_get_datastorestats_capacity_usage_percent(this.__wbg_ptr);
806
+ return ret;
807
+ }
808
+ /**
809
+ * Number of entries currently stored
810
+ * @returns {number}
811
+ */
812
+ get entry_count() {
813
+ const ret = wasm.__wbg_get_datastorestats_entry_count(this.__wbg_ptr);
814
+ return ret >>> 0;
815
+ }
816
+ /**
817
+ * Maximum number of entries allowed (0 = unlimited)
818
+ * @returns {number}
819
+ */
820
+ get max_entries() {
821
+ const ret = wasm.__wbg_get_datastorestats_max_entries(this.__wbg_ptr);
822
+ return ret >>> 0;
823
+ }
824
+ /**
825
+ * Maximum size per entry in bytes (0 = unlimited)
826
+ * @returns {number}
827
+ */
828
+ get max_entry_size() {
829
+ const ret = wasm.__wbg_get_datastorestats_max_entry_size(this.__wbg_ptr);
830
+ return ret >>> 0;
831
+ }
832
+ /**
833
+ * Memory usage threshold percentage (from config)
834
+ * @returns {number}
835
+ */
836
+ get memory_alert_threshold() {
837
+ const ret = wasm.__wbg_get_datastorestats_memory_alert_threshold(this.__wbg_ptr);
838
+ return ret;
839
+ }
840
+ /**
841
+ * Whether memory usage exceeds the alert threshold
842
+ * @returns {boolean}
843
+ */
844
+ get memory_alert_triggered() {
845
+ const ret = wasm.__wbg_get_datastorestats_memory_alert_triggered(this.__wbg_ptr);
846
+ return ret !== 0;
847
+ }
848
+ /**
849
+ * Whether metrics tracking is enabled
850
+ * @returns {boolean}
851
+ */
852
+ get metrics_enabled() {
853
+ const ret = wasm.__wbg_get_datastorestats_metrics_enabled(this.__wbg_ptr);
854
+ return ret !== 0;
855
+ }
856
+ /**
857
+ * Total size of all entries in bytes (approximate, based on JSON serialization)
858
+ * @returns {number}
859
+ */
860
+ get total_size_bytes() {
861
+ const ret = wasm.__wbg_get_datastorestats_total_size_bytes(this.__wbg_ptr);
862
+ return ret >>> 0;
863
+ }
864
+ /**
865
+ * Average size per entry in bytes (0 if no entries)
866
+ * @param {number} arg0
867
+ */
868
+ set avg_entry_size_bytes(arg0) {
869
+ wasm.__wbg_set_datastorestats_avg_entry_size_bytes(this.__wbg_ptr, arg0);
870
+ }
871
+ /**
872
+ * Percentage of capacity used (0.0-100.0, based on entry count)
873
+ * @param {number} arg0
874
+ */
875
+ set capacity_usage_percent(arg0) {
876
+ wasm.__wbg_set_datastorestats_capacity_usage_percent(this.__wbg_ptr, arg0);
877
+ }
878
+ /**
879
+ * Number of entries currently stored
880
+ * @param {number} arg0
881
+ */
882
+ set entry_count(arg0) {
883
+ wasm.__wbg_set_datastorestats_entry_count(this.__wbg_ptr, arg0);
884
+ }
885
+ /**
886
+ * Maximum number of entries allowed (0 = unlimited)
887
+ * @param {number} arg0
888
+ */
889
+ set max_entries(arg0) {
890
+ wasm.__wbg_set_datastorestats_max_entries(this.__wbg_ptr, arg0);
891
+ }
892
+ /**
893
+ * Maximum size per entry in bytes (0 = unlimited)
894
+ * @param {number} arg0
895
+ */
896
+ set max_entry_size(arg0) {
897
+ wasm.__wbg_set_datastorestats_max_entry_size(this.__wbg_ptr, arg0);
898
+ }
899
+ /**
900
+ * Memory usage threshold percentage (from config)
901
+ * @param {number} arg0
902
+ */
903
+ set memory_alert_threshold(arg0) {
904
+ wasm.__wbg_set_datastorestats_memory_alert_threshold(this.__wbg_ptr, arg0);
905
+ }
906
+ /**
907
+ * Whether memory usage exceeds the alert threshold
908
+ * @param {boolean} arg0
909
+ */
910
+ set memory_alert_triggered(arg0) {
911
+ wasm.__wbg_set_datastorestats_memory_alert_triggered(this.__wbg_ptr, arg0);
912
+ }
913
+ /**
914
+ * Whether metrics tracking is enabled
915
+ * @param {boolean} arg0
916
+ */
917
+ set metrics_enabled(arg0) {
918
+ wasm.__wbg_set_datastorestats_metrics_enabled(this.__wbg_ptr, arg0);
919
+ }
920
+ /**
921
+ * Total size of all entries in bytes (approximate, based on JSON serialization)
922
+ * @param {number} arg0
923
+ */
924
+ set total_size_bytes(arg0) {
925
+ wasm.__wbg_set_datastorestats_total_size_bytes(this.__wbg_ptr, arg0);
926
+ }
927
+ }
928
+ if (Symbol.dispose) DataStoreStats.prototype[Symbol.dispose] = DataStoreStats.prototype.free;
929
+
930
+ /**
931
+ * Diagnostics
932
+ * ===========
933
+ *
934
+ * Provides detailed information about how a policy decision was made, including policies that contributed to the decision and any errors encountered during evaluation.
935
+ */
936
+ export class Diagnostics {
937
+ static __wrap(ptr) {
938
+ ptr = ptr >>> 0;
939
+ const obj = Object.create(Diagnostics.prototype);
940
+ obj.__wbg_ptr = ptr;
941
+ DiagnosticsFinalization.register(obj, obj.__wbg_ptr, obj);
942
+ return obj;
943
+ }
944
+ __destroy_into_raw() {
945
+ const ptr = this.__wbg_ptr;
946
+ this.__wbg_ptr = 0;
947
+ DiagnosticsFinalization.unregister(this);
948
+ return ptr;
949
+ }
950
+ free() {
951
+ const ptr = this.__destroy_into_raw();
952
+ wasm.__wbg_diagnostics_free(ptr, 0);
953
+ }
954
+ /**
955
+ * Errors that occurred during authorization. The errors should be
956
+ * treated as unordered, since policies may be evaluated in any order.
957
+ * @returns {PolicyEvaluationError[]}
958
+ */
959
+ get errors() {
960
+ const ret = wasm.diagnostics_errors(this.__wbg_ptr);
961
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
962
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
963
+ return v1;
964
+ }
965
+ /**
966
+ * `PolicyId`s of the policies that contributed to the decision.
967
+ * If no policies applied to the request, this set will be empty.
968
+ *
969
+ * The ids should be treated as unordered,
970
+ * @returns {string[]}
971
+ */
972
+ get reason() {
973
+ const ret = wasm.diagnostics_reason(this.__wbg_ptr);
974
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
975
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
976
+ return v1;
977
+ }
978
+ }
979
+ if (Symbol.dispose) Diagnostics.prototype[Symbol.dispose] = Diagnostics.prototype.free;
980
+
981
+ export class IntoUnderlyingByteSource {
982
+ __destroy_into_raw() {
983
+ const ptr = this.__wbg_ptr;
984
+ this.__wbg_ptr = 0;
985
+ IntoUnderlyingByteSourceFinalization.unregister(this);
986
+ return ptr;
987
+ }
988
+ free() {
989
+ const ptr = this.__destroy_into_raw();
990
+ wasm.__wbg_intounderlyingbytesource_free(ptr, 0);
991
+ }
992
+ /**
993
+ * @returns {number}
994
+ */
995
+ get autoAllocateChunkSize() {
996
+ const ret = wasm.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr);
997
+ return ret >>> 0;
998
+ }
999
+ cancel() {
1000
+ const ptr = this.__destroy_into_raw();
1001
+ wasm.intounderlyingbytesource_cancel(ptr);
1002
+ }
1003
+ /**
1004
+ * @param {ReadableByteStreamController} controller
1005
+ * @returns {Promise<any>}
1006
+ */
1007
+ pull(controller) {
1008
+ const ret = wasm.intounderlyingbytesource_pull(this.__wbg_ptr, controller);
1009
+ return ret;
1010
+ }
1011
+ /**
1012
+ * @param {ReadableByteStreamController} controller
1013
+ */
1014
+ start(controller) {
1015
+ wasm.intounderlyingbytesource_start(this.__wbg_ptr, controller);
1016
+ }
1017
+ /**
1018
+ * @returns {ReadableStreamType}
1019
+ */
1020
+ get type() {
1021
+ const ret = wasm.intounderlyingbytesource_type(this.__wbg_ptr);
1022
+ return __wbindgen_enum_ReadableStreamType[ret];
1023
+ }
1024
+ }
1025
+ if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
1026
+
1027
+ export class IntoUnderlyingSink {
1028
+ __destroy_into_raw() {
742
1029
  const ptr = this.__wbg_ptr;
743
1030
  this.__wbg_ptr = 0;
744
- JsJsonLogicFinalization.unregister(this);
1031
+ IntoUnderlyingSinkFinalization.unregister(this);
745
1032
  return ptr;
746
1033
  }
1034
+ free() {
1035
+ const ptr = this.__destroy_into_raw();
1036
+ wasm.__wbg_intounderlyingsink_free(ptr, 0);
1037
+ }
1038
+ /**
1039
+ * @param {any} reason
1040
+ * @returns {Promise<any>}
1041
+ */
1042
+ abort(reason) {
1043
+ const ptr = this.__destroy_into_raw();
1044
+ const ret = wasm.intounderlyingsink_abort(ptr, reason);
1045
+ return ret;
1046
+ }
1047
+ /**
1048
+ * @returns {Promise<any>}
1049
+ */
1050
+ close() {
1051
+ const ptr = this.__destroy_into_raw();
1052
+ const ret = wasm.intounderlyingsink_close(ptr);
1053
+ return ret;
1054
+ }
1055
+ /**
1056
+ * @param {any} chunk
1057
+ * @returns {Promise<any>}
1058
+ */
1059
+ write(chunk) {
1060
+ const ret = wasm.intounderlyingsink_write(this.__wbg_ptr, chunk);
1061
+ return ret;
1062
+ }
1063
+ }
1064
+ if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
747
1065
 
1066
+ export class IntoUnderlyingSource {
1067
+ __destroy_into_raw() {
1068
+ const ptr = this.__wbg_ptr;
1069
+ this.__wbg_ptr = 0;
1070
+ IntoUnderlyingSourceFinalization.unregister(this);
1071
+ return ptr;
1072
+ }
748
1073
  free() {
749
1074
  const ptr = this.__destroy_into_raw();
750
- wasm.__wbg_jsjsonlogic_free(ptr, 0);
1075
+ wasm.__wbg_intounderlyingsource_free(ptr, 0);
1076
+ }
1077
+ cancel() {
1078
+ const ptr = this.__destroy_into_raw();
1079
+ wasm.intounderlyingsource_cancel(ptr);
1080
+ }
1081
+ /**
1082
+ * @param {ReadableStreamDefaultController} controller
1083
+ * @returns {Promise<any>}
1084
+ */
1085
+ pull(controller) {
1086
+ const ret = wasm.intounderlyingsource_pull(this.__wbg_ptr, controller);
1087
+ return ret;
1088
+ }
1089
+ }
1090
+ if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
1091
+
1092
+ /**
1093
+ * A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
1094
+ * Represents the result of a multi-issuer authorization request.
1095
+ */
1096
+ export class MultiIssuerAuthorizeResult {
1097
+ static __wrap(ptr) {
1098
+ ptr = ptr >>> 0;
1099
+ const obj = Object.create(MultiIssuerAuthorizeResult.prototype);
1100
+ obj.__wbg_ptr = ptr;
1101
+ MultiIssuerAuthorizeResultFinalization.register(obj, obj.__wbg_ptr, obj);
1102
+ return obj;
751
1103
  }
752
- constructor() {
753
- const ret = wasm.jsjsonlogic_new();
754
- this.__wbg_ptr = ret >>> 0;
755
- JsJsonLogicFinalization.register(this, this.__wbg_ptr, this);
756
- return this;
1104
+ __destroy_into_raw() {
1105
+ const ptr = this.__wbg_ptr;
1106
+ this.__wbg_ptr = 0;
1107
+ MultiIssuerAuthorizeResultFinalization.unregister(this);
1108
+ return ptr;
1109
+ }
1110
+ free() {
1111
+ const ptr = this.__destroy_into_raw();
1112
+ wasm.__wbg_multiissuerauthorizeresult_free(ptr, 0);
1113
+ }
1114
+ /**
1115
+ * Result of authorization
1116
+ * true means `ALLOW`
1117
+ * false means `Deny`
1118
+ * @returns {boolean}
1119
+ */
1120
+ get decision() {
1121
+ const ret = wasm.__wbg_get_multiissuerauthorizeresult_decision(this.__wbg_ptr);
1122
+ return ret !== 0;
1123
+ }
1124
+ /**
1125
+ * Request ID of the authorization request
1126
+ * @returns {string}
1127
+ */
1128
+ get request_id() {
1129
+ let deferred1_0;
1130
+ let deferred1_1;
1131
+ try {
1132
+ const ret = wasm.__wbg_get_multiissuerauthorizeresult_request_id(this.__wbg_ptr);
1133
+ deferred1_0 = ret[0];
1134
+ deferred1_1 = ret[1];
1135
+ return getStringFromWasm0(ret[0], ret[1]);
1136
+ } finally {
1137
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1138
+ }
1139
+ }
1140
+ /**
1141
+ * Result of Cedar policy authorization
1142
+ * @returns {AuthorizeResultResponse}
1143
+ */
1144
+ get response() {
1145
+ const ret = wasm.__wbg_get_multiissuerauthorizeresult_response(this.__wbg_ptr);
1146
+ return AuthorizeResultResponse.__wrap(ret);
1147
+ }
1148
+ /**
1149
+ * Convert `MultiIssuerAuthorizeResult` to json string value
1150
+ * @returns {string}
1151
+ */
1152
+ json_string() {
1153
+ let deferred1_0;
1154
+ let deferred1_1;
1155
+ try {
1156
+ const ret = wasm.multiissuerauthorizeresult_json_string(this.__wbg_ptr);
1157
+ deferred1_0 = ret[0];
1158
+ deferred1_1 = ret[1];
1159
+ return getStringFromWasm0(ret[0], ret[1]);
1160
+ } finally {
1161
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1162
+ }
1163
+ }
1164
+ /**
1165
+ * Result of authorization
1166
+ * true means `ALLOW`
1167
+ * false means `Deny`
1168
+ * @param {boolean} arg0
1169
+ */
1170
+ set decision(arg0) {
1171
+ wasm.__wbg_set_multiissuerauthorizeresult_decision(this.__wbg_ptr, arg0);
1172
+ }
1173
+ /**
1174
+ * Request ID of the authorization request
1175
+ * @param {string} arg0
1176
+ */
1177
+ set request_id(arg0) {
1178
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1179
+ const len0 = WASM_VECTOR_LEN;
1180
+ wasm.__wbg_set_multiissuerauthorizeresult_request_id(this.__wbg_ptr, ptr0, len0);
1181
+ }
1182
+ /**
1183
+ * Result of Cedar policy authorization
1184
+ * @param {AuthorizeResultResponse} arg0
1185
+ */
1186
+ set response(arg0) {
1187
+ _assertClass(arg0, AuthorizeResultResponse);
1188
+ var ptr0 = arg0.__destroy_into_raw();
1189
+ wasm.__wbg_set_multiissuerauthorizeresult_response(this.__wbg_ptr, ptr0);
1190
+ }
1191
+ }
1192
+ if (Symbol.dispose) MultiIssuerAuthorizeResult.prototype[Symbol.dispose] = MultiIssuerAuthorizeResult.prototype.free;
1193
+
1194
+ /**
1195
+ * PolicyEvaluationError
1196
+ * =====================
1197
+ *
1198
+ * Represents an error that occurred when evaluating a Cedar policy.
1199
+ */
1200
+ export class PolicyEvaluationError {
1201
+ static __wrap(ptr) {
1202
+ ptr = ptr >>> 0;
1203
+ const obj = Object.create(PolicyEvaluationError.prototype);
1204
+ obj.__wbg_ptr = ptr;
1205
+ PolicyEvaluationErrorFinalization.register(obj, obj.__wbg_ptr, obj);
1206
+ return obj;
1207
+ }
1208
+ __destroy_into_raw() {
1209
+ const ptr = this.__wbg_ptr;
1210
+ this.__wbg_ptr = 0;
1211
+ PolicyEvaluationErrorFinalization.unregister(this);
1212
+ return ptr;
1213
+ }
1214
+ free() {
1215
+ const ptr = this.__destroy_into_raw();
1216
+ wasm.__wbg_policyevaluationerror_free(ptr, 0);
1217
+ }
1218
+ /**
1219
+ * Underlying evaluation error string representation
1220
+ * @returns {string}
1221
+ */
1222
+ get error() {
1223
+ let deferred1_0;
1224
+ let deferred1_1;
1225
+ try {
1226
+ const ret = wasm.policyevaluationerror_error(this.__wbg_ptr);
1227
+ deferred1_0 = ret[0];
1228
+ deferred1_1 = ret[1];
1229
+ return getStringFromWasm0(ret[0], ret[1]);
1230
+ } finally {
1231
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1232
+ }
1233
+ }
1234
+ /**
1235
+ * Id of the policy with an error
1236
+ * @returns {string}
1237
+ */
1238
+ get id() {
1239
+ let deferred1_0;
1240
+ let deferred1_1;
1241
+ try {
1242
+ const ret = wasm.policyevaluationerror_id(this.__wbg_ptr);
1243
+ deferred1_0 = ret[0];
1244
+ deferred1_1 = ret[1];
1245
+ return getStringFromWasm0(ret[0], ret[1]);
1246
+ } finally {
1247
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1248
+ }
1249
+ }
1250
+ }
1251
+ if (Symbol.dispose) PolicyEvaluationError.prototype[Symbol.dispose] = PolicyEvaluationError.prototype.free;
1252
+
1253
+ /**
1254
+ * Create a new instance of the Cedarling application.
1255
+ * This function can take as config parameter the eather `Map` other `Object`
1256
+ * @param {any} config
1257
+ * @returns {Promise<Cedarling>}
1258
+ */
1259
+ export function init(config) {
1260
+ const ret = wasm.init(config);
1261
+ return ret;
1262
+ }
1263
+
1264
+ /**
1265
+ * Create a new instance of the Cedarling application from archive bytes.
1266
+ *
1267
+ * This function allows loading a policy store from a Cedar Archive (.cjar)
1268
+ * that was fetched with custom logic (e.g., with authentication headers).
1269
+ *
1270
+ * # Arguments
1271
+ * * `config` - Bootstrap configuration (Map or Object). Policy store config is ignored.
1272
+ * * `archive_bytes` - The .cjar archive bytes (Uint8Array)
1273
+ *
1274
+ * # Example
1275
+ * ```javascript
1276
+ * const response = await fetch(url, { headers: { Authorization: 'Bearer ...' } });
1277
+ * const bytes = new Uint8Array(await response.arrayBuffer());
1278
+ * const cedarling = await init_from_archive_bytes(config, bytes);
1279
+ * ```
1280
+ * @param {any} config
1281
+ * @param {Uint8Array} archive_bytes
1282
+ * @returns {Promise<Cedarling>}
1283
+ */
1284
+ export function init_from_archive_bytes(config, archive_bytes) {
1285
+ const ret = wasm.init_from_archive_bytes(config, archive_bytes);
1286
+ return ret;
1287
+ }
1288
+ function __wbg_get_imports() {
1289
+ const import0 = {
1290
+ __proto__: null,
1291
+ __wbg_Error_960c155d3d49e4c2: function(arg0, arg1) {
1292
+ const ret = Error(getStringFromWasm0(arg0, arg1));
1293
+ return ret;
1294
+ },
1295
+ __wbg_Number_32bf70a599af1d4b: function(arg0) {
1296
+ const ret = Number(arg0);
1297
+ return ret;
1298
+ },
1299
+ __wbg___wbindgen_bigint_get_as_i64_3d3aba5d616c6a51: function(arg0, arg1) {
1300
+ const v = arg1;
1301
+ const ret = typeof(v) === 'bigint' ? v : undefined;
1302
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
1303
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1304
+ },
1305
+ __wbg___wbindgen_boolean_get_6ea149f0a8dcc5ff: function(arg0) {
1306
+ const v = arg0;
1307
+ const ret = typeof(v) === 'boolean' ? v : undefined;
1308
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
1309
+ },
1310
+ __wbg___wbindgen_debug_string_ab4b34d23d6778bd: function(arg0, arg1) {
1311
+ const ret = debugString(arg1);
1312
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1313
+ const len1 = WASM_VECTOR_LEN;
1314
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1315
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1316
+ },
1317
+ __wbg___wbindgen_in_a5d8b22e52b24dd1: function(arg0, arg1) {
1318
+ const ret = arg0 in arg1;
1319
+ return ret;
1320
+ },
1321
+ __wbg___wbindgen_is_bigint_ec25c7f91b4d9e93: function(arg0) {
1322
+ const ret = typeof(arg0) === 'bigint';
1323
+ return ret;
1324
+ },
1325
+ __wbg___wbindgen_is_function_3baa9db1a987f47d: function(arg0) {
1326
+ const ret = typeof(arg0) === 'function';
1327
+ return ret;
1328
+ },
1329
+ __wbg___wbindgen_is_object_63322ec0cd6ea4ef: function(arg0) {
1330
+ const val = arg0;
1331
+ const ret = typeof(val) === 'object' && val !== null;
1332
+ return ret;
1333
+ },
1334
+ __wbg___wbindgen_is_string_6df3bf7ef1164ed3: function(arg0) {
1335
+ const ret = typeof(arg0) === 'string';
1336
+ return ret;
1337
+ },
1338
+ __wbg___wbindgen_is_undefined_29a43b4d42920abd: function(arg0) {
1339
+ const ret = arg0 === undefined;
1340
+ return ret;
1341
+ },
1342
+ __wbg___wbindgen_jsval_eq_d3465d8a07697228: function(arg0, arg1) {
1343
+ const ret = arg0 === arg1;
1344
+ return ret;
1345
+ },
1346
+ __wbg___wbindgen_jsval_loose_eq_cac3565e89b4134c: function(arg0, arg1) {
1347
+ const ret = arg0 == arg1;
1348
+ return ret;
1349
+ },
1350
+ __wbg___wbindgen_number_get_c7f42aed0525c451: function(arg0, arg1) {
1351
+ const obj = arg1;
1352
+ const ret = typeof(obj) === 'number' ? obj : undefined;
1353
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1354
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1355
+ },
1356
+ __wbg___wbindgen_string_get_7ed5322991caaec5: function(arg0, arg1) {
1357
+ const obj = arg1;
1358
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1359
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1360
+ var len1 = WASM_VECTOR_LEN;
1361
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1362
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1363
+ },
1364
+ __wbg___wbindgen_throw_6b64449b9b9ed33c: function(arg0, arg1) {
1365
+ throw new Error(getStringFromWasm0(arg0, arg1));
1366
+ },
1367
+ __wbg__wbg_cb_unref_b46c9b5a9f08ec37: function(arg0) {
1368
+ arg0._wbg_cb_unref();
1369
+ },
1370
+ __wbg_abort_4ce5b484434ef6fd: function(arg0) {
1371
+ arg0.abort();
1372
+ },
1373
+ __wbg_abort_d53712380a54cc81: function(arg0, arg1) {
1374
+ arg0.abort(arg1);
1375
+ },
1376
+ __wbg_append_e8fc56ce7c00e874: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
1377
+ arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
1378
+ }, arguments); },
1379
+ __wbg_arrayBuffer_848c392b70c67d3d: function() { return handleError(function (arg0) {
1380
+ const ret = arg0.arrayBuffer();
1381
+ return ret;
1382
+ }, arguments); },
1383
+ __wbg_authorizeresult_new: function(arg0) {
1384
+ const ret = AuthorizeResult.__wrap(arg0);
1385
+ return ret;
1386
+ },
1387
+ __wbg_body_0c3a51aec038a31a: function(arg0) {
1388
+ const ret = arg0.body;
1389
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1390
+ },
1391
+ __wbg_buffer_d0f5ea0926a691fd: function(arg0) {
1392
+ const ret = arg0.buffer;
1393
+ return ret;
1394
+ },
1395
+ __wbg_byobRequest_dc6aed9db01b12c6: function(arg0) {
1396
+ const ret = arg0.byobRequest;
1397
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1398
+ },
1399
+ __wbg_byteLength_3e660e5661f3327e: function(arg0) {
1400
+ const ret = arg0.byteLength;
1401
+ return ret;
1402
+ },
1403
+ __wbg_byteOffset_ecd62abe44dd28d4: function(arg0) {
1404
+ const ret = arg0.byteOffset;
1405
+ return ret;
1406
+ },
1407
+ __wbg_call_14b169f759b26747: function() { return handleError(function (arg0, arg1) {
1408
+ const ret = arg0.call(arg1);
1409
+ return ret;
1410
+ }, arguments); },
1411
+ __wbg_call_a24592a6f349a97e: function() { return handleError(function (arg0, arg1, arg2) {
1412
+ const ret = arg0.call(arg1, arg2);
1413
+ return ret;
1414
+ }, arguments); },
1415
+ __wbg_cancel_ceb1bda02e29f0a9: function(arg0) {
1416
+ const ret = arg0.cancel();
1417
+ return ret;
1418
+ },
1419
+ __wbg_catch_e9362815fd0b24cf: function(arg0, arg1) {
1420
+ const ret = arg0.catch(arg1);
1421
+ return ret;
1422
+ },
1423
+ __wbg_cedarling_new: function(arg0) {
1424
+ const ret = Cedarling.__wrap(arg0);
1425
+ return ret;
1426
+ },
1427
+ __wbg_clearTimeout_2256f1e7b94ef517: function(arg0) {
1428
+ const ret = clearTimeout(arg0);
1429
+ return ret;
1430
+ },
1431
+ __wbg_clearTimeout_3629d6209dfcc46e: function(arg0) {
1432
+ const ret = clearTimeout(arg0);
1433
+ return ret;
1434
+ },
1435
+ __wbg_clearTimeout_c122f92fd48cd749: function(arg0) {
1436
+ const ret = clearTimeout(arg0);
1437
+ return ret;
1438
+ },
1439
+ __wbg_close_e6c8977a002e9e13: function() { return handleError(function (arg0) {
1440
+ arg0.close();
1441
+ }, arguments); },
1442
+ __wbg_close_fb954dfaf67b5732: function() { return handleError(function (arg0) {
1443
+ arg0.close();
1444
+ }, arguments); },
1445
+ __wbg_crypto_38df2bab126b63dc: function(arg0) {
1446
+ const ret = arg0.crypto;
1447
+ return ret;
1448
+ },
1449
+ __wbg_dataentry_new: function(arg0) {
1450
+ const ret = DataEntry.__wrap(arg0);
1451
+ return ret;
1452
+ },
1453
+ __wbg_debug_e679aee1a146ce33: function(arg0) {
1454
+ console.debug(...arg0);
1455
+ },
1456
+ __wbg_done_9158f7cc8751ba32: function(arg0) {
1457
+ const ret = arg0.done;
1458
+ return ret;
1459
+ },
1460
+ __wbg_enqueue_4767ce322820c94d: function() { return handleError(function (arg0, arg1) {
1461
+ arg0.enqueue(arg1);
1462
+ }, arguments); },
1463
+ __wbg_entries_2bf997cf82353e47: function(arg0) {
1464
+ const ret = arg0.entries();
1465
+ return ret;
1466
+ },
1467
+ __wbg_entries_bf727fcd7bf35a41: function(arg0) {
1468
+ const ret = arg0.entries();
1469
+ return ret;
1470
+ },
1471
+ __wbg_entries_e0b73aa8571ddb56: function(arg0) {
1472
+ const ret = Object.entries(arg0);
1473
+ return ret;
1474
+ },
1475
+ __wbg_error_290de5487bca6d05: function(arg0) {
1476
+ console.error(...arg0);
1477
+ },
1478
+ __wbg_fetch_0d322c0aed196b8b: function(arg0, arg1) {
1479
+ const ret = arg0.fetch(arg1);
1480
+ return ret;
1481
+ },
1482
+ __wbg_fetch_28a97b69c20078bb: function(arg0, arg1, arg2) {
1483
+ const ret = arg0.fetch(arg1, arg2);
1484
+ return ret;
1485
+ },
1486
+ __wbg_fetch_43b2f110608a59ff: function(arg0) {
1487
+ const ret = fetch(arg0);
1488
+ return ret;
1489
+ },
1490
+ __wbg_fetch_5e2e4a3d60c8d1d3: function(arg0, arg1) {
1491
+ const ret = fetch(arg0, arg1);
1492
+ return ret;
1493
+ },
1494
+ __wbg_fromEntries_ce99d7540610a555: function() { return handleError(function (arg0) {
1495
+ const ret = Object.fromEntries(arg0);
1496
+ return ret;
1497
+ }, arguments); },
1498
+ __wbg_getRandomValues_76dfc69825c9c552: function() { return handleError(function (arg0, arg1) {
1499
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
1500
+ }, arguments); },
1501
+ __wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
1502
+ arg0.getRandomValues(arg1);
1503
+ }, arguments); },
1504
+ __wbg_getReader_9facd4f899beac89: function() { return handleError(function (arg0) {
1505
+ const ret = arg0.getReader();
1506
+ return ret;
1507
+ }, arguments); },
1508
+ __wbg_getTime_da7c55f52b71e8c6: function(arg0) {
1509
+ const ret = arg0.getTime();
1510
+ return ret;
1511
+ },
1512
+ __wbg_getTimezoneOffset_31f57a5389d0d57c: function(arg0) {
1513
+ const ret = arg0.getTimezoneOffset();
1514
+ return ret;
1515
+ },
1516
+ __wbg_get_1affdbdd5573b16a: function() { return handleError(function (arg0, arg1) {
1517
+ const ret = Reflect.get(arg0, arg1);
1518
+ return ret;
1519
+ }, arguments); },
1520
+ __wbg_get_6011fa3a58f61074: function() { return handleError(function (arg0, arg1) {
1521
+ const ret = Reflect.get(arg0, arg1);
1522
+ return ret;
1523
+ }, arguments); },
1524
+ __wbg_get_8360291721e2339f: function(arg0, arg1) {
1525
+ const ret = arg0[arg1 >>> 0];
1526
+ return ret;
1527
+ },
1528
+ __wbg_get_done_282bca5d3f90e0a8: function(arg0) {
1529
+ const ret = arg0.done;
1530
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
1531
+ },
1532
+ __wbg_get_unchecked_17f53dad852b9588: function(arg0, arg1) {
1533
+ const ret = arg0[arg1 >>> 0];
1534
+ return ret;
1535
+ },
1536
+ __wbg_get_value_65a7a2c60b42fd75: function(arg0) {
1537
+ const ret = arg0.value;
1538
+ return ret;
1539
+ },
1540
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
1541
+ const ret = arg0[arg1];
1542
+ return ret;
1543
+ },
1544
+ __wbg_has_880f1d472f7cecba: function() { return handleError(function (arg0, arg1) {
1545
+ const ret = Reflect.has(arg0, arg1);
1546
+ return ret;
1547
+ }, arguments); },
1548
+ __wbg_headers_6022deb4e576fb8e: function(arg0) {
1549
+ const ret = arg0.headers;
1550
+ return ret;
1551
+ },
1552
+ __wbg_info_cd965dfbcb78a57d: function(arg0) {
1553
+ console.info(...arg0);
1554
+ },
1555
+ __wbg_instanceof_ArrayBuffer_7c8433c6ed14ffe3: function(arg0) {
1556
+ let result;
1557
+ try {
1558
+ result = arg0 instanceof ArrayBuffer;
1559
+ } catch (_) {
1560
+ result = false;
1561
+ }
1562
+ const ret = result;
1563
+ return ret;
1564
+ },
1565
+ __wbg_instanceof_Array_d0200cccb1297a10: function(arg0) {
1566
+ let result;
1567
+ try {
1568
+ result = arg0 instanceof Array;
1569
+ } catch (_) {
1570
+ result = false;
1571
+ }
1572
+ const ret = result;
1573
+ return ret;
1574
+ },
1575
+ __wbg_instanceof_Map_1b76fd4635be43eb: function(arg0) {
1576
+ let result;
1577
+ try {
1578
+ result = arg0 instanceof Map;
1579
+ } catch (_) {
1580
+ result = false;
1581
+ }
1582
+ const ret = result;
1583
+ return ret;
1584
+ },
1585
+ __wbg_instanceof_Response_9b2d111407865ff2: function(arg0) {
1586
+ let result;
1587
+ try {
1588
+ result = arg0 instanceof Response;
1589
+ } catch (_) {
1590
+ result = false;
1591
+ }
1592
+ const ret = result;
1593
+ return ret;
1594
+ },
1595
+ __wbg_instanceof_Uint8Array_152ba1f289edcf3f: function(arg0) {
1596
+ let result;
1597
+ try {
1598
+ result = arg0 instanceof Uint8Array;
1599
+ } catch (_) {
1600
+ result = false;
1601
+ }
1602
+ const ret = result;
1603
+ return ret;
1604
+ },
1605
+ __wbg_isArray_c3109d14ffc06469: function(arg0) {
1606
+ const ret = Array.isArray(arg0);
1607
+ return ret;
1608
+ },
1609
+ __wbg_isSafeInteger_4fc213d1989d6d2a: function(arg0) {
1610
+ const ret = Number.isSafeInteger(arg0);
1611
+ return ret;
1612
+ },
1613
+ __wbg_iterator_013bc09ec998c2a7: function() {
1614
+ const ret = Symbol.iterator;
1615
+ return ret;
1616
+ },
1617
+ __wbg_keys_2fd1bfdda7e278ca: function(arg0) {
1618
+ const ret = Object.keys(arg0);
1619
+ return ret;
1620
+ },
1621
+ __wbg_length_3d4ecd04bd8d22f1: function(arg0) {
1622
+ const ret = arg0.length;
1623
+ return ret;
1624
+ },
1625
+ __wbg_length_9f1775224cf1d815: function(arg0) {
1626
+ const ret = arg0.length;
1627
+ return ret;
1628
+ },
1629
+ __wbg_log_3e08aa4d12dba7f3: function(arg0) {
1630
+ console.log(...arg0);
1631
+ },
1632
+ __wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
1633
+ const ret = arg0.msCrypto;
1634
+ return ret;
1635
+ },
1636
+ __wbg_multiissuerauthorizeresult_new: function(arg0) {
1637
+ const ret = MultiIssuerAuthorizeResult.__wrap(arg0);
1638
+ return ret;
1639
+ },
1640
+ __wbg_new_0_4d657201ced14de3: function() {
1641
+ const ret = new Date();
1642
+ return ret;
1643
+ },
1644
+ __wbg_new_0c7403db6e782f19: function(arg0) {
1645
+ const ret = new Uint8Array(arg0);
1646
+ return ret;
1647
+ },
1648
+ __wbg_new_15a4889b4b90734d: function() { return handleError(function () {
1649
+ const ret = new Headers();
1650
+ return ret;
1651
+ }, arguments); },
1652
+ __wbg_new_34d45cc8e36aaead: function() {
1653
+ const ret = new Map();
1654
+ return ret;
1655
+ },
1656
+ __wbg_new_5e360d2ff7b9e1c3: function(arg0, arg1) {
1657
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
1658
+ return ret;
1659
+ },
1660
+ __wbg_new_682678e2f47e32bc: function() {
1661
+ const ret = new Array();
1662
+ return ret;
1663
+ },
1664
+ __wbg_new_7913666fe5070684: function(arg0) {
1665
+ const ret = new Date(arg0);
1666
+ return ret;
1667
+ },
1668
+ __wbg_new_98c22165a42231aa: function() { return handleError(function () {
1669
+ const ret = new AbortController();
1670
+ return ret;
1671
+ }, arguments); },
1672
+ __wbg_new_aa8d0fa9762c29bd: function() {
1673
+ const ret = new Object();
1674
+ return ret;
1675
+ },
1676
+ __wbg_new_from_slice_b5ea43e23f6008c0: function(arg0, arg1) {
1677
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
1678
+ return ret;
1679
+ },
1680
+ __wbg_new_typed_323f37fd55ab048d: function(arg0, arg1) {
1681
+ try {
1682
+ var state0 = {a: arg0, b: arg1};
1683
+ var cb0 = (arg0, arg1) => {
1684
+ const a = state0.a;
1685
+ state0.a = 0;
1686
+ try {
1687
+ return wasm_bindgen__convert__closures_____invoke__h66f11f9242c621fe(a, state0.b, arg0, arg1);
1688
+ } finally {
1689
+ state0.a = a;
1690
+ }
1691
+ };
1692
+ const ret = new Promise(cb0);
1693
+ return ret;
1694
+ } finally {
1695
+ state0.a = 0;
1696
+ }
1697
+ },
1698
+ __wbg_new_with_byte_offset_and_length_01848e8d6a3d49ad: function(arg0, arg1, arg2) {
1699
+ const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
1700
+ return ret;
1701
+ },
1702
+ __wbg_new_with_length_8c854e41ea4dae9b: function(arg0) {
1703
+ const ret = new Uint8Array(arg0 >>> 0);
1704
+ return ret;
1705
+ },
1706
+ __wbg_new_with_str_and_init_897be1708e42f39d: function() { return handleError(function (arg0, arg1, arg2) {
1707
+ const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
1708
+ return ret;
1709
+ }, arguments); },
1710
+ __wbg_next_0340c4ae324393c3: function() { return handleError(function (arg0) {
1711
+ const ret = arg0.next();
1712
+ return ret;
1713
+ }, arguments); },
1714
+ __wbg_next_7646edaa39458ef7: function(arg0) {
1715
+ const ret = arg0.next;
1716
+ return ret;
1717
+ },
1718
+ __wbg_node_84ea875411254db1: function(arg0) {
1719
+ const ret = arg0.node;
1720
+ return ret;
1721
+ },
1722
+ __wbg_policyevaluationerror_new: function(arg0) {
1723
+ const ret = PolicyEvaluationError.__wrap(arg0);
1724
+ return ret;
1725
+ },
1726
+ __wbg_process_44c7a14e11e9f69e: function(arg0) {
1727
+ const ret = arg0.process;
1728
+ return ret;
1729
+ },
1730
+ __wbg_prototypesetcall_a6b02eb00b0f4ce2: function(arg0, arg1, arg2) {
1731
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1732
+ },
1733
+ __wbg_push_471a5b068a5295f6: function(arg0, arg1) {
1734
+ const ret = arg0.push(arg1);
1735
+ return ret;
1736
+ },
1737
+ __wbg_queueMicrotask_5d15a957e6aa920e: function(arg0) {
1738
+ queueMicrotask(arg0);
1739
+ },
1740
+ __wbg_queueMicrotask_f8819e5ffc402f36: function(arg0) {
1741
+ const ret = arg0.queueMicrotask;
1742
+ return ret;
1743
+ },
1744
+ __wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
1745
+ arg0.randomFillSync(arg1);
1746
+ }, arguments); },
1747
+ __wbg_read_ddc2d178d2e57272: function(arg0) {
1748
+ const ret = arg0.read();
1749
+ return ret;
1750
+ },
1751
+ __wbg_releaseLock_9baaf3ccc5cfad69: function(arg0) {
1752
+ arg0.releaseLock();
1753
+ },
1754
+ __wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
1755
+ const ret = module.require;
1756
+ return ret;
1757
+ }, arguments); },
1758
+ __wbg_resolve_e6c466bc1052f16c: function(arg0) {
1759
+ const ret = Promise.resolve(arg0);
1760
+ return ret;
1761
+ },
1762
+ __wbg_respond_008ca9525ae22847: function() { return handleError(function (arg0, arg1) {
1763
+ arg0.respond(arg1 >>> 0);
1764
+ }, arguments); },
1765
+ __wbg_setTimeout_56bcdccbad22fd44: function() { return handleError(function (arg0, arg1) {
1766
+ const ret = setTimeout(arg0, arg1);
1767
+ return ret;
1768
+ }, arguments); },
1769
+ __wbg_setTimeout_9f4169770fc5a5c3: function(arg0, arg1) {
1770
+ const ret = setTimeout(arg0, arg1);
1771
+ return ret;
1772
+ },
1773
+ __wbg_setTimeout_b188b3bcc8977c7d: function(arg0, arg1) {
1774
+ const ret = setTimeout(arg0, arg1);
1775
+ return ret;
1776
+ },
1777
+ __wbg_set_022bee52d0b05b19: function() { return handleError(function (arg0, arg1, arg2) {
1778
+ const ret = Reflect.set(arg0, arg1, arg2);
1779
+ return ret;
1780
+ }, arguments); },
1781
+ __wbg_set_1ffc463d4c541483: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
1782
+ arg0.set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
1783
+ }, arguments); },
1784
+ __wbg_set_3bf1de9fab0cd644: function(arg0, arg1, arg2) {
1785
+ arg0[arg1 >>> 0] = arg2;
1786
+ },
1787
+ __wbg_set_3d484eb794afec82: function(arg0, arg1, arg2) {
1788
+ arg0.set(getArrayU8FromWasm0(arg1, arg2));
1789
+ },
1790
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
1791
+ arg0[arg1] = arg2;
1792
+ },
1793
+ __wbg_set_body_be11680f34217f75: function(arg0, arg1) {
1794
+ arg0.body = arg1;
1795
+ },
1796
+ __wbg_set_cache_968edea422613d1b: function(arg0, arg1) {
1797
+ arg0.cache = __wbindgen_enum_RequestCache[arg1];
1798
+ },
1799
+ __wbg_set_credentials_6577be90e0e85eb6: function(arg0, arg1) {
1800
+ arg0.credentials = __wbindgen_enum_RequestCredentials[arg1];
1801
+ },
1802
+ __wbg_set_fde2cec06c23692b: function(arg0, arg1, arg2) {
1803
+ const ret = arg0.set(arg1, arg2);
1804
+ return ret;
1805
+ },
1806
+ __wbg_set_headers_50fc01786240a440: function(arg0, arg1) {
1807
+ arg0.headers = arg1;
1808
+ },
1809
+ __wbg_set_integrity_5c3b8dfca7ecca82: function(arg0, arg1, arg2) {
1810
+ arg0.integrity = getStringFromWasm0(arg1, arg2);
1811
+ },
1812
+ __wbg_set_method_c9f1f985f6b6c427: function(arg0, arg1, arg2) {
1813
+ arg0.method = getStringFromWasm0(arg1, arg2);
1814
+ },
1815
+ __wbg_set_mode_5e08d503428c06b9: function(arg0, arg1) {
1816
+ arg0.mode = __wbindgen_enum_RequestMode[arg1];
1817
+ },
1818
+ __wbg_set_redirect_af80b8bace117f0e: function(arg0, arg1) {
1819
+ arg0.redirect = __wbindgen_enum_RequestRedirect[arg1];
1820
+ },
1821
+ __wbg_set_referrer_478d9a69d0d97a98: function(arg0, arg1, arg2) {
1822
+ arg0.referrer = getStringFromWasm0(arg1, arg2);
1823
+ },
1824
+ __wbg_set_referrer_policy_84fedaa88bc9d667: function(arg0, arg1) {
1825
+ arg0.referrerPolicy = __wbindgen_enum_ReferrerPolicy[arg1];
1826
+ },
1827
+ __wbg_set_signal_1d4e73c2305a0e7c: function(arg0, arg1) {
1828
+ arg0.signal = arg1;
1829
+ },
1830
+ __wbg_signal_fdc54643b47bf85b: function(arg0) {
1831
+ const ret = arg0.signal;
1832
+ return ret;
1833
+ },
1834
+ __wbg_static_accessor_GLOBAL_8cfadc87a297ca02: function() {
1835
+ const ret = typeof global === 'undefined' ? null : global;
1836
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1837
+ },
1838
+ __wbg_static_accessor_GLOBAL_THIS_602256ae5c8f42cf: function() {
1839
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1840
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1841
+ },
1842
+ __wbg_static_accessor_SELF_e445c1c7484aecc3: function() {
1843
+ const ret = typeof self === 'undefined' ? null : self;
1844
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1845
+ },
1846
+ __wbg_static_accessor_WINDOW_f20e8576ef1e0f17: function() {
1847
+ const ret = typeof window === 'undefined' ? null : window;
1848
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1849
+ },
1850
+ __wbg_status_43e0d2f15b22d69f: function(arg0) {
1851
+ const ret = arg0.status;
1852
+ return ret;
1853
+ },
1854
+ __wbg_subarray_f8ca46a25b1f5e0d: function(arg0, arg1, arg2) {
1855
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1856
+ return ret;
1857
+ },
1858
+ __wbg_text_595ef75535aa25c1: function() { return handleError(function (arg0) {
1859
+ const ret = arg0.text();
1860
+ return ret;
1861
+ }, arguments); },
1862
+ __wbg_then_792e0c862b060889: function(arg0, arg1, arg2) {
1863
+ const ret = arg0.then(arg1, arg2);
1864
+ return ret;
1865
+ },
1866
+ __wbg_then_8e16ee11f05e4827: function(arg0, arg1) {
1867
+ const ret = arg0.then(arg1);
1868
+ return ret;
1869
+ },
1870
+ __wbg_toString_306ed0b9f320c1ca: function(arg0) {
1871
+ const ret = arg0.toString();
1872
+ return ret;
1873
+ },
1874
+ __wbg_trace_6a5731c8f9d2bfdf: function(arg0) {
1875
+ console.trace(...arg0);
1876
+ },
1877
+ __wbg_url_2bf741820e6563a0: function(arg0, arg1) {
1878
+ const ret = arg1.url;
1879
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1880
+ const len1 = WASM_VECTOR_LEN;
1881
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1882
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1883
+ },
1884
+ __wbg_value_ee3a06f4579184fa: function(arg0) {
1885
+ const ret = arg0.value;
1886
+ return ret;
1887
+ },
1888
+ __wbg_versions_276b2795b1c6a219: function(arg0) {
1889
+ const ret = arg0.versions;
1890
+ return ret;
1891
+ },
1892
+ __wbg_view_701664ffb3b1ce67: function(arg0) {
1893
+ const ret = arg0.view;
1894
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1895
+ },
1896
+ __wbg_warn_2dcbaf81b6d99110: function(arg0) {
1897
+ console.warn(...arg0);
1898
+ },
1899
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1900
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2179, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1901
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h80274e53af2c4a90);
1902
+ return ret;
1903
+ },
1904
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
1905
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 619, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1906
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h170c6019ccfd853a);
1907
+ return ret;
1908
+ },
1909
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
1910
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 526, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1911
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__ha272cf34a0c89527);
1912
+ return ret;
1913
+ },
1914
+ __wbindgen_cast_0000000000000004: function(arg0, arg1) {
1915
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 575, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1916
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h1f68ebdd661f92ac);
1917
+ return ret;
1918
+ },
1919
+ __wbindgen_cast_0000000000000005: function(arg0, arg1) {
1920
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 733, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1921
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hc6d79abdb072c199);
1922
+ return ret;
1923
+ },
1924
+ __wbindgen_cast_0000000000000006: function(arg0) {
1925
+ // Cast intrinsic for `F64 -> Externref`.
1926
+ const ret = arg0;
1927
+ return ret;
1928
+ },
1929
+ __wbindgen_cast_0000000000000007: function(arg0) {
1930
+ // Cast intrinsic for `I64 -> Externref`.
1931
+ const ret = arg0;
1932
+ return ret;
1933
+ },
1934
+ __wbindgen_cast_0000000000000008: function(arg0, arg1) {
1935
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
1936
+ const ret = getArrayU8FromWasm0(arg0, arg1);
1937
+ return ret;
1938
+ },
1939
+ __wbindgen_cast_0000000000000009: function(arg0, arg1) {
1940
+ // Cast intrinsic for `Ref(String) -> Externref`.
1941
+ const ret = getStringFromWasm0(arg0, arg1);
1942
+ return ret;
1943
+ },
1944
+ __wbindgen_cast_000000000000000a: function(arg0) {
1945
+ // Cast intrinsic for `U64 -> Externref`.
1946
+ const ret = BigInt.asUintN(64, arg0);
1947
+ return ret;
1948
+ },
1949
+ __wbindgen_init_externref_table: function() {
1950
+ const table = wasm.__wbindgen_externrefs;
1951
+ const offset = table.grow(4);
1952
+ table.set(0, undefined);
1953
+ table.set(offset + 0, undefined);
1954
+ table.set(offset + 1, null);
1955
+ table.set(offset + 2, true);
1956
+ table.set(offset + 3, false);
1957
+ },
1958
+ };
1959
+ return {
1960
+ __proto__: null,
1961
+ "./cedarling_wasm_bg.js": import0,
1962
+ };
1963
+ }
1964
+
1965
+ function wasm_bindgen__convert__closures_____invoke__ha272cf34a0c89527(arg0, arg1) {
1966
+ wasm.wasm_bindgen__convert__closures_____invoke__ha272cf34a0c89527(arg0, arg1);
1967
+ }
1968
+
1969
+ function wasm_bindgen__convert__closures_____invoke__h1f68ebdd661f92ac(arg0, arg1) {
1970
+ wasm.wasm_bindgen__convert__closures_____invoke__h1f68ebdd661f92ac(arg0, arg1);
1971
+ }
1972
+
1973
+ function wasm_bindgen__convert__closures_____invoke__hc6d79abdb072c199(arg0, arg1) {
1974
+ wasm.wasm_bindgen__convert__closures_____invoke__hc6d79abdb072c199(arg0, arg1);
1975
+ }
1976
+
1977
+ function wasm_bindgen__convert__closures_____invoke__h170c6019ccfd853a(arg0, arg1, arg2) {
1978
+ wasm.wasm_bindgen__convert__closures_____invoke__h170c6019ccfd853a(arg0, arg1, arg2);
1979
+ }
1980
+
1981
+ function wasm_bindgen__convert__closures_____invoke__h80274e53af2c4a90(arg0, arg1, arg2) {
1982
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h80274e53af2c4a90(arg0, arg1, arg2);
1983
+ if (ret[1]) {
1984
+ throw takeFromExternrefTable0(ret[0]);
1985
+ }
1986
+ }
1987
+
1988
+ function wasm_bindgen__convert__closures_____invoke__h66f11f9242c621fe(arg0, arg1, arg2, arg3) {
1989
+ wasm.wasm_bindgen__convert__closures_____invoke__h66f11f9242c621fe(arg0, arg1, arg2, arg3);
1990
+ }
1991
+
1992
+
1993
+ const __wbindgen_enum_ReadableStreamType = ["bytes"];
1994
+
1995
+
1996
+ const __wbindgen_enum_ReferrerPolicy = ["", "no-referrer", "no-referrer-when-downgrade", "origin", "origin-when-cross-origin", "unsafe-url", "same-origin", "strict-origin", "strict-origin-when-cross-origin"];
1997
+
1998
+
1999
+ const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
2000
+
2001
+
2002
+ const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
2003
+
2004
+
2005
+ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
2006
+
2007
+
2008
+ const __wbindgen_enum_RequestRedirect = ["follow", "error", "manual"];
2009
+ const AuthorizeResultFinalization = (typeof FinalizationRegistry === 'undefined')
2010
+ ? { register: () => {}, unregister: () => {} }
2011
+ : new FinalizationRegistry(ptr => wasm.__wbg_authorizeresult_free(ptr >>> 0, 1));
2012
+ const AuthorizeResultResponseFinalization = (typeof FinalizationRegistry === 'undefined')
2013
+ ? { register: () => {}, unregister: () => {} }
2014
+ : new FinalizationRegistry(ptr => wasm.__wbg_authorizeresultresponse_free(ptr >>> 0, 1));
2015
+ const CedarlingFinalization = (typeof FinalizationRegistry === 'undefined')
2016
+ ? { register: () => {}, unregister: () => {} }
2017
+ : new FinalizationRegistry(ptr => wasm.__wbg_cedarling_free(ptr >>> 0, 1));
2018
+ const DataEntryFinalization = (typeof FinalizationRegistry === 'undefined')
2019
+ ? { register: () => {}, unregister: () => {} }
2020
+ : new FinalizationRegistry(ptr => wasm.__wbg_dataentry_free(ptr >>> 0, 1));
2021
+ const DataStoreStatsFinalization = (typeof FinalizationRegistry === 'undefined')
2022
+ ? { register: () => {}, unregister: () => {} }
2023
+ : new FinalizationRegistry(ptr => wasm.__wbg_datastorestats_free(ptr >>> 0, 1));
2024
+ const DiagnosticsFinalization = (typeof FinalizationRegistry === 'undefined')
2025
+ ? { register: () => {}, unregister: () => {} }
2026
+ : new FinalizationRegistry(ptr => wasm.__wbg_diagnostics_free(ptr >>> 0, 1));
2027
+ const IntoUnderlyingByteSourceFinalization = (typeof FinalizationRegistry === 'undefined')
2028
+ ? { register: () => {}, unregister: () => {} }
2029
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingbytesource_free(ptr >>> 0, 1));
2030
+ const IntoUnderlyingSinkFinalization = (typeof FinalizationRegistry === 'undefined')
2031
+ ? { register: () => {}, unregister: () => {} }
2032
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsink_free(ptr >>> 0, 1));
2033
+ const IntoUnderlyingSourceFinalization = (typeof FinalizationRegistry === 'undefined')
2034
+ ? { register: () => {}, unregister: () => {} }
2035
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsource_free(ptr >>> 0, 1));
2036
+ const MultiIssuerAuthorizeResultFinalization = (typeof FinalizationRegistry === 'undefined')
2037
+ ? { register: () => {}, unregister: () => {} }
2038
+ : new FinalizationRegistry(ptr => wasm.__wbg_multiissuerauthorizeresult_free(ptr >>> 0, 1));
2039
+ const PolicyEvaluationErrorFinalization = (typeof FinalizationRegistry === 'undefined')
2040
+ ? { register: () => {}, unregister: () => {} }
2041
+ : new FinalizationRegistry(ptr => wasm.__wbg_policyevaluationerror_free(ptr >>> 0, 1));
2042
+
2043
+ function addToExternrefTable0(obj) {
2044
+ const idx = wasm.__externref_table_alloc();
2045
+ wasm.__wbindgen_externrefs.set(idx, obj);
2046
+ return idx;
2047
+ }
2048
+
2049
+ function _assertClass(instance, klass) {
2050
+ if (!(instance instanceof klass)) {
2051
+ throw new Error(`expected instance of ${klass.name}`);
2052
+ }
2053
+ }
2054
+
2055
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
2056
+ ? { register: () => {}, unregister: () => {} }
2057
+ : new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
2058
+
2059
+ function debugString(val) {
2060
+ // primitive types
2061
+ const type = typeof val;
2062
+ if (type == 'number' || type == 'boolean' || val == null) {
2063
+ return `${val}`;
2064
+ }
2065
+ if (type == 'string') {
2066
+ return `"${val}"`;
2067
+ }
2068
+ if (type == 'symbol') {
2069
+ const description = val.description;
2070
+ if (description == null) {
2071
+ return 'Symbol';
2072
+ } else {
2073
+ return `Symbol(${description})`;
2074
+ }
2075
+ }
2076
+ if (type == 'function') {
2077
+ const name = val.name;
2078
+ if (typeof name == 'string' && name.length > 0) {
2079
+ return `Function(${name})`;
2080
+ } else {
2081
+ return 'Function';
2082
+ }
2083
+ }
2084
+ // objects
2085
+ if (Array.isArray(val)) {
2086
+ const length = val.length;
2087
+ let debug = '[';
2088
+ if (length > 0) {
2089
+ debug += debugString(val[0]);
2090
+ }
2091
+ for(let i = 1; i < length; i++) {
2092
+ debug += ', ' + debugString(val[i]);
2093
+ }
2094
+ debug += ']';
2095
+ return debug;
2096
+ }
2097
+ // Test for built-in
2098
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
2099
+ let className;
2100
+ if (builtInMatches && builtInMatches.length > 1) {
2101
+ className = builtInMatches[1];
2102
+ } else {
2103
+ // Failed to match the standard '[object ClassName]'
2104
+ return toString.call(val);
2105
+ }
2106
+ if (className == 'Object') {
2107
+ // we're a user defined class or Object
2108
+ // JSON.stringify avoids problems with cycles, and is generally much
2109
+ // easier than looping through ownProperties of `val`.
2110
+ try {
2111
+ return 'Object(' + JSON.stringify(val) + ')';
2112
+ } catch (_) {
2113
+ return 'Object';
2114
+ }
2115
+ }
2116
+ // errors
2117
+ if (val instanceof Error) {
2118
+ return `${val.name}: ${val.message}\n${val.stack}`;
2119
+ }
2120
+ // TODO we could test for more things here, like `Set`s and `Map`s.
2121
+ return className;
2122
+ }
2123
+
2124
+ function getArrayJsValueFromWasm0(ptr, len) {
2125
+ ptr = ptr >>> 0;
2126
+ const mem = getDataViewMemory0();
2127
+ const result = [];
2128
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
2129
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
2130
+ }
2131
+ wasm.__externref_drop_slice(ptr, len);
2132
+ return result;
2133
+ }
2134
+
2135
+ function getArrayU8FromWasm0(ptr, len) {
2136
+ ptr = ptr >>> 0;
2137
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
2138
+ }
2139
+
2140
+ let cachedDataViewMemory0 = null;
2141
+ function getDataViewMemory0() {
2142
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
2143
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
2144
+ }
2145
+ return cachedDataViewMemory0;
2146
+ }
2147
+
2148
+ function getStringFromWasm0(ptr, len) {
2149
+ ptr = ptr >>> 0;
2150
+ return decodeText(ptr, len);
2151
+ }
2152
+
2153
+ let cachedUint8ArrayMemory0 = null;
2154
+ function getUint8ArrayMemory0() {
2155
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
2156
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
2157
+ }
2158
+ return cachedUint8ArrayMemory0;
2159
+ }
2160
+
2161
+ function handleError(f, args) {
2162
+ try {
2163
+ return f.apply(this, args);
2164
+ } catch (e) {
2165
+ const idx = addToExternrefTable0(e);
2166
+ wasm.__wbindgen_exn_store(idx);
2167
+ }
2168
+ }
2169
+
2170
+ function isLikeNone(x) {
2171
+ return x === undefined || x === null;
2172
+ }
2173
+
2174
+ function makeMutClosure(arg0, arg1, f) {
2175
+ const state = { a: arg0, b: arg1, cnt: 1 };
2176
+ const real = (...args) => {
2177
+
2178
+ // First up with a closure we increment the internal reference
2179
+ // count. This ensures that the Rust closure environment won't
2180
+ // be deallocated while we're invoking it.
2181
+ state.cnt++;
2182
+ const a = state.a;
2183
+ state.a = 0;
2184
+ try {
2185
+ return f(a, state.b, ...args);
2186
+ } finally {
2187
+ state.a = a;
2188
+ real._wbg_cb_unref();
2189
+ }
2190
+ };
2191
+ real._wbg_cb_unref = () => {
2192
+ if (--state.cnt === 0) {
2193
+ wasm.__wbindgen_destroy_closure(state.a, state.b);
2194
+ state.a = 0;
2195
+ CLOSURE_DTORS.unregister(state);
2196
+ }
2197
+ };
2198
+ CLOSURE_DTORS.register(real, state, state);
2199
+ return real;
2200
+ }
2201
+
2202
+ function passStringToWasm0(arg, malloc, realloc) {
2203
+ if (realloc === undefined) {
2204
+ const buf = cachedTextEncoder.encode(arg);
2205
+ const ptr = malloc(buf.length, 1) >>> 0;
2206
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
2207
+ WASM_VECTOR_LEN = buf.length;
2208
+ return ptr;
2209
+ }
2210
+
2211
+ let len = arg.length;
2212
+ let ptr = malloc(len, 1) >>> 0;
2213
+
2214
+ const mem = getUint8ArrayMemory0();
2215
+
2216
+ let offset = 0;
2217
+
2218
+ for (; offset < len; offset++) {
2219
+ const code = arg.charCodeAt(offset);
2220
+ if (code > 0x7F) break;
2221
+ mem[ptr + offset] = code;
757
2222
  }
758
- /**
759
- * @param {any} logic
760
- * @param {any} data
761
- * @returns {any}
762
- */
763
- apply(logic, data) {
764
- try {
765
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
766
- wasm.jsjsonlogic_apply(retptr, this.__wbg_ptr, addHeapObject(logic), addHeapObject(data));
767
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
768
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
769
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
770
- if (r2) {
771
- throw takeObject(r1);
772
- }
773
- return takeObject(r0);
774
- } finally {
775
- wasm.__wbindgen_add_to_stack_pointer(16);
2223
+ if (offset !== len) {
2224
+ if (offset !== 0) {
2225
+ arg = arg.slice(offset);
776
2226
  }
2227
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
2228
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
2229
+ const ret = cachedTextEncoder.encodeInto(arg, view);
2230
+
2231
+ offset += ret.written;
2232
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
777
2233
  }
2234
+
2235
+ WASM_VECTOR_LEN = offset;
2236
+ return ptr;
778
2237
  }
779
2238
 
780
- const PolicyEvaluationErrorFinalization = (typeof FinalizationRegistry === 'undefined')
781
- ? { register: () => {}, unregister: () => {} }
782
- : new FinalizationRegistry(ptr => wasm.__wbg_policyevaluationerror_free(ptr >>> 0, 1));
783
- /**
784
- * PolicyEvaluationError
785
- * =====================
786
- *
787
- * Represents an error that occurred when evaluating a Cedar policy.
788
- */
789
- export class PolicyEvaluationError {
2239
+ function takeFromExternrefTable0(idx) {
2240
+ const value = wasm.__wbindgen_externrefs.get(idx);
2241
+ wasm.__externref_table_dealloc(idx);
2242
+ return value;
2243
+ }
790
2244
 
791
- static __wrap(ptr) {
792
- ptr = ptr >>> 0;
793
- const obj = Object.create(PolicyEvaluationError.prototype);
794
- obj.__wbg_ptr = ptr;
795
- PolicyEvaluationErrorFinalization.register(obj, obj.__wbg_ptr, obj);
796
- return obj;
2245
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2246
+ cachedTextDecoder.decode();
2247
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
2248
+ let numBytesDecoded = 0;
2249
+ function decodeText(ptr, len) {
2250
+ numBytesDecoded += len;
2251
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
2252
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2253
+ cachedTextDecoder.decode();
2254
+ numBytesDecoded = len;
797
2255
  }
2256
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
2257
+ }
798
2258
 
799
- __destroy_into_raw() {
800
- const ptr = this.__wbg_ptr;
801
- this.__wbg_ptr = 0;
802
- PolicyEvaluationErrorFinalization.unregister(this);
803
- return ptr;
804
- }
2259
+ const cachedTextEncoder = new TextEncoder();
805
2260
 
806
- free() {
807
- const ptr = this.__destroy_into_raw();
808
- wasm.__wbg_policyevaluationerror_free(ptr, 0);
809
- }
810
- /**
811
- * Id of the policy with an error
812
- * @returns {string}
813
- */
814
- get id() {
815
- let deferred1_0;
816
- let deferred1_1;
817
- try {
818
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
819
- wasm.policyevaluationerror_id(retptr, this.__wbg_ptr);
820
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
821
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
822
- deferred1_0 = r0;
823
- deferred1_1 = r1;
824
- return getStringFromWasm0(r0, r1);
825
- } finally {
826
- wasm.__wbindgen_add_to_stack_pointer(16);
827
- wasm.__wbindgen_export_4(deferred1_0, deferred1_1, 1);
828
- }
829
- }
830
- /**
831
- * Underlying evaluation error string representation
832
- * @returns {string}
833
- */
834
- get error() {
835
- let deferred1_0;
836
- let deferred1_1;
837
- try {
838
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
839
- wasm.policyevaluationerror_error(retptr, this.__wbg_ptr);
840
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
841
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
842
- deferred1_0 = r0;
843
- deferred1_1 = r1;
844
- return getStringFromWasm0(r0, r1);
845
- } finally {
846
- wasm.__wbindgen_add_to_stack_pointer(16);
847
- wasm.__wbindgen_export_4(deferred1_0, deferred1_1, 1);
848
- }
849
- }
2261
+ if (!('encodeInto' in cachedTextEncoder)) {
2262
+ cachedTextEncoder.encodeInto = function (arg, view) {
2263
+ const buf = cachedTextEncoder.encode(arg);
2264
+ view.set(buf);
2265
+ return {
2266
+ read: arg.length,
2267
+ written: buf.length
2268
+ };
2269
+ };
2270
+ }
2271
+
2272
+ let WASM_VECTOR_LEN = 0;
2273
+
2274
+ let wasmModule, wasm;
2275
+ function __wbg_finalize_init(instance, module) {
2276
+ wasm = instance.exports;
2277
+ wasmModule = module;
2278
+ cachedDataViewMemory0 = null;
2279
+ cachedUint8ArrayMemory0 = null;
2280
+ wasm.__wbindgen_start();
2281
+ return wasm;
850
2282
  }
851
2283
 
852
2284
  async function __wbg_load(module, imports) {
@@ -854,580 +2286,41 @@ async function __wbg_load(module, imports) {
854
2286
  if (typeof WebAssembly.instantiateStreaming === 'function') {
855
2287
  try {
856
2288
  return await WebAssembly.instantiateStreaming(module, imports);
857
-
858
2289
  } catch (e) {
859
- if (module.headers.get('Content-Type') != 'application/wasm') {
2290
+ const validResponse = module.ok && expectedResponseType(module.type);
2291
+
2292
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
860
2293
  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);
861
2294
 
862
- } else {
863
- throw e;
864
- }
2295
+ } else { throw e; }
865
2296
  }
866
2297
  }
867
2298
 
868
2299
  const bytes = await module.arrayBuffer();
869
2300
  return await WebAssembly.instantiate(bytes, imports);
870
-
871
2301
  } else {
872
2302
  const instance = await WebAssembly.instantiate(module, imports);
873
2303
 
874
2304
  if (instance instanceof WebAssembly.Instance) {
875
2305
  return { instance, module };
876
-
877
2306
  } else {
878
2307
  return instance;
879
2308
  }
880
2309
  }
881
- }
882
2310
 
883
- function __wbg_get_imports() {
884
- const imports = {};
885
- imports.wbg = {};
886
- imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
887
- const ret = String(getObject(arg1));
888
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
889
- const len1 = WASM_VECTOR_LEN;
890
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
891
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
892
- };
893
- imports.wbg.__wbg_abort_410ec47a64ac6117 = function(arg0, arg1) {
894
- getObject(arg0).abort(getObject(arg1));
895
- };
896
- imports.wbg.__wbg_abort_775ef1d17fc65868 = function(arg0) {
897
- getObject(arg0).abort();
898
- };
899
- imports.wbg.__wbg_append_8c7dd8d641a5f01b = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
900
- getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
901
- }, arguments) };
902
- imports.wbg.__wbg_authorizeresult_new = function(arg0) {
903
- const ret = AuthorizeResult.__wrap(arg0);
904
- return addHeapObject(ret);
905
- };
906
- imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
907
- const ret = getObject(arg0).buffer;
908
- return addHeapObject(ret);
909
- };
910
- imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
911
- const ret = getObject(arg0).call(getObject(arg1));
912
- return addHeapObject(ret);
913
- }, arguments) };
914
- imports.wbg.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) {
915
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
916
- return addHeapObject(ret);
917
- }, arguments) };
918
- imports.wbg.__wbg_cedarling_new = function(arg0) {
919
- const ret = Cedarling.__wrap(arg0);
920
- return addHeapObject(ret);
921
- };
922
- imports.wbg.__wbg_clearTimeout_86721db0036bea98 = function(arg0) {
923
- const ret = clearTimeout(takeObject(arg0));
924
- return addHeapObject(ret);
925
- };
926
- imports.wbg.__wbg_crypto_ed58b8e10a292839 = function(arg0) {
927
- const ret = getObject(arg0).crypto;
928
- return addHeapObject(ret);
929
- };
930
- imports.wbg.__wbg_debug_faaa2b98a2718860 = function(arg0) {
931
- console.debug(...getObject(arg0));
932
- };
933
- imports.wbg.__wbg_done_769e5ede4b31c67b = function(arg0) {
934
- const ret = getObject(arg0).done;
935
- return ret;
936
- };
937
- imports.wbg.__wbg_entries_3265d4158b33e5dc = function(arg0) {
938
- const ret = Object.entries(getObject(arg0));
939
- return addHeapObject(ret);
940
- };
941
- imports.wbg.__wbg_entries_c8a90a7ed73e84ce = function(arg0) {
942
- const ret = getObject(arg0).entries();
943
- return addHeapObject(ret);
944
- };
945
- imports.wbg.__wbg_error_dc53417fcef5463a = function(arg0) {
946
- console.error(...getObject(arg0));
947
- };
948
- imports.wbg.__wbg_fetch_509096533071c657 = function(arg0, arg1) {
949
- const ret = getObject(arg0).fetch(getObject(arg1));
950
- return addHeapObject(ret);
951
- };
952
- imports.wbg.__wbg_fetch_d36a73832f0a45e8 = function(arg0) {
953
- const ret = fetch(getObject(arg0));
954
- return addHeapObject(ret);
955
- };
956
- imports.wbg.__wbg_fromEntries_524679eecb0bdc2e = function() { return handleError(function (arg0) {
957
- const ret = Object.fromEntries(getObject(arg0));
958
- return addHeapObject(ret);
959
- }, arguments) };
960
- imports.wbg.__wbg_getRandomValues_bcb4912f16000dc4 = function() { return handleError(function (arg0, arg1) {
961
- getObject(arg0).getRandomValues(getObject(arg1));
962
- }, arguments) };
963
- imports.wbg.__wbg_getTime_46267b1c24877e30 = function(arg0) {
964
- const ret = getObject(arg0).getTime();
965
- return ret;
966
- };
967
- imports.wbg.__wbg_getTimezoneOffset_6b5752021c499c47 = function(arg0) {
968
- const ret = getObject(arg0).getTimezoneOffset();
969
- return ret;
970
- };
971
- imports.wbg.__wbg_get_67b2ba62fc30de12 = function() { return handleError(function (arg0, arg1) {
972
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
973
- return addHeapObject(ret);
974
- }, arguments) };
975
- imports.wbg.__wbg_get_b9b93047fe3cf45b = function(arg0, arg1) {
976
- const ret = getObject(arg0)[arg1 >>> 0];
977
- return addHeapObject(ret);
978
- };
979
- imports.wbg.__wbg_getwithrefkey_1dc361bd10053bfe = function(arg0, arg1) {
980
- const ret = getObject(arg0)[getObject(arg1)];
981
- return addHeapObject(ret);
982
- };
983
- imports.wbg.__wbg_has_a5ea9117f258a0ec = function() { return handleError(function (arg0, arg1) {
984
- const ret = Reflect.has(getObject(arg0), getObject(arg1));
985
- return ret;
986
- }, arguments) };
987
- imports.wbg.__wbg_headers_9cb51cfd2ac780a4 = function(arg0) {
988
- const ret = getObject(arg0).headers;
989
- return addHeapObject(ret);
990
- };
991
- imports.wbg.__wbg_info_7fbe81f62c7b4dab = function(arg0) {
992
- console.info(...getObject(arg0));
993
- };
994
- imports.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function(arg0) {
995
- let result;
996
- try {
997
- result = getObject(arg0) instanceof ArrayBuffer;
998
- } catch (_) {
999
- result = false;
1000
- }
1001
- const ret = result;
1002
- return ret;
1003
- };
1004
- imports.wbg.__wbg_instanceof_Array_6ac07133d621675a = function(arg0) {
1005
- let result;
1006
- try {
1007
- result = getObject(arg0) instanceof Array;
1008
- } catch (_) {
1009
- result = false;
1010
- }
1011
- const ret = result;
1012
- return ret;
1013
- };
1014
- imports.wbg.__wbg_instanceof_Map_f3469ce2244d2430 = function(arg0) {
1015
- let result;
1016
- try {
1017
- result = getObject(arg0) instanceof Map;
1018
- } catch (_) {
1019
- result = false;
1020
- }
1021
- const ret = result;
1022
- return ret;
1023
- };
1024
- imports.wbg.__wbg_instanceof_Response_f2cc20d9f7dfd644 = function(arg0) {
1025
- let result;
1026
- try {
1027
- result = getObject(arg0) instanceof Response;
1028
- } catch (_) {
1029
- result = false;
2311
+ function expectedResponseType(type) {
2312
+ switch (type) {
2313
+ case 'basic': case 'cors': case 'default': return true;
1030
2314
  }
1031
- const ret = result;
1032
- return ret;
1033
- };
1034
- imports.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9 = function(arg0) {
1035
- let result;
1036
- try {
1037
- result = getObject(arg0) instanceof Uint8Array;
1038
- } catch (_) {
1039
- result = false;
1040
- }
1041
- const ret = result;
1042
- return ret;
1043
- };
1044
- imports.wbg.__wbg_isArray_a1eab7e0d067391b = function(arg0) {
1045
- const ret = Array.isArray(getObject(arg0));
1046
- return ret;
1047
- };
1048
- imports.wbg.__wbg_isSafeInteger_343e2beeeece1bb0 = function(arg0) {
1049
- const ret = Number.isSafeInteger(getObject(arg0));
1050
- return ret;
1051
- };
1052
- imports.wbg.__wbg_iterator_9a24c88df860dc65 = function() {
1053
- const ret = Symbol.iterator;
1054
- return addHeapObject(ret);
1055
- };
1056
- imports.wbg.__wbg_keys_5c77a08ddc2fb8a6 = function(arg0) {
1057
- const ret = Object.keys(getObject(arg0));
1058
- return addHeapObject(ret);
1059
- };
1060
- imports.wbg.__wbg_length_a446193dc22c12f8 = function(arg0) {
1061
- const ret = getObject(arg0).length;
1062
- return ret;
1063
- };
1064
- imports.wbg.__wbg_length_e2d2a49132c1b256 = function(arg0) {
1065
- const ret = getObject(arg0).length;
1066
- return ret;
1067
- };
1068
- imports.wbg.__wbg_log_245868b4b99cdf20 = function(arg0) {
1069
- console.log(...getObject(arg0));
1070
- };
1071
- imports.wbg.__wbg_msCrypto_0a36e2ec3a343d26 = function(arg0) {
1072
- const ret = getObject(arg0).msCrypto;
1073
- return addHeapObject(ret);
1074
- };
1075
- imports.wbg.__wbg_new0_f788a2397c7ca929 = function() {
1076
- const ret = new Date();
1077
- return addHeapObject(ret);
1078
- };
1079
- imports.wbg.__wbg_new_018dcc2d6c8c2f6a = function() { return handleError(function () {
1080
- const ret = new Headers();
1081
- return addHeapObject(ret);
1082
- }, arguments) };
1083
- imports.wbg.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
1084
- try {
1085
- var state0 = {a: arg0, b: arg1};
1086
- var cb0 = (arg0, arg1) => {
1087
- const a = state0.a;
1088
- state0.a = 0;
1089
- try {
1090
- return __wbg_adapter_173(a, state0.b, arg0, arg1);
1091
- } finally {
1092
- state0.a = a;
1093
- }
1094
- };
1095
- const ret = new Promise(cb0);
1096
- return addHeapObject(ret);
1097
- } finally {
1098
- state0.a = state0.b = 0;
1099
- }
1100
- };
1101
- imports.wbg.__wbg_new_31a97dac4f10fab7 = function(arg0) {
1102
- const ret = new Date(getObject(arg0));
1103
- return addHeapObject(ret);
1104
- };
1105
- imports.wbg.__wbg_new_405e22f390576ce2 = function() {
1106
- const ret = new Object();
1107
- return addHeapObject(ret);
1108
- };
1109
- imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
1110
- const ret = new Map();
1111
- return addHeapObject(ret);
1112
- };
1113
- imports.wbg.__wbg_new_78feb108b6472713 = function() {
1114
- const ret = new Array();
1115
- return addHeapObject(ret);
1116
- };
1117
- imports.wbg.__wbg_new_a12002a7f91c75be = function(arg0) {
1118
- const ret = new Uint8Array(getObject(arg0));
1119
- return addHeapObject(ret);
1120
- };
1121
- imports.wbg.__wbg_new_e25e5aab09ff45db = function() { return handleError(function () {
1122
- const ret = new AbortController();
1123
- return addHeapObject(ret);
1124
- }, arguments) };
1125
- imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
1126
- const ret = new Function(getStringFromWasm0(arg0, arg1));
1127
- return addHeapObject(ret);
1128
- };
1129
- imports.wbg.__wbg_newwithargs_ab6ffe8cd6c19c04 = function(arg0, arg1, arg2, arg3) {
1130
- const ret = new Function(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
1131
- return addHeapObject(ret);
1132
- };
1133
- imports.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a = function(arg0, arg1, arg2) {
1134
- const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
1135
- return addHeapObject(ret);
1136
- };
1137
- imports.wbg.__wbg_newwithlength_a381634e90c276d4 = function(arg0) {
1138
- const ret = new Uint8Array(arg0 >>> 0);
1139
- return addHeapObject(ret);
1140
- };
1141
- imports.wbg.__wbg_newwithstrandinit_06c535e0a867c635 = function() { return handleError(function (arg0, arg1, arg2) {
1142
- const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
1143
- return addHeapObject(ret);
1144
- }, arguments) };
1145
- imports.wbg.__wbg_next_25feadfc0913fea9 = function(arg0) {
1146
- const ret = getObject(arg0).next;
1147
- return addHeapObject(ret);
1148
- };
1149
- imports.wbg.__wbg_next_6574e1a8a62d1055 = function() { return handleError(function (arg0) {
1150
- const ret = getObject(arg0).next();
1151
- return addHeapObject(ret);
1152
- }, arguments) };
1153
- imports.wbg.__wbg_node_02999533c4ea02e3 = function(arg0) {
1154
- const ret = getObject(arg0).node;
1155
- return addHeapObject(ret);
1156
- };
1157
- imports.wbg.__wbg_policyevaluationerror_new = function(arg0) {
1158
- const ret = PolicyEvaluationError.__wrap(arg0);
1159
- return addHeapObject(ret);
1160
- };
1161
- imports.wbg.__wbg_process_5c1d670bc53614b8 = function(arg0) {
1162
- const ret = getObject(arg0).process;
1163
- return addHeapObject(ret);
1164
- };
1165
- imports.wbg.__wbg_push_737cfc8c1432c2c6 = function(arg0, arg1) {
1166
- const ret = getObject(arg0).push(getObject(arg1));
1167
- return ret;
1168
- };
1169
- imports.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5 = function(arg0) {
1170
- queueMicrotask(getObject(arg0));
1171
- };
1172
- imports.wbg.__wbg_queueMicrotask_d3219def82552485 = function(arg0) {
1173
- const ret = getObject(arg0).queueMicrotask;
1174
- return addHeapObject(ret);
1175
- };
1176
- imports.wbg.__wbg_randomFillSync_ab2cfe79ebbf2740 = function() { return handleError(function (arg0, arg1) {
1177
- getObject(arg0).randomFillSync(takeObject(arg1));
1178
- }, arguments) };
1179
- imports.wbg.__wbg_require_79b1e9274cde3c87 = function() { return handleError(function () {
1180
- const ret = module.require;
1181
- return addHeapObject(ret);
1182
- }, arguments) };
1183
- imports.wbg.__wbg_resolve_4851785c9c5f573d = function(arg0) {
1184
- const ret = Promise.resolve(getObject(arg0));
1185
- return addHeapObject(ret);
1186
- };
1187
- imports.wbg.__wbg_setTimeout_2e707715f8cc9497 = function(arg0, arg1) {
1188
- const ret = setTimeout(getObject(arg0), arg1);
1189
- return addHeapObject(ret);
1190
- };
1191
- imports.wbg.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
1192
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1193
- };
1194
- imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
1195
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1196
- };
1197
- imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
1198
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
1199
- };
1200
- imports.wbg.__wbg_set_8fc6bf8a5b1071d1 = function(arg0, arg1, arg2) {
1201
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
1202
- return addHeapObject(ret);
1203
- };
1204
- imports.wbg.__wbg_set_bb8cecf6a62b9f46 = function() { return handleError(function (arg0, arg1, arg2) {
1205
- const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
1206
- return ret;
1207
- }, arguments) };
1208
- imports.wbg.__wbg_setbody_5923b78a95eedf29 = function(arg0, arg1) {
1209
- getObject(arg0).body = getObject(arg1);
1210
- };
1211
- imports.wbg.__wbg_setcredentials_c3a22f1cd105a2c6 = function(arg0, arg1) {
1212
- getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
1213
- };
1214
- imports.wbg.__wbg_setheaders_834c0bdb6a8949ad = function(arg0, arg1) {
1215
- getObject(arg0).headers = getObject(arg1);
1216
- };
1217
- imports.wbg.__wbg_setmethod_3c5280fe5d890842 = function(arg0, arg1, arg2) {
1218
- getObject(arg0).method = getStringFromWasm0(arg1, arg2);
1219
- };
1220
- imports.wbg.__wbg_setmode_5dc300b865044b65 = function(arg0, arg1) {
1221
- getObject(arg0).mode = __wbindgen_enum_RequestMode[arg1];
1222
- };
1223
- imports.wbg.__wbg_setsignal_75b21ef3a81de905 = function(arg0, arg1) {
1224
- getObject(arg0).signal = getObject(arg1);
1225
- };
1226
- imports.wbg.__wbg_signal_aaf9ad74119f20a4 = function(arg0) {
1227
- const ret = getObject(arg0).signal;
1228
- return addHeapObject(ret);
1229
- };
1230
- imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
1231
- const ret = typeof global === 'undefined' ? null : global;
1232
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
1233
- };
1234
- imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
1235
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
1236
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
1237
- };
1238
- imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
1239
- const ret = typeof self === 'undefined' ? null : self;
1240
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
1241
- };
1242
- imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
1243
- const ret = typeof window === 'undefined' ? null : window;
1244
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
1245
- };
1246
- imports.wbg.__wbg_status_f6360336ca686bf0 = function(arg0) {
1247
- const ret = getObject(arg0).status;
1248
- return ret;
1249
- };
1250
- imports.wbg.__wbg_stringify_f7ed6987935b4a24 = function() { return handleError(function (arg0) {
1251
- const ret = JSON.stringify(getObject(arg0));
1252
- return addHeapObject(ret);
1253
- }, arguments) };
1254
- imports.wbg.__wbg_subarray_aa9065fa9dc5df96 = function(arg0, arg1, arg2) {
1255
- const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
1256
- return addHeapObject(ret);
1257
- };
1258
- imports.wbg.__wbg_text_7805bea50de2af49 = function() { return handleError(function (arg0) {
1259
- const ret = getObject(arg0).text();
1260
- return addHeapObject(ret);
1261
- }, arguments) };
1262
- imports.wbg.__wbg_then_44b73946d2fb3e7d = function(arg0, arg1) {
1263
- const ret = getObject(arg0).then(getObject(arg1));
1264
- return addHeapObject(ret);
1265
- };
1266
- imports.wbg.__wbg_then_48b406749878a531 = function(arg0, arg1, arg2) {
1267
- const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
1268
- return addHeapObject(ret);
1269
- };
1270
- imports.wbg.__wbg_trace_8fa9ac2274ea7420 = function(arg0) {
1271
- console.trace(...getObject(arg0));
1272
- };
1273
- imports.wbg.__wbg_url_ae10c34ca209681d = function(arg0, arg1) {
1274
- const ret = getObject(arg1).url;
1275
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1276
- const len1 = WASM_VECTOR_LEN;
1277
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1278
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1279
- };
1280
- imports.wbg.__wbg_value_cd1ffa7b1ab794f1 = function(arg0) {
1281
- const ret = getObject(arg0).value;
1282
- return addHeapObject(ret);
1283
- };
1284
- imports.wbg.__wbg_versions_c71aa1626a93e0a1 = function(arg0) {
1285
- const ret = getObject(arg0).versions;
1286
- return addHeapObject(ret);
1287
- };
1288
- imports.wbg.__wbg_warn_ba4bf5118b457d45 = function(arg0) {
1289
- console.warn(...getObject(arg0));
1290
- };
1291
- imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
1292
- const ret = arg0;
1293
- return addHeapObject(ret);
1294
- };
1295
- imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
1296
- const ret = BigInt.asUintN(64, arg0);
1297
- return addHeapObject(ret);
1298
- };
1299
- imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
1300
- const v = getObject(arg1);
1301
- const ret = typeof(v) === 'bigint' ? v : undefined;
1302
- getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
1303
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1304
- };
1305
- imports.wbg.__wbindgen_boolean_get = function(arg0) {
1306
- const v = getObject(arg0);
1307
- const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
1308
- return ret;
1309
- };
1310
- imports.wbg.__wbindgen_cb_drop = function(arg0) {
1311
- const obj = takeObject(arg0).original;
1312
- if (obj.cnt-- == 1) {
1313
- obj.a = 0;
1314
- return true;
1315
- }
1316
- const ret = false;
1317
- return ret;
1318
- };
1319
- imports.wbg.__wbindgen_closure_wrapper10812 = function(arg0, arg1, arg2) {
1320
- const ret = makeMutClosure(arg0, arg1, 1939, __wbg_adapter_48);
1321
- return addHeapObject(ret);
1322
- };
1323
- imports.wbg.__wbindgen_closure_wrapper11699 = function(arg0, arg1, arg2) {
1324
- const ret = makeMutClosure(arg0, arg1, 2139, __wbg_adapter_51);
1325
- return addHeapObject(ret);
1326
- };
1327
- imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
1328
- const ret = debugString(getObject(arg1));
1329
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1330
- const len1 = WASM_VECTOR_LEN;
1331
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1332
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1333
- };
1334
- imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
1335
- const ret = new Error(getStringFromWasm0(arg0, arg1));
1336
- return addHeapObject(ret);
1337
- };
1338
- imports.wbg.__wbindgen_in = function(arg0, arg1) {
1339
- const ret = getObject(arg0) in getObject(arg1);
1340
- return ret;
1341
- };
1342
- imports.wbg.__wbindgen_is_bigint = function(arg0) {
1343
- const ret = typeof(getObject(arg0)) === 'bigint';
1344
- return ret;
1345
- };
1346
- imports.wbg.__wbindgen_is_function = function(arg0) {
1347
- const ret = typeof(getObject(arg0)) === 'function';
1348
- return ret;
1349
- };
1350
- imports.wbg.__wbindgen_is_object = function(arg0) {
1351
- const val = getObject(arg0);
1352
- const ret = typeof(val) === 'object' && val !== null;
1353
- return ret;
1354
- };
1355
- imports.wbg.__wbindgen_is_string = function(arg0) {
1356
- const ret = typeof(getObject(arg0)) === 'string';
1357
- return ret;
1358
- };
1359
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
1360
- const ret = getObject(arg0) === undefined;
1361
- return ret;
1362
- };
1363
- imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
1364
- const ret = getObject(arg0) === getObject(arg1);
1365
- return ret;
1366
- };
1367
- imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
1368
- const ret = getObject(arg0) == getObject(arg1);
1369
- return ret;
1370
- };
1371
- imports.wbg.__wbindgen_memory = function() {
1372
- const ret = wasm.memory;
1373
- return addHeapObject(ret);
1374
- };
1375
- imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
1376
- const obj = getObject(arg1);
1377
- const ret = typeof(obj) === 'number' ? obj : undefined;
1378
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1379
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1380
- };
1381
- imports.wbg.__wbindgen_number_new = function(arg0) {
1382
- const ret = arg0;
1383
- return addHeapObject(ret);
1384
- };
1385
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
1386
- const ret = getObject(arg0);
1387
- return addHeapObject(ret);
1388
- };
1389
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
1390
- takeObject(arg0);
1391
- };
1392
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
1393
- const obj = getObject(arg1);
1394
- const ret = typeof(obj) === 'string' ? obj : undefined;
1395
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1396
- var len1 = WASM_VECTOR_LEN;
1397
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1398
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1399
- };
1400
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
1401
- const ret = getStringFromWasm0(arg0, arg1);
1402
- return addHeapObject(ret);
1403
- };
1404
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
1405
- throw new Error(getStringFromWasm0(arg0, arg1));
1406
- };
1407
-
1408
- return imports;
1409
- }
1410
-
1411
- function __wbg_init_memory(imports, memory) {
1412
-
1413
- }
1414
-
1415
- function __wbg_finalize_init(instance, module) {
1416
- wasm = instance.exports;
1417
- __wbg_init.__wbindgen_wasm_module = module;
1418
- cachedDataViewMemory0 = null;
1419
- cachedUint8ArrayMemory0 = null;
1420
-
1421
-
1422
-
1423
- return wasm;
2315
+ return false;
2316
+ }
1424
2317
  }
1425
2318
 
1426
2319
  function initSync(module) {
1427
2320
  if (wasm !== undefined) return wasm;
1428
2321
 
1429
2322
 
1430
- if (typeof module !== 'undefined') {
2323
+ if (module !== undefined) {
1431
2324
  if (Object.getPrototypeOf(module) === Object.prototype) {
1432
2325
  ({module} = module)
1433
2326
  } else {
@@ -1436,15 +2329,10 @@ function initSync(module) {
1436
2329
  }
1437
2330
 
1438
2331
  const imports = __wbg_get_imports();
1439
-
1440
- __wbg_init_memory(imports);
1441
-
1442
2332
  if (!(module instanceof WebAssembly.Module)) {
1443
2333
  module = new WebAssembly.Module(module);
1444
2334
  }
1445
-
1446
2335
  const instance = new WebAssembly.Instance(module, imports);
1447
-
1448
2336
  return __wbg_finalize_init(instance, module);
1449
2337
  }
1450
2338
 
@@ -1452,7 +2340,7 @@ async function __wbg_init(module_or_path) {
1452
2340
  if (wasm !== undefined) return wasm;
1453
2341
 
1454
2342
 
1455
- if (typeof module_or_path !== 'undefined') {
2343
+ if (module_or_path !== undefined) {
1456
2344
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1457
2345
  ({module_or_path} = module_or_path)
1458
2346
  } else {
@@ -1460,7 +2348,7 @@ async function __wbg_init(module_or_path) {
1460
2348
  }
1461
2349
  }
1462
2350
 
1463
- if (typeof module_or_path === 'undefined') {
2351
+ if (module_or_path === undefined) {
1464
2352
  module_or_path = new URL('cedarling_wasm_bg.wasm', import.meta.url);
1465
2353
  }
1466
2354
  const imports = __wbg_get_imports();
@@ -1469,12 +2357,9 @@ async function __wbg_init(module_or_path) {
1469
2357
  module_or_path = fetch(module_or_path);
1470
2358
  }
1471
2359
 
1472
- __wbg_init_memory(imports);
1473
-
1474
2360
  const { instance, module } = await __wbg_load(await module_or_path, imports);
1475
2361
 
1476
2362
  return __wbg_finalize_init(instance, module);
1477
2363
  }
1478
2364
 
1479
- export { initSync };
1480
- export default __wbg_init;
2365
+ export { initSync, __wbg_init as default };