@janssenproject/cedarling_wasm 0.0.369 → 0.0.370-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/README.md +7 -8
- package/cedarling_wasm.d.ts +11 -151
- package/cedarling_wasm.js +62 -132
- package/cedarling_wasm_bg.wasm +0 -0
- package/package.json +2 -6
package/README.md
CHANGED
|
@@ -104,8 +104,11 @@ export class Cedarling {
|
|
|
104
104
|
*/
|
|
105
105
|
static new_from_map(config: Map<any, any>): Promise<Cedarling>;
|
|
106
106
|
/**
|
|
107
|
-
* Authorize request
|
|
108
|
-
*
|
|
107
|
+
* Authorize an unsigned request carrying an optional single principal.
|
|
108
|
+
* Makes an authorization decision based on the [`RequestUnsigned`].
|
|
109
|
+
* When `principal` is omitted / `null` the core uses Cedar partial evaluation;
|
|
110
|
+
* residual-dependent requests fail closed with `Decision::Deny` and surface
|
|
111
|
+
* residual policy ids in `response.diagnostics.reason`.
|
|
109
112
|
*/
|
|
110
113
|
authorize_unsigned(request: any): Promise<AuthorizeResult>;
|
|
111
114
|
/**
|
|
@@ -261,13 +264,9 @@ export class AuthorizeResult {
|
|
|
261
264
|
*/
|
|
262
265
|
json_string(): string;
|
|
263
266
|
/**
|
|
264
|
-
*
|
|
267
|
+
* Cedar authorization response for the request.
|
|
265
268
|
*/
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Get result for a specific principal
|
|
269
|
-
*/
|
|
270
|
-
principal(principal: string): AuthorizeResultResponse | undefined;
|
|
269
|
+
response: AuthorizeResultResponse;
|
|
271
270
|
/**
|
|
272
271
|
* Result of authorization
|
|
273
272
|
* true means `ALLOW`
|
package/cedarling_wasm.d.ts
CHANGED
|
@@ -20,7 +20,6 @@ export class AuthorizeResult {
|
|
|
20
20
|
* Convert `AuthorizeResult` to json string value
|
|
21
21
|
*/
|
|
22
22
|
json_string(): string;
|
|
23
|
-
principal(principal: string): AuthorizeResultResponse | undefined;
|
|
24
23
|
/**
|
|
25
24
|
* Result of authorization
|
|
26
25
|
* true means `ALLOW`
|
|
@@ -33,6 +32,10 @@ export class AuthorizeResult {
|
|
|
33
32
|
* Request ID of the authorization request
|
|
34
33
|
*/
|
|
35
34
|
request_id: string;
|
|
35
|
+
/**
|
|
36
|
+
* Cedar authorization response for the request.
|
|
37
|
+
*/
|
|
38
|
+
response: AuthorizeResultResponse;
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
/**
|
|
@@ -66,8 +69,13 @@ export class Cedarling {
|
|
|
66
69
|
*/
|
|
67
70
|
authorize_multi_issuer(request: any): Promise<MultiIssuerAuthorizeResult>;
|
|
68
71
|
/**
|
|
69
|
-
* Authorize request
|
|
70
|
-
*
|
|
72
|
+
* Authorize an unsigned request carrying an optional single principal.
|
|
73
|
+
* Makes an authorization decision based on the [`RequestUnsigned`].
|
|
74
|
+
*
|
|
75
|
+
* When `principal` is omitted / `null` on the JS side the core uses Cedar
|
|
76
|
+
* partial evaluation; residual-dependent requests fail closed with
|
|
77
|
+
* `Decision::Deny` and surface residual policy ids in
|
|
78
|
+
* `response.diagnostics.reason`.
|
|
71
79
|
*/
|
|
72
80
|
authorize_unsigned(request: any): Promise<AuthorizeResult>;
|
|
73
81
|
/**
|
|
@@ -516,151 +524,3 @@ export function init(config: any): Promise<Cedarling>;
|
|
|
516
524
|
* ```
|
|
517
525
|
*/
|
|
518
526
|
export function init_from_archive_bytes(config: any, archive_bytes: Uint8Array): Promise<Cedarling>;
|
|
519
|
-
|
|
520
|
-
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
521
|
-
|
|
522
|
-
export interface InitOutput {
|
|
523
|
-
readonly memory: WebAssembly.Memory;
|
|
524
|
-
readonly __wbg_cedarling_free: (a: number, b: number) => void;
|
|
525
|
-
readonly __wbg_multiissuerauthorizeresult_free: (a: number, b: number) => void;
|
|
526
|
-
readonly __wbg_get_multiissuerauthorizeresult_response: (a: number) => number;
|
|
527
|
-
readonly __wbg_set_multiissuerauthorizeresult_response: (a: number, b: number) => void;
|
|
528
|
-
readonly __wbg_get_multiissuerauthorizeresult_decision: (a: number) => number;
|
|
529
|
-
readonly __wbg_set_multiissuerauthorizeresult_decision: (a: number, b: number) => void;
|
|
530
|
-
readonly __wbg_get_multiissuerauthorizeresult_request_id: (a: number) => [number, number];
|
|
531
|
-
readonly __wbg_set_multiissuerauthorizeresult_request_id: (a: number, b: number, c: number) => void;
|
|
532
|
-
readonly multiissuerauthorizeresult_json_string: (a: number) => [number, number];
|
|
533
|
-
readonly init: (a: any) => any;
|
|
534
|
-
readonly init_from_archive_bytes: (a: any, b: any) => any;
|
|
535
|
-
readonly cedarling_new: (a: any) => any;
|
|
536
|
-
readonly cedarling_new_from_map: (a: any) => any;
|
|
537
|
-
readonly cedarling_authorize_unsigned: (a: number, b: any) => any;
|
|
538
|
-
readonly cedarling_authorize_multi_issuer: (a: number, b: any) => any;
|
|
539
|
-
readonly cedarling_pop_logs: (a: number) => [number, number, number];
|
|
540
|
-
readonly cedarling_get_log_by_id: (a: number, b: number, c: number) => [number, number, number];
|
|
541
|
-
readonly cedarling_get_log_ids: (a: number) => any;
|
|
542
|
-
readonly cedarling_get_logs_by_tag: (a: number, b: number, c: number) => [number, number, number, number];
|
|
543
|
-
readonly cedarling_get_logs_by_request_id: (a: number, b: number, c: number) => [number, number, number, number];
|
|
544
|
-
readonly cedarling_get_logs_by_request_id_and_tag: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
545
|
-
readonly cedarling_shut_down: (a: number) => any;
|
|
546
|
-
readonly cedarling_push_data_ctx: (a: number, b: number, c: number, d: any, e: number, f: bigint) => [number, number];
|
|
547
|
-
readonly cedarling_get_data_ctx: (a: number, b: number, c: number) => [number, number, number];
|
|
548
|
-
readonly cedarling_get_data_entry_ctx: (a: number, b: number, c: number) => [number, number, number];
|
|
549
|
-
readonly cedarling_remove_data_ctx: (a: number, b: number, c: number) => [number, number, number];
|
|
550
|
-
readonly cedarling_clear_data_ctx: (a: number) => [number, number];
|
|
551
|
-
readonly cedarling_list_data_ctx: (a: number) => [number, number, number];
|
|
552
|
-
readonly cedarling_get_stats_ctx: (a: number) => [number, number, number];
|
|
553
|
-
readonly cedarling_is_trusted_issuer_loaded_by_name: (a: number, b: number, c: number) => number;
|
|
554
|
-
readonly cedarling_is_trusted_issuer_loaded_by_iss: (a: number, b: number, c: number) => number;
|
|
555
|
-
readonly cedarling_total_issuers: (a: number) => number;
|
|
556
|
-
readonly cedarling_loaded_trusted_issuers_count: (a: number) => number;
|
|
557
|
-
readonly cedarling_loaded_trusted_issuer_ids: (a: number) => any;
|
|
558
|
-
readonly cedarling_failed_trusted_issuer_ids: (a: number) => any;
|
|
559
|
-
readonly __wbg_authorizeresult_free: (a: number, b: number) => void;
|
|
560
|
-
readonly __wbg_get_authorizeresult_decision: (a: number) => number;
|
|
561
|
-
readonly __wbg_set_authorizeresult_decision: (a: number, b: number) => void;
|
|
562
|
-
readonly __wbg_get_authorizeresult_request_id: (a: number) => [number, number];
|
|
563
|
-
readonly __wbg_set_authorizeresult_request_id: (a: number, b: number, c: number) => void;
|
|
564
|
-
readonly authorizeresult_json_string: (a: number) => [number, number];
|
|
565
|
-
readonly authorizeresult_principal: (a: number, b: number, c: number) => number;
|
|
566
|
-
readonly __wbg_authorizeresultresponse_free: (a: number, b: number) => void;
|
|
567
|
-
readonly authorizeresultresponse_decision: (a: number) => number;
|
|
568
|
-
readonly authorizeresultresponse_diagnostics: (a: number) => number;
|
|
569
|
-
readonly __wbg_diagnostics_free: (a: number, b: number) => void;
|
|
570
|
-
readonly diagnostics_reason: (a: number) => [number, number];
|
|
571
|
-
readonly diagnostics_errors: (a: number) => [number, number];
|
|
572
|
-
readonly __wbg_policyevaluationerror_free: (a: number, b: number) => void;
|
|
573
|
-
readonly policyevaluationerror_id: (a: number) => [number, number];
|
|
574
|
-
readonly policyevaluationerror_error: (a: number) => [number, number];
|
|
575
|
-
readonly __wbg_dataentry_free: (a: number, b: number) => void;
|
|
576
|
-
readonly __wbg_get_dataentry_key: (a: number) => [number, number];
|
|
577
|
-
readonly __wbg_set_dataentry_key: (a: number, b: number, c: number) => void;
|
|
578
|
-
readonly __wbg_get_dataentry_data_type: (a: number) => [number, number];
|
|
579
|
-
readonly __wbg_set_dataentry_data_type: (a: number, b: number, c: number) => void;
|
|
580
|
-
readonly __wbg_get_dataentry_created_at: (a: number) => [number, number];
|
|
581
|
-
readonly __wbg_set_dataentry_created_at: (a: number, b: number, c: number) => void;
|
|
582
|
-
readonly __wbg_get_dataentry_expires_at: (a: number) => [number, number];
|
|
583
|
-
readonly __wbg_set_dataentry_expires_at: (a: number, b: number, c: number) => void;
|
|
584
|
-
readonly __wbg_get_dataentry_access_count: (a: number) => bigint;
|
|
585
|
-
readonly __wbg_set_dataentry_access_count: (a: number, b: bigint) => void;
|
|
586
|
-
readonly dataentry_value: (a: number) => [number, number, number];
|
|
587
|
-
readonly dataentry_json_string: (a: number) => [number, number];
|
|
588
|
-
readonly __wbg_datastorestats_free: (a: number, b: number) => void;
|
|
589
|
-
readonly __wbg_get_datastorestats_entry_count: (a: number) => number;
|
|
590
|
-
readonly __wbg_set_datastorestats_entry_count: (a: number, b: number) => void;
|
|
591
|
-
readonly __wbg_get_datastorestats_max_entries: (a: number) => number;
|
|
592
|
-
readonly __wbg_set_datastorestats_max_entries: (a: number, b: number) => void;
|
|
593
|
-
readonly __wbg_get_datastorestats_max_entry_size: (a: number) => number;
|
|
594
|
-
readonly __wbg_set_datastorestats_max_entry_size: (a: number, b: number) => void;
|
|
595
|
-
readonly __wbg_get_datastorestats_metrics_enabled: (a: number) => number;
|
|
596
|
-
readonly __wbg_set_datastorestats_metrics_enabled: (a: number, b: number) => void;
|
|
597
|
-
readonly __wbg_get_datastorestats_total_size_bytes: (a: number) => number;
|
|
598
|
-
readonly __wbg_set_datastorestats_total_size_bytes: (a: number, b: number) => void;
|
|
599
|
-
readonly __wbg_get_datastorestats_avg_entry_size_bytes: (a: number) => number;
|
|
600
|
-
readonly __wbg_set_datastorestats_avg_entry_size_bytes: (a: number, b: number) => void;
|
|
601
|
-
readonly __wbg_get_datastorestats_capacity_usage_percent: (a: number) => number;
|
|
602
|
-
readonly __wbg_set_datastorestats_capacity_usage_percent: (a: number, b: number) => void;
|
|
603
|
-
readonly __wbg_get_datastorestats_memory_alert_threshold: (a: number) => number;
|
|
604
|
-
readonly __wbg_set_datastorestats_memory_alert_threshold: (a: number, b: number) => void;
|
|
605
|
-
readonly __wbg_get_datastorestats_memory_alert_triggered: (a: number) => number;
|
|
606
|
-
readonly __wbg_set_datastorestats_memory_alert_triggered: (a: number, b: number) => void;
|
|
607
|
-
readonly datastorestats_json_string: (a: number) => [number, number];
|
|
608
|
-
readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
|
|
609
|
-
readonly intounderlyingbytesource_type: (a: number) => number;
|
|
610
|
-
readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
|
|
611
|
-
readonly intounderlyingbytesource_start: (a: number, b: any) => void;
|
|
612
|
-
readonly intounderlyingbytesource_pull: (a: number, b: any) => any;
|
|
613
|
-
readonly intounderlyingbytesource_cancel: (a: number) => void;
|
|
614
|
-
readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
|
|
615
|
-
readonly intounderlyingsource_pull: (a: number, b: any) => any;
|
|
616
|
-
readonly intounderlyingsource_cancel: (a: number) => void;
|
|
617
|
-
readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
|
|
618
|
-
readonly intounderlyingsink_write: (a: number, b: any) => any;
|
|
619
|
-
readonly intounderlyingsink_close: (a: number) => any;
|
|
620
|
-
readonly intounderlyingsink_abort: (a: number, b: any) => any;
|
|
621
|
-
readonly rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void;
|
|
622
|
-
readonly rust_zstd_wasm_shim_malloc: (a: number) => number;
|
|
623
|
-
readonly rust_zstd_wasm_shim_memcmp: (a: number, b: number, c: number) => number;
|
|
624
|
-
readonly rust_zstd_wasm_shim_calloc: (a: number, b: number) => number;
|
|
625
|
-
readonly rust_zstd_wasm_shim_free: (a: number) => void;
|
|
626
|
-
readonly rust_zstd_wasm_shim_memcpy: (a: number, b: number, c: number) => number;
|
|
627
|
-
readonly rust_zstd_wasm_shim_memmove: (a: number, b: number, c: number) => number;
|
|
628
|
-
readonly rust_zstd_wasm_shim_memset: (a: number, b: number, c: number) => number;
|
|
629
|
-
readonly wasm_bindgen__convert__closures_____invoke__h10797b50422db1d9: (a: number, b: number, c: any) => [number, number];
|
|
630
|
-
readonly wasm_bindgen__convert__closures_____invoke__h034cae6b5dd12778: (a: number, b: number, c: any, d: any) => void;
|
|
631
|
-
readonly wasm_bindgen__convert__closures_____invoke__hc1f7fa9b168b3277: (a: number, b: number, c: any) => void;
|
|
632
|
-
readonly wasm_bindgen__convert__closures_____invoke__h0cd1ac4ce5b742bb: (a: number, b: number) => void;
|
|
633
|
-
readonly wasm_bindgen__convert__closures_____invoke__h1de102d8396d84e7: (a: number, b: number) => void;
|
|
634
|
-
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
635
|
-
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
636
|
-
readonly __wbindgen_exn_store: (a: number) => void;
|
|
637
|
-
readonly __externref_table_alloc: () => number;
|
|
638
|
-
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
639
|
-
readonly __wbindgen_destroy_closure: (a: number, b: number) => void;
|
|
640
|
-
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
641
|
-
readonly __externref_table_dealloc: (a: number) => void;
|
|
642
|
-
readonly __externref_drop_slice: (a: number, b: number) => void;
|
|
643
|
-
readonly __wbindgen_start: () => void;
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
647
|
-
|
|
648
|
-
/**
|
|
649
|
-
* Instantiates the given `module`, which can either be bytes or
|
|
650
|
-
* a precompiled `WebAssembly.Module`.
|
|
651
|
-
*
|
|
652
|
-
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
653
|
-
*
|
|
654
|
-
* @returns {InitOutput}
|
|
655
|
-
*/
|
|
656
|
-
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
657
|
-
|
|
658
|
-
/**
|
|
659
|
-
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
660
|
-
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
661
|
-
*
|
|
662
|
-
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
663
|
-
*
|
|
664
|
-
* @returns {Promise<InitOutput>}
|
|
665
|
-
*/
|
|
666
|
-
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);
|
|
@@ -38,16 +38,6 @@ export class AuthorizeResult {
|
|
|
38
38
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
/**
|
|
42
|
-
* @param {string} principal
|
|
43
|
-
* @returns {AuthorizeResultResponse | undefined}
|
|
44
|
-
*/
|
|
45
|
-
principal(principal) {
|
|
46
|
-
const ptr0 = passStringToWasm0(principal, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
47
|
-
const len0 = WASM_VECTOR_LEN;
|
|
48
|
-
const ret = wasm.authorizeresult_principal(this.__wbg_ptr, ptr0, len0);
|
|
49
|
-
return ret === 0 ? undefined : AuthorizeResultResponse.__wrap(ret);
|
|
50
|
-
}
|
|
51
41
|
/**
|
|
52
42
|
* Result of authorization
|
|
53
43
|
* true means `ALLOW`
|
|
@@ -76,6 +66,14 @@ export class AuthorizeResult {
|
|
|
76
66
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
77
67
|
}
|
|
78
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Cedar authorization response for the request.
|
|
71
|
+
* @returns {AuthorizeResultResponse}
|
|
72
|
+
*/
|
|
73
|
+
get response() {
|
|
74
|
+
const ret = wasm.__wbg_get_authorizeresult_response(this.__wbg_ptr);
|
|
75
|
+
return AuthorizeResultResponse.__wrap(ret);
|
|
76
|
+
}
|
|
79
77
|
/**
|
|
80
78
|
* Result of authorization
|
|
81
79
|
* true means `ALLOW`
|
|
@@ -96,14 +94,24 @@ export class AuthorizeResult {
|
|
|
96
94
|
const len0 = WASM_VECTOR_LEN;
|
|
97
95
|
wasm.__wbg_set_authorizeresult_request_id(this.__wbg_ptr, ptr0, len0);
|
|
98
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Cedar authorization response for the request.
|
|
99
|
+
* @param {AuthorizeResultResponse} arg0
|
|
100
|
+
*/
|
|
101
|
+
set response(arg0) {
|
|
102
|
+
_assertClass(arg0, AuthorizeResultResponse);
|
|
103
|
+
var ptr0 = arg0.__destroy_into_raw();
|
|
104
|
+
wasm.__wbg_set_authorizeresult_response(this.__wbg_ptr, ptr0);
|
|
105
|
+
}
|
|
99
106
|
}
|
|
100
107
|
if (Symbol.dispose) AuthorizeResult.prototype[Symbol.dispose] = AuthorizeResult.prototype.free;
|
|
108
|
+
exports.AuthorizeResult = AuthorizeResult;
|
|
101
109
|
|
|
102
110
|
/**
|
|
103
111
|
* A WASM wrapper for the Rust `cedar_policy::Response` struct.
|
|
104
112
|
* Represents the result of an authorization request.
|
|
105
113
|
*/
|
|
106
|
-
|
|
114
|
+
class AuthorizeResultResponse {
|
|
107
115
|
static __wrap(ptr) {
|
|
108
116
|
ptr = ptr >>> 0;
|
|
109
117
|
const obj = Object.create(AuthorizeResultResponse.prototype);
|
|
@@ -139,11 +147,12 @@ export class AuthorizeResultResponse {
|
|
|
139
147
|
}
|
|
140
148
|
}
|
|
141
149
|
if (Symbol.dispose) AuthorizeResultResponse.prototype[Symbol.dispose] = AuthorizeResultResponse.prototype.free;
|
|
150
|
+
exports.AuthorizeResultResponse = AuthorizeResultResponse;
|
|
142
151
|
|
|
143
152
|
/**
|
|
144
153
|
* The instance of the Cedarling application.
|
|
145
154
|
*/
|
|
146
|
-
|
|
155
|
+
class Cedarling {
|
|
147
156
|
static __wrap(ptr) {
|
|
148
157
|
ptr = ptr >>> 0;
|
|
149
158
|
const obj = Object.create(Cedarling.prototype);
|
|
@@ -172,8 +181,13 @@ export class Cedarling {
|
|
|
172
181
|
return ret;
|
|
173
182
|
}
|
|
174
183
|
/**
|
|
175
|
-
* Authorize request
|
|
176
|
-
*
|
|
184
|
+
* Authorize an unsigned request carrying an optional single principal.
|
|
185
|
+
* Makes an authorization decision based on the [`RequestUnsigned`].
|
|
186
|
+
*
|
|
187
|
+
* When `principal` is omitted / `null` on the JS side the core uses Cedar
|
|
188
|
+
* partial evaluation; residual-dependent requests fail closed with
|
|
189
|
+
* `Decision::Deny` and surface residual policy ids in
|
|
190
|
+
* `response.diagnostics.reason`.
|
|
177
191
|
* @param {any} request
|
|
178
192
|
* @returns {Promise<AuthorizeResult>}
|
|
179
193
|
*/
|
|
@@ -574,12 +588,13 @@ export class Cedarling {
|
|
|
574
588
|
}
|
|
575
589
|
}
|
|
576
590
|
if (Symbol.dispose) Cedarling.prototype[Symbol.dispose] = Cedarling.prototype.free;
|
|
591
|
+
exports.Cedarling = Cedarling;
|
|
577
592
|
|
|
578
593
|
/**
|
|
579
594
|
* A WASM wrapper for the Rust `cedarling::DataEntry` struct.
|
|
580
595
|
* Represents a data entry in the DataStore with value and metadata.
|
|
581
596
|
*/
|
|
582
|
-
|
|
597
|
+
class DataEntry {
|
|
583
598
|
static __wrap(ptr) {
|
|
584
599
|
ptr = ptr >>> 0;
|
|
585
600
|
const obj = Object.create(DataEntry.prototype);
|
|
@@ -738,12 +753,13 @@ export class DataEntry {
|
|
|
738
753
|
}
|
|
739
754
|
}
|
|
740
755
|
if (Symbol.dispose) DataEntry.prototype[Symbol.dispose] = DataEntry.prototype.free;
|
|
756
|
+
exports.DataEntry = DataEntry;
|
|
741
757
|
|
|
742
758
|
/**
|
|
743
759
|
* A WASM wrapper for the Rust `cedarling::DataStoreStats` struct.
|
|
744
760
|
* Statistics about the DataStore.
|
|
745
761
|
*/
|
|
746
|
-
|
|
762
|
+
class DataStoreStats {
|
|
747
763
|
static __wrap(ptr) {
|
|
748
764
|
ptr = ptr >>> 0;
|
|
749
765
|
const obj = Object.create(DataStoreStats.prototype);
|
|
@@ -914,6 +930,7 @@ export class DataStoreStats {
|
|
|
914
930
|
}
|
|
915
931
|
}
|
|
916
932
|
if (Symbol.dispose) DataStoreStats.prototype[Symbol.dispose] = DataStoreStats.prototype.free;
|
|
933
|
+
exports.DataStoreStats = DataStoreStats;
|
|
917
934
|
|
|
918
935
|
/**
|
|
919
936
|
* Diagnostics
|
|
@@ -921,7 +938,7 @@ if (Symbol.dispose) DataStoreStats.prototype[Symbol.dispose] = DataStoreStats.pr
|
|
|
921
938
|
*
|
|
922
939
|
* Provides detailed information about how a policy decision was made, including policies that contributed to the decision and any errors encountered during evaluation.
|
|
923
940
|
*/
|
|
924
|
-
|
|
941
|
+
class Diagnostics {
|
|
925
942
|
static __wrap(ptr) {
|
|
926
943
|
ptr = ptr >>> 0;
|
|
927
944
|
const obj = Object.create(Diagnostics.prototype);
|
|
@@ -965,8 +982,9 @@ export class Diagnostics {
|
|
|
965
982
|
}
|
|
966
983
|
}
|
|
967
984
|
if (Symbol.dispose) Diagnostics.prototype[Symbol.dispose] = Diagnostics.prototype.free;
|
|
985
|
+
exports.Diagnostics = Diagnostics;
|
|
968
986
|
|
|
969
|
-
|
|
987
|
+
class IntoUnderlyingByteSource {
|
|
970
988
|
__destroy_into_raw() {
|
|
971
989
|
const ptr = this.__wbg_ptr;
|
|
972
990
|
this.__wbg_ptr = 0;
|
|
@@ -1011,8 +1029,9 @@ export class IntoUnderlyingByteSource {
|
|
|
1011
1029
|
}
|
|
1012
1030
|
}
|
|
1013
1031
|
if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
|
|
1032
|
+
exports.IntoUnderlyingByteSource = IntoUnderlyingByteSource;
|
|
1014
1033
|
|
|
1015
|
-
|
|
1034
|
+
class IntoUnderlyingSink {
|
|
1016
1035
|
__destroy_into_raw() {
|
|
1017
1036
|
const ptr = this.__wbg_ptr;
|
|
1018
1037
|
this.__wbg_ptr = 0;
|
|
@@ -1050,8 +1069,9 @@ export class IntoUnderlyingSink {
|
|
|
1050
1069
|
}
|
|
1051
1070
|
}
|
|
1052
1071
|
if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
|
|
1072
|
+
exports.IntoUnderlyingSink = IntoUnderlyingSink;
|
|
1053
1073
|
|
|
1054
|
-
|
|
1074
|
+
class IntoUnderlyingSource {
|
|
1055
1075
|
__destroy_into_raw() {
|
|
1056
1076
|
const ptr = this.__wbg_ptr;
|
|
1057
1077
|
this.__wbg_ptr = 0;
|
|
@@ -1076,12 +1096,13 @@ export class IntoUnderlyingSource {
|
|
|
1076
1096
|
}
|
|
1077
1097
|
}
|
|
1078
1098
|
if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
|
|
1099
|
+
exports.IntoUnderlyingSource = IntoUnderlyingSource;
|
|
1079
1100
|
|
|
1080
1101
|
/**
|
|
1081
1102
|
* A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
|
|
1082
1103
|
* Represents the result of a multi-issuer authorization request.
|
|
1083
1104
|
*/
|
|
1084
|
-
|
|
1105
|
+
class MultiIssuerAuthorizeResult {
|
|
1085
1106
|
static __wrap(ptr) {
|
|
1086
1107
|
ptr = ptr >>> 0;
|
|
1087
1108
|
const obj = Object.create(MultiIssuerAuthorizeResult.prototype);
|
|
@@ -1178,6 +1199,7 @@ export class MultiIssuerAuthorizeResult {
|
|
|
1178
1199
|
}
|
|
1179
1200
|
}
|
|
1180
1201
|
if (Symbol.dispose) MultiIssuerAuthorizeResult.prototype[Symbol.dispose] = MultiIssuerAuthorizeResult.prototype.free;
|
|
1202
|
+
exports.MultiIssuerAuthorizeResult = MultiIssuerAuthorizeResult;
|
|
1181
1203
|
|
|
1182
1204
|
/**
|
|
1183
1205
|
* PolicyEvaluationError
|
|
@@ -1185,7 +1207,7 @@ if (Symbol.dispose) MultiIssuerAuthorizeResult.prototype[Symbol.dispose] = Multi
|
|
|
1185
1207
|
*
|
|
1186
1208
|
* Represents an error that occurred when evaluating a Cedar policy.
|
|
1187
1209
|
*/
|
|
1188
|
-
|
|
1210
|
+
class PolicyEvaluationError {
|
|
1189
1211
|
static __wrap(ptr) {
|
|
1190
1212
|
ptr = ptr >>> 0;
|
|
1191
1213
|
const obj = Object.create(PolicyEvaluationError.prototype);
|
|
@@ -1237,6 +1259,7 @@ export class PolicyEvaluationError {
|
|
|
1237
1259
|
}
|
|
1238
1260
|
}
|
|
1239
1261
|
if (Symbol.dispose) PolicyEvaluationError.prototype[Symbol.dispose] = PolicyEvaluationError.prototype.free;
|
|
1262
|
+
exports.PolicyEvaluationError = PolicyEvaluationError;
|
|
1240
1263
|
|
|
1241
1264
|
/**
|
|
1242
1265
|
* Create a new instance of the Cedarling application.
|
|
@@ -1244,10 +1267,11 @@ if (Symbol.dispose) PolicyEvaluationError.prototype[Symbol.dispose] = PolicyEval
|
|
|
1244
1267
|
* @param {any} config
|
|
1245
1268
|
* @returns {Promise<Cedarling>}
|
|
1246
1269
|
*/
|
|
1247
|
-
|
|
1270
|
+
function init(config) {
|
|
1248
1271
|
const ret = wasm.init(config);
|
|
1249
1272
|
return ret;
|
|
1250
1273
|
}
|
|
1274
|
+
exports.init = init;
|
|
1251
1275
|
|
|
1252
1276
|
/**
|
|
1253
1277
|
* Create a new instance of the Cedarling application from archive bytes.
|
|
@@ -1269,10 +1293,11 @@ export function init(config) {
|
|
|
1269
1293
|
* @param {Uint8Array} archive_bytes
|
|
1270
1294
|
* @returns {Promise<Cedarling>}
|
|
1271
1295
|
*/
|
|
1272
|
-
|
|
1296
|
+
function init_from_archive_bytes(config, archive_bytes) {
|
|
1273
1297
|
const ret = wasm.init_from_archive_bytes(config, archive_bytes);
|
|
1274
1298
|
return ret;
|
|
1275
1299
|
}
|
|
1300
|
+
exports.init_from_archive_bytes = init_from_archive_bytes;
|
|
1276
1301
|
function __wbg_get_imports() {
|
|
1277
1302
|
const import0 = {
|
|
1278
1303
|
__proto__: null,
|
|
@@ -1877,22 +1902,22 @@ function __wbg_get_imports() {
|
|
|
1877
1902
|
console.warn(...arg0);
|
|
1878
1903
|
},
|
|
1879
1904
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1880
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1905
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2202, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1881
1906
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h10797b50422db1d9);
|
|
1882
1907
|
return ret;
|
|
1883
1908
|
},
|
|
1884
1909
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
1885
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1910
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 631, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1886
1911
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hc1f7fa9b168b3277);
|
|
1887
1912
|
return ret;
|
|
1888
1913
|
},
|
|
1889
1914
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
1890
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
1891
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1915
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 587, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1916
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h6f3d4b30895d4f66);
|
|
1892
1917
|
return ret;
|
|
1893
1918
|
},
|
|
1894
1919
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
1895
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
1920
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 748, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1896
1921
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h1de102d8396d84e7);
|
|
1897
1922
|
return ret;
|
|
1898
1923
|
},
|
|
@@ -1937,8 +1962,8 @@ function __wbg_get_imports() {
|
|
|
1937
1962
|
};
|
|
1938
1963
|
}
|
|
1939
1964
|
|
|
1940
|
-
function
|
|
1941
|
-
wasm.
|
|
1965
|
+
function wasm_bindgen__convert__closures_____invoke__h6f3d4b30895d4f66(arg0, arg1) {
|
|
1966
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h6f3d4b30895d4f66(arg0, arg1);
|
|
1942
1967
|
}
|
|
1943
1968
|
|
|
1944
1969
|
function wasm_bindgen__convert__closures_____invoke__h1de102d8396d84e7(arg0, arg1) {
|
|
@@ -2215,15 +2240,7 @@ function takeFromExternrefTable0(idx) {
|
|
|
2215
2240
|
|
|
2216
2241
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
2217
2242
|
cachedTextDecoder.decode();
|
|
2218
|
-
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
2219
|
-
let numBytesDecoded = 0;
|
|
2220
2243
|
function decodeText(ptr, len) {
|
|
2221
|
-
numBytesDecoded += len;
|
|
2222
|
-
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
2223
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
2224
|
-
cachedTextDecoder.decode();
|
|
2225
|
-
numBytesDecoded = len;
|
|
2226
|
-
}
|
|
2227
2244
|
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
2228
2245
|
}
|
|
2229
2246
|
|
|
@@ -2242,95 +2259,8 @@ if (!('encodeInto' in cachedTextEncoder)) {
|
|
|
2242
2259
|
|
|
2243
2260
|
let WASM_VECTOR_LEN = 0;
|
|
2244
2261
|
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
cachedUint8ArrayMemory0 = null;
|
|
2251
|
-
wasm.__wbindgen_start();
|
|
2252
|
-
return wasm;
|
|
2253
|
-
}
|
|
2254
|
-
|
|
2255
|
-
async function __wbg_load(module, imports) {
|
|
2256
|
-
if (typeof Response === 'function' && module instanceof Response) {
|
|
2257
|
-
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
2258
|
-
try {
|
|
2259
|
-
return await WebAssembly.instantiateStreaming(module, imports);
|
|
2260
|
-
} catch (e) {
|
|
2261
|
-
const validResponse = module.ok && expectedResponseType(module.type);
|
|
2262
|
-
|
|
2263
|
-
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
2264
|
-
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);
|
|
2265
|
-
|
|
2266
|
-
} else { throw e; }
|
|
2267
|
-
}
|
|
2268
|
-
}
|
|
2269
|
-
|
|
2270
|
-
const bytes = await module.arrayBuffer();
|
|
2271
|
-
return await WebAssembly.instantiate(bytes, imports);
|
|
2272
|
-
} else {
|
|
2273
|
-
const instance = await WebAssembly.instantiate(module, imports);
|
|
2274
|
-
|
|
2275
|
-
if (instance instanceof WebAssembly.Instance) {
|
|
2276
|
-
return { instance, module };
|
|
2277
|
-
} else {
|
|
2278
|
-
return instance;
|
|
2279
|
-
}
|
|
2280
|
-
}
|
|
2281
|
-
|
|
2282
|
-
function expectedResponseType(type) {
|
|
2283
|
-
switch (type) {
|
|
2284
|
-
case 'basic': case 'cors': case 'default': return true;
|
|
2285
|
-
}
|
|
2286
|
-
return false;
|
|
2287
|
-
}
|
|
2288
|
-
}
|
|
2289
|
-
|
|
2290
|
-
function initSync(module) {
|
|
2291
|
-
if (wasm !== undefined) return wasm;
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
if (module !== undefined) {
|
|
2295
|
-
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
2296
|
-
({module} = module)
|
|
2297
|
-
} else {
|
|
2298
|
-
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
2299
|
-
}
|
|
2300
|
-
}
|
|
2301
|
-
|
|
2302
|
-
const imports = __wbg_get_imports();
|
|
2303
|
-
if (!(module instanceof WebAssembly.Module)) {
|
|
2304
|
-
module = new WebAssembly.Module(module);
|
|
2305
|
-
}
|
|
2306
|
-
const instance = new WebAssembly.Instance(module, imports);
|
|
2307
|
-
return __wbg_finalize_init(instance, module);
|
|
2308
|
-
}
|
|
2309
|
-
|
|
2310
|
-
async function __wbg_init(module_or_path) {
|
|
2311
|
-
if (wasm !== undefined) return wasm;
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
if (module_or_path !== undefined) {
|
|
2315
|
-
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
2316
|
-
({module_or_path} = module_or_path)
|
|
2317
|
-
} else {
|
|
2318
|
-
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
2319
|
-
}
|
|
2320
|
-
}
|
|
2321
|
-
|
|
2322
|
-
if (module_or_path === undefined) {
|
|
2323
|
-
module_or_path = new URL('cedarling_wasm_bg.wasm', import.meta.url);
|
|
2324
|
-
}
|
|
2325
|
-
const imports = __wbg_get_imports();
|
|
2326
|
-
|
|
2327
|
-
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
2328
|
-
module_or_path = fetch(module_or_path);
|
|
2329
|
-
}
|
|
2330
|
-
|
|
2331
|
-
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
2332
|
-
|
|
2333
|
-
return __wbg_finalize_init(instance, module);
|
|
2334
|
-
}
|
|
2335
|
-
|
|
2336
|
-
export { initSync, __wbg_init as default };
|
|
2262
|
+
const wasmPath = `${__dirname}/cedarling_wasm_bg.wasm`;
|
|
2263
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
2264
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
2265
|
+
let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
|
|
2266
|
+
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.370-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
|
}
|