@janssenproject/cedarling_wasm 0.0.326 → 0.0.327-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.
- package/cedarling_wasm.d.ts +0 -133
- package/cedarling_wasm.js +26 -111
- package/cedarling_wasm_bg.wasm +0 -0
- package/package.json +2 -6
package/cedarling_wasm.d.ts
CHANGED
|
@@ -434,136 +434,3 @@ export function init(config: any): Promise<Cedarling>;
|
|
|
434
434
|
* ```
|
|
435
435
|
*/
|
|
436
436
|
export function init_from_archive_bytes(config: any, archive_bytes: Uint8Array): Promise<Cedarling>;
|
|
437
|
-
|
|
438
|
-
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
439
|
-
|
|
440
|
-
export interface InitOutput {
|
|
441
|
-
readonly memory: WebAssembly.Memory;
|
|
442
|
-
readonly __wbg_cedarling_free: (a: number, b: number) => void;
|
|
443
|
-
readonly __wbg_multiissuerauthorizeresult_free: (a: number, b: number) => void;
|
|
444
|
-
readonly __wbg_get_multiissuerauthorizeresult_response: (a: number) => number;
|
|
445
|
-
readonly __wbg_set_multiissuerauthorizeresult_response: (a: number, b: number) => void;
|
|
446
|
-
readonly __wbg_get_multiissuerauthorizeresult_decision: (a: number) => number;
|
|
447
|
-
readonly __wbg_set_multiissuerauthorizeresult_decision: (a: number, b: number) => void;
|
|
448
|
-
readonly __wbg_get_multiissuerauthorizeresult_request_id: (a: number) => [number, number];
|
|
449
|
-
readonly __wbg_set_multiissuerauthorizeresult_request_id: (a: number, b: number, c: number) => void;
|
|
450
|
-
readonly multiissuerauthorizeresult_json_string: (a: number) => [number, number];
|
|
451
|
-
readonly init: (a: any) => any;
|
|
452
|
-
readonly init_from_archive_bytes: (a: any, b: any) => any;
|
|
453
|
-
readonly cedarling_new: (a: any) => any;
|
|
454
|
-
readonly cedarling_new_from_map: (a: any) => any;
|
|
455
|
-
readonly cedarling_authorize: (a: number, b: any) => any;
|
|
456
|
-
readonly cedarling_authorize_unsigned: (a: number, b: any) => any;
|
|
457
|
-
readonly cedarling_authorize_multi_issuer: (a: number, b: any) => any;
|
|
458
|
-
readonly cedarling_pop_logs: (a: number) => [number, number, number];
|
|
459
|
-
readonly cedarling_get_log_by_id: (a: number, b: number, c: number) => [number, number, number];
|
|
460
|
-
readonly cedarling_get_log_ids: (a: number) => any;
|
|
461
|
-
readonly cedarling_get_logs_by_tag: (a: number, b: number, c: number) => [number, number, number, number];
|
|
462
|
-
readonly cedarling_get_logs_by_request_id: (a: number, b: number, c: number) => [number, number, number, number];
|
|
463
|
-
readonly cedarling_get_logs_by_request_id_and_tag: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
464
|
-
readonly cedarling_shut_down: (a: number) => any;
|
|
465
|
-
readonly cedarling_push_data_ctx: (a: number, b: number, c: number, d: any, e: number, f: bigint) => [number, number];
|
|
466
|
-
readonly cedarling_get_data_ctx: (a: number, b: number, c: number) => [number, number, number];
|
|
467
|
-
readonly cedarling_get_data_entry_ctx: (a: number, b: number, c: number) => [number, number, number];
|
|
468
|
-
readonly cedarling_remove_data_ctx: (a: number, b: number, c: number) => [number, number, number];
|
|
469
|
-
readonly cedarling_clear_data_ctx: (a: number) => [number, number];
|
|
470
|
-
readonly cedarling_list_data_ctx: (a: number) => [number, number, number];
|
|
471
|
-
readonly cedarling_get_stats_ctx: (a: number) => [number, number, number];
|
|
472
|
-
readonly __wbg_authorizeresult_free: (a: number, b: number) => void;
|
|
473
|
-
readonly __wbg_get_authorizeresult_workload: (a: number) => number;
|
|
474
|
-
readonly __wbg_set_authorizeresult_workload: (a: number, b: number) => void;
|
|
475
|
-
readonly __wbg_get_authorizeresult_person: (a: number) => number;
|
|
476
|
-
readonly __wbg_set_authorizeresult_person: (a: number, b: number) => void;
|
|
477
|
-
readonly __wbg_get_authorizeresult_decision: (a: number) => number;
|
|
478
|
-
readonly __wbg_set_authorizeresult_decision: (a: number, b: number) => void;
|
|
479
|
-
readonly __wbg_get_authorizeresult_request_id: (a: number) => [number, number];
|
|
480
|
-
readonly __wbg_set_authorizeresult_request_id: (a: number, b: number, c: number) => void;
|
|
481
|
-
readonly authorizeresult_json_string: (a: number) => [number, number];
|
|
482
|
-
readonly authorizeresult_principal: (a: number, b: number, c: number) => number;
|
|
483
|
-
readonly __wbg_authorizeresultresponse_free: (a: number, b: number) => void;
|
|
484
|
-
readonly authorizeresultresponse_decision: (a: number) => number;
|
|
485
|
-
readonly authorizeresultresponse_diagnostics: (a: number) => number;
|
|
486
|
-
readonly __wbg_diagnostics_free: (a: number, b: number) => void;
|
|
487
|
-
readonly diagnostics_reason: (a: number) => [number, number];
|
|
488
|
-
readonly diagnostics_errors: (a: number) => [number, number];
|
|
489
|
-
readonly __wbg_policyevaluationerror_free: (a: number, b: number) => void;
|
|
490
|
-
readonly policyevaluationerror_id: (a: number) => [number, number];
|
|
491
|
-
readonly policyevaluationerror_error: (a: number) => [number, number];
|
|
492
|
-
readonly __wbg_dataentry_free: (a: number, b: number) => void;
|
|
493
|
-
readonly __wbg_get_dataentry_key: (a: number) => [number, number];
|
|
494
|
-
readonly __wbg_set_dataentry_key: (a: number, b: number, c: number) => void;
|
|
495
|
-
readonly __wbg_get_dataentry_data_type: (a: number) => [number, number];
|
|
496
|
-
readonly __wbg_set_dataentry_data_type: (a: number, b: number, c: number) => void;
|
|
497
|
-
readonly __wbg_get_dataentry_created_at: (a: number) => [number, number];
|
|
498
|
-
readonly __wbg_set_dataentry_created_at: (a: number, b: number, c: number) => void;
|
|
499
|
-
readonly __wbg_get_dataentry_expires_at: (a: number) => [number, number];
|
|
500
|
-
readonly __wbg_set_dataentry_expires_at: (a: number, b: number, c: number) => void;
|
|
501
|
-
readonly __wbg_get_dataentry_access_count: (a: number) => bigint;
|
|
502
|
-
readonly __wbg_set_dataentry_access_count: (a: number, b: bigint) => void;
|
|
503
|
-
readonly dataentry_value: (a: number) => [number, number, number];
|
|
504
|
-
readonly dataentry_json_string: (a: number) => [number, number];
|
|
505
|
-
readonly __wbg_datastorestats_free: (a: number, b: number) => void;
|
|
506
|
-
readonly __wbg_get_datastorestats_entry_count: (a: number) => number;
|
|
507
|
-
readonly __wbg_set_datastorestats_entry_count: (a: number, b: number) => void;
|
|
508
|
-
readonly __wbg_get_datastorestats_max_entries: (a: number) => number;
|
|
509
|
-
readonly __wbg_set_datastorestats_max_entries: (a: number, b: number) => void;
|
|
510
|
-
readonly __wbg_get_datastorestats_max_entry_size: (a: number) => number;
|
|
511
|
-
readonly __wbg_set_datastorestats_max_entry_size: (a: number, b: number) => void;
|
|
512
|
-
readonly __wbg_get_datastorestats_metrics_enabled: (a: number) => number;
|
|
513
|
-
readonly __wbg_set_datastorestats_metrics_enabled: (a: number, b: number) => void;
|
|
514
|
-
readonly __wbg_get_datastorestats_total_size_bytes: (a: number) => number;
|
|
515
|
-
readonly __wbg_set_datastorestats_total_size_bytes: (a: number, b: number) => void;
|
|
516
|
-
readonly __wbg_get_datastorestats_avg_entry_size_bytes: (a: number) => number;
|
|
517
|
-
readonly __wbg_set_datastorestats_avg_entry_size_bytes: (a: number, b: number) => void;
|
|
518
|
-
readonly __wbg_get_datastorestats_capacity_usage_percent: (a: number) => number;
|
|
519
|
-
readonly __wbg_set_datastorestats_capacity_usage_percent: (a: number, b: number) => void;
|
|
520
|
-
readonly __wbg_get_datastorestats_memory_alert_threshold: (a: number) => number;
|
|
521
|
-
readonly __wbg_set_datastorestats_memory_alert_threshold: (a: number, b: number) => void;
|
|
522
|
-
readonly __wbg_get_datastorestats_memory_alert_triggered: (a: number) => number;
|
|
523
|
-
readonly __wbg_set_datastorestats_memory_alert_triggered: (a: number, b: number) => void;
|
|
524
|
-
readonly datastorestats_json_string: (a: number) => [number, number];
|
|
525
|
-
readonly rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void;
|
|
526
|
-
readonly rust_zstd_wasm_shim_malloc: (a: number) => number;
|
|
527
|
-
readonly rust_zstd_wasm_shim_memcmp: (a: number, b: number, c: number) => number;
|
|
528
|
-
readonly rust_zstd_wasm_shim_calloc: (a: number, b: number) => number;
|
|
529
|
-
readonly rust_zstd_wasm_shim_free: (a: number) => void;
|
|
530
|
-
readonly rust_zstd_wasm_shim_memcpy: (a: number, b: number, c: number) => number;
|
|
531
|
-
readonly rust_zstd_wasm_shim_memmove: (a: number, b: number, c: number) => number;
|
|
532
|
-
readonly rust_zstd_wasm_shim_memset: (a: number, b: number, c: number) => number;
|
|
533
|
-
readonly wasm_bindgen__closure__destroy__hd16846c4db5702f7: (a: number, b: number) => void;
|
|
534
|
-
readonly wasm_bindgen__closure__destroy__h05d83266f808ff3c: (a: number, b: number) => void;
|
|
535
|
-
readonly wasm_bindgen__convert__closures_____invoke__hef1652f203b86df2: (a: number, b: number, c: any) => [number, number];
|
|
536
|
-
readonly wasm_bindgen__convert__closures_____invoke__h24c31e14977a730e: (a: number, b: number, c: any, d: any) => void;
|
|
537
|
-
readonly wasm_bindgen__convert__closures_____invoke__h11599899629cf4d4: (a: number, b: number) => void;
|
|
538
|
-
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
539
|
-
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
540
|
-
readonly __wbindgen_exn_store: (a: number) => void;
|
|
541
|
-
readonly __externref_table_alloc: () => number;
|
|
542
|
-
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
543
|
-
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
544
|
-
readonly __externref_table_dealloc: (a: number) => void;
|
|
545
|
-
readonly __externref_drop_slice: (a: number, b: number) => void;
|
|
546
|
-
readonly __wbindgen_start: () => void;
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
550
|
-
|
|
551
|
-
/**
|
|
552
|
-
* Instantiates the given `module`, which can either be bytes or
|
|
553
|
-
* a precompiled `WebAssembly.Module`.
|
|
554
|
-
*
|
|
555
|
-
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
556
|
-
*
|
|
557
|
-
* @returns {InitOutput}
|
|
558
|
-
*/
|
|
559
|
-
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
560
|
-
|
|
561
|
-
/**
|
|
562
|
-
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
563
|
-
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
564
|
-
*
|
|
565
|
-
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
566
|
-
*
|
|
567
|
-
* @returns {Promise<InitOutput>}
|
|
568
|
-
*/
|
|
569
|
-
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
|
-
|
|
7
|
+
class AuthorizeResult {
|
|
8
8
|
static __wrap(ptr) {
|
|
9
9
|
ptr = ptr >>> 0;
|
|
10
10
|
const obj = Object.create(AuthorizeResult.prototype);
|
|
@@ -138,12 +138,13 @@ export class AuthorizeResult {
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
if (Symbol.dispose) AuthorizeResult.prototype[Symbol.dispose] = AuthorizeResult.prototype.free;
|
|
141
|
+
exports.AuthorizeResult = AuthorizeResult;
|
|
141
142
|
|
|
142
143
|
/**
|
|
143
144
|
* A WASM wrapper for the Rust `cedar_policy::Response` struct.
|
|
144
145
|
* Represents the result of an authorization request.
|
|
145
146
|
*/
|
|
146
|
-
|
|
147
|
+
class AuthorizeResultResponse {
|
|
147
148
|
static __wrap(ptr) {
|
|
148
149
|
ptr = ptr >>> 0;
|
|
149
150
|
const obj = Object.create(AuthorizeResultResponse.prototype);
|
|
@@ -179,11 +180,12 @@ export class AuthorizeResultResponse {
|
|
|
179
180
|
}
|
|
180
181
|
}
|
|
181
182
|
if (Symbol.dispose) AuthorizeResultResponse.prototype[Symbol.dispose] = AuthorizeResultResponse.prototype.free;
|
|
183
|
+
exports.AuthorizeResultResponse = AuthorizeResultResponse;
|
|
182
184
|
|
|
183
185
|
/**
|
|
184
186
|
* The instance of the Cedarling application.
|
|
185
187
|
*/
|
|
186
|
-
|
|
188
|
+
class Cedarling {
|
|
187
189
|
static __wrap(ptr) {
|
|
188
190
|
ptr = ptr >>> 0;
|
|
189
191
|
const obj = Object.create(Cedarling.prototype);
|
|
@@ -526,12 +528,13 @@ export class Cedarling {
|
|
|
526
528
|
}
|
|
527
529
|
}
|
|
528
530
|
if (Symbol.dispose) Cedarling.prototype[Symbol.dispose] = Cedarling.prototype.free;
|
|
531
|
+
exports.Cedarling = Cedarling;
|
|
529
532
|
|
|
530
533
|
/**
|
|
531
534
|
* A WASM wrapper for the Rust `cedarling::DataEntry` struct.
|
|
532
535
|
* Represents a data entry in the DataStore with value and metadata.
|
|
533
536
|
*/
|
|
534
|
-
|
|
537
|
+
class DataEntry {
|
|
535
538
|
static __wrap(ptr) {
|
|
536
539
|
ptr = ptr >>> 0;
|
|
537
540
|
const obj = Object.create(DataEntry.prototype);
|
|
@@ -690,12 +693,13 @@ export class DataEntry {
|
|
|
690
693
|
}
|
|
691
694
|
}
|
|
692
695
|
if (Symbol.dispose) DataEntry.prototype[Symbol.dispose] = DataEntry.prototype.free;
|
|
696
|
+
exports.DataEntry = DataEntry;
|
|
693
697
|
|
|
694
698
|
/**
|
|
695
699
|
* A WASM wrapper for the Rust `cedarling::DataStoreStats` struct.
|
|
696
700
|
* Statistics about the DataStore.
|
|
697
701
|
*/
|
|
698
|
-
|
|
702
|
+
class DataStoreStats {
|
|
699
703
|
static __wrap(ptr) {
|
|
700
704
|
ptr = ptr >>> 0;
|
|
701
705
|
const obj = Object.create(DataStoreStats.prototype);
|
|
@@ -866,6 +870,7 @@ export class DataStoreStats {
|
|
|
866
870
|
}
|
|
867
871
|
}
|
|
868
872
|
if (Symbol.dispose) DataStoreStats.prototype[Symbol.dispose] = DataStoreStats.prototype.free;
|
|
873
|
+
exports.DataStoreStats = DataStoreStats;
|
|
869
874
|
|
|
870
875
|
/**
|
|
871
876
|
* Diagnostics
|
|
@@ -873,7 +878,7 @@ if (Symbol.dispose) DataStoreStats.prototype[Symbol.dispose] = DataStoreStats.pr
|
|
|
873
878
|
*
|
|
874
879
|
* Provides detailed information about how a policy decision was made, including policies that contributed to the decision and any errors encountered during evaluation.
|
|
875
880
|
*/
|
|
876
|
-
|
|
881
|
+
class Diagnostics {
|
|
877
882
|
static __wrap(ptr) {
|
|
878
883
|
ptr = ptr >>> 0;
|
|
879
884
|
const obj = Object.create(Diagnostics.prototype);
|
|
@@ -917,12 +922,13 @@ export class Diagnostics {
|
|
|
917
922
|
}
|
|
918
923
|
}
|
|
919
924
|
if (Symbol.dispose) Diagnostics.prototype[Symbol.dispose] = Diagnostics.prototype.free;
|
|
925
|
+
exports.Diagnostics = Diagnostics;
|
|
920
926
|
|
|
921
927
|
/**
|
|
922
928
|
* A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
|
|
923
929
|
* Represents the result of a multi-issuer authorization request.
|
|
924
930
|
*/
|
|
925
|
-
|
|
931
|
+
class MultiIssuerAuthorizeResult {
|
|
926
932
|
static __wrap(ptr) {
|
|
927
933
|
ptr = ptr >>> 0;
|
|
928
934
|
const obj = Object.create(MultiIssuerAuthorizeResult.prototype);
|
|
@@ -1019,6 +1025,7 @@ export class MultiIssuerAuthorizeResult {
|
|
|
1019
1025
|
}
|
|
1020
1026
|
}
|
|
1021
1027
|
if (Symbol.dispose) MultiIssuerAuthorizeResult.prototype[Symbol.dispose] = MultiIssuerAuthorizeResult.prototype.free;
|
|
1028
|
+
exports.MultiIssuerAuthorizeResult = MultiIssuerAuthorizeResult;
|
|
1022
1029
|
|
|
1023
1030
|
/**
|
|
1024
1031
|
* PolicyEvaluationError
|
|
@@ -1026,7 +1033,7 @@ if (Symbol.dispose) MultiIssuerAuthorizeResult.prototype[Symbol.dispose] = Multi
|
|
|
1026
1033
|
*
|
|
1027
1034
|
* Represents an error that occurred when evaluating a Cedar policy.
|
|
1028
1035
|
*/
|
|
1029
|
-
|
|
1036
|
+
class PolicyEvaluationError {
|
|
1030
1037
|
static __wrap(ptr) {
|
|
1031
1038
|
ptr = ptr >>> 0;
|
|
1032
1039
|
const obj = Object.create(PolicyEvaluationError.prototype);
|
|
@@ -1078,6 +1085,7 @@ export class PolicyEvaluationError {
|
|
|
1078
1085
|
}
|
|
1079
1086
|
}
|
|
1080
1087
|
if (Symbol.dispose) PolicyEvaluationError.prototype[Symbol.dispose] = PolicyEvaluationError.prototype.free;
|
|
1088
|
+
exports.PolicyEvaluationError = PolicyEvaluationError;
|
|
1081
1089
|
|
|
1082
1090
|
/**
|
|
1083
1091
|
* Create a new instance of the Cedarling application.
|
|
@@ -1085,10 +1093,11 @@ if (Symbol.dispose) PolicyEvaluationError.prototype[Symbol.dispose] = PolicyEval
|
|
|
1085
1093
|
* @param {any} config
|
|
1086
1094
|
* @returns {Promise<Cedarling>}
|
|
1087
1095
|
*/
|
|
1088
|
-
|
|
1096
|
+
function init(config) {
|
|
1089
1097
|
const ret = wasm.init(config);
|
|
1090
1098
|
return ret;
|
|
1091
1099
|
}
|
|
1100
|
+
exports.init = init;
|
|
1092
1101
|
|
|
1093
1102
|
/**
|
|
1094
1103
|
* Create a new instance of the Cedarling application from archive bytes.
|
|
@@ -1110,10 +1119,11 @@ export function init(config) {
|
|
|
1110
1119
|
* @param {Uint8Array} archive_bytes
|
|
1111
1120
|
* @returns {Promise<Cedarling>}
|
|
1112
1121
|
*/
|
|
1113
|
-
|
|
1122
|
+
function init_from_archive_bytes(config, archive_bytes) {
|
|
1114
1123
|
const ret = wasm.init_from_archive_bytes(config, archive_bytes);
|
|
1115
1124
|
return ret;
|
|
1116
1125
|
}
|
|
1126
|
+
exports.init_from_archive_bytes = init_from_archive_bytes;
|
|
1117
1127
|
|
|
1118
1128
|
function __wbg_get_imports() {
|
|
1119
1129
|
const import0 = {
|
|
@@ -1615,7 +1625,7 @@ function __wbg_get_imports() {
|
|
|
1615
1625
|
return ret;
|
|
1616
1626
|
},
|
|
1617
1627
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
1618
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 635, function: Function { arguments: [Externref], shim_idx:
|
|
1628
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 635, function: Function { arguments: [Externref], shim_idx: 2062, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1619
1629
|
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h05d83266f808ff3c, wasm_bindgen__convert__closures_____invoke__hef1652f203b86df2);
|
|
1620
1630
|
return ret;
|
|
1621
1631
|
},
|
|
@@ -1912,15 +1922,7 @@ function takeFromExternrefTable0(idx) {
|
|
|
1912
1922
|
|
|
1913
1923
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
1914
1924
|
cachedTextDecoder.decode();
|
|
1915
|
-
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
1916
|
-
let numBytesDecoded = 0;
|
|
1917
1925
|
function decodeText(ptr, len) {
|
|
1918
|
-
numBytesDecoded += len;
|
|
1919
|
-
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
1920
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
1921
|
-
cachedTextDecoder.decode();
|
|
1922
|
-
numBytesDecoded = len;
|
|
1923
|
-
}
|
|
1924
1926
|
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
1925
1927
|
}
|
|
1926
1928
|
|
|
@@ -1939,95 +1941,8 @@ if (!('encodeInto' in cachedTextEncoder)) {
|
|
|
1939
1941
|
|
|
1940
1942
|
let WASM_VECTOR_LEN = 0;
|
|
1941
1943
|
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
cachedUint8ArrayMemory0 = null;
|
|
1948
|
-
wasm.__wbindgen_start();
|
|
1949
|
-
return wasm;
|
|
1950
|
-
}
|
|
1951
|
-
|
|
1952
|
-
async function __wbg_load(module, imports) {
|
|
1953
|
-
if (typeof Response === 'function' && module instanceof Response) {
|
|
1954
|
-
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
1955
|
-
try {
|
|
1956
|
-
return await WebAssembly.instantiateStreaming(module, imports);
|
|
1957
|
-
} catch (e) {
|
|
1958
|
-
const validResponse = module.ok && expectedResponseType(module.type);
|
|
1959
|
-
|
|
1960
|
-
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
1961
|
-
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);
|
|
1962
|
-
|
|
1963
|
-
} else { throw e; }
|
|
1964
|
-
}
|
|
1965
|
-
}
|
|
1966
|
-
|
|
1967
|
-
const bytes = await module.arrayBuffer();
|
|
1968
|
-
return await WebAssembly.instantiate(bytes, imports);
|
|
1969
|
-
} else {
|
|
1970
|
-
const instance = await WebAssembly.instantiate(module, imports);
|
|
1971
|
-
|
|
1972
|
-
if (instance instanceof WebAssembly.Instance) {
|
|
1973
|
-
return { instance, module };
|
|
1974
|
-
} else {
|
|
1975
|
-
return instance;
|
|
1976
|
-
}
|
|
1977
|
-
}
|
|
1978
|
-
|
|
1979
|
-
function expectedResponseType(type) {
|
|
1980
|
-
switch (type) {
|
|
1981
|
-
case 'basic': case 'cors': case 'default': return true;
|
|
1982
|
-
}
|
|
1983
|
-
return false;
|
|
1984
|
-
}
|
|
1985
|
-
}
|
|
1986
|
-
|
|
1987
|
-
function initSync(module) {
|
|
1988
|
-
if (wasm !== undefined) return wasm;
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
if (module !== undefined) {
|
|
1992
|
-
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
1993
|
-
({module} = module)
|
|
1994
|
-
} else {
|
|
1995
|
-
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
1996
|
-
}
|
|
1997
|
-
}
|
|
1998
|
-
|
|
1999
|
-
const imports = __wbg_get_imports();
|
|
2000
|
-
if (!(module instanceof WebAssembly.Module)) {
|
|
2001
|
-
module = new WebAssembly.Module(module);
|
|
2002
|
-
}
|
|
2003
|
-
const instance = new WebAssembly.Instance(module, imports);
|
|
2004
|
-
return __wbg_finalize_init(instance, module);
|
|
2005
|
-
}
|
|
2006
|
-
|
|
2007
|
-
async function __wbg_init(module_or_path) {
|
|
2008
|
-
if (wasm !== undefined) return wasm;
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
if (module_or_path !== undefined) {
|
|
2012
|
-
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
2013
|
-
({module_or_path} = module_or_path)
|
|
2014
|
-
} else {
|
|
2015
|
-
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
2016
|
-
}
|
|
2017
|
-
}
|
|
2018
|
-
|
|
2019
|
-
if (module_or_path === undefined) {
|
|
2020
|
-
module_or_path = new URL('cedarling_wasm_bg.wasm', import.meta.url);
|
|
2021
|
-
}
|
|
2022
|
-
const imports = __wbg_get_imports();
|
|
2023
|
-
|
|
2024
|
-
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
2025
|
-
module_or_path = fetch(module_or_path);
|
|
2026
|
-
}
|
|
2027
|
-
|
|
2028
|
-
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
2029
|
-
|
|
2030
|
-
return __wbg_finalize_init(instance, module);
|
|
2031
|
-
}
|
|
2032
|
-
|
|
2033
|
-
export { initSync, __wbg_init as default };
|
|
1944
|
+
const wasmPath = `${__dirname}/cedarling_wasm_bg.wasm`;
|
|
1945
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
1946
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
1947
|
+
let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
|
|
1948
|
+
wasm.__wbindgen_start();
|
package/cedarling_wasm_bg.wasm
CHANGED
|
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.
|
|
4
|
+
"version": "0.0.327-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
|
}
|