@janssenproject/cedarling_wasm 0.0.415-nodejs → 0.0.415
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 +144 -0
- package/cedarling_wasm.js +113 -31
- package/cedarling_wasm_bg.wasm +0 -0
- package/package.json +6 -2
package/cedarling_wasm.d.ts
CHANGED
|
@@ -544,3 +544,147 @@ export function init(config: any): Promise<Cedarling>;
|
|
|
544
544
|
* ```
|
|
545
545
|
*/
|
|
546
546
|
export function init_from_archive_bytes(config: any, archive_bytes: Uint8Array): Promise<Cedarling>;
|
|
547
|
+
|
|
548
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
549
|
+
|
|
550
|
+
export interface InitOutput {
|
|
551
|
+
readonly memory: WebAssembly.Memory;
|
|
552
|
+
readonly __wbg_authorizeresult_free: (a: number, b: number) => void;
|
|
553
|
+
readonly __wbg_authorizeresultresponse_free: (a: number, b: number) => void;
|
|
554
|
+
readonly __wbg_cedarling_free: (a: number, b: number) => void;
|
|
555
|
+
readonly __wbg_dataentry_free: (a: number, b: number) => void;
|
|
556
|
+
readonly __wbg_datastorestats_free: (a: number, b: number) => void;
|
|
557
|
+
readonly __wbg_diagnostics_free: (a: number, b: number) => void;
|
|
558
|
+
readonly __wbg_get_authorizeresult_decision: (a: number) => number;
|
|
559
|
+
readonly __wbg_get_authorizeresult_request_id: (a: number, b: number) => void;
|
|
560
|
+
readonly __wbg_get_authorizeresult_response: (a: number) => number;
|
|
561
|
+
readonly __wbg_get_dataentry_access_count: (a: number) => bigint;
|
|
562
|
+
readonly __wbg_get_dataentry_created_at: (a: number, b: number) => void;
|
|
563
|
+
readonly __wbg_get_dataentry_data_type: (a: number, b: number) => void;
|
|
564
|
+
readonly __wbg_get_dataentry_expires_at: (a: number, b: number) => void;
|
|
565
|
+
readonly __wbg_get_dataentry_key: (a: number, b: number) => void;
|
|
566
|
+
readonly __wbg_get_datastorestats_avg_entry_size_bytes: (a: number) => number;
|
|
567
|
+
readonly __wbg_get_datastorestats_capacity_usage_percent: (a: number) => number;
|
|
568
|
+
readonly __wbg_get_datastorestats_entry_count: (a: number) => number;
|
|
569
|
+
readonly __wbg_get_datastorestats_max_entries: (a: number) => number;
|
|
570
|
+
readonly __wbg_get_datastorestats_max_entry_size: (a: number) => number;
|
|
571
|
+
readonly __wbg_get_datastorestats_memory_alert_threshold: (a: number) => number;
|
|
572
|
+
readonly __wbg_get_datastorestats_memory_alert_triggered: (a: number) => number;
|
|
573
|
+
readonly __wbg_get_datastorestats_metrics_enabled: (a: number) => number;
|
|
574
|
+
readonly __wbg_get_datastorestats_total_size_bytes: (a: number) => number;
|
|
575
|
+
readonly __wbg_policyevaluationerror_free: (a: number, b: number) => void;
|
|
576
|
+
readonly __wbg_set_authorizeresult_decision: (a: number, b: number) => void;
|
|
577
|
+
readonly __wbg_set_authorizeresult_request_id: (a: number, b: number, c: number) => void;
|
|
578
|
+
readonly __wbg_set_authorizeresult_response: (a: number, b: number) => void;
|
|
579
|
+
readonly __wbg_set_dataentry_access_count: (a: number, b: bigint) => void;
|
|
580
|
+
readonly __wbg_set_dataentry_created_at: (a: number, b: number, c: number) => void;
|
|
581
|
+
readonly __wbg_set_dataentry_data_type: (a: number, b: number, c: number) => void;
|
|
582
|
+
readonly __wbg_set_dataentry_expires_at: (a: number, b: number, c: number) => void;
|
|
583
|
+
readonly __wbg_set_dataentry_key: (a: number, b: number, c: number) => void;
|
|
584
|
+
readonly __wbg_set_datastorestats_avg_entry_size_bytes: (a: number, b: number) => void;
|
|
585
|
+
readonly __wbg_set_datastorestats_capacity_usage_percent: (a: number, b: number) => void;
|
|
586
|
+
readonly __wbg_set_datastorestats_entry_count: (a: number, b: number) => void;
|
|
587
|
+
readonly __wbg_set_datastorestats_max_entries: (a: number, b: number) => void;
|
|
588
|
+
readonly __wbg_set_datastorestats_max_entry_size: (a: number, b: number) => void;
|
|
589
|
+
readonly __wbg_set_datastorestats_memory_alert_threshold: (a: number, b: number) => void;
|
|
590
|
+
readonly __wbg_set_datastorestats_memory_alert_triggered: (a: number, b: number) => void;
|
|
591
|
+
readonly __wbg_set_datastorestats_metrics_enabled: (a: number, b: number) => void;
|
|
592
|
+
readonly __wbg_set_datastorestats_total_size_bytes: (a: number, b: number) => void;
|
|
593
|
+
readonly authorizeresult_json_string: (a: number, b: number) => void;
|
|
594
|
+
readonly authorizeresultresponse_decision: (a: number) => number;
|
|
595
|
+
readonly authorizeresultresponse_diagnostics: (a: number) => number;
|
|
596
|
+
readonly cedarling_authorize_multi_issuer: (a: number, b: number, c: number) => number;
|
|
597
|
+
readonly cedarling_authorize_unsigned: (a: number, b: number, c: number) => number;
|
|
598
|
+
readonly cedarling_clear_data_ctx: (a: number, b: number) => void;
|
|
599
|
+
readonly cedarling_failed_trusted_issuer_ids: (a: number) => number;
|
|
600
|
+
readonly cedarling_get_data_ctx: (a: number, b: number, c: number, d: number) => void;
|
|
601
|
+
readonly cedarling_get_data_entry_ctx: (a: number, b: number, c: number, d: number) => void;
|
|
602
|
+
readonly cedarling_get_log_by_id: (a: number, b: number, c: number, d: number) => void;
|
|
603
|
+
readonly cedarling_get_log_ids: (a: number) => number;
|
|
604
|
+
readonly cedarling_get_logs_by_request_id: (a: number, b: number, c: number, d: number) => void;
|
|
605
|
+
readonly cedarling_get_logs_by_request_id_and_tag: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
606
|
+
readonly cedarling_get_stats_ctx: (a: number, b: number) => void;
|
|
607
|
+
readonly cedarling_is_trusted_issuer_loaded_by_iss: (a: number, b: number, c: number) => number;
|
|
608
|
+
readonly cedarling_is_trusted_issuer_loaded_by_name: (a: number, b: number, c: number) => number;
|
|
609
|
+
readonly cedarling_list_data_ctx: (a: number, b: number) => void;
|
|
610
|
+
readonly cedarling_loaded_trusted_issuer_ids: (a: number) => number;
|
|
611
|
+
readonly cedarling_loaded_trusted_issuers_count: (a: number) => number;
|
|
612
|
+
readonly cedarling_new: (a: number) => number;
|
|
613
|
+
readonly cedarling_new_from_map: (a: number) => number;
|
|
614
|
+
readonly cedarling_pop_logs: (a: number, b: number) => void;
|
|
615
|
+
readonly cedarling_push_data_ctx: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint) => void;
|
|
616
|
+
readonly cedarling_remove_data_ctx: (a: number, b: number, c: number, d: number) => void;
|
|
617
|
+
readonly cedarling_shut_down: (a: number) => number;
|
|
618
|
+
readonly cedarling_total_issuers: (a: number) => number;
|
|
619
|
+
readonly dataentry_json_string: (a: number, b: number) => void;
|
|
620
|
+
readonly dataentry_value: (a: number, b: number) => void;
|
|
621
|
+
readonly datastorestats_json_string: (a: number, b: number) => void;
|
|
622
|
+
readonly diagnostics_errors: (a: number, b: number) => void;
|
|
623
|
+
readonly diagnostics_reason: (a: number, b: number) => void;
|
|
624
|
+
readonly init: (a: number) => number;
|
|
625
|
+
readonly init_from_archive_bytes: (a: number, b: number) => number;
|
|
626
|
+
readonly multiissuerauthorizeresult_json_string: (a: number, b: number) => void;
|
|
627
|
+
readonly policyevaluationerror_error: (a: number, b: number) => void;
|
|
628
|
+
readonly policyevaluationerror_id: (a: number, b: number) => void;
|
|
629
|
+
readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
|
|
630
|
+
readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
|
|
631
|
+
readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
|
|
632
|
+
readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
|
|
633
|
+
readonly intounderlyingbytesource_cancel: (a: number) => void;
|
|
634
|
+
readonly intounderlyingbytesource_pull: (a: number, b: number) => number;
|
|
635
|
+
readonly intounderlyingbytesource_start: (a: number, b: number) => void;
|
|
636
|
+
readonly intounderlyingbytesource_type: (a: number) => number;
|
|
637
|
+
readonly intounderlyingsink_abort: (a: number, b: number) => number;
|
|
638
|
+
readonly intounderlyingsink_close: (a: number) => number;
|
|
639
|
+
readonly intounderlyingsink_write: (a: number, b: number) => number;
|
|
640
|
+
readonly intounderlyingsource_cancel: (a: number) => void;
|
|
641
|
+
readonly intounderlyingsource_pull: (a: number, b: number) => number;
|
|
642
|
+
readonly rust_zstd_wasm_shim_calloc: (a: number, b: number) => number;
|
|
643
|
+
readonly rust_zstd_wasm_shim_free: (a: number) => void;
|
|
644
|
+
readonly rust_zstd_wasm_shim_malloc: (a: number) => number;
|
|
645
|
+
readonly rust_zstd_wasm_shim_memcmp: (a: number, b: number, c: number) => number;
|
|
646
|
+
readonly rust_zstd_wasm_shim_memcpy: (a: number, b: number, c: number) => number;
|
|
647
|
+
readonly rust_zstd_wasm_shim_memmove: (a: number, b: number, c: number) => number;
|
|
648
|
+
readonly rust_zstd_wasm_shim_memset: (a: number, b: number, c: number) => number;
|
|
649
|
+
readonly rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void;
|
|
650
|
+
readonly __wbg_get_multiissuerauthorizeresult_decision: (a: number) => number;
|
|
651
|
+
readonly __wbg_set_multiissuerauthorizeresult_response: (a: number, b: number) => void;
|
|
652
|
+
readonly __wbg_set_multiissuerauthorizeresult_request_id: (a: number, b: number, c: number) => void;
|
|
653
|
+
readonly __wbg_set_multiissuerauthorizeresult_decision: (a: number, b: number) => void;
|
|
654
|
+
readonly __wbg_get_multiissuerauthorizeresult_response: (a: number) => number;
|
|
655
|
+
readonly __wbg_get_multiissuerauthorizeresult_request_id: (a: number, b: number) => void;
|
|
656
|
+
readonly __wbg_multiissuerauthorizeresult_free: (a: number, b: number) => void;
|
|
657
|
+
readonly cedarling_get_logs_by_tag: (a: number, b: number, c: number, d: number) => void;
|
|
658
|
+
readonly __wasm_bindgen_func_elem_8668: (a: number, b: number, c: number, d: number) => void;
|
|
659
|
+
readonly __wasm_bindgen_func_elem_8722: (a: number, b: number, c: number, d: number) => void;
|
|
660
|
+
readonly __wasm_bindgen_func_elem_12144: (a: number, b: number, c: number) => void;
|
|
661
|
+
readonly __wasm_bindgen_func_elem_8503: (a: number, b: number) => void;
|
|
662
|
+
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
663
|
+
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
664
|
+
readonly __wbindgen_export3: (a: number) => void;
|
|
665
|
+
readonly __wbindgen_export4: (a: number, b: number) => void;
|
|
666
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
667
|
+
readonly __wbindgen_export5: (a: number, b: number, c: number) => void;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
671
|
+
|
|
672
|
+
/**
|
|
673
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
674
|
+
* a precompiled `WebAssembly.Module`.
|
|
675
|
+
*
|
|
676
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
677
|
+
*
|
|
678
|
+
* @returns {InitOutput}
|
|
679
|
+
*/
|
|
680
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
684
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
685
|
+
*
|
|
686
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
687
|
+
*
|
|
688
|
+
* @returns {Promise<InitOutput>}
|
|
689
|
+
*/
|
|
690
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
package/cedarling_wasm.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* A WASM wrapper for the Rust `cedarling::AuthorizeResult` struct.
|
|
5
5
|
* Represents the result of an authorization request.
|
|
6
6
|
*/
|
|
7
|
-
class AuthorizeResult {
|
|
7
|
+
export class AuthorizeResult {
|
|
8
8
|
static __wrap(ptr) {
|
|
9
9
|
const obj = Object.create(AuthorizeResult.prototype);
|
|
10
10
|
obj.__wbg_ptr = ptr;
|
|
@@ -112,13 +112,12 @@ class AuthorizeResult {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
if (Symbol.dispose) AuthorizeResult.prototype[Symbol.dispose] = AuthorizeResult.prototype.free;
|
|
115
|
-
exports.AuthorizeResult = AuthorizeResult;
|
|
116
115
|
|
|
117
116
|
/**
|
|
118
117
|
* A WASM wrapper for the Rust `cedar_policy::Response` struct.
|
|
119
118
|
* Represents the result of an authorization request.
|
|
120
119
|
*/
|
|
121
|
-
class AuthorizeResultResponse {
|
|
120
|
+
export class AuthorizeResultResponse {
|
|
122
121
|
static __wrap(ptr) {
|
|
123
122
|
const obj = Object.create(AuthorizeResultResponse.prototype);
|
|
124
123
|
obj.__wbg_ptr = ptr;
|
|
@@ -153,12 +152,11 @@ class AuthorizeResultResponse {
|
|
|
153
152
|
}
|
|
154
153
|
}
|
|
155
154
|
if (Symbol.dispose) AuthorizeResultResponse.prototype[Symbol.dispose] = AuthorizeResultResponse.prototype.free;
|
|
156
|
-
exports.AuthorizeResultResponse = AuthorizeResultResponse;
|
|
157
155
|
|
|
158
156
|
/**
|
|
159
157
|
* The instance of the Cedarling application.
|
|
160
158
|
*/
|
|
161
|
-
class Cedarling {
|
|
159
|
+
export class Cedarling {
|
|
162
160
|
static __wrap(ptr) {
|
|
163
161
|
const obj = Object.create(Cedarling.prototype);
|
|
164
162
|
obj.__wbg_ptr = ptr;
|
|
@@ -714,13 +712,12 @@ class Cedarling {
|
|
|
714
712
|
}
|
|
715
713
|
}
|
|
716
714
|
if (Symbol.dispose) Cedarling.prototype[Symbol.dispose] = Cedarling.prototype.free;
|
|
717
|
-
exports.Cedarling = Cedarling;
|
|
718
715
|
|
|
719
716
|
/**
|
|
720
717
|
* A WASM wrapper for the Rust `cedarling::DataEntry` struct.
|
|
721
718
|
* Represents a data entry in the DataStore with value and metadata.
|
|
722
719
|
*/
|
|
723
|
-
class DataEntry {
|
|
720
|
+
export class DataEntry {
|
|
724
721
|
static __wrap(ptr) {
|
|
725
722
|
const obj = Object.create(DataEntry.prototype);
|
|
726
723
|
obj.__wbg_ptr = ptr;
|
|
@@ -909,13 +906,12 @@ class DataEntry {
|
|
|
909
906
|
}
|
|
910
907
|
}
|
|
911
908
|
if (Symbol.dispose) DataEntry.prototype[Symbol.dispose] = DataEntry.prototype.free;
|
|
912
|
-
exports.DataEntry = DataEntry;
|
|
913
909
|
|
|
914
910
|
/**
|
|
915
911
|
* A WASM wrapper for the Rust `cedarling::DataStoreStats` struct.
|
|
916
912
|
* Statistics about the DataStore.
|
|
917
913
|
*/
|
|
918
|
-
class DataStoreStats {
|
|
914
|
+
export class DataStoreStats {
|
|
919
915
|
static __wrap(ptr) {
|
|
920
916
|
const obj = Object.create(DataStoreStats.prototype);
|
|
921
917
|
obj.__wbg_ptr = ptr;
|
|
@@ -1089,7 +1085,6 @@ class DataStoreStats {
|
|
|
1089
1085
|
}
|
|
1090
1086
|
}
|
|
1091
1087
|
if (Symbol.dispose) DataStoreStats.prototype[Symbol.dispose] = DataStoreStats.prototype.free;
|
|
1092
|
-
exports.DataStoreStats = DataStoreStats;
|
|
1093
1088
|
|
|
1094
1089
|
/**
|
|
1095
1090
|
* Diagnostics
|
|
@@ -1097,7 +1092,7 @@ exports.DataStoreStats = DataStoreStats;
|
|
|
1097
1092
|
*
|
|
1098
1093
|
* Provides detailed information about how a policy decision was made, including policies that contributed to the decision and any errors encountered during evaluation.
|
|
1099
1094
|
*/
|
|
1100
|
-
class Diagnostics {
|
|
1095
|
+
export class Diagnostics {
|
|
1101
1096
|
static __wrap(ptr) {
|
|
1102
1097
|
const obj = Object.create(Diagnostics.prototype);
|
|
1103
1098
|
obj.__wbg_ptr = ptr;
|
|
@@ -1154,9 +1149,8 @@ class Diagnostics {
|
|
|
1154
1149
|
}
|
|
1155
1150
|
}
|
|
1156
1151
|
if (Symbol.dispose) Diagnostics.prototype[Symbol.dispose] = Diagnostics.prototype.free;
|
|
1157
|
-
exports.Diagnostics = Diagnostics;
|
|
1158
1152
|
|
|
1159
|
-
class IntoUnderlyingByteSource {
|
|
1153
|
+
export class IntoUnderlyingByteSource {
|
|
1160
1154
|
__destroy_into_raw() {
|
|
1161
1155
|
const ptr = this.__wbg_ptr;
|
|
1162
1156
|
this.__wbg_ptr = 0;
|
|
@@ -1201,9 +1195,8 @@ class IntoUnderlyingByteSource {
|
|
|
1201
1195
|
}
|
|
1202
1196
|
}
|
|
1203
1197
|
if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
|
|
1204
|
-
exports.IntoUnderlyingByteSource = IntoUnderlyingByteSource;
|
|
1205
1198
|
|
|
1206
|
-
class IntoUnderlyingSink {
|
|
1199
|
+
export class IntoUnderlyingSink {
|
|
1207
1200
|
__destroy_into_raw() {
|
|
1208
1201
|
const ptr = this.__wbg_ptr;
|
|
1209
1202
|
this.__wbg_ptr = 0;
|
|
@@ -1241,9 +1234,8 @@ class IntoUnderlyingSink {
|
|
|
1241
1234
|
}
|
|
1242
1235
|
}
|
|
1243
1236
|
if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
|
|
1244
|
-
exports.IntoUnderlyingSink = IntoUnderlyingSink;
|
|
1245
1237
|
|
|
1246
|
-
class IntoUnderlyingSource {
|
|
1238
|
+
export class IntoUnderlyingSource {
|
|
1247
1239
|
__destroy_into_raw() {
|
|
1248
1240
|
const ptr = this.__wbg_ptr;
|
|
1249
1241
|
this.__wbg_ptr = 0;
|
|
@@ -1268,13 +1260,12 @@ class IntoUnderlyingSource {
|
|
|
1268
1260
|
}
|
|
1269
1261
|
}
|
|
1270
1262
|
if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
|
|
1271
|
-
exports.IntoUnderlyingSource = IntoUnderlyingSource;
|
|
1272
1263
|
|
|
1273
1264
|
/**
|
|
1274
1265
|
* A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
|
|
1275
1266
|
* Represents the result of a multi-issuer authorization request.
|
|
1276
1267
|
*/
|
|
1277
|
-
class MultiIssuerAuthorizeResult {
|
|
1268
|
+
export class MultiIssuerAuthorizeResult {
|
|
1278
1269
|
static __wrap(ptr) {
|
|
1279
1270
|
const obj = Object.create(MultiIssuerAuthorizeResult.prototype);
|
|
1280
1271
|
obj.__wbg_ptr = ptr;
|
|
@@ -1378,7 +1369,6 @@ class MultiIssuerAuthorizeResult {
|
|
|
1378
1369
|
}
|
|
1379
1370
|
}
|
|
1380
1371
|
if (Symbol.dispose) MultiIssuerAuthorizeResult.prototype[Symbol.dispose] = MultiIssuerAuthorizeResult.prototype.free;
|
|
1381
|
-
exports.MultiIssuerAuthorizeResult = MultiIssuerAuthorizeResult;
|
|
1382
1372
|
|
|
1383
1373
|
/**
|
|
1384
1374
|
* PolicyEvaluationError
|
|
@@ -1386,7 +1376,7 @@ exports.MultiIssuerAuthorizeResult = MultiIssuerAuthorizeResult;
|
|
|
1386
1376
|
*
|
|
1387
1377
|
* Represents an error that occurred when evaluating a Cedar policy.
|
|
1388
1378
|
*/
|
|
1389
|
-
class PolicyEvaluationError {
|
|
1379
|
+
export class PolicyEvaluationError {
|
|
1390
1380
|
static __wrap(ptr) {
|
|
1391
1381
|
const obj = Object.create(PolicyEvaluationError.prototype);
|
|
1392
1382
|
obj.__wbg_ptr = ptr;
|
|
@@ -1445,7 +1435,6 @@ class PolicyEvaluationError {
|
|
|
1445
1435
|
}
|
|
1446
1436
|
}
|
|
1447
1437
|
if (Symbol.dispose) PolicyEvaluationError.prototype[Symbol.dispose] = PolicyEvaluationError.prototype.free;
|
|
1448
|
-
exports.PolicyEvaluationError = PolicyEvaluationError;
|
|
1449
1438
|
|
|
1450
1439
|
/**
|
|
1451
1440
|
* Create a new instance of the Cedarling application.
|
|
@@ -1453,11 +1442,10 @@ exports.PolicyEvaluationError = PolicyEvaluationError;
|
|
|
1453
1442
|
* @param {any} config
|
|
1454
1443
|
* @returns {Promise<Cedarling>}
|
|
1455
1444
|
*/
|
|
1456
|
-
function init(config) {
|
|
1445
|
+
export function init(config) {
|
|
1457
1446
|
const ret = wasm.init(addHeapObject(config));
|
|
1458
1447
|
return takeObject(ret);
|
|
1459
1448
|
}
|
|
1460
|
-
exports.init = init;
|
|
1461
1449
|
|
|
1462
1450
|
/**
|
|
1463
1451
|
* Create a new instance of the Cedarling application from archive bytes.
|
|
@@ -1479,11 +1467,10 @@ exports.init = init;
|
|
|
1479
1467
|
* @param {Uint8Array} archive_bytes
|
|
1480
1468
|
* @returns {Promise<Cedarling>}
|
|
1481
1469
|
*/
|
|
1482
|
-
function init_from_archive_bytes(config, archive_bytes) {
|
|
1470
|
+
export function init_from_archive_bytes(config, archive_bytes) {
|
|
1483
1471
|
const ret = wasm.init_from_archive_bytes(addHeapObject(config), addHeapObject(archive_bytes));
|
|
1484
1472
|
return takeObject(ret);
|
|
1485
1473
|
}
|
|
1486
|
-
exports.init_from_archive_bytes = init_from_archive_bytes;
|
|
1487
1474
|
function __wbg_get_imports() {
|
|
1488
1475
|
const import0 = {
|
|
1489
1476
|
__proto__: null,
|
|
@@ -2439,7 +2426,15 @@ function takeObject(idx) {
|
|
|
2439
2426
|
|
|
2440
2427
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
2441
2428
|
cachedTextDecoder.decode();
|
|
2429
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
2430
|
+
let numBytesDecoded = 0;
|
|
2442
2431
|
function decodeText(ptr, len) {
|
|
2432
|
+
numBytesDecoded += len;
|
|
2433
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
2434
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
2435
|
+
cachedTextDecoder.decode();
|
|
2436
|
+
numBytesDecoded = len;
|
|
2437
|
+
}
|
|
2443
2438
|
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
2444
2439
|
}
|
|
2445
2440
|
|
|
@@ -2458,8 +2453,95 @@ if (!('encodeInto' in cachedTextEncoder)) {
|
|
|
2458
2453
|
|
|
2459
2454
|
let WASM_VECTOR_LEN = 0;
|
|
2460
2455
|
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2456
|
+
let wasmModule, wasmInstance, wasm;
|
|
2457
|
+
function __wbg_finalize_init(instance, module) {
|
|
2458
|
+
wasmInstance = instance;
|
|
2459
|
+
wasm = instance.exports;
|
|
2460
|
+
wasmModule = module;
|
|
2461
|
+
cachedDataViewMemory0 = null;
|
|
2462
|
+
cachedUint8ArrayMemory0 = null;
|
|
2463
|
+
return wasm;
|
|
2464
|
+
}
|
|
2465
|
+
|
|
2466
|
+
async function __wbg_load(module, imports) {
|
|
2467
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
2468
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
2469
|
+
try {
|
|
2470
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
2471
|
+
} catch (e) {
|
|
2472
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
2473
|
+
|
|
2474
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
2475
|
+
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);
|
|
2476
|
+
|
|
2477
|
+
} else { throw e; }
|
|
2478
|
+
}
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
const bytes = await module.arrayBuffer();
|
|
2482
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
2483
|
+
} else {
|
|
2484
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
2485
|
+
|
|
2486
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
2487
|
+
return { instance, module };
|
|
2488
|
+
} else {
|
|
2489
|
+
return instance;
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
|
|
2493
|
+
function expectedResponseType(type) {
|
|
2494
|
+
switch (type) {
|
|
2495
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
2496
|
+
}
|
|
2497
|
+
return false;
|
|
2498
|
+
}
|
|
2499
|
+
}
|
|
2500
|
+
|
|
2501
|
+
function initSync(module) {
|
|
2502
|
+
if (wasm !== undefined) return wasm;
|
|
2503
|
+
|
|
2504
|
+
|
|
2505
|
+
if (module !== undefined) {
|
|
2506
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
2507
|
+
({module} = module)
|
|
2508
|
+
} else {
|
|
2509
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
|
|
2513
|
+
const imports = __wbg_get_imports();
|
|
2514
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
2515
|
+
module = new WebAssembly.Module(module);
|
|
2516
|
+
}
|
|
2517
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
2518
|
+
return __wbg_finalize_init(instance, module);
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
async function __wbg_init(module_or_path) {
|
|
2522
|
+
if (wasm !== undefined) return wasm;
|
|
2523
|
+
|
|
2524
|
+
|
|
2525
|
+
if (module_or_path !== undefined) {
|
|
2526
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
2527
|
+
({module_or_path} = module_or_path)
|
|
2528
|
+
} else {
|
|
2529
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
|
|
2533
|
+
if (module_or_path === undefined) {
|
|
2534
|
+
module_or_path = new URL('cedarling_wasm_bg.wasm', import.meta.url);
|
|
2535
|
+
}
|
|
2536
|
+
const imports = __wbg_get_imports();
|
|
2537
|
+
|
|
2538
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
2539
|
+
module_or_path = fetch(module_or_path);
|
|
2540
|
+
}
|
|
2541
|
+
|
|
2542
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
2543
|
+
|
|
2544
|
+
return __wbg_finalize_init(instance, module);
|
|
2545
|
+
}
|
|
2546
|
+
|
|
2547
|
+
export { initSync, __wbg_init as default };
|
package/cedarling_wasm_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@janssenproject/cedarling_wasm",
|
|
3
|
+
"type": "module",
|
|
3
4
|
"description": "The Cedarling is a performant local authorization service that runs the Rust Cedar Engine",
|
|
4
|
-
"version": "0.0.415
|
|
5
|
+
"version": "0.0.415",
|
|
5
6
|
"license": "Apache-2.0",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
@@ -13,5 +14,8 @@
|
|
|
13
14
|
"cedarling_wasm.d.ts"
|
|
14
15
|
],
|
|
15
16
|
"main": "cedarling_wasm.js",
|
|
16
|
-
"types": "cedarling_wasm.d.ts"
|
|
17
|
+
"types": "cedarling_wasm.d.ts",
|
|
18
|
+
"sideEffects": [
|
|
19
|
+
"./snippets/*"
|
|
20
|
+
]
|
|
17
21
|
}
|