@janssenproject/cedarling_wasm 0.0.346 → 0.0.347-nodejs

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,151 +516,3 @@ 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
- export class AuthorizeResult {
7
+ class AuthorizeResult {
8
8
  static __wrap(ptr) {
9
9
  ptr = ptr >>> 0;
10
10
  const obj = Object.create(AuthorizeResult.prototype);
@@ -98,12 +98,13 @@ export class AuthorizeResult {
98
98
  }
99
99
  }
100
100
  if (Symbol.dispose) AuthorizeResult.prototype[Symbol.dispose] = AuthorizeResult.prototype.free;
101
+ exports.AuthorizeResult = AuthorizeResult;
101
102
 
102
103
  /**
103
104
  * A WASM wrapper for the Rust `cedar_policy::Response` struct.
104
105
  * Represents the result of an authorization request.
105
106
  */
106
- export class AuthorizeResultResponse {
107
+ class AuthorizeResultResponse {
107
108
  static __wrap(ptr) {
108
109
  ptr = ptr >>> 0;
109
110
  const obj = Object.create(AuthorizeResultResponse.prototype);
@@ -139,11 +140,12 @@ export class AuthorizeResultResponse {
139
140
  }
140
141
  }
141
142
  if (Symbol.dispose) AuthorizeResultResponse.prototype[Symbol.dispose] = AuthorizeResultResponse.prototype.free;
143
+ exports.AuthorizeResultResponse = AuthorizeResultResponse;
142
144
 
143
145
  /**
144
146
  * The instance of the Cedarling application.
145
147
  */
146
- export class Cedarling {
148
+ class Cedarling {
147
149
  static __wrap(ptr) {
148
150
  ptr = ptr >>> 0;
149
151
  const obj = Object.create(Cedarling.prototype);
@@ -574,12 +576,13 @@ export class Cedarling {
574
576
  }
575
577
  }
576
578
  if (Symbol.dispose) Cedarling.prototype[Symbol.dispose] = Cedarling.prototype.free;
579
+ exports.Cedarling = Cedarling;
577
580
 
578
581
  /**
579
582
  * A WASM wrapper for the Rust `cedarling::DataEntry` struct.
580
583
  * Represents a data entry in the DataStore with value and metadata.
581
584
  */
582
- export class DataEntry {
585
+ class DataEntry {
583
586
  static __wrap(ptr) {
584
587
  ptr = ptr >>> 0;
585
588
  const obj = Object.create(DataEntry.prototype);
@@ -738,12 +741,13 @@ export class DataEntry {
738
741
  }
739
742
  }
740
743
  if (Symbol.dispose) DataEntry.prototype[Symbol.dispose] = DataEntry.prototype.free;
744
+ exports.DataEntry = DataEntry;
741
745
 
742
746
  /**
743
747
  * A WASM wrapper for the Rust `cedarling::DataStoreStats` struct.
744
748
  * Statistics about the DataStore.
745
749
  */
746
- export class DataStoreStats {
750
+ class DataStoreStats {
747
751
  static __wrap(ptr) {
748
752
  ptr = ptr >>> 0;
749
753
  const obj = Object.create(DataStoreStats.prototype);
@@ -914,6 +918,7 @@ export class DataStoreStats {
914
918
  }
915
919
  }
916
920
  if (Symbol.dispose) DataStoreStats.prototype[Symbol.dispose] = DataStoreStats.prototype.free;
921
+ exports.DataStoreStats = DataStoreStats;
917
922
 
918
923
  /**
919
924
  * Diagnostics
@@ -921,7 +926,7 @@ if (Symbol.dispose) DataStoreStats.prototype[Symbol.dispose] = DataStoreStats.pr
921
926
  *
922
927
  * Provides detailed information about how a policy decision was made, including policies that contributed to the decision and any errors encountered during evaluation.
923
928
  */
924
- export class Diagnostics {
929
+ class Diagnostics {
925
930
  static __wrap(ptr) {
926
931
  ptr = ptr >>> 0;
927
932
  const obj = Object.create(Diagnostics.prototype);
@@ -965,8 +970,9 @@ export class Diagnostics {
965
970
  }
966
971
  }
967
972
  if (Symbol.dispose) Diagnostics.prototype[Symbol.dispose] = Diagnostics.prototype.free;
973
+ exports.Diagnostics = Diagnostics;
968
974
 
969
- export class IntoUnderlyingByteSource {
975
+ class IntoUnderlyingByteSource {
970
976
  __destroy_into_raw() {
971
977
  const ptr = this.__wbg_ptr;
972
978
  this.__wbg_ptr = 0;
@@ -1011,8 +1017,9 @@ export class IntoUnderlyingByteSource {
1011
1017
  }
1012
1018
  }
1013
1019
  if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
1020
+ exports.IntoUnderlyingByteSource = IntoUnderlyingByteSource;
1014
1021
 
1015
- export class IntoUnderlyingSink {
1022
+ class IntoUnderlyingSink {
1016
1023
  __destroy_into_raw() {
1017
1024
  const ptr = this.__wbg_ptr;
1018
1025
  this.__wbg_ptr = 0;
@@ -1050,8 +1057,9 @@ export class IntoUnderlyingSink {
1050
1057
  }
1051
1058
  }
1052
1059
  if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
1060
+ exports.IntoUnderlyingSink = IntoUnderlyingSink;
1053
1061
 
1054
- export class IntoUnderlyingSource {
1062
+ class IntoUnderlyingSource {
1055
1063
  __destroy_into_raw() {
1056
1064
  const ptr = this.__wbg_ptr;
1057
1065
  this.__wbg_ptr = 0;
@@ -1076,12 +1084,13 @@ export class IntoUnderlyingSource {
1076
1084
  }
1077
1085
  }
1078
1086
  if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
1087
+ exports.IntoUnderlyingSource = IntoUnderlyingSource;
1079
1088
 
1080
1089
  /**
1081
1090
  * A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
1082
1091
  * Represents the result of a multi-issuer authorization request.
1083
1092
  */
1084
- export class MultiIssuerAuthorizeResult {
1093
+ class MultiIssuerAuthorizeResult {
1085
1094
  static __wrap(ptr) {
1086
1095
  ptr = ptr >>> 0;
1087
1096
  const obj = Object.create(MultiIssuerAuthorizeResult.prototype);
@@ -1178,6 +1187,7 @@ export class MultiIssuerAuthorizeResult {
1178
1187
  }
1179
1188
  }
1180
1189
  if (Symbol.dispose) MultiIssuerAuthorizeResult.prototype[Symbol.dispose] = MultiIssuerAuthorizeResult.prototype.free;
1190
+ exports.MultiIssuerAuthorizeResult = MultiIssuerAuthorizeResult;
1181
1191
 
1182
1192
  /**
1183
1193
  * PolicyEvaluationError
@@ -1185,7 +1195,7 @@ if (Symbol.dispose) MultiIssuerAuthorizeResult.prototype[Symbol.dispose] = Multi
1185
1195
  *
1186
1196
  * Represents an error that occurred when evaluating a Cedar policy.
1187
1197
  */
1188
- export class PolicyEvaluationError {
1198
+ class PolicyEvaluationError {
1189
1199
  static __wrap(ptr) {
1190
1200
  ptr = ptr >>> 0;
1191
1201
  const obj = Object.create(PolicyEvaluationError.prototype);
@@ -1237,6 +1247,7 @@ export class PolicyEvaluationError {
1237
1247
  }
1238
1248
  }
1239
1249
  if (Symbol.dispose) PolicyEvaluationError.prototype[Symbol.dispose] = PolicyEvaluationError.prototype.free;
1250
+ exports.PolicyEvaluationError = PolicyEvaluationError;
1240
1251
 
1241
1252
  /**
1242
1253
  * Create a new instance of the Cedarling application.
@@ -1244,10 +1255,11 @@ if (Symbol.dispose) PolicyEvaluationError.prototype[Symbol.dispose] = PolicyEval
1244
1255
  * @param {any} config
1245
1256
  * @returns {Promise<Cedarling>}
1246
1257
  */
1247
- export function init(config) {
1258
+ function init(config) {
1248
1259
  const ret = wasm.init(config);
1249
1260
  return ret;
1250
1261
  }
1262
+ exports.init = init;
1251
1263
 
1252
1264
  /**
1253
1265
  * Create a new instance of the Cedarling application from archive bytes.
@@ -1269,10 +1281,11 @@ export function init(config) {
1269
1281
  * @param {Uint8Array} archive_bytes
1270
1282
  * @returns {Promise<Cedarling>}
1271
1283
  */
1272
- export function init_from_archive_bytes(config, archive_bytes) {
1284
+ function init_from_archive_bytes(config, archive_bytes) {
1273
1285
  const ret = wasm.init_from_archive_bytes(config, archive_bytes);
1274
1286
  return ret;
1275
1287
  }
1288
+ exports.init_from_archive_bytes = init_from_archive_bytes;
1276
1289
 
1277
1290
  function __wbg_get_imports() {
1278
1291
  const import0 = {
@@ -1878,7 +1891,7 @@ function __wbg_get_imports() {
1878
1891
  console.warn(...arg0);
1879
1892
  },
1880
1893
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1881
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2205, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1894
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2206, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1882
1895
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__haed62cf3e2984162);
1883
1896
  return ret;
1884
1897
  },
@@ -2216,15 +2229,7 @@ function takeFromExternrefTable0(idx) {
2216
2229
 
2217
2230
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2218
2231
  cachedTextDecoder.decode();
2219
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
2220
- let numBytesDecoded = 0;
2221
2232
  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
- }
2228
2233
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
2229
2234
  }
2230
2235
 
@@ -2243,95 +2248,8 @@ if (!('encodeInto' in cachedTextEncoder)) {
2243
2248
 
2244
2249
  let WASM_VECTOR_LEN = 0;
2245
2250
 
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 };
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();
Binary file
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@janssenproject/cedarling_wasm",
3
- "type": "module",
4
3
  "description": "The Cedarling is a performant local authorization service that runs the Rust Cedar Engine",
5
- "version": "0.0.346",
4
+ "version": "0.0.347-nodejs",
6
5
  "license": "Apache-2.0",
7
6
  "repository": {
8
7
  "type": "git",
@@ -14,8 +13,5 @@
14
13
  "cedarling_wasm.d.ts"
15
14
  ],
16
15
  "main": "cedarling_wasm.js",
17
- "types": "cedarling_wasm.d.ts",
18
- "sideEffects": [
19
- "./snippets/*"
20
- ]
16
+ "types": "cedarling_wasm.d.ts"
21
17
  }