@janssenproject/cedarling_wasm 0.0.348-nodejs → 0.0.348

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.
@@ -516,3 +516,151 @@ export function init(config: any): Promise<Cedarling>;
516
516
  * ```
517
517
  */
518
518
  export function init_from_archive_bytes(config: any, archive_bytes: Uint8Array): Promise<Cedarling>;
519
+
520
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
521
+
522
+ export interface InitOutput {
523
+ readonly memory: WebAssembly.Memory;
524
+ readonly __wbg_cedarling_free: (a: number, b: number) => void;
525
+ readonly __wbg_multiissuerauthorizeresult_free: (a: number, b: number) => void;
526
+ readonly __wbg_get_multiissuerauthorizeresult_response: (a: number) => number;
527
+ readonly __wbg_set_multiissuerauthorizeresult_response: (a: number, b: number) => void;
528
+ readonly __wbg_get_multiissuerauthorizeresult_decision: (a: number) => number;
529
+ readonly __wbg_set_multiissuerauthorizeresult_decision: (a: number, b: number) => void;
530
+ readonly __wbg_get_multiissuerauthorizeresult_request_id: (a: number) => [number, number];
531
+ readonly __wbg_set_multiissuerauthorizeresult_request_id: (a: number, b: number, c: number) => void;
532
+ readonly multiissuerauthorizeresult_json_string: (a: number) => [number, number];
533
+ readonly init: (a: any) => any;
534
+ readonly init_from_archive_bytes: (a: any, b: any) => any;
535
+ readonly cedarling_new: (a: any) => any;
536
+ readonly cedarling_new_from_map: (a: any) => any;
537
+ readonly cedarling_authorize_unsigned: (a: number, b: any) => any;
538
+ readonly cedarling_authorize_multi_issuer: (a: number, b: any) => any;
539
+ readonly cedarling_pop_logs: (a: number) => [number, number, number];
540
+ readonly cedarling_get_log_by_id: (a: number, b: number, c: number) => [number, number, number];
541
+ readonly cedarling_get_log_ids: (a: number) => any;
542
+ readonly cedarling_get_logs_by_tag: (a: number, b: number, c: number) => [number, number, number, number];
543
+ readonly cedarling_get_logs_by_request_id: (a: number, b: number, c: number) => [number, number, number, number];
544
+ readonly cedarling_get_logs_by_request_id_and_tag: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
545
+ readonly cedarling_shut_down: (a: number) => any;
546
+ readonly cedarling_push_data_ctx: (a: number, b: number, c: number, d: any, e: number, f: bigint) => [number, number];
547
+ readonly cedarling_get_data_ctx: (a: number, b: number, c: number) => [number, number, number];
548
+ readonly cedarling_get_data_entry_ctx: (a: number, b: number, c: number) => [number, number, number];
549
+ readonly cedarling_remove_data_ctx: (a: number, b: number, c: number) => [number, number, number];
550
+ readonly cedarling_clear_data_ctx: (a: number) => [number, number];
551
+ readonly cedarling_list_data_ctx: (a: number) => [number, number, number];
552
+ readonly cedarling_get_stats_ctx: (a: number) => [number, number, number];
553
+ readonly cedarling_is_trusted_issuer_loaded_by_name: (a: number, b: number, c: number) => number;
554
+ readonly cedarling_is_trusted_issuer_loaded_by_iss: (a: number, b: number, c: number) => number;
555
+ readonly cedarling_total_issuers: (a: number) => number;
556
+ readonly cedarling_loaded_trusted_issuers_count: (a: number) => number;
557
+ readonly cedarling_loaded_trusted_issuer_ids: (a: number) => any;
558
+ readonly cedarling_failed_trusted_issuer_ids: (a: number) => any;
559
+ readonly __wbg_authorizeresult_free: (a: number, b: number) => void;
560
+ readonly __wbg_get_authorizeresult_decision: (a: number) => number;
561
+ readonly __wbg_set_authorizeresult_decision: (a: number, b: number) => void;
562
+ readonly __wbg_get_authorizeresult_request_id: (a: number) => [number, number];
563
+ readonly __wbg_set_authorizeresult_request_id: (a: number, b: number, c: number) => void;
564
+ readonly authorizeresult_json_string: (a: number) => [number, number];
565
+ readonly authorizeresult_principal: (a: number, b: number, c: number) => number;
566
+ readonly __wbg_authorizeresultresponse_free: (a: number, b: number) => void;
567
+ readonly authorizeresultresponse_decision: (a: number) => number;
568
+ readonly authorizeresultresponse_diagnostics: (a: number) => number;
569
+ readonly __wbg_diagnostics_free: (a: number, b: number) => void;
570
+ readonly diagnostics_reason: (a: number) => [number, number];
571
+ readonly diagnostics_errors: (a: number) => [number, number];
572
+ readonly __wbg_policyevaluationerror_free: (a: number, b: number) => void;
573
+ readonly policyevaluationerror_id: (a: number) => [number, number];
574
+ readonly policyevaluationerror_error: (a: number) => [number, number];
575
+ readonly __wbg_dataentry_free: (a: number, b: number) => void;
576
+ readonly __wbg_get_dataentry_key: (a: number) => [number, number];
577
+ readonly __wbg_set_dataentry_key: (a: number, b: number, c: number) => void;
578
+ readonly __wbg_get_dataentry_data_type: (a: number) => [number, number];
579
+ readonly __wbg_set_dataentry_data_type: (a: number, b: number, c: number) => void;
580
+ readonly __wbg_get_dataentry_created_at: (a: number) => [number, number];
581
+ readonly __wbg_set_dataentry_created_at: (a: number, b: number, c: number) => void;
582
+ readonly __wbg_get_dataentry_expires_at: (a: number) => [number, number];
583
+ readonly __wbg_set_dataentry_expires_at: (a: number, b: number, c: number) => void;
584
+ readonly __wbg_get_dataentry_access_count: (a: number) => bigint;
585
+ readonly __wbg_set_dataentry_access_count: (a: number, b: bigint) => void;
586
+ readonly dataentry_value: (a: number) => [number, number, number];
587
+ readonly dataentry_json_string: (a: number) => [number, number];
588
+ readonly __wbg_datastorestats_free: (a: number, b: number) => void;
589
+ readonly __wbg_get_datastorestats_entry_count: (a: number) => number;
590
+ readonly __wbg_set_datastorestats_entry_count: (a: number, b: number) => void;
591
+ readonly __wbg_get_datastorestats_max_entries: (a: number) => number;
592
+ readonly __wbg_set_datastorestats_max_entries: (a: number, b: number) => void;
593
+ readonly __wbg_get_datastorestats_max_entry_size: (a: number) => number;
594
+ readonly __wbg_set_datastorestats_max_entry_size: (a: number, b: number) => void;
595
+ readonly __wbg_get_datastorestats_metrics_enabled: (a: number) => number;
596
+ readonly __wbg_set_datastorestats_metrics_enabled: (a: number, b: number) => void;
597
+ readonly __wbg_get_datastorestats_total_size_bytes: (a: number) => number;
598
+ readonly __wbg_set_datastorestats_total_size_bytes: (a: number, b: number) => void;
599
+ readonly __wbg_get_datastorestats_avg_entry_size_bytes: (a: number) => number;
600
+ readonly __wbg_set_datastorestats_avg_entry_size_bytes: (a: number, b: number) => void;
601
+ readonly __wbg_get_datastorestats_capacity_usage_percent: (a: number) => number;
602
+ readonly __wbg_set_datastorestats_capacity_usage_percent: (a: number, b: number) => void;
603
+ readonly __wbg_get_datastorestats_memory_alert_threshold: (a: number) => number;
604
+ readonly __wbg_set_datastorestats_memory_alert_threshold: (a: number, b: number) => void;
605
+ readonly __wbg_get_datastorestats_memory_alert_triggered: (a: number) => number;
606
+ readonly __wbg_set_datastorestats_memory_alert_triggered: (a: number, b: number) => void;
607
+ readonly datastorestats_json_string: (a: number) => [number, number];
608
+ readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
609
+ readonly intounderlyingbytesource_type: (a: number) => number;
610
+ readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
611
+ readonly intounderlyingbytesource_start: (a: number, b: any) => void;
612
+ readonly intounderlyingbytesource_pull: (a: number, b: any) => any;
613
+ readonly intounderlyingbytesource_cancel: (a: number) => void;
614
+ readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
615
+ readonly intounderlyingsource_pull: (a: number, b: any) => any;
616
+ readonly intounderlyingsource_cancel: (a: number) => void;
617
+ readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
618
+ readonly intounderlyingsink_write: (a: number, b: any) => any;
619
+ readonly intounderlyingsink_close: (a: number) => any;
620
+ readonly intounderlyingsink_abort: (a: number, b: any) => any;
621
+ readonly rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void;
622
+ readonly rust_zstd_wasm_shim_malloc: (a: number) => number;
623
+ readonly rust_zstd_wasm_shim_memcmp: (a: number, b: number, c: number) => number;
624
+ readonly rust_zstd_wasm_shim_calloc: (a: number, b: number) => number;
625
+ readonly rust_zstd_wasm_shim_free: (a: number) => void;
626
+ readonly rust_zstd_wasm_shim_memcpy: (a: number, b: number, c: number) => number;
627
+ readonly rust_zstd_wasm_shim_memmove: (a: number, b: number, c: number) => number;
628
+ readonly rust_zstd_wasm_shim_memset: (a: number, b: number, c: number) => number;
629
+ readonly wasm_bindgen__convert__closures_____invoke__haed62cf3e2984162: (a: number, b: number, c: any) => [number, number];
630
+ readonly wasm_bindgen__convert__closures_____invoke__h7b228b9e08b1988a: (a: number, b: number, c: any, d: any) => void;
631
+ readonly wasm_bindgen__convert__closures_____invoke__h7bfdbb08164f06ae: (a: number, b: number, c: any) => void;
632
+ readonly wasm_bindgen__convert__closures_____invoke__h57b5907d3b936f99: (a: number, b: number) => void;
633
+ readonly wasm_bindgen__convert__closures_____invoke__hc120bfaa77467242: (a: number, b: number) => void;
634
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
635
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
636
+ readonly __wbindgen_exn_store: (a: number) => void;
637
+ readonly __externref_table_alloc: () => number;
638
+ readonly __wbindgen_externrefs: WebAssembly.Table;
639
+ readonly __wbindgen_destroy_closure: (a: number, b: number) => void;
640
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
641
+ readonly __externref_table_dealloc: (a: number) => void;
642
+ readonly __externref_drop_slice: (a: number, b: number) => void;
643
+ readonly __wbindgen_start: () => void;
644
+ }
645
+
646
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
647
+
648
+ /**
649
+ * Instantiates the given `module`, which can either be bytes or
650
+ * a precompiled `WebAssembly.Module`.
651
+ *
652
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
653
+ *
654
+ * @returns {InitOutput}
655
+ */
656
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
657
+
658
+ /**
659
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
660
+ * for everything else, calls `WebAssembly.instantiate` directly.
661
+ *
662
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
663
+ *
664
+ * @returns {Promise<InitOutput>}
665
+ */
666
+ 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
  ptr = ptr >>> 0;
10
10
  const obj = Object.create(AuthorizeResult.prototype);
@@ -98,13 +98,12 @@ class AuthorizeResult {
98
98
  }
99
99
  }
100
100
  if (Symbol.dispose) AuthorizeResult.prototype[Symbol.dispose] = AuthorizeResult.prototype.free;
101
- exports.AuthorizeResult = AuthorizeResult;
102
101
 
103
102
  /**
104
103
  * A WASM wrapper for the Rust `cedar_policy::Response` struct.
105
104
  * Represents the result of an authorization request.
106
105
  */
107
- class AuthorizeResultResponse {
106
+ export class AuthorizeResultResponse {
108
107
  static __wrap(ptr) {
109
108
  ptr = ptr >>> 0;
110
109
  const obj = Object.create(AuthorizeResultResponse.prototype);
@@ -140,12 +139,11 @@ class AuthorizeResultResponse {
140
139
  }
141
140
  }
142
141
  if (Symbol.dispose) AuthorizeResultResponse.prototype[Symbol.dispose] = AuthorizeResultResponse.prototype.free;
143
- exports.AuthorizeResultResponse = AuthorizeResultResponse;
144
142
 
145
143
  /**
146
144
  * The instance of the Cedarling application.
147
145
  */
148
- class Cedarling {
146
+ export class Cedarling {
149
147
  static __wrap(ptr) {
150
148
  ptr = ptr >>> 0;
151
149
  const obj = Object.create(Cedarling.prototype);
@@ -576,13 +574,12 @@ class Cedarling {
576
574
  }
577
575
  }
578
576
  if (Symbol.dispose) Cedarling.prototype[Symbol.dispose] = Cedarling.prototype.free;
579
- exports.Cedarling = Cedarling;
580
577
 
581
578
  /**
582
579
  * A WASM wrapper for the Rust `cedarling::DataEntry` struct.
583
580
  * Represents a data entry in the DataStore with value and metadata.
584
581
  */
585
- class DataEntry {
582
+ export class DataEntry {
586
583
  static __wrap(ptr) {
587
584
  ptr = ptr >>> 0;
588
585
  const obj = Object.create(DataEntry.prototype);
@@ -741,13 +738,12 @@ class DataEntry {
741
738
  }
742
739
  }
743
740
  if (Symbol.dispose) DataEntry.prototype[Symbol.dispose] = DataEntry.prototype.free;
744
- exports.DataEntry = DataEntry;
745
741
 
746
742
  /**
747
743
  * A WASM wrapper for the Rust `cedarling::DataStoreStats` struct.
748
744
  * Statistics about the DataStore.
749
745
  */
750
- class DataStoreStats {
746
+ export class DataStoreStats {
751
747
  static __wrap(ptr) {
752
748
  ptr = ptr >>> 0;
753
749
  const obj = Object.create(DataStoreStats.prototype);
@@ -918,7 +914,6 @@ class DataStoreStats {
918
914
  }
919
915
  }
920
916
  if (Symbol.dispose) DataStoreStats.prototype[Symbol.dispose] = DataStoreStats.prototype.free;
921
- exports.DataStoreStats = DataStoreStats;
922
917
 
923
918
  /**
924
919
  * Diagnostics
@@ -926,7 +921,7 @@ exports.DataStoreStats = DataStoreStats;
926
921
  *
927
922
  * Provides detailed information about how a policy decision was made, including policies that contributed to the decision and any errors encountered during evaluation.
928
923
  */
929
- class Diagnostics {
924
+ export class Diagnostics {
930
925
  static __wrap(ptr) {
931
926
  ptr = ptr >>> 0;
932
927
  const obj = Object.create(Diagnostics.prototype);
@@ -970,9 +965,8 @@ class Diagnostics {
970
965
  }
971
966
  }
972
967
  if (Symbol.dispose) Diagnostics.prototype[Symbol.dispose] = Diagnostics.prototype.free;
973
- exports.Diagnostics = Diagnostics;
974
968
 
975
- class IntoUnderlyingByteSource {
969
+ export class IntoUnderlyingByteSource {
976
970
  __destroy_into_raw() {
977
971
  const ptr = this.__wbg_ptr;
978
972
  this.__wbg_ptr = 0;
@@ -1017,9 +1011,8 @@ class IntoUnderlyingByteSource {
1017
1011
  }
1018
1012
  }
1019
1013
  if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
1020
- exports.IntoUnderlyingByteSource = IntoUnderlyingByteSource;
1021
1014
 
1022
- class IntoUnderlyingSink {
1015
+ export class IntoUnderlyingSink {
1023
1016
  __destroy_into_raw() {
1024
1017
  const ptr = this.__wbg_ptr;
1025
1018
  this.__wbg_ptr = 0;
@@ -1057,9 +1050,8 @@ class IntoUnderlyingSink {
1057
1050
  }
1058
1051
  }
1059
1052
  if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
1060
- exports.IntoUnderlyingSink = IntoUnderlyingSink;
1061
1053
 
1062
- class IntoUnderlyingSource {
1054
+ export class IntoUnderlyingSource {
1063
1055
  __destroy_into_raw() {
1064
1056
  const ptr = this.__wbg_ptr;
1065
1057
  this.__wbg_ptr = 0;
@@ -1084,13 +1076,12 @@ class IntoUnderlyingSource {
1084
1076
  }
1085
1077
  }
1086
1078
  if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
1087
- exports.IntoUnderlyingSource = IntoUnderlyingSource;
1088
1079
 
1089
1080
  /**
1090
1081
  * A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
1091
1082
  * Represents the result of a multi-issuer authorization request.
1092
1083
  */
1093
- class MultiIssuerAuthorizeResult {
1084
+ export class MultiIssuerAuthorizeResult {
1094
1085
  static __wrap(ptr) {
1095
1086
  ptr = ptr >>> 0;
1096
1087
  const obj = Object.create(MultiIssuerAuthorizeResult.prototype);
@@ -1187,7 +1178,6 @@ class MultiIssuerAuthorizeResult {
1187
1178
  }
1188
1179
  }
1189
1180
  if (Symbol.dispose) MultiIssuerAuthorizeResult.prototype[Symbol.dispose] = MultiIssuerAuthorizeResult.prototype.free;
1190
- exports.MultiIssuerAuthorizeResult = MultiIssuerAuthorizeResult;
1191
1181
 
1192
1182
  /**
1193
1183
  * PolicyEvaluationError
@@ -1195,7 +1185,7 @@ exports.MultiIssuerAuthorizeResult = MultiIssuerAuthorizeResult;
1195
1185
  *
1196
1186
  * Represents an error that occurred when evaluating a Cedar policy.
1197
1187
  */
1198
- class PolicyEvaluationError {
1188
+ export class PolicyEvaluationError {
1199
1189
  static __wrap(ptr) {
1200
1190
  ptr = ptr >>> 0;
1201
1191
  const obj = Object.create(PolicyEvaluationError.prototype);
@@ -1247,7 +1237,6 @@ class PolicyEvaluationError {
1247
1237
  }
1248
1238
  }
1249
1239
  if (Symbol.dispose) PolicyEvaluationError.prototype[Symbol.dispose] = PolicyEvaluationError.prototype.free;
1250
- exports.PolicyEvaluationError = PolicyEvaluationError;
1251
1240
 
1252
1241
  /**
1253
1242
  * Create a new instance of the Cedarling application.
@@ -1255,11 +1244,10 @@ exports.PolicyEvaluationError = PolicyEvaluationError;
1255
1244
  * @param {any} config
1256
1245
  * @returns {Promise<Cedarling>}
1257
1246
  */
1258
- function init(config) {
1247
+ export function init(config) {
1259
1248
  const ret = wasm.init(config);
1260
1249
  return ret;
1261
1250
  }
1262
- exports.init = init;
1263
1251
 
1264
1252
  /**
1265
1253
  * Create a new instance of the Cedarling application from archive bytes.
@@ -1281,11 +1269,10 @@ exports.init = init;
1281
1269
  * @param {Uint8Array} archive_bytes
1282
1270
  * @returns {Promise<Cedarling>}
1283
1271
  */
1284
- function init_from_archive_bytes(config, archive_bytes) {
1272
+ export function init_from_archive_bytes(config, archive_bytes) {
1285
1273
  const ret = wasm.init_from_archive_bytes(config, archive_bytes);
1286
1274
  return ret;
1287
1275
  }
1288
- exports.init_from_archive_bytes = init_from_archive_bytes;
1289
1276
 
1290
1277
  function __wbg_get_imports() {
1291
1278
  const import0 = {
@@ -2229,7 +2216,15 @@ function takeFromExternrefTable0(idx) {
2229
2216
 
2230
2217
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2231
2218
  cachedTextDecoder.decode();
2219
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
2220
+ let numBytesDecoded = 0;
2232
2221
  function decodeText(ptr, len) {
2222
+ numBytesDecoded += len;
2223
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
2224
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2225
+ cachedTextDecoder.decode();
2226
+ numBytesDecoded = len;
2227
+ }
2233
2228
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
2234
2229
  }
2235
2230
 
@@ -2248,8 +2243,95 @@ if (!('encodeInto' in cachedTextEncoder)) {
2248
2243
 
2249
2244
  let WASM_VECTOR_LEN = 0;
2250
2245
 
2251
- const wasmPath = `${__dirname}/cedarling_wasm_bg.wasm`;
2252
- const wasmBytes = require('fs').readFileSync(wasmPath);
2253
- const wasmModule = new WebAssembly.Module(wasmBytes);
2254
- let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
2255
- wasm.__wbindgen_start();
2246
+ let wasmModule, wasm;
2247
+ function __wbg_finalize_init(instance, module) {
2248
+ wasm = instance.exports;
2249
+ wasmModule = module;
2250
+ cachedDataViewMemory0 = null;
2251
+ cachedUint8ArrayMemory0 = null;
2252
+ wasm.__wbindgen_start();
2253
+ return wasm;
2254
+ }
2255
+
2256
+ async function __wbg_load(module, imports) {
2257
+ if (typeof Response === 'function' && module instanceof Response) {
2258
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
2259
+ try {
2260
+ return await WebAssembly.instantiateStreaming(module, imports);
2261
+ } catch (e) {
2262
+ const validResponse = module.ok && expectedResponseType(module.type);
2263
+
2264
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
2265
+ 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);
2266
+
2267
+ } else { throw e; }
2268
+ }
2269
+ }
2270
+
2271
+ const bytes = await module.arrayBuffer();
2272
+ return await WebAssembly.instantiate(bytes, imports);
2273
+ } else {
2274
+ const instance = await WebAssembly.instantiate(module, imports);
2275
+
2276
+ if (instance instanceof WebAssembly.Instance) {
2277
+ return { instance, module };
2278
+ } else {
2279
+ return instance;
2280
+ }
2281
+ }
2282
+
2283
+ function expectedResponseType(type) {
2284
+ switch (type) {
2285
+ case 'basic': case 'cors': case 'default': return true;
2286
+ }
2287
+ return false;
2288
+ }
2289
+ }
2290
+
2291
+ function initSync(module) {
2292
+ if (wasm !== undefined) return wasm;
2293
+
2294
+
2295
+ if (module !== undefined) {
2296
+ if (Object.getPrototypeOf(module) === Object.prototype) {
2297
+ ({module} = module)
2298
+ } else {
2299
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
2300
+ }
2301
+ }
2302
+
2303
+ const imports = __wbg_get_imports();
2304
+ if (!(module instanceof WebAssembly.Module)) {
2305
+ module = new WebAssembly.Module(module);
2306
+ }
2307
+ const instance = new WebAssembly.Instance(module, imports);
2308
+ return __wbg_finalize_init(instance, module);
2309
+ }
2310
+
2311
+ async function __wbg_init(module_or_path) {
2312
+ if (wasm !== undefined) return wasm;
2313
+
2314
+
2315
+ if (module_or_path !== undefined) {
2316
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
2317
+ ({module_or_path} = module_or_path)
2318
+ } else {
2319
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
2320
+ }
2321
+ }
2322
+
2323
+ if (module_or_path === undefined) {
2324
+ module_or_path = new URL('cedarling_wasm_bg.wasm', import.meta.url);
2325
+ }
2326
+ const imports = __wbg_get_imports();
2327
+
2328
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
2329
+ module_or_path = fetch(module_or_path);
2330
+ }
2331
+
2332
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
2333
+
2334
+ return __wbg_finalize_init(instance, module);
2335
+ }
2336
+
2337
+ 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.348-nodejs",
5
+ "version": "0.0.348",
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
  }