@janssenproject/cedarling_wasm 0.0.420-nodejs → 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
  *
@@ -605,3 +757,170 @@ export function init(config: any): Promise<Cedarling>;
605
757
  * ```
606
758
  */
607
759
  export function init_from_archive_bytes(config: any, archive_bytes: Uint8Array): Promise<Cedarling>;
760
+
761
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
762
+
763
+ export interface InitOutput {
764
+ readonly memory: WebAssembly.Memory;
765
+ readonly __wbg_authorizeresult_free: (a: number, b: number) => void;
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;
770
+ readonly __wbg_cedarling_free: (a: number, b: number) => void;
771
+ readonly __wbg_dataentry_free: (a: number, b: number) => void;
772
+ readonly __wbg_datastorestats_free: (a: number, b: number) => void;
773
+ readonly __wbg_diagnostics_free: (a: number, b: number) => void;
774
+ readonly __wbg_get_authorizeresult_decision: (a: number) => number;
775
+ readonly __wbg_get_authorizeresult_request_id: (a: number, b: number) => void;
776
+ readonly __wbg_get_authorizeresult_response: (a: number) => number;
777
+ readonly __wbg_get_dataentry_access_count: (a: number) => bigint;
778
+ readonly __wbg_get_dataentry_created_at: (a: number, b: number) => void;
779
+ readonly __wbg_get_dataentry_data_type: (a: number, b: number) => void;
780
+ readonly __wbg_get_dataentry_expires_at: (a: number, b: number) => void;
781
+ readonly __wbg_get_dataentry_key: (a: number, b: number) => void;
782
+ readonly __wbg_get_datastorestats_avg_entry_size_bytes: (a: number) => number;
783
+ readonly __wbg_get_datastorestats_capacity_usage_percent: (a: number) => number;
784
+ readonly __wbg_get_datastorestats_entry_count: (a: number) => number;
785
+ readonly __wbg_get_datastorestats_max_entries: (a: number) => number;
786
+ readonly __wbg_get_datastorestats_max_entry_size: (a: number) => number;
787
+ readonly __wbg_get_datastorestats_memory_alert_threshold: (a: number) => number;
788
+ readonly __wbg_get_datastorestats_memory_alert_triggered: (a: number) => number;
789
+ readonly __wbg_get_datastorestats_metrics_enabled: (a: number) => number;
790
+ readonly __wbg_get_datastorestats_total_size_bytes: (a: number) => number;
791
+ readonly __wbg_policyevaluationerror_free: (a: number, b: number) => void;
792
+ readonly __wbg_set_authorizeresult_decision: (a: number, b: number) => void;
793
+ readonly __wbg_set_authorizeresult_request_id: (a: number, b: number, c: number) => void;
794
+ readonly __wbg_set_authorizeresult_response: (a: number, b: number) => void;
795
+ readonly __wbg_set_dataentry_access_count: (a: number, b: bigint) => void;
796
+ readonly __wbg_set_dataentry_created_at: (a: number, b: number, c: number) => void;
797
+ readonly __wbg_set_dataentry_data_type: (a: number, b: number, c: number) => void;
798
+ readonly __wbg_set_dataentry_expires_at: (a: number, b: number, c: number) => void;
799
+ readonly __wbg_set_dataentry_key: (a: number, b: number, c: number) => void;
800
+ readonly __wbg_set_datastorestats_avg_entry_size_bytes: (a: number, b: number) => void;
801
+ readonly __wbg_set_datastorestats_capacity_usage_percent: (a: number, b: number) => void;
802
+ readonly __wbg_set_datastorestats_entry_count: (a: number, b: number) => void;
803
+ readonly __wbg_set_datastorestats_max_entries: (a: number, b: number) => void;
804
+ readonly __wbg_set_datastorestats_max_entry_size: (a: number, b: number) => void;
805
+ readonly __wbg_set_datastorestats_memory_alert_threshold: (a: number, b: number) => void;
806
+ readonly __wbg_set_datastorestats_memory_alert_triggered: (a: number, b: number) => void;
807
+ readonly __wbg_set_datastorestats_metrics_enabled: (a: number, b: number) => void;
808
+ readonly __wbg_set_datastorestats_total_size_bytes: (a: number, b: number) => void;
809
+ readonly authorizeresult_json_string: (a: number, b: number) => void;
810
+ readonly authorizeresultresponse_decision: (a: number) => number;
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;
822
+ readonly cedarling_annotation_values: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
823
+ readonly cedarling_annotations_by_policy: (a: number, b: number, c: number, d: number) => void;
824
+ readonly cedarling_annotations_map: (a: number, b: number, c: number, d: number) => void;
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;
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;
829
+ readonly cedarling_clear_data_ctx: (a: number, b: number) => void;
830
+ readonly cedarling_failed_trusted_issuer_ids: (a: number) => number;
831
+ readonly cedarling_get_data_ctx: (a: number, b: number, c: number, d: number) => void;
832
+ readonly cedarling_get_data_entry_ctx: (a: number, b: number, c: number, d: number) => void;
833
+ readonly cedarling_get_log_by_id: (a: number, b: number, c: number, d: number) => void;
834
+ readonly cedarling_get_log_ids: (a: number) => number;
835
+ readonly cedarling_get_logs_by_request_id: (a: number, b: number, c: number, d: number) => void;
836
+ readonly cedarling_get_logs_by_request_id_and_tag: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
837
+ readonly cedarling_get_stats_ctx: (a: number, b: number) => void;
838
+ readonly cedarling_is_trusted_issuer_loaded_by_iss: (a: number, b: number, c: number) => number;
839
+ readonly cedarling_is_trusted_issuer_loaded_by_name: (a: number, b: number, c: number) => number;
840
+ readonly cedarling_list_data_ctx: (a: number, b: number) => void;
841
+ readonly cedarling_loaded_trusted_issuer_ids: (a: number) => number;
842
+ readonly cedarling_loaded_trusted_issuers_count: (a: number) => number;
843
+ readonly cedarling_new: (a: number) => number;
844
+ readonly cedarling_new_from_map: (a: number) => number;
845
+ readonly cedarling_pop_logs: (a: number, b: number) => void;
846
+ readonly cedarling_push_data_ctx: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint) => void;
847
+ readonly cedarling_remove_data_ctx: (a: number, b: number, c: number, d: number) => void;
848
+ readonly cedarling_shut_down: (a: number) => number;
849
+ readonly cedarling_total_issuers: (a: number) => number;
850
+ readonly dataentry_json_string: (a: number, b: number) => void;
851
+ readonly dataentry_value: (a: number, b: number) => void;
852
+ readonly datastorestats_json_string: (a: number, b: number) => void;
853
+ readonly diagnostics_errors: (a: number, b: number) => void;
854
+ readonly diagnostics_reason: (a: number, b: number) => void;
855
+ readonly init: (a: number) => number;
856
+ readonly init_from_archive_bytes: (a: number, b: number) => number;
857
+ readonly multiissuerauthorizeresult_json_string: (a: number, b: number) => void;
858
+ readonly policyevaluationerror_error: (a: number, b: number) => void;
859
+ readonly policyevaluationerror_id: (a: number, b: number) => void;
860
+ readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
861
+ readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
862
+ readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
863
+ readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
864
+ readonly intounderlyingbytesource_cancel: (a: number) => void;
865
+ readonly intounderlyingbytesource_pull: (a: number, b: number) => number;
866
+ readonly intounderlyingbytesource_start: (a: number, b: number) => void;
867
+ readonly intounderlyingbytesource_type: (a: number) => number;
868
+ readonly intounderlyingsink_abort: (a: number, b: number) => number;
869
+ readonly intounderlyingsink_close: (a: number) => number;
870
+ readonly intounderlyingsink_write: (a: number, b: number) => number;
871
+ readonly intounderlyingsource_cancel: (a: number) => void;
872
+ readonly intounderlyingsource_pull: (a: number, b: number) => number;
873
+ readonly rust_zstd_wasm_shim_calloc: (a: number, b: number) => number;
874
+ readonly rust_zstd_wasm_shim_free: (a: number) => void;
875
+ readonly rust_zstd_wasm_shim_malloc: (a: number) => number;
876
+ readonly rust_zstd_wasm_shim_memcmp: (a: number, b: number, c: number) => number;
877
+ readonly rust_zstd_wasm_shim_memcpy: (a: number, b: number, c: number) => number;
878
+ readonly rust_zstd_wasm_shim_memmove: (a: number, b: number, c: number) => number;
879
+ readonly rust_zstd_wasm_shim_memset: (a: number, b: number, c: number) => number;
880
+ readonly rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void;
881
+ readonly __wbg_get_multiissuerauthorizeresult_decision: (a: number) => number;
882
+ readonly __wbg_set_multiissuerauthorizeresult_response: (a: number, b: number) => void;
883
+ readonly __wbg_set_multiissuerauthorizeresult_request_id: (a: number, b: number, c: number) => void;
884
+ readonly __wbg_set_multiissuerauthorizeresult_decision: (a: number, b: number) => void;
885
+ readonly __wbg_get_multiissuerauthorizeresult_response: (a: number) => number;
886
+ readonly __wbg_get_multiissuerauthorizeresult_request_id: (a: number, b: number) => void;
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;
893
+ readonly cedarling_get_logs_by_tag: (a: number, b: number, c: number, d: 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;
898
+ readonly __wbindgen_export: (a: number, b: number) => number;
899
+ readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
900
+ readonly __wbindgen_export3: (a: number) => void;
901
+ readonly __wbindgen_export4: (a: number, b: number) => void;
902
+ readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
903
+ readonly __wbindgen_export5: (a: number, b: number, c: number) => void;
904
+ }
905
+
906
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
907
+
908
+ /**
909
+ * Instantiates the given `module`, which can either be bytes or
910
+ * a precompiled `WebAssembly.Module`.
911
+ *
912
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
913
+ *
914
+ * @returns {InitOutput}
915
+ */
916
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
917
+
918
+ /**
919
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
920
+ * for everything else, calls `WebAssembly.instantiate` directly.
921
+ *
922
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
923
+ *
924
+ * @returns {Promise<InitOutput>}
925
+ */
926
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
package/cedarling_wasm.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * A WASM wrapper for the Rust `cedarling::AuthorizeResult` struct.
5
5
  * Represents the result of an authorization request.
6
6
  */
7
- class AuthorizeResult {
7
+ export class AuthorizeResult {
8
8
  static __wrap(ptr) {
9
9
  const obj = Object.create(AuthorizeResult.prototype);
10
10
  obj.__wbg_ptr = ptr;
@@ -112,13 +112,12 @@ class AuthorizeResult {
112
112
  }
113
113
  }
114
114
  if (Symbol.dispose) AuthorizeResult.prototype[Symbol.dispose] = AuthorizeResult.prototype.free;
115
- exports.AuthorizeResult = AuthorizeResult;
116
115
 
117
116
  /**
118
117
  * A WASM wrapper for the Rust `cedar_policy::Response` struct.
119
118
  * Represents the result of an authorization request.
120
119
  */
121
- class AuthorizeResultResponse {
120
+ export class AuthorizeResultResponse {
122
121
  static __wrap(ptr) {
123
122
  const obj = Object.create(AuthorizeResultResponse.prototype);
124
123
  obj.__wbg_ptr = ptr;
@@ -153,12 +152,331 @@ class AuthorizeResultResponse {
153
152
  }
154
153
  }
155
154
  if (Symbol.dispose) AuthorizeResultResponse.prototype[Symbol.dispose] = AuthorizeResultResponse.prototype.free;
156
- exports.AuthorizeResultResponse = AuthorizeResultResponse;
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;
157
475
 
158
476
  /**
159
477
  * The instance of the Cedarling application.
160
478
  */
161
- class Cedarling {
479
+ export class Cedarling {
162
480
  static __wrap(ptr) {
163
481
  const obj = Object.create(Cedarling.prototype);
164
482
  obj.__wbg_ptr = ptr;
@@ -313,6 +631,34 @@ class Cedarling {
313
631
  const ret = wasm.cedarling_authorize_multi_issuer(this.__wbg_ptr, ptr0, len0);
314
632
  return takeObject(ret);
315
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
+ }
316
662
  /**
317
663
  * Authorize an unsigned request carrying an optional single principal.
318
664
  * Makes an authorization decision based on the [`RequestUnsigned`].
@@ -340,6 +686,34 @@ class Cedarling {
340
686
  const ret = wasm.cedarling_authorize_unsigned(this.__wbg_ptr, ptr0, len0);
341
687
  return takeObject(ret);
342
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
+ }
343
717
  /**
344
718
  * Clear all entries from the data store.
345
719
  *
@@ -830,13 +1204,12 @@ class Cedarling {
830
1204
  }
831
1205
  }
832
1206
  if (Symbol.dispose) Cedarling.prototype[Symbol.dispose] = Cedarling.prototype.free;
833
- exports.Cedarling = Cedarling;
834
1207
 
835
1208
  /**
836
1209
  * A WASM wrapper for the Rust `cedarling::DataEntry` struct.
837
1210
  * Represents a data entry in the DataStore with value and metadata.
838
1211
  */
839
- class DataEntry {
1212
+ export class DataEntry {
840
1213
  static __wrap(ptr) {
841
1214
  const obj = Object.create(DataEntry.prototype);
842
1215
  obj.__wbg_ptr = ptr;
@@ -1025,13 +1398,12 @@ class DataEntry {
1025
1398
  }
1026
1399
  }
1027
1400
  if (Symbol.dispose) DataEntry.prototype[Symbol.dispose] = DataEntry.prototype.free;
1028
- exports.DataEntry = DataEntry;
1029
1401
 
1030
1402
  /**
1031
1403
  * A WASM wrapper for the Rust `cedarling::DataStoreStats` struct.
1032
1404
  * Statistics about the DataStore.
1033
1405
  */
1034
- class DataStoreStats {
1406
+ export class DataStoreStats {
1035
1407
  static __wrap(ptr) {
1036
1408
  const obj = Object.create(DataStoreStats.prototype);
1037
1409
  obj.__wbg_ptr = ptr;
@@ -1205,7 +1577,6 @@ class DataStoreStats {
1205
1577
  }
1206
1578
  }
1207
1579
  if (Symbol.dispose) DataStoreStats.prototype[Symbol.dispose] = DataStoreStats.prototype.free;
1208
- exports.DataStoreStats = DataStoreStats;
1209
1580
 
1210
1581
  /**
1211
1582
  * Diagnostics
@@ -1213,7 +1584,7 @@ exports.DataStoreStats = DataStoreStats;
1213
1584
  *
1214
1585
  * Provides detailed information about how a policy decision was made, including policies that contributed to the decision and any errors encountered during evaluation.
1215
1586
  */
1216
- class Diagnostics {
1587
+ export class Diagnostics {
1217
1588
  static __wrap(ptr) {
1218
1589
  const obj = Object.create(Diagnostics.prototype);
1219
1590
  obj.__wbg_ptr = ptr;
@@ -1270,9 +1641,8 @@ class Diagnostics {
1270
1641
  }
1271
1642
  }
1272
1643
  if (Symbol.dispose) Diagnostics.prototype[Symbol.dispose] = Diagnostics.prototype.free;
1273
- exports.Diagnostics = Diagnostics;
1274
1644
 
1275
- class IntoUnderlyingByteSource {
1645
+ export class IntoUnderlyingByteSource {
1276
1646
  __destroy_into_raw() {
1277
1647
  const ptr = this.__wbg_ptr;
1278
1648
  this.__wbg_ptr = 0;
@@ -1317,9 +1687,8 @@ class IntoUnderlyingByteSource {
1317
1687
  }
1318
1688
  }
1319
1689
  if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
1320
- exports.IntoUnderlyingByteSource = IntoUnderlyingByteSource;
1321
1690
 
1322
- class IntoUnderlyingSink {
1691
+ export class IntoUnderlyingSink {
1323
1692
  __destroy_into_raw() {
1324
1693
  const ptr = this.__wbg_ptr;
1325
1694
  this.__wbg_ptr = 0;
@@ -1357,9 +1726,8 @@ class IntoUnderlyingSink {
1357
1726
  }
1358
1727
  }
1359
1728
  if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
1360
- exports.IntoUnderlyingSink = IntoUnderlyingSink;
1361
1729
 
1362
- class IntoUnderlyingSource {
1730
+ export class IntoUnderlyingSource {
1363
1731
  __destroy_into_raw() {
1364
1732
  const ptr = this.__wbg_ptr;
1365
1733
  this.__wbg_ptr = 0;
@@ -1384,13 +1752,12 @@ class IntoUnderlyingSource {
1384
1752
  }
1385
1753
  }
1386
1754
  if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
1387
- exports.IntoUnderlyingSource = IntoUnderlyingSource;
1388
1755
 
1389
1756
  /**
1390
1757
  * A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
1391
1758
  * Represents the result of a multi-issuer authorization request.
1392
1759
  */
1393
- class MultiIssuerAuthorizeResult {
1760
+ export class MultiIssuerAuthorizeResult {
1394
1761
  static __wrap(ptr) {
1395
1762
  const obj = Object.create(MultiIssuerAuthorizeResult.prototype);
1396
1763
  obj.__wbg_ptr = ptr;
@@ -1494,7 +1861,6 @@ class MultiIssuerAuthorizeResult {
1494
1861
  }
1495
1862
  }
1496
1863
  if (Symbol.dispose) MultiIssuerAuthorizeResult.prototype[Symbol.dispose] = MultiIssuerAuthorizeResult.prototype.free;
1497
- exports.MultiIssuerAuthorizeResult = MultiIssuerAuthorizeResult;
1498
1864
 
1499
1865
  /**
1500
1866
  * PolicyEvaluationError
@@ -1502,7 +1868,7 @@ exports.MultiIssuerAuthorizeResult = MultiIssuerAuthorizeResult;
1502
1868
  *
1503
1869
  * Represents an error that occurred when evaluating a Cedar policy.
1504
1870
  */
1505
- class PolicyEvaluationError {
1871
+ export class PolicyEvaluationError {
1506
1872
  static __wrap(ptr) {
1507
1873
  const obj = Object.create(PolicyEvaluationError.prototype);
1508
1874
  obj.__wbg_ptr = ptr;
@@ -1561,7 +1927,6 @@ class PolicyEvaluationError {
1561
1927
  }
1562
1928
  }
1563
1929
  if (Symbol.dispose) PolicyEvaluationError.prototype[Symbol.dispose] = PolicyEvaluationError.prototype.free;
1564
- exports.PolicyEvaluationError = PolicyEvaluationError;
1565
1930
 
1566
1931
  /**
1567
1932
  * Create a new instance of the Cedarling application.
@@ -1569,11 +1934,10 @@ exports.PolicyEvaluationError = PolicyEvaluationError;
1569
1934
  * @param {any} config
1570
1935
  * @returns {Promise<Cedarling>}
1571
1936
  */
1572
- function init(config) {
1937
+ export function init(config) {
1573
1938
  const ret = wasm.init(addHeapObject(config));
1574
1939
  return takeObject(ret);
1575
1940
  }
1576
- exports.init = init;
1577
1941
 
1578
1942
  /**
1579
1943
  * Create a new instance of the Cedarling application from archive bytes.
@@ -1595,11 +1959,10 @@ exports.init = init;
1595
1959
  * @param {Uint8Array} archive_bytes
1596
1960
  * @returns {Promise<Cedarling>}
1597
1961
  */
1598
- function init_from_archive_bytes(config, archive_bytes) {
1962
+ export function init_from_archive_bytes(config, archive_bytes) {
1599
1963
  const ret = wasm.init_from_archive_bytes(addHeapObject(config), addHeapObject(archive_bytes));
1600
1964
  return takeObject(ret);
1601
1965
  }
1602
- exports.init_from_archive_bytes = init_from_archive_bytes;
1603
1966
  function __wbg_get_imports() {
1604
1967
  const import0 = {
1605
1968
  __proto__: null,
@@ -1699,6 +2062,22 @@ function __wbg_get_imports() {
1699
2062
  const ret = AuthorizeResult.__wrap(arg0);
1700
2063
  return addHeapObject(ret);
1701
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
+ },
1702
2081
  __wbg_body_18c9f2ac15ead4b2: function(arg0) {
1703
2082
  const ret = getObject(arg0).body;
1704
2083
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
@@ -1999,7 +2378,7 @@ function __wbg_get_imports() {
1999
2378
  const a = state0.a;
2000
2379
  state0.a = 0;
2001
2380
  try {
2002
- return __wasm_bindgen_func_elem_8750(a, state0.b, arg0, arg1);
2381
+ return __wasm_bindgen_func_elem_8835(a, state0.b, arg0, arg1);
2003
2382
  } finally {
2004
2383
  state0.a = a;
2005
2384
  }
@@ -2208,18 +2587,18 @@ function __wbg_get_imports() {
2208
2587
  console.warn(...getObject(arg0));
2209
2588
  },
2210
2589
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
2211
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1196, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2212
- 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);
2213
2592
  return addHeapObject(ret);
2214
2593
  },
2215
2594
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
2216
- // 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`.
2217
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_8695);
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);
2218
2597
  return addHeapObject(ret);
2219
2598
  },
2220
2599
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
2221
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 883, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2222
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_8530);
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);
2223
2602
  return addHeapObject(ret);
2224
2603
  },
2225
2604
  __wbindgen_cast_0000000000000004: function(arg0) {
@@ -2261,18 +2640,18 @@ function __wbg_get_imports() {
2261
2640
  };
2262
2641
  }
2263
2642
 
2264
- function __wasm_bindgen_func_elem_8530(arg0, arg1) {
2265
- wasm.__wasm_bindgen_func_elem_8530(arg0, arg1);
2643
+ function __wasm_bindgen_func_elem_8615(arg0, arg1) {
2644
+ wasm.__wasm_bindgen_func_elem_8615(arg0, arg1);
2266
2645
  }
2267
2646
 
2268
- function __wasm_bindgen_func_elem_12170(arg0, arg1, arg2) {
2269
- 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));
2270
2649
  }
2271
2650
 
2272
- function __wasm_bindgen_func_elem_8695(arg0, arg1, arg2) {
2651
+ function __wasm_bindgen_func_elem_8780(arg0, arg1, arg2) {
2273
2652
  try {
2274
2653
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2275
- wasm.__wasm_bindgen_func_elem_8695(retptr, arg0, arg1, addHeapObject(arg2));
2654
+ wasm.__wasm_bindgen_func_elem_8780(retptr, arg0, arg1, addHeapObject(arg2));
2276
2655
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2277
2656
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2278
2657
  if (r1) {
@@ -2283,8 +2662,8 @@ function __wasm_bindgen_func_elem_8695(arg0, arg1, arg2) {
2283
2662
  }
2284
2663
  }
2285
2664
 
2286
- function __wasm_bindgen_func_elem_8750(arg0, arg1, arg2, arg3) {
2287
- wasm.__wasm_bindgen_func_elem_8750(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));
2288
2667
  }
2289
2668
 
2290
2669
 
@@ -2310,6 +2689,21 @@ const AuthorizeResultFinalization = (typeof FinalizationRegistry === 'undefined'
2310
2689
  const AuthorizeResultResponseFinalization = (typeof FinalizationRegistry === 'undefined')
2311
2690
  ? { register: () => {}, unregister: () => {} }
2312
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));
2313
2707
  const CedarlingFinalization = (typeof FinalizationRegistry === 'undefined')
2314
2708
  ? { register: () => {}, unregister: () => {} }
2315
2709
  : new FinalizationRegistry(ptr => wasm.__wbg_cedarling_free(ptr, 1));
@@ -2565,7 +2959,15 @@ function takeObject(idx) {
2565
2959
 
2566
2960
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2567
2961
  cachedTextDecoder.decode();
2962
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
2963
+ let numBytesDecoded = 0;
2568
2964
  function decodeText(ptr, len) {
2965
+ numBytesDecoded += len;
2966
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
2967
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2968
+ cachedTextDecoder.decode();
2969
+ numBytesDecoded = len;
2970
+ }
2569
2971
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
2570
2972
  }
2571
2973
 
@@ -2584,8 +2986,95 @@ if (!('encodeInto' in cachedTextEncoder)) {
2584
2986
 
2585
2987
  let WASM_VECTOR_LEN = 0;
2586
2988
 
2587
- const wasmPath = `${__dirname}/cedarling_wasm_bg.wasm`;
2588
- const wasmBytes = require('fs').readFileSync(wasmPath);
2589
- const wasmModule = new WebAssembly.Module(wasmBytes);
2590
- let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
2591
- let wasm = wasmInstance.exports;
2989
+ let wasmModule, wasmInstance, wasm;
2990
+ function __wbg_finalize_init(instance, module) {
2991
+ wasmInstance = instance;
2992
+ wasm = instance.exports;
2993
+ wasmModule = module;
2994
+ cachedDataViewMemory0 = null;
2995
+ cachedUint8ArrayMemory0 = null;
2996
+ return wasm;
2997
+ }
2998
+
2999
+ async function __wbg_load(module, imports) {
3000
+ if (typeof Response === 'function' && module instanceof Response) {
3001
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
3002
+ try {
3003
+ return await WebAssembly.instantiateStreaming(module, imports);
3004
+ } catch (e) {
3005
+ const validResponse = module.ok && expectedResponseType(module.type);
3006
+
3007
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
3008
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
3009
+
3010
+ } else { throw e; }
3011
+ }
3012
+ }
3013
+
3014
+ const bytes = await module.arrayBuffer();
3015
+ return await WebAssembly.instantiate(bytes, imports);
3016
+ } else {
3017
+ const instance = await WebAssembly.instantiate(module, imports);
3018
+
3019
+ if (instance instanceof WebAssembly.Instance) {
3020
+ return { instance, module };
3021
+ } else {
3022
+ return instance;
3023
+ }
3024
+ }
3025
+
3026
+ function expectedResponseType(type) {
3027
+ switch (type) {
3028
+ case 'basic': case 'cors': case 'default': return true;
3029
+ }
3030
+ return false;
3031
+ }
3032
+ }
3033
+
3034
+ function initSync(module) {
3035
+ if (wasm !== undefined) return wasm;
3036
+
3037
+
3038
+ if (module !== undefined) {
3039
+ if (Object.getPrototypeOf(module) === Object.prototype) {
3040
+ ({module} = module)
3041
+ } else {
3042
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
3043
+ }
3044
+ }
3045
+
3046
+ const imports = __wbg_get_imports();
3047
+ if (!(module instanceof WebAssembly.Module)) {
3048
+ module = new WebAssembly.Module(module);
3049
+ }
3050
+ const instance = new WebAssembly.Instance(module, imports);
3051
+ return __wbg_finalize_init(instance, module);
3052
+ }
3053
+
3054
+ async function __wbg_init(module_or_path) {
3055
+ if (wasm !== undefined) return wasm;
3056
+
3057
+
3058
+ if (module_or_path !== undefined) {
3059
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
3060
+ ({module_or_path} = module_or_path)
3061
+ } else {
3062
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
3063
+ }
3064
+ }
3065
+
3066
+ if (module_or_path === undefined) {
3067
+ module_or_path = new URL('cedarling_wasm_bg.wasm', import.meta.url);
3068
+ }
3069
+ const imports = __wbg_get_imports();
3070
+
3071
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
3072
+ module_or_path = fetch(module_or_path);
3073
+ }
3074
+
3075
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
3076
+
3077
+ return __wbg_finalize_init(instance, module);
3078
+ }
3079
+
3080
+ export { initSync, __wbg_init as default };
Binary file
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@janssenproject/cedarling_wasm",
3
+ "type": "module",
3
4
  "description": "The Cedarling is a performant local authorization service that runs the Rust Cedar Engine",
4
- "version": "0.0.420-nodejs",
5
+ "version": "0.0.421",
5
6
  "license": "Apache-2.0",
6
7
  "repository": {
7
8
  "type": "git",
@@ -13,5 +14,8 @@
13
14
  "cedarling_wasm.d.ts"
14
15
  ],
15
16
  "main": "cedarling_wasm.js",
16
- "types": "cedarling_wasm.d.ts"
17
+ "types": "cedarling_wasm.d.ts",
18
+ "sideEffects": [
19
+ "./snippets/*"
20
+ ]
17
21
  }