@janssenproject/cedarling_wasm 0.0.417-nodejs → 0.0.417

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.
@@ -605,3 +605,150 @@ export function init(config: any): Promise<Cedarling>;
605
605
  * ```
606
606
  */
607
607
  export function init_from_archive_bytes(config: any, archive_bytes: Uint8Array): Promise<Cedarling>;
608
+
609
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
610
+
611
+ export interface InitOutput {
612
+ readonly memory: WebAssembly.Memory;
613
+ readonly __wbg_authorizeresult_free: (a: number, b: number) => void;
614
+ readonly __wbg_authorizeresultresponse_free: (a: number, b: number) => void;
615
+ readonly __wbg_cedarling_free: (a: number, b: number) => void;
616
+ readonly __wbg_dataentry_free: (a: number, b: number) => void;
617
+ readonly __wbg_datastorestats_free: (a: number, b: number) => void;
618
+ readonly __wbg_diagnostics_free: (a: number, b: number) => void;
619
+ readonly __wbg_get_authorizeresult_decision: (a: number) => number;
620
+ readonly __wbg_get_authorizeresult_request_id: (a: number, b: number) => void;
621
+ readonly __wbg_get_authorizeresult_response: (a: number) => number;
622
+ readonly __wbg_get_dataentry_access_count: (a: number) => bigint;
623
+ readonly __wbg_get_dataentry_created_at: (a: number, b: number) => void;
624
+ readonly __wbg_get_dataentry_data_type: (a: number, b: number) => void;
625
+ readonly __wbg_get_dataentry_expires_at: (a: number, b: number) => void;
626
+ readonly __wbg_get_dataentry_key: (a: number, b: number) => void;
627
+ readonly __wbg_get_datastorestats_avg_entry_size_bytes: (a: number) => number;
628
+ readonly __wbg_get_datastorestats_capacity_usage_percent: (a: number) => number;
629
+ readonly __wbg_get_datastorestats_entry_count: (a: number) => number;
630
+ readonly __wbg_get_datastorestats_max_entries: (a: number) => number;
631
+ readonly __wbg_get_datastorestats_max_entry_size: (a: number) => number;
632
+ readonly __wbg_get_datastorestats_memory_alert_threshold: (a: number) => number;
633
+ readonly __wbg_get_datastorestats_memory_alert_triggered: (a: number) => number;
634
+ readonly __wbg_get_datastorestats_metrics_enabled: (a: number) => number;
635
+ readonly __wbg_get_datastorestats_total_size_bytes: (a: number) => number;
636
+ readonly __wbg_policyevaluationerror_free: (a: number, b: number) => void;
637
+ readonly __wbg_set_authorizeresult_decision: (a: number, b: number) => void;
638
+ readonly __wbg_set_authorizeresult_request_id: (a: number, b: number, c: number) => void;
639
+ readonly __wbg_set_authorizeresult_response: (a: number, b: number) => void;
640
+ readonly __wbg_set_dataentry_access_count: (a: number, b: bigint) => void;
641
+ readonly __wbg_set_dataentry_created_at: (a: number, b: number, c: number) => void;
642
+ readonly __wbg_set_dataentry_data_type: (a: number, b: number, c: number) => void;
643
+ readonly __wbg_set_dataentry_expires_at: (a: number, b: number, c: number) => void;
644
+ readonly __wbg_set_dataentry_key: (a: number, b: number, c: number) => void;
645
+ readonly __wbg_set_datastorestats_avg_entry_size_bytes: (a: number, b: number) => void;
646
+ readonly __wbg_set_datastorestats_capacity_usage_percent: (a: number, b: number) => void;
647
+ readonly __wbg_set_datastorestats_entry_count: (a: number, b: number) => void;
648
+ readonly __wbg_set_datastorestats_max_entries: (a: number, b: number) => void;
649
+ readonly __wbg_set_datastorestats_max_entry_size: (a: number, b: number) => void;
650
+ readonly __wbg_set_datastorestats_memory_alert_threshold: (a: number, b: number) => void;
651
+ readonly __wbg_set_datastorestats_memory_alert_triggered: (a: number, b: number) => void;
652
+ readonly __wbg_set_datastorestats_metrics_enabled: (a: number, b: number) => void;
653
+ readonly __wbg_set_datastorestats_total_size_bytes: (a: number, b: number) => void;
654
+ readonly authorizeresult_json_string: (a: number, b: number) => void;
655
+ readonly authorizeresultresponse_decision: (a: number) => number;
656
+ readonly authorizeresultresponse_diagnostics: (a: number) => number;
657
+ readonly cedarling_annotation_values: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
658
+ readonly cedarling_annotations_by_policy: (a: number, b: number, c: number, d: number) => void;
659
+ readonly cedarling_annotations_map: (a: number, b: number, c: number, d: number) => void;
660
+ readonly cedarling_authorize_multi_issuer: (a: number, b: number, c: number) => number;
661
+ readonly cedarling_authorize_unsigned: (a: number, b: number, c: number) => number;
662
+ readonly cedarling_clear_data_ctx: (a: number, b: number) => void;
663
+ readonly cedarling_failed_trusted_issuer_ids: (a: number) => number;
664
+ readonly cedarling_get_data_ctx: (a: number, b: number, c: number, d: number) => void;
665
+ readonly cedarling_get_data_entry_ctx: (a: number, b: number, c: number, d: number) => void;
666
+ readonly cedarling_get_log_by_id: (a: number, b: number, c: number, d: number) => void;
667
+ readonly cedarling_get_log_ids: (a: number) => number;
668
+ readonly cedarling_get_logs_by_request_id: (a: number, b: number, c: number, d: number) => void;
669
+ readonly cedarling_get_logs_by_request_id_and_tag: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
670
+ readonly cedarling_get_stats_ctx: (a: number, b: number) => void;
671
+ readonly cedarling_is_trusted_issuer_loaded_by_iss: (a: number, b: number, c: number) => number;
672
+ readonly cedarling_is_trusted_issuer_loaded_by_name: (a: number, b: number, c: number) => number;
673
+ readonly cedarling_list_data_ctx: (a: number, b: number) => void;
674
+ readonly cedarling_loaded_trusted_issuer_ids: (a: number) => number;
675
+ readonly cedarling_loaded_trusted_issuers_count: (a: number) => number;
676
+ readonly cedarling_new: (a: number) => number;
677
+ readonly cedarling_new_from_map: (a: number) => number;
678
+ readonly cedarling_pop_logs: (a: number, b: number) => void;
679
+ readonly cedarling_push_data_ctx: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint) => void;
680
+ readonly cedarling_remove_data_ctx: (a: number, b: number, c: number, d: number) => void;
681
+ readonly cedarling_shut_down: (a: number) => number;
682
+ readonly cedarling_total_issuers: (a: number) => number;
683
+ readonly dataentry_json_string: (a: number, b: number) => void;
684
+ readonly dataentry_value: (a: number, b: number) => void;
685
+ readonly datastorestats_json_string: (a: number, b: number) => void;
686
+ readonly diagnostics_errors: (a: number, b: number) => void;
687
+ readonly diagnostics_reason: (a: number, b: number) => void;
688
+ readonly init: (a: number) => number;
689
+ readonly init_from_archive_bytes: (a: number, b: number) => number;
690
+ readonly multiissuerauthorizeresult_json_string: (a: number, b: number) => void;
691
+ readonly policyevaluationerror_error: (a: number, b: number) => void;
692
+ readonly policyevaluationerror_id: (a: number, b: number) => void;
693
+ readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
694
+ readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
695
+ readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
696
+ readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
697
+ readonly intounderlyingbytesource_cancel: (a: number) => void;
698
+ readonly intounderlyingbytesource_pull: (a: number, b: number) => number;
699
+ readonly intounderlyingbytesource_start: (a: number, b: number) => void;
700
+ readonly intounderlyingbytesource_type: (a: number) => number;
701
+ readonly intounderlyingsink_abort: (a: number, b: number) => number;
702
+ readonly intounderlyingsink_close: (a: number) => number;
703
+ readonly intounderlyingsink_write: (a: number, b: number) => number;
704
+ readonly intounderlyingsource_cancel: (a: number) => void;
705
+ readonly intounderlyingsource_pull: (a: number, b: number) => number;
706
+ readonly rust_zstd_wasm_shim_calloc: (a: number, b: number) => number;
707
+ readonly rust_zstd_wasm_shim_free: (a: number) => void;
708
+ readonly rust_zstd_wasm_shim_malloc: (a: number) => number;
709
+ readonly rust_zstd_wasm_shim_memcmp: (a: number, b: number, c: number) => number;
710
+ readonly rust_zstd_wasm_shim_memcpy: (a: number, b: number, c: number) => number;
711
+ readonly rust_zstd_wasm_shim_memmove: (a: number, b: number, c: number) => number;
712
+ readonly rust_zstd_wasm_shim_memset: (a: number, b: number, c: number) => number;
713
+ readonly rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void;
714
+ readonly __wbg_get_multiissuerauthorizeresult_decision: (a: number) => number;
715
+ readonly __wbg_set_multiissuerauthorizeresult_response: (a: number, b: number) => void;
716
+ readonly __wbg_set_multiissuerauthorizeresult_request_id: (a: number, b: number, c: number) => void;
717
+ readonly __wbg_set_multiissuerauthorizeresult_decision: (a: number, b: number) => void;
718
+ readonly __wbg_get_multiissuerauthorizeresult_response: (a: number) => number;
719
+ readonly __wbg_get_multiissuerauthorizeresult_request_id: (a: number, b: number) => void;
720
+ readonly __wbg_multiissuerauthorizeresult_free: (a: number, b: number) => void;
721
+ readonly cedarling_get_logs_by_tag: (a: number, b: number, c: number, d: number) => void;
722
+ readonly __wasm_bindgen_func_elem_8691: (a: number, b: number, c: number, d: number) => void;
723
+ readonly __wasm_bindgen_func_elem_8746: (a: number, b: number, c: number, d: number) => void;
724
+ readonly __wasm_bindgen_func_elem_12170: (a: number, b: number, c: number) => void;
725
+ readonly __wasm_bindgen_func_elem_8526: (a: number, b: number) => void;
726
+ readonly __wbindgen_export: (a: number, b: number) => number;
727
+ readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
728
+ readonly __wbindgen_export3: (a: number) => void;
729
+ readonly __wbindgen_export4: (a: number, b: number) => void;
730
+ readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
731
+ readonly __wbindgen_export5: (a: number, b: number, c: number) => void;
732
+ }
733
+
734
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
735
+
736
+ /**
737
+ * Instantiates the given `module`, which can either be bytes or
738
+ * a precompiled `WebAssembly.Module`.
739
+ *
740
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
741
+ *
742
+ * @returns {InitOutput}
743
+ */
744
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
745
+
746
+ /**
747
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
748
+ * for everything else, calls `WebAssembly.instantiate` directly.
749
+ *
750
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
751
+ *
752
+ * @returns {Promise<InitOutput>}
753
+ */
754
+ 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,11 @@ class AuthorizeResultResponse {
153
152
  }
154
153
  }
155
154
  if (Symbol.dispose) AuthorizeResultResponse.prototype[Symbol.dispose] = AuthorizeResultResponse.prototype.free;
156
- exports.AuthorizeResultResponse = AuthorizeResultResponse;
157
155
 
158
156
  /**
159
157
  * The instance of the Cedarling application.
160
158
  */
161
- class Cedarling {
159
+ export class Cedarling {
162
160
  static __wrap(ptr) {
163
161
  const obj = Object.create(Cedarling.prototype);
164
162
  obj.__wbg_ptr = ptr;
@@ -830,13 +828,12 @@ class Cedarling {
830
828
  }
831
829
  }
832
830
  if (Symbol.dispose) Cedarling.prototype[Symbol.dispose] = Cedarling.prototype.free;
833
- exports.Cedarling = Cedarling;
834
831
 
835
832
  /**
836
833
  * A WASM wrapper for the Rust `cedarling::DataEntry` struct.
837
834
  * Represents a data entry in the DataStore with value and metadata.
838
835
  */
839
- class DataEntry {
836
+ export class DataEntry {
840
837
  static __wrap(ptr) {
841
838
  const obj = Object.create(DataEntry.prototype);
842
839
  obj.__wbg_ptr = ptr;
@@ -1025,13 +1022,12 @@ class DataEntry {
1025
1022
  }
1026
1023
  }
1027
1024
  if (Symbol.dispose) DataEntry.prototype[Symbol.dispose] = DataEntry.prototype.free;
1028
- exports.DataEntry = DataEntry;
1029
1025
 
1030
1026
  /**
1031
1027
  * A WASM wrapper for the Rust `cedarling::DataStoreStats` struct.
1032
1028
  * Statistics about the DataStore.
1033
1029
  */
1034
- class DataStoreStats {
1030
+ export class DataStoreStats {
1035
1031
  static __wrap(ptr) {
1036
1032
  const obj = Object.create(DataStoreStats.prototype);
1037
1033
  obj.__wbg_ptr = ptr;
@@ -1205,7 +1201,6 @@ class DataStoreStats {
1205
1201
  }
1206
1202
  }
1207
1203
  if (Symbol.dispose) DataStoreStats.prototype[Symbol.dispose] = DataStoreStats.prototype.free;
1208
- exports.DataStoreStats = DataStoreStats;
1209
1204
 
1210
1205
  /**
1211
1206
  * Diagnostics
@@ -1213,7 +1208,7 @@ exports.DataStoreStats = DataStoreStats;
1213
1208
  *
1214
1209
  * Provides detailed information about how a policy decision was made, including policies that contributed to the decision and any errors encountered during evaluation.
1215
1210
  */
1216
- class Diagnostics {
1211
+ export class Diagnostics {
1217
1212
  static __wrap(ptr) {
1218
1213
  const obj = Object.create(Diagnostics.prototype);
1219
1214
  obj.__wbg_ptr = ptr;
@@ -1270,9 +1265,8 @@ class Diagnostics {
1270
1265
  }
1271
1266
  }
1272
1267
  if (Symbol.dispose) Diagnostics.prototype[Symbol.dispose] = Diagnostics.prototype.free;
1273
- exports.Diagnostics = Diagnostics;
1274
1268
 
1275
- class IntoUnderlyingByteSource {
1269
+ export class IntoUnderlyingByteSource {
1276
1270
  __destroy_into_raw() {
1277
1271
  const ptr = this.__wbg_ptr;
1278
1272
  this.__wbg_ptr = 0;
@@ -1317,9 +1311,8 @@ class IntoUnderlyingByteSource {
1317
1311
  }
1318
1312
  }
1319
1313
  if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
1320
- exports.IntoUnderlyingByteSource = IntoUnderlyingByteSource;
1321
1314
 
1322
- class IntoUnderlyingSink {
1315
+ export class IntoUnderlyingSink {
1323
1316
  __destroy_into_raw() {
1324
1317
  const ptr = this.__wbg_ptr;
1325
1318
  this.__wbg_ptr = 0;
@@ -1357,9 +1350,8 @@ class IntoUnderlyingSink {
1357
1350
  }
1358
1351
  }
1359
1352
  if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
1360
- exports.IntoUnderlyingSink = IntoUnderlyingSink;
1361
1353
 
1362
- class IntoUnderlyingSource {
1354
+ export class IntoUnderlyingSource {
1363
1355
  __destroy_into_raw() {
1364
1356
  const ptr = this.__wbg_ptr;
1365
1357
  this.__wbg_ptr = 0;
@@ -1384,13 +1376,12 @@ class IntoUnderlyingSource {
1384
1376
  }
1385
1377
  }
1386
1378
  if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
1387
- exports.IntoUnderlyingSource = IntoUnderlyingSource;
1388
1379
 
1389
1380
  /**
1390
1381
  * A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
1391
1382
  * Represents the result of a multi-issuer authorization request.
1392
1383
  */
1393
- class MultiIssuerAuthorizeResult {
1384
+ export class MultiIssuerAuthorizeResult {
1394
1385
  static __wrap(ptr) {
1395
1386
  const obj = Object.create(MultiIssuerAuthorizeResult.prototype);
1396
1387
  obj.__wbg_ptr = ptr;
@@ -1494,7 +1485,6 @@ class MultiIssuerAuthorizeResult {
1494
1485
  }
1495
1486
  }
1496
1487
  if (Symbol.dispose) MultiIssuerAuthorizeResult.prototype[Symbol.dispose] = MultiIssuerAuthorizeResult.prototype.free;
1497
- exports.MultiIssuerAuthorizeResult = MultiIssuerAuthorizeResult;
1498
1488
 
1499
1489
  /**
1500
1490
  * PolicyEvaluationError
@@ -1502,7 +1492,7 @@ exports.MultiIssuerAuthorizeResult = MultiIssuerAuthorizeResult;
1502
1492
  *
1503
1493
  * Represents an error that occurred when evaluating a Cedar policy.
1504
1494
  */
1505
- class PolicyEvaluationError {
1495
+ export class PolicyEvaluationError {
1506
1496
  static __wrap(ptr) {
1507
1497
  const obj = Object.create(PolicyEvaluationError.prototype);
1508
1498
  obj.__wbg_ptr = ptr;
@@ -1561,7 +1551,6 @@ class PolicyEvaluationError {
1561
1551
  }
1562
1552
  }
1563
1553
  if (Symbol.dispose) PolicyEvaluationError.prototype[Symbol.dispose] = PolicyEvaluationError.prototype.free;
1564
- exports.PolicyEvaluationError = PolicyEvaluationError;
1565
1554
 
1566
1555
  /**
1567
1556
  * Create a new instance of the Cedarling application.
@@ -1569,11 +1558,10 @@ exports.PolicyEvaluationError = PolicyEvaluationError;
1569
1558
  * @param {any} config
1570
1559
  * @returns {Promise<Cedarling>}
1571
1560
  */
1572
- function init(config) {
1561
+ export function init(config) {
1573
1562
  const ret = wasm.init(addHeapObject(config));
1574
1563
  return takeObject(ret);
1575
1564
  }
1576
- exports.init = init;
1577
1565
 
1578
1566
  /**
1579
1567
  * Create a new instance of the Cedarling application from archive bytes.
@@ -1595,11 +1583,10 @@ exports.init = init;
1595
1583
  * @param {Uint8Array} archive_bytes
1596
1584
  * @returns {Promise<Cedarling>}
1597
1585
  */
1598
- function init_from_archive_bytes(config, archive_bytes) {
1586
+ export function init_from_archive_bytes(config, archive_bytes) {
1599
1587
  const ret = wasm.init_from_archive_bytes(addHeapObject(config), addHeapObject(archive_bytes));
1600
1588
  return takeObject(ret);
1601
1589
  }
1602
- exports.init_from_archive_bytes = init_from_archive_bytes;
1603
1590
  function __wbg_get_imports() {
1604
1591
  const import0 = {
1605
1592
  __proto__: null,
@@ -1999,7 +1986,7 @@ function __wbg_get_imports() {
1999
1986
  const a = state0.a;
2000
1987
  state0.a = 0;
2001
1988
  try {
2002
- return __wasm_bindgen_func_elem_8748(a, state0.b, arg0, arg1);
1989
+ return __wasm_bindgen_func_elem_8746(a, state0.b, arg0, arg1);
2003
1990
  } finally {
2004
1991
  state0.a = a;
2005
1992
  }
@@ -2209,17 +2196,17 @@ function __wbg_get_imports() {
2209
2196
  },
2210
2197
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
2211
2198
  // 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_12171);
2199
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_12170);
2213
2200
  return addHeapObject(ret);
2214
2201
  },
2215
2202
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
2216
2203
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 995, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2217
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_8693);
2204
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_8691);
2218
2205
  return addHeapObject(ret);
2219
2206
  },
2220
2207
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
2221
2208
  // 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_8528);
2209
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_8526);
2223
2210
  return addHeapObject(ret);
2224
2211
  },
2225
2212
  __wbindgen_cast_0000000000000004: function(arg0) {
@@ -2261,18 +2248,18 @@ function __wbg_get_imports() {
2261
2248
  };
2262
2249
  }
2263
2250
 
2264
- function __wasm_bindgen_func_elem_8528(arg0, arg1) {
2265
- wasm.__wasm_bindgen_func_elem_8528(arg0, arg1);
2251
+ function __wasm_bindgen_func_elem_8526(arg0, arg1) {
2252
+ wasm.__wasm_bindgen_func_elem_8526(arg0, arg1);
2266
2253
  }
2267
2254
 
2268
- function __wasm_bindgen_func_elem_12171(arg0, arg1, arg2) {
2269
- wasm.__wasm_bindgen_func_elem_12171(arg0, arg1, addHeapObject(arg2));
2255
+ function __wasm_bindgen_func_elem_12170(arg0, arg1, arg2) {
2256
+ wasm.__wasm_bindgen_func_elem_12170(arg0, arg1, addHeapObject(arg2));
2270
2257
  }
2271
2258
 
2272
- function __wasm_bindgen_func_elem_8693(arg0, arg1, arg2) {
2259
+ function __wasm_bindgen_func_elem_8691(arg0, arg1, arg2) {
2273
2260
  try {
2274
2261
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2275
- wasm.__wasm_bindgen_func_elem_8693(retptr, arg0, arg1, addHeapObject(arg2));
2262
+ wasm.__wasm_bindgen_func_elem_8691(retptr, arg0, arg1, addHeapObject(arg2));
2276
2263
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2277
2264
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2278
2265
  if (r1) {
@@ -2283,8 +2270,8 @@ function __wasm_bindgen_func_elem_8693(arg0, arg1, arg2) {
2283
2270
  }
2284
2271
  }
2285
2272
 
2286
- function __wasm_bindgen_func_elem_8748(arg0, arg1, arg2, arg3) {
2287
- wasm.__wasm_bindgen_func_elem_8748(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
2273
+ function __wasm_bindgen_func_elem_8746(arg0, arg1, arg2, arg3) {
2274
+ wasm.__wasm_bindgen_func_elem_8746(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
2288
2275
  }
2289
2276
 
2290
2277
 
@@ -2565,7 +2552,15 @@ function takeObject(idx) {
2565
2552
 
2566
2553
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2567
2554
  cachedTextDecoder.decode();
2555
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
2556
+ let numBytesDecoded = 0;
2568
2557
  function decodeText(ptr, len) {
2558
+ numBytesDecoded += len;
2559
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
2560
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2561
+ cachedTextDecoder.decode();
2562
+ numBytesDecoded = len;
2563
+ }
2569
2564
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
2570
2565
  }
2571
2566
 
@@ -2584,8 +2579,95 @@ if (!('encodeInto' in cachedTextEncoder)) {
2584
2579
 
2585
2580
  let WASM_VECTOR_LEN = 0;
2586
2581
 
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;
2582
+ let wasmModule, wasmInstance, wasm;
2583
+ function __wbg_finalize_init(instance, module) {
2584
+ wasmInstance = instance;
2585
+ wasm = instance.exports;
2586
+ wasmModule = module;
2587
+ cachedDataViewMemory0 = null;
2588
+ cachedUint8ArrayMemory0 = null;
2589
+ return wasm;
2590
+ }
2591
+
2592
+ async function __wbg_load(module, imports) {
2593
+ if (typeof Response === 'function' && module instanceof Response) {
2594
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
2595
+ try {
2596
+ return await WebAssembly.instantiateStreaming(module, imports);
2597
+ } catch (e) {
2598
+ const validResponse = module.ok && expectedResponseType(module.type);
2599
+
2600
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
2601
+ 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);
2602
+
2603
+ } else { throw e; }
2604
+ }
2605
+ }
2606
+
2607
+ const bytes = await module.arrayBuffer();
2608
+ return await WebAssembly.instantiate(bytes, imports);
2609
+ } else {
2610
+ const instance = await WebAssembly.instantiate(module, imports);
2611
+
2612
+ if (instance instanceof WebAssembly.Instance) {
2613
+ return { instance, module };
2614
+ } else {
2615
+ return instance;
2616
+ }
2617
+ }
2618
+
2619
+ function expectedResponseType(type) {
2620
+ switch (type) {
2621
+ case 'basic': case 'cors': case 'default': return true;
2622
+ }
2623
+ return false;
2624
+ }
2625
+ }
2626
+
2627
+ function initSync(module) {
2628
+ if (wasm !== undefined) return wasm;
2629
+
2630
+
2631
+ if (module !== undefined) {
2632
+ if (Object.getPrototypeOf(module) === Object.prototype) {
2633
+ ({module} = module)
2634
+ } else {
2635
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
2636
+ }
2637
+ }
2638
+
2639
+ const imports = __wbg_get_imports();
2640
+ if (!(module instanceof WebAssembly.Module)) {
2641
+ module = new WebAssembly.Module(module);
2642
+ }
2643
+ const instance = new WebAssembly.Instance(module, imports);
2644
+ return __wbg_finalize_init(instance, module);
2645
+ }
2646
+
2647
+ async function __wbg_init(module_or_path) {
2648
+ if (wasm !== undefined) return wasm;
2649
+
2650
+
2651
+ if (module_or_path !== undefined) {
2652
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
2653
+ ({module_or_path} = module_or_path)
2654
+ } else {
2655
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
2656
+ }
2657
+ }
2658
+
2659
+ if (module_or_path === undefined) {
2660
+ module_or_path = new URL('cedarling_wasm_bg.wasm', import.meta.url);
2661
+ }
2662
+ const imports = __wbg_get_imports();
2663
+
2664
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
2665
+ module_or_path = fetch(module_or_path);
2666
+ }
2667
+
2668
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
2669
+
2670
+ return __wbg_finalize_init(instance, module);
2671
+ }
2672
+
2673
+ 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.417-nodejs",
5
+ "version": "0.0.417",
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
  }