@janssenproject/cedarling_wasm 0.0.420 → 0.0.421

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.
@@ -56,6 +56,116 @@ export class AuthorizeResultResponse {
56
56
  readonly diagnostics: Diagnostics;
57
57
  }
58
58
 
59
+ /**
60
+ * WASM wrapper for
61
+ * `cedarling::BatchAuthorizeResponse<Result<MultiIssuerAuthorizeResult, BatchItemError>>`.
62
+ * Same shape as [`BatchAuthorizeUnsignedResponse`] with multi-issuer results.
63
+ */
64
+ export class BatchAuthorizeMultiIssuerResponse {
65
+ private constructor();
66
+ free(): void;
67
+ [Symbol.dispose](): void;
68
+ /**
69
+ * Shared correlation id stamped on every per-item decision log entry.
70
+ */
71
+ readonly batch_id: string;
72
+ /**
73
+ * Per-item results in input order — each slot is a
74
+ * [`BatchItemMultiIssuerResult`].
75
+ */
76
+ readonly results: BatchItemMultiIssuerResult[];
77
+ }
78
+
79
+ /**
80
+ * WASM wrapper for `cedarling::BatchAuthorizeResponse<Result<AuthorizeResult, BatchItemError>>`.
81
+ *
82
+ * Carries a shared `batch_id` (UUIDv7) alongside per-item results. Each result
83
+ * is a [`BatchItemUnsignedResult`] — Cedar decision on `is_ok()`, per-item
84
+ * build failure on `error`. `results[i]` corresponds to `items[i]`.
85
+ */
86
+ export class BatchAuthorizeUnsignedResponse {
87
+ private constructor();
88
+ free(): void;
89
+ [Symbol.dispose](): void;
90
+ /**
91
+ * Shared correlation id stamped on every per-item decision log entry.
92
+ */
93
+ readonly batch_id: string;
94
+ /**
95
+ * Per-item results in input order — each slot is a
96
+ * [`BatchItemUnsignedResult`].
97
+ */
98
+ readonly results: BatchItemUnsignedResult[];
99
+ }
100
+
101
+ /**
102
+ * Per-item build failure surfaced inside a batch response at `results[i]`
103
+ * when Cedar couldn't be reached for that item.
104
+ */
105
+ export class BatchItemError {
106
+ private constructor();
107
+ free(): void;
108
+ [Symbol.dispose](): void;
109
+ /**
110
+ * Stable variant slug — `action_parse`, `resource_build`, `context_build`,
111
+ * `principal_build`, `schema_validation`, `multi_issuer_entity`,
112
+ * `request_validation`.
113
+ */
114
+ readonly category: string;
115
+ /**
116
+ * Position of the failing item in the original `items` vector.
117
+ */
118
+ readonly item_index: number;
119
+ /**
120
+ * Human-readable diagnostic. Safe to log.
121
+ */
122
+ readonly message: string;
123
+ }
124
+
125
+ /**
126
+ * Multi-issuer analog of [`BatchItemUnsignedResult`].
127
+ */
128
+ export class BatchItemMultiIssuerResult {
129
+ private constructor();
130
+ free(): void;
131
+ [Symbol.dispose](): void;
132
+ /**
133
+ * The multi-issuer decision if `is_ok()`; throws otherwise.
134
+ */
135
+ unwrap(): MultiIssuerAuthorizeResult;
136
+ /**
137
+ * The per-item error if `!is_ok()`; `undefined` otherwise.
138
+ */
139
+ readonly error: BatchItemError | undefined;
140
+ /**
141
+ * `true` when Cedar evaluated this item.
142
+ */
143
+ readonly is_ok: boolean;
144
+ }
145
+
146
+ /**
147
+ * One slot in a batch response's `results` array. Callers switch on
148
+ * `is_ok()` — on `true`, read `unwrap()`; on `false`, read `error()`.
149
+ */
150
+ export class BatchItemUnsignedResult {
151
+ private constructor();
152
+ free(): void;
153
+ [Symbol.dispose](): void;
154
+ /**
155
+ * The Cedar decision if `is_ok()`; throws otherwise.
156
+ */
157
+ unwrap(): AuthorizeResult;
158
+ /**
159
+ * The per-item error if `!is_ok()`; `undefined` otherwise.
160
+ */
161
+ readonly error: BatchItemError | undefined;
162
+ /**
163
+ * `true` when Cedar evaluated this item (Allow or Deny); `false` when it
164
+ * failed to build.
165
+ */
166
+ readonly is_ok: boolean;
167
+ }
168
+
59
169
  /**
60
170
  * The instance of the Cedarling application.
61
171
  */
@@ -139,6 +249,27 @@ export class Cedarling {
139
249
  * ```
140
250
  */
141
251
  authorize_multi_issuer(request: string): Promise<MultiIssuerAuthorizeResult>;
252
+ /**
253
+ * Authorize a batch of multi-issuer requests against one shared token set.
254
+ *
255
+ * Tokens are validated and token/issuer entities are built once, then
256
+ * each item is evaluated in input order. Batch-level failures (validation,
257
+ * JWT verification, status-list refresh) reject the whole call; per-item
258
+ * failures are returned as `BatchItemError` results and exposed by WASM
259
+ * with `is_ok=false` and `error`, while genuine Cedar denials remain
260
+ * `AuthorizeResult` values with `decision=false`.
261
+ *
262
+ * # Arguments
263
+ *
264
+ * * `request` - JSON string representation of [`BatchAuthorizeMultiIssuerRequest`].
265
+ *
266
+ * # Example
267
+ *
268
+ * ```javascript
269
+ * const result = await cedarling.authorize_multi_issuer_batch(JSON.stringify(batchRequest));
270
+ * ```
271
+ */
272
+ authorize_multi_issuer_batch(request: string): Promise<BatchAuthorizeMultiIssuerResponse>;
142
273
  /**
143
274
  * Authorize an unsigned request carrying an optional single principal.
144
275
  * Makes an authorization decision based on the [`RequestUnsigned`].
@@ -159,6 +290,27 @@ export class Cedarling {
159
290
  * ```
160
291
  */
161
292
  authorize_unsigned(request: string): Promise<AuthorizeResult>;
293
+ /**
294
+ * Authorize a batch of unsigned requests against one shared principal.
295
+ *
296
+ * Setup work (principal build + pushed-data snapshot) runs once and each
297
+ * item is evaluated in input order. Results are returned inside a
298
+ * [`BatchAuthorizeUnsignedResponse`] carrying the shared `batch_id`.
299
+ * Batch-level failures (validation, principal parse) reject the whole
300
+ * call; per-item failures are returned as `BatchItemError` results and
301
+ * exposed by WASM with `is_ok=false` and `error`, while genuine Cedar
302
+ * denials remain `AuthorizeResult` values with `decision=false`.
303
+ * # Arguments
304
+ *
305
+ * * `request` - JSON string representation of [`BatchAuthorizeUnsignedRequest`].
306
+ *
307
+ * # Example
308
+ *
309
+ * ```javascript
310
+ * const result = await cedarling.authorize_unsigned_batch(JSON.stringify(batchRequest));
311
+ * ```
312
+ */
313
+ authorize_unsigned_batch(request: string): Promise<BatchAuthorizeUnsignedResponse>;
162
314
  /**
163
315
  * Clear all entries from the data store.
164
316
  *
@@ -612,6 +764,9 @@ export interface InitOutput {
612
764
  readonly memory: WebAssembly.Memory;
613
765
  readonly __wbg_authorizeresult_free: (a: number, b: number) => void;
614
766
  readonly __wbg_authorizeresultresponse_free: (a: number, b: number) => void;
767
+ readonly __wbg_batchauthorizemultiissuerresponse_free: (a: number, b: number) => void;
768
+ readonly __wbg_batchitemerror_free: (a: number, b: number) => void;
769
+ readonly __wbg_batchitemmultiissuerresult_free: (a: number, b: number) => void;
615
770
  readonly __wbg_cedarling_free: (a: number, b: number) => void;
616
771
  readonly __wbg_dataentry_free: (a: number, b: number) => void;
617
772
  readonly __wbg_datastorestats_free: (a: number, b: number) => void;
@@ -654,11 +809,23 @@ export interface InitOutput {
654
809
  readonly authorizeresult_json_string: (a: number, b: number) => void;
655
810
  readonly authorizeresultresponse_decision: (a: number) => number;
656
811
  readonly authorizeresultresponse_diagnostics: (a: number) => number;
812
+ readonly batchauthorizemultiissuerresponse_batch_id: (a: number, b: number) => void;
813
+ readonly batchauthorizemultiissuerresponse_results: (a: number, b: number) => void;
814
+ readonly batchauthorizeunsignedresponse_results: (a: number, b: number) => void;
815
+ readonly batchitemerror_category: (a: number, b: number) => void;
816
+ readonly batchitemerror_item_index: (a: number) => number;
817
+ readonly batchitemerror_message: (a: number, b: number) => void;
818
+ readonly batchitemmultiissuerresult_error: (a: number) => number;
819
+ readonly batchitemmultiissuerresult_is_ok: (a: number) => number;
820
+ readonly batchitemmultiissuerresult_unwrap: (a: number, b: number) => void;
821
+ readonly batchitemunsignedresult_unwrap: (a: number, b: number) => void;
657
822
  readonly cedarling_annotation_values: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
658
823
  readonly cedarling_annotations_by_policy: (a: number, b: number, c: number, d: number) => void;
659
824
  readonly cedarling_annotations_map: (a: number, b: number, c: number, d: number) => void;
660
825
  readonly cedarling_authorize_multi_issuer: (a: number, b: number, c: number) => number;
826
+ readonly cedarling_authorize_multi_issuer_batch: (a: number, b: number, c: number) => number;
661
827
  readonly cedarling_authorize_unsigned: (a: number, b: number, c: number) => number;
828
+ readonly cedarling_authorize_unsigned_batch: (a: number, b: number, c: number) => number;
662
829
  readonly cedarling_clear_data_ctx: (a: number, b: number) => void;
663
830
  readonly cedarling_failed_trusted_issuer_ids: (a: number) => number;
664
831
  readonly cedarling_get_data_ctx: (a: number, b: number, c: number, d: number) => void;
@@ -718,11 +885,16 @@ export interface InitOutput {
718
885
  readonly __wbg_get_multiissuerauthorizeresult_response: (a: number) => number;
719
886
  readonly __wbg_get_multiissuerauthorizeresult_request_id: (a: number, b: number) => void;
720
887
  readonly __wbg_multiissuerauthorizeresult_free: (a: number, b: number) => void;
888
+ readonly __wbg_batchitemunsignedresult_free: (a: number, b: number) => void;
889
+ readonly __wbg_batchauthorizeunsignedresponse_free: (a: number, b: number) => void;
890
+ readonly batchitemunsignedresult_is_ok: (a: number) => number;
891
+ readonly batchitemunsignedresult_error: (a: number) => number;
892
+ readonly batchauthorizeunsignedresponse_batch_id: (a: number, b: number) => void;
721
893
  readonly cedarling_get_logs_by_tag: (a: number, b: number, c: number, d: number) => void;
722
- readonly __wasm_bindgen_func_elem_8692: (a: number, b: number, c: number, d: number) => void;
723
- readonly __wasm_bindgen_func_elem_8747: (a: number, b: number, c: number, d: number) => void;
724
- readonly __wasm_bindgen_func_elem_12170: (a: number, b: number, c: number) => void;
725
- readonly __wasm_bindgen_func_elem_8527: (a: number, b: number) => void;
894
+ readonly __wasm_bindgen_func_elem_8780: (a: number, b: number, c: number, d: number) => void;
895
+ readonly __wasm_bindgen_func_elem_8835: (a: number, b: number, c: number, d: number) => void;
896
+ readonly __wasm_bindgen_func_elem_12258: (a: number, b: number, c: number) => void;
897
+ readonly __wasm_bindgen_func_elem_8615: (a: number, b: number) => void;
726
898
  readonly __wbindgen_export: (a: number, b: number) => number;
727
899
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
728
900
  readonly __wbindgen_export3: (a: number) => void;
package/cedarling_wasm.js CHANGED
@@ -153,6 +153,326 @@ export class AuthorizeResultResponse {
153
153
  }
154
154
  if (Symbol.dispose) AuthorizeResultResponse.prototype[Symbol.dispose] = AuthorizeResultResponse.prototype.free;
155
155
 
156
+ /**
157
+ * WASM wrapper for
158
+ * `cedarling::BatchAuthorizeResponse<Result<MultiIssuerAuthorizeResult, BatchItemError>>`.
159
+ * Same shape as [`BatchAuthorizeUnsignedResponse`] with multi-issuer results.
160
+ */
161
+ export class BatchAuthorizeMultiIssuerResponse {
162
+ static __wrap(ptr) {
163
+ const obj = Object.create(BatchAuthorizeMultiIssuerResponse.prototype);
164
+ obj.__wbg_ptr = ptr;
165
+ BatchAuthorizeMultiIssuerResponseFinalization.register(obj, obj.__wbg_ptr, obj);
166
+ return obj;
167
+ }
168
+ __destroy_into_raw() {
169
+ const ptr = this.__wbg_ptr;
170
+ this.__wbg_ptr = 0;
171
+ BatchAuthorizeMultiIssuerResponseFinalization.unregister(this);
172
+ return ptr;
173
+ }
174
+ free() {
175
+ const ptr = this.__destroy_into_raw();
176
+ wasm.__wbg_batchauthorizemultiissuerresponse_free(ptr, 0);
177
+ }
178
+ /**
179
+ * Shared correlation id stamped on every per-item decision log entry.
180
+ * @returns {string}
181
+ */
182
+ get batch_id() {
183
+ let deferred1_0;
184
+ let deferred1_1;
185
+ try {
186
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
187
+ wasm.batchauthorizemultiissuerresponse_batch_id(retptr, this.__wbg_ptr);
188
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
189
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
190
+ deferred1_0 = r0;
191
+ deferred1_1 = r1;
192
+ return getStringFromWasm0(r0, r1);
193
+ } finally {
194
+ wasm.__wbindgen_add_to_stack_pointer(16);
195
+ wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
196
+ }
197
+ }
198
+ /**
199
+ * Per-item results in input order — each slot is a
200
+ * [`BatchItemMultiIssuerResult`].
201
+ * @returns {BatchItemMultiIssuerResult[]}
202
+ */
203
+ get results() {
204
+ try {
205
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
206
+ wasm.batchauthorizemultiissuerresponse_results(retptr, this.__wbg_ptr);
207
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
208
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
209
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
210
+ wasm.__wbindgen_export5(r0, r1 * 4, 4);
211
+ return v1;
212
+ } finally {
213
+ wasm.__wbindgen_add_to_stack_pointer(16);
214
+ }
215
+ }
216
+ }
217
+ if (Symbol.dispose) BatchAuthorizeMultiIssuerResponse.prototype[Symbol.dispose] = BatchAuthorizeMultiIssuerResponse.prototype.free;
218
+
219
+ /**
220
+ * WASM wrapper for `cedarling::BatchAuthorizeResponse<Result<AuthorizeResult, BatchItemError>>`.
221
+ *
222
+ * Carries a shared `batch_id` (UUIDv7) alongside per-item results. Each result
223
+ * is a [`BatchItemUnsignedResult`] — Cedar decision on `is_ok()`, per-item
224
+ * build failure on `error`. `results[i]` corresponds to `items[i]`.
225
+ */
226
+ export class BatchAuthorizeUnsignedResponse {
227
+ static __wrap(ptr) {
228
+ const obj = Object.create(BatchAuthorizeUnsignedResponse.prototype);
229
+ obj.__wbg_ptr = ptr;
230
+ BatchAuthorizeUnsignedResponseFinalization.register(obj, obj.__wbg_ptr, obj);
231
+ return obj;
232
+ }
233
+ __destroy_into_raw() {
234
+ const ptr = this.__wbg_ptr;
235
+ this.__wbg_ptr = 0;
236
+ BatchAuthorizeUnsignedResponseFinalization.unregister(this);
237
+ return ptr;
238
+ }
239
+ free() {
240
+ const ptr = this.__destroy_into_raw();
241
+ wasm.__wbg_batchauthorizeunsignedresponse_free(ptr, 0);
242
+ }
243
+ /**
244
+ * Shared correlation id stamped on every per-item decision log entry.
245
+ * @returns {string}
246
+ */
247
+ get batch_id() {
248
+ let deferred1_0;
249
+ let deferred1_1;
250
+ try {
251
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
252
+ wasm.batchauthorizeunsignedresponse_batch_id(retptr, this.__wbg_ptr);
253
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
254
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
255
+ deferred1_0 = r0;
256
+ deferred1_1 = r1;
257
+ return getStringFromWasm0(r0, r1);
258
+ } finally {
259
+ wasm.__wbindgen_add_to_stack_pointer(16);
260
+ wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
261
+ }
262
+ }
263
+ /**
264
+ * Per-item results in input order — each slot is a
265
+ * [`BatchItemUnsignedResult`].
266
+ * @returns {BatchItemUnsignedResult[]}
267
+ */
268
+ get results() {
269
+ try {
270
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
271
+ wasm.batchauthorizeunsignedresponse_results(retptr, this.__wbg_ptr);
272
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
273
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
274
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
275
+ wasm.__wbindgen_export5(r0, r1 * 4, 4);
276
+ return v1;
277
+ } finally {
278
+ wasm.__wbindgen_add_to_stack_pointer(16);
279
+ }
280
+ }
281
+ }
282
+ if (Symbol.dispose) BatchAuthorizeUnsignedResponse.prototype[Symbol.dispose] = BatchAuthorizeUnsignedResponse.prototype.free;
283
+
284
+ /**
285
+ * Per-item build failure surfaced inside a batch response at `results[i]`
286
+ * when Cedar couldn't be reached for that item.
287
+ */
288
+ export class BatchItemError {
289
+ static __wrap(ptr) {
290
+ const obj = Object.create(BatchItemError.prototype);
291
+ obj.__wbg_ptr = ptr;
292
+ BatchItemErrorFinalization.register(obj, obj.__wbg_ptr, obj);
293
+ return obj;
294
+ }
295
+ __destroy_into_raw() {
296
+ const ptr = this.__wbg_ptr;
297
+ this.__wbg_ptr = 0;
298
+ BatchItemErrorFinalization.unregister(this);
299
+ return ptr;
300
+ }
301
+ free() {
302
+ const ptr = this.__destroy_into_raw();
303
+ wasm.__wbg_batchitemerror_free(ptr, 0);
304
+ }
305
+ /**
306
+ * Stable variant slug — `action_parse`, `resource_build`, `context_build`,
307
+ * `principal_build`, `schema_validation`, `multi_issuer_entity`,
308
+ * `request_validation`.
309
+ * @returns {string}
310
+ */
311
+ get category() {
312
+ let deferred1_0;
313
+ let deferred1_1;
314
+ try {
315
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
316
+ wasm.batchitemerror_category(retptr, this.__wbg_ptr);
317
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
318
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
319
+ deferred1_0 = r0;
320
+ deferred1_1 = r1;
321
+ return getStringFromWasm0(r0, r1);
322
+ } finally {
323
+ wasm.__wbindgen_add_to_stack_pointer(16);
324
+ wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
325
+ }
326
+ }
327
+ /**
328
+ * Position of the failing item in the original `items` vector.
329
+ * @returns {number}
330
+ */
331
+ get item_index() {
332
+ const ret = wasm.batchitemerror_item_index(this.__wbg_ptr);
333
+ return ret >>> 0;
334
+ }
335
+ /**
336
+ * Human-readable diagnostic. Safe to log.
337
+ * @returns {string}
338
+ */
339
+ get message() {
340
+ let deferred1_0;
341
+ let deferred1_1;
342
+ try {
343
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
344
+ wasm.batchitemerror_message(retptr, this.__wbg_ptr);
345
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
346
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
347
+ deferred1_0 = r0;
348
+ deferred1_1 = r1;
349
+ return getStringFromWasm0(r0, r1);
350
+ } finally {
351
+ wasm.__wbindgen_add_to_stack_pointer(16);
352
+ wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
353
+ }
354
+ }
355
+ }
356
+ if (Symbol.dispose) BatchItemError.prototype[Symbol.dispose] = BatchItemError.prototype.free;
357
+
358
+ /**
359
+ * Multi-issuer analog of [`BatchItemUnsignedResult`].
360
+ */
361
+ export class BatchItemMultiIssuerResult {
362
+ static __wrap(ptr) {
363
+ const obj = Object.create(BatchItemMultiIssuerResult.prototype);
364
+ obj.__wbg_ptr = ptr;
365
+ BatchItemMultiIssuerResultFinalization.register(obj, obj.__wbg_ptr, obj);
366
+ return obj;
367
+ }
368
+ __destroy_into_raw() {
369
+ const ptr = this.__wbg_ptr;
370
+ this.__wbg_ptr = 0;
371
+ BatchItemMultiIssuerResultFinalization.unregister(this);
372
+ return ptr;
373
+ }
374
+ free() {
375
+ const ptr = this.__destroy_into_raw();
376
+ wasm.__wbg_batchitemmultiissuerresult_free(ptr, 0);
377
+ }
378
+ /**
379
+ * The per-item error if `!is_ok()`; `undefined` otherwise.
380
+ * @returns {BatchItemError | undefined}
381
+ */
382
+ get error() {
383
+ const ret = wasm.batchitemmultiissuerresult_error(this.__wbg_ptr);
384
+ return ret === 0 ? undefined : BatchItemError.__wrap(ret);
385
+ }
386
+ /**
387
+ * `true` when Cedar evaluated this item.
388
+ * @returns {boolean}
389
+ */
390
+ get is_ok() {
391
+ const ret = wasm.batchitemmultiissuerresult_is_ok(this.__wbg_ptr);
392
+ return ret !== 0;
393
+ }
394
+ /**
395
+ * The multi-issuer decision if `is_ok()`; throws otherwise.
396
+ * @returns {MultiIssuerAuthorizeResult}
397
+ */
398
+ unwrap() {
399
+ try {
400
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
401
+ wasm.batchitemmultiissuerresult_unwrap(retptr, this.__wbg_ptr);
402
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
403
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
404
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
405
+ if (r2) {
406
+ throw takeObject(r1);
407
+ }
408
+ return MultiIssuerAuthorizeResult.__wrap(r0);
409
+ } finally {
410
+ wasm.__wbindgen_add_to_stack_pointer(16);
411
+ }
412
+ }
413
+ }
414
+ if (Symbol.dispose) BatchItemMultiIssuerResult.prototype[Symbol.dispose] = BatchItemMultiIssuerResult.prototype.free;
415
+
416
+ /**
417
+ * One slot in a batch response's `results` array. Callers switch on
418
+ * `is_ok()` — on `true`, read `unwrap()`; on `false`, read `error()`.
419
+ */
420
+ export class BatchItemUnsignedResult {
421
+ static __wrap(ptr) {
422
+ const obj = Object.create(BatchItemUnsignedResult.prototype);
423
+ obj.__wbg_ptr = ptr;
424
+ BatchItemUnsignedResultFinalization.register(obj, obj.__wbg_ptr, obj);
425
+ return obj;
426
+ }
427
+ __destroy_into_raw() {
428
+ const ptr = this.__wbg_ptr;
429
+ this.__wbg_ptr = 0;
430
+ BatchItemUnsignedResultFinalization.unregister(this);
431
+ return ptr;
432
+ }
433
+ free() {
434
+ const ptr = this.__destroy_into_raw();
435
+ wasm.__wbg_batchitemunsignedresult_free(ptr, 0);
436
+ }
437
+ /**
438
+ * The per-item error if `!is_ok()`; `undefined` otherwise.
439
+ * @returns {BatchItemError | undefined}
440
+ */
441
+ get error() {
442
+ const ret = wasm.batchitemunsignedresult_error(this.__wbg_ptr);
443
+ return ret === 0 ? undefined : BatchItemError.__wrap(ret);
444
+ }
445
+ /**
446
+ * `true` when Cedar evaluated this item (Allow or Deny); `false` when it
447
+ * failed to build.
448
+ * @returns {boolean}
449
+ */
450
+ get is_ok() {
451
+ const ret = wasm.batchitemunsignedresult_is_ok(this.__wbg_ptr);
452
+ return ret !== 0;
453
+ }
454
+ /**
455
+ * The Cedar decision if `is_ok()`; throws otherwise.
456
+ * @returns {AuthorizeResult}
457
+ */
458
+ unwrap() {
459
+ try {
460
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
461
+ wasm.batchitemunsignedresult_unwrap(retptr, this.__wbg_ptr);
462
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
463
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
464
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
465
+ if (r2) {
466
+ throw takeObject(r1);
467
+ }
468
+ return AuthorizeResult.__wrap(r0);
469
+ } finally {
470
+ wasm.__wbindgen_add_to_stack_pointer(16);
471
+ }
472
+ }
473
+ }
474
+ if (Symbol.dispose) BatchItemUnsignedResult.prototype[Symbol.dispose] = BatchItemUnsignedResult.prototype.free;
475
+
156
476
  /**
157
477
  * The instance of the Cedarling application.
158
478
  */
@@ -311,6 +631,34 @@ export class Cedarling {
311
631
  const ret = wasm.cedarling_authorize_multi_issuer(this.__wbg_ptr, ptr0, len0);
312
632
  return takeObject(ret);
313
633
  }
634
+ /**
635
+ * Authorize a batch of multi-issuer requests against one shared token set.
636
+ *
637
+ * Tokens are validated and token/issuer entities are built once, then
638
+ * each item is evaluated in input order. Batch-level failures (validation,
639
+ * JWT verification, status-list refresh) reject the whole call; per-item
640
+ * failures are returned as `BatchItemError` results and exposed by WASM
641
+ * with `is_ok=false` and `error`, while genuine Cedar denials remain
642
+ * `AuthorizeResult` values with `decision=false`.
643
+ *
644
+ * # Arguments
645
+ *
646
+ * * `request` - JSON string representation of [`BatchAuthorizeMultiIssuerRequest`].
647
+ *
648
+ * # Example
649
+ *
650
+ * ```javascript
651
+ * const result = await cedarling.authorize_multi_issuer_batch(JSON.stringify(batchRequest));
652
+ * ```
653
+ * @param {string} request
654
+ * @returns {Promise<BatchAuthorizeMultiIssuerResponse>}
655
+ */
656
+ authorize_multi_issuer_batch(request) {
657
+ const ptr0 = passStringToWasm0(request, wasm.__wbindgen_export, wasm.__wbindgen_export2);
658
+ const len0 = WASM_VECTOR_LEN;
659
+ const ret = wasm.cedarling_authorize_multi_issuer_batch(this.__wbg_ptr, ptr0, len0);
660
+ return takeObject(ret);
661
+ }
314
662
  /**
315
663
  * Authorize an unsigned request carrying an optional single principal.
316
664
  * Makes an authorization decision based on the [`RequestUnsigned`].
@@ -338,6 +686,34 @@ export class Cedarling {
338
686
  const ret = wasm.cedarling_authorize_unsigned(this.__wbg_ptr, ptr0, len0);
339
687
  return takeObject(ret);
340
688
  }
689
+ /**
690
+ * Authorize a batch of unsigned requests against one shared principal.
691
+ *
692
+ * Setup work (principal build + pushed-data snapshot) runs once and each
693
+ * item is evaluated in input order. Results are returned inside a
694
+ * [`BatchAuthorizeUnsignedResponse`] carrying the shared `batch_id`.
695
+ * Batch-level failures (validation, principal parse) reject the whole
696
+ * call; per-item failures are returned as `BatchItemError` results and
697
+ * exposed by WASM with `is_ok=false` and `error`, while genuine Cedar
698
+ * denials remain `AuthorizeResult` values with `decision=false`.
699
+ * # Arguments
700
+ *
701
+ * * `request` - JSON string representation of [`BatchAuthorizeUnsignedRequest`].
702
+ *
703
+ * # Example
704
+ *
705
+ * ```javascript
706
+ * const result = await cedarling.authorize_unsigned_batch(JSON.stringify(batchRequest));
707
+ * ```
708
+ * @param {string} request
709
+ * @returns {Promise<BatchAuthorizeUnsignedResponse>}
710
+ */
711
+ authorize_unsigned_batch(request) {
712
+ const ptr0 = passStringToWasm0(request, wasm.__wbindgen_export, wasm.__wbindgen_export2);
713
+ const len0 = WASM_VECTOR_LEN;
714
+ const ret = wasm.cedarling_authorize_unsigned_batch(this.__wbg_ptr, ptr0, len0);
715
+ return takeObject(ret);
716
+ }
341
717
  /**
342
718
  * Clear all entries from the data store.
343
719
  *
@@ -1686,6 +2062,22 @@ function __wbg_get_imports() {
1686
2062
  const ret = AuthorizeResult.__wrap(arg0);
1687
2063
  return addHeapObject(ret);
1688
2064
  },
2065
+ __wbg_batchauthorizemultiissuerresponse_new: function(arg0) {
2066
+ const ret = BatchAuthorizeMultiIssuerResponse.__wrap(arg0);
2067
+ return addHeapObject(ret);
2068
+ },
2069
+ __wbg_batchauthorizeunsignedresponse_new: function(arg0) {
2070
+ const ret = BatchAuthorizeUnsignedResponse.__wrap(arg0);
2071
+ return addHeapObject(ret);
2072
+ },
2073
+ __wbg_batchitemmultiissuerresult_new: function(arg0) {
2074
+ const ret = BatchItemMultiIssuerResult.__wrap(arg0);
2075
+ return addHeapObject(ret);
2076
+ },
2077
+ __wbg_batchitemunsignedresult_new: function(arg0) {
2078
+ const ret = BatchItemUnsignedResult.__wrap(arg0);
2079
+ return addHeapObject(ret);
2080
+ },
1689
2081
  __wbg_body_18c9f2ac15ead4b2: function(arg0) {
1690
2082
  const ret = getObject(arg0).body;
1691
2083
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
@@ -1986,7 +2378,7 @@ function __wbg_get_imports() {
1986
2378
  const a = state0.a;
1987
2379
  state0.a = 0;
1988
2380
  try {
1989
- return __wasm_bindgen_func_elem_8747(a, state0.b, arg0, arg1);
2381
+ return __wasm_bindgen_func_elem_8835(a, state0.b, arg0, arg1);
1990
2382
  } finally {
1991
2383
  state0.a = a;
1992
2384
  }
@@ -2195,18 +2587,18 @@ function __wbg_get_imports() {
2195
2587
  console.warn(...getObject(arg0));
2196
2588
  },
2197
2589
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
2198
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1196, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2199
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_12170);
2590
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1193, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2591
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_12258);
2200
2592
  return addHeapObject(ret);
2201
2593
  },
2202
2594
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
2203
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 995, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2204
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_8692);
2595
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 992, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2596
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_8780);
2205
2597
  return addHeapObject(ret);
2206
2598
  },
2207
2599
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
2208
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 883, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2209
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_8527);
2600
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 876, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2601
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_8615);
2210
2602
  return addHeapObject(ret);
2211
2603
  },
2212
2604
  __wbindgen_cast_0000000000000004: function(arg0) {
@@ -2248,18 +2640,18 @@ function __wbg_get_imports() {
2248
2640
  };
2249
2641
  }
2250
2642
 
2251
- function __wasm_bindgen_func_elem_8527(arg0, arg1) {
2252
- wasm.__wasm_bindgen_func_elem_8527(arg0, arg1);
2643
+ function __wasm_bindgen_func_elem_8615(arg0, arg1) {
2644
+ wasm.__wasm_bindgen_func_elem_8615(arg0, arg1);
2253
2645
  }
2254
2646
 
2255
- function __wasm_bindgen_func_elem_12170(arg0, arg1, arg2) {
2256
- wasm.__wasm_bindgen_func_elem_12170(arg0, arg1, addHeapObject(arg2));
2647
+ function __wasm_bindgen_func_elem_12258(arg0, arg1, arg2) {
2648
+ wasm.__wasm_bindgen_func_elem_12258(arg0, arg1, addHeapObject(arg2));
2257
2649
  }
2258
2650
 
2259
- function __wasm_bindgen_func_elem_8692(arg0, arg1, arg2) {
2651
+ function __wasm_bindgen_func_elem_8780(arg0, arg1, arg2) {
2260
2652
  try {
2261
2653
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2262
- wasm.__wasm_bindgen_func_elem_8692(retptr, arg0, arg1, addHeapObject(arg2));
2654
+ wasm.__wasm_bindgen_func_elem_8780(retptr, arg0, arg1, addHeapObject(arg2));
2263
2655
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2264
2656
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2265
2657
  if (r1) {
@@ -2270,8 +2662,8 @@ function __wasm_bindgen_func_elem_8692(arg0, arg1, arg2) {
2270
2662
  }
2271
2663
  }
2272
2664
 
2273
- function __wasm_bindgen_func_elem_8747(arg0, arg1, arg2, arg3) {
2274
- wasm.__wasm_bindgen_func_elem_8747(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
2665
+ function __wasm_bindgen_func_elem_8835(arg0, arg1, arg2, arg3) {
2666
+ wasm.__wasm_bindgen_func_elem_8835(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
2275
2667
  }
2276
2668
 
2277
2669
 
@@ -2297,6 +2689,21 @@ const AuthorizeResultFinalization = (typeof FinalizationRegistry === 'undefined'
2297
2689
  const AuthorizeResultResponseFinalization = (typeof FinalizationRegistry === 'undefined')
2298
2690
  ? { register: () => {}, unregister: () => {} }
2299
2691
  : new FinalizationRegistry(ptr => wasm.__wbg_authorizeresultresponse_free(ptr, 1));
2692
+ const BatchAuthorizeMultiIssuerResponseFinalization = (typeof FinalizationRegistry === 'undefined')
2693
+ ? { register: () => {}, unregister: () => {} }
2694
+ : new FinalizationRegistry(ptr => wasm.__wbg_batchauthorizemultiissuerresponse_free(ptr, 1));
2695
+ const BatchAuthorizeUnsignedResponseFinalization = (typeof FinalizationRegistry === 'undefined')
2696
+ ? { register: () => {}, unregister: () => {} }
2697
+ : new FinalizationRegistry(ptr => wasm.__wbg_batchauthorizeunsignedresponse_free(ptr, 1));
2698
+ const BatchItemErrorFinalization = (typeof FinalizationRegistry === 'undefined')
2699
+ ? { register: () => {}, unregister: () => {} }
2700
+ : new FinalizationRegistry(ptr => wasm.__wbg_batchitemerror_free(ptr, 1));
2701
+ const BatchItemMultiIssuerResultFinalization = (typeof FinalizationRegistry === 'undefined')
2702
+ ? { register: () => {}, unregister: () => {} }
2703
+ : new FinalizationRegistry(ptr => wasm.__wbg_batchitemmultiissuerresult_free(ptr, 1));
2704
+ const BatchItemUnsignedResultFinalization = (typeof FinalizationRegistry === 'undefined')
2705
+ ? { register: () => {}, unregister: () => {} }
2706
+ : new FinalizationRegistry(ptr => wasm.__wbg_batchitemunsignedresult_free(ptr, 1));
2300
2707
  const CedarlingFinalization = (typeof FinalizationRegistry === 'undefined')
2301
2708
  ? { register: () => {}, unregister: () => {} }
2302
2709
  : new FinalizationRegistry(ptr => wasm.__wbg_cedarling_free(ptr, 1));
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@janssenproject/cedarling_wasm",
3
3
  "type": "module",
4
4
  "description": "The Cedarling is a performant local authorization service that runs the Rust Cedar Engine",
5
- "version": "0.0.420",
5
+ "version": "0.0.421",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",