@janssenproject/cedarling_wasm 0.0.390 → 0.0.391-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.
@@ -524,153 +524,3 @@ 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_decision: (a: number) => number;
611
- readonly __wbg_set_multiissuerauthorizeresult_response: (a: number, b: number) => void;
612
- readonly __wbg_set_multiissuerauthorizeresult_request_id: (a: number, b: number, c: number) => void;
613
- readonly __wbg_set_multiissuerauthorizeresult_decision: (a: number, b: number) => void;
614
- readonly __wbg_get_multiissuerauthorizeresult_response: (a: number) => number;
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__h122aa852e025a273: (a: number, b: number, c: any) => [number, number];
639
- readonly wasm_bindgen__convert__closures_____invoke__h1aa6bfccca23b638: (a: number, b: number, c: any, d: any) => void;
640
- readonly wasm_bindgen__convert__closures_____invoke__hd100e35fa7d3225c: (a: number, b: number, c: any) => void;
641
- readonly wasm_bindgen__convert__closures_____invoke__h461784cf6dfc2afa: (a: number, b: number) => void;
642
- readonly wasm_bindgen__convert__closures_____invoke__h057874c537728a90: (a: number, b: number) => void;
643
- readonly wasm_bindgen__convert__closures_____invoke__hc5f2b2e319a50b97: (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
- export class AuthorizeResult {
7
+ class AuthorizeResult {
8
8
  static __wrap(ptr) {
9
9
  const obj = Object.create(AuthorizeResult.prototype);
10
10
  obj.__wbg_ptr = ptr;
@@ -104,12 +104,13 @@ export class AuthorizeResult {
104
104
  }
105
105
  }
106
106
  if (Symbol.dispose) AuthorizeResult.prototype[Symbol.dispose] = AuthorizeResult.prototype.free;
107
+ exports.AuthorizeResult = AuthorizeResult;
107
108
 
108
109
  /**
109
110
  * A WASM wrapper for the Rust `cedar_policy::Response` struct.
110
111
  * Represents the result of an authorization request.
111
112
  */
112
- export class AuthorizeResultResponse {
113
+ class AuthorizeResultResponse {
113
114
  static __wrap(ptr) {
114
115
  const obj = Object.create(AuthorizeResultResponse.prototype);
115
116
  obj.__wbg_ptr = ptr;
@@ -144,11 +145,12 @@ export class AuthorizeResultResponse {
144
145
  }
145
146
  }
146
147
  if (Symbol.dispose) AuthorizeResultResponse.prototype[Symbol.dispose] = AuthorizeResultResponse.prototype.free;
148
+ exports.AuthorizeResultResponse = AuthorizeResultResponse;
147
149
 
148
150
  /**
149
151
  * The instance of the Cedarling application.
150
152
  */
151
- export class Cedarling {
153
+ class Cedarling {
152
154
  static __wrap(ptr) {
153
155
  const obj = Object.create(Cedarling.prototype);
154
156
  obj.__wbg_ptr = ptr;
@@ -583,12 +585,13 @@ export class Cedarling {
583
585
  }
584
586
  }
585
587
  if (Symbol.dispose) Cedarling.prototype[Symbol.dispose] = Cedarling.prototype.free;
588
+ exports.Cedarling = Cedarling;
586
589
 
587
590
  /**
588
591
  * A WASM wrapper for the Rust `cedarling::DataEntry` struct.
589
592
  * Represents a data entry in the DataStore with value and metadata.
590
593
  */
591
- export class DataEntry {
594
+ class DataEntry {
592
595
  static __wrap(ptr) {
593
596
  const obj = Object.create(DataEntry.prototype);
594
597
  obj.__wbg_ptr = ptr;
@@ -746,12 +749,13 @@ export class DataEntry {
746
749
  }
747
750
  }
748
751
  if (Symbol.dispose) DataEntry.prototype[Symbol.dispose] = DataEntry.prototype.free;
752
+ exports.DataEntry = DataEntry;
749
753
 
750
754
  /**
751
755
  * A WASM wrapper for the Rust `cedarling::DataStoreStats` struct.
752
756
  * Statistics about the DataStore.
753
757
  */
754
- export class DataStoreStats {
758
+ class DataStoreStats {
755
759
  static __wrap(ptr) {
756
760
  const obj = Object.create(DataStoreStats.prototype);
757
761
  obj.__wbg_ptr = ptr;
@@ -921,6 +925,7 @@ export class DataStoreStats {
921
925
  }
922
926
  }
923
927
  if (Symbol.dispose) DataStoreStats.prototype[Symbol.dispose] = DataStoreStats.prototype.free;
928
+ exports.DataStoreStats = DataStoreStats;
924
929
 
925
930
  /**
926
931
  * Diagnostics
@@ -928,7 +933,7 @@ if (Symbol.dispose) DataStoreStats.prototype[Symbol.dispose] = DataStoreStats.pr
928
933
  *
929
934
  * Provides detailed information about how a policy decision was made, including policies that contributed to the decision and any errors encountered during evaluation.
930
935
  */
931
- export class Diagnostics {
936
+ class Diagnostics {
932
937
  static __wrap(ptr) {
933
938
  const obj = Object.create(Diagnostics.prototype);
934
939
  obj.__wbg_ptr = ptr;
@@ -971,8 +976,9 @@ export class Diagnostics {
971
976
  }
972
977
  }
973
978
  if (Symbol.dispose) Diagnostics.prototype[Symbol.dispose] = Diagnostics.prototype.free;
979
+ exports.Diagnostics = Diagnostics;
974
980
 
975
- export class IntoUnderlyingByteSource {
981
+ class IntoUnderlyingByteSource {
976
982
  __destroy_into_raw() {
977
983
  const ptr = this.__wbg_ptr;
978
984
  this.__wbg_ptr = 0;
@@ -1017,8 +1023,9 @@ export class IntoUnderlyingByteSource {
1017
1023
  }
1018
1024
  }
1019
1025
  if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
1026
+ exports.IntoUnderlyingByteSource = IntoUnderlyingByteSource;
1020
1027
 
1021
- export class IntoUnderlyingSink {
1028
+ class IntoUnderlyingSink {
1022
1029
  __destroy_into_raw() {
1023
1030
  const ptr = this.__wbg_ptr;
1024
1031
  this.__wbg_ptr = 0;
@@ -1056,8 +1063,9 @@ export class IntoUnderlyingSink {
1056
1063
  }
1057
1064
  }
1058
1065
  if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
1066
+ exports.IntoUnderlyingSink = IntoUnderlyingSink;
1059
1067
 
1060
- export class IntoUnderlyingSource {
1068
+ class IntoUnderlyingSource {
1061
1069
  __destroy_into_raw() {
1062
1070
  const ptr = this.__wbg_ptr;
1063
1071
  this.__wbg_ptr = 0;
@@ -1082,12 +1090,13 @@ export class IntoUnderlyingSource {
1082
1090
  }
1083
1091
  }
1084
1092
  if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
1093
+ exports.IntoUnderlyingSource = IntoUnderlyingSource;
1085
1094
 
1086
1095
  /**
1087
1096
  * A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
1088
1097
  * Represents the result of a multi-issuer authorization request.
1089
1098
  */
1090
- export class MultiIssuerAuthorizeResult {
1099
+ class MultiIssuerAuthorizeResult {
1091
1100
  static __wrap(ptr) {
1092
1101
  const obj = Object.create(MultiIssuerAuthorizeResult.prototype);
1093
1102
  obj.__wbg_ptr = ptr;
@@ -1183,6 +1192,7 @@ export class MultiIssuerAuthorizeResult {
1183
1192
  }
1184
1193
  }
1185
1194
  if (Symbol.dispose) MultiIssuerAuthorizeResult.prototype[Symbol.dispose] = MultiIssuerAuthorizeResult.prototype.free;
1195
+ exports.MultiIssuerAuthorizeResult = MultiIssuerAuthorizeResult;
1186
1196
 
1187
1197
  /**
1188
1198
  * PolicyEvaluationError
@@ -1190,7 +1200,7 @@ if (Symbol.dispose) MultiIssuerAuthorizeResult.prototype[Symbol.dispose] = Multi
1190
1200
  *
1191
1201
  * Represents an error that occurred when evaluating a Cedar policy.
1192
1202
  */
1193
- export class PolicyEvaluationError {
1203
+ class PolicyEvaluationError {
1194
1204
  static __wrap(ptr) {
1195
1205
  const obj = Object.create(PolicyEvaluationError.prototype);
1196
1206
  obj.__wbg_ptr = ptr;
@@ -1241,6 +1251,7 @@ export class PolicyEvaluationError {
1241
1251
  }
1242
1252
  }
1243
1253
  if (Symbol.dispose) PolicyEvaluationError.prototype[Symbol.dispose] = PolicyEvaluationError.prototype.free;
1254
+ exports.PolicyEvaluationError = PolicyEvaluationError;
1244
1255
 
1245
1256
  /**
1246
1257
  * Create a new instance of the Cedarling application.
@@ -1248,10 +1259,11 @@ if (Symbol.dispose) PolicyEvaluationError.prototype[Symbol.dispose] = PolicyEval
1248
1259
  * @param {any} config
1249
1260
  * @returns {Promise<Cedarling>}
1250
1261
  */
1251
- export function init(config) {
1262
+ function init(config) {
1252
1263
  const ret = wasm.init(config);
1253
1264
  return ret;
1254
1265
  }
1266
+ exports.init = init;
1255
1267
 
1256
1268
  /**
1257
1269
  * Create a new instance of the Cedarling application from archive bytes.
@@ -1273,10 +1285,11 @@ export function init(config) {
1273
1285
  * @param {Uint8Array} archive_bytes
1274
1286
  * @returns {Promise<Cedarling>}
1275
1287
  */
1276
- export function init_from_archive_bytes(config, archive_bytes) {
1288
+ function init_from_archive_bytes(config, archive_bytes) {
1277
1289
  const ret = wasm.init_from_archive_bytes(config, archive_bytes);
1278
1290
  return ret;
1279
1291
  }
1292
+ exports.init_from_archive_bytes = init_from_archive_bytes;
1280
1293
  function __wbg_get_imports() {
1281
1294
  const import0 = {
1282
1295
  __proto__: null,
@@ -2235,15 +2248,7 @@ function takeFromExternrefTable0(idx) {
2235
2248
 
2236
2249
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2237
2250
  cachedTextDecoder.decode();
2238
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
2239
- let numBytesDecoded = 0;
2240
2251
  function decodeText(ptr, len) {
2241
- numBytesDecoded += len;
2242
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
2243
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2244
- cachedTextDecoder.decode();
2245
- numBytesDecoded = len;
2246
- }
2247
2252
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
2248
2253
  }
2249
2254
 
@@ -2262,96 +2267,9 @@ if (!('encodeInto' in cachedTextEncoder)) {
2262
2267
 
2263
2268
  let WASM_VECTOR_LEN = 0;
2264
2269
 
2265
- let wasmModule, wasmInstance, wasm;
2266
- function __wbg_finalize_init(instance, module) {
2267
- wasmInstance = instance;
2268
- wasm = instance.exports;
2269
- wasmModule = module;
2270
- cachedDataViewMemory0 = null;
2271
- cachedUint8ArrayMemory0 = null;
2272
- wasm.__wbindgen_start();
2273
- return wasm;
2274
- }
2275
-
2276
- async function __wbg_load(module, imports) {
2277
- if (typeof Response === 'function' && module instanceof Response) {
2278
- if (typeof WebAssembly.instantiateStreaming === 'function') {
2279
- try {
2280
- return await WebAssembly.instantiateStreaming(module, imports);
2281
- } catch (e) {
2282
- const validResponse = module.ok && expectedResponseType(module.type);
2283
-
2284
- if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
2285
- 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);
2286
-
2287
- } else { throw e; }
2288
- }
2289
- }
2290
-
2291
- const bytes = await module.arrayBuffer();
2292
- return await WebAssembly.instantiate(bytes, imports);
2293
- } else {
2294
- const instance = await WebAssembly.instantiate(module, imports);
2295
-
2296
- if (instance instanceof WebAssembly.Instance) {
2297
- return { instance, module };
2298
- } else {
2299
- return instance;
2300
- }
2301
- }
2302
-
2303
- function expectedResponseType(type) {
2304
- switch (type) {
2305
- case 'basic': case 'cors': case 'default': return true;
2306
- }
2307
- return false;
2308
- }
2309
- }
2310
-
2311
- function initSync(module) {
2312
- if (wasm !== undefined) return wasm;
2313
-
2314
-
2315
- if (module !== undefined) {
2316
- if (Object.getPrototypeOf(module) === Object.prototype) {
2317
- ({module} = module)
2318
- } else {
2319
- console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
2320
- }
2321
- }
2322
-
2323
- const imports = __wbg_get_imports();
2324
- if (!(module instanceof WebAssembly.Module)) {
2325
- module = new WebAssembly.Module(module);
2326
- }
2327
- const instance = new WebAssembly.Instance(module, imports);
2328
- return __wbg_finalize_init(instance, module);
2329
- }
2330
-
2331
- async function __wbg_init(module_or_path) {
2332
- if (wasm !== undefined) return wasm;
2333
-
2334
-
2335
- if (module_or_path !== undefined) {
2336
- if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
2337
- ({module_or_path} = module_or_path)
2338
- } else {
2339
- console.warn('using deprecated parameters for the initialization function; pass a single object instead')
2340
- }
2341
- }
2342
-
2343
- if (module_or_path === undefined) {
2344
- module_or_path = new URL('cedarling_wasm_bg.wasm', import.meta.url);
2345
- }
2346
- const imports = __wbg_get_imports();
2347
-
2348
- if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
2349
- module_or_path = fetch(module_or_path);
2350
- }
2351
-
2352
- const { instance, module } = await __wbg_load(await module_or_path, imports);
2353
-
2354
- return __wbg_finalize_init(instance, module);
2355
- }
2356
-
2357
- export { initSync, __wbg_init as default };
2270
+ const wasmPath = `${__dirname}/cedarling_wasm_bg.wasm`;
2271
+ const wasmBytes = require('fs').readFileSync(wasmPath);
2272
+ const wasmModule = new WebAssembly.Module(wasmBytes);
2273
+ let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
2274
+ let wasm = wasmInstance.exports;
2275
+ 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.390",
4
+ "version": "0.0.391-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
  }