@janssenproject/cedarling_wasm 0.0.315-nodejs → 0.0.316

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 CHANGED
@@ -149,6 +149,102 @@ export class Cedarling {
149
149
  * Return log entries that match the given request_id and tag.
150
150
  */
151
151
  get_logs_by_request_id_and_tag(request_id: string, tag: string): any[];
152
+ /**
153
+ * Push a value into the data store with an optional TTL.
154
+ * If the key already exists, the value will be replaced.
155
+ * If TTL is not provided, the default TTL from configuration is used.
156
+ *
157
+ * # Arguments
158
+ * * `key` - The key for the data entry
159
+ * * `value` - The value to store (any JSON-serializable value)
160
+ * * `ttl_secs` - Optional TTL in seconds (undefined uses default from config)
161
+ *
162
+ * # Example
163
+ * ```javascript
164
+ * cedarling.push_data_ctx("user:123", { name: "John", age: 30 }, 3600);
165
+ * cedarling.push_data_ctx("config", { setting: "value" }); // Uses default TTL
166
+ * ```
167
+ */
168
+ push_data_ctx(key: string, value: any, ttl_secs?: number): void;
169
+ /**
170
+ * Get a value from the data store by key.
171
+ * Returns null if the key doesn't exist or the entry has expired.
172
+ *
173
+ * # Arguments
174
+ * * `key` - The key to retrieve
175
+ *
176
+ * # Example
177
+ * ```javascript
178
+ * const value = cedarling.get_data_ctx("user:123");
179
+ * if (value) {
180
+ * console.log(value.name);
181
+ * }
182
+ * ```
183
+ */
184
+ get_data_ctx(key: string): any;
185
+ /**
186
+ * Get a data entry with full metadata by key.
187
+ * Returns null if the key doesn't exist or the entry has expired.
188
+ * Includes metadata like creation time, expiration, access count, and type.
189
+ *
190
+ * # Arguments
191
+ * * `key` - The key to retrieve
192
+ *
193
+ * # Example
194
+ * ```javascript
195
+ * const entry = cedarling.get_data_entry_ctx("user:123");
196
+ * if (entry) {
197
+ * console.log(`Created: ${entry.created_at}, Access count: ${entry.access_count}`);
198
+ * }
199
+ * ```
200
+ */
201
+ get_data_entry_ctx(key: string): any;
202
+ /**
203
+ * Remove a value from the data store by key.
204
+ * Returns true if the key existed and was removed, false otherwise.
205
+ *
206
+ * # Arguments
207
+ * * `key` - The key to remove
208
+ *
209
+ * # Example
210
+ * ```javascript
211
+ * const removed = cedarling.remove_data_ctx("user:123");
212
+ * ```
213
+ */
214
+ remove_data_ctx(key: string): boolean;
215
+ /**
216
+ * Clear all entries from the data store.
217
+ *
218
+ * # Example
219
+ * ```javascript
220
+ * cedarling.clear_data_ctx();
221
+ * ```
222
+ */
223
+ clear_data_ctx(): void;
224
+ /**
225
+ * List all entries with their metadata.
226
+ * Returns an array of data entries containing key, value, type, and timing metadata.
227
+ *
228
+ * # Example
229
+ * ```javascript
230
+ * const entries = cedarling.list_data_ctx();
231
+ * entries.forEach(entry => {
232
+ * console.log(`Key: ${entry.key}, Type: ${entry.data_type}`);
233
+ * });
234
+ * ```
235
+ */
236
+ list_data_ctx(): any[];
237
+ /**
238
+ * Get statistics about the data store.
239
+ * Returns current entry count, capacity limits, and configuration state.
240
+ *
241
+ * # Example
242
+ * ```javascript
243
+ * const stats = cedarling.get_stats_ctx();
244
+ * console.log(`Entries: ${stats.entry_count}/${stats.max_entries}`);
245
+ * ```
246
+ */
247
+ get_stats_ctx(): DataStoreStats;
152
248
  }
153
249
 
154
250
  /**
@@ -263,6 +359,52 @@ export class PolicyEvaluationError {
263
359
  */
264
360
  readonly error: string;
265
361
  }
362
+
363
+ /**
364
+ * DataStoreStats
365
+ * ==============
366
+ *
367
+ * Statistics about the DataStore, providing insight into the current state
368
+ * and usage of the data store, including memory usage metrics and capacity information.
369
+ */
370
+ export class DataStoreStats {
371
+ /**
372
+ * Number of entries currently stored
373
+ */
374
+ readonly entry_count: number;
375
+ /**
376
+ * Maximum number of entries allowed (0 = unlimited)
377
+ */
378
+ readonly max_entries: number;
379
+ /**
380
+ * Maximum size per entry in bytes (0 = unlimited)
381
+ */
382
+ readonly max_entry_size: number;
383
+ /**
384
+ * Whether metrics tracking is enabled
385
+ */
386
+ readonly metrics_enabled: boolean;
387
+ /**
388
+ * Total size of all entries in bytes (approximate, based on JSON serialization)
389
+ */
390
+ readonly total_size_bytes: number;
391
+ /**
392
+ * Average size per entry in bytes (0 if no entries)
393
+ */
394
+ readonly avg_entry_size_bytes: number;
395
+ /**
396
+ * Percentage of capacity used (0.0-100.0, based on entry count)
397
+ */
398
+ readonly capacity_usage_percent: number;
399
+ /**
400
+ * Memory usage threshold percentage (from config)
401
+ */
402
+ readonly memory_alert_threshold: number;
403
+ /**
404
+ * Whether memory usage exceeds the alert threshold
405
+ */
406
+ readonly memory_alert_triggered: boolean;
407
+ }
266
408
  ```
267
409
 
268
410
  ## Configuration
@@ -335,3 +477,134 @@ const BOOTSTRAP_CONFIG = {
335
477
  ```
336
478
 
337
479
  For complete configuration documentation, see [cedarling-properties.md](../../../docs/cedarling/cedarling-properties.md) or on [our page](https://docs.jans.io/stable/cedarling/cedarling-properties/).
480
+
481
+ ## Context Data API
482
+
483
+ The Context Data API allows you to push external data into the Cedarling evaluation context, making it available in Cedar policies through the `context.data` namespace.
484
+
485
+ ### Push Data
486
+
487
+ Store data with an optional TTL (Time To Live):
488
+
489
+ ```javascript
490
+ // Push data without TTL (uses default from config)
491
+ cedarling.push_data_ctx("user:123", {
492
+ role: ["admin", "editor"],
493
+ country: "US"
494
+ });
495
+
496
+ // Push data with TTL (5 minutes = 300 seconds)
497
+ cedarling.push_data_ctx("config:app", { setting: "value" }, 300);
498
+
499
+ // Push different data types
500
+ cedarling.push_data_ctx("key1", "string_value");
501
+ cedarling.push_data_ctx("key2", 42);
502
+ cedarling.push_data_ctx("key3", [1, 2, 3]);
503
+ cedarling.push_data_ctx("key4", { nested: "data" });
504
+ ```
505
+
506
+ ### Get Data
507
+
508
+ Retrieve stored data:
509
+
510
+ ```javascript
511
+ // Get data by key
512
+ const value = cedarling.get_data_ctx("user:123");
513
+ if (value) {
514
+ console.log(`User roles: ${value.role}`);
515
+ }
516
+ ```
517
+
518
+ ### Get Data Entry with Metadata
519
+
520
+ Get a data entry with full metadata including creation time, expiration, access count, and type:
521
+
522
+ ```javascript
523
+ const entry = cedarling.get_data_entry_ctx("user:123");
524
+ if (entry) {
525
+ console.log(`Key: ${entry.key}`);
526
+ console.log(`Created at: ${entry.created_at}`);
527
+ console.log(`Access count: ${entry.access_count}`);
528
+ console.log(`Data type: ${entry.data_type}`);
529
+ console.log(`Value:`, entry.value);
530
+ }
531
+ ```
532
+
533
+ ### Remove Data
534
+
535
+ Remove a specific entry:
536
+
537
+ ```javascript
538
+ // Remove data by key
539
+ const removed = cedarling.remove_data_ctx("user:123");
540
+ if (removed) {
541
+ console.log("Entry was removed");
542
+ } else {
543
+ console.log("Entry did not exist");
544
+ }
545
+ ```
546
+
547
+ ### Clear All Data
548
+
549
+ Remove all entries from the data store:
550
+
551
+ ```javascript
552
+ cedarling.clear_data_ctx();
553
+ ```
554
+
555
+ ### List All Data
556
+
557
+ List all entries with their metadata:
558
+
559
+ ```javascript
560
+ const entries = cedarling.list_data_ctx();
561
+ entries.forEach(entry => {
562
+ console.log(`Key: ${entry.key}, Type: ${entry.data_type}, Created: ${entry.created_at}`);
563
+ });
564
+ ```
565
+
566
+ ### Get Statistics
567
+
568
+ Get statistics about the data store:
569
+
570
+ ```javascript
571
+ const stats = cedarling.get_stats_ctx();
572
+ console.log(`Entries: ${stats.entry_count}/${stats.max_entries}`);
573
+ console.log(`Total size: ${stats.total_size_bytes} bytes`);
574
+ console.log(`Capacity usage: ${stats.capacity_usage_percent}%`);
575
+ ```
576
+
577
+ ### Error Handling
578
+
579
+ The Context Data API methods throw errors for different error conditions:
580
+
581
+ ```javascript
582
+ try {
583
+ cedarling.push_data_ctx("", { data: "value" }); // Empty key
584
+ } catch (error) {
585
+ if (error.message.includes("InvalidKey")) {
586
+ console.log("Invalid key provided");
587
+ }
588
+ }
589
+
590
+ const value = cedarling.get_data_ctx("nonexistent");
591
+ if (value === null) {
592
+ console.log("Key not found");
593
+ }
594
+ ```
595
+
596
+ ### Using Data in Cedar Policies
597
+
598
+ Data pushed via the Context Data API is automatically available in Cedar policies under the `context.data` namespace:
599
+
600
+ ```cedar
601
+ permit(
602
+ principal,
603
+ action == Action::"read",
604
+ resource
605
+ ) when {
606
+ context.data["user:123"].role.contains("admin")
607
+ };
608
+ ```
609
+
610
+ The data is injected into the evaluation context before policy evaluation, allowing policies to make decisions based on dynamically pushed data.
@@ -84,6 +84,57 @@ export class Cedarling {
84
84
  * makes authorization decision based on the [`RequestUnsigned`]
85
85
  */
86
86
  authorize_unsigned(request: any): Promise<AuthorizeResult>;
87
+ /**
88
+ * Clear all entries from the data store.
89
+ *
90
+ * # Example
91
+ *
92
+ * ```javascript
93
+ * cedarling.clear_data_ctx();
94
+ * console.log("All data entries cleared");
95
+ * ```
96
+ */
97
+ clear_data_ctx(): void;
98
+ /**
99
+ * Get a value from the data store by key.
100
+ * Returns null if the key doesn't exist or the entry has expired.
101
+ *
102
+ * # Arguments
103
+ *
104
+ * * `key` - A string key for the data entry to retrieve
105
+ *
106
+ * # Example
107
+ *
108
+ * ```javascript
109
+ * const value = cedarling.get_data_ctx("user:123");
110
+ * if (value !== null) {
111
+ * console.log(value.name); // "John"
112
+ * }
113
+ * ```
114
+ */
115
+ get_data_ctx(key: string): any;
116
+ /**
117
+ * Get a data entry with full metadata by key.
118
+ * Returns null if the key doesn't exist or the entry has expired.
119
+ *
120
+ * # Arguments
121
+ *
122
+ * * `key` - A string key for the data entry to retrieve
123
+ *
124
+ * # Example
125
+ *
126
+ * ```javascript
127
+ * const entry = cedarling.get_data_entry_ctx("user:123");
128
+ * if (entry !== null) {
129
+ * console.log(entry.key); // "user:123"
130
+ * console.log(entry.value); // { name: "John", age: 30 }
131
+ * console.log(entry.data_type); // "Record"
132
+ * console.log(entry.created_at); // "2024-01-01T12:00:00Z"
133
+ * console.log(entry.access_count); // 5
134
+ * }
135
+ * ```
136
+ */
137
+ get_data_entry_ctx(key: string): DataEntry | undefined;
87
138
  /**
88
139
  * Get specific log entry.
89
140
  * Returns `Map` with values or `null`.
@@ -110,6 +161,33 @@ export class Cedarling {
110
161
  * Tag can be `log_kind`, `log_level`.
111
162
  */
112
163
  get_logs_by_tag(tag: string): any[];
164
+ /**
165
+ * Get statistics about the data store.
166
+ *
167
+ * # Example
168
+ *
169
+ * ```javascript
170
+ * const stats = cedarling.get_stats_ctx();
171
+ * console.log(`Entries: ${stats.entry_count}/${stats.max_entries || 'unlimited'}`);
172
+ * console.log(`Capacity: ${stats.capacity_usage_percent.toFixed(2)}%`);
173
+ * console.log(`Total size: ${stats.total_size_bytes} bytes`);
174
+ * ```
175
+ */
176
+ get_stats_ctx(): DataStoreStats;
177
+ /**
178
+ * List all entries with their metadata.
179
+ * Returns an array of DataEntry objects.
180
+ *
181
+ * # Example
182
+ *
183
+ * ```javascript
184
+ * const entries = cedarling.list_data_ctx();
185
+ * entries.forEach(entry => {
186
+ * console.log(`${entry.key}: ${entry.data_type} (accessed ${entry.access_count} times)`);
187
+ * });
188
+ * ```
189
+ */
190
+ list_data_ctx(): Array<any>;
113
191
  /**
114
192
  * Create a new instance of the Cedarling application.
115
193
  * Assume that config is `Object`
@@ -125,12 +203,141 @@ export class Cedarling {
125
203
  * Returns `Array` of `Map`
126
204
  */
127
205
  pop_logs(): Array<any>;
206
+ /**
207
+ * Push a value into the data store with an optional TTL.
208
+ * If the key already exists, the value will be replaced.
209
+ * If TTL is not provided, the default TTL from configuration is used.
210
+ *
211
+ * # Arguments
212
+ *
213
+ * * `key` - A string key for the data entry (must not be empty)
214
+ * * `value` - The value to store (any JSON-serializable JavaScript value: object, array, string, number, boolean)
215
+ * * `ttl_secs` - Optional TTL in seconds (undefined/null uses default from config)
216
+ *
217
+ * # Example
218
+ *
219
+ * ```javascript
220
+ * cedarling.push_data_ctx("user:123", { name: "John", age: 30 }, 3600);
221
+ * cedarling.push_data_ctx("config", { setting: "value" }); // Uses default TTL
222
+ * ```
223
+ */
224
+ push_data_ctx(key: string, value: any, ttl_secs?: bigint | null): void;
225
+ /**
226
+ * Remove a value from the data store by key.
227
+ * Returns true if the key existed and was removed, false otherwise.
228
+ *
229
+ * # Arguments
230
+ *
231
+ * * `key` - A string key for the data entry to remove
232
+ *
233
+ * # Example
234
+ *
235
+ * ```javascript
236
+ * const removed = cedarling.remove_data_ctx("user:123");
237
+ * if (removed) {
238
+ * console.log("Entry was successfully removed");
239
+ * }
240
+ * ```
241
+ */
242
+ remove_data_ctx(key: string): boolean;
128
243
  /**
129
244
  * Closes the connections to the Lock Server and pushes all available logs.
130
245
  */
131
246
  shut_down(): Promise<void>;
132
247
  }
133
248
 
249
+ /**
250
+ * A WASM wrapper for the Rust `cedarling::DataEntry` struct.
251
+ * Represents a data entry in the DataStore with value and metadata.
252
+ */
253
+ export class DataEntry {
254
+ private constructor();
255
+ free(): void;
256
+ [Symbol.dispose](): void;
257
+ /**
258
+ * Convert `DataEntry` to json string value
259
+ */
260
+ json_string(): string;
261
+ /**
262
+ * Get the value stored in this entry as a JavaScript object
263
+ */
264
+ value(): any;
265
+ /**
266
+ * Number of times this entry has been accessed
267
+ */
268
+ access_count: bigint;
269
+ /**
270
+ * Timestamp when this entry was created (RFC 3339 format)
271
+ */
272
+ created_at: string;
273
+ /**
274
+ * The inferred Cedar type of the value
275
+ */
276
+ data_type: string;
277
+ /**
278
+ * Timestamp when this entry expires (RFC 3339 format), or null if no TTL
279
+ */
280
+ get expires_at(): string | undefined;
281
+ /**
282
+ * Timestamp when this entry expires (RFC 3339 format), or null if no TTL
283
+ */
284
+ set expires_at(value: string | null | undefined);
285
+ /**
286
+ * The key for this entry
287
+ */
288
+ key: string;
289
+ }
290
+
291
+ /**
292
+ * A WASM wrapper for the Rust `cedarling::DataStoreStats` struct.
293
+ * Statistics about the DataStore.
294
+ */
295
+ export class DataStoreStats {
296
+ private constructor();
297
+ free(): void;
298
+ [Symbol.dispose](): void;
299
+ /**
300
+ * Convert `DataStoreStats` to json string value
301
+ */
302
+ json_string(): string;
303
+ /**
304
+ * Average size per entry in bytes (0 if no entries)
305
+ */
306
+ avg_entry_size_bytes: number;
307
+ /**
308
+ * Percentage of capacity used (0.0-100.0, based on entry count)
309
+ */
310
+ capacity_usage_percent: number;
311
+ /**
312
+ * Number of entries currently stored
313
+ */
314
+ entry_count: number;
315
+ /**
316
+ * Maximum number of entries allowed (0 = unlimited)
317
+ */
318
+ max_entries: number;
319
+ /**
320
+ * Maximum size per entry in bytes (0 = unlimited)
321
+ */
322
+ max_entry_size: number;
323
+ /**
324
+ * Memory usage threshold percentage (from config)
325
+ */
326
+ memory_alert_threshold: number;
327
+ /**
328
+ * Whether memory usage exceeds the alert threshold
329
+ */
330
+ memory_alert_triggered: boolean;
331
+ /**
332
+ * Whether metrics tracking is enabled
333
+ */
334
+ metrics_enabled: boolean;
335
+ /**
336
+ * Total size of all entries in bytes (approximate, based on JSON serialization)
337
+ */
338
+ total_size_bytes: number;
339
+ }
340
+
134
341
  /**
135
342
  * Diagnostics
136
343
  * ===========
@@ -227,3 +434,136 @@ export function init(config: any): Promise<Cedarling>;
227
434
  * ```
228
435
  */
229
436
  export function init_from_archive_bytes(config: any, archive_bytes: Uint8Array): Promise<Cedarling>;
437
+
438
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
439
+
440
+ export interface InitOutput {
441
+ readonly memory: WebAssembly.Memory;
442
+ readonly __wbg_cedarling_free: (a: number, b: number) => void;
443
+ readonly __wbg_multiissuerauthorizeresult_free: (a: number, b: number) => void;
444
+ readonly __wbg_get_multiissuerauthorizeresult_response: (a: number) => number;
445
+ readonly __wbg_set_multiissuerauthorizeresult_response: (a: number, b: number) => void;
446
+ readonly __wbg_get_multiissuerauthorizeresult_decision: (a: number) => number;
447
+ readonly __wbg_set_multiissuerauthorizeresult_decision: (a: number, b: number) => void;
448
+ readonly __wbg_get_multiissuerauthorizeresult_request_id: (a: number) => [number, number];
449
+ readonly __wbg_set_multiissuerauthorizeresult_request_id: (a: number, b: number, c: number) => void;
450
+ readonly multiissuerauthorizeresult_json_string: (a: number) => [number, number];
451
+ readonly init: (a: any) => any;
452
+ readonly init_from_archive_bytes: (a: any, b: any) => any;
453
+ readonly cedarling_new: (a: any) => any;
454
+ readonly cedarling_new_from_map: (a: any) => any;
455
+ readonly cedarling_authorize: (a: number, b: any) => any;
456
+ readonly cedarling_authorize_unsigned: (a: number, b: any) => any;
457
+ readonly cedarling_authorize_multi_issuer: (a: number, b: any) => any;
458
+ readonly cedarling_pop_logs: (a: number) => [number, number, number];
459
+ readonly cedarling_get_log_by_id: (a: number, b: number, c: number) => [number, number, number];
460
+ readonly cedarling_get_log_ids: (a: number) => any;
461
+ readonly cedarling_get_logs_by_tag: (a: number, b: number, c: number) => [number, number, number, number];
462
+ readonly cedarling_get_logs_by_request_id: (a: number, b: number, c: number) => [number, number, number, number];
463
+ readonly cedarling_get_logs_by_request_id_and_tag: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
464
+ readonly cedarling_shut_down: (a: number) => any;
465
+ readonly cedarling_push_data_ctx: (a: number, b: number, c: number, d: any, e: number, f: bigint) => [number, number];
466
+ readonly cedarling_get_data_ctx: (a: number, b: number, c: number) => [number, number, number];
467
+ readonly cedarling_get_data_entry_ctx: (a: number, b: number, c: number) => [number, number, number];
468
+ readonly cedarling_remove_data_ctx: (a: number, b: number, c: number) => [number, number, number];
469
+ readonly cedarling_clear_data_ctx: (a: number) => [number, number];
470
+ readonly cedarling_list_data_ctx: (a: number) => [number, number, number];
471
+ readonly cedarling_get_stats_ctx: (a: number) => [number, number, number];
472
+ readonly __wbg_authorizeresult_free: (a: number, b: number) => void;
473
+ readonly __wbg_get_authorizeresult_workload: (a: number) => number;
474
+ readonly __wbg_set_authorizeresult_workload: (a: number, b: number) => void;
475
+ readonly __wbg_get_authorizeresult_person: (a: number) => number;
476
+ readonly __wbg_set_authorizeresult_person: (a: number, b: number) => void;
477
+ readonly __wbg_get_authorizeresult_decision: (a: number) => number;
478
+ readonly __wbg_set_authorizeresult_decision: (a: number, b: number) => void;
479
+ readonly __wbg_get_authorizeresult_request_id: (a: number) => [number, number];
480
+ readonly __wbg_set_authorizeresult_request_id: (a: number, b: number, c: number) => void;
481
+ readonly authorizeresult_json_string: (a: number) => [number, number];
482
+ readonly authorizeresult_principal: (a: number, b: number, c: number) => number;
483
+ readonly __wbg_authorizeresultresponse_free: (a: number, b: number) => void;
484
+ readonly authorizeresultresponse_decision: (a: number) => number;
485
+ readonly authorizeresultresponse_diagnostics: (a: number) => number;
486
+ readonly __wbg_diagnostics_free: (a: number, b: number) => void;
487
+ readonly diagnostics_reason: (a: number) => [number, number];
488
+ readonly diagnostics_errors: (a: number) => [number, number];
489
+ readonly __wbg_policyevaluationerror_free: (a: number, b: number) => void;
490
+ readonly policyevaluationerror_id: (a: number) => [number, number];
491
+ readonly policyevaluationerror_error: (a: number) => [number, number];
492
+ readonly __wbg_dataentry_free: (a: number, b: number) => void;
493
+ readonly __wbg_get_dataentry_key: (a: number) => [number, number];
494
+ readonly __wbg_set_dataentry_key: (a: number, b: number, c: number) => void;
495
+ readonly __wbg_get_dataentry_data_type: (a: number) => [number, number];
496
+ readonly __wbg_set_dataentry_data_type: (a: number, b: number, c: number) => void;
497
+ readonly __wbg_get_dataentry_created_at: (a: number) => [number, number];
498
+ readonly __wbg_set_dataentry_created_at: (a: number, b: number, c: number) => void;
499
+ readonly __wbg_get_dataentry_expires_at: (a: number) => [number, number];
500
+ readonly __wbg_set_dataentry_expires_at: (a: number, b: number, c: number) => void;
501
+ readonly __wbg_get_dataentry_access_count: (a: number) => bigint;
502
+ readonly __wbg_set_dataentry_access_count: (a: number, b: bigint) => void;
503
+ readonly dataentry_value: (a: number) => [number, number, number];
504
+ readonly dataentry_json_string: (a: number) => [number, number];
505
+ readonly __wbg_datastorestats_free: (a: number, b: number) => void;
506
+ readonly __wbg_get_datastorestats_entry_count: (a: number) => number;
507
+ readonly __wbg_set_datastorestats_entry_count: (a: number, b: number) => void;
508
+ readonly __wbg_get_datastorestats_max_entries: (a: number) => number;
509
+ readonly __wbg_set_datastorestats_max_entries: (a: number, b: number) => void;
510
+ readonly __wbg_get_datastorestats_max_entry_size: (a: number) => number;
511
+ readonly __wbg_set_datastorestats_max_entry_size: (a: number, b: number) => void;
512
+ readonly __wbg_get_datastorestats_metrics_enabled: (a: number) => number;
513
+ readonly __wbg_set_datastorestats_metrics_enabled: (a: number, b: number) => void;
514
+ readonly __wbg_get_datastorestats_total_size_bytes: (a: number) => number;
515
+ readonly __wbg_set_datastorestats_total_size_bytes: (a: number, b: number) => void;
516
+ readonly __wbg_get_datastorestats_avg_entry_size_bytes: (a: number) => number;
517
+ readonly __wbg_set_datastorestats_avg_entry_size_bytes: (a: number, b: number) => void;
518
+ readonly __wbg_get_datastorestats_capacity_usage_percent: (a: number) => number;
519
+ readonly __wbg_set_datastorestats_capacity_usage_percent: (a: number, b: number) => void;
520
+ readonly __wbg_get_datastorestats_memory_alert_threshold: (a: number) => number;
521
+ readonly __wbg_set_datastorestats_memory_alert_threshold: (a: number, b: number) => void;
522
+ readonly __wbg_get_datastorestats_memory_alert_triggered: (a: number) => number;
523
+ readonly __wbg_set_datastorestats_memory_alert_triggered: (a: number, b: number) => void;
524
+ readonly datastorestats_json_string: (a: number) => [number, number];
525
+ readonly rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void;
526
+ readonly rust_zstd_wasm_shim_malloc: (a: number) => number;
527
+ readonly rust_zstd_wasm_shim_memcmp: (a: number, b: number, c: number) => number;
528
+ readonly rust_zstd_wasm_shim_calloc: (a: number, b: number) => number;
529
+ readonly rust_zstd_wasm_shim_free: (a: number) => void;
530
+ readonly rust_zstd_wasm_shim_memcpy: (a: number, b: number, c: number) => number;
531
+ readonly rust_zstd_wasm_shim_memmove: (a: number, b: number, c: number) => number;
532
+ readonly rust_zstd_wasm_shim_memset: (a: number, b: number, c: number) => number;
533
+ readonly wasm_bindgen__closure__destroy__haa2c8eeec983adf2: (a: number, b: number) => void;
534
+ readonly wasm_bindgen__closure__destroy__haf4358594d12c874: (a: number, b: number) => void;
535
+ readonly wasm_bindgen__convert__closures_____invoke__h1f90382e3f7fa14a: (a: number, b: number, c: any) => [number, number];
536
+ readonly wasm_bindgen__convert__closures_____invoke__h434e5a5fca11045c: (a: number, b: number, c: any, d: any) => void;
537
+ readonly wasm_bindgen__convert__closures_____invoke__h680f4b2480ae6141: (a: number, b: number) => void;
538
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
539
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
540
+ readonly __wbindgen_exn_store: (a: number) => void;
541
+ readonly __externref_table_alloc: () => number;
542
+ readonly __wbindgen_externrefs: WebAssembly.Table;
543
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
544
+ readonly __externref_table_dealloc: (a: number) => void;
545
+ readonly __externref_drop_slice: (a: number, b: number) => void;
546
+ readonly __wbindgen_start: () => void;
547
+ }
548
+
549
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
550
+
551
+ /**
552
+ * Instantiates the given `module`, which can either be bytes or
553
+ * a precompiled `WebAssembly.Module`.
554
+ *
555
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
556
+ *
557
+ * @returns {InitOutput}
558
+ */
559
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
560
+
561
+ /**
562
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
563
+ * for everything else, calls `WebAssembly.instantiate` directly.
564
+ *
565
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
566
+ *
567
+ * @returns {Promise<InitOutput>}
568
+ */
569
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;