@janssenproject/cedarling_wasm 0.0.372-nodejs → 0.0.373

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.
@@ -524,3 +524,153 @@ export function init(config: any): Promise<Cedarling>;
524
524
  * ```
525
525
  */
526
526
  export function init_from_archive_bytes(config: any, archive_bytes: Uint8Array): Promise<Cedarling>;
527
+
528
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
529
+
530
+ export interface InitOutput {
531
+ readonly memory: WebAssembly.Memory;
532
+ readonly __wbg_authorizeresult_free: (a: number, b: number) => void;
533
+ readonly __wbg_authorizeresultresponse_free: (a: number, b: number) => void;
534
+ readonly __wbg_cedarling_free: (a: number, b: number) => void;
535
+ readonly __wbg_dataentry_free: (a: number, b: number) => void;
536
+ readonly __wbg_datastorestats_free: (a: number, b: number) => void;
537
+ readonly __wbg_diagnostics_free: (a: number, b: number) => void;
538
+ readonly __wbg_get_authorizeresult_decision: (a: number) => number;
539
+ readonly __wbg_get_authorizeresult_request_id: (a: number) => [number, number];
540
+ readonly __wbg_get_authorizeresult_response: (a: number) => number;
541
+ readonly __wbg_get_dataentry_access_count: (a: number) => bigint;
542
+ readonly __wbg_get_dataentry_created_at: (a: number) => [number, number];
543
+ readonly __wbg_get_dataentry_data_type: (a: number) => [number, number];
544
+ readonly __wbg_get_dataentry_expires_at: (a: number) => [number, number];
545
+ readonly __wbg_get_dataentry_key: (a: number) => [number, number];
546
+ readonly __wbg_get_datastorestats_avg_entry_size_bytes: (a: number) => number;
547
+ readonly __wbg_get_datastorestats_capacity_usage_percent: (a: number) => number;
548
+ readonly __wbg_get_datastorestats_entry_count: (a: number) => number;
549
+ readonly __wbg_get_datastorestats_max_entries: (a: number) => number;
550
+ readonly __wbg_get_datastorestats_max_entry_size: (a: number) => number;
551
+ readonly __wbg_get_datastorestats_memory_alert_threshold: (a: number) => number;
552
+ readonly __wbg_get_datastorestats_memory_alert_triggered: (a: number) => number;
553
+ readonly __wbg_get_datastorestats_metrics_enabled: (a: number) => number;
554
+ readonly __wbg_get_datastorestats_total_size_bytes: (a: number) => number;
555
+ readonly __wbg_policyevaluationerror_free: (a: number, b: number) => void;
556
+ readonly __wbg_set_authorizeresult_decision: (a: number, b: number) => void;
557
+ readonly __wbg_set_authorizeresult_request_id: (a: number, b: number, c: number) => void;
558
+ readonly __wbg_set_authorizeresult_response: (a: number, b: number) => void;
559
+ readonly __wbg_set_dataentry_access_count: (a: number, b: bigint) => void;
560
+ readonly __wbg_set_dataentry_created_at: (a: number, b: number, c: number) => void;
561
+ readonly __wbg_set_dataentry_data_type: (a: number, b: number, c: number) => void;
562
+ readonly __wbg_set_dataentry_expires_at: (a: number, b: number, c: number) => void;
563
+ readonly __wbg_set_dataentry_key: (a: number, b: number, c: number) => void;
564
+ readonly __wbg_set_datastorestats_avg_entry_size_bytes: (a: number, b: number) => void;
565
+ readonly __wbg_set_datastorestats_capacity_usage_percent: (a: number, b: number) => void;
566
+ readonly __wbg_set_datastorestats_entry_count: (a: number, b: number) => void;
567
+ readonly __wbg_set_datastorestats_max_entries: (a: number, b: number) => void;
568
+ readonly __wbg_set_datastorestats_max_entry_size: (a: number, b: number) => void;
569
+ readonly __wbg_set_datastorestats_memory_alert_threshold: (a: number, b: number) => void;
570
+ readonly __wbg_set_datastorestats_memory_alert_triggered: (a: number, b: number) => void;
571
+ readonly __wbg_set_datastorestats_metrics_enabled: (a: number, b: number) => void;
572
+ readonly __wbg_set_datastorestats_total_size_bytes: (a: number, b: number) => void;
573
+ readonly authorizeresult_json_string: (a: number) => [number, number];
574
+ readonly authorizeresultresponse_decision: (a: number) => number;
575
+ readonly authorizeresultresponse_diagnostics: (a: number) => number;
576
+ readonly cedarling_authorize_multi_issuer: (a: number, b: any) => any;
577
+ readonly cedarling_authorize_unsigned: (a: number, b: any) => any;
578
+ readonly cedarling_clear_data_ctx: (a: number) => [number, number];
579
+ readonly cedarling_failed_trusted_issuer_ids: (a: number) => any;
580
+ readonly cedarling_get_data_ctx: (a: number, b: number, c: number) => [number, number, number];
581
+ readonly cedarling_get_data_entry_ctx: (a: number, b: number, c: number) => [number, number, number];
582
+ readonly cedarling_get_log_by_id: (a: number, b: number, c: number) => [number, number, number];
583
+ readonly cedarling_get_log_ids: (a: number) => any;
584
+ readonly cedarling_get_logs_by_request_id: (a: number, b: number, c: number) => [number, number, number, number];
585
+ readonly cedarling_get_logs_by_request_id_and_tag: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
586
+ readonly cedarling_get_logs_by_tag: (a: number, b: number, c: number) => [number, number, number, number];
587
+ readonly cedarling_get_stats_ctx: (a: number) => [number, number, number];
588
+ readonly cedarling_is_trusted_issuer_loaded_by_iss: (a: number, b: number, c: number) => number;
589
+ readonly cedarling_is_trusted_issuer_loaded_by_name: (a: number, b: number, c: number) => number;
590
+ readonly cedarling_list_data_ctx: (a: number) => [number, number, number];
591
+ readonly cedarling_loaded_trusted_issuer_ids: (a: number) => any;
592
+ readonly cedarling_loaded_trusted_issuers_count: (a: number) => number;
593
+ readonly cedarling_new: (a: any) => any;
594
+ readonly cedarling_new_from_map: (a: any) => any;
595
+ readonly cedarling_pop_logs: (a: number) => [number, number, number];
596
+ readonly cedarling_push_data_ctx: (a: number, b: number, c: number, d: any, e: number, f: bigint) => [number, number];
597
+ readonly cedarling_remove_data_ctx: (a: number, b: number, c: number) => [number, number, number];
598
+ readonly cedarling_shut_down: (a: number) => any;
599
+ readonly cedarling_total_issuers: (a: number) => number;
600
+ readonly dataentry_json_string: (a: number) => [number, number];
601
+ readonly dataentry_value: (a: number) => [number, number, number];
602
+ readonly datastorestats_json_string: (a: number) => [number, number];
603
+ readonly diagnostics_errors: (a: number) => [number, number];
604
+ readonly diagnostics_reason: (a: number) => [number, number];
605
+ readonly init: (a: any) => any;
606
+ readonly init_from_archive_bytes: (a: any, b: any) => any;
607
+ readonly multiissuerauthorizeresult_json_string: (a: number) => [number, number];
608
+ readonly policyevaluationerror_error: (a: number) => [number, number];
609
+ readonly policyevaluationerror_id: (a: number) => [number, number];
610
+ readonly __wbg_get_multiissuerauthorizeresult_response: (a: number) => number;
611
+ readonly __wbg_get_multiissuerauthorizeresult_decision: (a: number) => number;
612
+ readonly __wbg_set_multiissuerauthorizeresult_response: (a: number, b: number) => void;
613
+ readonly __wbg_set_multiissuerauthorizeresult_request_id: (a: number, b: number, c: number) => void;
614
+ readonly __wbg_set_multiissuerauthorizeresult_decision: (a: number, b: number) => void;
615
+ readonly __wbg_get_multiissuerauthorizeresult_request_id: (a: number) => [number, number];
616
+ readonly __wbg_multiissuerauthorizeresult_free: (a: number, b: number) => void;
617
+ readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
618
+ readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
619
+ readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
620
+ readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
621
+ readonly intounderlyingbytesource_cancel: (a: number) => void;
622
+ readonly intounderlyingbytesource_pull: (a: number, b: any) => any;
623
+ readonly intounderlyingbytesource_start: (a: number, b: any) => void;
624
+ readonly intounderlyingbytesource_type: (a: number) => number;
625
+ readonly intounderlyingsink_abort: (a: number, b: any) => any;
626
+ readonly intounderlyingsink_close: (a: number) => any;
627
+ readonly intounderlyingsink_write: (a: number, b: any) => any;
628
+ readonly intounderlyingsource_cancel: (a: number) => void;
629
+ readonly intounderlyingsource_pull: (a: number, b: any) => any;
630
+ readonly rust_zstd_wasm_shim_calloc: (a: number, b: number) => number;
631
+ readonly rust_zstd_wasm_shim_free: (a: number) => void;
632
+ readonly rust_zstd_wasm_shim_malloc: (a: number) => number;
633
+ readonly rust_zstd_wasm_shim_memcmp: (a: number, b: number, c: number) => number;
634
+ readonly rust_zstd_wasm_shim_memcpy: (a: number, b: number, c: number) => number;
635
+ readonly rust_zstd_wasm_shim_memmove: (a: number, b: number, c: number) => number;
636
+ readonly rust_zstd_wasm_shim_memset: (a: number, b: number, c: number) => number;
637
+ readonly rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void;
638
+ readonly wasm_bindgen__convert__closures_____invoke__h80274e53af2c4a90: (a: number, b: number, c: any) => [number, number];
639
+ readonly wasm_bindgen__convert__closures_____invoke__h66f11f9242c621fe: (a: number, b: number, c: any, d: any) => void;
640
+ readonly wasm_bindgen__convert__closures_____invoke__h170c6019ccfd853a: (a: number, b: number, c: any) => void;
641
+ readonly wasm_bindgen__convert__closures_____invoke__ha272cf34a0c89527: (a: number, b: number) => void;
642
+ readonly wasm_bindgen__convert__closures_____invoke__h1f68ebdd661f92ac: (a: number, b: number) => void;
643
+ readonly wasm_bindgen__convert__closures_____invoke__hc6d79abdb072c199: (a: number, b: number) => void;
644
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
645
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
646
+ readonly __wbindgen_exn_store: (a: number) => void;
647
+ readonly __externref_table_alloc: () => number;
648
+ readonly __wbindgen_externrefs: WebAssembly.Table;
649
+ readonly __wbindgen_destroy_closure: (a: number, b: number) => void;
650
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
651
+ readonly __externref_table_dealloc: (a: number) => void;
652
+ readonly __externref_drop_slice: (a: number, b: number) => void;
653
+ readonly __wbindgen_start: () => void;
654
+ }
655
+
656
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
657
+
658
+ /**
659
+ * Instantiates the given `module`, which can either be bytes or
660
+ * a precompiled `WebAssembly.Module`.
661
+ *
662
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
663
+ *
664
+ * @returns {InitOutput}
665
+ */
666
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
667
+
668
+ /**
669
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
670
+ * for everything else, calls `WebAssembly.instantiate` directly.
671
+ *
672
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
673
+ *
674
+ * @returns {Promise<InitOutput>}
675
+ */
676
+ 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);
@@ -105,13 +105,12 @@ class AuthorizeResult {
105
105
  }
106
106
  }
107
107
  if (Symbol.dispose) AuthorizeResult.prototype[Symbol.dispose] = AuthorizeResult.prototype.free;
108
- exports.AuthorizeResult = AuthorizeResult;
109
108
 
110
109
  /**
111
110
  * A WASM wrapper for the Rust `cedar_policy::Response` struct.
112
111
  * Represents the result of an authorization request.
113
112
  */
114
- class AuthorizeResultResponse {
113
+ export class AuthorizeResultResponse {
115
114
  static __wrap(ptr) {
116
115
  ptr = ptr >>> 0;
117
116
  const obj = Object.create(AuthorizeResultResponse.prototype);
@@ -147,12 +146,11 @@ class AuthorizeResultResponse {
147
146
  }
148
147
  }
149
148
  if (Symbol.dispose) AuthorizeResultResponse.prototype[Symbol.dispose] = AuthorizeResultResponse.prototype.free;
150
- exports.AuthorizeResultResponse = AuthorizeResultResponse;
151
149
 
152
150
  /**
153
151
  * The instance of the Cedarling application.
154
152
  */
155
- class Cedarling {
153
+ export class Cedarling {
156
154
  static __wrap(ptr) {
157
155
  ptr = ptr >>> 0;
158
156
  const obj = Object.create(Cedarling.prototype);
@@ -588,13 +586,12 @@ class Cedarling {
588
586
  }
589
587
  }
590
588
  if (Symbol.dispose) Cedarling.prototype[Symbol.dispose] = Cedarling.prototype.free;
591
- exports.Cedarling = Cedarling;
592
589
 
593
590
  /**
594
591
  * A WASM wrapper for the Rust `cedarling::DataEntry` struct.
595
592
  * Represents a data entry in the DataStore with value and metadata.
596
593
  */
597
- class DataEntry {
594
+ export class DataEntry {
598
595
  static __wrap(ptr) {
599
596
  ptr = ptr >>> 0;
600
597
  const obj = Object.create(DataEntry.prototype);
@@ -753,13 +750,12 @@ class DataEntry {
753
750
  }
754
751
  }
755
752
  if (Symbol.dispose) DataEntry.prototype[Symbol.dispose] = DataEntry.prototype.free;
756
- exports.DataEntry = DataEntry;
757
753
 
758
754
  /**
759
755
  * A WASM wrapper for the Rust `cedarling::DataStoreStats` struct.
760
756
  * Statistics about the DataStore.
761
757
  */
762
- class DataStoreStats {
758
+ export class DataStoreStats {
763
759
  static __wrap(ptr) {
764
760
  ptr = ptr >>> 0;
765
761
  const obj = Object.create(DataStoreStats.prototype);
@@ -930,7 +926,6 @@ class DataStoreStats {
930
926
  }
931
927
  }
932
928
  if (Symbol.dispose) DataStoreStats.prototype[Symbol.dispose] = DataStoreStats.prototype.free;
933
- exports.DataStoreStats = DataStoreStats;
934
929
 
935
930
  /**
936
931
  * Diagnostics
@@ -938,7 +933,7 @@ exports.DataStoreStats = DataStoreStats;
938
933
  *
939
934
  * Provides detailed information about how a policy decision was made, including policies that contributed to the decision and any errors encountered during evaluation.
940
935
  */
941
- class Diagnostics {
936
+ export class Diagnostics {
942
937
  static __wrap(ptr) {
943
938
  ptr = ptr >>> 0;
944
939
  const obj = Object.create(Diagnostics.prototype);
@@ -982,9 +977,8 @@ class Diagnostics {
982
977
  }
983
978
  }
984
979
  if (Symbol.dispose) Diagnostics.prototype[Symbol.dispose] = Diagnostics.prototype.free;
985
- exports.Diagnostics = Diagnostics;
986
980
 
987
- class IntoUnderlyingByteSource {
981
+ export class IntoUnderlyingByteSource {
988
982
  __destroy_into_raw() {
989
983
  const ptr = this.__wbg_ptr;
990
984
  this.__wbg_ptr = 0;
@@ -1029,9 +1023,8 @@ class IntoUnderlyingByteSource {
1029
1023
  }
1030
1024
  }
1031
1025
  if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
1032
- exports.IntoUnderlyingByteSource = IntoUnderlyingByteSource;
1033
1026
 
1034
- class IntoUnderlyingSink {
1027
+ export class IntoUnderlyingSink {
1035
1028
  __destroy_into_raw() {
1036
1029
  const ptr = this.__wbg_ptr;
1037
1030
  this.__wbg_ptr = 0;
@@ -1069,9 +1062,8 @@ class IntoUnderlyingSink {
1069
1062
  }
1070
1063
  }
1071
1064
  if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
1072
- exports.IntoUnderlyingSink = IntoUnderlyingSink;
1073
1065
 
1074
- class IntoUnderlyingSource {
1066
+ export class IntoUnderlyingSource {
1075
1067
  __destroy_into_raw() {
1076
1068
  const ptr = this.__wbg_ptr;
1077
1069
  this.__wbg_ptr = 0;
@@ -1096,13 +1088,12 @@ class IntoUnderlyingSource {
1096
1088
  }
1097
1089
  }
1098
1090
  if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
1099
- exports.IntoUnderlyingSource = IntoUnderlyingSource;
1100
1091
 
1101
1092
  /**
1102
1093
  * A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
1103
1094
  * Represents the result of a multi-issuer authorization request.
1104
1095
  */
1105
- class MultiIssuerAuthorizeResult {
1096
+ export class MultiIssuerAuthorizeResult {
1106
1097
  static __wrap(ptr) {
1107
1098
  ptr = ptr >>> 0;
1108
1099
  const obj = Object.create(MultiIssuerAuthorizeResult.prototype);
@@ -1199,7 +1190,6 @@ class MultiIssuerAuthorizeResult {
1199
1190
  }
1200
1191
  }
1201
1192
  if (Symbol.dispose) MultiIssuerAuthorizeResult.prototype[Symbol.dispose] = MultiIssuerAuthorizeResult.prototype.free;
1202
- exports.MultiIssuerAuthorizeResult = MultiIssuerAuthorizeResult;
1203
1193
 
1204
1194
  /**
1205
1195
  * PolicyEvaluationError
@@ -1207,7 +1197,7 @@ exports.MultiIssuerAuthorizeResult = MultiIssuerAuthorizeResult;
1207
1197
  *
1208
1198
  * Represents an error that occurred when evaluating a Cedar policy.
1209
1199
  */
1210
- class PolicyEvaluationError {
1200
+ export class PolicyEvaluationError {
1211
1201
  static __wrap(ptr) {
1212
1202
  ptr = ptr >>> 0;
1213
1203
  const obj = Object.create(PolicyEvaluationError.prototype);
@@ -1259,7 +1249,6 @@ class PolicyEvaluationError {
1259
1249
  }
1260
1250
  }
1261
1251
  if (Symbol.dispose) PolicyEvaluationError.prototype[Symbol.dispose] = PolicyEvaluationError.prototype.free;
1262
- exports.PolicyEvaluationError = PolicyEvaluationError;
1263
1252
 
1264
1253
  /**
1265
1254
  * Create a new instance of the Cedarling application.
@@ -1267,11 +1256,10 @@ exports.PolicyEvaluationError = PolicyEvaluationError;
1267
1256
  * @param {any} config
1268
1257
  * @returns {Promise<Cedarling>}
1269
1258
  */
1270
- function init(config) {
1259
+ export function init(config) {
1271
1260
  const ret = wasm.init(config);
1272
1261
  return ret;
1273
1262
  }
1274
- exports.init = init;
1275
1263
 
1276
1264
  /**
1277
1265
  * Create a new instance of the Cedarling application from archive bytes.
@@ -1293,11 +1281,10 @@ exports.init = init;
1293
1281
  * @param {Uint8Array} archive_bytes
1294
1282
  * @returns {Promise<Cedarling>}
1295
1283
  */
1296
- function init_from_archive_bytes(config, archive_bytes) {
1284
+ export function init_from_archive_bytes(config, archive_bytes) {
1297
1285
  const ret = wasm.init_from_archive_bytes(config, archive_bytes);
1298
1286
  return ret;
1299
1287
  }
1300
- exports.init_from_archive_bytes = init_from_archive_bytes;
1301
1288
  function __wbg_get_imports() {
1302
1289
  const import0 = {
1303
1290
  __proto__: null,
@@ -1441,6 +1428,10 @@ function __wbg_get_imports() {
1441
1428
  const ret = clearTimeout(arg0);
1442
1429
  return ret;
1443
1430
  },
1431
+ __wbg_clearTimeout_3629d6209dfcc46e: function(arg0) {
1432
+ const ret = clearTimeout(arg0);
1433
+ return ret;
1434
+ },
1444
1435
  __wbg_clearTimeout_c122f92fd48cd749: function(arg0) {
1445
1436
  const ret = clearTimeout(arg0);
1446
1437
  return ret;
@@ -1693,7 +1684,7 @@ function __wbg_get_imports() {
1693
1684
  const a = state0.a;
1694
1685
  state0.a = 0;
1695
1686
  try {
1696
- return wasm_bindgen__convert__closures_____invoke__h3fccbd5fc7c99223(a, state0.b, arg0, arg1);
1687
+ return wasm_bindgen__convert__closures_____invoke__h66f11f9242c621fe(a, state0.b, arg0, arg1);
1697
1688
  } finally {
1698
1689
  state0.a = a;
1699
1690
  }
@@ -1771,6 +1762,10 @@ function __wbg_get_imports() {
1771
1762
  __wbg_respond_008ca9525ae22847: function() { return handleError(function (arg0, arg1) {
1772
1763
  arg0.respond(arg1 >>> 0);
1773
1764
  }, arguments); },
1765
+ __wbg_setTimeout_56bcdccbad22fd44: function() { return handleError(function (arg0, arg1) {
1766
+ const ret = setTimeout(arg0, arg1);
1767
+ return ret;
1768
+ }, arguments); },
1774
1769
  __wbg_setTimeout_9f4169770fc5a5c3: function(arg0, arg1) {
1775
1770
  const ret = setTimeout(arg0, arg1);
1776
1771
  return ret;
@@ -1902,46 +1897,51 @@ function __wbg_get_imports() {
1902
1897
  console.warn(...arg0);
1903
1898
  },
1904
1899
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1905
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2168, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1906
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hfcfcbd3c7ca0a8cd);
1900
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2179, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1901
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h80274e53af2c4a90);
1907
1902
  return ret;
1908
1903
  },
1909
1904
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
1910
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 613, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1911
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h7af717b30b28e8ae);
1905
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 619, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1906
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h170c6019ccfd853a);
1912
1907
  return ret;
1913
1908
  },
1914
1909
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
1915
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 569, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1916
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h67964fb515305df3);
1910
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 526, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1911
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__ha272cf34a0c89527);
1917
1912
  return ret;
1918
1913
  },
1919
1914
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
1920
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 723, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1921
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hf5137e7a528f865f);
1915
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 575, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1916
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h1f68ebdd661f92ac);
1917
+ return ret;
1918
+ },
1919
+ __wbindgen_cast_0000000000000005: function(arg0, arg1) {
1920
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 733, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1921
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hc6d79abdb072c199);
1922
1922
  return ret;
1923
1923
  },
1924
- __wbindgen_cast_0000000000000005: function(arg0) {
1924
+ __wbindgen_cast_0000000000000006: function(arg0) {
1925
1925
  // Cast intrinsic for `F64 -> Externref`.
1926
1926
  const ret = arg0;
1927
1927
  return ret;
1928
1928
  },
1929
- __wbindgen_cast_0000000000000006: function(arg0) {
1929
+ __wbindgen_cast_0000000000000007: function(arg0) {
1930
1930
  // Cast intrinsic for `I64 -> Externref`.
1931
1931
  const ret = arg0;
1932
1932
  return ret;
1933
1933
  },
1934
- __wbindgen_cast_0000000000000007: function(arg0, arg1) {
1934
+ __wbindgen_cast_0000000000000008: function(arg0, arg1) {
1935
1935
  // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
1936
1936
  const ret = getArrayU8FromWasm0(arg0, arg1);
1937
1937
  return ret;
1938
1938
  },
1939
- __wbindgen_cast_0000000000000008: function(arg0, arg1) {
1939
+ __wbindgen_cast_0000000000000009: function(arg0, arg1) {
1940
1940
  // Cast intrinsic for `Ref(String) -> Externref`.
1941
1941
  const ret = getStringFromWasm0(arg0, arg1);
1942
1942
  return ret;
1943
1943
  },
1944
- __wbindgen_cast_0000000000000009: function(arg0) {
1944
+ __wbindgen_cast_000000000000000a: function(arg0) {
1945
1945
  // Cast intrinsic for `U64 -> Externref`.
1946
1946
  const ret = BigInt.asUintN(64, arg0);
1947
1947
  return ret;
@@ -1962,27 +1962,31 @@ function __wbg_get_imports() {
1962
1962
  };
1963
1963
  }
1964
1964
 
1965
- function wasm_bindgen__convert__closures_____invoke__h67964fb515305df3(arg0, arg1) {
1966
- wasm.wasm_bindgen__convert__closures_____invoke__h67964fb515305df3(arg0, arg1);
1965
+ function wasm_bindgen__convert__closures_____invoke__ha272cf34a0c89527(arg0, arg1) {
1966
+ wasm.wasm_bindgen__convert__closures_____invoke__ha272cf34a0c89527(arg0, arg1);
1967
+ }
1968
+
1969
+ function wasm_bindgen__convert__closures_____invoke__h1f68ebdd661f92ac(arg0, arg1) {
1970
+ wasm.wasm_bindgen__convert__closures_____invoke__h1f68ebdd661f92ac(arg0, arg1);
1967
1971
  }
1968
1972
 
1969
- function wasm_bindgen__convert__closures_____invoke__hf5137e7a528f865f(arg0, arg1) {
1970
- wasm.wasm_bindgen__convert__closures_____invoke__hf5137e7a528f865f(arg0, arg1);
1973
+ function wasm_bindgen__convert__closures_____invoke__hc6d79abdb072c199(arg0, arg1) {
1974
+ wasm.wasm_bindgen__convert__closures_____invoke__hc6d79abdb072c199(arg0, arg1);
1971
1975
  }
1972
1976
 
1973
- function wasm_bindgen__convert__closures_____invoke__h7af717b30b28e8ae(arg0, arg1, arg2) {
1974
- wasm.wasm_bindgen__convert__closures_____invoke__h7af717b30b28e8ae(arg0, arg1, arg2);
1977
+ function wasm_bindgen__convert__closures_____invoke__h170c6019ccfd853a(arg0, arg1, arg2) {
1978
+ wasm.wasm_bindgen__convert__closures_____invoke__h170c6019ccfd853a(arg0, arg1, arg2);
1975
1979
  }
1976
1980
 
1977
- function wasm_bindgen__convert__closures_____invoke__hfcfcbd3c7ca0a8cd(arg0, arg1, arg2) {
1978
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__hfcfcbd3c7ca0a8cd(arg0, arg1, arg2);
1981
+ function wasm_bindgen__convert__closures_____invoke__h80274e53af2c4a90(arg0, arg1, arg2) {
1982
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h80274e53af2c4a90(arg0, arg1, arg2);
1979
1983
  if (ret[1]) {
1980
1984
  throw takeFromExternrefTable0(ret[0]);
1981
1985
  }
1982
1986
  }
1983
1987
 
1984
- function wasm_bindgen__convert__closures_____invoke__h3fccbd5fc7c99223(arg0, arg1, arg2, arg3) {
1985
- wasm.wasm_bindgen__convert__closures_____invoke__h3fccbd5fc7c99223(arg0, arg1, arg2, arg3);
1988
+ function wasm_bindgen__convert__closures_____invoke__h66f11f9242c621fe(arg0, arg1, arg2, arg3) {
1989
+ wasm.wasm_bindgen__convert__closures_____invoke__h66f11f9242c621fe(arg0, arg1, arg2, arg3);
1986
1990
  }
1987
1991
 
1988
1992
 
@@ -2240,7 +2244,15 @@ function takeFromExternrefTable0(idx) {
2240
2244
 
2241
2245
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2242
2246
  cachedTextDecoder.decode();
2247
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
2248
+ let numBytesDecoded = 0;
2243
2249
  function decodeText(ptr, len) {
2250
+ numBytesDecoded += len;
2251
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
2252
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2253
+ cachedTextDecoder.decode();
2254
+ numBytesDecoded = len;
2255
+ }
2244
2256
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
2245
2257
  }
2246
2258
 
@@ -2259,8 +2271,95 @@ if (!('encodeInto' in cachedTextEncoder)) {
2259
2271
 
2260
2272
  let WASM_VECTOR_LEN = 0;
2261
2273
 
2262
- const wasmPath = `${__dirname}/cedarling_wasm_bg.wasm`;
2263
- const wasmBytes = require('fs').readFileSync(wasmPath);
2264
- const wasmModule = new WebAssembly.Module(wasmBytes);
2265
- let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
2266
- wasm.__wbindgen_start();
2274
+ let wasmModule, wasm;
2275
+ function __wbg_finalize_init(instance, module) {
2276
+ wasm = instance.exports;
2277
+ wasmModule = module;
2278
+ cachedDataViewMemory0 = null;
2279
+ cachedUint8ArrayMemory0 = null;
2280
+ wasm.__wbindgen_start();
2281
+ return wasm;
2282
+ }
2283
+
2284
+ async function __wbg_load(module, imports) {
2285
+ if (typeof Response === 'function' && module instanceof Response) {
2286
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
2287
+ try {
2288
+ return await WebAssembly.instantiateStreaming(module, imports);
2289
+ } catch (e) {
2290
+ const validResponse = module.ok && expectedResponseType(module.type);
2291
+
2292
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
2293
+ 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);
2294
+
2295
+ } else { throw e; }
2296
+ }
2297
+ }
2298
+
2299
+ const bytes = await module.arrayBuffer();
2300
+ return await WebAssembly.instantiate(bytes, imports);
2301
+ } else {
2302
+ const instance = await WebAssembly.instantiate(module, imports);
2303
+
2304
+ if (instance instanceof WebAssembly.Instance) {
2305
+ return { instance, module };
2306
+ } else {
2307
+ return instance;
2308
+ }
2309
+ }
2310
+
2311
+ function expectedResponseType(type) {
2312
+ switch (type) {
2313
+ case 'basic': case 'cors': case 'default': return true;
2314
+ }
2315
+ return false;
2316
+ }
2317
+ }
2318
+
2319
+ function initSync(module) {
2320
+ if (wasm !== undefined) return wasm;
2321
+
2322
+
2323
+ if (module !== undefined) {
2324
+ if (Object.getPrototypeOf(module) === Object.prototype) {
2325
+ ({module} = module)
2326
+ } else {
2327
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
2328
+ }
2329
+ }
2330
+
2331
+ const imports = __wbg_get_imports();
2332
+ if (!(module instanceof WebAssembly.Module)) {
2333
+ module = new WebAssembly.Module(module);
2334
+ }
2335
+ const instance = new WebAssembly.Instance(module, imports);
2336
+ return __wbg_finalize_init(instance, module);
2337
+ }
2338
+
2339
+ async function __wbg_init(module_or_path) {
2340
+ if (wasm !== undefined) return wasm;
2341
+
2342
+
2343
+ if (module_or_path !== undefined) {
2344
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
2345
+ ({module_or_path} = module_or_path)
2346
+ } else {
2347
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
2348
+ }
2349
+ }
2350
+
2351
+ if (module_or_path === undefined) {
2352
+ module_or_path = new URL('cedarling_wasm_bg.wasm', import.meta.url);
2353
+ }
2354
+ const imports = __wbg_get_imports();
2355
+
2356
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
2357
+ module_or_path = fetch(module_or_path);
2358
+ }
2359
+
2360
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
2361
+
2362
+ return __wbg_finalize_init(instance, module);
2363
+ }
2364
+
2365
+ 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.372-nodejs",
5
+ "version": "0.0.373",
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
  }