@janssenproject/cedarling_wasm 0.0.467 → 0.0.468

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.
@@ -1,3 +1,4 @@
1
+ /// <reference lib="esnext.disposable" />
1
2
  /* tslint:disable */
2
3
  /* eslint-disable */
3
4
  /**
@@ -237,21 +238,6 @@ export class Cedarling {
237
238
  * ```
238
239
  */
239
240
  annotationsMap(policy_ids: string[]): any;
240
- /**
241
- * Authorize multi-issuer request.
242
- * Makes authorization decision based on multiple JWT tokens from different issuers.
243
- *
244
- * # Arguments
245
- *
246
- * * `request` - JSON string representation of [`AuthorizeMultiIssuerRequest`].
247
- *
248
- * # Example
249
- *
250
- * ```javascript
251
- * const result = await cedarling.authorizeMultiIssuer(JSON.stringify(request));
252
- * ```
253
- */
254
- authorizeMultiIssuer(request: string): Promise<MultiIssuerAuthorizeResult>;
255
241
  /**
256
242
  * Authorize a batch of multi-issuer requests against one shared token set.
257
243
  *
@@ -274,25 +260,20 @@ export class Cedarling {
274
260
  */
275
261
  authorizeMultiIssuerBatch(request: string): Promise<BatchAuthorizeMultiIssuerResponse>;
276
262
  /**
277
- * Authorize an unsigned request carrying an optional single principal.
278
- * Makes an authorization decision based on the [`RequestUnsigned`].
279
- *
280
- * When `principal` is omitted / `null` on the JS side the core uses Cedar
281
- * partial evaluation; residual-dependent requests fail closed with
282
- * `Decision::Deny` and surface residual policy ids in
283
- * `response.diagnostics.reason`.
263
+ * Authorize multi-issuer request.
264
+ * Makes authorization decision based on multiple JWT tokens from different issuers.
284
265
  *
285
266
  * # Arguments
286
267
  *
287
- * * `request` - JSON string representation of [`RequestUnsigned`].
268
+ * * `request` - JSON string representation of [`AuthorizeMultiIssuerRequest`].
288
269
  *
289
270
  * # Example
290
271
  *
291
272
  * ```javascript
292
- * const result = await cedarling.authorizeUnsigned(JSON.stringify(request));
273
+ * const result = await cedarling.authorizeMultiIssuer(JSON.stringify(request));
293
274
  * ```
294
275
  */
295
- authorizeUnsigned(request: string): Promise<AuthorizeResult>;
276
+ authorizeMultiIssuer(request: string): Promise<MultiIssuerAuthorizeResult>;
296
277
  /**
297
278
  * Authorize a batch of unsigned requests against one shared principal.
298
279
  *
@@ -314,6 +295,26 @@ export class Cedarling {
314
295
  * ```
315
296
  */
316
297
  authorizeUnsignedBatch(request: string): Promise<BatchAuthorizeUnsignedResponse>;
298
+ /**
299
+ * Authorize an unsigned request carrying an optional single principal.
300
+ * Makes an authorization decision based on the [`RequestUnsigned`].
301
+ *
302
+ * When `principal` is omitted / `null` on the JS side the core uses Cedar
303
+ * partial evaluation; residual-dependent requests fail closed with
304
+ * `Decision::Deny` and surface residual policy ids in
305
+ * `response.diagnostics.reason`.
306
+ *
307
+ * # Arguments
308
+ *
309
+ * * `request` - JSON string representation of [`RequestUnsigned`].
310
+ *
311
+ * # Example
312
+ *
313
+ * ```javascript
314
+ * const result = await cedarling.authorizeUnsigned(JSON.stringify(request));
315
+ * ```
316
+ */
317
+ authorizeUnsigned(request: string): Promise<AuthorizeResult>;
317
318
  /**
318
319
  * Clear all entries from the data store.
319
320
  *
@@ -412,35 +413,35 @@ export class Cedarling {
412
413
  */
413
414
  getLogIds(): Array<any>;
414
415
  /**
415
- * Returns retained memory logs for one request ID.
416
+ * Returns retained memory logs matching one request ID and indexed value.
416
417
  *
417
418
  * # Arguments
418
419
  *
419
420
  * * `requestId` - The request identifier to match.
421
+ * * `tag` - A log kind (`"System"`, `"Decision"`, or `"Metric"`) or a
422
+ * system-log level such as `"DEBUG"`.
420
423
  *
421
424
  * # Example
422
425
  *
423
426
  * ```javascript
424
- * const logs = cedarling.getLogsByRequestId("request-id");
427
+ * const logs = cedarling.getLogsByRequestIdAndTag("request-id", "System");
425
428
  * ```
426
429
  */
427
- getLogsByRequestId(request_id: string): any[];
430
+ getLogsByRequestIdAndTag(request_id: string, tag: string): any[];
428
431
  /**
429
- * Returns retained memory logs matching one request ID and indexed value.
432
+ * Returns retained memory logs for one request ID.
430
433
  *
431
434
  * # Arguments
432
435
  *
433
436
  * * `requestId` - The request identifier to match.
434
- * * `tag` - A log kind (`"System"`, `"Decision"`, or `"Metric"`) or a
435
- * system-log level such as `"DEBUG"`.
436
437
  *
437
438
  * # Example
438
439
  *
439
440
  * ```javascript
440
- * const logs = cedarling.getLogsByRequestIdAndTag("request-id", "System");
441
+ * const logs = cedarling.getLogsByRequestId("request-id");
441
442
  * ```
442
443
  */
443
- getLogsByRequestIdAndTag(request_id: string, tag: string): any[];
444
+ getLogsByRequestId(request_id: string): any[];
444
445
  /**
445
446
  * Returns retained memory logs matching an indexed value.
446
447
  *
@@ -548,45 +549,45 @@ export class Cedarling {
548
549
  */
549
550
  loadedTrustedIssuersCount(): number;
550
551
  /**
551
- * Creates a Cedarling application from bootstrap properties.
552
+ * Creates a new Cedarling application from a JavaScript `Map`.
552
553
  *
553
554
  * # Arguments
554
555
  *
555
- * * `config` - A plain object of Cedarling bootstrap-property names and values.
556
+ * * `config` - A `Map` of Cedarling bootstrap-property names and values.
556
557
  *
557
558
  * # Example
558
559
  *
559
560
  * ```javascript
560
561
  * await initWasm();
561
- * const cedarling = await Cedarling.new({
562
- * CEDARLING_APPLICATION_NAME: "task-api",
563
- * CEDARLING_POLICY_STORE_URI: "https://example.com/policy-store.cjar",
564
- * CEDARLING_LOG_TYPE: "memory",
565
- * CEDARLING_LOG_TTL: 120,
566
- * });
562
+ * const cedarling = await Cedarling.newFromMap(new Map([
563
+ * ["CEDARLING_APPLICATION_NAME", "task-api"],
564
+ * ["CEDARLING_POLICY_STORE_URI", "https://example.com/policy-store.cjar"],
565
+ * ["CEDARLING_LOG_TYPE", "memory"],
566
+ * ["CEDARLING_LOG_TTL", 120],
567
+ * ]));
567
568
  * ```
568
569
  */
569
- static new(config: object): Promise<Cedarling>;
570
+ static newFromMap(config: Map<any, any>): Promise<Cedarling>;
570
571
  /**
571
- * Creates a new Cedarling application from a JavaScript `Map`.
572
+ * Creates a Cedarling application from bootstrap properties.
572
573
  *
573
574
  * # Arguments
574
575
  *
575
- * * `config` - A `Map` of Cedarling bootstrap-property names and values.
576
+ * * `config` - A plain object of Cedarling bootstrap-property names and values.
576
577
  *
577
578
  * # Example
578
579
  *
579
580
  * ```javascript
580
581
  * await initWasm();
581
- * const cedarling = await Cedarling.newFromMap(new Map([
582
- * ["CEDARLING_APPLICATION_NAME", "task-api"],
583
- * ["CEDARLING_POLICY_STORE_URI", "https://example.com/policy-store.cjar"],
584
- * ["CEDARLING_LOG_TYPE", "memory"],
585
- * ["CEDARLING_LOG_TTL", 120],
586
- * ]));
582
+ * const cedarling = await Cedarling.new({
583
+ * CEDARLING_APPLICATION_NAME: "task-api",
584
+ * CEDARLING_POLICY_STORE_URI: "https://example.com/policy-store.cjar",
585
+ * CEDARLING_LOG_TYPE: "memory",
586
+ * CEDARLING_LOG_TTL: 120,
587
+ * });
587
588
  * ```
588
589
  */
589
- static newFromMap(config: Map<any, any>): Promise<Cedarling>;
590
+ static new(config: object): Promise<Cedarling>;
590
591
  /**
591
592
  * Returns all retained memory logs and removes them from storage.
592
593
  * Other log configurations return an empty array.
@@ -785,7 +786,7 @@ export class Diagnostics {
785
786
  readonly reason: string[];
786
787
  }
787
788
 
788
- export class IntoUnderlyingByteSource {
789
+ declare class IntoUnderlyingByteSource {
789
790
  private constructor();
790
791
  free(): void;
791
792
  [Symbol.dispose](): void;
@@ -795,8 +796,9 @@ export class IntoUnderlyingByteSource {
795
796
  readonly autoAllocateChunkSize: number;
796
797
  readonly type: ReadableStreamType;
797
798
  }
799
+ export type { IntoUnderlyingByteSource };
798
800
 
799
- export class IntoUnderlyingSink {
801
+ declare class IntoUnderlyingSink {
800
802
  private constructor();
801
803
  free(): void;
802
804
  [Symbol.dispose](): void;
@@ -804,14 +806,16 @@ export class IntoUnderlyingSink {
804
806
  close(): Promise<any>;
805
807
  write(chunk: any): Promise<any>;
806
808
  }
809
+ export type { IntoUnderlyingSink };
807
810
 
808
- export class IntoUnderlyingSource {
811
+ declare class IntoUnderlyingSource {
809
812
  private constructor();
810
813
  free(): void;
811
814
  [Symbol.dispose](): void;
812
815
  cancel(): void;
813
816
  pull(controller: ReadableStreamDefaultController): Promise<any>;
814
817
  }
818
+ export type { IntoUnderlyingSource };
815
819
 
816
820
  /**
817
821
  * A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
@@ -919,8 +923,10 @@ export interface InitOutput {
919
923
  readonly __wbg_authorizeresult_free: (a: number, b: number) => void;
920
924
  readonly __wbg_authorizeresultresponse_free: (a: number, b: number) => void;
921
925
  readonly __wbg_batchauthorizemultiissuerresponse_free: (a: number, b: number) => void;
926
+ readonly __wbg_batchauthorizeunsignedresponse_free: (a: number, b: number) => void;
922
927
  readonly __wbg_batchitemerror_free: (a: number, b: number) => void;
923
928
  readonly __wbg_batchitemmultiissuerresult_free: (a: number, b: number) => void;
929
+ readonly __wbg_batchitemunsignedresult_free: (a: number, b: number) => void;
924
930
  readonly __wbg_cedarling_free: (a: number, b: number) => void;
925
931
  readonly __wbg_dataentry_free: (a: number, b: number) => void;
926
932
  readonly __wbg_datastorestats_free: (a: number, b: number) => void;
@@ -942,6 +948,13 @@ export interface InitOutput {
942
948
  readonly __wbg_get_datastorestats_memory_alert_triggered: (a: number) => number;
943
949
  readonly __wbg_get_datastorestats_metrics_enabled: (a: number) => number;
944
950
  readonly __wbg_get_datastorestats_total_size_bytes: (a: number) => number;
951
+ readonly __wbg_get_multiissuerauthorizeresult_decision: (a: number) => number;
952
+ readonly __wbg_get_multiissuerauthorizeresult_request_id: (a: number, b: number) => void;
953
+ readonly __wbg_get_multiissuerauthorizeresult_response: (a: number) => number;
954
+ readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
955
+ readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
956
+ readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
957
+ readonly __wbg_multiissuerauthorizeresult_free: (a: number, b: number) => void;
945
958
  readonly __wbg_policyevaluationerror_free: (a: number, b: number) => void;
946
959
  readonly __wbg_set_authorizeresult_decision: (a: number, b: number) => void;
947
960
  readonly __wbg_set_authorizeresult_request_id: (a: number, b: number, c: number) => void;
@@ -960,11 +973,15 @@ export interface InitOutput {
960
973
  readonly __wbg_set_datastorestats_memory_alert_triggered: (a: number, b: number) => void;
961
974
  readonly __wbg_set_datastorestats_metrics_enabled: (a: number, b: number) => void;
962
975
  readonly __wbg_set_datastorestats_total_size_bytes: (a: number, b: number) => void;
976
+ readonly __wbg_set_multiissuerauthorizeresult_decision: (a: number, b: number) => void;
977
+ readonly __wbg_set_multiissuerauthorizeresult_request_id: (a: number, b: number, c: number) => void;
978
+ readonly __wbg_set_multiissuerauthorizeresult_response: (a: number, b: number) => void;
963
979
  readonly authorizeresult_jsonString: (a: number, b: number) => void;
964
980
  readonly authorizeresultresponse_decision: (a: number) => number;
965
981
  readonly authorizeresultresponse_diagnostics: (a: number) => number;
966
982
  readonly batchauthorizemultiissuerresponse_batch_id: (a: number, b: number) => void;
967
983
  readonly batchauthorizemultiissuerresponse_results: (a: number, b: number) => void;
984
+ readonly batchauthorizeunsignedresponse_batch_id: (a: number, b: number) => void;
968
985
  readonly batchauthorizeunsignedresponse_results: (a: number, b: number) => void;
969
986
  readonly batchitemerror_category: (a: number, b: number) => void;
970
987
  readonly batchitemerror_item_index: (a: number) => number;
@@ -972,6 +989,8 @@ export interface InitOutput {
972
989
  readonly batchitemmultiissuerresult_error: (a: number) => number;
973
990
  readonly batchitemmultiissuerresult_is_ok: (a: number) => number;
974
991
  readonly batchitemmultiissuerresult_unwrap: (a: number, b: number) => void;
992
+ readonly batchitemunsignedresult_error: (a: number) => number;
993
+ readonly batchitemunsignedresult_is_ok: (a: number) => number;
975
994
  readonly batchitemunsignedresult_unwrap: (a: number, b: number) => void;
976
995
  readonly cedarling_annotationValues: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
977
996
  readonly cedarling_annotationsByPolicy: (a: number, b: number, c: number, d: number) => void;
@@ -988,6 +1007,7 @@ export interface InitOutput {
988
1007
  readonly cedarling_getLogIds: (a: number) => number;
989
1008
  readonly cedarling_getLogsByRequestId: (a: number, b: number, c: number, d: number) => void;
990
1009
  readonly cedarling_getLogsByRequestIdAndTag: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
1010
+ readonly cedarling_getLogsByTag: (a: number, b: number, c: number, d: number) => void;
991
1011
  readonly cedarling_getStatsCtx: (a: number, b: number) => void;
992
1012
  readonly cedarling_isTrustedIssuerLoadedByIss: (a: number, b: number, c: number) => number;
993
1013
  readonly cedarling_isTrustedIssuerLoadedByName: (a: number, b: number, c: number) => number;
@@ -1008,12 +1028,14 @@ export interface InitOutput {
1008
1028
  readonly diagnostics_reason: (a: number, b: number) => void;
1009
1029
  readonly init: (a: number) => number;
1010
1030
  readonly initFromArchiveBytes: (a: number, b: number) => number;
1011
- readonly multiissuerauthorizeresult_jsonString: (a: number, b: number) => void;
1012
- readonly policyevaluationerror_error: (a: number, b: number) => void;
1013
- readonly policyevaluationerror_id: (a: number, b: number) => void;
1014
- readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
1015
- readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
1016
- readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
1031
+ readonly rust_zstd_wasm_shim_calloc: (a: number, b: number) => number;
1032
+ readonly rust_zstd_wasm_shim_free: (a: number) => void;
1033
+ readonly rust_zstd_wasm_shim_malloc: (a: number) => number;
1034
+ readonly rust_zstd_wasm_shim_memcmp: (a: number, b: number, c: number) => number;
1035
+ readonly rust_zstd_wasm_shim_memcpy: (a: number, b: number, c: number) => number;
1036
+ readonly rust_zstd_wasm_shim_memmove: (a: number, b: number, c: number) => number;
1037
+ readonly rust_zstd_wasm_shim_memset: (a: number, b: number, c: number) => number;
1038
+ readonly rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void;
1017
1039
  readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
1018
1040
  readonly intounderlyingbytesource_cancel: (a: number) => void;
1019
1041
  readonly intounderlyingbytesource_pull: (a: number, b: number) => number;
@@ -1024,31 +1046,13 @@ export interface InitOutput {
1024
1046
  readonly intounderlyingsink_write: (a: number, b: number) => number;
1025
1047
  readonly intounderlyingsource_cancel: (a: number) => void;
1026
1048
  readonly intounderlyingsource_pull: (a: number, b: number) => number;
1027
- readonly rust_zstd_wasm_shim_calloc: (a: number, b: number) => number;
1028
- readonly rust_zstd_wasm_shim_free: (a: number) => void;
1029
- readonly rust_zstd_wasm_shim_malloc: (a: number) => number;
1030
- readonly rust_zstd_wasm_shim_memcmp: (a: number, b: number, c: number) => number;
1031
- readonly rust_zstd_wasm_shim_memcpy: (a: number, b: number, c: number) => number;
1032
- readonly rust_zstd_wasm_shim_memmove: (a: number, b: number, c: number) => number;
1033
- readonly rust_zstd_wasm_shim_memset: (a: number, b: number, c: number) => number;
1034
- readonly rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void;
1035
- readonly __wbg_get_multiissuerauthorizeresult_decision: (a: number) => number;
1036
- readonly __wbg_set_multiissuerauthorizeresult_response: (a: number, b: number) => void;
1037
- readonly __wbg_set_multiissuerauthorizeresult_request_id: (a: number, b: number, c: number) => void;
1038
- readonly __wbg_set_multiissuerauthorizeresult_decision: (a: number, b: number) => void;
1039
- readonly __wbg_get_multiissuerauthorizeresult_response: (a: number) => number;
1040
- readonly __wbg_get_multiissuerauthorizeresult_request_id: (a: number, b: number) => void;
1041
- readonly __wbg_multiissuerauthorizeresult_free: (a: number, b: number) => void;
1042
- readonly __wbg_batchitemunsignedresult_free: (a: number, b: number) => void;
1043
- readonly __wbg_batchauthorizeunsignedresponse_free: (a: number, b: number) => void;
1044
- readonly batchitemunsignedresult_is_ok: (a: number) => number;
1045
- readonly batchitemunsignedresult_error: (a: number) => number;
1046
- readonly batchauthorizeunsignedresponse_batch_id: (a: number, b: number) => void;
1047
- readonly cedarling_getLogsByTag: (a: number, b: number, c: number, d: number) => void;
1048
- readonly __wasm_bindgen_func_elem_8902: (a: number, b: number, c: number, d: number) => void;
1049
- readonly __wasm_bindgen_func_elem_8968: (a: number, b: number, c: number, d: number) => void;
1050
- readonly __wasm_bindgen_func_elem_12454: (a: number, b: number, c: number) => void;
1051
- readonly __wasm_bindgen_func_elem_8737: (a: number, b: number) => void;
1049
+ readonly multiissuerauthorizeresult_jsonString: (a: number, b: number) => void;
1050
+ readonly policyevaluationerror_error: (a: number, b: number) => void;
1051
+ readonly policyevaluationerror_id: (a: number, b: number) => void;
1052
+ readonly __wasm_bindgen_func_elem_8900: (a: number, b: number, c: number, d: number) => void;
1053
+ readonly __wasm_bindgen_func_elem_8955: (a: number, b: number, c: number, d: number) => void;
1054
+ readonly __wasm_bindgen_func_elem_12460: (a: number, b: number, c: number) => void;
1055
+ readonly __wasm_bindgen_func_elem_8734: (a: number, b: number) => void;
1052
1056
  readonly __wbindgen_export: (a: number, b: number) => number;
1053
1057
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
1054
1058
  readonly __wbindgen_export3: (a: number) => void;
@@ -0,0 +1,6 @@
1
+ export declare const init: typeof import("./generated.js").init;
2
+ export declare const initSync: typeof import("./generated.js").initSync;
3
+ export declare const initWasm: typeof import("./generated.js").default;
4
+ export declare const initFromArchiveBytes: typeof import("./generated.js").initFromArchiveBytes;
5
+ export { initWasm as default };
6
+ export type * from "./generated.js";
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,7 @@
1
+ import type { InitOutput } from "./generated.js";
2
+ export declare const init: typeof import("./generated.js").init;
3
+ export declare const initSync: typeof import("./generated.js").initSync;
4
+ export declare const initWasm: () => Promise<InitOutput>;
5
+ export declare const initFromArchiveBytes: typeof import("./generated.js").initFromArchiveBytes;
6
+ export { initWasm as default };
7
+ export type * from "./generated.js";