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