@janssenproject/cedarling_wasm 0.0.467 → 0.0.468

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 DELETED
@@ -1,3238 +0,0 @@
1
- /* @ts-self-types="./cedarling_wasm.d.ts" */
2
-
3
- /**
4
- * A WASM wrapper for the Rust `cedarling::AuthorizeResult` struct.
5
- * Represents the result of an authorization request.
6
- */
7
- export class AuthorizeResult {
8
- static __wrap(ptr) {
9
- const obj = Object.create(AuthorizeResult.prototype);
10
- obj.__wbg_ptr = ptr;
11
- AuthorizeResultFinalization.register(obj, obj.__wbg_ptr, obj);
12
- return obj;
13
- }
14
- __destroy_into_raw() {
15
- const ptr = this.__wbg_ptr;
16
- this.__wbg_ptr = 0;
17
- AuthorizeResultFinalization.unregister(this);
18
- return ptr;
19
- }
20
- free() {
21
- const ptr = this.__destroy_into_raw();
22
- wasm.__wbg_authorizeresult_free(ptr, 0);
23
- }
24
- /**
25
- * Convert `AuthorizeResult` to json string value
26
- * @returns {string}
27
- */
28
- jsonString() {
29
- let deferred1_0;
30
- let deferred1_1;
31
- try {
32
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
33
- wasm.authorizeresult_jsonString(retptr, this.__wbg_ptr);
34
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
35
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
36
- deferred1_0 = r0;
37
- deferred1_1 = r1;
38
- return getStringFromWasm0(r0, r1);
39
- } finally {
40
- wasm.__wbindgen_add_to_stack_pointer(16);
41
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
42
- }
43
- }
44
- /**
45
- * Result of authorization
46
- * true means `ALLOW`
47
- * false means `Deny`
48
- *
49
- * this field is [`bool`] type to be compatible with [authzen Access Evaluation Decision](https://openid.github.io/authzen/#section-6.2.1).
50
- * @returns {boolean}
51
- */
52
- get decision() {
53
- const ret = wasm.__wbg_get_authorizeresult_decision(this.__wbg_ptr);
54
- return ret !== 0;
55
- }
56
- /**
57
- * Request ID of the authorization request
58
- * @returns {string}
59
- */
60
- get request_id() {
61
- let deferred1_0;
62
- let deferred1_1;
63
- try {
64
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
65
- wasm.__wbg_get_authorizeresult_request_id(retptr, this.__wbg_ptr);
66
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
67
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
68
- deferred1_0 = r0;
69
- deferred1_1 = r1;
70
- return getStringFromWasm0(r0, r1);
71
- } finally {
72
- wasm.__wbindgen_add_to_stack_pointer(16);
73
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
74
- }
75
- }
76
- /**
77
- * Cedar authorization response for the request.
78
- * @returns {AuthorizeResultResponse}
79
- */
80
- get response() {
81
- const ret = wasm.__wbg_get_authorizeresult_response(this.__wbg_ptr);
82
- return AuthorizeResultResponse.__wrap(ret);
83
- }
84
- /**
85
- * Result of authorization
86
- * true means `ALLOW`
87
- * false means `Deny`
88
- *
89
- * this field is [`bool`] type to be compatible with [authzen Access Evaluation Decision](https://openid.github.io/authzen/#section-6.2.1).
90
- * @param {boolean} arg0
91
- */
92
- set decision(arg0) {
93
- wasm.__wbg_set_authorizeresult_decision(this.__wbg_ptr, arg0);
94
- }
95
- /**
96
- * Request ID of the authorization request
97
- * @param {string} arg0
98
- */
99
- set request_id(arg0) {
100
- const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
101
- const len0 = WASM_VECTOR_LEN;
102
- wasm.__wbg_set_authorizeresult_request_id(this.__wbg_ptr, ptr0, len0);
103
- }
104
- /**
105
- * Cedar authorization response for the request.
106
- * @param {AuthorizeResultResponse} arg0
107
- */
108
- set response(arg0) {
109
- _assertClass(arg0, AuthorizeResultResponse);
110
- var ptr0 = arg0.__destroy_into_raw();
111
- wasm.__wbg_set_authorizeresult_response(this.__wbg_ptr, ptr0);
112
- }
113
- }
114
- if (Symbol.dispose) AuthorizeResult.prototype[Symbol.dispose] = AuthorizeResult.prototype.free;
115
-
116
- /**
117
- * A WASM wrapper for the Rust `cedar_policy::Response` struct.
118
- * Represents the result of an authorization request.
119
- */
120
- export class AuthorizeResultResponse {
121
- static __wrap(ptr) {
122
- const obj = Object.create(AuthorizeResultResponse.prototype);
123
- obj.__wbg_ptr = ptr;
124
- AuthorizeResultResponseFinalization.register(obj, obj.__wbg_ptr, obj);
125
- return obj;
126
- }
127
- __destroy_into_raw() {
128
- const ptr = this.__wbg_ptr;
129
- this.__wbg_ptr = 0;
130
- AuthorizeResultResponseFinalization.unregister(this);
131
- return ptr;
132
- }
133
- free() {
134
- const ptr = this.__destroy_into_raw();
135
- wasm.__wbg_authorizeresultresponse_free(ptr, 0);
136
- }
137
- /**
138
- * Authorization decision
139
- * @returns {boolean}
140
- */
141
- get decision() {
142
- const ret = wasm.authorizeresultresponse_decision(this.__wbg_ptr);
143
- return ret !== 0;
144
- }
145
- /**
146
- * Diagnostics providing more information on how this decision was reached
147
- * @returns {Diagnostics}
148
- */
149
- get diagnostics() {
150
- const ret = wasm.authorizeresultresponse_diagnostics(this.__wbg_ptr);
151
- return Diagnostics.__wrap(ret);
152
- }
153
- }
154
- if (Symbol.dispose) AuthorizeResultResponse.prototype[Symbol.dispose] = AuthorizeResultResponse.prototype.free;
155
-
156
- /**
157
- * WASM wrapper for
158
- * `cedarling::BatchAuthorizeResponse<Result<MultiIssuerAuthorizeResult, BatchItemError>>`.
159
- * Same shape as [`BatchAuthorizeUnsignedResponse`] with multi-issuer results.
160
- */
161
- export class BatchAuthorizeMultiIssuerResponse {
162
- static __wrap(ptr) {
163
- const obj = Object.create(BatchAuthorizeMultiIssuerResponse.prototype);
164
- obj.__wbg_ptr = ptr;
165
- BatchAuthorizeMultiIssuerResponseFinalization.register(obj, obj.__wbg_ptr, obj);
166
- return obj;
167
- }
168
- __destroy_into_raw() {
169
- const ptr = this.__wbg_ptr;
170
- this.__wbg_ptr = 0;
171
- BatchAuthorizeMultiIssuerResponseFinalization.unregister(this);
172
- return ptr;
173
- }
174
- free() {
175
- const ptr = this.__destroy_into_raw();
176
- wasm.__wbg_batchauthorizemultiissuerresponse_free(ptr, 0);
177
- }
178
- /**
179
- * Shared correlation id stamped on every per-item decision log entry.
180
- * @returns {string}
181
- */
182
- get batch_id() {
183
- let deferred1_0;
184
- let deferred1_1;
185
- try {
186
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
187
- wasm.batchauthorizemultiissuerresponse_batch_id(retptr, this.__wbg_ptr);
188
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
189
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
190
- deferred1_0 = r0;
191
- deferred1_1 = r1;
192
- return getStringFromWasm0(r0, r1);
193
- } finally {
194
- wasm.__wbindgen_add_to_stack_pointer(16);
195
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
196
- }
197
- }
198
- /**
199
- * Per-item results in input order — each slot is a
200
- * [`BatchItemMultiIssuerResult`].
201
- * @returns {BatchItemMultiIssuerResult[]}
202
- */
203
- get results() {
204
- try {
205
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
206
- wasm.batchauthorizemultiissuerresponse_results(retptr, this.__wbg_ptr);
207
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
208
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
209
- var v1 = getArrayJsValueFromWasm0(r0, r1);
210
- wasm.__wbindgen_export5(r0, r1 * 4, 4);
211
- return v1;
212
- } finally {
213
- wasm.__wbindgen_add_to_stack_pointer(16);
214
- }
215
- }
216
- }
217
- if (Symbol.dispose) BatchAuthorizeMultiIssuerResponse.prototype[Symbol.dispose] = BatchAuthorizeMultiIssuerResponse.prototype.free;
218
-
219
- /**
220
- * WASM wrapper for `cedarling::BatchAuthorizeResponse<Result<AuthorizeResult, BatchItemError>>`.
221
- *
222
- * Carries a shared `batch_id` (UUIDv7) alongside per-item results. Each result
223
- * is a [`BatchItemUnsignedResult`] — Cedar decision on `is_ok()`, per-item
224
- * build failure on `error`. `results[i]` corresponds to `items[i]`.
225
- */
226
- export class BatchAuthorizeUnsignedResponse {
227
- static __wrap(ptr) {
228
- const obj = Object.create(BatchAuthorizeUnsignedResponse.prototype);
229
- obj.__wbg_ptr = ptr;
230
- BatchAuthorizeUnsignedResponseFinalization.register(obj, obj.__wbg_ptr, obj);
231
- return obj;
232
- }
233
- __destroy_into_raw() {
234
- const ptr = this.__wbg_ptr;
235
- this.__wbg_ptr = 0;
236
- BatchAuthorizeUnsignedResponseFinalization.unregister(this);
237
- return ptr;
238
- }
239
- free() {
240
- const ptr = this.__destroy_into_raw();
241
- wasm.__wbg_batchauthorizeunsignedresponse_free(ptr, 0);
242
- }
243
- /**
244
- * Shared correlation id stamped on every per-item decision log entry.
245
- * @returns {string}
246
- */
247
- get batch_id() {
248
- let deferred1_0;
249
- let deferred1_1;
250
- try {
251
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
252
- wasm.batchauthorizeunsignedresponse_batch_id(retptr, this.__wbg_ptr);
253
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
254
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
255
- deferred1_0 = r0;
256
- deferred1_1 = r1;
257
- return getStringFromWasm0(r0, r1);
258
- } finally {
259
- wasm.__wbindgen_add_to_stack_pointer(16);
260
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
261
- }
262
- }
263
- /**
264
- * Per-item results in input order — each slot is a
265
- * [`BatchItemUnsignedResult`].
266
- * @returns {BatchItemUnsignedResult[]}
267
- */
268
- get results() {
269
- try {
270
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
271
- wasm.batchauthorizeunsignedresponse_results(retptr, this.__wbg_ptr);
272
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
273
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
274
- var v1 = getArrayJsValueFromWasm0(r0, r1);
275
- wasm.__wbindgen_export5(r0, r1 * 4, 4);
276
- return v1;
277
- } finally {
278
- wasm.__wbindgen_add_to_stack_pointer(16);
279
- }
280
- }
281
- }
282
- if (Symbol.dispose) BatchAuthorizeUnsignedResponse.prototype[Symbol.dispose] = BatchAuthorizeUnsignedResponse.prototype.free;
283
-
284
- /**
285
- * Per-item build failure surfaced inside a batch response at `results[i]`
286
- * when Cedar couldn't be reached for that item.
287
- */
288
- export class BatchItemError {
289
- static __wrap(ptr) {
290
- const obj = Object.create(BatchItemError.prototype);
291
- obj.__wbg_ptr = ptr;
292
- BatchItemErrorFinalization.register(obj, obj.__wbg_ptr, obj);
293
- return obj;
294
- }
295
- __destroy_into_raw() {
296
- const ptr = this.__wbg_ptr;
297
- this.__wbg_ptr = 0;
298
- BatchItemErrorFinalization.unregister(this);
299
- return ptr;
300
- }
301
- free() {
302
- const ptr = this.__destroy_into_raw();
303
- wasm.__wbg_batchitemerror_free(ptr, 0);
304
- }
305
- /**
306
- * Stable variant slug — `action_parse`, `resource_build`, `context_build`,
307
- * `principal_build`, `schema_validation`, `multi_issuer_entity`,
308
- * `request_validation`.
309
- * @returns {string}
310
- */
311
- get category() {
312
- let deferred1_0;
313
- let deferred1_1;
314
- try {
315
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
316
- wasm.batchitemerror_category(retptr, this.__wbg_ptr);
317
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
318
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
319
- deferred1_0 = r0;
320
- deferred1_1 = r1;
321
- return getStringFromWasm0(r0, r1);
322
- } finally {
323
- wasm.__wbindgen_add_to_stack_pointer(16);
324
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
325
- }
326
- }
327
- /**
328
- * Position of the failing item in the original `items` vector.
329
- * @returns {number}
330
- */
331
- get item_index() {
332
- const ret = wasm.batchitemerror_item_index(this.__wbg_ptr);
333
- return ret >>> 0;
334
- }
335
- /**
336
- * Human-readable diagnostic. Safe to log.
337
- * @returns {string}
338
- */
339
- get message() {
340
- let deferred1_0;
341
- let deferred1_1;
342
- try {
343
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
344
- wasm.batchitemerror_message(retptr, this.__wbg_ptr);
345
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
346
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
347
- deferred1_0 = r0;
348
- deferred1_1 = r1;
349
- return getStringFromWasm0(r0, r1);
350
- } finally {
351
- wasm.__wbindgen_add_to_stack_pointer(16);
352
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
353
- }
354
- }
355
- }
356
- if (Symbol.dispose) BatchItemError.prototype[Symbol.dispose] = BatchItemError.prototype.free;
357
-
358
- /**
359
- * Multi-issuer analog of [`BatchItemUnsignedResult`].
360
- */
361
- export class BatchItemMultiIssuerResult {
362
- static __wrap(ptr) {
363
- const obj = Object.create(BatchItemMultiIssuerResult.prototype);
364
- obj.__wbg_ptr = ptr;
365
- BatchItemMultiIssuerResultFinalization.register(obj, obj.__wbg_ptr, obj);
366
- return obj;
367
- }
368
- __destroy_into_raw() {
369
- const ptr = this.__wbg_ptr;
370
- this.__wbg_ptr = 0;
371
- BatchItemMultiIssuerResultFinalization.unregister(this);
372
- return ptr;
373
- }
374
- free() {
375
- const ptr = this.__destroy_into_raw();
376
- wasm.__wbg_batchitemmultiissuerresult_free(ptr, 0);
377
- }
378
- /**
379
- * The per-item error if `!is_ok()`; `undefined` otherwise.
380
- * @returns {BatchItemError | undefined}
381
- */
382
- get error() {
383
- const ret = wasm.batchitemmultiissuerresult_error(this.__wbg_ptr);
384
- return ret === 0 ? undefined : BatchItemError.__wrap(ret);
385
- }
386
- /**
387
- * `true` when Cedar evaluated this item.
388
- * @returns {boolean}
389
- */
390
- get is_ok() {
391
- const ret = wasm.batchitemmultiissuerresult_is_ok(this.__wbg_ptr);
392
- return ret !== 0;
393
- }
394
- /**
395
- * The multi-issuer decision if `is_ok()`; throws otherwise.
396
- * @returns {MultiIssuerAuthorizeResult}
397
- */
398
- unwrap() {
399
- try {
400
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
401
- wasm.batchitemmultiissuerresult_unwrap(retptr, this.__wbg_ptr);
402
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
403
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
404
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
405
- if (r2) {
406
- throw takeObject(r1);
407
- }
408
- return MultiIssuerAuthorizeResult.__wrap(r0);
409
- } finally {
410
- wasm.__wbindgen_add_to_stack_pointer(16);
411
- }
412
- }
413
- }
414
- if (Symbol.dispose) BatchItemMultiIssuerResult.prototype[Symbol.dispose] = BatchItemMultiIssuerResult.prototype.free;
415
-
416
- /**
417
- * One slot in a batch response's `results` array. Callers switch on
418
- * `is_ok()` — on `true`, read `unwrap()`; on `false`, read `error()`.
419
- */
420
- export class BatchItemUnsignedResult {
421
- static __wrap(ptr) {
422
- const obj = Object.create(BatchItemUnsignedResult.prototype);
423
- obj.__wbg_ptr = ptr;
424
- BatchItemUnsignedResultFinalization.register(obj, obj.__wbg_ptr, obj);
425
- return obj;
426
- }
427
- __destroy_into_raw() {
428
- const ptr = this.__wbg_ptr;
429
- this.__wbg_ptr = 0;
430
- BatchItemUnsignedResultFinalization.unregister(this);
431
- return ptr;
432
- }
433
- free() {
434
- const ptr = this.__destroy_into_raw();
435
- wasm.__wbg_batchitemunsignedresult_free(ptr, 0);
436
- }
437
- /**
438
- * The per-item error if `!is_ok()`; `undefined` otherwise.
439
- * @returns {BatchItemError | undefined}
440
- */
441
- get error() {
442
- const ret = wasm.batchitemunsignedresult_error(this.__wbg_ptr);
443
- return ret === 0 ? undefined : BatchItemError.__wrap(ret);
444
- }
445
- /**
446
- * `true` when Cedar evaluated this item (Allow or Deny); `false` when it
447
- * failed to build.
448
- * @returns {boolean}
449
- */
450
- get is_ok() {
451
- const ret = wasm.batchitemunsignedresult_is_ok(this.__wbg_ptr);
452
- return ret !== 0;
453
- }
454
- /**
455
- * The Cedar decision if `is_ok()`; throws otherwise.
456
- * @returns {AuthorizeResult}
457
- */
458
- unwrap() {
459
- try {
460
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
461
- wasm.batchitemunsignedresult_unwrap(retptr, this.__wbg_ptr);
462
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
463
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
464
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
465
- if (r2) {
466
- throw takeObject(r1);
467
- }
468
- return AuthorizeResult.__wrap(r0);
469
- } finally {
470
- wasm.__wbindgen_add_to_stack_pointer(16);
471
- }
472
- }
473
- }
474
- if (Symbol.dispose) BatchItemUnsignedResult.prototype[Symbol.dispose] = BatchItemUnsignedResult.prototype.free;
475
-
476
- /**
477
- * The instance of the Cedarling application.
478
- */
479
- export class Cedarling {
480
- static __wrap(ptr) {
481
- const obj = Object.create(Cedarling.prototype);
482
- obj.__wbg_ptr = ptr;
483
- CedarlingFinalization.register(obj, obj.__wbg_ptr, obj);
484
- return obj;
485
- }
486
- __destroy_into_raw() {
487
- const ptr = this.__wbg_ptr;
488
- this.__wbg_ptr = 0;
489
- CedarlingFinalization.unregister(this);
490
- return ptr;
491
- }
492
- free() {
493
- const ptr = this.__destroy_into_raw();
494
- wasm.__wbg_cedarling_free(ptr, 0);
495
- }
496
- /**
497
- * Collect every value of the annotation `key` across the given policies,
498
- * preserving duplicates. Unknown policy IDs are silently skipped.
499
- *
500
- * # Arguments
501
- *
502
- * * `policy_ids` - List of policy IDs to search. Typically
503
- * `result.response.diagnostics.reason` from an authorization result.
504
- * * `key` - The annotation key to collect values for (e.g. `"redirect"`).
505
- *
506
- * # Example
507
- *
508
- * ```javascript
509
- * const redirects = cedarling.annotationValues(
510
- * result.response.diagnostics.reason,
511
- * "redirect",
512
- * );
513
- * // ["/upgrade"]
514
- * ```
515
- * @param {string[]} policy_ids
516
- * @param {string} key
517
- * @returns {string[]}
518
- */
519
- annotationValues(policy_ids, key) {
520
- try {
521
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
522
- const ptr0 = passArrayJsValueToWasm0(policy_ids, wasm.__wbindgen_export);
523
- const len0 = WASM_VECTOR_LEN;
524
- const ptr1 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
525
- const len1 = WASM_VECTOR_LEN;
526
- wasm.cedarling_annotationValues(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
527
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
528
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
529
- var v3 = getArrayJsValueFromWasm0(r0, r1);
530
- wasm.__wbindgen_export5(r0, r1 * 4, 4);
531
- return v3;
532
- } finally {
533
- wasm.__wbindgen_add_to_stack_pointer(16);
534
- }
535
- }
536
- /**
537
- * Return the annotations of each given policy, grouped by policy ID. It is
538
- * the loss-free companion to `annotationsMap`. Unknown policy IDs are
539
- * silently skipped.
540
- *
541
- * # Arguments
542
- *
543
- * * `policy_ids` - List of policy IDs whose annotations should be returned
544
- * grouped by policy ID. Typically `result.response.diagnostics.reason` from
545
- * an authorization result.
546
- *
547
- * # Example
548
- *
549
- * ```javascript
550
- * const byPolicy = cedarling.annotationsByPolicy(result.response.diagnostics.reason);
551
- * // { "5": { redirect: "/upgrade", tier: "premium" } }
552
- * ```
553
- * @param {string[]} policy_ids
554
- * @returns {any}
555
- */
556
- annotationsByPolicy(policy_ids) {
557
- try {
558
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
559
- const ptr0 = passArrayJsValueToWasm0(policy_ids, wasm.__wbindgen_export);
560
- const len0 = WASM_VECTOR_LEN;
561
- wasm.cedarling_annotationsByPolicy(retptr, this.__wbg_ptr, ptr0, len0);
562
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
563
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
564
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
565
- if (r2) {
566
- throw takeObject(r1);
567
- }
568
- return takeObject(r0);
569
- } finally {
570
- wasm.__wbindgen_add_to_stack_pointer(16);
571
- }
572
- }
573
- /**
574
- * Merge the annotations (`@key("value")`) of the given policies into a single object.
575
- *
576
- * Intended for resolving the determining policies of an authorization decision:
577
- * pass `result.response.diagnostics.reason`.
578
- *
579
- * Lossy: if the same annotation key appears on several policies, one value wins
580
- * arbitrarily. Use `annotationValues` / `annotationsByPolicy` when duplicates
581
- * matter. Unknown policy IDs are silently skipped.
582
- *
583
- * # Arguments
584
- *
585
- * * `policy_ids` - List of policy IDs whose annotations should be merged into
586
- * a single object. Typically `result.response.diagnostics.reason` from an
587
- * authorization result.
588
- *
589
- * # Example
590
- *
591
- * ```javascript
592
- * const annotations = cedarling.annotationsMap(result.response.diagnostics.reason);
593
- * // { redirect: "/upgrade", tier: "premium" }
594
- * ```
595
- * @param {string[]} policy_ids
596
- * @returns {any}
597
- */
598
- annotationsMap(policy_ids) {
599
- try {
600
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
601
- const ptr0 = passArrayJsValueToWasm0(policy_ids, wasm.__wbindgen_export);
602
- const len0 = WASM_VECTOR_LEN;
603
- wasm.cedarling_annotationsMap(retptr, this.__wbg_ptr, ptr0, len0);
604
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
605
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
606
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
607
- if (r2) {
608
- throw takeObject(r1);
609
- }
610
- return takeObject(r0);
611
- } finally {
612
- wasm.__wbindgen_add_to_stack_pointer(16);
613
- }
614
- }
615
- /**
616
- * Authorize multi-issuer request.
617
- * Makes authorization decision based on multiple JWT tokens from different issuers.
618
- *
619
- * # Arguments
620
- *
621
- * * `request` - JSON string representation of [`AuthorizeMultiIssuerRequest`].
622
- *
623
- * # Example
624
- *
625
- * ```javascript
626
- * const result = await cedarling.authorizeMultiIssuer(JSON.stringify(request));
627
- * ```
628
- * @param {string} request
629
- * @returns {Promise<MultiIssuerAuthorizeResult>}
630
- */
631
- authorizeMultiIssuer(request) {
632
- const ptr0 = passStringToWasm0(request, wasm.__wbindgen_export, wasm.__wbindgen_export2);
633
- const len0 = WASM_VECTOR_LEN;
634
- const ret = wasm.cedarling_authorizeMultiIssuer(this.__wbg_ptr, ptr0, len0);
635
- return takeObject(ret);
636
- }
637
- /**
638
- * Authorize a batch of multi-issuer requests against one shared token set.
639
- *
640
- * Tokens are validated and token/issuer entities are built once, then
641
- * each item is evaluated in input order. Batch-level failures (validation,
642
- * JWT verification, status-list refresh) reject the whole call; per-item
643
- * failures are returned as `BatchItemError` results and exposed by WASM
644
- * with `is_ok=false` and `error`, while genuine Cedar denials remain
645
- * `AuthorizeResult` values with `decision=false`.
646
- *
647
- * # Arguments
648
- *
649
- * * `request` - JSON string representation of [`BatchAuthorizeMultiIssuerRequest`].
650
- *
651
- * # Example
652
- *
653
- * ```javascript
654
- * const result = await cedarling.authorizeMultiIssuerBatch(JSON.stringify(batchRequest));
655
- * ```
656
- * @param {string} request
657
- * @returns {Promise<BatchAuthorizeMultiIssuerResponse>}
658
- */
659
- authorizeMultiIssuerBatch(request) {
660
- const ptr0 = passStringToWasm0(request, wasm.__wbindgen_export, wasm.__wbindgen_export2);
661
- const len0 = WASM_VECTOR_LEN;
662
- const ret = wasm.cedarling_authorizeMultiIssuerBatch(this.__wbg_ptr, ptr0, len0);
663
- return takeObject(ret);
664
- }
665
- /**
666
- * Authorize an unsigned request carrying an optional single principal.
667
- * Makes an authorization decision based on the [`RequestUnsigned`].
668
- *
669
- * When `principal` is omitted / `null` on the JS side the core uses Cedar
670
- * partial evaluation; residual-dependent requests fail closed with
671
- * `Decision::Deny` and surface residual policy ids in
672
- * `response.diagnostics.reason`.
673
- *
674
- * # Arguments
675
- *
676
- * * `request` - JSON string representation of [`RequestUnsigned`].
677
- *
678
- * # Example
679
- *
680
- * ```javascript
681
- * const result = await cedarling.authorizeUnsigned(JSON.stringify(request));
682
- * ```
683
- * @param {string} request
684
- * @returns {Promise<AuthorizeResult>}
685
- */
686
- authorizeUnsigned(request) {
687
- const ptr0 = passStringToWasm0(request, wasm.__wbindgen_export, wasm.__wbindgen_export2);
688
- const len0 = WASM_VECTOR_LEN;
689
- const ret = wasm.cedarling_authorizeUnsigned(this.__wbg_ptr, ptr0, len0);
690
- return takeObject(ret);
691
- }
692
- /**
693
- * Authorize a batch of unsigned requests against one shared principal.
694
- *
695
- * Setup work (principal build + pushed-data snapshot) runs once and each
696
- * item is evaluated in input order. Results are returned inside a
697
- * [`BatchAuthorizeUnsignedResponse`] carrying the shared `batch_id`.
698
- * Batch-level failures (validation, principal parse) reject the whole
699
- * call; per-item failures are returned as `BatchItemError` results and
700
- * exposed by WASM with `is_ok=false` and `error`, while genuine Cedar
701
- * denials remain `AuthorizeResult` values with `decision=false`.
702
- * # Arguments
703
- *
704
- * * `request` - JSON string representation of [`BatchAuthorizeUnsignedRequest`].
705
- *
706
- * # Example
707
- *
708
- * ```javascript
709
- * const result = await cedarling.authorizeUnsignedBatch(JSON.stringify(batchRequest));
710
- * ```
711
- * @param {string} request
712
- * @returns {Promise<BatchAuthorizeUnsignedResponse>}
713
- */
714
- authorizeUnsignedBatch(request) {
715
- const ptr0 = passStringToWasm0(request, wasm.__wbindgen_export, wasm.__wbindgen_export2);
716
- const len0 = WASM_VECTOR_LEN;
717
- const ret = wasm.cedarling_authorizeUnsignedBatch(this.__wbg_ptr, ptr0, len0);
718
- return takeObject(ret);
719
- }
720
- /**
721
- * Clear all entries from the data store.
722
- *
723
- * # Arguments
724
- *
725
- * None.
726
- *
727
- * # Example
728
- *
729
- * ```javascript
730
- * cedarling.clearDataCtx();
731
- * console.log("All data entries cleared");
732
- * ```
733
- */
734
- clearDataCtx() {
735
- try {
736
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
737
- wasm.cedarling_clearDataCtx(retptr, this.__wbg_ptr);
738
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
739
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
740
- if (r1) {
741
- throw takeObject(r0);
742
- }
743
- } finally {
744
- wasm.__wbindgen_add_to_stack_pointer(16);
745
- }
746
- }
747
- /**
748
- * Get trusted issuer identifiers that failed to load.
749
- *
750
- * # Arguments
751
- *
752
- * None.
753
- *
754
- * # Example
755
- *
756
- * ```javascript
757
- * const ids = cedarling.failedTrustedIssuerIds();
758
- * ```
759
- * @returns {Array<any>}
760
- */
761
- failedTrustedIssuerIds() {
762
- const ret = wasm.cedarling_failedTrustedIssuerIds(this.__wbg_ptr);
763
- return takeObject(ret);
764
- }
765
- /**
766
- * Get a value from the data store by key.
767
- * Returns null if the key doesn't exist or the entry has expired.
768
- *
769
- * # Arguments
770
- *
771
- * * `key` - A string key for the data entry to retrieve
772
- *
773
- * # Example
774
- *
775
- * ```javascript
776
- * const value = cedarling.getDataCtx("user:123");
777
- * if (value !== null) {
778
- * console.log(value.name); // "John"
779
- * }
780
- * ```
781
- * @param {string} key
782
- * @returns {any}
783
- */
784
- getDataCtx(key) {
785
- try {
786
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
787
- const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
788
- const len0 = WASM_VECTOR_LEN;
789
- wasm.cedarling_getDataCtx(retptr, this.__wbg_ptr, ptr0, len0);
790
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
791
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
792
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
793
- if (r2) {
794
- throw takeObject(r1);
795
- }
796
- return takeObject(r0);
797
- } finally {
798
- wasm.__wbindgen_add_to_stack_pointer(16);
799
- }
800
- }
801
- /**
802
- * Get a data entry with full metadata by key.
803
- * Returns undefined if the key doesn't exist or the entry has expired.
804
- *
805
- * # Arguments
806
- *
807
- * * `key` - A string key for the data entry to retrieve
808
- *
809
- * # Example
810
- *
811
- * ```javascript
812
- * const entry = cedarling.getDataEntryCtx("user:123");
813
- * if (entry !== undefined) {
814
- * console.log(entry.key); // "user:123"
815
- * console.log(entry.value()); // { name: "John", age: 30 }
816
- * console.log(entry.data_type); // "Record"
817
- * console.log(entry.created_at); // "2024-01-01T12:00:00Z"
818
- * console.log(entry.access_count); // 5
819
- * }
820
- * ```
821
- * @param {string} key
822
- * @returns {DataEntry | undefined}
823
- */
824
- getDataEntryCtx(key) {
825
- try {
826
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
827
- const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
828
- const len0 = WASM_VECTOR_LEN;
829
- wasm.cedarling_getDataEntryCtx(retptr, this.__wbg_ptr, ptr0, len0);
830
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
831
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
832
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
833
- if (r2) {
834
- throw takeObject(r1);
835
- }
836
- return r0 === 0 ? undefined : DataEntry.__wrap(r0);
837
- } finally {
838
- wasm.__wbindgen_add_to_stack_pointer(16);
839
- }
840
- }
841
- /**
842
- * Returns one retained memory log by ID, or `null` when it is not retained.
843
- *
844
- * # Arguments
845
- *
846
- * * `id` - The retained log identifier.
847
- *
848
- * # Example
849
- *
850
- * ```javascript
851
- * const log = cedarling.getLogById("request-id");
852
- * ```
853
- * @param {string} id
854
- * @returns {any}
855
- */
856
- getLogById(id) {
857
- try {
858
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
859
- const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
860
- const len0 = WASM_VECTOR_LEN;
861
- wasm.cedarling_getLogById(retptr, this.__wbg_ptr, ptr0, len0);
862
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
863
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
864
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
865
- if (r2) {
866
- throw takeObject(r1);
867
- }
868
- return takeObject(r0);
869
- } finally {
870
- wasm.__wbindgen_add_to_stack_pointer(16);
871
- }
872
- }
873
- /**
874
- * Returns identifiers for all retained memory logs.
875
- *
876
- * # Arguments
877
- *
878
- * None.
879
- *
880
- * # Example
881
- *
882
- * ```javascript
883
- * const ids = cedarling.getLogIds();
884
- * ```
885
- * @returns {Array<any>}
886
- */
887
- getLogIds() {
888
- const ret = wasm.cedarling_getLogIds(this.__wbg_ptr);
889
- return takeObject(ret);
890
- }
891
- /**
892
- * Returns retained memory logs for one request ID.
893
- *
894
- * # Arguments
895
- *
896
- * * `requestId` - The request identifier to match.
897
- *
898
- * # Example
899
- *
900
- * ```javascript
901
- * const logs = cedarling.getLogsByRequestId("request-id");
902
- * ```
903
- * @param {string} request_id
904
- * @returns {any[]}
905
- */
906
- getLogsByRequestId(request_id) {
907
- try {
908
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
909
- const ptr0 = passStringToWasm0(request_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
910
- const len0 = WASM_VECTOR_LEN;
911
- wasm.cedarling_getLogsByRequestId(retptr, this.__wbg_ptr, ptr0, len0);
912
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
913
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
914
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
915
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
916
- if (r3) {
917
- throw takeObject(r2);
918
- }
919
- var v2 = getArrayJsValueFromWasm0(r0, r1);
920
- wasm.__wbindgen_export5(r0, r1 * 4, 4);
921
- return v2;
922
- } finally {
923
- wasm.__wbindgen_add_to_stack_pointer(16);
924
- }
925
- }
926
- /**
927
- * Returns retained memory logs matching one request ID and indexed value.
928
- *
929
- * # Arguments
930
- *
931
- * * `requestId` - The request identifier to match.
932
- * * `tag` - A log kind (`"System"`, `"Decision"`, or `"Metric"`) or a
933
- * system-log level such as `"DEBUG"`.
934
- *
935
- * # Example
936
- *
937
- * ```javascript
938
- * const logs = cedarling.getLogsByRequestIdAndTag("request-id", "System");
939
- * ```
940
- * @param {string} request_id
941
- * @param {string} tag
942
- * @returns {any[]}
943
- */
944
- getLogsByRequestIdAndTag(request_id, tag) {
945
- try {
946
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
947
- const ptr0 = passStringToWasm0(request_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
948
- const len0 = WASM_VECTOR_LEN;
949
- const ptr1 = passStringToWasm0(tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
950
- const len1 = WASM_VECTOR_LEN;
951
- wasm.cedarling_getLogsByRequestIdAndTag(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
952
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
953
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
954
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
955
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
956
- if (r3) {
957
- throw takeObject(r2);
958
- }
959
- var v3 = getArrayJsValueFromWasm0(r0, r1);
960
- wasm.__wbindgen_export5(r0, r1 * 4, 4);
961
- return v3;
962
- } finally {
963
- wasm.__wbindgen_add_to_stack_pointer(16);
964
- }
965
- }
966
- /**
967
- * Returns retained memory logs matching an indexed value.
968
- *
969
- * # Arguments
970
- *
971
- * * `tag` - A log kind (`"System"`, `"Decision"`, or `"Metric"`) or a
972
- * system-log level such as `"DEBUG"`.
973
- *
974
- * # Example
975
- *
976
- * ```javascript
977
- * const logs = cedarling.getLogsByTag("System");
978
- * ```
979
- * @param {string} tag
980
- * @returns {any[]}
981
- */
982
- getLogsByTag(tag) {
983
- try {
984
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
985
- const ptr0 = passStringToWasm0(tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
986
- const len0 = WASM_VECTOR_LEN;
987
- wasm.cedarling_getLogsByTag(retptr, this.__wbg_ptr, ptr0, len0);
988
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
989
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
990
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
991
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
992
- if (r3) {
993
- throw takeObject(r2);
994
- }
995
- var v2 = getArrayJsValueFromWasm0(r0, r1);
996
- wasm.__wbindgen_export5(r0, r1 * 4, 4);
997
- return v2;
998
- } finally {
999
- wasm.__wbindgen_add_to_stack_pointer(16);
1000
- }
1001
- }
1002
- /**
1003
- * Get statistics about the data store.
1004
- *
1005
- * # Arguments
1006
- *
1007
- * None.
1008
- *
1009
- * # Example
1010
- *
1011
- * ```javascript
1012
- * const stats = cedarling.getStatsCtx();
1013
- * console.log(`Entries: ${stats.entry_count}/${stats.max_entries || 'unlimited'}`);
1014
- * console.log(`Capacity: ${stats.capacity_usage_percent.toFixed(2)}%`);
1015
- * console.log(`Total size: ${stats.total_size_bytes} bytes`);
1016
- * ```
1017
- * @returns {DataStoreStats}
1018
- */
1019
- getStatsCtx() {
1020
- try {
1021
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1022
- wasm.cedarling_getStatsCtx(retptr, this.__wbg_ptr);
1023
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1024
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1025
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1026
- if (r2) {
1027
- throw takeObject(r1);
1028
- }
1029
- return DataStoreStats.__wrap(r0);
1030
- } finally {
1031
- wasm.__wbindgen_add_to_stack_pointer(16);
1032
- }
1033
- }
1034
- /**
1035
- * Check whether a trusted issuer was loaded by `iss` claim.
1036
- *
1037
- * # Arguments
1038
- *
1039
- * * `iss_claim` - Issuer `iss` claim value to check.
1040
- *
1041
- * # Example
1042
- *
1043
- * ```javascript
1044
- * const ok = cedarling.isTrustedIssuerLoadedByIss("https://issuer.example.org");
1045
- * ```
1046
- * @param {string} iss_claim
1047
- * @returns {boolean}
1048
- */
1049
- isTrustedIssuerLoadedByIss(iss_claim) {
1050
- const ptr0 = passStringToWasm0(iss_claim, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1051
- const len0 = WASM_VECTOR_LEN;
1052
- const ret = wasm.cedarling_isTrustedIssuerLoadedByIss(this.__wbg_ptr, ptr0, len0);
1053
- return ret !== 0;
1054
- }
1055
- /**
1056
- * Check whether a trusted issuer was loaded by issuer identifier.
1057
- *
1058
- * # Arguments
1059
- *
1060
- * * `issuer_id` - Trusted issuer identifier to check.
1061
- *
1062
- * # Example
1063
- *
1064
- * ```javascript
1065
- * const ok = cedarling.isTrustedIssuerLoadedByName("issuer_id");
1066
- * ```
1067
- * @param {string} issuer_id
1068
- * @returns {boolean}
1069
- */
1070
- isTrustedIssuerLoadedByName(issuer_id) {
1071
- const ptr0 = passStringToWasm0(issuer_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1072
- const len0 = WASM_VECTOR_LEN;
1073
- const ret = wasm.cedarling_isTrustedIssuerLoadedByName(this.__wbg_ptr, ptr0, len0);
1074
- return ret !== 0;
1075
- }
1076
- /**
1077
- * List all entries with their metadata.
1078
- * Returns an array of DataEntry objects.
1079
- *
1080
- * # Arguments
1081
- *
1082
- * None.
1083
- *
1084
- * # Example
1085
- *
1086
- * ```javascript
1087
- * const entries = cedarling.listDataCtx();
1088
- * entries.forEach(entry => {
1089
- * console.log(`${entry.key}: ${entry.data_type} (accessed ${entry.access_count} times)`);
1090
- * });
1091
- * ```
1092
- * @returns {Array<any>}
1093
- */
1094
- listDataCtx() {
1095
- try {
1096
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1097
- wasm.cedarling_listDataCtx(retptr, this.__wbg_ptr);
1098
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1099
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1100
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1101
- if (r2) {
1102
- throw takeObject(r1);
1103
- }
1104
- return takeObject(r0);
1105
- } finally {
1106
- wasm.__wbindgen_add_to_stack_pointer(16);
1107
- }
1108
- }
1109
- /**
1110
- * Get trusted issuer identifiers loaded successfully.
1111
- *
1112
- * # Arguments
1113
- *
1114
- * None.
1115
- *
1116
- * # Example
1117
- *
1118
- * ```javascript
1119
- * const ids = cedarling.loadedTrustedIssuerIds();
1120
- * ```
1121
- * @returns {Array<any>}
1122
- */
1123
- loadedTrustedIssuerIds() {
1124
- const ret = wasm.cedarling_loadedTrustedIssuerIds(this.__wbg_ptr);
1125
- return takeObject(ret);
1126
- }
1127
- /**
1128
- * Get the number of trusted issuers loaded successfully.
1129
- *
1130
- * # Arguments
1131
- *
1132
- * None.
1133
- *
1134
- * # Example
1135
- *
1136
- * ```javascript
1137
- * const loadedCount = cedarling.loadedTrustedIssuersCount();
1138
- * ```
1139
- * @returns {number}
1140
- */
1141
- loadedTrustedIssuersCount() {
1142
- const ret = wasm.cedarling_loadedTrustedIssuersCount(this.__wbg_ptr);
1143
- return ret >>> 0;
1144
- }
1145
- /**
1146
- * Creates a Cedarling application from bootstrap properties.
1147
- *
1148
- * # Arguments
1149
- *
1150
- * * `config` - A plain object of Cedarling bootstrap-property names and values.
1151
- *
1152
- * # Example
1153
- *
1154
- * ```javascript
1155
- * await initWasm();
1156
- * const cedarling = await Cedarling.new({
1157
- * CEDARLING_APPLICATION_NAME: "task-api",
1158
- * CEDARLING_POLICY_STORE_URI: "https://example.com/policy-store.cjar",
1159
- * CEDARLING_LOG_TYPE: "memory",
1160
- * CEDARLING_LOG_TTL: 120,
1161
- * });
1162
- * ```
1163
- * @param {object} config
1164
- * @returns {Promise<Cedarling>}
1165
- */
1166
- static new(config) {
1167
- const ret = wasm.cedarling_new(addHeapObject(config));
1168
- return takeObject(ret);
1169
- }
1170
- /**
1171
- * Creates a new Cedarling application from a JavaScript `Map`.
1172
- *
1173
- * # Arguments
1174
- *
1175
- * * `config` - A `Map` of Cedarling bootstrap-property names and values.
1176
- *
1177
- * # Example
1178
- *
1179
- * ```javascript
1180
- * await initWasm();
1181
- * const cedarling = await Cedarling.newFromMap(new Map([
1182
- * ["CEDARLING_APPLICATION_NAME", "task-api"],
1183
- * ["CEDARLING_POLICY_STORE_URI", "https://example.com/policy-store.cjar"],
1184
- * ["CEDARLING_LOG_TYPE", "memory"],
1185
- * ["CEDARLING_LOG_TTL", 120],
1186
- * ]));
1187
- * ```
1188
- * @param {Map<any, any>} config
1189
- * @returns {Promise<Cedarling>}
1190
- */
1191
- static newFromMap(config) {
1192
- const ret = wasm.cedarling_newFromMap(addHeapObject(config));
1193
- return takeObject(ret);
1194
- }
1195
- /**
1196
- * Returns all retained memory logs and removes them from storage.
1197
- * Other log configurations return an empty array.
1198
- *
1199
- * # Arguments
1200
- *
1201
- * None.
1202
- *
1203
- * # Example
1204
- *
1205
- * ```javascript
1206
- * const logs = cedarling.popLogs();
1207
- * ```
1208
- * @returns {Array<any>}
1209
- */
1210
- popLogs() {
1211
- try {
1212
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1213
- wasm.cedarling_popLogs(retptr, this.__wbg_ptr);
1214
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1215
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1216
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1217
- if (r2) {
1218
- throw takeObject(r1);
1219
- }
1220
- return takeObject(r0);
1221
- } finally {
1222
- wasm.__wbindgen_add_to_stack_pointer(16);
1223
- }
1224
- }
1225
- /**
1226
- * Push a value into the data store with an optional TTL.
1227
- * If the key already exists, the value will be replaced.
1228
- * If TTL is not provided, the default TTL from configuration is used.
1229
- *
1230
- * # Arguments
1231
- *
1232
- * * `key` - A string key for the data entry (must not be empty)
1233
- * * `value` - The value to store (any JSON-serializable JavaScript value: object, array, string, number, boolean)
1234
- * * `ttl_secs` - Optional TTL in seconds (undefined/null uses default from config)
1235
- *
1236
- * # Example
1237
- *
1238
- * ```javascript
1239
- * cedarling.pushDataCtx("user:123", { name: "John", age: 30 }, 3600);
1240
- * cedarling.pushDataCtx("config", { setting: "value" }); // Uses default TTL
1241
- * ```
1242
- * @param {string} key
1243
- * @param {any} value
1244
- * @param {bigint | null} [ttl_secs]
1245
- */
1246
- pushDataCtx(key, value, ttl_secs) {
1247
- try {
1248
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1249
- const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1250
- const len0 = WASM_VECTOR_LEN;
1251
- wasm.cedarling_pushDataCtx(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(value), !isLikeNone(ttl_secs), isLikeNone(ttl_secs) ? BigInt(0) : ttl_secs);
1252
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1253
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1254
- if (r1) {
1255
- throw takeObject(r0);
1256
- }
1257
- } finally {
1258
- wasm.__wbindgen_add_to_stack_pointer(16);
1259
- }
1260
- }
1261
- /**
1262
- * Remove a value from the data store by key.
1263
- * Returns true if the key existed and was removed, false otherwise.
1264
- *
1265
- * # Arguments
1266
- *
1267
- * * `key` - A string key for the data entry to remove
1268
- *
1269
- * # Example
1270
- *
1271
- * ```javascript
1272
- * const removed = cedarling.removeDataCtx("user:123");
1273
- * if (removed) {
1274
- * console.log("Entry was successfully removed");
1275
- * }
1276
- * ```
1277
- * @param {string} key
1278
- * @returns {boolean}
1279
- */
1280
- removeDataCtx(key) {
1281
- try {
1282
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1283
- const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1284
- const len0 = WASM_VECTOR_LEN;
1285
- wasm.cedarling_removeDataCtx(retptr, this.__wbg_ptr, ptr0, len0);
1286
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1287
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1288
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1289
- if (r2) {
1290
- throw takeObject(r1);
1291
- }
1292
- return r0 !== 0;
1293
- } finally {
1294
- wasm.__wbindgen_add_to_stack_pointer(16);
1295
- }
1296
- }
1297
- /**
1298
- * Closes Lock Server connections and pushes all available logs.
1299
- *
1300
- * # Arguments
1301
- *
1302
- * None.
1303
- *
1304
- * # Example
1305
- *
1306
- * ```javascript
1307
- * await cedarling.shutDown();
1308
- * ```
1309
- * @returns {Promise<void>}
1310
- */
1311
- shutDown() {
1312
- const ret = wasm.cedarling_shutDown(this.__wbg_ptr);
1313
- return takeObject(ret);
1314
- }
1315
- /**
1316
- * Get the total number of trusted issuer entries discovered.
1317
- *
1318
- * # Arguments
1319
- *
1320
- * None.
1321
- *
1322
- * # Example
1323
- *
1324
- * ```javascript
1325
- * const total = cedarling.totalIssuers();
1326
- * ```
1327
- * @returns {number}
1328
- */
1329
- totalIssuers() {
1330
- const ret = wasm.cedarling_totalIssuers(this.__wbg_ptr);
1331
- return ret >>> 0;
1332
- }
1333
- }
1334
- if (Symbol.dispose) Cedarling.prototype[Symbol.dispose] = Cedarling.prototype.free;
1335
-
1336
- /**
1337
- * A WASM wrapper for the Rust `cedarling::DataEntry` struct.
1338
- * Represents a data entry in the DataStore with value and metadata.
1339
- */
1340
- export class DataEntry {
1341
- static __wrap(ptr) {
1342
- const obj = Object.create(DataEntry.prototype);
1343
- obj.__wbg_ptr = ptr;
1344
- DataEntryFinalization.register(obj, obj.__wbg_ptr, obj);
1345
- return obj;
1346
- }
1347
- __destroy_into_raw() {
1348
- const ptr = this.__wbg_ptr;
1349
- this.__wbg_ptr = 0;
1350
- DataEntryFinalization.unregister(this);
1351
- return ptr;
1352
- }
1353
- free() {
1354
- const ptr = this.__destroy_into_raw();
1355
- wasm.__wbg_dataentry_free(ptr, 0);
1356
- }
1357
- /**
1358
- * Convert `DataEntry` to json string value
1359
- * @returns {string}
1360
- */
1361
- jsonString() {
1362
- let deferred1_0;
1363
- let deferred1_1;
1364
- try {
1365
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1366
- wasm.dataentry_jsonString(retptr, this.__wbg_ptr);
1367
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1368
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1369
- deferred1_0 = r0;
1370
- deferred1_1 = r1;
1371
- return getStringFromWasm0(r0, r1);
1372
- } finally {
1373
- wasm.__wbindgen_add_to_stack_pointer(16);
1374
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
1375
- }
1376
- }
1377
- /**
1378
- * Get the value stored in this entry as a JavaScript object
1379
- * @returns {any}
1380
- */
1381
- value() {
1382
- try {
1383
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1384
- wasm.dataentry_value(retptr, this.__wbg_ptr);
1385
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1386
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1387
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1388
- if (r2) {
1389
- throw takeObject(r1);
1390
- }
1391
- return takeObject(r0);
1392
- } finally {
1393
- wasm.__wbindgen_add_to_stack_pointer(16);
1394
- }
1395
- }
1396
- /**
1397
- * Number of times this entry has been accessed
1398
- * @returns {bigint}
1399
- */
1400
- get access_count() {
1401
- const ret = wasm.__wbg_get_dataentry_access_count(this.__wbg_ptr);
1402
- return BigInt.asUintN(64, ret);
1403
- }
1404
- /**
1405
- * Timestamp when this entry was created (RFC 3339 format)
1406
- * @returns {string}
1407
- */
1408
- get created_at() {
1409
- let deferred1_0;
1410
- let deferred1_1;
1411
- try {
1412
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1413
- wasm.__wbg_get_dataentry_created_at(retptr, this.__wbg_ptr);
1414
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1415
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1416
- deferred1_0 = r0;
1417
- deferred1_1 = r1;
1418
- return getStringFromWasm0(r0, r1);
1419
- } finally {
1420
- wasm.__wbindgen_add_to_stack_pointer(16);
1421
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
1422
- }
1423
- }
1424
- /**
1425
- * The inferred Cedar type of the value
1426
- * @returns {string}
1427
- */
1428
- get data_type() {
1429
- let deferred1_0;
1430
- let deferred1_1;
1431
- try {
1432
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1433
- wasm.__wbg_get_dataentry_data_type(retptr, this.__wbg_ptr);
1434
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1435
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1436
- deferred1_0 = r0;
1437
- deferred1_1 = r1;
1438
- return getStringFromWasm0(r0, r1);
1439
- } finally {
1440
- wasm.__wbindgen_add_to_stack_pointer(16);
1441
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
1442
- }
1443
- }
1444
- /**
1445
- * Timestamp when this entry expires (RFC 3339 format). The getter returns undefined if no TTL.
1446
- * @returns {string | undefined}
1447
- */
1448
- get expires_at() {
1449
- try {
1450
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1451
- wasm.__wbg_get_dataentry_expires_at(retptr, this.__wbg_ptr);
1452
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1453
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1454
- let v1;
1455
- if (r0 !== 0) {
1456
- v1 = getStringFromWasm0(r0, r1);
1457
- wasm.__wbindgen_export5(r0, r1 * 1, 1);
1458
- }
1459
- return v1;
1460
- } finally {
1461
- wasm.__wbindgen_add_to_stack_pointer(16);
1462
- }
1463
- }
1464
- /**
1465
- * The key for this entry
1466
- * @returns {string}
1467
- */
1468
- get key() {
1469
- let deferred1_0;
1470
- let deferred1_1;
1471
- try {
1472
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1473
- wasm.__wbg_get_dataentry_key(retptr, this.__wbg_ptr);
1474
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1475
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1476
- deferred1_0 = r0;
1477
- deferred1_1 = r1;
1478
- return getStringFromWasm0(r0, r1);
1479
- } finally {
1480
- wasm.__wbindgen_add_to_stack_pointer(16);
1481
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
1482
- }
1483
- }
1484
- /**
1485
- * Number of times this entry has been accessed
1486
- * @param {bigint} arg0
1487
- */
1488
- set access_count(arg0) {
1489
- wasm.__wbg_set_dataentry_access_count(this.__wbg_ptr, arg0);
1490
- }
1491
- /**
1492
- * Timestamp when this entry was created (RFC 3339 format)
1493
- * @param {string} arg0
1494
- */
1495
- set created_at(arg0) {
1496
- const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1497
- const len0 = WASM_VECTOR_LEN;
1498
- wasm.__wbg_set_dataentry_created_at(this.__wbg_ptr, ptr0, len0);
1499
- }
1500
- /**
1501
- * The inferred Cedar type of the value
1502
- * @param {string} arg0
1503
- */
1504
- set data_type(arg0) {
1505
- const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1506
- const len0 = WASM_VECTOR_LEN;
1507
- wasm.__wbg_set_dataentry_data_type(this.__wbg_ptr, ptr0, len0);
1508
- }
1509
- /**
1510
- * Timestamp when this entry expires (RFC 3339 format). The getter returns undefined if no TTL.
1511
- * @param {string | null} [arg0]
1512
- */
1513
- set expires_at(arg0) {
1514
- var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1515
- var len0 = WASM_VECTOR_LEN;
1516
- wasm.__wbg_set_dataentry_expires_at(this.__wbg_ptr, ptr0, len0);
1517
- }
1518
- /**
1519
- * The key for this entry
1520
- * @param {string} arg0
1521
- */
1522
- set key(arg0) {
1523
- const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1524
- const len0 = WASM_VECTOR_LEN;
1525
- wasm.__wbg_set_dataentry_key(this.__wbg_ptr, ptr0, len0);
1526
- }
1527
- }
1528
- if (Symbol.dispose) DataEntry.prototype[Symbol.dispose] = DataEntry.prototype.free;
1529
-
1530
- /**
1531
- * A WASM wrapper for the Rust `cedarling::DataStoreStats` struct.
1532
- * Statistics about the DataStore.
1533
- */
1534
- export class DataStoreStats {
1535
- static __wrap(ptr) {
1536
- const obj = Object.create(DataStoreStats.prototype);
1537
- obj.__wbg_ptr = ptr;
1538
- DataStoreStatsFinalization.register(obj, obj.__wbg_ptr, obj);
1539
- return obj;
1540
- }
1541
- __destroy_into_raw() {
1542
- const ptr = this.__wbg_ptr;
1543
- this.__wbg_ptr = 0;
1544
- DataStoreStatsFinalization.unregister(this);
1545
- return ptr;
1546
- }
1547
- free() {
1548
- const ptr = this.__destroy_into_raw();
1549
- wasm.__wbg_datastorestats_free(ptr, 0);
1550
- }
1551
- /**
1552
- * Convert `DataStoreStats` to json string value
1553
- * @returns {string}
1554
- */
1555
- jsonString() {
1556
- let deferred1_0;
1557
- let deferred1_1;
1558
- try {
1559
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1560
- wasm.datastorestats_jsonString(retptr, this.__wbg_ptr);
1561
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1562
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1563
- deferred1_0 = r0;
1564
- deferred1_1 = r1;
1565
- return getStringFromWasm0(r0, r1);
1566
- } finally {
1567
- wasm.__wbindgen_add_to_stack_pointer(16);
1568
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
1569
- }
1570
- }
1571
- /**
1572
- * Average size per entry in bytes (0 if no entries)
1573
- * @returns {number}
1574
- */
1575
- get avg_entry_size_bytes() {
1576
- const ret = wasm.__wbg_get_datastorestats_avg_entry_size_bytes(this.__wbg_ptr);
1577
- return ret >>> 0;
1578
- }
1579
- /**
1580
- * Percentage of capacity used (0.0-100.0, based on entry count)
1581
- * @returns {number}
1582
- */
1583
- get capacity_usage_percent() {
1584
- const ret = wasm.__wbg_get_datastorestats_capacity_usage_percent(this.__wbg_ptr);
1585
- return ret;
1586
- }
1587
- /**
1588
- * Number of entries currently stored
1589
- * @returns {number}
1590
- */
1591
- get entry_count() {
1592
- const ret = wasm.__wbg_get_datastorestats_entry_count(this.__wbg_ptr);
1593
- return ret >>> 0;
1594
- }
1595
- /**
1596
- * Maximum number of entries allowed (0 = unlimited)
1597
- * @returns {number}
1598
- */
1599
- get max_entries() {
1600
- const ret = wasm.__wbg_get_datastorestats_max_entries(this.__wbg_ptr);
1601
- return ret >>> 0;
1602
- }
1603
- /**
1604
- * Maximum size per entry in bytes (0 = unlimited)
1605
- * @returns {number}
1606
- */
1607
- get max_entry_size() {
1608
- const ret = wasm.__wbg_get_datastorestats_max_entry_size(this.__wbg_ptr);
1609
- return ret >>> 0;
1610
- }
1611
- /**
1612
- * Memory usage threshold percentage (from config)
1613
- * @returns {number}
1614
- */
1615
- get memory_alert_threshold() {
1616
- const ret = wasm.__wbg_get_datastorestats_memory_alert_threshold(this.__wbg_ptr);
1617
- return ret;
1618
- }
1619
- /**
1620
- * Whether memory usage exceeds the alert threshold
1621
- * @returns {boolean}
1622
- */
1623
- get memory_alert_triggered() {
1624
- const ret = wasm.__wbg_get_datastorestats_memory_alert_triggered(this.__wbg_ptr);
1625
- return ret !== 0;
1626
- }
1627
- /**
1628
- * Whether metrics tracking is enabled
1629
- * @returns {boolean}
1630
- */
1631
- get metrics_enabled() {
1632
- const ret = wasm.__wbg_get_datastorestats_metrics_enabled(this.__wbg_ptr);
1633
- return ret !== 0;
1634
- }
1635
- /**
1636
- * Total size of all entries in bytes (approximate, based on JSON serialization)
1637
- * @returns {number}
1638
- */
1639
- get total_size_bytes() {
1640
- const ret = wasm.__wbg_get_datastorestats_total_size_bytes(this.__wbg_ptr);
1641
- return ret >>> 0;
1642
- }
1643
- /**
1644
- * Average size per entry in bytes (0 if no entries)
1645
- * @param {number} arg0
1646
- */
1647
- set avg_entry_size_bytes(arg0) {
1648
- wasm.__wbg_set_datastorestats_avg_entry_size_bytes(this.__wbg_ptr, arg0);
1649
- }
1650
- /**
1651
- * Percentage of capacity used (0.0-100.0, based on entry count)
1652
- * @param {number} arg0
1653
- */
1654
- set capacity_usage_percent(arg0) {
1655
- wasm.__wbg_set_datastorestats_capacity_usage_percent(this.__wbg_ptr, arg0);
1656
- }
1657
- /**
1658
- * Number of entries currently stored
1659
- * @param {number} arg0
1660
- */
1661
- set entry_count(arg0) {
1662
- wasm.__wbg_set_datastorestats_entry_count(this.__wbg_ptr, arg0);
1663
- }
1664
- /**
1665
- * Maximum number of entries allowed (0 = unlimited)
1666
- * @param {number} arg0
1667
- */
1668
- set max_entries(arg0) {
1669
- wasm.__wbg_set_datastorestats_max_entries(this.__wbg_ptr, arg0);
1670
- }
1671
- /**
1672
- * Maximum size per entry in bytes (0 = unlimited)
1673
- * @param {number} arg0
1674
- */
1675
- set max_entry_size(arg0) {
1676
- wasm.__wbg_set_datastorestats_max_entry_size(this.__wbg_ptr, arg0);
1677
- }
1678
- /**
1679
- * Memory usage threshold percentage (from config)
1680
- * @param {number} arg0
1681
- */
1682
- set memory_alert_threshold(arg0) {
1683
- wasm.__wbg_set_datastorestats_memory_alert_threshold(this.__wbg_ptr, arg0);
1684
- }
1685
- /**
1686
- * Whether memory usage exceeds the alert threshold
1687
- * @param {boolean} arg0
1688
- */
1689
- set memory_alert_triggered(arg0) {
1690
- wasm.__wbg_set_datastorestats_memory_alert_triggered(this.__wbg_ptr, arg0);
1691
- }
1692
- /**
1693
- * Whether metrics tracking is enabled
1694
- * @param {boolean} arg0
1695
- */
1696
- set metrics_enabled(arg0) {
1697
- wasm.__wbg_set_datastorestats_metrics_enabled(this.__wbg_ptr, arg0);
1698
- }
1699
- /**
1700
- * Total size of all entries in bytes (approximate, based on JSON serialization)
1701
- * @param {number} arg0
1702
- */
1703
- set total_size_bytes(arg0) {
1704
- wasm.__wbg_set_datastorestats_total_size_bytes(this.__wbg_ptr, arg0);
1705
- }
1706
- }
1707
- if (Symbol.dispose) DataStoreStats.prototype[Symbol.dispose] = DataStoreStats.prototype.free;
1708
-
1709
- /**
1710
- * Diagnostics
1711
- * ===========
1712
- *
1713
- * Provides detailed information about how a policy decision was made, including policies that contributed to the decision and any errors encountered during evaluation.
1714
- */
1715
- export class Diagnostics {
1716
- static __wrap(ptr) {
1717
- const obj = Object.create(Diagnostics.prototype);
1718
- obj.__wbg_ptr = ptr;
1719
- DiagnosticsFinalization.register(obj, obj.__wbg_ptr, obj);
1720
- return obj;
1721
- }
1722
- __destroy_into_raw() {
1723
- const ptr = this.__wbg_ptr;
1724
- this.__wbg_ptr = 0;
1725
- DiagnosticsFinalization.unregister(this);
1726
- return ptr;
1727
- }
1728
- free() {
1729
- const ptr = this.__destroy_into_raw();
1730
- wasm.__wbg_diagnostics_free(ptr, 0);
1731
- }
1732
- /**
1733
- * Errors that occurred during authorization. The errors should be
1734
- * treated as unordered, since policies may be evaluated in any order.
1735
- * @returns {PolicyEvaluationError[]}
1736
- */
1737
- get errors() {
1738
- try {
1739
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1740
- wasm.diagnostics_errors(retptr, this.__wbg_ptr);
1741
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1742
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1743
- var v1 = getArrayJsValueFromWasm0(r0, r1);
1744
- wasm.__wbindgen_export5(r0, r1 * 4, 4);
1745
- return v1;
1746
- } finally {
1747
- wasm.__wbindgen_add_to_stack_pointer(16);
1748
- }
1749
- }
1750
- /**
1751
- * `PolicyId`s of the policies that contributed to the decision.
1752
- * If no policies applied to the request, this set will be empty.
1753
- *
1754
- * The ids should be treated as unordered,
1755
- * @returns {string[]}
1756
- */
1757
- get reason() {
1758
- try {
1759
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1760
- wasm.diagnostics_reason(retptr, this.__wbg_ptr);
1761
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1762
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1763
- var v1 = getArrayJsValueFromWasm0(r0, r1);
1764
- wasm.__wbindgen_export5(r0, r1 * 4, 4);
1765
- return v1;
1766
- } finally {
1767
- wasm.__wbindgen_add_to_stack_pointer(16);
1768
- }
1769
- }
1770
- }
1771
- if (Symbol.dispose) Diagnostics.prototype[Symbol.dispose] = Diagnostics.prototype.free;
1772
-
1773
- export class IntoUnderlyingByteSource {
1774
- __destroy_into_raw() {
1775
- const ptr = this.__wbg_ptr;
1776
- this.__wbg_ptr = 0;
1777
- IntoUnderlyingByteSourceFinalization.unregister(this);
1778
- return ptr;
1779
- }
1780
- free() {
1781
- const ptr = this.__destroy_into_raw();
1782
- wasm.__wbg_intounderlyingbytesource_free(ptr, 0);
1783
- }
1784
- /**
1785
- * @returns {number}
1786
- */
1787
- get autoAllocateChunkSize() {
1788
- const ret = wasm.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr);
1789
- return ret >>> 0;
1790
- }
1791
- cancel() {
1792
- const ptr = this.__destroy_into_raw();
1793
- wasm.intounderlyingbytesource_cancel(ptr);
1794
- }
1795
- /**
1796
- * @param {ReadableByteStreamController} controller
1797
- * @returns {Promise<any>}
1798
- */
1799
- pull(controller) {
1800
- const ret = wasm.intounderlyingbytesource_pull(this.__wbg_ptr, addHeapObject(controller));
1801
- return takeObject(ret);
1802
- }
1803
- /**
1804
- * @param {ReadableByteStreamController} controller
1805
- */
1806
- start(controller) {
1807
- wasm.intounderlyingbytesource_start(this.__wbg_ptr, addHeapObject(controller));
1808
- }
1809
- /**
1810
- * @returns {ReadableStreamType}
1811
- */
1812
- get type() {
1813
- const ret = wasm.intounderlyingbytesource_type(this.__wbg_ptr);
1814
- return __wbindgen_enum_ReadableStreamType[ret];
1815
- }
1816
- }
1817
- if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
1818
-
1819
- export class IntoUnderlyingSink {
1820
- __destroy_into_raw() {
1821
- const ptr = this.__wbg_ptr;
1822
- this.__wbg_ptr = 0;
1823
- IntoUnderlyingSinkFinalization.unregister(this);
1824
- return ptr;
1825
- }
1826
- free() {
1827
- const ptr = this.__destroy_into_raw();
1828
- wasm.__wbg_intounderlyingsink_free(ptr, 0);
1829
- }
1830
- /**
1831
- * @param {any} reason
1832
- * @returns {Promise<any>}
1833
- */
1834
- abort(reason) {
1835
- const ptr = this.__destroy_into_raw();
1836
- const ret = wasm.intounderlyingsink_abort(ptr, addHeapObject(reason));
1837
- return takeObject(ret);
1838
- }
1839
- /**
1840
- * @returns {Promise<any>}
1841
- */
1842
- close() {
1843
- const ptr = this.__destroy_into_raw();
1844
- const ret = wasm.intounderlyingsink_close(ptr);
1845
- return takeObject(ret);
1846
- }
1847
- /**
1848
- * @param {any} chunk
1849
- * @returns {Promise<any>}
1850
- */
1851
- write(chunk) {
1852
- const ret = wasm.intounderlyingsink_write(this.__wbg_ptr, addHeapObject(chunk));
1853
- return takeObject(ret);
1854
- }
1855
- }
1856
- if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
1857
-
1858
- export class IntoUnderlyingSource {
1859
- __destroy_into_raw() {
1860
- const ptr = this.__wbg_ptr;
1861
- this.__wbg_ptr = 0;
1862
- IntoUnderlyingSourceFinalization.unregister(this);
1863
- return ptr;
1864
- }
1865
- free() {
1866
- const ptr = this.__destroy_into_raw();
1867
- wasm.__wbg_intounderlyingsource_free(ptr, 0);
1868
- }
1869
- cancel() {
1870
- const ptr = this.__destroy_into_raw();
1871
- wasm.intounderlyingsource_cancel(ptr);
1872
- }
1873
- /**
1874
- * @param {ReadableStreamDefaultController} controller
1875
- * @returns {Promise<any>}
1876
- */
1877
- pull(controller) {
1878
- const ret = wasm.intounderlyingsource_pull(this.__wbg_ptr, addHeapObject(controller));
1879
- return takeObject(ret);
1880
- }
1881
- }
1882
- if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
1883
-
1884
- /**
1885
- * A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
1886
- * Represents the result of a multi-issuer authorization request.
1887
- */
1888
- export class MultiIssuerAuthorizeResult {
1889
- static __wrap(ptr) {
1890
- const obj = Object.create(MultiIssuerAuthorizeResult.prototype);
1891
- obj.__wbg_ptr = ptr;
1892
- MultiIssuerAuthorizeResultFinalization.register(obj, obj.__wbg_ptr, obj);
1893
- return obj;
1894
- }
1895
- __destroy_into_raw() {
1896
- const ptr = this.__wbg_ptr;
1897
- this.__wbg_ptr = 0;
1898
- MultiIssuerAuthorizeResultFinalization.unregister(this);
1899
- return ptr;
1900
- }
1901
- free() {
1902
- const ptr = this.__destroy_into_raw();
1903
- wasm.__wbg_multiissuerauthorizeresult_free(ptr, 0);
1904
- }
1905
- /**
1906
- * Result of authorization
1907
- * true means `ALLOW`
1908
- * false means `Deny`
1909
- * @returns {boolean}
1910
- */
1911
- get decision() {
1912
- const ret = wasm.__wbg_get_multiissuerauthorizeresult_decision(this.__wbg_ptr);
1913
- return ret !== 0;
1914
- }
1915
- /**
1916
- * Request ID of the authorization request
1917
- * @returns {string}
1918
- */
1919
- get request_id() {
1920
- let deferred1_0;
1921
- let deferred1_1;
1922
- try {
1923
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1924
- wasm.__wbg_get_multiissuerauthorizeresult_request_id(retptr, this.__wbg_ptr);
1925
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1926
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1927
- deferred1_0 = r0;
1928
- deferred1_1 = r1;
1929
- return getStringFromWasm0(r0, r1);
1930
- } finally {
1931
- wasm.__wbindgen_add_to_stack_pointer(16);
1932
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
1933
- }
1934
- }
1935
- /**
1936
- * Result of Cedar policy authorization
1937
- * @returns {AuthorizeResultResponse}
1938
- */
1939
- get response() {
1940
- const ret = wasm.__wbg_get_multiissuerauthorizeresult_response(this.__wbg_ptr);
1941
- return AuthorizeResultResponse.__wrap(ret);
1942
- }
1943
- /**
1944
- * Convert `MultiIssuerAuthorizeResult` to json string value
1945
- * @returns {string}
1946
- */
1947
- jsonString() {
1948
- let deferred1_0;
1949
- let deferred1_1;
1950
- try {
1951
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1952
- wasm.multiissuerauthorizeresult_jsonString(retptr, this.__wbg_ptr);
1953
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1954
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1955
- deferred1_0 = r0;
1956
- deferred1_1 = r1;
1957
- return getStringFromWasm0(r0, r1);
1958
- } finally {
1959
- wasm.__wbindgen_add_to_stack_pointer(16);
1960
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
1961
- }
1962
- }
1963
- /**
1964
- * Result of authorization
1965
- * true means `ALLOW`
1966
- * false means `Deny`
1967
- * @param {boolean} arg0
1968
- */
1969
- set decision(arg0) {
1970
- wasm.__wbg_set_multiissuerauthorizeresult_decision(this.__wbg_ptr, arg0);
1971
- }
1972
- /**
1973
- * Request ID of the authorization request
1974
- * @param {string} arg0
1975
- */
1976
- set request_id(arg0) {
1977
- const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1978
- const len0 = WASM_VECTOR_LEN;
1979
- wasm.__wbg_set_multiissuerauthorizeresult_request_id(this.__wbg_ptr, ptr0, len0);
1980
- }
1981
- /**
1982
- * Result of Cedar policy authorization
1983
- * @param {AuthorizeResultResponse} arg0
1984
- */
1985
- set response(arg0) {
1986
- _assertClass(arg0, AuthorizeResultResponse);
1987
- var ptr0 = arg0.__destroy_into_raw();
1988
- wasm.__wbg_set_multiissuerauthorizeresult_response(this.__wbg_ptr, ptr0);
1989
- }
1990
- }
1991
- if (Symbol.dispose) MultiIssuerAuthorizeResult.prototype[Symbol.dispose] = MultiIssuerAuthorizeResult.prototype.free;
1992
-
1993
- /**
1994
- * PolicyEvaluationError
1995
- * =====================
1996
- *
1997
- * Represents an error that occurred when evaluating a Cedar policy.
1998
- */
1999
- export class PolicyEvaluationError {
2000
- static __wrap(ptr) {
2001
- const obj = Object.create(PolicyEvaluationError.prototype);
2002
- obj.__wbg_ptr = ptr;
2003
- PolicyEvaluationErrorFinalization.register(obj, obj.__wbg_ptr, obj);
2004
- return obj;
2005
- }
2006
- __destroy_into_raw() {
2007
- const ptr = this.__wbg_ptr;
2008
- this.__wbg_ptr = 0;
2009
- PolicyEvaluationErrorFinalization.unregister(this);
2010
- return ptr;
2011
- }
2012
- free() {
2013
- const ptr = this.__destroy_into_raw();
2014
- wasm.__wbg_policyevaluationerror_free(ptr, 0);
2015
- }
2016
- /**
2017
- * Underlying evaluation error string representation
2018
- * @returns {string}
2019
- */
2020
- get error() {
2021
- let deferred1_0;
2022
- let deferred1_1;
2023
- try {
2024
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2025
- wasm.policyevaluationerror_error(retptr, this.__wbg_ptr);
2026
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2027
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2028
- deferred1_0 = r0;
2029
- deferred1_1 = r1;
2030
- return getStringFromWasm0(r0, r1);
2031
- } finally {
2032
- wasm.__wbindgen_add_to_stack_pointer(16);
2033
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
2034
- }
2035
- }
2036
- /**
2037
- * Id of the policy with an error
2038
- * @returns {string}
2039
- */
2040
- get id() {
2041
- let deferred1_0;
2042
- let deferred1_1;
2043
- try {
2044
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2045
- wasm.policyevaluationerror_id(retptr, this.__wbg_ptr);
2046
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2047
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2048
- deferred1_0 = r0;
2049
- deferred1_1 = r1;
2050
- return getStringFromWasm0(r0, r1);
2051
- } finally {
2052
- wasm.__wbindgen_add_to_stack_pointer(16);
2053
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
2054
- }
2055
- }
2056
- }
2057
- if (Symbol.dispose) PolicyEvaluationError.prototype[Symbol.dispose] = PolicyEvaluationError.prototype.free;
2058
-
2059
- /**
2060
- * Creates a Cedarling application from bootstrap properties.
2061
- *
2062
- * # Arguments
2063
- *
2064
- * * `config` - A JavaScript `Map` or plain object of Cedarling
2065
- * bootstrap-property names and values.
2066
- *
2067
- * # Example
2068
- *
2069
- * ```javascript
2070
- * await initWasm();
2071
- * const cedarling = await init({
2072
- * CEDARLING_APPLICATION_NAME: "task-api",
2073
- * CEDARLING_POLICY_STORE_URI: "https://example.com/policy-store.cjar",
2074
- * CEDARLING_LOG_TYPE: "memory",
2075
- * CEDARLING_LOG_TTL: 120,
2076
- * });
2077
- * ```
2078
- * @param {any} config
2079
- * @returns {Promise<Cedarling>}
2080
- */
2081
- export function init(config) {
2082
- const ret = wasm.init(addHeapObject(config));
2083
- return takeObject(ret);
2084
- }
2085
-
2086
- /**
2087
- * Create a new instance of the Cedarling application from archive bytes.
2088
- *
2089
- * This function allows loading a policy store from a Cedar Archive (.cjar)
2090
- * that was fetched with custom logic (e.g., with authentication headers).
2091
- *
2092
- * # Arguments
2093
- * * `config` - Bootstrap configuration (Map or Object) without a policy-store
2094
- * source property. The archive bytes provide the policy store.
2095
- * * `archive_bytes` - The .cjar archive bytes (Uint8Array)
2096
- *
2097
- * # Example
2098
- * ```javascript
2099
- * await initWasm();
2100
- * const config = {
2101
- * CEDARLING_APPLICATION_NAME: "task-api",
2102
- * CEDARLING_LOG_TYPE: "memory",
2103
- * CEDARLING_LOG_TTL: 120,
2104
- * };
2105
- * const response = await fetch("https://example.com/policy-store.cjar", {
2106
- * headers: { Authorization: "Bearer <token>" },
2107
- * });
2108
- * if (!response.ok) throw new Error("Unable to fetch policy store");
2109
- * const archiveBytes = new Uint8Array(await response.arrayBuffer());
2110
- * const cedarling = await initFromArchiveBytes(config, archiveBytes);
2111
- * ```
2112
- * @param {any} config
2113
- * @param {Uint8Array} archive_bytes
2114
- * @returns {Promise<Cedarling>}
2115
- */
2116
- export function initFromArchiveBytes(config, archive_bytes) {
2117
- const ret = wasm.initFromArchiveBytes(addHeapObject(config), addHeapObject(archive_bytes));
2118
- return takeObject(ret);
2119
- }
2120
- function __wbg_get_imports() {
2121
- const import0 = {
2122
- __proto__: null,
2123
- __wbg_Error_408e67f47ca7b58b: function(arg0, arg1) {
2124
- const ret = Error(getStringFromWasm0(arg0, arg1));
2125
- return addHeapObject(ret);
2126
- },
2127
- __wbg_Number_3890faa6d3ff057d: function(arg0) {
2128
- const ret = Number(getObject(arg0));
2129
- return ret;
2130
- },
2131
- __wbg___wbindgen_bigint_get_as_i64_c4ecf48528083721: function(arg0, arg1) {
2132
- const v = getObject(arg1);
2133
- const ret = typeof(v) === 'bigint' ? v : undefined;
2134
- getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
2135
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
2136
- },
2137
- __wbg___wbindgen_boolean_get_c9c83ebd41b34df3: function(arg0) {
2138
- const v = getObject(arg0);
2139
- const ret = typeof(v) === 'boolean' ? v : undefined;
2140
- return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
2141
- },
2142
- __wbg___wbindgen_debug_string_a57024b9c6e4a48b: function(arg0, arg1) {
2143
- const ret = debugString(getObject(arg1));
2144
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2145
- const len1 = WASM_VECTOR_LEN;
2146
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2147
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2148
- },
2149
- __wbg___wbindgen_in_ac983077f137f2e6: function(arg0, arg1) {
2150
- const ret = getObject(arg0) in getObject(arg1);
2151
- return ret;
2152
- },
2153
- __wbg___wbindgen_is_bigint_8ffbbef442139384: function(arg0) {
2154
- const ret = typeof(getObject(arg0)) === 'bigint';
2155
- return ret;
2156
- },
2157
- __wbg___wbindgen_is_function_5e4570eb24ffa122: function(arg0) {
2158
- const ret = typeof(getObject(arg0)) === 'function';
2159
- return ret;
2160
- },
2161
- __wbg___wbindgen_is_object_a2790eb24c211ea0: function(arg0) {
2162
- const val = getObject(arg0);
2163
- const ret = typeof(val) === 'object' && val !== null;
2164
- return ret;
2165
- },
2166
- __wbg___wbindgen_is_string_e6f02f0ea5f20a32: function(arg0) {
2167
- const ret = typeof(getObject(arg0)) === 'string';
2168
- return ret;
2169
- },
2170
- __wbg___wbindgen_is_undefined_6cff064c44e0d823: function(arg0) {
2171
- const ret = getObject(arg0) === undefined;
2172
- return ret;
2173
- },
2174
- __wbg___wbindgen_jsval_eq_0a18949a61670320: function(arg0, arg1) {
2175
- const ret = getObject(arg0) === getObject(arg1);
2176
- return ret;
2177
- },
2178
- __wbg___wbindgen_jsval_loose_eq_acf2776254a8d832: function(arg0, arg1) {
2179
- const ret = getObject(arg0) == getObject(arg1);
2180
- return ret;
2181
- },
2182
- __wbg___wbindgen_number_get_136b9679cab35cfb: function(arg0, arg1) {
2183
- const obj = getObject(arg1);
2184
- const ret = typeof(obj) === 'number' ? obj : undefined;
2185
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
2186
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
2187
- },
2188
- __wbg___wbindgen_string_get_d154f1e671052120: function(arg0, arg1) {
2189
- const obj = getObject(arg1);
2190
- const ret = typeof(obj) === 'string' ? obj : undefined;
2191
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2192
- var len1 = WASM_VECTOR_LEN;
2193
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2194
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2195
- },
2196
- __wbg___wbindgen_throw_bb96b2010945f0bc: function(arg0, arg1) {
2197
- throw new Error(getStringFromWasm0(arg0, arg1));
2198
- },
2199
- __wbg__wbg_cb_unref_be22cc64ae6946a0: function(arg0) {
2200
- getObject(arg0)._wbg_cb_unref();
2201
- },
2202
- __wbg_abort_1254fe4ac5695dc0: function(arg0, arg1) {
2203
- getObject(arg0).abort(getObject(arg1));
2204
- },
2205
- __wbg_abort_d8615b5857e112b3: function(arg0) {
2206
- getObject(arg0).abort();
2207
- },
2208
- __wbg_append_acad6a3f39a3e778: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2209
- getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
2210
- }, arguments); },
2211
- __wbg_arrayBuffer_16433f17fbd74397: function() { return handleError(function (arg0) {
2212
- const ret = getObject(arg0).arrayBuffer();
2213
- return addHeapObject(ret);
2214
- }, arguments); },
2215
- __wbg_authorizeresult_new: function(arg0) {
2216
- const ret = AuthorizeResult.__wrap(arg0);
2217
- return addHeapObject(ret);
2218
- },
2219
- __wbg_batchauthorizemultiissuerresponse_new: function(arg0) {
2220
- const ret = BatchAuthorizeMultiIssuerResponse.__wrap(arg0);
2221
- return addHeapObject(ret);
2222
- },
2223
- __wbg_batchauthorizeunsignedresponse_new: function(arg0) {
2224
- const ret = BatchAuthorizeUnsignedResponse.__wrap(arg0);
2225
- return addHeapObject(ret);
2226
- },
2227
- __wbg_batchitemmultiissuerresult_new: function(arg0) {
2228
- const ret = BatchItemMultiIssuerResult.__wrap(arg0);
2229
- return addHeapObject(ret);
2230
- },
2231
- __wbg_batchitemunsignedresult_new: function(arg0) {
2232
- const ret = BatchItemUnsignedResult.__wrap(arg0);
2233
- return addHeapObject(ret);
2234
- },
2235
- __wbg_body_eb2e7e7701fa47ae: function(arg0) {
2236
- const ret = getObject(arg0).body;
2237
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2238
- },
2239
- __wbg_buffer_78291c0e094ccf99: function(arg0) {
2240
- const ret = getObject(arg0).buffer;
2241
- return addHeapObject(ret);
2242
- },
2243
- __wbg_byobRequest_f8b1c89429b77545: function(arg0) {
2244
- const ret = getObject(arg0).byobRequest;
2245
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2246
- },
2247
- __wbg_byteLength_336bc7d303511ba0: function(arg0) {
2248
- const ret = getObject(arg0).byteLength;
2249
- return ret;
2250
- },
2251
- __wbg_byteOffset_2b1d5b10453ce198: function(arg0) {
2252
- const ret = getObject(arg0).byteOffset;
2253
- return ret;
2254
- },
2255
- __wbg_call_1c5886ab9c57d1c7: function() { return handleError(function (arg0, arg1) {
2256
- const ret = getObject(arg0).call(getObject(arg1));
2257
- return addHeapObject(ret);
2258
- }, arguments); },
2259
- __wbg_call_35dba3c747ad7521: function() { return handleError(function (arg0, arg1, arg2) {
2260
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
2261
- return addHeapObject(ret);
2262
- }, arguments); },
2263
- __wbg_cancel_9610ed0dbe990e64: function(arg0) {
2264
- const ret = getObject(arg0).cancel();
2265
- return addHeapObject(ret);
2266
- },
2267
- __wbg_catch_8094577c3f159ad5: function(arg0, arg1) {
2268
- const ret = getObject(arg0).catch(getObject(arg1));
2269
- return addHeapObject(ret);
2270
- },
2271
- __wbg_cedarling_new: function(arg0) {
2272
- const ret = Cedarling.__wrap(arg0);
2273
- return addHeapObject(ret);
2274
- },
2275
- __wbg_clearTimeout_333bba87532ab9d3: function(arg0) {
2276
- const ret = clearTimeout(takeObject(arg0));
2277
- return addHeapObject(ret);
2278
- },
2279
- __wbg_clearTimeout_3629d6209dfcc46e: function(arg0) {
2280
- const ret = clearTimeout(takeObject(arg0));
2281
- return addHeapObject(ret);
2282
- },
2283
- __wbg_clearTimeout_c122f92fd48cd749: function(arg0) {
2284
- const ret = clearTimeout(takeObject(arg0));
2285
- return addHeapObject(ret);
2286
- },
2287
- __wbg_close_72f69f5f2de2bc73: function() { return handleError(function (arg0) {
2288
- getObject(arg0).close();
2289
- }, arguments); },
2290
- __wbg_close_97cdb44c3a7878f6: function() { return handleError(function (arg0) {
2291
- getObject(arg0).close();
2292
- }, arguments); },
2293
- __wbg_crypto_38df2bab126b63dc: function(arg0) {
2294
- const ret = getObject(arg0).crypto;
2295
- return addHeapObject(ret);
2296
- },
2297
- __wbg_dataentry_new: function(arg0) {
2298
- const ret = DataEntry.__wrap(arg0);
2299
- return addHeapObject(ret);
2300
- },
2301
- __wbg_debug_5f9689ee1e1c839f: function(arg0) {
2302
- console.debug(...getObject(arg0));
2303
- },
2304
- __wbg_done_669171204c3dcae2: function(arg0) {
2305
- const ret = getObject(arg0).done;
2306
- return ret;
2307
- },
2308
- __wbg_enqueue_7d68a21eda78e72f: function() { return handleError(function (arg0, arg1) {
2309
- getObject(arg0).enqueue(getObject(arg1));
2310
- }, arguments); },
2311
- __wbg_entries_2c710161cbd65b89: function(arg0) {
2312
- const ret = getObject(arg0).entries();
2313
- return addHeapObject(ret);
2314
- },
2315
- __wbg_entries_71601bcb707d5078: function(arg0) {
2316
- const ret = getObject(arg0).entries();
2317
- return addHeapObject(ret);
2318
- },
2319
- __wbg_entries_7774d489e1da5f4f: function(arg0) {
2320
- const ret = Object.entries(getObject(arg0));
2321
- return addHeapObject(ret);
2322
- },
2323
- __wbg_error_64ffb537ec0eda86: function(arg0) {
2324
- console.error(...getObject(arg0));
2325
- },
2326
- __wbg_fetch_074561c3e313c86f: function(arg0) {
2327
- const ret = fetch(getObject(arg0));
2328
- return addHeapObject(ret);
2329
- },
2330
- __wbg_fetch_5e2e4a3d60c8d1d3: function(arg0, arg1) {
2331
- const ret = fetch(getObject(arg0), getObject(arg1));
2332
- return addHeapObject(ret);
2333
- },
2334
- __wbg_fetch_75234d52fb417eb2: function(arg0, arg1, arg2) {
2335
- const ret = getObject(arg0).fetch(getObject(arg1), getObject(arg2));
2336
- return addHeapObject(ret);
2337
- },
2338
- __wbg_fetch_d752d93f5b259503: function(arg0, arg1) {
2339
- const ret = getObject(arg0).fetch(getObject(arg1));
2340
- return addHeapObject(ret);
2341
- },
2342
- __wbg_fromEntries_464704b0ede47aaf: function() { return handleError(function (arg0) {
2343
- const ret = Object.fromEntries(getObject(arg0));
2344
- return addHeapObject(ret);
2345
- }, arguments); },
2346
- __wbg_getRandomValues_436a51d0629d84e1: function() { return handleError(function (arg0, arg1) {
2347
- globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
2348
- }, arguments); },
2349
- __wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
2350
- getObject(arg0).getRandomValues(getObject(arg1));
2351
- }, arguments); },
2352
- __wbg_getReader_9facd4f899beac89: function() { return handleError(function (arg0) {
2353
- const ret = getObject(arg0).getReader();
2354
- return addHeapObject(ret);
2355
- }, arguments); },
2356
- __wbg_getTime_63fb0332e6c4ec17: function(arg0) {
2357
- const ret = getObject(arg0).getTime();
2358
- return ret;
2359
- },
2360
- __wbg_getTimezoneOffset_4baa793e0d3962a8: function(arg0) {
2361
- const ret = getObject(arg0).getTimezoneOffset();
2362
- return ret;
2363
- },
2364
- __wbg_get_971a0c45d172643f: function() { return handleError(function (arg0, arg1) {
2365
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
2366
- return addHeapObject(ret);
2367
- }, arguments); },
2368
- __wbg_get_c0c8f8d7da0c03dd: function(arg0, arg1) {
2369
- const ret = getObject(arg0)[arg1 >>> 0];
2370
- return addHeapObject(ret);
2371
- },
2372
- __wbg_get_d173c0308df22d37: function() { return handleError(function (arg0, arg1) {
2373
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
2374
- return addHeapObject(ret);
2375
- }, arguments); },
2376
- __wbg_get_done_ce5b5691b59c07f2: function(arg0) {
2377
- const ret = getObject(arg0).done;
2378
- return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
2379
- },
2380
- __wbg_get_unchecked_e20b893aeafc3fca: function(arg0, arg1) {
2381
- const ret = getObject(arg0)[arg1 >>> 0];
2382
- return addHeapObject(ret);
2383
- },
2384
- __wbg_get_value_58309ba057b715e1: function(arg0) {
2385
- const ret = getObject(arg0).value;
2386
- return addHeapObject(ret);
2387
- },
2388
- __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
2389
- const ret = getObject(arg0)[getObject(arg1)];
2390
- return addHeapObject(ret);
2391
- },
2392
- __wbg_has_b3a6e6d0d28295fa: function() { return handleError(function (arg0, arg1) {
2393
- const ret = Reflect.has(getObject(arg0), getObject(arg1));
2394
- return ret;
2395
- }, arguments); },
2396
- __wbg_headers_92567b07014384b9: function(arg0) {
2397
- const ret = getObject(arg0).headers;
2398
- return addHeapObject(ret);
2399
- },
2400
- __wbg_info_1fa281be98acfc08: function(arg0) {
2401
- console.info(...getObject(arg0));
2402
- },
2403
- __wbg_instanceof_ArrayBuffer_993d02d2d254cad1: function(arg0) {
2404
- let result;
2405
- try {
2406
- result = getObject(arg0) instanceof ArrayBuffer;
2407
- } catch (_) {
2408
- result = false;
2409
- }
2410
- const ret = result;
2411
- return ret;
2412
- },
2413
- __wbg_instanceof_Array_20c759966d2a22c8: function(arg0) {
2414
- let result;
2415
- try {
2416
- result = getObject(arg0) instanceof Array;
2417
- } catch (_) {
2418
- result = false;
2419
- }
2420
- const ret = result;
2421
- return ret;
2422
- },
2423
- __wbg_instanceof_Map_9a4d6ead180ae3a9: function(arg0) {
2424
- let result;
2425
- try {
2426
- result = getObject(arg0) instanceof Map;
2427
- } catch (_) {
2428
- result = false;
2429
- }
2430
- const ret = result;
2431
- return ret;
2432
- },
2433
- __wbg_instanceof_Response_8f49efbd4bfd76d6: function(arg0) {
2434
- let result;
2435
- try {
2436
- result = getObject(arg0) instanceof Response;
2437
- } catch (_) {
2438
- result = false;
2439
- }
2440
- const ret = result;
2441
- return ret;
2442
- },
2443
- __wbg_instanceof_Uint8Array_f935dbb0aa7cdeed: function(arg0) {
2444
- let result;
2445
- try {
2446
- result = getObject(arg0) instanceof Uint8Array;
2447
- } catch (_) {
2448
- result = false;
2449
- }
2450
- const ret = result;
2451
- return ret;
2452
- },
2453
- __wbg_isArray_6339f732981044bf: function(arg0) {
2454
- const ret = Array.isArray(getObject(arg0));
2455
- return ret;
2456
- },
2457
- __wbg_isSafeInteger_f3d6cd19ccfe4512: function(arg0) {
2458
- const ret = Number.isSafeInteger(getObject(arg0));
2459
- return ret;
2460
- },
2461
- __wbg_iterator_5cebbb86e33c6dd6: function() {
2462
- const ret = Symbol.iterator;
2463
- return addHeapObject(ret);
2464
- },
2465
- __wbg_keys_ec7f8c0c2370d91d: function(arg0) {
2466
- const ret = Object.keys(getObject(arg0));
2467
- return addHeapObject(ret);
2468
- },
2469
- __wbg_length_36bd29c6848c2144: function(arg0) {
2470
- const ret = getObject(arg0).length;
2471
- return ret;
2472
- },
2473
- __wbg_length_ecfa2c63d3d0d82c: function(arg0) {
2474
- const ret = getObject(arg0).length;
2475
- return ret;
2476
- },
2477
- __wbg_log_3432c886933c2c5f: function(arg0) {
2478
- console.log(...getObject(arg0));
2479
- },
2480
- __wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
2481
- const ret = getObject(arg0).msCrypto;
2482
- return addHeapObject(ret);
2483
- },
2484
- __wbg_multiissuerauthorizeresult_new: function(arg0) {
2485
- const ret = MultiIssuerAuthorizeResult.__wrap(arg0);
2486
- return addHeapObject(ret);
2487
- },
2488
- __wbg_new_0_f117d868b403dc07: function() {
2489
- const ret = new Date();
2490
- return addHeapObject(ret);
2491
- },
2492
- __wbg_new_116be93542d39019: function() {
2493
- const ret = new Array();
2494
- return addHeapObject(ret);
2495
- },
2496
- __wbg_new_358857d90afd5a2d: function(arg0, arg1) {
2497
- const ret = new Error(getStringFromWasm0(arg0, arg1));
2498
- return addHeapObject(ret);
2499
- },
2500
- __wbg_new_77cc4f4f472aeb81: function(arg0) {
2501
- const ret = new Uint8Array(getObject(arg0));
2502
- return addHeapObject(ret);
2503
- },
2504
- __wbg_new_95039e162b0c4466: function() { return handleError(function () {
2505
- const ret = new Headers();
2506
- return addHeapObject(ret);
2507
- }, arguments); },
2508
- __wbg_new_cdf041679ded4c5f: function() {
2509
- const ret = new Map();
2510
- return addHeapObject(ret);
2511
- },
2512
- __wbg_new_ebe3e0f6837f0879: function() {
2513
- const ret = new Object();
2514
- return addHeapObject(ret);
2515
- },
2516
- __wbg_new_f5712de39c931ddf: function() { return handleError(function () {
2517
- const ret = new AbortController();
2518
- return addHeapObject(ret);
2519
- }, arguments); },
2520
- __wbg_new_f9d6489212f3b2b3: function(arg0) {
2521
- const ret = new Date(getObject(arg0));
2522
- return addHeapObject(ret);
2523
- },
2524
- __wbg_new_from_slice_3eea173078478cfe: function(arg0, arg1) {
2525
- const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
2526
- return addHeapObject(ret);
2527
- },
2528
- __wbg_new_typed_cceaf62d8d95e9f2: function(arg0, arg1) {
2529
- try {
2530
- var state0 = {a: arg0, b: arg1};
2531
- var cb0 = (arg0, arg1) => {
2532
- const a = state0.a;
2533
- state0.a = 0;
2534
- try {
2535
- return __wasm_bindgen_func_elem_8968(a, state0.b, arg0, arg1);
2536
- } finally {
2537
- state0.a = a;
2538
- }
2539
- };
2540
- const ret = new Promise(cb0);
2541
- return addHeapObject(ret);
2542
- } finally {
2543
- state0.a = 0;
2544
- }
2545
- },
2546
- __wbg_new_with_byte_offset_and_length_ff6e927f8d72f0c3: function(arg0, arg1, arg2) {
2547
- const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
2548
- return addHeapObject(ret);
2549
- },
2550
- __wbg_new_with_length_3ffc1c56427c525c: function(arg0) {
2551
- const ret = new Uint8Array(arg0 >>> 0);
2552
- return addHeapObject(ret);
2553
- },
2554
- __wbg_new_with_str_and_init_5a37d576dec75a86: function() { return handleError(function (arg0, arg1, arg2) {
2555
- const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
2556
- return addHeapObject(ret);
2557
- }, arguments); },
2558
- __wbg_next_42cf16ee0dafc9e2: function() { return handleError(function (arg0) {
2559
- const ret = getObject(arg0).next();
2560
- return addHeapObject(ret);
2561
- }, arguments); },
2562
- __wbg_next_8f26b64fa5e9f64b: function(arg0) {
2563
- const ret = getObject(arg0).next;
2564
- return addHeapObject(ret);
2565
- },
2566
- __wbg_node_84ea875411254db1: function(arg0) {
2567
- const ret = getObject(arg0).node;
2568
- return addHeapObject(ret);
2569
- },
2570
- __wbg_policyevaluationerror_new: function(arg0) {
2571
- const ret = PolicyEvaluationError.__wrap(arg0);
2572
- return addHeapObject(ret);
2573
- },
2574
- __wbg_process_44c7a14e11e9f69e: function(arg0) {
2575
- const ret = getObject(arg0).process;
2576
- return addHeapObject(ret);
2577
- },
2578
- __wbg_prototypesetcall_de8e0d9553586985: function(arg0, arg1, arg2) {
2579
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
2580
- },
2581
- __wbg_push_adb0107829f02d75: function(arg0, arg1) {
2582
- const ret = getObject(arg0).push(getObject(arg1));
2583
- return ret;
2584
- },
2585
- __wbg_queueMicrotask_ac694eae12e92dfb: function(arg0) {
2586
- queueMicrotask(getObject(arg0));
2587
- },
2588
- __wbg_queueMicrotask_be5fe34a8f4cad4d: function(arg0) {
2589
- const ret = getObject(arg0).queueMicrotask;
2590
- return addHeapObject(ret);
2591
- },
2592
- __wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
2593
- getObject(arg0).randomFillSync(takeObject(arg1));
2594
- }, arguments); },
2595
- __wbg_read_ae34ffedeb11f034: function(arg0) {
2596
- const ret = getObject(arg0).read();
2597
- return addHeapObject(ret);
2598
- },
2599
- __wbg_releaseLock_f38d2d1c08212a8a: function(arg0) {
2600
- getObject(arg0).releaseLock();
2601
- },
2602
- __wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
2603
- const ret = module.require;
2604
- return addHeapObject(ret);
2605
- }, arguments); },
2606
- __wbg_resolve_020f95d838c6ef25: function(arg0) {
2607
- const ret = Promise.resolve(getObject(arg0));
2608
- return addHeapObject(ret);
2609
- },
2610
- __wbg_respond_f88cbcebace42068: function() { return handleError(function (arg0, arg1) {
2611
- getObject(arg0).respond(arg1 >>> 0);
2612
- }, arguments); },
2613
- __wbg_setTimeout_3a808dd861dd3c12: function(arg0, arg1) {
2614
- const ret = setTimeout(getObject(arg0), arg1);
2615
- return addHeapObject(ret);
2616
- },
2617
- __wbg_setTimeout_56bcdccbad22fd44: function() { return handleError(function (arg0, arg1) {
2618
- const ret = setTimeout(getObject(arg0), arg1);
2619
- return addHeapObject(ret);
2620
- }, arguments); },
2621
- __wbg_setTimeout_9f4169770fc5a5c3: function(arg0, arg1) {
2622
- const ret = setTimeout(getObject(arg0), arg1);
2623
- return addHeapObject(ret);
2624
- },
2625
- __wbg_set_014226dfeca53178: function(arg0, arg1, arg2) {
2626
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
2627
- return addHeapObject(ret);
2628
- },
2629
- __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
2630
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
2631
- },
2632
- __wbg_set_8155bb79a948541b: function() { return handleError(function (arg0, arg1, arg2) {
2633
- const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
2634
- return ret;
2635
- }, arguments); },
2636
- __wbg_set_a80955eb93b145c6: function(arg0, arg1, arg2) {
2637
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
2638
- },
2639
- __wbg_set_b9b5b5cb7b495037: function(arg0, arg1, arg2) {
2640
- getObject(arg0).set(getArrayU8FromWasm0(arg1, arg2));
2641
- },
2642
- __wbg_set_body_f301b68bff45f419: function(arg0, arg1) {
2643
- getObject(arg0).body = getObject(arg1);
2644
- },
2645
- __wbg_set_cache_ab8f11813716fe29: function(arg0, arg1) {
2646
- getObject(arg0).cache = __wbindgen_enum_RequestCache[arg1];
2647
- },
2648
- __wbg_set_credentials_d7f3b810cbf191e1: function(arg0, arg1) {
2649
- getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
2650
- },
2651
- __wbg_set_e92392c4b44c5de1: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2652
- getObject(arg0).set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
2653
- }, arguments); },
2654
- __wbg_set_headers_805555608daf7f2a: function(arg0, arg1) {
2655
- getObject(arg0).headers = getObject(arg1);
2656
- },
2657
- __wbg_set_integrity_c05dca79461dfe0a: function(arg0, arg1, arg2) {
2658
- getObject(arg0).integrity = getStringFromWasm0(arg1, arg2);
2659
- },
2660
- __wbg_set_method_cf2b992b9a610bc3: function(arg0, arg1, arg2) {
2661
- getObject(arg0).method = getStringFromWasm0(arg1, arg2);
2662
- },
2663
- __wbg_set_mode_d6479dfd6696c8d3: function(arg0, arg1) {
2664
- getObject(arg0).mode = __wbindgen_enum_RequestMode[arg1];
2665
- },
2666
- __wbg_set_redirect_9d53fb52143d8ea4: function(arg0, arg1) {
2667
- getObject(arg0).redirect = __wbindgen_enum_RequestRedirect[arg1];
2668
- },
2669
- __wbg_set_referrer_de24582cadb58b95: function(arg0, arg1, arg2) {
2670
- getObject(arg0).referrer = getStringFromWasm0(arg1, arg2);
2671
- },
2672
- __wbg_set_referrer_policy_3f990097931e92b7: function(arg0, arg1) {
2673
- getObject(arg0).referrerPolicy = __wbindgen_enum_ReferrerPolicy[arg1];
2674
- },
2675
- __wbg_set_signal_115b9e9423652e66: function(arg0, arg1) {
2676
- getObject(arg0).signal = getObject(arg1);
2677
- },
2678
- __wbg_signal_58449b7eb331d1be: function(arg0) {
2679
- const ret = getObject(arg0).signal;
2680
- return addHeapObject(ret);
2681
- },
2682
- __wbg_static_accessor_GLOBAL_THIS_466428f93b4eaa76: function() {
2683
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
2684
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2685
- },
2686
- __wbg_static_accessor_GLOBAL_c7aea38d4de089bc: function() {
2687
- const ret = typeof global === 'undefined' ? null : global;
2688
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2689
- },
2690
- __wbg_static_accessor_SELF_42d4fae05e59267a: function() {
2691
- const ret = typeof self === 'undefined' ? null : self;
2692
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2693
- },
2694
- __wbg_static_accessor_WINDOW_e0db14a0eba6a812: function() {
2695
- const ret = typeof window === 'undefined' ? null : window;
2696
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2697
- },
2698
- __wbg_status_b0de02a07fd7d927: function(arg0) {
2699
- const ret = getObject(arg0).status;
2700
- return ret;
2701
- },
2702
- __wbg_subarray_a4cc58201c7359fd: function(arg0, arg1, arg2) {
2703
- const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
2704
- return addHeapObject(ret);
2705
- },
2706
- __wbg_then_7026b513a94278a8: function(arg0, arg1) {
2707
- const ret = getObject(arg0).then(getObject(arg1));
2708
- return addHeapObject(ret);
2709
- },
2710
- __wbg_then_72819b8d4e081fb5: function(arg0, arg1, arg2) {
2711
- const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
2712
- return addHeapObject(ret);
2713
- },
2714
- __wbg_toString_2f0b0aec069cb718: function(arg0) {
2715
- const ret = getObject(arg0).toString();
2716
- return addHeapObject(ret);
2717
- },
2718
- __wbg_trace_f39eacb57667b538: function(arg0) {
2719
- console.trace(...getObject(arg0));
2720
- },
2721
- __wbg_url_82c95d5d2e2ba977: function(arg0, arg1) {
2722
- const ret = getObject(arg1).url;
2723
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2724
- const len1 = WASM_VECTOR_LEN;
2725
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2726
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2727
- },
2728
- __wbg_value_1e2369fab29b420e: function(arg0) {
2729
- const ret = getObject(arg0).value;
2730
- return addHeapObject(ret);
2731
- },
2732
- __wbg_versions_276b2795b1c6a219: function(arg0) {
2733
- const ret = getObject(arg0).versions;
2734
- return addHeapObject(ret);
2735
- },
2736
- __wbg_view_7685fe4b2845c5b6: function(arg0) {
2737
- const ret = getObject(arg0).view;
2738
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2739
- },
2740
- __wbg_warn_f0d66a42df9a1e7b: function(arg0) {
2741
- console.warn(...getObject(arg0));
2742
- },
2743
- __wbindgen_cast_0000000000000001: function(arg0, arg1) {
2744
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1010, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2745
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_8902);
2746
- return addHeapObject(ret);
2747
- },
2748
- __wbindgen_cast_0000000000000002: function(arg0, arg1) {
2749
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1206, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2750
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_12454);
2751
- return addHeapObject(ret);
2752
- },
2753
- __wbindgen_cast_0000000000000003: function(arg0, arg1) {
2754
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 1003, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2755
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_8737);
2756
- return addHeapObject(ret);
2757
- },
2758
- __wbindgen_cast_0000000000000004: function(arg0) {
2759
- // Cast intrinsic for `F64 -> Externref`.
2760
- const ret = arg0;
2761
- return addHeapObject(ret);
2762
- },
2763
- __wbindgen_cast_0000000000000005: function(arg0) {
2764
- // Cast intrinsic for `I64 -> Externref`.
2765
- const ret = arg0;
2766
- return addHeapObject(ret);
2767
- },
2768
- __wbindgen_cast_0000000000000006: function(arg0, arg1) {
2769
- // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
2770
- const ret = getArrayU8FromWasm0(arg0, arg1);
2771
- return addHeapObject(ret);
2772
- },
2773
- __wbindgen_cast_0000000000000007: function(arg0, arg1) {
2774
- // Cast intrinsic for `Ref(String) -> Externref`.
2775
- const ret = getStringFromWasm0(arg0, arg1);
2776
- return addHeapObject(ret);
2777
- },
2778
- __wbindgen_cast_0000000000000008: function(arg0) {
2779
- // Cast intrinsic for `U64 -> Externref`.
2780
- const ret = BigInt.asUintN(64, arg0);
2781
- return addHeapObject(ret);
2782
- },
2783
- __wbindgen_object_clone_ref: function(arg0) {
2784
- const ret = getObject(arg0);
2785
- return addHeapObject(ret);
2786
- },
2787
- __wbindgen_object_drop_ref: function(arg0) {
2788
- takeObject(arg0);
2789
- },
2790
- };
2791
- return {
2792
- __proto__: null,
2793
- "./cedarling_wasm_bg.js": import0,
2794
- };
2795
- }
2796
-
2797
- function __wasm_bindgen_func_elem_8737(arg0, arg1) {
2798
- wasm.__wasm_bindgen_func_elem_8737(arg0, arg1);
2799
- }
2800
-
2801
- function __wasm_bindgen_func_elem_12454(arg0, arg1, arg2) {
2802
- wasm.__wasm_bindgen_func_elem_12454(arg0, arg1, addHeapObject(arg2));
2803
- }
2804
-
2805
- function __wasm_bindgen_func_elem_8902(arg0, arg1, arg2) {
2806
- try {
2807
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2808
- wasm.__wasm_bindgen_func_elem_8902(retptr, arg0, arg1, addHeapObject(arg2));
2809
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2810
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2811
- if (r1) {
2812
- throw takeObject(r0);
2813
- }
2814
- } finally {
2815
- wasm.__wbindgen_add_to_stack_pointer(16);
2816
- }
2817
- }
2818
-
2819
- function __wasm_bindgen_func_elem_8968(arg0, arg1, arg2, arg3) {
2820
- wasm.__wasm_bindgen_func_elem_8968(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
2821
- }
2822
-
2823
-
2824
- const __wbindgen_enum_ReadableStreamType = ["bytes"];
2825
-
2826
-
2827
- 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"];
2828
-
2829
-
2830
- const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
2831
-
2832
-
2833
- const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
2834
-
2835
-
2836
- const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
2837
-
2838
-
2839
- const __wbindgen_enum_RequestRedirect = ["follow", "error", "manual"];
2840
- const AuthorizeResultFinalization = (typeof FinalizationRegistry === 'undefined')
2841
- ? { register: () => {}, unregister: () => {} }
2842
- : new FinalizationRegistry(ptr => wasm.__wbg_authorizeresult_free(ptr, 1));
2843
- const AuthorizeResultResponseFinalization = (typeof FinalizationRegistry === 'undefined')
2844
- ? { register: () => {}, unregister: () => {} }
2845
- : new FinalizationRegistry(ptr => wasm.__wbg_authorizeresultresponse_free(ptr, 1));
2846
- const BatchAuthorizeMultiIssuerResponseFinalization = (typeof FinalizationRegistry === 'undefined')
2847
- ? { register: () => {}, unregister: () => {} }
2848
- : new FinalizationRegistry(ptr => wasm.__wbg_batchauthorizemultiissuerresponse_free(ptr, 1));
2849
- const BatchAuthorizeUnsignedResponseFinalization = (typeof FinalizationRegistry === 'undefined')
2850
- ? { register: () => {}, unregister: () => {} }
2851
- : new FinalizationRegistry(ptr => wasm.__wbg_batchauthorizeunsignedresponse_free(ptr, 1));
2852
- const BatchItemErrorFinalization = (typeof FinalizationRegistry === 'undefined')
2853
- ? { register: () => {}, unregister: () => {} }
2854
- : new FinalizationRegistry(ptr => wasm.__wbg_batchitemerror_free(ptr, 1));
2855
- const BatchItemMultiIssuerResultFinalization = (typeof FinalizationRegistry === 'undefined')
2856
- ? { register: () => {}, unregister: () => {} }
2857
- : new FinalizationRegistry(ptr => wasm.__wbg_batchitemmultiissuerresult_free(ptr, 1));
2858
- const BatchItemUnsignedResultFinalization = (typeof FinalizationRegistry === 'undefined')
2859
- ? { register: () => {}, unregister: () => {} }
2860
- : new FinalizationRegistry(ptr => wasm.__wbg_batchitemunsignedresult_free(ptr, 1));
2861
- const CedarlingFinalization = (typeof FinalizationRegistry === 'undefined')
2862
- ? { register: () => {}, unregister: () => {} }
2863
- : new FinalizationRegistry(ptr => wasm.__wbg_cedarling_free(ptr, 1));
2864
- const DataEntryFinalization = (typeof FinalizationRegistry === 'undefined')
2865
- ? { register: () => {}, unregister: () => {} }
2866
- : new FinalizationRegistry(ptr => wasm.__wbg_dataentry_free(ptr, 1));
2867
- const DataStoreStatsFinalization = (typeof FinalizationRegistry === 'undefined')
2868
- ? { register: () => {}, unregister: () => {} }
2869
- : new FinalizationRegistry(ptr => wasm.__wbg_datastorestats_free(ptr, 1));
2870
- const DiagnosticsFinalization = (typeof FinalizationRegistry === 'undefined')
2871
- ? { register: () => {}, unregister: () => {} }
2872
- : new FinalizationRegistry(ptr => wasm.__wbg_diagnostics_free(ptr, 1));
2873
- const IntoUnderlyingByteSourceFinalization = (typeof FinalizationRegistry === 'undefined')
2874
- ? { register: () => {}, unregister: () => {} }
2875
- : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingbytesource_free(ptr, 1));
2876
- const IntoUnderlyingSinkFinalization = (typeof FinalizationRegistry === 'undefined')
2877
- ? { register: () => {}, unregister: () => {} }
2878
- : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsink_free(ptr, 1));
2879
- const IntoUnderlyingSourceFinalization = (typeof FinalizationRegistry === 'undefined')
2880
- ? { register: () => {}, unregister: () => {} }
2881
- : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsource_free(ptr, 1));
2882
- const MultiIssuerAuthorizeResultFinalization = (typeof FinalizationRegistry === 'undefined')
2883
- ? { register: () => {}, unregister: () => {} }
2884
- : new FinalizationRegistry(ptr => wasm.__wbg_multiissuerauthorizeresult_free(ptr, 1));
2885
- const PolicyEvaluationErrorFinalization = (typeof FinalizationRegistry === 'undefined')
2886
- ? { register: () => {}, unregister: () => {} }
2887
- : new FinalizationRegistry(ptr => wasm.__wbg_policyevaluationerror_free(ptr, 1));
2888
-
2889
- function addHeapObject(obj) {
2890
- if (heap_next === heap.length) heap.push(heap.length + 1);
2891
- const idx = heap_next;
2892
- heap_next = heap[idx];
2893
-
2894
- heap[idx] = obj;
2895
- return idx;
2896
- }
2897
-
2898
- function _assertClass(instance, klass) {
2899
- if (!(instance instanceof klass)) {
2900
- throw new Error(`expected instance of ${klass.name}`);
2901
- }
2902
- }
2903
-
2904
- const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
2905
- ? { register: () => {}, unregister: () => {} }
2906
- : new FinalizationRegistry(state => wasm.__wbindgen_export4(state.a, state.b));
2907
-
2908
- function debugString(val) {
2909
- // primitive types
2910
- const type = typeof val;
2911
- if (type == 'number' || type == 'boolean' || val == null) {
2912
- return `${val}`;
2913
- }
2914
- if (type == 'string') {
2915
- return `"${val}"`;
2916
- }
2917
- if (type == 'symbol') {
2918
- const description = val.description;
2919
- if (description == null) {
2920
- return 'Symbol';
2921
- } else {
2922
- return `Symbol(${description})`;
2923
- }
2924
- }
2925
- if (type == 'function') {
2926
- const name = val.name;
2927
- if (typeof name == 'string' && name.length > 0) {
2928
- return `Function(${name})`;
2929
- } else {
2930
- return 'Function';
2931
- }
2932
- }
2933
- // objects
2934
- if (Array.isArray(val)) {
2935
- const length = val.length;
2936
- let debug = '[';
2937
- if (length > 0) {
2938
- debug += debugString(val[0]);
2939
- }
2940
- for(let i = 1; i < length; i++) {
2941
- debug += ', ' + debugString(val[i]);
2942
- }
2943
- debug += ']';
2944
- return debug;
2945
- }
2946
- // Test for built-in
2947
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
2948
- let className;
2949
- if (builtInMatches && builtInMatches.length > 1) {
2950
- className = builtInMatches[1];
2951
- } else {
2952
- // Failed to match the standard '[object ClassName]'
2953
- return toString.call(val);
2954
- }
2955
- if (className == 'Object') {
2956
- // we're a user defined class or Object
2957
- // JSON.stringify avoids problems with cycles, and is generally much
2958
- // easier than looping through ownProperties of `val`.
2959
- try {
2960
- return 'Object(' + JSON.stringify(val) + ')';
2961
- } catch (_) {
2962
- return 'Object';
2963
- }
2964
- }
2965
- // errors
2966
- if (val instanceof Error) {
2967
- return `${val.name}: ${val.message}\n${val.stack}`;
2968
- }
2969
- // TODO we could test for more things here, like `Set`s and `Map`s.
2970
- return className;
2971
- }
2972
-
2973
- function dropObject(idx) {
2974
- if (idx < 1028) return;
2975
- heap[idx] = heap_next;
2976
- heap_next = idx;
2977
- }
2978
-
2979
- function getArrayJsValueFromWasm0(ptr, len) {
2980
- ptr = ptr >>> 0;
2981
- const mem = getDataViewMemory0();
2982
- const result = [];
2983
- for (let i = ptr; i < ptr + 4 * len; i += 4) {
2984
- result.push(takeObject(mem.getUint32(i, true)));
2985
- }
2986
- return result;
2987
- }
2988
-
2989
- function getArrayU8FromWasm0(ptr, len) {
2990
- ptr = ptr >>> 0;
2991
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
2992
- }
2993
-
2994
- let cachedDataViewMemory0 = null;
2995
- function getDataViewMemory0() {
2996
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
2997
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
2998
- }
2999
- return cachedDataViewMemory0;
3000
- }
3001
-
3002
- function getStringFromWasm0(ptr, len) {
3003
- return decodeText(ptr >>> 0, len);
3004
- }
3005
-
3006
- let cachedUint8ArrayMemory0 = null;
3007
- function getUint8ArrayMemory0() {
3008
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
3009
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
3010
- }
3011
- return cachedUint8ArrayMemory0;
3012
- }
3013
-
3014
- function getObject(idx) { return heap[idx]; }
3015
-
3016
- function handleError(f, args) {
3017
- try {
3018
- return f.apply(this, args);
3019
- } catch (e) {
3020
- wasm.__wbindgen_export3(addHeapObject(e));
3021
- }
3022
- }
3023
-
3024
- let heap = new Array(1024).fill(undefined);
3025
- heap.push(undefined, null, true, false);
3026
-
3027
- let heap_next = heap.length;
3028
-
3029
- function isLikeNone(x) {
3030
- return x === undefined || x === null;
3031
- }
3032
-
3033
- function makeMutClosure(arg0, arg1, f) {
3034
- const state = { a: arg0, b: arg1, cnt: 1 };
3035
- const real = (...args) => {
3036
-
3037
- // First up with a closure we increment the internal reference
3038
- // count. This ensures that the Rust closure environment won't
3039
- // be deallocated while we're invoking it.
3040
- state.cnt++;
3041
- const a = state.a;
3042
- state.a = 0;
3043
- try {
3044
- return f(a, state.b, ...args);
3045
- } finally {
3046
- state.a = a;
3047
- real._wbg_cb_unref();
3048
- }
3049
- };
3050
- real._wbg_cb_unref = () => {
3051
- if (--state.cnt === 0) {
3052
- wasm.__wbindgen_export4(state.a, state.b);
3053
- state.a = 0;
3054
- CLOSURE_DTORS.unregister(state);
3055
- }
3056
- };
3057
- CLOSURE_DTORS.register(real, state, state);
3058
- return real;
3059
- }
3060
-
3061
- function passArrayJsValueToWasm0(array, malloc) {
3062
- const ptr = malloc(array.length * 4, 4) >>> 0;
3063
- const mem = getDataViewMemory0();
3064
- for (let i = 0; i < array.length; i++) {
3065
- mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
3066
- }
3067
- WASM_VECTOR_LEN = array.length;
3068
- return ptr;
3069
- }
3070
-
3071
- function passStringToWasm0(arg, malloc, realloc) {
3072
- if (realloc === undefined) {
3073
- const buf = cachedTextEncoder.encode(arg);
3074
- const ptr = malloc(buf.length, 1) >>> 0;
3075
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
3076
- WASM_VECTOR_LEN = buf.length;
3077
- return ptr;
3078
- }
3079
-
3080
- let len = arg.length;
3081
- let ptr = malloc(len, 1) >>> 0;
3082
-
3083
- const mem = getUint8ArrayMemory0();
3084
-
3085
- let offset = 0;
3086
-
3087
- for (; offset < len; offset++) {
3088
- const code = arg.charCodeAt(offset);
3089
- if (code > 0x7F) break;
3090
- mem[ptr + offset] = code;
3091
- }
3092
- if (offset !== len) {
3093
- if (offset !== 0) {
3094
- arg = arg.slice(offset);
3095
- }
3096
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
3097
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
3098
- const ret = cachedTextEncoder.encodeInto(arg, view);
3099
-
3100
- offset += ret.written;
3101
- ptr = realloc(ptr, len, offset, 1) >>> 0;
3102
- }
3103
-
3104
- WASM_VECTOR_LEN = offset;
3105
- return ptr;
3106
- }
3107
-
3108
- function takeObject(idx) {
3109
- const ret = getObject(idx);
3110
- dropObject(idx);
3111
- return ret;
3112
- }
3113
-
3114
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
3115
- cachedTextDecoder.decode();
3116
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
3117
- let numBytesDecoded = 0;
3118
- function decodeText(ptr, len) {
3119
- numBytesDecoded += len;
3120
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
3121
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
3122
- cachedTextDecoder.decode();
3123
- numBytesDecoded = len;
3124
- }
3125
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
3126
- }
3127
-
3128
- const cachedTextEncoder = new TextEncoder();
3129
-
3130
- if (!('encodeInto' in cachedTextEncoder)) {
3131
- cachedTextEncoder.encodeInto = function (arg, view) {
3132
- const buf = cachedTextEncoder.encode(arg);
3133
- view.set(buf);
3134
- return {
3135
- read: arg.length,
3136
- written: buf.length
3137
- };
3138
- };
3139
- }
3140
-
3141
- let WASM_VECTOR_LEN = 0;
3142
-
3143
- let wasmModule, wasmInstance, wasm;
3144
- function __wbg_finalize_init(instance, module) {
3145
- wasmInstance = instance;
3146
- wasm = instance.exports;
3147
- wasmModule = module;
3148
- cachedDataViewMemory0 = null;
3149
- cachedUint8ArrayMemory0 = null;
3150
- return wasm;
3151
- }
3152
-
3153
- async function __wbg_load(module, imports) {
3154
- if (typeof Response === 'function' && module instanceof Response) {
3155
- if (!module.ok) {
3156
- throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
3157
- }
3158
-
3159
- if (typeof WebAssembly.instantiateStreaming === 'function') {
3160
- try {
3161
- return await WebAssembly.instantiateStreaming(module, imports);
3162
- } catch (e) {
3163
- const validResponse = expectedResponseType(module.type);
3164
-
3165
- if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
3166
- 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);
3167
-
3168
- } else { throw e; }
3169
- }
3170
- }
3171
-
3172
- const bytes = await module.arrayBuffer();
3173
- return await WebAssembly.instantiate(bytes, imports);
3174
- } else {
3175
- const instance = await WebAssembly.instantiate(module, imports);
3176
-
3177
- if (instance instanceof WebAssembly.Instance) {
3178
- return { instance, module };
3179
- } else {
3180
- return instance;
3181
- }
3182
- }
3183
-
3184
- function expectedResponseType(type) {
3185
- switch (type) {
3186
- case 'basic': case 'cors': case 'default': return true;
3187
- }
3188
- return false;
3189
- }
3190
- }
3191
-
3192
- function initSync(module) {
3193
- if (wasm !== undefined) return wasm;
3194
-
3195
-
3196
- if (module !== undefined) {
3197
- if (Object.getPrototypeOf(module) === Object.prototype) {
3198
- ({module} = module)
3199
- } else {
3200
- console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
3201
- }
3202
- }
3203
-
3204
- const imports = __wbg_get_imports();
3205
- if (!(module instanceof WebAssembly.Module)) {
3206
- module = new WebAssembly.Module(module);
3207
- }
3208
- const instance = new WebAssembly.Instance(module, imports);
3209
- return __wbg_finalize_init(instance, module);
3210
- }
3211
-
3212
- async function __wbg_init(module_or_path) {
3213
- if (wasm !== undefined) return wasm;
3214
-
3215
-
3216
- if (module_or_path !== undefined) {
3217
- if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
3218
- ({module_or_path} = module_or_path)
3219
- } else {
3220
- console.warn('using deprecated parameters for the initialization function; pass a single object instead')
3221
- }
3222
- }
3223
-
3224
- if (module_or_path === undefined) {
3225
- module_or_path = new URL('cedarling_wasm_bg.wasm', import.meta.url);
3226
- }
3227
- const imports = __wbg_get_imports();
3228
-
3229
- if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
3230
- module_or_path = fetch(module_or_path);
3231
- }
3232
-
3233
- const { instance, module } = await __wbg_load(await module_or_path, imports);
3234
-
3235
- return __wbg_finalize_init(instance, module);
3236
- }
3237
-
3238
- export { initSync, __wbg_init as default };