@janssenproject/cedarling_wasm 0.0.342 → 0.0.343-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.
@@ -448,148 +448,3 @@ export function init(config: any): Promise<Cedarling>;
448
448
  * ```
449
449
  */
450
450
  export function init_from_archive_bytes(config: any, archive_bytes: Uint8Array): Promise<Cedarling>;
451
-
452
- export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
453
-
454
- export interface InitOutput {
455
- readonly memory: WebAssembly.Memory;
456
- readonly __wbg_cedarling_free: (a: number, b: number) => void;
457
- readonly __wbg_multiissuerauthorizeresult_free: (a: number, b: number) => void;
458
- readonly __wbg_get_multiissuerauthorizeresult_response: (a: number) => number;
459
- readonly __wbg_set_multiissuerauthorizeresult_response: (a: number, b: number) => void;
460
- readonly __wbg_get_multiissuerauthorizeresult_decision: (a: number) => number;
461
- readonly __wbg_set_multiissuerauthorizeresult_decision: (a: number, b: number) => void;
462
- readonly __wbg_get_multiissuerauthorizeresult_request_id: (a: number) => [number, number];
463
- readonly __wbg_set_multiissuerauthorizeresult_request_id: (a: number, b: number, c: number) => void;
464
- readonly multiissuerauthorizeresult_json_string: (a: number) => [number, number];
465
- readonly init: (a: any) => any;
466
- readonly init_from_archive_bytes: (a: any, b: any) => any;
467
- readonly cedarling_new: (a: any) => any;
468
- readonly cedarling_new_from_map: (a: any) => any;
469
- readonly cedarling_authorize_unsigned: (a: number, b: any) => any;
470
- readonly cedarling_authorize_multi_issuer: (a: number, b: any) => any;
471
- readonly cedarling_pop_logs: (a: number) => [number, number, number];
472
- readonly cedarling_get_log_by_id: (a: number, b: number, c: number) => [number, number, number];
473
- readonly cedarling_get_log_ids: (a: number) => any;
474
- readonly cedarling_get_logs_by_tag: (a: number, b: number, c: number) => [number, number, number, number];
475
- readonly cedarling_get_logs_by_request_id: (a: number, b: number, c: number) => [number, number, number, number];
476
- readonly cedarling_get_logs_by_request_id_and_tag: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
477
- readonly cedarling_shut_down: (a: number) => any;
478
- readonly cedarling_push_data_ctx: (a: number, b: number, c: number, d: any, e: number, f: bigint) => [number, number];
479
- readonly cedarling_get_data_ctx: (a: number, b: number, c: number) => [number, number, number];
480
- readonly cedarling_get_data_entry_ctx: (a: number, b: number, c: number) => [number, number, number];
481
- readonly cedarling_remove_data_ctx: (a: number, b: number, c: number) => [number, number, number];
482
- readonly cedarling_clear_data_ctx: (a: number) => [number, number];
483
- readonly cedarling_list_data_ctx: (a: number) => [number, number, number];
484
- readonly cedarling_get_stats_ctx: (a: number) => [number, number, number];
485
- readonly __wbg_authorizeresult_free: (a: number, b: number) => void;
486
- readonly __wbg_get_authorizeresult_decision: (a: number) => number;
487
- readonly __wbg_set_authorizeresult_decision: (a: number, b: number) => void;
488
- readonly __wbg_get_authorizeresult_request_id: (a: number) => [number, number];
489
- readonly __wbg_set_authorizeresult_request_id: (a: number, b: number, c: number) => void;
490
- readonly authorizeresult_json_string: (a: number) => [number, number];
491
- readonly authorizeresult_principal: (a: number, b: number, c: number) => number;
492
- readonly __wbg_authorizeresultresponse_free: (a: number, b: number) => void;
493
- readonly authorizeresultresponse_decision: (a: number) => number;
494
- readonly authorizeresultresponse_diagnostics: (a: number) => number;
495
- readonly __wbg_diagnostics_free: (a: number, b: number) => void;
496
- readonly diagnostics_reason: (a: number) => [number, number];
497
- readonly diagnostics_errors: (a: number) => [number, number];
498
- readonly __wbg_policyevaluationerror_free: (a: number, b: number) => void;
499
- readonly policyevaluationerror_id: (a: number) => [number, number];
500
- readonly policyevaluationerror_error: (a: number) => [number, number];
501
- readonly __wbg_dataentry_free: (a: number, b: number) => void;
502
- readonly __wbg_get_dataentry_key: (a: number) => [number, number];
503
- readonly __wbg_set_dataentry_key: (a: number, b: number, c: number) => void;
504
- readonly __wbg_get_dataentry_data_type: (a: number) => [number, number];
505
- readonly __wbg_set_dataentry_data_type: (a: number, b: number, c: number) => void;
506
- readonly __wbg_get_dataentry_created_at: (a: number) => [number, number];
507
- readonly __wbg_set_dataentry_created_at: (a: number, b: number, c: number) => void;
508
- readonly __wbg_get_dataentry_expires_at: (a: number) => [number, number];
509
- readonly __wbg_set_dataentry_expires_at: (a: number, b: number, c: number) => void;
510
- readonly __wbg_get_dataentry_access_count: (a: number) => bigint;
511
- readonly __wbg_set_dataentry_access_count: (a: number, b: bigint) => void;
512
- readonly dataentry_value: (a: number) => [number, number, number];
513
- readonly dataentry_json_string: (a: number) => [number, number];
514
- readonly __wbg_datastorestats_free: (a: number, b: number) => void;
515
- readonly __wbg_get_datastorestats_entry_count: (a: number) => number;
516
- readonly __wbg_set_datastorestats_entry_count: (a: number, b: number) => void;
517
- readonly __wbg_get_datastorestats_max_entries: (a: number) => number;
518
- readonly __wbg_set_datastorestats_max_entries: (a: number, b: number) => void;
519
- readonly __wbg_get_datastorestats_max_entry_size: (a: number) => number;
520
- readonly __wbg_set_datastorestats_max_entry_size: (a: number, b: number) => void;
521
- readonly __wbg_get_datastorestats_metrics_enabled: (a: number) => number;
522
- readonly __wbg_set_datastorestats_metrics_enabled: (a: number, b: number) => void;
523
- readonly __wbg_get_datastorestats_total_size_bytes: (a: number) => number;
524
- readonly __wbg_set_datastorestats_total_size_bytes: (a: number, b: number) => void;
525
- readonly __wbg_get_datastorestats_avg_entry_size_bytes: (a: number) => number;
526
- readonly __wbg_set_datastorestats_avg_entry_size_bytes: (a: number, b: number) => void;
527
- readonly __wbg_get_datastorestats_capacity_usage_percent: (a: number) => number;
528
- readonly __wbg_set_datastorestats_capacity_usage_percent: (a: number, b: number) => void;
529
- readonly __wbg_get_datastorestats_memory_alert_threshold: (a: number) => number;
530
- readonly __wbg_set_datastorestats_memory_alert_threshold: (a: number, b: number) => void;
531
- readonly __wbg_get_datastorestats_memory_alert_triggered: (a: number) => number;
532
- readonly __wbg_set_datastorestats_memory_alert_triggered: (a: number, b: number) => void;
533
- readonly datastorestats_json_string: (a: number) => [number, number];
534
- readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
535
- readonly intounderlyingbytesource_type: (a: number) => number;
536
- readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
537
- readonly intounderlyingbytesource_start: (a: number, b: any) => void;
538
- readonly intounderlyingbytesource_pull: (a: number, b: any) => any;
539
- readonly intounderlyingbytesource_cancel: (a: number) => void;
540
- readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
541
- readonly intounderlyingsource_pull: (a: number, b: any) => any;
542
- readonly intounderlyingsource_cancel: (a: number) => void;
543
- readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
544
- readonly intounderlyingsink_write: (a: number, b: any) => any;
545
- readonly intounderlyingsink_close: (a: number) => any;
546
- readonly intounderlyingsink_abort: (a: number, b: any) => any;
547
- readonly rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void;
548
- readonly rust_zstd_wasm_shim_malloc: (a: number) => number;
549
- readonly rust_zstd_wasm_shim_memcmp: (a: number, b: number, c: number) => number;
550
- readonly rust_zstd_wasm_shim_calloc: (a: number, b: number) => number;
551
- readonly rust_zstd_wasm_shim_free: (a: number) => void;
552
- readonly rust_zstd_wasm_shim_memcpy: (a: number, b: number, c: number) => number;
553
- readonly rust_zstd_wasm_shim_memmove: (a: number, b: number, c: number) => number;
554
- readonly rust_zstd_wasm_shim_memset: (a: number, b: number, c: number) => number;
555
- readonly wasm_bindgen__closure__destroy__hcbf2ec2b115651da: (a: number, b: number) => void;
556
- readonly wasm_bindgen__closure__destroy__hb94dbe4a47b9147c: (a: number, b: number) => void;
557
- readonly wasm_bindgen__closure__destroy__hd11c5dfc6ff843b5: (a: number, b: number) => void;
558
- readonly wasm_bindgen__closure__destroy__h14227e6b7ccdc7d9: (a: number, b: number) => void;
559
- readonly wasm_bindgen__convert__closures_____invoke__hce0de7781e15b6ff: (a: number, b: number, c: any) => [number, number];
560
- readonly wasm_bindgen__convert__closures_____invoke__h17a92308e79e69c0: (a: number, b: number, c: any, d: any) => void;
561
- readonly wasm_bindgen__convert__closures_____invoke__hdb4e3955a815023f: (a: number, b: number, c: any) => void;
562
- readonly wasm_bindgen__convert__closures_____invoke__h09da5be58b802521: (a: number, b: number) => void;
563
- readonly wasm_bindgen__convert__closures_____invoke__h5ac545e984d2dde4: (a: number, b: number) => void;
564
- readonly __wbindgen_malloc: (a: number, b: number) => number;
565
- readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
566
- readonly __wbindgen_exn_store: (a: number) => void;
567
- readonly __externref_table_alloc: () => number;
568
- readonly __wbindgen_externrefs: WebAssembly.Table;
569
- readonly __wbindgen_free: (a: number, b: number, c: number) => void;
570
- readonly __externref_table_dealloc: (a: number) => void;
571
- readonly __externref_drop_slice: (a: number, b: number) => void;
572
- readonly __wbindgen_start: () => void;
573
- }
574
-
575
- export type SyncInitInput = BufferSource | WebAssembly.Module;
576
-
577
- /**
578
- * Instantiates the given `module`, which can either be bytes or
579
- * a precompiled `WebAssembly.Module`.
580
- *
581
- * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
582
- *
583
- * @returns {InitOutput}
584
- */
585
- export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
586
-
587
- /**
588
- * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
589
- * for everything else, calls `WebAssembly.instantiate` directly.
590
- *
591
- * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
592
- *
593
- * @returns {Promise<InitOutput>}
594
- */
595
- 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);
@@ -476,12 +478,13 @@ export class Cedarling {
476
478
  }
477
479
  }
478
480
  if (Symbol.dispose) Cedarling.prototype[Symbol.dispose] = Cedarling.prototype.free;
481
+ exports.Cedarling = Cedarling;
479
482
 
480
483
  /**
481
484
  * A WASM wrapper for the Rust `cedarling::DataEntry` struct.
482
485
  * Represents a data entry in the DataStore with value and metadata.
483
486
  */
484
- export class DataEntry {
487
+ class DataEntry {
485
488
  static __wrap(ptr) {
486
489
  ptr = ptr >>> 0;
487
490
  const obj = Object.create(DataEntry.prototype);
@@ -640,12 +643,13 @@ export class DataEntry {
640
643
  }
641
644
  }
642
645
  if (Symbol.dispose) DataEntry.prototype[Symbol.dispose] = DataEntry.prototype.free;
646
+ exports.DataEntry = DataEntry;
643
647
 
644
648
  /**
645
649
  * A WASM wrapper for the Rust `cedarling::DataStoreStats` struct.
646
650
  * Statistics about the DataStore.
647
651
  */
648
- export class DataStoreStats {
652
+ class DataStoreStats {
649
653
  static __wrap(ptr) {
650
654
  ptr = ptr >>> 0;
651
655
  const obj = Object.create(DataStoreStats.prototype);
@@ -816,6 +820,7 @@ export class DataStoreStats {
816
820
  }
817
821
  }
818
822
  if (Symbol.dispose) DataStoreStats.prototype[Symbol.dispose] = DataStoreStats.prototype.free;
823
+ exports.DataStoreStats = DataStoreStats;
819
824
 
820
825
  /**
821
826
  * Diagnostics
@@ -823,7 +828,7 @@ if (Symbol.dispose) DataStoreStats.prototype[Symbol.dispose] = DataStoreStats.pr
823
828
  *
824
829
  * Provides detailed information about how a policy decision was made, including policies that contributed to the decision and any errors encountered during evaluation.
825
830
  */
826
- export class Diagnostics {
831
+ class Diagnostics {
827
832
  static __wrap(ptr) {
828
833
  ptr = ptr >>> 0;
829
834
  const obj = Object.create(Diagnostics.prototype);
@@ -867,8 +872,9 @@ export class Diagnostics {
867
872
  }
868
873
  }
869
874
  if (Symbol.dispose) Diagnostics.prototype[Symbol.dispose] = Diagnostics.prototype.free;
875
+ exports.Diagnostics = Diagnostics;
870
876
 
871
- export class IntoUnderlyingByteSource {
877
+ class IntoUnderlyingByteSource {
872
878
  __destroy_into_raw() {
873
879
  const ptr = this.__wbg_ptr;
874
880
  this.__wbg_ptr = 0;
@@ -913,8 +919,9 @@ export class IntoUnderlyingByteSource {
913
919
  }
914
920
  }
915
921
  if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
922
+ exports.IntoUnderlyingByteSource = IntoUnderlyingByteSource;
916
923
 
917
- export class IntoUnderlyingSink {
924
+ class IntoUnderlyingSink {
918
925
  __destroy_into_raw() {
919
926
  const ptr = this.__wbg_ptr;
920
927
  this.__wbg_ptr = 0;
@@ -952,8 +959,9 @@ export class IntoUnderlyingSink {
952
959
  }
953
960
  }
954
961
  if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
962
+ exports.IntoUnderlyingSink = IntoUnderlyingSink;
955
963
 
956
- export class IntoUnderlyingSource {
964
+ class IntoUnderlyingSource {
957
965
  __destroy_into_raw() {
958
966
  const ptr = this.__wbg_ptr;
959
967
  this.__wbg_ptr = 0;
@@ -978,12 +986,13 @@ export class IntoUnderlyingSource {
978
986
  }
979
987
  }
980
988
  if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
989
+ exports.IntoUnderlyingSource = IntoUnderlyingSource;
981
990
 
982
991
  /**
983
992
  * A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
984
993
  * Represents the result of a multi-issuer authorization request.
985
994
  */
986
- export class MultiIssuerAuthorizeResult {
995
+ class MultiIssuerAuthorizeResult {
987
996
  static __wrap(ptr) {
988
997
  ptr = ptr >>> 0;
989
998
  const obj = Object.create(MultiIssuerAuthorizeResult.prototype);
@@ -1080,6 +1089,7 @@ export class MultiIssuerAuthorizeResult {
1080
1089
  }
1081
1090
  }
1082
1091
  if (Symbol.dispose) MultiIssuerAuthorizeResult.prototype[Symbol.dispose] = MultiIssuerAuthorizeResult.prototype.free;
1092
+ exports.MultiIssuerAuthorizeResult = MultiIssuerAuthorizeResult;
1083
1093
 
1084
1094
  /**
1085
1095
  * PolicyEvaluationError
@@ -1087,7 +1097,7 @@ if (Symbol.dispose) MultiIssuerAuthorizeResult.prototype[Symbol.dispose] = Multi
1087
1097
  *
1088
1098
  * Represents an error that occurred when evaluating a Cedar policy.
1089
1099
  */
1090
- export class PolicyEvaluationError {
1100
+ class PolicyEvaluationError {
1091
1101
  static __wrap(ptr) {
1092
1102
  ptr = ptr >>> 0;
1093
1103
  const obj = Object.create(PolicyEvaluationError.prototype);
@@ -1139,6 +1149,7 @@ export class PolicyEvaluationError {
1139
1149
  }
1140
1150
  }
1141
1151
  if (Symbol.dispose) PolicyEvaluationError.prototype[Symbol.dispose] = PolicyEvaluationError.prototype.free;
1152
+ exports.PolicyEvaluationError = PolicyEvaluationError;
1142
1153
 
1143
1154
  /**
1144
1155
  * Create a new instance of the Cedarling application.
@@ -1146,10 +1157,11 @@ if (Symbol.dispose) PolicyEvaluationError.prototype[Symbol.dispose] = PolicyEval
1146
1157
  * @param {any} config
1147
1158
  * @returns {Promise<Cedarling>}
1148
1159
  */
1149
- export function init(config) {
1160
+ function init(config) {
1150
1161
  const ret = wasm.init(config);
1151
1162
  return ret;
1152
1163
  }
1164
+ exports.init = init;
1153
1165
 
1154
1166
  /**
1155
1167
  * Create a new instance of the Cedarling application from archive bytes.
@@ -1171,10 +1183,11 @@ export function init(config) {
1171
1183
  * @param {Uint8Array} archive_bytes
1172
1184
  * @returns {Promise<Cedarling>}
1173
1185
  */
1174
- export function init_from_archive_bytes(config, archive_bytes) {
1186
+ function init_from_archive_bytes(config, archive_bytes) {
1175
1187
  const ret = wasm.init_from_archive_bytes(config, archive_bytes);
1176
1188
  return ret;
1177
1189
  }
1190
+ exports.init_from_archive_bytes = init_from_archive_bytes;
1178
1191
 
1179
1192
  function __wbg_get_imports() {
1180
1193
  const import0 = {
@@ -2118,15 +2131,7 @@ function takeFromExternrefTable0(idx) {
2118
2131
 
2119
2132
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2120
2133
  cachedTextDecoder.decode();
2121
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
2122
- let numBytesDecoded = 0;
2123
2134
  function decodeText(ptr, len) {
2124
- numBytesDecoded += len;
2125
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
2126
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2127
- cachedTextDecoder.decode();
2128
- numBytesDecoded = len;
2129
- }
2130
2135
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
2131
2136
  }
2132
2137
 
@@ -2145,95 +2150,8 @@ if (!('encodeInto' in cachedTextEncoder)) {
2145
2150
 
2146
2151
  let WASM_VECTOR_LEN = 0;
2147
2152
 
2148
- let wasmModule, wasm;
2149
- function __wbg_finalize_init(instance, module) {
2150
- wasm = instance.exports;
2151
- wasmModule = module;
2152
- cachedDataViewMemory0 = null;
2153
- cachedUint8ArrayMemory0 = null;
2154
- wasm.__wbindgen_start();
2155
- return wasm;
2156
- }
2157
-
2158
- async function __wbg_load(module, imports) {
2159
- if (typeof Response === 'function' && module instanceof Response) {
2160
- if (typeof WebAssembly.instantiateStreaming === 'function') {
2161
- try {
2162
- return await WebAssembly.instantiateStreaming(module, imports);
2163
- } catch (e) {
2164
- const validResponse = module.ok && expectedResponseType(module.type);
2165
-
2166
- if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
2167
- 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);
2168
-
2169
- } else { throw e; }
2170
- }
2171
- }
2172
-
2173
- const bytes = await module.arrayBuffer();
2174
- return await WebAssembly.instantiate(bytes, imports);
2175
- } else {
2176
- const instance = await WebAssembly.instantiate(module, imports);
2177
-
2178
- if (instance instanceof WebAssembly.Instance) {
2179
- return { instance, module };
2180
- } else {
2181
- return instance;
2182
- }
2183
- }
2184
-
2185
- function expectedResponseType(type) {
2186
- switch (type) {
2187
- case 'basic': case 'cors': case 'default': return true;
2188
- }
2189
- return false;
2190
- }
2191
- }
2192
-
2193
- function initSync(module) {
2194
- if (wasm !== undefined) return wasm;
2195
-
2196
-
2197
- if (module !== undefined) {
2198
- if (Object.getPrototypeOf(module) === Object.prototype) {
2199
- ({module} = module)
2200
- } else {
2201
- console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
2202
- }
2203
- }
2204
-
2205
- const imports = __wbg_get_imports();
2206
- if (!(module instanceof WebAssembly.Module)) {
2207
- module = new WebAssembly.Module(module);
2208
- }
2209
- const instance = new WebAssembly.Instance(module, imports);
2210
- return __wbg_finalize_init(instance, module);
2211
- }
2212
-
2213
- async function __wbg_init(module_or_path) {
2214
- if (wasm !== undefined) return wasm;
2215
-
2216
-
2217
- if (module_or_path !== undefined) {
2218
- if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
2219
- ({module_or_path} = module_or_path)
2220
- } else {
2221
- console.warn('using deprecated parameters for the initialization function; pass a single object instead')
2222
- }
2223
- }
2224
-
2225
- if (module_or_path === undefined) {
2226
- module_or_path = new URL('cedarling_wasm_bg.wasm', import.meta.url);
2227
- }
2228
- const imports = __wbg_get_imports();
2229
-
2230
- if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
2231
- module_or_path = fetch(module_or_path);
2232
- }
2233
-
2234
- const { instance, module } = await __wbg_load(await module_or_path, imports);
2235
-
2236
- return __wbg_finalize_init(instance, module);
2237
- }
2238
-
2239
- export { initSync, __wbg_init as default };
2153
+ const wasmPath = `${__dirname}/cedarling_wasm_bg.wasm`;
2154
+ const wasmBytes = require('fs').readFileSync(wasmPath);
2155
+ const wasmModule = new WebAssembly.Module(wasmBytes);
2156
+ let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
2157
+ 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.342",
4
+ "version": "0.0.343-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
  }