@janssenproject/cedarling_wasm 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cedarling_wasm.js DELETED
@@ -1,3084 +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
- json_string() {
29
- let deferred1_0;
30
- let deferred1_1;
31
- try {
32
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
33
- wasm.authorizeresult_json_string(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.annotation_values(result.response.diagnostics.reason, "redirect");
510
- * // ["/upgrade"]
511
- * ```
512
- * @param {string[]} policy_ids
513
- * @param {string} key
514
- * @returns {string[]}
515
- */
516
- annotation_values(policy_ids, key) {
517
- try {
518
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
519
- const ptr0 = passArrayJsValueToWasm0(policy_ids, wasm.__wbindgen_export);
520
- const len0 = WASM_VECTOR_LEN;
521
- const ptr1 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
522
- const len1 = WASM_VECTOR_LEN;
523
- wasm.cedarling_annotation_values(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
524
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
525
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
526
- var v3 = getArrayJsValueFromWasm0(r0, r1);
527
- wasm.__wbindgen_export5(r0, r1 * 4, 4);
528
- return v3;
529
- } finally {
530
- wasm.__wbindgen_add_to_stack_pointer(16);
531
- }
532
- }
533
- /**
534
- * Return the annotations of each given policy, grouped by policy ID
535
- * the loss-free companion to `annotations_map`. Unknown policy IDs are
536
- * silently skipped.
537
- *
538
- * # Arguments
539
- *
540
- * * `policy_ids` - List of policy IDs whose annotations should be returned
541
- * grouped by policy ID. Typically `result.response.diagnostics.reason` from
542
- * an authorization result.
543
- *
544
- * # Example
545
- *
546
- * ```javascript
547
- * const byPolicy = cedarling.annotations_by_policy(result.response.diagnostics.reason);
548
- * // { "5": { redirect: "/upgrade", tier: "premium" } }
549
- * ```
550
- * @param {string[]} policy_ids
551
- * @returns {any}
552
- */
553
- annotations_by_policy(policy_ids) {
554
- try {
555
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
556
- const ptr0 = passArrayJsValueToWasm0(policy_ids, wasm.__wbindgen_export);
557
- const len0 = WASM_VECTOR_LEN;
558
- wasm.cedarling_annotations_by_policy(retptr, this.__wbg_ptr, ptr0, len0);
559
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
560
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
561
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
562
- if (r2) {
563
- throw takeObject(r1);
564
- }
565
- return takeObject(r0);
566
- } finally {
567
- wasm.__wbindgen_add_to_stack_pointer(16);
568
- }
569
- }
570
- /**
571
- * Merge the annotations (`@key("value")`) of the given policies into a single object.
572
- *
573
- * Intended for resolving the determining policies of an authorization decision:
574
- * pass `result.response.diagnostics.reason`.
575
- *
576
- * Lossy: if the same annotation key appears on several policies, one value wins
577
- * arbitrarily. Use `annotation_values` / `annotations_by_policy` when duplicates
578
- * matter. Unknown policy IDs are silently skipped.
579
- *
580
- * # Arguments
581
- *
582
- * * `policy_ids` - List of policy IDs whose annotations should be merged into
583
- * a single object. Typically `result.response.diagnostics.reason` from an
584
- * authorization result.
585
- *
586
- * # Example
587
- *
588
- * ```javascript
589
- * const annotations = cedarling.annotations_map(result.response.diagnostics.reason);
590
- * // { redirect: "/upgrade", tier: "premium" }
591
- * ```
592
- * @param {string[]} policy_ids
593
- * @returns {any}
594
- */
595
- annotations_map(policy_ids) {
596
- try {
597
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
598
- const ptr0 = passArrayJsValueToWasm0(policy_ids, wasm.__wbindgen_export);
599
- const len0 = WASM_VECTOR_LEN;
600
- wasm.cedarling_annotations_map(retptr, this.__wbg_ptr, ptr0, len0);
601
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
602
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
603
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
604
- if (r2) {
605
- throw takeObject(r1);
606
- }
607
- return takeObject(r0);
608
- } finally {
609
- wasm.__wbindgen_add_to_stack_pointer(16);
610
- }
611
- }
612
- /**
613
- * Authorize multi-issuer request.
614
- * Makes authorization decision based on multiple JWT tokens from different issuers.
615
- *
616
- * # Arguments
617
- *
618
- * * `request` - JSON string representation of [`AuthorizeMultiIssuerRequest`].
619
- *
620
- * # Example
621
- *
622
- * ```javascript
623
- * const result = await cedarling.authorize_multi_issuer(JSON.stringify(request));
624
- * ```
625
- * @param {string} request
626
- * @returns {Promise<MultiIssuerAuthorizeResult>}
627
- */
628
- authorize_multi_issuer(request) {
629
- const ptr0 = passStringToWasm0(request, wasm.__wbindgen_export, wasm.__wbindgen_export2);
630
- const len0 = WASM_VECTOR_LEN;
631
- const ret = wasm.cedarling_authorize_multi_issuer(this.__wbg_ptr, ptr0, len0);
632
- return takeObject(ret);
633
- }
634
- /**
635
- * Authorize a batch of multi-issuer requests against one shared token set.
636
- *
637
- * Tokens are validated and token/issuer entities are built once, then
638
- * each item is evaluated in input order. Batch-level failures (validation,
639
- * JWT verification, status-list refresh) reject the whole call; per-item
640
- * failures are returned as `BatchItemError` results and exposed by WASM
641
- * with `is_ok=false` and `error`, while genuine Cedar denials remain
642
- * `AuthorizeResult` values with `decision=false`.
643
- *
644
- * # Arguments
645
- *
646
- * * `request` - JSON string representation of [`BatchAuthorizeMultiIssuerRequest`].
647
- *
648
- * # Example
649
- *
650
- * ```javascript
651
- * const result = await cedarling.authorize_multi_issuer_batch(JSON.stringify(batchRequest));
652
- * ```
653
- * @param {string} request
654
- * @returns {Promise<BatchAuthorizeMultiIssuerResponse>}
655
- */
656
- authorize_multi_issuer_batch(request) {
657
- const ptr0 = passStringToWasm0(request, wasm.__wbindgen_export, wasm.__wbindgen_export2);
658
- const len0 = WASM_VECTOR_LEN;
659
- const ret = wasm.cedarling_authorize_multi_issuer_batch(this.__wbg_ptr, ptr0, len0);
660
- return takeObject(ret);
661
- }
662
- /**
663
- * Authorize an unsigned request carrying an optional single principal.
664
- * Makes an authorization decision based on the [`RequestUnsigned`].
665
- *
666
- * When `principal` is omitted / `null` on the JS side the core uses Cedar
667
- * partial evaluation; residual-dependent requests fail closed with
668
- * `Decision::Deny` and surface residual policy ids in
669
- * `response.diagnostics.reason`.
670
- *
671
- * # Arguments
672
- *
673
- * * `request` - JSON string representation of [`RequestUnsigned`].
674
- *
675
- * # Example
676
- *
677
- * ```javascript
678
- * const result = await cedarling.authorize_unsigned(JSON.stringify(request));
679
- * ```
680
- * @param {string} request
681
- * @returns {Promise<AuthorizeResult>}
682
- */
683
- authorize_unsigned(request) {
684
- const ptr0 = passStringToWasm0(request, wasm.__wbindgen_export, wasm.__wbindgen_export2);
685
- const len0 = WASM_VECTOR_LEN;
686
- const ret = wasm.cedarling_authorize_unsigned(this.__wbg_ptr, ptr0, len0);
687
- return takeObject(ret);
688
- }
689
- /**
690
- * Authorize a batch of unsigned requests against one shared principal.
691
- *
692
- * Setup work (principal build + pushed-data snapshot) runs once and each
693
- * item is evaluated in input order. Results are returned inside a
694
- * [`BatchAuthorizeUnsignedResponse`] carrying the shared `batch_id`.
695
- * Batch-level failures (validation, principal parse) reject the whole
696
- * call; per-item failures are returned as `BatchItemError` results and
697
- * exposed by WASM with `is_ok=false` and `error`, while genuine Cedar
698
- * denials remain `AuthorizeResult` values with `decision=false`.
699
- * # Arguments
700
- *
701
- * * `request` - JSON string representation of [`BatchAuthorizeUnsignedRequest`].
702
- *
703
- * # Example
704
- *
705
- * ```javascript
706
- * const result = await cedarling.authorize_unsigned_batch(JSON.stringify(batchRequest));
707
- * ```
708
- * @param {string} request
709
- * @returns {Promise<BatchAuthorizeUnsignedResponse>}
710
- */
711
- authorize_unsigned_batch(request) {
712
- const ptr0 = passStringToWasm0(request, wasm.__wbindgen_export, wasm.__wbindgen_export2);
713
- const len0 = WASM_VECTOR_LEN;
714
- const ret = wasm.cedarling_authorize_unsigned_batch(this.__wbg_ptr, ptr0, len0);
715
- return takeObject(ret);
716
- }
717
- /**
718
- * Clear all entries from the data store.
719
- *
720
- * # Example
721
- *
722
- * ```javascript
723
- * cedarling.clear_data_ctx();
724
- * console.log("All data entries cleared");
725
- * ```
726
- */
727
- clear_data_ctx() {
728
- try {
729
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
730
- wasm.cedarling_clear_data_ctx(retptr, this.__wbg_ptr);
731
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
732
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
733
- if (r1) {
734
- throw takeObject(r0);
735
- }
736
- } finally {
737
- wasm.__wbindgen_add_to_stack_pointer(16);
738
- }
739
- }
740
- /**
741
- * Get trusted issuer identifiers that failed to load.
742
- *
743
- * # Example
744
- *
745
- * ```javascript
746
- * const ids = cedarling.failed_trusted_issuer_ids();
747
- * ```
748
- * @returns {Array<any>}
749
- */
750
- failed_trusted_issuer_ids() {
751
- const ret = wasm.cedarling_failed_trusted_issuer_ids(this.__wbg_ptr);
752
- return takeObject(ret);
753
- }
754
- /**
755
- * Get a value from the data store by key.
756
- * Returns null if the key doesn't exist or the entry has expired.
757
- *
758
- * # Arguments
759
- *
760
- * * `key` - A string key for the data entry to retrieve
761
- *
762
- * # Example
763
- *
764
- * ```javascript
765
- * const value = cedarling.get_data_ctx("user:123");
766
- * if (value !== null) {
767
- * console.log(value.name); // "John"
768
- * }
769
- * ```
770
- * @param {string} key
771
- * @returns {any}
772
- */
773
- get_data_ctx(key) {
774
- try {
775
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
776
- const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
777
- const len0 = WASM_VECTOR_LEN;
778
- wasm.cedarling_get_data_ctx(retptr, this.__wbg_ptr, ptr0, len0);
779
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
780
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
781
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
782
- if (r2) {
783
- throw takeObject(r1);
784
- }
785
- return takeObject(r0);
786
- } finally {
787
- wasm.__wbindgen_add_to_stack_pointer(16);
788
- }
789
- }
790
- /**
791
- * Get a data entry with full metadata by key.
792
- * Returns null if the key doesn't exist or the entry has expired.
793
- *
794
- * # Arguments
795
- *
796
- * * `key` - A string key for the data entry to retrieve
797
- *
798
- * # Example
799
- *
800
- * ```javascript
801
- * const entry = cedarling.get_data_entry_ctx("user:123");
802
- * if (entry !== null) {
803
- * console.log(entry.key); // "user:123"
804
- * console.log(entry.value); // { name: "John", age: 30 }
805
- * console.log(entry.data_type); // "Record"
806
- * console.log(entry.created_at); // "2024-01-01T12:00:00Z"
807
- * console.log(entry.access_count); // 5
808
- * }
809
- * ```
810
- * @param {string} key
811
- * @returns {DataEntry | undefined}
812
- */
813
- get_data_entry_ctx(key) {
814
- try {
815
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
816
- const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
817
- const len0 = WASM_VECTOR_LEN;
818
- wasm.cedarling_get_data_entry_ctx(retptr, this.__wbg_ptr, ptr0, len0);
819
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
820
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
821
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
822
- if (r2) {
823
- throw takeObject(r1);
824
- }
825
- return r0 === 0 ? undefined : DataEntry.__wrap(r0);
826
- } finally {
827
- wasm.__wbindgen_add_to_stack_pointer(16);
828
- }
829
- }
830
- /**
831
- * Get specific log entry.
832
- * Returns `Map` with values or `null`.
833
- * @param {string} id
834
- * @returns {any}
835
- */
836
- get_log_by_id(id) {
837
- try {
838
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
839
- const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
840
- const len0 = WASM_VECTOR_LEN;
841
- wasm.cedarling_get_log_by_id(retptr, this.__wbg_ptr, ptr0, len0);
842
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
843
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
844
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
845
- if (r2) {
846
- throw takeObject(r1);
847
- }
848
- return takeObject(r0);
849
- } finally {
850
- wasm.__wbindgen_add_to_stack_pointer(16);
851
- }
852
- }
853
- /**
854
- * Returns a list of all log ids.
855
- * Returns `Array` of `String`
856
- * @returns {Array<any>}
857
- */
858
- get_log_ids() {
859
- const ret = wasm.cedarling_get_log_ids(this.__wbg_ptr);
860
- return takeObject(ret);
861
- }
862
- /**
863
- * Get logs by request_id.
864
- * Return log entries that match the given request_id.
865
- * @param {string} request_id
866
- * @returns {any[]}
867
- */
868
- get_logs_by_request_id(request_id) {
869
- try {
870
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
871
- const ptr0 = passStringToWasm0(request_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
872
- const len0 = WASM_VECTOR_LEN;
873
- wasm.cedarling_get_logs_by_request_id(retptr, this.__wbg_ptr, ptr0, len0);
874
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
875
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
876
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
877
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
878
- if (r3) {
879
- throw takeObject(r2);
880
- }
881
- var v2 = getArrayJsValueFromWasm0(r0, r1);
882
- wasm.__wbindgen_export5(r0, r1 * 4, 4);
883
- return v2;
884
- } finally {
885
- wasm.__wbindgen_add_to_stack_pointer(16);
886
- }
887
- }
888
- /**
889
- * Get log by request_id and tag, like composite key `request_id` + `log_kind`.
890
- * Tag can be `log_kind`, `log_level`.
891
- * Return log entries that match the given request_id and tag.
892
- * @param {string} request_id
893
- * @param {string} tag
894
- * @returns {any[]}
895
- */
896
- get_logs_by_request_id_and_tag(request_id, tag) {
897
- try {
898
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
899
- const ptr0 = passStringToWasm0(request_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
900
- const len0 = WASM_VECTOR_LEN;
901
- const ptr1 = passStringToWasm0(tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
902
- const len1 = WASM_VECTOR_LEN;
903
- wasm.cedarling_get_logs_by_request_id_and_tag(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
904
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
905
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
906
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
907
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
908
- if (r3) {
909
- throw takeObject(r2);
910
- }
911
- var v3 = getArrayJsValueFromWasm0(r0, r1);
912
- wasm.__wbindgen_export5(r0, r1 * 4, 4);
913
- return v3;
914
- } finally {
915
- wasm.__wbindgen_add_to_stack_pointer(16);
916
- }
917
- }
918
- /**
919
- * Get logs by tag, like `log_kind` or `log level`.
920
- * Tag can be `log_kind`, `log_level`.
921
- * @param {string} tag
922
- * @returns {any[]}
923
- */
924
- get_logs_by_tag(tag) {
925
- try {
926
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
927
- const ptr0 = passStringToWasm0(tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
928
- const len0 = WASM_VECTOR_LEN;
929
- wasm.cedarling_get_logs_by_tag(retptr, this.__wbg_ptr, ptr0, len0);
930
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
931
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
932
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
933
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
934
- if (r3) {
935
- throw takeObject(r2);
936
- }
937
- var v2 = getArrayJsValueFromWasm0(r0, r1);
938
- wasm.__wbindgen_export5(r0, r1 * 4, 4);
939
- return v2;
940
- } finally {
941
- wasm.__wbindgen_add_to_stack_pointer(16);
942
- }
943
- }
944
- /**
945
- * Get statistics about the data store.
946
- *
947
- * # Example
948
- *
949
- * ```javascript
950
- * const stats = cedarling.get_stats_ctx();
951
- * console.log(`Entries: ${stats.entry_count}/${stats.max_entries || 'unlimited'}`);
952
- * console.log(`Capacity: ${stats.capacity_usage_percent.toFixed(2)}%`);
953
- * console.log(`Total size: ${stats.total_size_bytes} bytes`);
954
- * ```
955
- * @returns {DataStoreStats}
956
- */
957
- get_stats_ctx() {
958
- try {
959
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
960
- wasm.cedarling_get_stats_ctx(retptr, this.__wbg_ptr);
961
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
962
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
963
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
964
- if (r2) {
965
- throw takeObject(r1);
966
- }
967
- return DataStoreStats.__wrap(r0);
968
- } finally {
969
- wasm.__wbindgen_add_to_stack_pointer(16);
970
- }
971
- }
972
- /**
973
- * Check whether a trusted issuer was loaded by `iss` claim.
974
- *
975
- * # Arguments
976
- *
977
- * * `iss_claim` - Issuer `iss` claim value to check.
978
- *
979
- * # Example
980
- *
981
- * ```javascript
982
- * const ok = cedarling.is_trusted_issuer_loaded_by_iss("https://issuer.example.org");
983
- * ```
984
- * @param {string} iss_claim
985
- * @returns {boolean}
986
- */
987
- is_trusted_issuer_loaded_by_iss(iss_claim) {
988
- const ptr0 = passStringToWasm0(iss_claim, wasm.__wbindgen_export, wasm.__wbindgen_export2);
989
- const len0 = WASM_VECTOR_LEN;
990
- const ret = wasm.cedarling_is_trusted_issuer_loaded_by_iss(this.__wbg_ptr, ptr0, len0);
991
- return ret !== 0;
992
- }
993
- /**
994
- * Check whether a trusted issuer was loaded by issuer identifier.
995
- *
996
- * # Arguments
997
- *
998
- * * `issuer_id` - Trusted issuer identifier to check.
999
- *
1000
- * # Example
1001
- *
1002
- * ```javascript
1003
- * const ok = cedarling.is_trusted_issuer_loaded_by_name("issuer_id");
1004
- * ```
1005
- * @param {string} issuer_id
1006
- * @returns {boolean}
1007
- */
1008
- is_trusted_issuer_loaded_by_name(issuer_id) {
1009
- const ptr0 = passStringToWasm0(issuer_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1010
- const len0 = WASM_VECTOR_LEN;
1011
- const ret = wasm.cedarling_is_trusted_issuer_loaded_by_name(this.__wbg_ptr, ptr0, len0);
1012
- return ret !== 0;
1013
- }
1014
- /**
1015
- * List all entries with their metadata.
1016
- * Returns an array of DataEntry objects.
1017
- *
1018
- * # Example
1019
- *
1020
- * ```javascript
1021
- * const entries = cedarling.list_data_ctx();
1022
- * entries.forEach(entry => {
1023
- * console.log(`${entry.key}: ${entry.data_type} (accessed ${entry.access_count} times)`);
1024
- * });
1025
- * ```
1026
- * @returns {Array<any>}
1027
- */
1028
- list_data_ctx() {
1029
- try {
1030
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1031
- wasm.cedarling_list_data_ctx(retptr, this.__wbg_ptr);
1032
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1033
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1034
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1035
- if (r2) {
1036
- throw takeObject(r1);
1037
- }
1038
- return takeObject(r0);
1039
- } finally {
1040
- wasm.__wbindgen_add_to_stack_pointer(16);
1041
- }
1042
- }
1043
- /**
1044
- * Get trusted issuer identifiers loaded successfully.
1045
- *
1046
- * # Example
1047
- *
1048
- * ```javascript
1049
- * const ids = cedarling.loaded_trusted_issuer_ids();
1050
- * ```
1051
- * @returns {Array<any>}
1052
- */
1053
- loaded_trusted_issuer_ids() {
1054
- const ret = wasm.cedarling_loaded_trusted_issuer_ids(this.__wbg_ptr);
1055
- return takeObject(ret);
1056
- }
1057
- /**
1058
- * Get the number of trusted issuers loaded successfully.
1059
- *
1060
- * # Example
1061
- *
1062
- * ```javascript
1063
- * const loadedCount = cedarling.loaded_trusted_issuers_count();
1064
- * ```
1065
- * @returns {number}
1066
- */
1067
- loaded_trusted_issuers_count() {
1068
- const ret = wasm.cedarling_loaded_trusted_issuers_count(this.__wbg_ptr);
1069
- return ret >>> 0;
1070
- }
1071
- /**
1072
- * Create a new instance of the Cedarling application.
1073
- * Assume that config is `Object`
1074
- * @param {object} config
1075
- * @returns {Promise<Cedarling>}
1076
- */
1077
- static new(config) {
1078
- const ret = wasm.cedarling_new(addHeapObject(config));
1079
- return takeObject(ret);
1080
- }
1081
- /**
1082
- * Create a new instance of the Cedarling application.
1083
- * Assume that config is `Map`
1084
- * @param {Map<any, any>} config
1085
- * @returns {Promise<Cedarling>}
1086
- */
1087
- static new_from_map(config) {
1088
- const ret = wasm.cedarling_new_from_map(addHeapObject(config));
1089
- return takeObject(ret);
1090
- }
1091
- /**
1092
- * Get logs and remove them from the storage.
1093
- * Returns `Array` of `Map`
1094
- * @returns {Array<any>}
1095
- */
1096
- pop_logs() {
1097
- try {
1098
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1099
- wasm.cedarling_pop_logs(retptr, this.__wbg_ptr);
1100
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1101
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1102
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1103
- if (r2) {
1104
- throw takeObject(r1);
1105
- }
1106
- return takeObject(r0);
1107
- } finally {
1108
- wasm.__wbindgen_add_to_stack_pointer(16);
1109
- }
1110
- }
1111
- /**
1112
- * Push a value into the data store with an optional TTL.
1113
- * If the key already exists, the value will be replaced.
1114
- * If TTL is not provided, the default TTL from configuration is used.
1115
- *
1116
- * # Arguments
1117
- *
1118
- * * `key` - A string key for the data entry (must not be empty)
1119
- * * `value` - The value to store (any JSON-serializable JavaScript value: object, array, string, number, boolean)
1120
- * * `ttl_secs` - Optional TTL in seconds (undefined/null uses default from config)
1121
- *
1122
- * # Example
1123
- *
1124
- * ```javascript
1125
- * cedarling.push_data_ctx("user:123", { name: "John", age: 30 }, 3600);
1126
- * cedarling.push_data_ctx("config", { setting: "value" }); // Uses default TTL
1127
- * ```
1128
- * @param {string} key
1129
- * @param {any} value
1130
- * @param {bigint | null} [ttl_secs]
1131
- */
1132
- push_data_ctx(key, value, ttl_secs) {
1133
- try {
1134
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1135
- const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1136
- const len0 = WASM_VECTOR_LEN;
1137
- wasm.cedarling_push_data_ctx(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(value), !isLikeNone(ttl_secs), isLikeNone(ttl_secs) ? BigInt(0) : ttl_secs);
1138
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1139
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1140
- if (r1) {
1141
- throw takeObject(r0);
1142
- }
1143
- } finally {
1144
- wasm.__wbindgen_add_to_stack_pointer(16);
1145
- }
1146
- }
1147
- /**
1148
- * Remove a value from the data store by key.
1149
- * Returns true if the key existed and was removed, false otherwise.
1150
- *
1151
- * # Arguments
1152
- *
1153
- * * `key` - A string key for the data entry to remove
1154
- *
1155
- * # Example
1156
- *
1157
- * ```javascript
1158
- * const removed = cedarling.remove_data_ctx("user:123");
1159
- * if (removed) {
1160
- * console.log("Entry was successfully removed");
1161
- * }
1162
- * ```
1163
- * @param {string} key
1164
- * @returns {boolean}
1165
- */
1166
- remove_data_ctx(key) {
1167
- try {
1168
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1169
- const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1170
- const len0 = WASM_VECTOR_LEN;
1171
- wasm.cedarling_remove_data_ctx(retptr, this.__wbg_ptr, ptr0, len0);
1172
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1173
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1174
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1175
- if (r2) {
1176
- throw takeObject(r1);
1177
- }
1178
- return r0 !== 0;
1179
- } finally {
1180
- wasm.__wbindgen_add_to_stack_pointer(16);
1181
- }
1182
- }
1183
- /**
1184
- * Closes the connections to the Lock Server and pushes all available logs.
1185
- * @returns {Promise<void>}
1186
- */
1187
- shut_down() {
1188
- const ret = wasm.cedarling_shut_down(this.__wbg_ptr);
1189
- return takeObject(ret);
1190
- }
1191
- /**
1192
- * Get the total number of trusted issuer entries discovered.
1193
- *
1194
- * # Example
1195
- *
1196
- * ```javascript
1197
- * const total = cedarling.total_issuers();
1198
- * ```
1199
- * @returns {number}
1200
- */
1201
- total_issuers() {
1202
- const ret = wasm.cedarling_total_issuers(this.__wbg_ptr);
1203
- return ret >>> 0;
1204
- }
1205
- }
1206
- if (Symbol.dispose) Cedarling.prototype[Symbol.dispose] = Cedarling.prototype.free;
1207
-
1208
- /**
1209
- * A WASM wrapper for the Rust `cedarling::DataEntry` struct.
1210
- * Represents a data entry in the DataStore with value and metadata.
1211
- */
1212
- export class DataEntry {
1213
- static __wrap(ptr) {
1214
- const obj = Object.create(DataEntry.prototype);
1215
- obj.__wbg_ptr = ptr;
1216
- DataEntryFinalization.register(obj, obj.__wbg_ptr, obj);
1217
- return obj;
1218
- }
1219
- __destroy_into_raw() {
1220
- const ptr = this.__wbg_ptr;
1221
- this.__wbg_ptr = 0;
1222
- DataEntryFinalization.unregister(this);
1223
- return ptr;
1224
- }
1225
- free() {
1226
- const ptr = this.__destroy_into_raw();
1227
- wasm.__wbg_dataentry_free(ptr, 0);
1228
- }
1229
- /**
1230
- * Convert `DataEntry` to json string value
1231
- * @returns {string}
1232
- */
1233
- json_string() {
1234
- let deferred1_0;
1235
- let deferred1_1;
1236
- try {
1237
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1238
- wasm.dataentry_json_string(retptr, this.__wbg_ptr);
1239
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1240
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1241
- deferred1_0 = r0;
1242
- deferred1_1 = r1;
1243
- return getStringFromWasm0(r0, r1);
1244
- } finally {
1245
- wasm.__wbindgen_add_to_stack_pointer(16);
1246
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
1247
- }
1248
- }
1249
- /**
1250
- * Get the value stored in this entry as a JavaScript object
1251
- * @returns {any}
1252
- */
1253
- value() {
1254
- try {
1255
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1256
- wasm.dataentry_value(retptr, this.__wbg_ptr);
1257
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1258
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1259
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1260
- if (r2) {
1261
- throw takeObject(r1);
1262
- }
1263
- return takeObject(r0);
1264
- } finally {
1265
- wasm.__wbindgen_add_to_stack_pointer(16);
1266
- }
1267
- }
1268
- /**
1269
- * Number of times this entry has been accessed
1270
- * @returns {bigint}
1271
- */
1272
- get access_count() {
1273
- const ret = wasm.__wbg_get_dataentry_access_count(this.__wbg_ptr);
1274
- return BigInt.asUintN(64, ret);
1275
- }
1276
- /**
1277
- * Timestamp when this entry was created (RFC 3339 format)
1278
- * @returns {string}
1279
- */
1280
- get created_at() {
1281
- let deferred1_0;
1282
- let deferred1_1;
1283
- try {
1284
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1285
- wasm.__wbg_get_dataentry_created_at(retptr, this.__wbg_ptr);
1286
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1287
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1288
- deferred1_0 = r0;
1289
- deferred1_1 = r1;
1290
- return getStringFromWasm0(r0, r1);
1291
- } finally {
1292
- wasm.__wbindgen_add_to_stack_pointer(16);
1293
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
1294
- }
1295
- }
1296
- /**
1297
- * The inferred Cedar type of the value
1298
- * @returns {string}
1299
- */
1300
- get data_type() {
1301
- let deferred1_0;
1302
- let deferred1_1;
1303
- try {
1304
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1305
- wasm.__wbg_get_dataentry_data_type(retptr, this.__wbg_ptr);
1306
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1307
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1308
- deferred1_0 = r0;
1309
- deferred1_1 = r1;
1310
- return getStringFromWasm0(r0, r1);
1311
- } finally {
1312
- wasm.__wbindgen_add_to_stack_pointer(16);
1313
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
1314
- }
1315
- }
1316
- /**
1317
- * Timestamp when this entry expires (RFC 3339 format), or null if no TTL
1318
- * @returns {string | undefined}
1319
- */
1320
- get expires_at() {
1321
- try {
1322
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1323
- wasm.__wbg_get_dataentry_expires_at(retptr, this.__wbg_ptr);
1324
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1325
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1326
- let v1;
1327
- if (r0 !== 0) {
1328
- v1 = getStringFromWasm0(r0, r1);
1329
- wasm.__wbindgen_export5(r0, r1 * 1, 1);
1330
- }
1331
- return v1;
1332
- } finally {
1333
- wasm.__wbindgen_add_to_stack_pointer(16);
1334
- }
1335
- }
1336
- /**
1337
- * The key for this entry
1338
- * @returns {string}
1339
- */
1340
- get key() {
1341
- let deferred1_0;
1342
- let deferred1_1;
1343
- try {
1344
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1345
- wasm.__wbg_get_dataentry_key(retptr, this.__wbg_ptr);
1346
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1347
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1348
- deferred1_0 = r0;
1349
- deferred1_1 = r1;
1350
- return getStringFromWasm0(r0, r1);
1351
- } finally {
1352
- wasm.__wbindgen_add_to_stack_pointer(16);
1353
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
1354
- }
1355
- }
1356
- /**
1357
- * Number of times this entry has been accessed
1358
- * @param {bigint} arg0
1359
- */
1360
- set access_count(arg0) {
1361
- wasm.__wbg_set_dataentry_access_count(this.__wbg_ptr, arg0);
1362
- }
1363
- /**
1364
- * Timestamp when this entry was created (RFC 3339 format)
1365
- * @param {string} arg0
1366
- */
1367
- set created_at(arg0) {
1368
- const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1369
- const len0 = WASM_VECTOR_LEN;
1370
- wasm.__wbg_set_dataentry_created_at(this.__wbg_ptr, ptr0, len0);
1371
- }
1372
- /**
1373
- * The inferred Cedar type of the value
1374
- * @param {string} arg0
1375
- */
1376
- set data_type(arg0) {
1377
- const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1378
- const len0 = WASM_VECTOR_LEN;
1379
- wasm.__wbg_set_dataentry_data_type(this.__wbg_ptr, ptr0, len0);
1380
- }
1381
- /**
1382
- * Timestamp when this entry expires (RFC 3339 format), or null if no TTL
1383
- * @param {string | null} [arg0]
1384
- */
1385
- set expires_at(arg0) {
1386
- var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1387
- var len0 = WASM_VECTOR_LEN;
1388
- wasm.__wbg_set_dataentry_expires_at(this.__wbg_ptr, ptr0, len0);
1389
- }
1390
- /**
1391
- * The key for this entry
1392
- * @param {string} arg0
1393
- */
1394
- set key(arg0) {
1395
- const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1396
- const len0 = WASM_VECTOR_LEN;
1397
- wasm.__wbg_set_dataentry_key(this.__wbg_ptr, ptr0, len0);
1398
- }
1399
- }
1400
- if (Symbol.dispose) DataEntry.prototype[Symbol.dispose] = DataEntry.prototype.free;
1401
-
1402
- /**
1403
- * A WASM wrapper for the Rust `cedarling::DataStoreStats` struct.
1404
- * Statistics about the DataStore.
1405
- */
1406
- export class DataStoreStats {
1407
- static __wrap(ptr) {
1408
- const obj = Object.create(DataStoreStats.prototype);
1409
- obj.__wbg_ptr = ptr;
1410
- DataStoreStatsFinalization.register(obj, obj.__wbg_ptr, obj);
1411
- return obj;
1412
- }
1413
- __destroy_into_raw() {
1414
- const ptr = this.__wbg_ptr;
1415
- this.__wbg_ptr = 0;
1416
- DataStoreStatsFinalization.unregister(this);
1417
- return ptr;
1418
- }
1419
- free() {
1420
- const ptr = this.__destroy_into_raw();
1421
- wasm.__wbg_datastorestats_free(ptr, 0);
1422
- }
1423
- /**
1424
- * Convert `DataStoreStats` to json string value
1425
- * @returns {string}
1426
- */
1427
- json_string() {
1428
- let deferred1_0;
1429
- let deferred1_1;
1430
- try {
1431
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1432
- wasm.datastorestats_json_string(retptr, this.__wbg_ptr);
1433
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1434
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1435
- deferred1_0 = r0;
1436
- deferred1_1 = r1;
1437
- return getStringFromWasm0(r0, r1);
1438
- } finally {
1439
- wasm.__wbindgen_add_to_stack_pointer(16);
1440
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
1441
- }
1442
- }
1443
- /**
1444
- * Average size per entry in bytes (0 if no entries)
1445
- * @returns {number}
1446
- */
1447
- get avg_entry_size_bytes() {
1448
- const ret = wasm.__wbg_get_datastorestats_avg_entry_size_bytes(this.__wbg_ptr);
1449
- return ret >>> 0;
1450
- }
1451
- /**
1452
- * Percentage of capacity used (0.0-100.0, based on entry count)
1453
- * @returns {number}
1454
- */
1455
- get capacity_usage_percent() {
1456
- const ret = wasm.__wbg_get_datastorestats_capacity_usage_percent(this.__wbg_ptr);
1457
- return ret;
1458
- }
1459
- /**
1460
- * Number of entries currently stored
1461
- * @returns {number}
1462
- */
1463
- get entry_count() {
1464
- const ret = wasm.__wbg_get_datastorestats_entry_count(this.__wbg_ptr);
1465
- return ret >>> 0;
1466
- }
1467
- /**
1468
- * Maximum number of entries allowed (0 = unlimited)
1469
- * @returns {number}
1470
- */
1471
- get max_entries() {
1472
- const ret = wasm.__wbg_get_datastorestats_max_entries(this.__wbg_ptr);
1473
- return ret >>> 0;
1474
- }
1475
- /**
1476
- * Maximum size per entry in bytes (0 = unlimited)
1477
- * @returns {number}
1478
- */
1479
- get max_entry_size() {
1480
- const ret = wasm.__wbg_get_datastorestats_max_entry_size(this.__wbg_ptr);
1481
- return ret >>> 0;
1482
- }
1483
- /**
1484
- * Memory usage threshold percentage (from config)
1485
- * @returns {number}
1486
- */
1487
- get memory_alert_threshold() {
1488
- const ret = wasm.__wbg_get_datastorestats_memory_alert_threshold(this.__wbg_ptr);
1489
- return ret;
1490
- }
1491
- /**
1492
- * Whether memory usage exceeds the alert threshold
1493
- * @returns {boolean}
1494
- */
1495
- get memory_alert_triggered() {
1496
- const ret = wasm.__wbg_get_datastorestats_memory_alert_triggered(this.__wbg_ptr);
1497
- return ret !== 0;
1498
- }
1499
- /**
1500
- * Whether metrics tracking is enabled
1501
- * @returns {boolean}
1502
- */
1503
- get metrics_enabled() {
1504
- const ret = wasm.__wbg_get_datastorestats_metrics_enabled(this.__wbg_ptr);
1505
- return ret !== 0;
1506
- }
1507
- /**
1508
- * Total size of all entries in bytes (approximate, based on JSON serialization)
1509
- * @returns {number}
1510
- */
1511
- get total_size_bytes() {
1512
- const ret = wasm.__wbg_get_datastorestats_total_size_bytes(this.__wbg_ptr);
1513
- return ret >>> 0;
1514
- }
1515
- /**
1516
- * Average size per entry in bytes (0 if no entries)
1517
- * @param {number} arg0
1518
- */
1519
- set avg_entry_size_bytes(arg0) {
1520
- wasm.__wbg_set_datastorestats_avg_entry_size_bytes(this.__wbg_ptr, arg0);
1521
- }
1522
- /**
1523
- * Percentage of capacity used (0.0-100.0, based on entry count)
1524
- * @param {number} arg0
1525
- */
1526
- set capacity_usage_percent(arg0) {
1527
- wasm.__wbg_set_datastorestats_capacity_usage_percent(this.__wbg_ptr, arg0);
1528
- }
1529
- /**
1530
- * Number of entries currently stored
1531
- * @param {number} arg0
1532
- */
1533
- set entry_count(arg0) {
1534
- wasm.__wbg_set_datastorestats_entry_count(this.__wbg_ptr, arg0);
1535
- }
1536
- /**
1537
- * Maximum number of entries allowed (0 = unlimited)
1538
- * @param {number} arg0
1539
- */
1540
- set max_entries(arg0) {
1541
- wasm.__wbg_set_datastorestats_max_entries(this.__wbg_ptr, arg0);
1542
- }
1543
- /**
1544
- * Maximum size per entry in bytes (0 = unlimited)
1545
- * @param {number} arg0
1546
- */
1547
- set max_entry_size(arg0) {
1548
- wasm.__wbg_set_datastorestats_max_entry_size(this.__wbg_ptr, arg0);
1549
- }
1550
- /**
1551
- * Memory usage threshold percentage (from config)
1552
- * @param {number} arg0
1553
- */
1554
- set memory_alert_threshold(arg0) {
1555
- wasm.__wbg_set_datastorestats_memory_alert_threshold(this.__wbg_ptr, arg0);
1556
- }
1557
- /**
1558
- * Whether memory usage exceeds the alert threshold
1559
- * @param {boolean} arg0
1560
- */
1561
- set memory_alert_triggered(arg0) {
1562
- wasm.__wbg_set_datastorestats_memory_alert_triggered(this.__wbg_ptr, arg0);
1563
- }
1564
- /**
1565
- * Whether metrics tracking is enabled
1566
- * @param {boolean} arg0
1567
- */
1568
- set metrics_enabled(arg0) {
1569
- wasm.__wbg_set_datastorestats_metrics_enabled(this.__wbg_ptr, arg0);
1570
- }
1571
- /**
1572
- * Total size of all entries in bytes (approximate, based on JSON serialization)
1573
- * @param {number} arg0
1574
- */
1575
- set total_size_bytes(arg0) {
1576
- wasm.__wbg_set_datastorestats_total_size_bytes(this.__wbg_ptr, arg0);
1577
- }
1578
- }
1579
- if (Symbol.dispose) DataStoreStats.prototype[Symbol.dispose] = DataStoreStats.prototype.free;
1580
-
1581
- /**
1582
- * Diagnostics
1583
- * ===========
1584
- *
1585
- * Provides detailed information about how a policy decision was made, including policies that contributed to the decision and any errors encountered during evaluation.
1586
- */
1587
- export class Diagnostics {
1588
- static __wrap(ptr) {
1589
- const obj = Object.create(Diagnostics.prototype);
1590
- obj.__wbg_ptr = ptr;
1591
- DiagnosticsFinalization.register(obj, obj.__wbg_ptr, obj);
1592
- return obj;
1593
- }
1594
- __destroy_into_raw() {
1595
- const ptr = this.__wbg_ptr;
1596
- this.__wbg_ptr = 0;
1597
- DiagnosticsFinalization.unregister(this);
1598
- return ptr;
1599
- }
1600
- free() {
1601
- const ptr = this.__destroy_into_raw();
1602
- wasm.__wbg_diagnostics_free(ptr, 0);
1603
- }
1604
- /**
1605
- * Errors that occurred during authorization. The errors should be
1606
- * treated as unordered, since policies may be evaluated in any order.
1607
- * @returns {PolicyEvaluationError[]}
1608
- */
1609
- get errors() {
1610
- try {
1611
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1612
- wasm.diagnostics_errors(retptr, this.__wbg_ptr);
1613
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1614
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1615
- var v1 = getArrayJsValueFromWasm0(r0, r1);
1616
- wasm.__wbindgen_export5(r0, r1 * 4, 4);
1617
- return v1;
1618
- } finally {
1619
- wasm.__wbindgen_add_to_stack_pointer(16);
1620
- }
1621
- }
1622
- /**
1623
- * `PolicyId`s of the policies that contributed to the decision.
1624
- * If no policies applied to the request, this set will be empty.
1625
- *
1626
- * The ids should be treated as unordered,
1627
- * @returns {string[]}
1628
- */
1629
- get reason() {
1630
- try {
1631
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1632
- wasm.diagnostics_reason(retptr, this.__wbg_ptr);
1633
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1634
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1635
- var v1 = getArrayJsValueFromWasm0(r0, r1);
1636
- wasm.__wbindgen_export5(r0, r1 * 4, 4);
1637
- return v1;
1638
- } finally {
1639
- wasm.__wbindgen_add_to_stack_pointer(16);
1640
- }
1641
- }
1642
- }
1643
- if (Symbol.dispose) Diagnostics.prototype[Symbol.dispose] = Diagnostics.prototype.free;
1644
-
1645
- export class IntoUnderlyingByteSource {
1646
- __destroy_into_raw() {
1647
- const ptr = this.__wbg_ptr;
1648
- this.__wbg_ptr = 0;
1649
- IntoUnderlyingByteSourceFinalization.unregister(this);
1650
- return ptr;
1651
- }
1652
- free() {
1653
- const ptr = this.__destroy_into_raw();
1654
- wasm.__wbg_intounderlyingbytesource_free(ptr, 0);
1655
- }
1656
- /**
1657
- * @returns {number}
1658
- */
1659
- get autoAllocateChunkSize() {
1660
- const ret = wasm.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr);
1661
- return ret >>> 0;
1662
- }
1663
- cancel() {
1664
- const ptr = this.__destroy_into_raw();
1665
- wasm.intounderlyingbytesource_cancel(ptr);
1666
- }
1667
- /**
1668
- * @param {ReadableByteStreamController} controller
1669
- * @returns {Promise<any>}
1670
- */
1671
- pull(controller) {
1672
- const ret = wasm.intounderlyingbytesource_pull(this.__wbg_ptr, addHeapObject(controller));
1673
- return takeObject(ret);
1674
- }
1675
- /**
1676
- * @param {ReadableByteStreamController} controller
1677
- */
1678
- start(controller) {
1679
- wasm.intounderlyingbytesource_start(this.__wbg_ptr, addHeapObject(controller));
1680
- }
1681
- /**
1682
- * @returns {ReadableStreamType}
1683
- */
1684
- get type() {
1685
- const ret = wasm.intounderlyingbytesource_type(this.__wbg_ptr);
1686
- return __wbindgen_enum_ReadableStreamType[ret];
1687
- }
1688
- }
1689
- if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
1690
-
1691
- export class IntoUnderlyingSink {
1692
- __destroy_into_raw() {
1693
- const ptr = this.__wbg_ptr;
1694
- this.__wbg_ptr = 0;
1695
- IntoUnderlyingSinkFinalization.unregister(this);
1696
- return ptr;
1697
- }
1698
- free() {
1699
- const ptr = this.__destroy_into_raw();
1700
- wasm.__wbg_intounderlyingsink_free(ptr, 0);
1701
- }
1702
- /**
1703
- * @param {any} reason
1704
- * @returns {Promise<any>}
1705
- */
1706
- abort(reason) {
1707
- const ptr = this.__destroy_into_raw();
1708
- const ret = wasm.intounderlyingsink_abort(ptr, addHeapObject(reason));
1709
- return takeObject(ret);
1710
- }
1711
- /**
1712
- * @returns {Promise<any>}
1713
- */
1714
- close() {
1715
- const ptr = this.__destroy_into_raw();
1716
- const ret = wasm.intounderlyingsink_close(ptr);
1717
- return takeObject(ret);
1718
- }
1719
- /**
1720
- * @param {any} chunk
1721
- * @returns {Promise<any>}
1722
- */
1723
- write(chunk) {
1724
- const ret = wasm.intounderlyingsink_write(this.__wbg_ptr, addHeapObject(chunk));
1725
- return takeObject(ret);
1726
- }
1727
- }
1728
- if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
1729
-
1730
- export class IntoUnderlyingSource {
1731
- __destroy_into_raw() {
1732
- const ptr = this.__wbg_ptr;
1733
- this.__wbg_ptr = 0;
1734
- IntoUnderlyingSourceFinalization.unregister(this);
1735
- return ptr;
1736
- }
1737
- free() {
1738
- const ptr = this.__destroy_into_raw();
1739
- wasm.__wbg_intounderlyingsource_free(ptr, 0);
1740
- }
1741
- cancel() {
1742
- const ptr = this.__destroy_into_raw();
1743
- wasm.intounderlyingsource_cancel(ptr);
1744
- }
1745
- /**
1746
- * @param {ReadableStreamDefaultController} controller
1747
- * @returns {Promise<any>}
1748
- */
1749
- pull(controller) {
1750
- const ret = wasm.intounderlyingsource_pull(this.__wbg_ptr, addHeapObject(controller));
1751
- return takeObject(ret);
1752
- }
1753
- }
1754
- if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
1755
-
1756
- /**
1757
- * A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
1758
- * Represents the result of a multi-issuer authorization request.
1759
- */
1760
- export class MultiIssuerAuthorizeResult {
1761
- static __wrap(ptr) {
1762
- const obj = Object.create(MultiIssuerAuthorizeResult.prototype);
1763
- obj.__wbg_ptr = ptr;
1764
- MultiIssuerAuthorizeResultFinalization.register(obj, obj.__wbg_ptr, obj);
1765
- return obj;
1766
- }
1767
- __destroy_into_raw() {
1768
- const ptr = this.__wbg_ptr;
1769
- this.__wbg_ptr = 0;
1770
- MultiIssuerAuthorizeResultFinalization.unregister(this);
1771
- return ptr;
1772
- }
1773
- free() {
1774
- const ptr = this.__destroy_into_raw();
1775
- wasm.__wbg_multiissuerauthorizeresult_free(ptr, 0);
1776
- }
1777
- /**
1778
- * Result of authorization
1779
- * true means `ALLOW`
1780
- * false means `Deny`
1781
- * @returns {boolean}
1782
- */
1783
- get decision() {
1784
- const ret = wasm.__wbg_get_multiissuerauthorizeresult_decision(this.__wbg_ptr);
1785
- return ret !== 0;
1786
- }
1787
- /**
1788
- * Request ID of the authorization request
1789
- * @returns {string}
1790
- */
1791
- get request_id() {
1792
- let deferred1_0;
1793
- let deferred1_1;
1794
- try {
1795
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1796
- wasm.__wbg_get_multiissuerauthorizeresult_request_id(retptr, this.__wbg_ptr);
1797
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1798
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1799
- deferred1_0 = r0;
1800
- deferred1_1 = r1;
1801
- return getStringFromWasm0(r0, r1);
1802
- } finally {
1803
- wasm.__wbindgen_add_to_stack_pointer(16);
1804
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
1805
- }
1806
- }
1807
- /**
1808
- * Result of Cedar policy authorization
1809
- * @returns {AuthorizeResultResponse}
1810
- */
1811
- get response() {
1812
- const ret = wasm.__wbg_get_multiissuerauthorizeresult_response(this.__wbg_ptr);
1813
- return AuthorizeResultResponse.__wrap(ret);
1814
- }
1815
- /**
1816
- * Convert `MultiIssuerAuthorizeResult` to json string value
1817
- * @returns {string}
1818
- */
1819
- json_string() {
1820
- let deferred1_0;
1821
- let deferred1_1;
1822
- try {
1823
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1824
- wasm.multiissuerauthorizeresult_json_string(retptr, this.__wbg_ptr);
1825
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1826
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1827
- deferred1_0 = r0;
1828
- deferred1_1 = r1;
1829
- return getStringFromWasm0(r0, r1);
1830
- } finally {
1831
- wasm.__wbindgen_add_to_stack_pointer(16);
1832
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
1833
- }
1834
- }
1835
- /**
1836
- * Result of authorization
1837
- * true means `ALLOW`
1838
- * false means `Deny`
1839
- * @param {boolean} arg0
1840
- */
1841
- set decision(arg0) {
1842
- wasm.__wbg_set_multiissuerauthorizeresult_decision(this.__wbg_ptr, arg0);
1843
- }
1844
- /**
1845
- * Request ID of the authorization request
1846
- * @param {string} arg0
1847
- */
1848
- set request_id(arg0) {
1849
- const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1850
- const len0 = WASM_VECTOR_LEN;
1851
- wasm.__wbg_set_multiissuerauthorizeresult_request_id(this.__wbg_ptr, ptr0, len0);
1852
- }
1853
- /**
1854
- * Result of Cedar policy authorization
1855
- * @param {AuthorizeResultResponse} arg0
1856
- */
1857
- set response(arg0) {
1858
- _assertClass(arg0, AuthorizeResultResponse);
1859
- var ptr0 = arg0.__destroy_into_raw();
1860
- wasm.__wbg_set_multiissuerauthorizeresult_response(this.__wbg_ptr, ptr0);
1861
- }
1862
- }
1863
- if (Symbol.dispose) MultiIssuerAuthorizeResult.prototype[Symbol.dispose] = MultiIssuerAuthorizeResult.prototype.free;
1864
-
1865
- /**
1866
- * PolicyEvaluationError
1867
- * =====================
1868
- *
1869
- * Represents an error that occurred when evaluating a Cedar policy.
1870
- */
1871
- export class PolicyEvaluationError {
1872
- static __wrap(ptr) {
1873
- const obj = Object.create(PolicyEvaluationError.prototype);
1874
- obj.__wbg_ptr = ptr;
1875
- PolicyEvaluationErrorFinalization.register(obj, obj.__wbg_ptr, obj);
1876
- return obj;
1877
- }
1878
- __destroy_into_raw() {
1879
- const ptr = this.__wbg_ptr;
1880
- this.__wbg_ptr = 0;
1881
- PolicyEvaluationErrorFinalization.unregister(this);
1882
- return ptr;
1883
- }
1884
- free() {
1885
- const ptr = this.__destroy_into_raw();
1886
- wasm.__wbg_policyevaluationerror_free(ptr, 0);
1887
- }
1888
- /**
1889
- * Underlying evaluation error string representation
1890
- * @returns {string}
1891
- */
1892
- get error() {
1893
- let deferred1_0;
1894
- let deferred1_1;
1895
- try {
1896
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1897
- wasm.policyevaluationerror_error(retptr, this.__wbg_ptr);
1898
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1899
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1900
- deferred1_0 = r0;
1901
- deferred1_1 = r1;
1902
- return getStringFromWasm0(r0, r1);
1903
- } finally {
1904
- wasm.__wbindgen_add_to_stack_pointer(16);
1905
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
1906
- }
1907
- }
1908
- /**
1909
- * Id of the policy with an error
1910
- * @returns {string}
1911
- */
1912
- get id() {
1913
- let deferred1_0;
1914
- let deferred1_1;
1915
- try {
1916
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1917
- wasm.policyevaluationerror_id(retptr, this.__wbg_ptr);
1918
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1919
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1920
- deferred1_0 = r0;
1921
- deferred1_1 = r1;
1922
- return getStringFromWasm0(r0, r1);
1923
- } finally {
1924
- wasm.__wbindgen_add_to_stack_pointer(16);
1925
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
1926
- }
1927
- }
1928
- }
1929
- if (Symbol.dispose) PolicyEvaluationError.prototype[Symbol.dispose] = PolicyEvaluationError.prototype.free;
1930
-
1931
- /**
1932
- * Create a new instance of the Cedarling application.
1933
- * This function can take as config parameter the eather `Map` other `Object`
1934
- * @param {any} config
1935
- * @returns {Promise<Cedarling>}
1936
- */
1937
- export function init(config) {
1938
- const ret = wasm.init(addHeapObject(config));
1939
- return takeObject(ret);
1940
- }
1941
-
1942
- /**
1943
- * Create a new instance of the Cedarling application from archive bytes.
1944
- *
1945
- * This function allows loading a policy store from a Cedar Archive (.cjar)
1946
- * that was fetched with custom logic (e.g., with authentication headers).
1947
- *
1948
- * # Arguments
1949
- * * `config` - Bootstrap configuration (Map or Object). Policy store config is ignored.
1950
- * * `archive_bytes` - The .cjar archive bytes (Uint8Array)
1951
- *
1952
- * # Example
1953
- * ```javascript
1954
- * const response = await fetch(url, { headers: { Authorization: 'Bearer ...' } });
1955
- * const bytes = new Uint8Array(await response.arrayBuffer());
1956
- * const cedarling = await init_from_archive_bytes(config, bytes);
1957
- * ```
1958
- * @param {any} config
1959
- * @param {Uint8Array} archive_bytes
1960
- * @returns {Promise<Cedarling>}
1961
- */
1962
- export function init_from_archive_bytes(config, archive_bytes) {
1963
- const ret = wasm.init_from_archive_bytes(addHeapObject(config), addHeapObject(archive_bytes));
1964
- return takeObject(ret);
1965
- }
1966
- function __wbg_get_imports() {
1967
- const import0 = {
1968
- __proto__: null,
1969
- __wbg_Error_408e67f47ca7b58b: function(arg0, arg1) {
1970
- const ret = Error(getStringFromWasm0(arg0, arg1));
1971
- return addHeapObject(ret);
1972
- },
1973
- __wbg_Number_3890faa6d3ff057d: function(arg0) {
1974
- const ret = Number(getObject(arg0));
1975
- return ret;
1976
- },
1977
- __wbg___wbindgen_bigint_get_as_i64_c4ecf48528083721: function(arg0, arg1) {
1978
- const v = getObject(arg1);
1979
- const ret = typeof(v) === 'bigint' ? v : undefined;
1980
- getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
1981
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1982
- },
1983
- __wbg___wbindgen_boolean_get_c9c83ebd41b34df3: function(arg0) {
1984
- const v = getObject(arg0);
1985
- const ret = typeof(v) === 'boolean' ? v : undefined;
1986
- return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
1987
- },
1988
- __wbg___wbindgen_debug_string_a57024b9c6e4a48b: function(arg0, arg1) {
1989
- const ret = debugString(getObject(arg1));
1990
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1991
- const len1 = WASM_VECTOR_LEN;
1992
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1993
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1994
- },
1995
- __wbg___wbindgen_in_ac983077f137f2e6: function(arg0, arg1) {
1996
- const ret = getObject(arg0) in getObject(arg1);
1997
- return ret;
1998
- },
1999
- __wbg___wbindgen_is_bigint_8ffbbef442139384: function(arg0) {
2000
- const ret = typeof(getObject(arg0)) === 'bigint';
2001
- return ret;
2002
- },
2003
- __wbg___wbindgen_is_function_5e4570eb24ffa122: function(arg0) {
2004
- const ret = typeof(getObject(arg0)) === 'function';
2005
- return ret;
2006
- },
2007
- __wbg___wbindgen_is_object_a2790eb24c211ea0: function(arg0) {
2008
- const val = getObject(arg0);
2009
- const ret = typeof(val) === 'object' && val !== null;
2010
- return ret;
2011
- },
2012
- __wbg___wbindgen_is_string_e6f02f0ea5f20a32: function(arg0) {
2013
- const ret = typeof(getObject(arg0)) === 'string';
2014
- return ret;
2015
- },
2016
- __wbg___wbindgen_is_undefined_6cff064c44e0d823: function(arg0) {
2017
- const ret = getObject(arg0) === undefined;
2018
- return ret;
2019
- },
2020
- __wbg___wbindgen_jsval_eq_0a18949a61670320: function(arg0, arg1) {
2021
- const ret = getObject(arg0) === getObject(arg1);
2022
- return ret;
2023
- },
2024
- __wbg___wbindgen_jsval_loose_eq_acf2776254a8d832: function(arg0, arg1) {
2025
- const ret = getObject(arg0) == getObject(arg1);
2026
- return ret;
2027
- },
2028
- __wbg___wbindgen_number_get_136b9679cab35cfb: function(arg0, arg1) {
2029
- const obj = getObject(arg1);
2030
- const ret = typeof(obj) === 'number' ? obj : undefined;
2031
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
2032
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
2033
- },
2034
- __wbg___wbindgen_string_get_d154f1e671052120: function(arg0, arg1) {
2035
- const obj = getObject(arg1);
2036
- const ret = typeof(obj) === 'string' ? obj : undefined;
2037
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2038
- var len1 = WASM_VECTOR_LEN;
2039
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2040
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2041
- },
2042
- __wbg___wbindgen_throw_bb96b2010945f0bc: function(arg0, arg1) {
2043
- throw new Error(getStringFromWasm0(arg0, arg1));
2044
- },
2045
- __wbg__wbg_cb_unref_be22cc64ae6946a0: function(arg0) {
2046
- getObject(arg0)._wbg_cb_unref();
2047
- },
2048
- __wbg_abort_1254fe4ac5695dc0: function(arg0, arg1) {
2049
- getObject(arg0).abort(getObject(arg1));
2050
- },
2051
- __wbg_abort_d8615b5857e112b3: function(arg0) {
2052
- getObject(arg0).abort();
2053
- },
2054
- __wbg_append_acad6a3f39a3e778: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2055
- getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
2056
- }, arguments); },
2057
- __wbg_arrayBuffer_16433f17fbd74397: function() { return handleError(function (arg0) {
2058
- const ret = getObject(arg0).arrayBuffer();
2059
- return addHeapObject(ret);
2060
- }, arguments); },
2061
- __wbg_authorizeresult_new: function(arg0) {
2062
- const ret = AuthorizeResult.__wrap(arg0);
2063
- return addHeapObject(ret);
2064
- },
2065
- __wbg_batchauthorizemultiissuerresponse_new: function(arg0) {
2066
- const ret = BatchAuthorizeMultiIssuerResponse.__wrap(arg0);
2067
- return addHeapObject(ret);
2068
- },
2069
- __wbg_batchauthorizeunsignedresponse_new: function(arg0) {
2070
- const ret = BatchAuthorizeUnsignedResponse.__wrap(arg0);
2071
- return addHeapObject(ret);
2072
- },
2073
- __wbg_batchitemmultiissuerresult_new: function(arg0) {
2074
- const ret = BatchItemMultiIssuerResult.__wrap(arg0);
2075
- return addHeapObject(ret);
2076
- },
2077
- __wbg_batchitemunsignedresult_new: function(arg0) {
2078
- const ret = BatchItemUnsignedResult.__wrap(arg0);
2079
- return addHeapObject(ret);
2080
- },
2081
- __wbg_body_eb2e7e7701fa47ae: function(arg0) {
2082
- const ret = getObject(arg0).body;
2083
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2084
- },
2085
- __wbg_buffer_78291c0e094ccf99: function(arg0) {
2086
- const ret = getObject(arg0).buffer;
2087
- return addHeapObject(ret);
2088
- },
2089
- __wbg_byobRequest_f8b1c89429b77545: function(arg0) {
2090
- const ret = getObject(arg0).byobRequest;
2091
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2092
- },
2093
- __wbg_byteLength_336bc7d303511ba0: function(arg0) {
2094
- const ret = getObject(arg0).byteLength;
2095
- return ret;
2096
- },
2097
- __wbg_byteOffset_2b1d5b10453ce198: function(arg0) {
2098
- const ret = getObject(arg0).byteOffset;
2099
- return ret;
2100
- },
2101
- __wbg_call_1c5886ab9c57d1c7: function() { return handleError(function (arg0, arg1) {
2102
- const ret = getObject(arg0).call(getObject(arg1));
2103
- return addHeapObject(ret);
2104
- }, arguments); },
2105
- __wbg_call_35dba3c747ad7521: function() { return handleError(function (arg0, arg1, arg2) {
2106
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
2107
- return addHeapObject(ret);
2108
- }, arguments); },
2109
- __wbg_cancel_9610ed0dbe990e64: function(arg0) {
2110
- const ret = getObject(arg0).cancel();
2111
- return addHeapObject(ret);
2112
- },
2113
- __wbg_catch_8094577c3f159ad5: function(arg0, arg1) {
2114
- const ret = getObject(arg0).catch(getObject(arg1));
2115
- return addHeapObject(ret);
2116
- },
2117
- __wbg_cedarling_new: function(arg0) {
2118
- const ret = Cedarling.__wrap(arg0);
2119
- return addHeapObject(ret);
2120
- },
2121
- __wbg_clearTimeout_333bba87532ab9d3: function(arg0) {
2122
- const ret = clearTimeout(takeObject(arg0));
2123
- return addHeapObject(ret);
2124
- },
2125
- __wbg_clearTimeout_3629d6209dfcc46e: function(arg0) {
2126
- const ret = clearTimeout(takeObject(arg0));
2127
- return addHeapObject(ret);
2128
- },
2129
- __wbg_clearTimeout_c122f92fd48cd749: function(arg0) {
2130
- const ret = clearTimeout(takeObject(arg0));
2131
- return addHeapObject(ret);
2132
- },
2133
- __wbg_close_72f69f5f2de2bc73: function() { return handleError(function (arg0) {
2134
- getObject(arg0).close();
2135
- }, arguments); },
2136
- __wbg_close_97cdb44c3a7878f6: function() { return handleError(function (arg0) {
2137
- getObject(arg0).close();
2138
- }, arguments); },
2139
- __wbg_crypto_38df2bab126b63dc: function(arg0) {
2140
- const ret = getObject(arg0).crypto;
2141
- return addHeapObject(ret);
2142
- },
2143
- __wbg_dataentry_new: function(arg0) {
2144
- const ret = DataEntry.__wrap(arg0);
2145
- return addHeapObject(ret);
2146
- },
2147
- __wbg_debug_5f9689ee1e1c839f: function(arg0) {
2148
- console.debug(...getObject(arg0));
2149
- },
2150
- __wbg_done_669171204c3dcae2: function(arg0) {
2151
- const ret = getObject(arg0).done;
2152
- return ret;
2153
- },
2154
- __wbg_enqueue_7d68a21eda78e72f: function() { return handleError(function (arg0, arg1) {
2155
- getObject(arg0).enqueue(getObject(arg1));
2156
- }, arguments); },
2157
- __wbg_entries_2c710161cbd65b89: function(arg0) {
2158
- const ret = getObject(arg0).entries();
2159
- return addHeapObject(ret);
2160
- },
2161
- __wbg_entries_71601bcb707d5078: function(arg0) {
2162
- const ret = getObject(arg0).entries();
2163
- return addHeapObject(ret);
2164
- },
2165
- __wbg_entries_7774d489e1da5f4f: function(arg0) {
2166
- const ret = Object.entries(getObject(arg0));
2167
- return addHeapObject(ret);
2168
- },
2169
- __wbg_error_64ffb537ec0eda86: function(arg0) {
2170
- console.error(...getObject(arg0));
2171
- },
2172
- __wbg_fetch_074561c3e313c86f: function(arg0) {
2173
- const ret = fetch(getObject(arg0));
2174
- return addHeapObject(ret);
2175
- },
2176
- __wbg_fetch_5e2e4a3d60c8d1d3: function(arg0, arg1) {
2177
- const ret = fetch(getObject(arg0), getObject(arg1));
2178
- return addHeapObject(ret);
2179
- },
2180
- __wbg_fetch_75234d52fb417eb2: function(arg0, arg1, arg2) {
2181
- const ret = getObject(arg0).fetch(getObject(arg1), getObject(arg2));
2182
- return addHeapObject(ret);
2183
- },
2184
- __wbg_fetch_d752d93f5b259503: function(arg0, arg1) {
2185
- const ret = getObject(arg0).fetch(getObject(arg1));
2186
- return addHeapObject(ret);
2187
- },
2188
- __wbg_fromEntries_464704b0ede47aaf: function() { return handleError(function (arg0) {
2189
- const ret = Object.fromEntries(getObject(arg0));
2190
- return addHeapObject(ret);
2191
- }, arguments); },
2192
- __wbg_getRandomValues_436a51d0629d84e1: function() { return handleError(function (arg0, arg1) {
2193
- globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
2194
- }, arguments); },
2195
- __wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
2196
- getObject(arg0).getRandomValues(getObject(arg1));
2197
- }, arguments); },
2198
- __wbg_getReader_9facd4f899beac89: function() { return handleError(function (arg0) {
2199
- const ret = getObject(arg0).getReader();
2200
- return addHeapObject(ret);
2201
- }, arguments); },
2202
- __wbg_getTime_63fb0332e6c4ec17: function(arg0) {
2203
- const ret = getObject(arg0).getTime();
2204
- return ret;
2205
- },
2206
- __wbg_getTimezoneOffset_4baa793e0d3962a8: function(arg0) {
2207
- const ret = getObject(arg0).getTimezoneOffset();
2208
- return ret;
2209
- },
2210
- __wbg_get_971a0c45d172643f: function() { return handleError(function (arg0, arg1) {
2211
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
2212
- return addHeapObject(ret);
2213
- }, arguments); },
2214
- __wbg_get_c0c8f8d7da0c03dd: function(arg0, arg1) {
2215
- const ret = getObject(arg0)[arg1 >>> 0];
2216
- return addHeapObject(ret);
2217
- },
2218
- __wbg_get_d173c0308df22d37: function() { return handleError(function (arg0, arg1) {
2219
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
2220
- return addHeapObject(ret);
2221
- }, arguments); },
2222
- __wbg_get_done_ce5b5691b59c07f2: function(arg0) {
2223
- const ret = getObject(arg0).done;
2224
- return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
2225
- },
2226
- __wbg_get_unchecked_e20b893aeafc3fca: function(arg0, arg1) {
2227
- const ret = getObject(arg0)[arg1 >>> 0];
2228
- return addHeapObject(ret);
2229
- },
2230
- __wbg_get_value_58309ba057b715e1: function(arg0) {
2231
- const ret = getObject(arg0).value;
2232
- return addHeapObject(ret);
2233
- },
2234
- __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
2235
- const ret = getObject(arg0)[getObject(arg1)];
2236
- return addHeapObject(ret);
2237
- },
2238
- __wbg_has_b3a6e6d0d28295fa: function() { return handleError(function (arg0, arg1) {
2239
- const ret = Reflect.has(getObject(arg0), getObject(arg1));
2240
- return ret;
2241
- }, arguments); },
2242
- __wbg_headers_92567b07014384b9: function(arg0) {
2243
- const ret = getObject(arg0).headers;
2244
- return addHeapObject(ret);
2245
- },
2246
- __wbg_info_1fa281be98acfc08: function(arg0) {
2247
- console.info(...getObject(arg0));
2248
- },
2249
- __wbg_instanceof_ArrayBuffer_993d02d2d254cad1: function(arg0) {
2250
- let result;
2251
- try {
2252
- result = getObject(arg0) instanceof ArrayBuffer;
2253
- } catch (_) {
2254
- result = false;
2255
- }
2256
- const ret = result;
2257
- return ret;
2258
- },
2259
- __wbg_instanceof_Array_20c759966d2a22c8: function(arg0) {
2260
- let result;
2261
- try {
2262
- result = getObject(arg0) instanceof Array;
2263
- } catch (_) {
2264
- result = false;
2265
- }
2266
- const ret = result;
2267
- return ret;
2268
- },
2269
- __wbg_instanceof_Map_9a4d6ead180ae3a9: function(arg0) {
2270
- let result;
2271
- try {
2272
- result = getObject(arg0) instanceof Map;
2273
- } catch (_) {
2274
- result = false;
2275
- }
2276
- const ret = result;
2277
- return ret;
2278
- },
2279
- __wbg_instanceof_Response_8f49efbd4bfd76d6: function(arg0) {
2280
- let result;
2281
- try {
2282
- result = getObject(arg0) instanceof Response;
2283
- } catch (_) {
2284
- result = false;
2285
- }
2286
- const ret = result;
2287
- return ret;
2288
- },
2289
- __wbg_instanceof_Uint8Array_f935dbb0aa7cdeed: function(arg0) {
2290
- let result;
2291
- try {
2292
- result = getObject(arg0) instanceof Uint8Array;
2293
- } catch (_) {
2294
- result = false;
2295
- }
2296
- const ret = result;
2297
- return ret;
2298
- },
2299
- __wbg_isArray_6339f732981044bf: function(arg0) {
2300
- const ret = Array.isArray(getObject(arg0));
2301
- return ret;
2302
- },
2303
- __wbg_isSafeInteger_f3d6cd19ccfe4512: function(arg0) {
2304
- const ret = Number.isSafeInteger(getObject(arg0));
2305
- return ret;
2306
- },
2307
- __wbg_iterator_5cebbb86e33c6dd6: function() {
2308
- const ret = Symbol.iterator;
2309
- return addHeapObject(ret);
2310
- },
2311
- __wbg_keys_ec7f8c0c2370d91d: function(arg0) {
2312
- const ret = Object.keys(getObject(arg0));
2313
- return addHeapObject(ret);
2314
- },
2315
- __wbg_length_36bd29c6848c2144: function(arg0) {
2316
- const ret = getObject(arg0).length;
2317
- return ret;
2318
- },
2319
- __wbg_length_ecfa2c63d3d0d82c: function(arg0) {
2320
- const ret = getObject(arg0).length;
2321
- return ret;
2322
- },
2323
- __wbg_log_3432c886933c2c5f: function(arg0) {
2324
- console.log(...getObject(arg0));
2325
- },
2326
- __wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
2327
- const ret = getObject(arg0).msCrypto;
2328
- return addHeapObject(ret);
2329
- },
2330
- __wbg_multiissuerauthorizeresult_new: function(arg0) {
2331
- const ret = MultiIssuerAuthorizeResult.__wrap(arg0);
2332
- return addHeapObject(ret);
2333
- },
2334
- __wbg_new_0_f117d868b403dc07: function() {
2335
- const ret = new Date();
2336
- return addHeapObject(ret);
2337
- },
2338
- __wbg_new_116be93542d39019: function() {
2339
- const ret = new Array();
2340
- return addHeapObject(ret);
2341
- },
2342
- __wbg_new_358857d90afd5a2d: function(arg0, arg1) {
2343
- const ret = new Error(getStringFromWasm0(arg0, arg1));
2344
- return addHeapObject(ret);
2345
- },
2346
- __wbg_new_77cc4f4f472aeb81: function(arg0) {
2347
- const ret = new Uint8Array(getObject(arg0));
2348
- return addHeapObject(ret);
2349
- },
2350
- __wbg_new_95039e162b0c4466: function() { return handleError(function () {
2351
- const ret = new Headers();
2352
- return addHeapObject(ret);
2353
- }, arguments); },
2354
- __wbg_new_cdf041679ded4c5f: function() {
2355
- const ret = new Map();
2356
- return addHeapObject(ret);
2357
- },
2358
- __wbg_new_ebe3e0f6837f0879: function() {
2359
- const ret = new Object();
2360
- return addHeapObject(ret);
2361
- },
2362
- __wbg_new_f5712de39c931ddf: function() { return handleError(function () {
2363
- const ret = new AbortController();
2364
- return addHeapObject(ret);
2365
- }, arguments); },
2366
- __wbg_new_f9d6489212f3b2b3: function(arg0) {
2367
- const ret = new Date(getObject(arg0));
2368
- return addHeapObject(ret);
2369
- },
2370
- __wbg_new_from_slice_3eea173078478cfe: function(arg0, arg1) {
2371
- const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
2372
- return addHeapObject(ret);
2373
- },
2374
- __wbg_new_typed_cceaf62d8d95e9f2: function(arg0, arg1) {
2375
- try {
2376
- var state0 = {a: arg0, b: arg1};
2377
- var cb0 = (arg0, arg1) => {
2378
- const a = state0.a;
2379
- state0.a = 0;
2380
- try {
2381
- return __wasm_bindgen_func_elem_8972(a, state0.b, arg0, arg1);
2382
- } finally {
2383
- state0.a = a;
2384
- }
2385
- };
2386
- const ret = new Promise(cb0);
2387
- return addHeapObject(ret);
2388
- } finally {
2389
- state0.a = 0;
2390
- }
2391
- },
2392
- __wbg_new_with_byte_offset_and_length_ff6e927f8d72f0c3: function(arg0, arg1, arg2) {
2393
- const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
2394
- return addHeapObject(ret);
2395
- },
2396
- __wbg_new_with_length_3ffc1c56427c525c: function(arg0) {
2397
- const ret = new Uint8Array(arg0 >>> 0);
2398
- return addHeapObject(ret);
2399
- },
2400
- __wbg_new_with_str_and_init_5a37d576dec75a86: function() { return handleError(function (arg0, arg1, arg2) {
2401
- const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
2402
- return addHeapObject(ret);
2403
- }, arguments); },
2404
- __wbg_next_42cf16ee0dafc9e2: function() { return handleError(function (arg0) {
2405
- const ret = getObject(arg0).next();
2406
- return addHeapObject(ret);
2407
- }, arguments); },
2408
- __wbg_next_8f26b64fa5e9f64b: function(arg0) {
2409
- const ret = getObject(arg0).next;
2410
- return addHeapObject(ret);
2411
- },
2412
- __wbg_node_84ea875411254db1: function(arg0) {
2413
- const ret = getObject(arg0).node;
2414
- return addHeapObject(ret);
2415
- },
2416
- __wbg_policyevaluationerror_new: function(arg0) {
2417
- const ret = PolicyEvaluationError.__wrap(arg0);
2418
- return addHeapObject(ret);
2419
- },
2420
- __wbg_process_44c7a14e11e9f69e: function(arg0) {
2421
- const ret = getObject(arg0).process;
2422
- return addHeapObject(ret);
2423
- },
2424
- __wbg_prototypesetcall_de8e0d9553586985: function(arg0, arg1, arg2) {
2425
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
2426
- },
2427
- __wbg_push_adb0107829f02d75: function(arg0, arg1) {
2428
- const ret = getObject(arg0).push(getObject(arg1));
2429
- return ret;
2430
- },
2431
- __wbg_queueMicrotask_ac694eae12e92dfb: function(arg0) {
2432
- queueMicrotask(getObject(arg0));
2433
- },
2434
- __wbg_queueMicrotask_be5fe34a8f4cad4d: function(arg0) {
2435
- const ret = getObject(arg0).queueMicrotask;
2436
- return addHeapObject(ret);
2437
- },
2438
- __wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
2439
- getObject(arg0).randomFillSync(takeObject(arg1));
2440
- }, arguments); },
2441
- __wbg_read_ae34ffedeb11f034: function(arg0) {
2442
- const ret = getObject(arg0).read();
2443
- return addHeapObject(ret);
2444
- },
2445
- __wbg_releaseLock_f38d2d1c08212a8a: function(arg0) {
2446
- getObject(arg0).releaseLock();
2447
- },
2448
- __wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
2449
- const ret = module.require;
2450
- return addHeapObject(ret);
2451
- }, arguments); },
2452
- __wbg_resolve_020f95d838c6ef25: function(arg0) {
2453
- const ret = Promise.resolve(getObject(arg0));
2454
- return addHeapObject(ret);
2455
- },
2456
- __wbg_respond_f88cbcebace42068: function() { return handleError(function (arg0, arg1) {
2457
- getObject(arg0).respond(arg1 >>> 0);
2458
- }, arguments); },
2459
- __wbg_setTimeout_3a808dd861dd3c12: function(arg0, arg1) {
2460
- const ret = setTimeout(getObject(arg0), arg1);
2461
- return addHeapObject(ret);
2462
- },
2463
- __wbg_setTimeout_56bcdccbad22fd44: function() { return handleError(function (arg0, arg1) {
2464
- const ret = setTimeout(getObject(arg0), arg1);
2465
- return addHeapObject(ret);
2466
- }, arguments); },
2467
- __wbg_setTimeout_9f4169770fc5a5c3: function(arg0, arg1) {
2468
- const ret = setTimeout(getObject(arg0), arg1);
2469
- return addHeapObject(ret);
2470
- },
2471
- __wbg_set_014226dfeca53178: function(arg0, arg1, arg2) {
2472
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
2473
- return addHeapObject(ret);
2474
- },
2475
- __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
2476
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
2477
- },
2478
- __wbg_set_8155bb79a948541b: function() { return handleError(function (arg0, arg1, arg2) {
2479
- const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
2480
- return ret;
2481
- }, arguments); },
2482
- __wbg_set_a80955eb93b145c6: function(arg0, arg1, arg2) {
2483
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
2484
- },
2485
- __wbg_set_b9b5b5cb7b495037: function(arg0, arg1, arg2) {
2486
- getObject(arg0).set(getArrayU8FromWasm0(arg1, arg2));
2487
- },
2488
- __wbg_set_body_f301b68bff45f419: function(arg0, arg1) {
2489
- getObject(arg0).body = getObject(arg1);
2490
- },
2491
- __wbg_set_cache_ab8f11813716fe29: function(arg0, arg1) {
2492
- getObject(arg0).cache = __wbindgen_enum_RequestCache[arg1];
2493
- },
2494
- __wbg_set_credentials_d7f3b810cbf191e1: function(arg0, arg1) {
2495
- getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
2496
- },
2497
- __wbg_set_e92392c4b44c5de1: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2498
- getObject(arg0).set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
2499
- }, arguments); },
2500
- __wbg_set_headers_805555608daf7f2a: function(arg0, arg1) {
2501
- getObject(arg0).headers = getObject(arg1);
2502
- },
2503
- __wbg_set_integrity_c05dca79461dfe0a: function(arg0, arg1, arg2) {
2504
- getObject(arg0).integrity = getStringFromWasm0(arg1, arg2);
2505
- },
2506
- __wbg_set_method_cf2b992b9a610bc3: function(arg0, arg1, arg2) {
2507
- getObject(arg0).method = getStringFromWasm0(arg1, arg2);
2508
- },
2509
- __wbg_set_mode_d6479dfd6696c8d3: function(arg0, arg1) {
2510
- getObject(arg0).mode = __wbindgen_enum_RequestMode[arg1];
2511
- },
2512
- __wbg_set_redirect_9d53fb52143d8ea4: function(arg0, arg1) {
2513
- getObject(arg0).redirect = __wbindgen_enum_RequestRedirect[arg1];
2514
- },
2515
- __wbg_set_referrer_de24582cadb58b95: function(arg0, arg1, arg2) {
2516
- getObject(arg0).referrer = getStringFromWasm0(arg1, arg2);
2517
- },
2518
- __wbg_set_referrer_policy_3f990097931e92b7: function(arg0, arg1) {
2519
- getObject(arg0).referrerPolicy = __wbindgen_enum_ReferrerPolicy[arg1];
2520
- },
2521
- __wbg_set_signal_115b9e9423652e66: function(arg0, arg1) {
2522
- getObject(arg0).signal = getObject(arg1);
2523
- },
2524
- __wbg_signal_58449b7eb331d1be: function(arg0) {
2525
- const ret = getObject(arg0).signal;
2526
- return addHeapObject(ret);
2527
- },
2528
- __wbg_static_accessor_GLOBAL_THIS_466428f93b4eaa76: function() {
2529
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
2530
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2531
- },
2532
- __wbg_static_accessor_GLOBAL_c7aea38d4de089bc: function() {
2533
- const ret = typeof global === 'undefined' ? null : global;
2534
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2535
- },
2536
- __wbg_static_accessor_SELF_42d4fae05e59267a: function() {
2537
- const ret = typeof self === 'undefined' ? null : self;
2538
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2539
- },
2540
- __wbg_static_accessor_WINDOW_e0db14a0eba6a812: function() {
2541
- const ret = typeof window === 'undefined' ? null : window;
2542
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2543
- },
2544
- __wbg_status_b0de02a07fd7d927: function(arg0) {
2545
- const ret = getObject(arg0).status;
2546
- return ret;
2547
- },
2548
- __wbg_subarray_a4cc58201c7359fd: function(arg0, arg1, arg2) {
2549
- const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
2550
- return addHeapObject(ret);
2551
- },
2552
- __wbg_then_7026b513a94278a8: function(arg0, arg1) {
2553
- const ret = getObject(arg0).then(getObject(arg1));
2554
- return addHeapObject(ret);
2555
- },
2556
- __wbg_then_72819b8d4e081fb5: function(arg0, arg1, arg2) {
2557
- const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
2558
- return addHeapObject(ret);
2559
- },
2560
- __wbg_toString_2f0b0aec069cb718: function(arg0) {
2561
- const ret = getObject(arg0).toString();
2562
- return addHeapObject(ret);
2563
- },
2564
- __wbg_trace_f39eacb57667b538: function(arg0) {
2565
- console.trace(...getObject(arg0));
2566
- },
2567
- __wbg_url_82c95d5d2e2ba977: function(arg0, arg1) {
2568
- const ret = getObject(arg1).url;
2569
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2570
- const len1 = WASM_VECTOR_LEN;
2571
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2572
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2573
- },
2574
- __wbg_value_1e2369fab29b420e: function(arg0) {
2575
- const ret = getObject(arg0).value;
2576
- return addHeapObject(ret);
2577
- },
2578
- __wbg_versions_276b2795b1c6a219: function(arg0) {
2579
- const ret = getObject(arg0).versions;
2580
- return addHeapObject(ret);
2581
- },
2582
- __wbg_view_7685fe4b2845c5b6: function(arg0) {
2583
- const ret = getObject(arg0).view;
2584
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2585
- },
2586
- __wbg_warn_f0d66a42df9a1e7b: function(arg0) {
2587
- console.warn(...getObject(arg0));
2588
- },
2589
- __wbindgen_cast_0000000000000001: function(arg0, arg1) {
2590
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1007, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2591
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_8906);
2592
- return addHeapObject(ret);
2593
- },
2594
- __wbindgen_cast_0000000000000002: function(arg0, arg1) {
2595
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1203, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2596
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_12458);
2597
- return addHeapObject(ret);
2598
- },
2599
- __wbindgen_cast_0000000000000003: function(arg0, arg1) {
2600
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 1000, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2601
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_8741);
2602
- return addHeapObject(ret);
2603
- },
2604
- __wbindgen_cast_0000000000000004: function(arg0) {
2605
- // Cast intrinsic for `F64 -> Externref`.
2606
- const ret = arg0;
2607
- return addHeapObject(ret);
2608
- },
2609
- __wbindgen_cast_0000000000000005: function(arg0) {
2610
- // Cast intrinsic for `I64 -> Externref`.
2611
- const ret = arg0;
2612
- return addHeapObject(ret);
2613
- },
2614
- __wbindgen_cast_0000000000000006: function(arg0, arg1) {
2615
- // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
2616
- const ret = getArrayU8FromWasm0(arg0, arg1);
2617
- return addHeapObject(ret);
2618
- },
2619
- __wbindgen_cast_0000000000000007: function(arg0, arg1) {
2620
- // Cast intrinsic for `Ref(String) -> Externref`.
2621
- const ret = getStringFromWasm0(arg0, arg1);
2622
- return addHeapObject(ret);
2623
- },
2624
- __wbindgen_cast_0000000000000008: function(arg0) {
2625
- // Cast intrinsic for `U64 -> Externref`.
2626
- const ret = BigInt.asUintN(64, arg0);
2627
- return addHeapObject(ret);
2628
- },
2629
- __wbindgen_object_clone_ref: function(arg0) {
2630
- const ret = getObject(arg0);
2631
- return addHeapObject(ret);
2632
- },
2633
- __wbindgen_object_drop_ref: function(arg0) {
2634
- takeObject(arg0);
2635
- },
2636
- };
2637
- return {
2638
- __proto__: null,
2639
- "./cedarling_wasm_bg.js": import0,
2640
- };
2641
- }
2642
-
2643
- function __wasm_bindgen_func_elem_8741(arg0, arg1) {
2644
- wasm.__wasm_bindgen_func_elem_8741(arg0, arg1);
2645
- }
2646
-
2647
- function __wasm_bindgen_func_elem_12458(arg0, arg1, arg2) {
2648
- wasm.__wasm_bindgen_func_elem_12458(arg0, arg1, addHeapObject(arg2));
2649
- }
2650
-
2651
- function __wasm_bindgen_func_elem_8906(arg0, arg1, arg2) {
2652
- try {
2653
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2654
- wasm.__wasm_bindgen_func_elem_8906(retptr, arg0, arg1, addHeapObject(arg2));
2655
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2656
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2657
- if (r1) {
2658
- throw takeObject(r0);
2659
- }
2660
- } finally {
2661
- wasm.__wbindgen_add_to_stack_pointer(16);
2662
- }
2663
- }
2664
-
2665
- function __wasm_bindgen_func_elem_8972(arg0, arg1, arg2, arg3) {
2666
- wasm.__wasm_bindgen_func_elem_8972(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
2667
- }
2668
-
2669
-
2670
- const __wbindgen_enum_ReadableStreamType = ["bytes"];
2671
-
2672
-
2673
- 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"];
2674
-
2675
-
2676
- const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
2677
-
2678
-
2679
- const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
2680
-
2681
-
2682
- const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
2683
-
2684
-
2685
- const __wbindgen_enum_RequestRedirect = ["follow", "error", "manual"];
2686
- const AuthorizeResultFinalization = (typeof FinalizationRegistry === 'undefined')
2687
- ? { register: () => {}, unregister: () => {} }
2688
- : new FinalizationRegistry(ptr => wasm.__wbg_authorizeresult_free(ptr, 1));
2689
- const AuthorizeResultResponseFinalization = (typeof FinalizationRegistry === 'undefined')
2690
- ? { register: () => {}, unregister: () => {} }
2691
- : new FinalizationRegistry(ptr => wasm.__wbg_authorizeresultresponse_free(ptr, 1));
2692
- const BatchAuthorizeMultiIssuerResponseFinalization = (typeof FinalizationRegistry === 'undefined')
2693
- ? { register: () => {}, unregister: () => {} }
2694
- : new FinalizationRegistry(ptr => wasm.__wbg_batchauthorizemultiissuerresponse_free(ptr, 1));
2695
- const BatchAuthorizeUnsignedResponseFinalization = (typeof FinalizationRegistry === 'undefined')
2696
- ? { register: () => {}, unregister: () => {} }
2697
- : new FinalizationRegistry(ptr => wasm.__wbg_batchauthorizeunsignedresponse_free(ptr, 1));
2698
- const BatchItemErrorFinalization = (typeof FinalizationRegistry === 'undefined')
2699
- ? { register: () => {}, unregister: () => {} }
2700
- : new FinalizationRegistry(ptr => wasm.__wbg_batchitemerror_free(ptr, 1));
2701
- const BatchItemMultiIssuerResultFinalization = (typeof FinalizationRegistry === 'undefined')
2702
- ? { register: () => {}, unregister: () => {} }
2703
- : new FinalizationRegistry(ptr => wasm.__wbg_batchitemmultiissuerresult_free(ptr, 1));
2704
- const BatchItemUnsignedResultFinalization = (typeof FinalizationRegistry === 'undefined')
2705
- ? { register: () => {}, unregister: () => {} }
2706
- : new FinalizationRegistry(ptr => wasm.__wbg_batchitemunsignedresult_free(ptr, 1));
2707
- const CedarlingFinalization = (typeof FinalizationRegistry === 'undefined')
2708
- ? { register: () => {}, unregister: () => {} }
2709
- : new FinalizationRegistry(ptr => wasm.__wbg_cedarling_free(ptr, 1));
2710
- const DataEntryFinalization = (typeof FinalizationRegistry === 'undefined')
2711
- ? { register: () => {}, unregister: () => {} }
2712
- : new FinalizationRegistry(ptr => wasm.__wbg_dataentry_free(ptr, 1));
2713
- const DataStoreStatsFinalization = (typeof FinalizationRegistry === 'undefined')
2714
- ? { register: () => {}, unregister: () => {} }
2715
- : new FinalizationRegistry(ptr => wasm.__wbg_datastorestats_free(ptr, 1));
2716
- const DiagnosticsFinalization = (typeof FinalizationRegistry === 'undefined')
2717
- ? { register: () => {}, unregister: () => {} }
2718
- : new FinalizationRegistry(ptr => wasm.__wbg_diagnostics_free(ptr, 1));
2719
- const IntoUnderlyingByteSourceFinalization = (typeof FinalizationRegistry === 'undefined')
2720
- ? { register: () => {}, unregister: () => {} }
2721
- : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingbytesource_free(ptr, 1));
2722
- const IntoUnderlyingSinkFinalization = (typeof FinalizationRegistry === 'undefined')
2723
- ? { register: () => {}, unregister: () => {} }
2724
- : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsink_free(ptr, 1));
2725
- const IntoUnderlyingSourceFinalization = (typeof FinalizationRegistry === 'undefined')
2726
- ? { register: () => {}, unregister: () => {} }
2727
- : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsource_free(ptr, 1));
2728
- const MultiIssuerAuthorizeResultFinalization = (typeof FinalizationRegistry === 'undefined')
2729
- ? { register: () => {}, unregister: () => {} }
2730
- : new FinalizationRegistry(ptr => wasm.__wbg_multiissuerauthorizeresult_free(ptr, 1));
2731
- const PolicyEvaluationErrorFinalization = (typeof FinalizationRegistry === 'undefined')
2732
- ? { register: () => {}, unregister: () => {} }
2733
- : new FinalizationRegistry(ptr => wasm.__wbg_policyevaluationerror_free(ptr, 1));
2734
-
2735
- function addHeapObject(obj) {
2736
- if (heap_next === heap.length) heap.push(heap.length + 1);
2737
- const idx = heap_next;
2738
- heap_next = heap[idx];
2739
-
2740
- heap[idx] = obj;
2741
- return idx;
2742
- }
2743
-
2744
- function _assertClass(instance, klass) {
2745
- if (!(instance instanceof klass)) {
2746
- throw new Error(`expected instance of ${klass.name}`);
2747
- }
2748
- }
2749
-
2750
- const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
2751
- ? { register: () => {}, unregister: () => {} }
2752
- : new FinalizationRegistry(state => wasm.__wbindgen_export4(state.a, state.b));
2753
-
2754
- function debugString(val) {
2755
- // primitive types
2756
- const type = typeof val;
2757
- if (type == 'number' || type == 'boolean' || val == null) {
2758
- return `${val}`;
2759
- }
2760
- if (type == 'string') {
2761
- return `"${val}"`;
2762
- }
2763
- if (type == 'symbol') {
2764
- const description = val.description;
2765
- if (description == null) {
2766
- return 'Symbol';
2767
- } else {
2768
- return `Symbol(${description})`;
2769
- }
2770
- }
2771
- if (type == 'function') {
2772
- const name = val.name;
2773
- if (typeof name == 'string' && name.length > 0) {
2774
- return `Function(${name})`;
2775
- } else {
2776
- return 'Function';
2777
- }
2778
- }
2779
- // objects
2780
- if (Array.isArray(val)) {
2781
- const length = val.length;
2782
- let debug = '[';
2783
- if (length > 0) {
2784
- debug += debugString(val[0]);
2785
- }
2786
- for(let i = 1; i < length; i++) {
2787
- debug += ', ' + debugString(val[i]);
2788
- }
2789
- debug += ']';
2790
- return debug;
2791
- }
2792
- // Test for built-in
2793
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
2794
- let className;
2795
- if (builtInMatches && builtInMatches.length > 1) {
2796
- className = builtInMatches[1];
2797
- } else {
2798
- // Failed to match the standard '[object ClassName]'
2799
- return toString.call(val);
2800
- }
2801
- if (className == 'Object') {
2802
- // we're a user defined class or Object
2803
- // JSON.stringify avoids problems with cycles, and is generally much
2804
- // easier than looping through ownProperties of `val`.
2805
- try {
2806
- return 'Object(' + JSON.stringify(val) + ')';
2807
- } catch (_) {
2808
- return 'Object';
2809
- }
2810
- }
2811
- // errors
2812
- if (val instanceof Error) {
2813
- return `${val.name}: ${val.message}\n${val.stack}`;
2814
- }
2815
- // TODO we could test for more things here, like `Set`s and `Map`s.
2816
- return className;
2817
- }
2818
-
2819
- function dropObject(idx) {
2820
- if (idx < 1028) return;
2821
- heap[idx] = heap_next;
2822
- heap_next = idx;
2823
- }
2824
-
2825
- function getArrayJsValueFromWasm0(ptr, len) {
2826
- ptr = ptr >>> 0;
2827
- const mem = getDataViewMemory0();
2828
- const result = [];
2829
- for (let i = ptr; i < ptr + 4 * len; i += 4) {
2830
- result.push(takeObject(mem.getUint32(i, true)));
2831
- }
2832
- return result;
2833
- }
2834
-
2835
- function getArrayU8FromWasm0(ptr, len) {
2836
- ptr = ptr >>> 0;
2837
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
2838
- }
2839
-
2840
- let cachedDataViewMemory0 = null;
2841
- function getDataViewMemory0() {
2842
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
2843
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
2844
- }
2845
- return cachedDataViewMemory0;
2846
- }
2847
-
2848
- function getStringFromWasm0(ptr, len) {
2849
- return decodeText(ptr >>> 0, len);
2850
- }
2851
-
2852
- let cachedUint8ArrayMemory0 = null;
2853
- function getUint8ArrayMemory0() {
2854
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
2855
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
2856
- }
2857
- return cachedUint8ArrayMemory0;
2858
- }
2859
-
2860
- function getObject(idx) { return heap[idx]; }
2861
-
2862
- function handleError(f, args) {
2863
- try {
2864
- return f.apply(this, args);
2865
- } catch (e) {
2866
- wasm.__wbindgen_export3(addHeapObject(e));
2867
- }
2868
- }
2869
-
2870
- let heap = new Array(1024).fill(undefined);
2871
- heap.push(undefined, null, true, false);
2872
-
2873
- let heap_next = heap.length;
2874
-
2875
- function isLikeNone(x) {
2876
- return x === undefined || x === null;
2877
- }
2878
-
2879
- function makeMutClosure(arg0, arg1, f) {
2880
- const state = { a: arg0, b: arg1, cnt: 1 };
2881
- const real = (...args) => {
2882
-
2883
- // First up with a closure we increment the internal reference
2884
- // count. This ensures that the Rust closure environment won't
2885
- // be deallocated while we're invoking it.
2886
- state.cnt++;
2887
- const a = state.a;
2888
- state.a = 0;
2889
- try {
2890
- return f(a, state.b, ...args);
2891
- } finally {
2892
- state.a = a;
2893
- real._wbg_cb_unref();
2894
- }
2895
- };
2896
- real._wbg_cb_unref = () => {
2897
- if (--state.cnt === 0) {
2898
- wasm.__wbindgen_export4(state.a, state.b);
2899
- state.a = 0;
2900
- CLOSURE_DTORS.unregister(state);
2901
- }
2902
- };
2903
- CLOSURE_DTORS.register(real, state, state);
2904
- return real;
2905
- }
2906
-
2907
- function passArrayJsValueToWasm0(array, malloc) {
2908
- const ptr = malloc(array.length * 4, 4) >>> 0;
2909
- const mem = getDataViewMemory0();
2910
- for (let i = 0; i < array.length; i++) {
2911
- mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
2912
- }
2913
- WASM_VECTOR_LEN = array.length;
2914
- return ptr;
2915
- }
2916
-
2917
- function passStringToWasm0(arg, malloc, realloc) {
2918
- if (realloc === undefined) {
2919
- const buf = cachedTextEncoder.encode(arg);
2920
- const ptr = malloc(buf.length, 1) >>> 0;
2921
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
2922
- WASM_VECTOR_LEN = buf.length;
2923
- return ptr;
2924
- }
2925
-
2926
- let len = arg.length;
2927
- let ptr = malloc(len, 1) >>> 0;
2928
-
2929
- const mem = getUint8ArrayMemory0();
2930
-
2931
- let offset = 0;
2932
-
2933
- for (; offset < len; offset++) {
2934
- const code = arg.charCodeAt(offset);
2935
- if (code > 0x7F) break;
2936
- mem[ptr + offset] = code;
2937
- }
2938
- if (offset !== len) {
2939
- if (offset !== 0) {
2940
- arg = arg.slice(offset);
2941
- }
2942
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
2943
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
2944
- const ret = cachedTextEncoder.encodeInto(arg, view);
2945
-
2946
- offset += ret.written;
2947
- ptr = realloc(ptr, len, offset, 1) >>> 0;
2948
- }
2949
-
2950
- WASM_VECTOR_LEN = offset;
2951
- return ptr;
2952
- }
2953
-
2954
- function takeObject(idx) {
2955
- const ret = getObject(idx);
2956
- dropObject(idx);
2957
- return ret;
2958
- }
2959
-
2960
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2961
- cachedTextDecoder.decode();
2962
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
2963
- let numBytesDecoded = 0;
2964
- function decodeText(ptr, len) {
2965
- numBytesDecoded += len;
2966
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
2967
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2968
- cachedTextDecoder.decode();
2969
- numBytesDecoded = len;
2970
- }
2971
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
2972
- }
2973
-
2974
- const cachedTextEncoder = new TextEncoder();
2975
-
2976
- if (!('encodeInto' in cachedTextEncoder)) {
2977
- cachedTextEncoder.encodeInto = function (arg, view) {
2978
- const buf = cachedTextEncoder.encode(arg);
2979
- view.set(buf);
2980
- return {
2981
- read: arg.length,
2982
- written: buf.length
2983
- };
2984
- };
2985
- }
2986
-
2987
- let WASM_VECTOR_LEN = 0;
2988
-
2989
- let wasmModule, wasmInstance, wasm;
2990
- function __wbg_finalize_init(instance, module) {
2991
- wasmInstance = instance;
2992
- wasm = instance.exports;
2993
- wasmModule = module;
2994
- cachedDataViewMemory0 = null;
2995
- cachedUint8ArrayMemory0 = null;
2996
- return wasm;
2997
- }
2998
-
2999
- async function __wbg_load(module, imports) {
3000
- if (typeof Response === 'function' && module instanceof Response) {
3001
- if (!module.ok) {
3002
- throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
3003
- }
3004
-
3005
- if (typeof WebAssembly.instantiateStreaming === 'function') {
3006
- try {
3007
- return await WebAssembly.instantiateStreaming(module, imports);
3008
- } catch (e) {
3009
- const validResponse = expectedResponseType(module.type);
3010
-
3011
- if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
3012
- 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);
3013
-
3014
- } else { throw e; }
3015
- }
3016
- }
3017
-
3018
- const bytes = await module.arrayBuffer();
3019
- return await WebAssembly.instantiate(bytes, imports);
3020
- } else {
3021
- const instance = await WebAssembly.instantiate(module, imports);
3022
-
3023
- if (instance instanceof WebAssembly.Instance) {
3024
- return { instance, module };
3025
- } else {
3026
- return instance;
3027
- }
3028
- }
3029
-
3030
- function expectedResponseType(type) {
3031
- switch (type) {
3032
- case 'basic': case 'cors': case 'default': return true;
3033
- }
3034
- return false;
3035
- }
3036
- }
3037
-
3038
- function initSync(module) {
3039
- if (wasm !== undefined) return wasm;
3040
-
3041
-
3042
- if (module !== undefined) {
3043
- if (Object.getPrototypeOf(module) === Object.prototype) {
3044
- ({module} = module)
3045
- } else {
3046
- console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
3047
- }
3048
- }
3049
-
3050
- const imports = __wbg_get_imports();
3051
- if (!(module instanceof WebAssembly.Module)) {
3052
- module = new WebAssembly.Module(module);
3053
- }
3054
- const instance = new WebAssembly.Instance(module, imports);
3055
- return __wbg_finalize_init(instance, module);
3056
- }
3057
-
3058
- async function __wbg_init(module_or_path) {
3059
- if (wasm !== undefined) return wasm;
3060
-
3061
-
3062
- if (module_or_path !== undefined) {
3063
- if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
3064
- ({module_or_path} = module_or_path)
3065
- } else {
3066
- console.warn('using deprecated parameters for the initialization function; pass a single object instead')
3067
- }
3068
- }
3069
-
3070
- if (module_or_path === undefined) {
3071
- module_or_path = new URL('cedarling_wasm_bg.wasm', import.meta.url);
3072
- }
3073
- const imports = __wbg_get_imports();
3074
-
3075
- if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
3076
- module_or_path = fetch(module_or_path);
3077
- }
3078
-
3079
- const { instance, module } = await __wbg_load(await module_or_path, imports);
3080
-
3081
- return __wbg_finalize_init(instance, module);
3082
- }
3083
-
3084
- export { initSync, __wbg_init as default };