@janssenproject/cedarling_wasm 2.3.0-nodejs → 2.3.0
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 +167 -0
- package/cedarling_wasm.js +127 -50
- package/cedarling_wasm_bg.wasm +0 -0
- package/package.json +6 -2
package/cedarling_wasm.d.ts
CHANGED
|
@@ -757,3 +757,170 @@ export function init(config: any): Promise<Cedarling>;
|
|
|
757
757
|
* ```
|
|
758
758
|
*/
|
|
759
759
|
export function init_from_archive_bytes(config: any, archive_bytes: Uint8Array): Promise<Cedarling>;
|
|
760
|
+
|
|
761
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
762
|
+
|
|
763
|
+
export interface InitOutput {
|
|
764
|
+
readonly memory: WebAssembly.Memory;
|
|
765
|
+
readonly __wbg_authorizeresult_free: (a: number, b: number) => void;
|
|
766
|
+
readonly __wbg_authorizeresultresponse_free: (a: number, b: number) => void;
|
|
767
|
+
readonly __wbg_batchauthorizemultiissuerresponse_free: (a: number, b: number) => void;
|
|
768
|
+
readonly __wbg_batchitemerror_free: (a: number, b: number) => void;
|
|
769
|
+
readonly __wbg_batchitemmultiissuerresult_free: (a: number, b: number) => void;
|
|
770
|
+
readonly __wbg_cedarling_free: (a: number, b: number) => void;
|
|
771
|
+
readonly __wbg_dataentry_free: (a: number, b: number) => void;
|
|
772
|
+
readonly __wbg_datastorestats_free: (a: number, b: number) => void;
|
|
773
|
+
readonly __wbg_diagnostics_free: (a: number, b: number) => void;
|
|
774
|
+
readonly __wbg_get_authorizeresult_decision: (a: number) => number;
|
|
775
|
+
readonly __wbg_get_authorizeresult_request_id: (a: number, b: number) => void;
|
|
776
|
+
readonly __wbg_get_authorizeresult_response: (a: number) => number;
|
|
777
|
+
readonly __wbg_get_dataentry_access_count: (a: number) => bigint;
|
|
778
|
+
readonly __wbg_get_dataentry_created_at: (a: number, b: number) => void;
|
|
779
|
+
readonly __wbg_get_dataentry_data_type: (a: number, b: number) => void;
|
|
780
|
+
readonly __wbg_get_dataentry_expires_at: (a: number, b: number) => void;
|
|
781
|
+
readonly __wbg_get_dataentry_key: (a: number, b: number) => void;
|
|
782
|
+
readonly __wbg_get_datastorestats_avg_entry_size_bytes: (a: number) => number;
|
|
783
|
+
readonly __wbg_get_datastorestats_capacity_usage_percent: (a: number) => number;
|
|
784
|
+
readonly __wbg_get_datastorestats_entry_count: (a: number) => number;
|
|
785
|
+
readonly __wbg_get_datastorestats_max_entries: (a: number) => number;
|
|
786
|
+
readonly __wbg_get_datastorestats_max_entry_size: (a: number) => number;
|
|
787
|
+
readonly __wbg_get_datastorestats_memory_alert_threshold: (a: number) => number;
|
|
788
|
+
readonly __wbg_get_datastorestats_memory_alert_triggered: (a: number) => number;
|
|
789
|
+
readonly __wbg_get_datastorestats_metrics_enabled: (a: number) => number;
|
|
790
|
+
readonly __wbg_get_datastorestats_total_size_bytes: (a: number) => number;
|
|
791
|
+
readonly __wbg_policyevaluationerror_free: (a: number, b: number) => void;
|
|
792
|
+
readonly __wbg_set_authorizeresult_decision: (a: number, b: number) => void;
|
|
793
|
+
readonly __wbg_set_authorizeresult_request_id: (a: number, b: number, c: number) => void;
|
|
794
|
+
readonly __wbg_set_authorizeresult_response: (a: number, b: number) => void;
|
|
795
|
+
readonly __wbg_set_dataentry_access_count: (a: number, b: bigint) => void;
|
|
796
|
+
readonly __wbg_set_dataentry_created_at: (a: number, b: number, c: number) => void;
|
|
797
|
+
readonly __wbg_set_dataentry_data_type: (a: number, b: number, c: number) => void;
|
|
798
|
+
readonly __wbg_set_dataentry_expires_at: (a: number, b: number, c: number) => void;
|
|
799
|
+
readonly __wbg_set_dataentry_key: (a: number, b: number, c: number) => void;
|
|
800
|
+
readonly __wbg_set_datastorestats_avg_entry_size_bytes: (a: number, b: number) => void;
|
|
801
|
+
readonly __wbg_set_datastorestats_capacity_usage_percent: (a: number, b: number) => void;
|
|
802
|
+
readonly __wbg_set_datastorestats_entry_count: (a: number, b: number) => void;
|
|
803
|
+
readonly __wbg_set_datastorestats_max_entries: (a: number, b: number) => void;
|
|
804
|
+
readonly __wbg_set_datastorestats_max_entry_size: (a: number, b: number) => void;
|
|
805
|
+
readonly __wbg_set_datastorestats_memory_alert_threshold: (a: number, b: number) => void;
|
|
806
|
+
readonly __wbg_set_datastorestats_memory_alert_triggered: (a: number, b: number) => void;
|
|
807
|
+
readonly __wbg_set_datastorestats_metrics_enabled: (a: number, b: number) => void;
|
|
808
|
+
readonly __wbg_set_datastorestats_total_size_bytes: (a: number, b: number) => void;
|
|
809
|
+
readonly authorizeresult_json_string: (a: number, b: number) => void;
|
|
810
|
+
readonly authorizeresultresponse_decision: (a: number) => number;
|
|
811
|
+
readonly authorizeresultresponse_diagnostics: (a: number) => number;
|
|
812
|
+
readonly batchauthorizemultiissuerresponse_batch_id: (a: number, b: number) => void;
|
|
813
|
+
readonly batchauthorizemultiissuerresponse_results: (a: number, b: number) => void;
|
|
814
|
+
readonly batchauthorizeunsignedresponse_results: (a: number, b: number) => void;
|
|
815
|
+
readonly batchitemerror_category: (a: number, b: number) => void;
|
|
816
|
+
readonly batchitemerror_item_index: (a: number) => number;
|
|
817
|
+
readonly batchitemerror_message: (a: number, b: number) => void;
|
|
818
|
+
readonly batchitemmultiissuerresult_error: (a: number) => number;
|
|
819
|
+
readonly batchitemmultiissuerresult_is_ok: (a: number) => number;
|
|
820
|
+
readonly batchitemmultiissuerresult_unwrap: (a: number, b: number) => void;
|
|
821
|
+
readonly batchitemunsignedresult_unwrap: (a: number, b: number) => void;
|
|
822
|
+
readonly cedarling_annotation_values: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
823
|
+
readonly cedarling_annotations_by_policy: (a: number, b: number, c: number, d: number) => void;
|
|
824
|
+
readonly cedarling_annotations_map: (a: number, b: number, c: number, d: number) => void;
|
|
825
|
+
readonly cedarling_authorize_multi_issuer: (a: number, b: number, c: number) => number;
|
|
826
|
+
readonly cedarling_authorize_multi_issuer_batch: (a: number, b: number, c: number) => number;
|
|
827
|
+
readonly cedarling_authorize_unsigned: (a: number, b: number, c: number) => number;
|
|
828
|
+
readonly cedarling_authorize_unsigned_batch: (a: number, b: number, c: number) => number;
|
|
829
|
+
readonly cedarling_clear_data_ctx: (a: number, b: number) => void;
|
|
830
|
+
readonly cedarling_failed_trusted_issuer_ids: (a: number) => number;
|
|
831
|
+
readonly cedarling_get_data_ctx: (a: number, b: number, c: number, d: number) => void;
|
|
832
|
+
readonly cedarling_get_data_entry_ctx: (a: number, b: number, c: number, d: number) => void;
|
|
833
|
+
readonly cedarling_get_log_by_id: (a: number, b: number, c: number, d: number) => void;
|
|
834
|
+
readonly cedarling_get_log_ids: (a: number) => number;
|
|
835
|
+
readonly cedarling_get_logs_by_request_id: (a: number, b: number, c: number, d: number) => void;
|
|
836
|
+
readonly cedarling_get_logs_by_request_id_and_tag: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
837
|
+
readonly cedarling_get_stats_ctx: (a: number, b: number) => void;
|
|
838
|
+
readonly cedarling_is_trusted_issuer_loaded_by_iss: (a: number, b: number, c: number) => number;
|
|
839
|
+
readonly cedarling_is_trusted_issuer_loaded_by_name: (a: number, b: number, c: number) => number;
|
|
840
|
+
readonly cedarling_list_data_ctx: (a: number, b: number) => void;
|
|
841
|
+
readonly cedarling_loaded_trusted_issuer_ids: (a: number) => number;
|
|
842
|
+
readonly cedarling_loaded_trusted_issuers_count: (a: number) => number;
|
|
843
|
+
readonly cedarling_new: (a: number) => number;
|
|
844
|
+
readonly cedarling_new_from_map: (a: number) => number;
|
|
845
|
+
readonly cedarling_pop_logs: (a: number, b: number) => void;
|
|
846
|
+
readonly cedarling_push_data_ctx: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint) => void;
|
|
847
|
+
readonly cedarling_remove_data_ctx: (a: number, b: number, c: number, d: number) => void;
|
|
848
|
+
readonly cedarling_shut_down: (a: number) => number;
|
|
849
|
+
readonly cedarling_total_issuers: (a: number) => number;
|
|
850
|
+
readonly dataentry_json_string: (a: number, b: number) => void;
|
|
851
|
+
readonly dataentry_value: (a: number, b: number) => void;
|
|
852
|
+
readonly datastorestats_json_string: (a: number, b: number) => void;
|
|
853
|
+
readonly diagnostics_errors: (a: number, b: number) => void;
|
|
854
|
+
readonly diagnostics_reason: (a: number, b: number) => void;
|
|
855
|
+
readonly init: (a: number) => number;
|
|
856
|
+
readonly init_from_archive_bytes: (a: number, b: number) => number;
|
|
857
|
+
readonly multiissuerauthorizeresult_json_string: (a: number, b: number) => void;
|
|
858
|
+
readonly policyevaluationerror_error: (a: number, b: number) => void;
|
|
859
|
+
readonly policyevaluationerror_id: (a: number, b: number) => void;
|
|
860
|
+
readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
|
|
861
|
+
readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
|
|
862
|
+
readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
|
|
863
|
+
readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
|
|
864
|
+
readonly intounderlyingbytesource_cancel: (a: number) => void;
|
|
865
|
+
readonly intounderlyingbytesource_pull: (a: number, b: number) => number;
|
|
866
|
+
readonly intounderlyingbytesource_start: (a: number, b: number) => void;
|
|
867
|
+
readonly intounderlyingbytesource_type: (a: number) => number;
|
|
868
|
+
readonly intounderlyingsink_abort: (a: number, b: number) => number;
|
|
869
|
+
readonly intounderlyingsink_close: (a: number) => number;
|
|
870
|
+
readonly intounderlyingsink_write: (a: number, b: number) => number;
|
|
871
|
+
readonly intounderlyingsource_cancel: (a: number) => void;
|
|
872
|
+
readonly intounderlyingsource_pull: (a: number, b: number) => number;
|
|
873
|
+
readonly rust_zstd_wasm_shim_calloc: (a: number, b: number) => number;
|
|
874
|
+
readonly rust_zstd_wasm_shim_free: (a: number) => void;
|
|
875
|
+
readonly rust_zstd_wasm_shim_malloc: (a: number) => number;
|
|
876
|
+
readonly rust_zstd_wasm_shim_memcmp: (a: number, b: number, c: number) => number;
|
|
877
|
+
readonly rust_zstd_wasm_shim_memcpy: (a: number, b: number, c: number) => number;
|
|
878
|
+
readonly rust_zstd_wasm_shim_memmove: (a: number, b: number, c: number) => number;
|
|
879
|
+
readonly rust_zstd_wasm_shim_memset: (a: number, b: number, c: number) => number;
|
|
880
|
+
readonly rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void;
|
|
881
|
+
readonly __wbg_get_multiissuerauthorizeresult_decision: (a: number) => number;
|
|
882
|
+
readonly __wbg_set_multiissuerauthorizeresult_response: (a: number, b: number) => void;
|
|
883
|
+
readonly __wbg_set_multiissuerauthorizeresult_request_id: (a: number, b: number, c: number) => void;
|
|
884
|
+
readonly __wbg_set_multiissuerauthorizeresult_decision: (a: number, b: number) => void;
|
|
885
|
+
readonly __wbg_get_multiissuerauthorizeresult_response: (a: number) => number;
|
|
886
|
+
readonly __wbg_get_multiissuerauthorizeresult_request_id: (a: number, b: number) => void;
|
|
887
|
+
readonly __wbg_multiissuerauthorizeresult_free: (a: number, b: number) => void;
|
|
888
|
+
readonly __wbg_batchitemunsignedresult_free: (a: number, b: number) => void;
|
|
889
|
+
readonly __wbg_batchauthorizeunsignedresponse_free: (a: number, b: number) => void;
|
|
890
|
+
readonly batchitemunsignedresult_is_ok: (a: number) => number;
|
|
891
|
+
readonly batchitemunsignedresult_error: (a: number) => number;
|
|
892
|
+
readonly batchauthorizeunsignedresponse_batch_id: (a: number, b: number) => void;
|
|
893
|
+
readonly cedarling_get_logs_by_tag: (a: number, b: number, c: number, d: number) => void;
|
|
894
|
+
readonly __wasm_bindgen_func_elem_8780: (a: number, b: number, c: number, d: number) => void;
|
|
895
|
+
readonly __wasm_bindgen_func_elem_8835: (a: number, b: number, c: number, d: number) => void;
|
|
896
|
+
readonly __wasm_bindgen_func_elem_12259: (a: number, b: number, c: number) => void;
|
|
897
|
+
readonly __wasm_bindgen_func_elem_8615: (a: number, b: number) => void;
|
|
898
|
+
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
899
|
+
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
900
|
+
readonly __wbindgen_export3: (a: number) => void;
|
|
901
|
+
readonly __wbindgen_export4: (a: number, b: number) => void;
|
|
902
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
903
|
+
readonly __wbindgen_export5: (a: number, b: number, c: number) => void;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
910
|
+
* a precompiled `WebAssembly.Module`.
|
|
911
|
+
*
|
|
912
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
913
|
+
*
|
|
914
|
+
* @returns {InitOutput}
|
|
915
|
+
*/
|
|
916
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
920
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
921
|
+
*
|
|
922
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
923
|
+
*
|
|
924
|
+
* @returns {Promise<InitOutput>}
|
|
925
|
+
*/
|
|
926
|
+
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,14 +152,13 @@ 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
|
* WASM wrapper for
|
|
160
158
|
* `cedarling::BatchAuthorizeResponse<Result<MultiIssuerAuthorizeResult, BatchItemError>>`.
|
|
161
159
|
* Same shape as [`BatchAuthorizeUnsignedResponse`] with multi-issuer results.
|
|
162
160
|
*/
|
|
163
|
-
class BatchAuthorizeMultiIssuerResponse {
|
|
161
|
+
export class BatchAuthorizeMultiIssuerResponse {
|
|
164
162
|
static __wrap(ptr) {
|
|
165
163
|
const obj = Object.create(BatchAuthorizeMultiIssuerResponse.prototype);
|
|
166
164
|
obj.__wbg_ptr = ptr;
|
|
@@ -217,7 +215,6 @@ class BatchAuthorizeMultiIssuerResponse {
|
|
|
217
215
|
}
|
|
218
216
|
}
|
|
219
217
|
if (Symbol.dispose) BatchAuthorizeMultiIssuerResponse.prototype[Symbol.dispose] = BatchAuthorizeMultiIssuerResponse.prototype.free;
|
|
220
|
-
exports.BatchAuthorizeMultiIssuerResponse = BatchAuthorizeMultiIssuerResponse;
|
|
221
218
|
|
|
222
219
|
/**
|
|
223
220
|
* WASM wrapper for `cedarling::BatchAuthorizeResponse<Result<AuthorizeResult, BatchItemError>>`.
|
|
@@ -226,7 +223,7 @@ exports.BatchAuthorizeMultiIssuerResponse = BatchAuthorizeMultiIssuerResponse;
|
|
|
226
223
|
* is a [`BatchItemUnsignedResult`] — Cedar decision on `is_ok()`, per-item
|
|
227
224
|
* build failure on `error`. `results[i]` corresponds to `items[i]`.
|
|
228
225
|
*/
|
|
229
|
-
class BatchAuthorizeUnsignedResponse {
|
|
226
|
+
export class BatchAuthorizeUnsignedResponse {
|
|
230
227
|
static __wrap(ptr) {
|
|
231
228
|
const obj = Object.create(BatchAuthorizeUnsignedResponse.prototype);
|
|
232
229
|
obj.__wbg_ptr = ptr;
|
|
@@ -283,13 +280,12 @@ class BatchAuthorizeUnsignedResponse {
|
|
|
283
280
|
}
|
|
284
281
|
}
|
|
285
282
|
if (Symbol.dispose) BatchAuthorizeUnsignedResponse.prototype[Symbol.dispose] = BatchAuthorizeUnsignedResponse.prototype.free;
|
|
286
|
-
exports.BatchAuthorizeUnsignedResponse = BatchAuthorizeUnsignedResponse;
|
|
287
283
|
|
|
288
284
|
/**
|
|
289
285
|
* Per-item build failure surfaced inside a batch response at `results[i]`
|
|
290
286
|
* when Cedar couldn't be reached for that item.
|
|
291
287
|
*/
|
|
292
|
-
class BatchItemError {
|
|
288
|
+
export class BatchItemError {
|
|
293
289
|
static __wrap(ptr) {
|
|
294
290
|
const obj = Object.create(BatchItemError.prototype);
|
|
295
291
|
obj.__wbg_ptr = ptr;
|
|
@@ -358,12 +354,11 @@ class BatchItemError {
|
|
|
358
354
|
}
|
|
359
355
|
}
|
|
360
356
|
if (Symbol.dispose) BatchItemError.prototype[Symbol.dispose] = BatchItemError.prototype.free;
|
|
361
|
-
exports.BatchItemError = BatchItemError;
|
|
362
357
|
|
|
363
358
|
/**
|
|
364
359
|
* Multi-issuer analog of [`BatchItemUnsignedResult`].
|
|
365
360
|
*/
|
|
366
|
-
class BatchItemMultiIssuerResult {
|
|
361
|
+
export class BatchItemMultiIssuerResult {
|
|
367
362
|
static __wrap(ptr) {
|
|
368
363
|
const obj = Object.create(BatchItemMultiIssuerResult.prototype);
|
|
369
364
|
obj.__wbg_ptr = ptr;
|
|
@@ -417,13 +412,12 @@ class BatchItemMultiIssuerResult {
|
|
|
417
412
|
}
|
|
418
413
|
}
|
|
419
414
|
if (Symbol.dispose) BatchItemMultiIssuerResult.prototype[Symbol.dispose] = BatchItemMultiIssuerResult.prototype.free;
|
|
420
|
-
exports.BatchItemMultiIssuerResult = BatchItemMultiIssuerResult;
|
|
421
415
|
|
|
422
416
|
/**
|
|
423
417
|
* One slot in a batch response's `results` array. Callers switch on
|
|
424
418
|
* `is_ok()` — on `true`, read `unwrap()`; on `false`, read `error()`.
|
|
425
419
|
*/
|
|
426
|
-
class BatchItemUnsignedResult {
|
|
420
|
+
export class BatchItemUnsignedResult {
|
|
427
421
|
static __wrap(ptr) {
|
|
428
422
|
const obj = Object.create(BatchItemUnsignedResult.prototype);
|
|
429
423
|
obj.__wbg_ptr = ptr;
|
|
@@ -478,12 +472,11 @@ class BatchItemUnsignedResult {
|
|
|
478
472
|
}
|
|
479
473
|
}
|
|
480
474
|
if (Symbol.dispose) BatchItemUnsignedResult.prototype[Symbol.dispose] = BatchItemUnsignedResult.prototype.free;
|
|
481
|
-
exports.BatchItemUnsignedResult = BatchItemUnsignedResult;
|
|
482
475
|
|
|
483
476
|
/**
|
|
484
477
|
* The instance of the Cedarling application.
|
|
485
478
|
*/
|
|
486
|
-
class Cedarling {
|
|
479
|
+
export class Cedarling {
|
|
487
480
|
static __wrap(ptr) {
|
|
488
481
|
const obj = Object.create(Cedarling.prototype);
|
|
489
482
|
obj.__wbg_ptr = ptr;
|
|
@@ -1211,13 +1204,12 @@ class Cedarling {
|
|
|
1211
1204
|
}
|
|
1212
1205
|
}
|
|
1213
1206
|
if (Symbol.dispose) Cedarling.prototype[Symbol.dispose] = Cedarling.prototype.free;
|
|
1214
|
-
exports.Cedarling = Cedarling;
|
|
1215
1207
|
|
|
1216
1208
|
/**
|
|
1217
1209
|
* A WASM wrapper for the Rust `cedarling::DataEntry` struct.
|
|
1218
1210
|
* Represents a data entry in the DataStore with value and metadata.
|
|
1219
1211
|
*/
|
|
1220
|
-
class DataEntry {
|
|
1212
|
+
export class DataEntry {
|
|
1221
1213
|
static __wrap(ptr) {
|
|
1222
1214
|
const obj = Object.create(DataEntry.prototype);
|
|
1223
1215
|
obj.__wbg_ptr = ptr;
|
|
@@ -1406,13 +1398,12 @@ class DataEntry {
|
|
|
1406
1398
|
}
|
|
1407
1399
|
}
|
|
1408
1400
|
if (Symbol.dispose) DataEntry.prototype[Symbol.dispose] = DataEntry.prototype.free;
|
|
1409
|
-
exports.DataEntry = DataEntry;
|
|
1410
1401
|
|
|
1411
1402
|
/**
|
|
1412
1403
|
* A WASM wrapper for the Rust `cedarling::DataStoreStats` struct.
|
|
1413
1404
|
* Statistics about the DataStore.
|
|
1414
1405
|
*/
|
|
1415
|
-
class DataStoreStats {
|
|
1406
|
+
export class DataStoreStats {
|
|
1416
1407
|
static __wrap(ptr) {
|
|
1417
1408
|
const obj = Object.create(DataStoreStats.prototype);
|
|
1418
1409
|
obj.__wbg_ptr = ptr;
|
|
@@ -1586,7 +1577,6 @@ class DataStoreStats {
|
|
|
1586
1577
|
}
|
|
1587
1578
|
}
|
|
1588
1579
|
if (Symbol.dispose) DataStoreStats.prototype[Symbol.dispose] = DataStoreStats.prototype.free;
|
|
1589
|
-
exports.DataStoreStats = DataStoreStats;
|
|
1590
1580
|
|
|
1591
1581
|
/**
|
|
1592
1582
|
* Diagnostics
|
|
@@ -1594,7 +1584,7 @@ exports.DataStoreStats = DataStoreStats;
|
|
|
1594
1584
|
*
|
|
1595
1585
|
* Provides detailed information about how a policy decision was made, including policies that contributed to the decision and any errors encountered during evaluation.
|
|
1596
1586
|
*/
|
|
1597
|
-
class Diagnostics {
|
|
1587
|
+
export class Diagnostics {
|
|
1598
1588
|
static __wrap(ptr) {
|
|
1599
1589
|
const obj = Object.create(Diagnostics.prototype);
|
|
1600
1590
|
obj.__wbg_ptr = ptr;
|
|
@@ -1651,9 +1641,8 @@ class Diagnostics {
|
|
|
1651
1641
|
}
|
|
1652
1642
|
}
|
|
1653
1643
|
if (Symbol.dispose) Diagnostics.prototype[Symbol.dispose] = Diagnostics.prototype.free;
|
|
1654
|
-
exports.Diagnostics = Diagnostics;
|
|
1655
1644
|
|
|
1656
|
-
class IntoUnderlyingByteSource {
|
|
1645
|
+
export class IntoUnderlyingByteSource {
|
|
1657
1646
|
__destroy_into_raw() {
|
|
1658
1647
|
const ptr = this.__wbg_ptr;
|
|
1659
1648
|
this.__wbg_ptr = 0;
|
|
@@ -1698,9 +1687,8 @@ class IntoUnderlyingByteSource {
|
|
|
1698
1687
|
}
|
|
1699
1688
|
}
|
|
1700
1689
|
if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
|
|
1701
|
-
exports.IntoUnderlyingByteSource = IntoUnderlyingByteSource;
|
|
1702
1690
|
|
|
1703
|
-
class IntoUnderlyingSink {
|
|
1691
|
+
export class IntoUnderlyingSink {
|
|
1704
1692
|
__destroy_into_raw() {
|
|
1705
1693
|
const ptr = this.__wbg_ptr;
|
|
1706
1694
|
this.__wbg_ptr = 0;
|
|
@@ -1738,9 +1726,8 @@ class IntoUnderlyingSink {
|
|
|
1738
1726
|
}
|
|
1739
1727
|
}
|
|
1740
1728
|
if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
|
|
1741
|
-
exports.IntoUnderlyingSink = IntoUnderlyingSink;
|
|
1742
1729
|
|
|
1743
|
-
class IntoUnderlyingSource {
|
|
1730
|
+
export class IntoUnderlyingSource {
|
|
1744
1731
|
__destroy_into_raw() {
|
|
1745
1732
|
const ptr = this.__wbg_ptr;
|
|
1746
1733
|
this.__wbg_ptr = 0;
|
|
@@ -1765,13 +1752,12 @@ class IntoUnderlyingSource {
|
|
|
1765
1752
|
}
|
|
1766
1753
|
}
|
|
1767
1754
|
if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
|
|
1768
|
-
exports.IntoUnderlyingSource = IntoUnderlyingSource;
|
|
1769
1755
|
|
|
1770
1756
|
/**
|
|
1771
1757
|
* A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
|
|
1772
1758
|
* Represents the result of a multi-issuer authorization request.
|
|
1773
1759
|
*/
|
|
1774
|
-
class MultiIssuerAuthorizeResult {
|
|
1760
|
+
export class MultiIssuerAuthorizeResult {
|
|
1775
1761
|
static __wrap(ptr) {
|
|
1776
1762
|
const obj = Object.create(MultiIssuerAuthorizeResult.prototype);
|
|
1777
1763
|
obj.__wbg_ptr = ptr;
|
|
@@ -1875,7 +1861,6 @@ class MultiIssuerAuthorizeResult {
|
|
|
1875
1861
|
}
|
|
1876
1862
|
}
|
|
1877
1863
|
if (Symbol.dispose) MultiIssuerAuthorizeResult.prototype[Symbol.dispose] = MultiIssuerAuthorizeResult.prototype.free;
|
|
1878
|
-
exports.MultiIssuerAuthorizeResult = MultiIssuerAuthorizeResult;
|
|
1879
1864
|
|
|
1880
1865
|
/**
|
|
1881
1866
|
* PolicyEvaluationError
|
|
@@ -1883,7 +1868,7 @@ exports.MultiIssuerAuthorizeResult = MultiIssuerAuthorizeResult;
|
|
|
1883
1868
|
*
|
|
1884
1869
|
* Represents an error that occurred when evaluating a Cedar policy.
|
|
1885
1870
|
*/
|
|
1886
|
-
class PolicyEvaluationError {
|
|
1871
|
+
export class PolicyEvaluationError {
|
|
1887
1872
|
static __wrap(ptr) {
|
|
1888
1873
|
const obj = Object.create(PolicyEvaluationError.prototype);
|
|
1889
1874
|
obj.__wbg_ptr = ptr;
|
|
@@ -1942,7 +1927,6 @@ class PolicyEvaluationError {
|
|
|
1942
1927
|
}
|
|
1943
1928
|
}
|
|
1944
1929
|
if (Symbol.dispose) PolicyEvaluationError.prototype[Symbol.dispose] = PolicyEvaluationError.prototype.free;
|
|
1945
|
-
exports.PolicyEvaluationError = PolicyEvaluationError;
|
|
1946
1930
|
|
|
1947
1931
|
/**
|
|
1948
1932
|
* Create a new instance of the Cedarling application.
|
|
@@ -1950,11 +1934,10 @@ exports.PolicyEvaluationError = PolicyEvaluationError;
|
|
|
1950
1934
|
* @param {any} config
|
|
1951
1935
|
* @returns {Promise<Cedarling>}
|
|
1952
1936
|
*/
|
|
1953
|
-
function init(config) {
|
|
1937
|
+
export function init(config) {
|
|
1954
1938
|
const ret = wasm.init(addHeapObject(config));
|
|
1955
1939
|
return takeObject(ret);
|
|
1956
1940
|
}
|
|
1957
|
-
exports.init = init;
|
|
1958
1941
|
|
|
1959
1942
|
/**
|
|
1960
1943
|
* Create a new instance of the Cedarling application from archive bytes.
|
|
@@ -1976,11 +1959,10 @@ exports.init = init;
|
|
|
1976
1959
|
* @param {Uint8Array} archive_bytes
|
|
1977
1960
|
* @returns {Promise<Cedarling>}
|
|
1978
1961
|
*/
|
|
1979
|
-
function init_from_archive_bytes(config, archive_bytes) {
|
|
1962
|
+
export function init_from_archive_bytes(config, archive_bytes) {
|
|
1980
1963
|
const ret = wasm.init_from_archive_bytes(addHeapObject(config), addHeapObject(archive_bytes));
|
|
1981
1964
|
return takeObject(ret);
|
|
1982
1965
|
}
|
|
1983
|
-
exports.init_from_archive_bytes = init_from_archive_bytes;
|
|
1984
1966
|
function __wbg_get_imports() {
|
|
1985
1967
|
const import0 = {
|
|
1986
1968
|
__proto__: null,
|
|
@@ -2396,7 +2378,7 @@ function __wbg_get_imports() {
|
|
|
2396
2378
|
const a = state0.a;
|
|
2397
2379
|
state0.a = 0;
|
|
2398
2380
|
try {
|
|
2399
|
-
return
|
|
2381
|
+
return __wasm_bindgen_func_elem_8835(a, state0.b, arg0, arg1);
|
|
2400
2382
|
} finally {
|
|
2401
2383
|
state0.a = a;
|
|
2402
2384
|
}
|
|
@@ -2611,12 +2593,12 @@ function __wbg_get_imports() {
|
|
|
2611
2593
|
},
|
|
2612
2594
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
2613
2595
|
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 992, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
2614
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
2596
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_8780);
|
|
2615
2597
|
return addHeapObject(ret);
|
|
2616
2598
|
},
|
|
2617
2599
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
2618
2600
|
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 876, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2619
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
2601
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_8615);
|
|
2620
2602
|
return addHeapObject(ret);
|
|
2621
2603
|
},
|
|
2622
2604
|
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
@@ -2658,18 +2640,18 @@ function __wbg_get_imports() {
|
|
|
2658
2640
|
};
|
|
2659
2641
|
}
|
|
2660
2642
|
|
|
2661
|
-
function
|
|
2662
|
-
wasm.
|
|
2643
|
+
function __wasm_bindgen_func_elem_8615(arg0, arg1) {
|
|
2644
|
+
wasm.__wasm_bindgen_func_elem_8615(arg0, arg1);
|
|
2663
2645
|
}
|
|
2664
2646
|
|
|
2665
2647
|
function __wasm_bindgen_func_elem_12259(arg0, arg1, arg2) {
|
|
2666
2648
|
wasm.__wasm_bindgen_func_elem_12259(arg0, arg1, addHeapObject(arg2));
|
|
2667
2649
|
}
|
|
2668
2650
|
|
|
2669
|
-
function
|
|
2651
|
+
function __wasm_bindgen_func_elem_8780(arg0, arg1, arg2) {
|
|
2670
2652
|
try {
|
|
2671
2653
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2672
|
-
wasm.
|
|
2654
|
+
wasm.__wasm_bindgen_func_elem_8780(retptr, arg0, arg1, addHeapObject(arg2));
|
|
2673
2655
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2674
2656
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2675
2657
|
if (r1) {
|
|
@@ -2680,8 +2662,8 @@ function __wasm_bindgen_func_elem_8781(arg0, arg1, arg2) {
|
|
|
2680
2662
|
}
|
|
2681
2663
|
}
|
|
2682
2664
|
|
|
2683
|
-
function
|
|
2684
|
-
wasm.
|
|
2665
|
+
function __wasm_bindgen_func_elem_8835(arg0, arg1, arg2, arg3) {
|
|
2666
|
+
wasm.__wasm_bindgen_func_elem_8835(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
2685
2667
|
}
|
|
2686
2668
|
|
|
2687
2669
|
|
|
@@ -2977,7 +2959,15 @@ function takeObject(idx) {
|
|
|
2977
2959
|
|
|
2978
2960
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
2979
2961
|
cachedTextDecoder.decode();
|
|
2962
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
2963
|
+
let numBytesDecoded = 0;
|
|
2980
2964
|
function decodeText(ptr, len) {
|
|
2965
|
+
numBytesDecoded += len;
|
|
2966
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
2967
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
2968
|
+
cachedTextDecoder.decode();
|
|
2969
|
+
numBytesDecoded = len;
|
|
2970
|
+
}
|
|
2981
2971
|
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
2982
2972
|
}
|
|
2983
2973
|
|
|
@@ -2996,8 +2986,95 @@ if (!('encodeInto' in cachedTextEncoder)) {
|
|
|
2996
2986
|
|
|
2997
2987
|
let WASM_VECTOR_LEN = 0;
|
|
2998
2988
|
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
2989
|
+
let wasmModule, wasmInstance, wasm;
|
|
2990
|
+
function __wbg_finalize_init(instance, module) {
|
|
2991
|
+
wasmInstance = instance;
|
|
2992
|
+
wasm = instance.exports;
|
|
2993
|
+
wasmModule = module;
|
|
2994
|
+
cachedDataViewMemory0 = null;
|
|
2995
|
+
cachedUint8ArrayMemory0 = null;
|
|
2996
|
+
return wasm;
|
|
2997
|
+
}
|
|
2998
|
+
|
|
2999
|
+
async function __wbg_load(module, imports) {
|
|
3000
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
3001
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
3002
|
+
try {
|
|
3003
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
3004
|
+
} catch (e) {
|
|
3005
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
3006
|
+
|
|
3007
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
3008
|
+
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);
|
|
3009
|
+
|
|
3010
|
+
} else { throw e; }
|
|
3011
|
+
}
|
|
3012
|
+
}
|
|
3013
|
+
|
|
3014
|
+
const bytes = await module.arrayBuffer();
|
|
3015
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
3016
|
+
} else {
|
|
3017
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
3018
|
+
|
|
3019
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
3020
|
+
return { instance, module };
|
|
3021
|
+
} else {
|
|
3022
|
+
return instance;
|
|
3023
|
+
}
|
|
3024
|
+
}
|
|
3025
|
+
|
|
3026
|
+
function expectedResponseType(type) {
|
|
3027
|
+
switch (type) {
|
|
3028
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
3029
|
+
}
|
|
3030
|
+
return false;
|
|
3031
|
+
}
|
|
3032
|
+
}
|
|
3033
|
+
|
|
3034
|
+
function initSync(module) {
|
|
3035
|
+
if (wasm !== undefined) return wasm;
|
|
3036
|
+
|
|
3037
|
+
|
|
3038
|
+
if (module !== undefined) {
|
|
3039
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
3040
|
+
({module} = module)
|
|
3041
|
+
} else {
|
|
3042
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
3045
|
+
|
|
3046
|
+
const imports = __wbg_get_imports();
|
|
3047
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
3048
|
+
module = new WebAssembly.Module(module);
|
|
3049
|
+
}
|
|
3050
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
3051
|
+
return __wbg_finalize_init(instance, module);
|
|
3052
|
+
}
|
|
3053
|
+
|
|
3054
|
+
async function __wbg_init(module_or_path) {
|
|
3055
|
+
if (wasm !== undefined) return wasm;
|
|
3056
|
+
|
|
3057
|
+
|
|
3058
|
+
if (module_or_path !== undefined) {
|
|
3059
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
3060
|
+
({module_or_path} = module_or_path)
|
|
3061
|
+
} else {
|
|
3062
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
3063
|
+
}
|
|
3064
|
+
}
|
|
3065
|
+
|
|
3066
|
+
if (module_or_path === undefined) {
|
|
3067
|
+
module_or_path = new URL('cedarling_wasm_bg.wasm', import.meta.url);
|
|
3068
|
+
}
|
|
3069
|
+
const imports = __wbg_get_imports();
|
|
3070
|
+
|
|
3071
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
3072
|
+
module_or_path = fetch(module_or_path);
|
|
3073
|
+
}
|
|
3074
|
+
|
|
3075
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
3076
|
+
|
|
3077
|
+
return __wbg_finalize_init(instance, module);
|
|
3078
|
+
}
|
|
3079
|
+
|
|
3080
|
+
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": "2.3.0
|
|
5
|
+
"version": "2.3.0",
|
|
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
|
}
|