@janssenproject/cedarling_wasm 2.4.0-nodejs → 2.5.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.
@@ -1,759 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * The `ReadableStreamType` enum.
5
- *
6
- * *This API requires the following crate features to be activated: `ReadableStreamType`*
7
- */
8
-
9
- export type ReadableStreamType = "bytes";
10
-
11
- /**
12
- * A WASM wrapper for the Rust `cedarling::AuthorizeResult` struct.
13
- * Represents the result of an authorization request.
14
- */
15
- export class AuthorizeResult {
16
- private constructor();
17
- free(): void;
18
- [Symbol.dispose](): void;
19
- /**
20
- * Convert `AuthorizeResult` to json string value
21
- */
22
- json_string(): string;
23
- /**
24
- * Result of authorization
25
- * true means `ALLOW`
26
- * false means `Deny`
27
- *
28
- * this field is [`bool`] type to be compatible with [authzen Access Evaluation Decision](https://openid.github.io/authzen/#section-6.2.1).
29
- */
30
- decision: boolean;
31
- /**
32
- * Request ID of the authorization request
33
- */
34
- request_id: string;
35
- /**
36
- * Cedar authorization response for the request.
37
- */
38
- response: AuthorizeResultResponse;
39
- }
40
-
41
- /**
42
- * A WASM wrapper for the Rust `cedar_policy::Response` struct.
43
- * Represents the result of an authorization request.
44
- */
45
- export class AuthorizeResultResponse {
46
- private constructor();
47
- free(): void;
48
- [Symbol.dispose](): void;
49
- /**
50
- * Authorization decision
51
- */
52
- readonly decision: boolean;
53
- /**
54
- * Diagnostics providing more information on how this decision was reached
55
- */
56
- readonly diagnostics: Diagnostics;
57
- }
58
-
59
- /**
60
- * WASM wrapper for
61
- * `cedarling::BatchAuthorizeResponse<Result<MultiIssuerAuthorizeResult, BatchItemError>>`.
62
- * Same shape as [`BatchAuthorizeUnsignedResponse`] with multi-issuer results.
63
- */
64
- export class BatchAuthorizeMultiIssuerResponse {
65
- private constructor();
66
- free(): void;
67
- [Symbol.dispose](): void;
68
- /**
69
- * Shared correlation id stamped on every per-item decision log entry.
70
- */
71
- readonly batch_id: string;
72
- /**
73
- * Per-item results in input order — each slot is a
74
- * [`BatchItemMultiIssuerResult`].
75
- */
76
- readonly results: BatchItemMultiIssuerResult[];
77
- }
78
-
79
- /**
80
- * WASM wrapper for `cedarling::BatchAuthorizeResponse<Result<AuthorizeResult, BatchItemError>>`.
81
- *
82
- * Carries a shared `batch_id` (UUIDv7) alongside per-item results. Each result
83
- * is a [`BatchItemUnsignedResult`] — Cedar decision on `is_ok()`, per-item
84
- * build failure on `error`. `results[i]` corresponds to `items[i]`.
85
- */
86
- export class BatchAuthorizeUnsignedResponse {
87
- private constructor();
88
- free(): void;
89
- [Symbol.dispose](): void;
90
- /**
91
- * Shared correlation id stamped on every per-item decision log entry.
92
- */
93
- readonly batch_id: string;
94
- /**
95
- * Per-item results in input order — each slot is a
96
- * [`BatchItemUnsignedResult`].
97
- */
98
- readonly results: BatchItemUnsignedResult[];
99
- }
100
-
101
- /**
102
- * Per-item build failure surfaced inside a batch response at `results[i]`
103
- * when Cedar couldn't be reached for that item.
104
- */
105
- export class BatchItemError {
106
- private constructor();
107
- free(): void;
108
- [Symbol.dispose](): void;
109
- /**
110
- * Stable variant slug — `action_parse`, `resource_build`, `context_build`,
111
- * `principal_build`, `schema_validation`, `multi_issuer_entity`,
112
- * `request_validation`.
113
- */
114
- readonly category: string;
115
- /**
116
- * Position of the failing item in the original `items` vector.
117
- */
118
- readonly item_index: number;
119
- /**
120
- * Human-readable diagnostic. Safe to log.
121
- */
122
- readonly message: string;
123
- }
124
-
125
- /**
126
- * Multi-issuer analog of [`BatchItemUnsignedResult`].
127
- */
128
- export class BatchItemMultiIssuerResult {
129
- private constructor();
130
- free(): void;
131
- [Symbol.dispose](): void;
132
- /**
133
- * The multi-issuer decision if `is_ok()`; throws otherwise.
134
- */
135
- unwrap(): MultiIssuerAuthorizeResult;
136
- /**
137
- * The per-item error if `!is_ok()`; `undefined` otherwise.
138
- */
139
- readonly error: BatchItemError | undefined;
140
- /**
141
- * `true` when Cedar evaluated this item.
142
- */
143
- readonly is_ok: boolean;
144
- }
145
-
146
- /**
147
- * One slot in a batch response's `results` array. Callers switch on
148
- * `is_ok()` — on `true`, read `unwrap()`; on `false`, read `error()`.
149
- */
150
- export class BatchItemUnsignedResult {
151
- private constructor();
152
- free(): void;
153
- [Symbol.dispose](): void;
154
- /**
155
- * The Cedar decision if `is_ok()`; throws otherwise.
156
- */
157
- unwrap(): AuthorizeResult;
158
- /**
159
- * The per-item error if `!is_ok()`; `undefined` otherwise.
160
- */
161
- readonly error: BatchItemError | undefined;
162
- /**
163
- * `true` when Cedar evaluated this item (Allow or Deny); `false` when it
164
- * failed to build.
165
- */
166
- readonly is_ok: boolean;
167
- }
168
-
169
- /**
170
- * The instance of the Cedarling application.
171
- */
172
- export class Cedarling {
173
- private constructor();
174
- free(): void;
175
- [Symbol.dispose](): void;
176
- /**
177
- * Collect every value of the annotation `key` across the given policies,
178
- * preserving duplicates. Unknown policy IDs are silently skipped.
179
- *
180
- * # Arguments
181
- *
182
- * * `policy_ids` - List of policy IDs to search. Typically
183
- * `result.response.diagnostics.reason` from an authorization result.
184
- * * `key` - The annotation key to collect values for (e.g. `"redirect"`).
185
- *
186
- * # Example
187
- *
188
- * ```javascript
189
- * const redirects = cedarling.annotation_values(result.response.diagnostics.reason, "redirect");
190
- * // ["/upgrade"]
191
- * ```
192
- */
193
- annotation_values(policy_ids: string[], key: string): string[];
194
- /**
195
- * Return the annotations of each given policy, grouped by policy ID
196
- * the loss-free companion to `annotations_map`. Unknown policy IDs are
197
- * silently skipped.
198
- *
199
- * # Arguments
200
- *
201
- * * `policy_ids` - List of policy IDs whose annotations should be returned
202
- * grouped by policy ID. Typically `result.response.diagnostics.reason` from
203
- * an authorization result.
204
- *
205
- * # Example
206
- *
207
- * ```javascript
208
- * const byPolicy = cedarling.annotations_by_policy(result.response.diagnostics.reason);
209
- * // { "5": { redirect: "/upgrade", tier: "premium" } }
210
- * ```
211
- */
212
- annotations_by_policy(policy_ids: string[]): any;
213
- /**
214
- * Merge the annotations (`@key("value")`) of the given policies into a single object.
215
- *
216
- * Intended for resolving the determining policies of an authorization decision:
217
- * pass `result.response.diagnostics.reason`.
218
- *
219
- * Lossy: if the same annotation key appears on several policies, one value wins
220
- * arbitrarily. Use `annotation_values` / `annotations_by_policy` when duplicates
221
- * matter. Unknown policy IDs are silently skipped.
222
- *
223
- * # Arguments
224
- *
225
- * * `policy_ids` - List of policy IDs whose annotations should be merged into
226
- * a single object. Typically `result.response.diagnostics.reason` from an
227
- * authorization result.
228
- *
229
- * # Example
230
- *
231
- * ```javascript
232
- * const annotations = cedarling.annotations_map(result.response.diagnostics.reason);
233
- * // { redirect: "/upgrade", tier: "premium" }
234
- * ```
235
- */
236
- annotations_map(policy_ids: string[]): any;
237
- /**
238
- * Authorize multi-issuer request.
239
- * Makes authorization decision based on multiple JWT tokens from different issuers.
240
- *
241
- * # Arguments
242
- *
243
- * * `request` - JSON string representation of [`AuthorizeMultiIssuerRequest`].
244
- *
245
- * # Example
246
- *
247
- * ```javascript
248
- * const result = await cedarling.authorize_multi_issuer(JSON.stringify(request));
249
- * ```
250
- */
251
- authorize_multi_issuer(request: string): Promise<MultiIssuerAuthorizeResult>;
252
- /**
253
- * Authorize a batch of multi-issuer requests against one shared token set.
254
- *
255
- * Tokens are validated and token/issuer entities are built once, then
256
- * each item is evaluated in input order. Batch-level failures (validation,
257
- * JWT verification, status-list refresh) reject the whole call; per-item
258
- * failures are returned as `BatchItemError` results and exposed by WASM
259
- * with `is_ok=false` and `error`, while genuine Cedar denials remain
260
- * `AuthorizeResult` values with `decision=false`.
261
- *
262
- * # Arguments
263
- *
264
- * * `request` - JSON string representation of [`BatchAuthorizeMultiIssuerRequest`].
265
- *
266
- * # Example
267
- *
268
- * ```javascript
269
- * const result = await cedarling.authorize_multi_issuer_batch(JSON.stringify(batchRequest));
270
- * ```
271
- */
272
- authorize_multi_issuer_batch(request: string): Promise<BatchAuthorizeMultiIssuerResponse>;
273
- /**
274
- * Authorize an unsigned request carrying an optional single principal.
275
- * Makes an authorization decision based on the [`RequestUnsigned`].
276
- *
277
- * When `principal` is omitted / `null` on the JS side the core uses Cedar
278
- * partial evaluation; residual-dependent requests fail closed with
279
- * `Decision::Deny` and surface residual policy ids in
280
- * `response.diagnostics.reason`.
281
- *
282
- * # Arguments
283
- *
284
- * * `request` - JSON string representation of [`RequestUnsigned`].
285
- *
286
- * # Example
287
- *
288
- * ```javascript
289
- * const result = await cedarling.authorize_unsigned(JSON.stringify(request));
290
- * ```
291
- */
292
- authorize_unsigned(request: string): Promise<AuthorizeResult>;
293
- /**
294
- * Authorize a batch of unsigned requests against one shared principal.
295
- *
296
- * Setup work (principal build + pushed-data snapshot) runs once and each
297
- * item is evaluated in input order. Results are returned inside a
298
- * [`BatchAuthorizeUnsignedResponse`] carrying the shared `batch_id`.
299
- * Batch-level failures (validation, principal parse) reject the whole
300
- * call; per-item failures are returned as `BatchItemError` results and
301
- * exposed by WASM with `is_ok=false` and `error`, while genuine Cedar
302
- * denials remain `AuthorizeResult` values with `decision=false`.
303
- * # Arguments
304
- *
305
- * * `request` - JSON string representation of [`BatchAuthorizeUnsignedRequest`].
306
- *
307
- * # Example
308
- *
309
- * ```javascript
310
- * const result = await cedarling.authorize_unsigned_batch(JSON.stringify(batchRequest));
311
- * ```
312
- */
313
- authorize_unsigned_batch(request: string): Promise<BatchAuthorizeUnsignedResponse>;
314
- /**
315
- * Clear all entries from the data store.
316
- *
317
- * # Example
318
- *
319
- * ```javascript
320
- * cedarling.clear_data_ctx();
321
- * console.log("All data entries cleared");
322
- * ```
323
- */
324
- clear_data_ctx(): void;
325
- /**
326
- * Get trusted issuer identifiers that failed to load.
327
- *
328
- * # Example
329
- *
330
- * ```javascript
331
- * const ids = cedarling.failed_trusted_issuer_ids();
332
- * ```
333
- */
334
- failed_trusted_issuer_ids(): Array<any>;
335
- /**
336
- * Get a value from the data store by key.
337
- * Returns null if the key doesn't exist or the entry has expired.
338
- *
339
- * # Arguments
340
- *
341
- * * `key` - A string key for the data entry to retrieve
342
- *
343
- * # Example
344
- *
345
- * ```javascript
346
- * const value = cedarling.get_data_ctx("user:123");
347
- * if (value !== null) {
348
- * console.log(value.name); // "John"
349
- * }
350
- * ```
351
- */
352
- get_data_ctx(key: string): any;
353
- /**
354
- * Get a data entry with full metadata by key.
355
- * Returns null if the key doesn't exist or the entry has expired.
356
- *
357
- * # Arguments
358
- *
359
- * * `key` - A string key for the data entry to retrieve
360
- *
361
- * # Example
362
- *
363
- * ```javascript
364
- * const entry = cedarling.get_data_entry_ctx("user:123");
365
- * if (entry !== null) {
366
- * console.log(entry.key); // "user:123"
367
- * console.log(entry.value); // { name: "John", age: 30 }
368
- * console.log(entry.data_type); // "Record"
369
- * console.log(entry.created_at); // "2024-01-01T12:00:00Z"
370
- * console.log(entry.access_count); // 5
371
- * }
372
- * ```
373
- */
374
- get_data_entry_ctx(key: string): DataEntry | undefined;
375
- /**
376
- * Get specific log entry.
377
- * Returns `Map` with values or `null`.
378
- */
379
- get_log_by_id(id: string): any;
380
- /**
381
- * Returns a list of all log ids.
382
- * Returns `Array` of `String`
383
- */
384
- get_log_ids(): Array<any>;
385
- /**
386
- * Get logs by request_id.
387
- * Return log entries that match the given request_id.
388
- */
389
- get_logs_by_request_id(request_id: string): any[];
390
- /**
391
- * Get log by request_id and tag, like composite key `request_id` + `log_kind`.
392
- * Tag can be `log_kind`, `log_level`.
393
- * Return log entries that match the given request_id and tag.
394
- */
395
- get_logs_by_request_id_and_tag(request_id: string, tag: string): any[];
396
- /**
397
- * Get logs by tag, like `log_kind` or `log level`.
398
- * Tag can be `log_kind`, `log_level`.
399
- */
400
- get_logs_by_tag(tag: string): any[];
401
- /**
402
- * Get statistics about the data store.
403
- *
404
- * # Example
405
- *
406
- * ```javascript
407
- * const stats = cedarling.get_stats_ctx();
408
- * console.log(`Entries: ${stats.entry_count}/${stats.max_entries || 'unlimited'}`);
409
- * console.log(`Capacity: ${stats.capacity_usage_percent.toFixed(2)}%`);
410
- * console.log(`Total size: ${stats.total_size_bytes} bytes`);
411
- * ```
412
- */
413
- get_stats_ctx(): DataStoreStats;
414
- /**
415
- * Check whether a trusted issuer was loaded by `iss` claim.
416
- *
417
- * # Arguments
418
- *
419
- * * `iss_claim` - Issuer `iss` claim value to check.
420
- *
421
- * # Example
422
- *
423
- * ```javascript
424
- * const ok = cedarling.is_trusted_issuer_loaded_by_iss("https://issuer.example.org");
425
- * ```
426
- */
427
- is_trusted_issuer_loaded_by_iss(iss_claim: string): boolean;
428
- /**
429
- * Check whether a trusted issuer was loaded by issuer identifier.
430
- *
431
- * # Arguments
432
- *
433
- * * `issuer_id` - Trusted issuer identifier to check.
434
- *
435
- * # Example
436
- *
437
- * ```javascript
438
- * const ok = cedarling.is_trusted_issuer_loaded_by_name("issuer_id");
439
- * ```
440
- */
441
- is_trusted_issuer_loaded_by_name(issuer_id: string): boolean;
442
- /**
443
- * List all entries with their metadata.
444
- * Returns an array of DataEntry objects.
445
- *
446
- * # Example
447
- *
448
- * ```javascript
449
- * const entries = cedarling.list_data_ctx();
450
- * entries.forEach(entry => {
451
- * console.log(`${entry.key}: ${entry.data_type} (accessed ${entry.access_count} times)`);
452
- * });
453
- * ```
454
- */
455
- list_data_ctx(): Array<any>;
456
- /**
457
- * Get trusted issuer identifiers loaded successfully.
458
- *
459
- * # Example
460
- *
461
- * ```javascript
462
- * const ids = cedarling.loaded_trusted_issuer_ids();
463
- * ```
464
- */
465
- loaded_trusted_issuer_ids(): Array<any>;
466
- /**
467
- * Get the number of trusted issuers loaded successfully.
468
- *
469
- * # Example
470
- *
471
- * ```javascript
472
- * const loadedCount = cedarling.loaded_trusted_issuers_count();
473
- * ```
474
- */
475
- loaded_trusted_issuers_count(): number;
476
- /**
477
- * Create a new instance of the Cedarling application.
478
- * Assume that config is `Object`
479
- */
480
- static new(config: object): Promise<Cedarling>;
481
- /**
482
- * Create a new instance of the Cedarling application.
483
- * Assume that config is `Map`
484
- */
485
- static new_from_map(config: Map<any, any>): Promise<Cedarling>;
486
- /**
487
- * Get logs and remove them from the storage.
488
- * Returns `Array` of `Map`
489
- */
490
- pop_logs(): Array<any>;
491
- /**
492
- * Push a value into the data store with an optional TTL.
493
- * If the key already exists, the value will be replaced.
494
- * If TTL is not provided, the default TTL from configuration is used.
495
- *
496
- * # Arguments
497
- *
498
- * * `key` - A string key for the data entry (must not be empty)
499
- * * `value` - The value to store (any JSON-serializable JavaScript value: object, array, string, number, boolean)
500
- * * `ttl_secs` - Optional TTL in seconds (undefined/null uses default from config)
501
- *
502
- * # Example
503
- *
504
- * ```javascript
505
- * cedarling.push_data_ctx("user:123", { name: "John", age: 30 }, 3600);
506
- * cedarling.push_data_ctx("config", { setting: "value" }); // Uses default TTL
507
- * ```
508
- */
509
- push_data_ctx(key: string, value: any, ttl_secs?: bigint | null): void;
510
- /**
511
- * Remove a value from the data store by key.
512
- * Returns true if the key existed and was removed, false otherwise.
513
- *
514
- * # Arguments
515
- *
516
- * * `key` - A string key for the data entry to remove
517
- *
518
- * # Example
519
- *
520
- * ```javascript
521
- * const removed = cedarling.remove_data_ctx("user:123");
522
- * if (removed) {
523
- * console.log("Entry was successfully removed");
524
- * }
525
- * ```
526
- */
527
- remove_data_ctx(key: string): boolean;
528
- /**
529
- * Closes the connections to the Lock Server and pushes all available logs.
530
- */
531
- shut_down(): Promise<void>;
532
- /**
533
- * Get the total number of trusted issuer entries discovered.
534
- *
535
- * # Example
536
- *
537
- * ```javascript
538
- * const total = cedarling.total_issuers();
539
- * ```
540
- */
541
- total_issuers(): number;
542
- }
543
-
544
- /**
545
- * A WASM wrapper for the Rust `cedarling::DataEntry` struct.
546
- * Represents a data entry in the DataStore with value and metadata.
547
- */
548
- export class DataEntry {
549
- private constructor();
550
- free(): void;
551
- [Symbol.dispose](): void;
552
- /**
553
- * Convert `DataEntry` to json string value
554
- */
555
- json_string(): string;
556
- /**
557
- * Get the value stored in this entry as a JavaScript object
558
- */
559
- value(): any;
560
- /**
561
- * Number of times this entry has been accessed
562
- */
563
- access_count: bigint;
564
- /**
565
- * Timestamp when this entry was created (RFC 3339 format)
566
- */
567
- created_at: string;
568
- /**
569
- * The inferred Cedar type of the value
570
- */
571
- data_type: string;
572
- /**
573
- * Timestamp when this entry expires (RFC 3339 format), or null if no TTL
574
- */
575
- get expires_at(): string | undefined;
576
- /**
577
- * Timestamp when this entry expires (RFC 3339 format), or null if no TTL
578
- */
579
- set expires_at(value: string | null | undefined);
580
- /**
581
- * The key for this entry
582
- */
583
- key: string;
584
- }
585
-
586
- /**
587
- * A WASM wrapper for the Rust `cedarling::DataStoreStats` struct.
588
- * Statistics about the DataStore.
589
- */
590
- export class DataStoreStats {
591
- private constructor();
592
- free(): void;
593
- [Symbol.dispose](): void;
594
- /**
595
- * Convert `DataStoreStats` to json string value
596
- */
597
- json_string(): string;
598
- /**
599
- * Average size per entry in bytes (0 if no entries)
600
- */
601
- avg_entry_size_bytes: number;
602
- /**
603
- * Percentage of capacity used (0.0-100.0, based on entry count)
604
- */
605
- capacity_usage_percent: number;
606
- /**
607
- * Number of entries currently stored
608
- */
609
- entry_count: number;
610
- /**
611
- * Maximum number of entries allowed (0 = unlimited)
612
- */
613
- max_entries: number;
614
- /**
615
- * Maximum size per entry in bytes (0 = unlimited)
616
- */
617
- max_entry_size: number;
618
- /**
619
- * Memory usage threshold percentage (from config)
620
- */
621
- memory_alert_threshold: number;
622
- /**
623
- * Whether memory usage exceeds the alert threshold
624
- */
625
- memory_alert_triggered: boolean;
626
- /**
627
- * Whether metrics tracking is enabled
628
- */
629
- metrics_enabled: boolean;
630
- /**
631
- * Total size of all entries in bytes (approximate, based on JSON serialization)
632
- */
633
- total_size_bytes: number;
634
- }
635
-
636
- /**
637
- * Diagnostics
638
- * ===========
639
- *
640
- * Provides detailed information about how a policy decision was made, including policies that contributed to the decision and any errors encountered during evaluation.
641
- */
642
- export class Diagnostics {
643
- private constructor();
644
- free(): void;
645
- [Symbol.dispose](): void;
646
- /**
647
- * Errors that occurred during authorization. The errors should be
648
- * treated as unordered, since policies may be evaluated in any order.
649
- */
650
- readonly errors: PolicyEvaluationError[];
651
- /**
652
- * `PolicyId`s of the policies that contributed to the decision.
653
- * If no policies applied to the request, this set will be empty.
654
- *
655
- * The ids should be treated as unordered,
656
- */
657
- readonly reason: string[];
658
- }
659
-
660
- export class IntoUnderlyingByteSource {
661
- private constructor();
662
- free(): void;
663
- [Symbol.dispose](): void;
664
- cancel(): void;
665
- pull(controller: ReadableByteStreamController): Promise<any>;
666
- start(controller: ReadableByteStreamController): void;
667
- readonly autoAllocateChunkSize: number;
668
- readonly type: ReadableStreamType;
669
- }
670
-
671
- export class IntoUnderlyingSink {
672
- private constructor();
673
- free(): void;
674
- [Symbol.dispose](): void;
675
- abort(reason: any): Promise<any>;
676
- close(): Promise<any>;
677
- write(chunk: any): Promise<any>;
678
- }
679
-
680
- export class IntoUnderlyingSource {
681
- private constructor();
682
- free(): void;
683
- [Symbol.dispose](): void;
684
- cancel(): void;
685
- pull(controller: ReadableStreamDefaultController): Promise<any>;
686
- }
687
-
688
- /**
689
- * A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
690
- * Represents the result of a multi-issuer authorization request.
691
- */
692
- export class MultiIssuerAuthorizeResult {
693
- private constructor();
694
- free(): void;
695
- [Symbol.dispose](): void;
696
- /**
697
- * Convert `MultiIssuerAuthorizeResult` to json string value
698
- */
699
- json_string(): string;
700
- /**
701
- * Result of authorization
702
- * true means `ALLOW`
703
- * false means `Deny`
704
- */
705
- decision: boolean;
706
- /**
707
- * Request ID of the authorization request
708
- */
709
- request_id: string;
710
- /**
711
- * Result of Cedar policy authorization
712
- */
713
- response: AuthorizeResultResponse;
714
- }
715
-
716
- /**
717
- * PolicyEvaluationError
718
- * =====================
719
- *
720
- * Represents an error that occurred when evaluating a Cedar policy.
721
- */
722
- export class PolicyEvaluationError {
723
- private constructor();
724
- free(): void;
725
- [Symbol.dispose](): void;
726
- /**
727
- * Underlying evaluation error string representation
728
- */
729
- readonly error: string;
730
- /**
731
- * Id of the policy with an error
732
- */
733
- readonly id: string;
734
- }
735
-
736
- /**
737
- * Create a new instance of the Cedarling application.
738
- * This function can take as config parameter the eather `Map` other `Object`
739
- */
740
- export function init(config: any): Promise<Cedarling>;
741
-
742
- /**
743
- * Create a new instance of the Cedarling application from archive bytes.
744
- *
745
- * This function allows loading a policy store from a Cedar Archive (.cjar)
746
- * that was fetched with custom logic (e.g., with authentication headers).
747
- *
748
- * # Arguments
749
- * * `config` - Bootstrap configuration (Map or Object). Policy store config is ignored.
750
- * * `archive_bytes` - The .cjar archive bytes (Uint8Array)
751
- *
752
- * # Example
753
- * ```javascript
754
- * const response = await fetch(url, { headers: { Authorization: 'Bearer ...' } });
755
- * const bytes = new Uint8Array(await response.arrayBuffer());
756
- * const cedarling = await init_from_archive_bytes(config, bytes);
757
- * ```
758
- */
759
- export function init_from_archive_bytes(config: any, archive_bytes: Uint8Array): Promise<Cedarling>;