@janssenproject/cedarling_wasm 0.0.315-nodejs → 0.0.316-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 +273 -0
- package/cedarling_wasm.d.ts +207 -0
- package/cedarling_wasm.js +649 -123
- package/cedarling_wasm_bg.wasm +0 -0
- package/package.json +1 -1
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.
|
package/cedarling_wasm.d.ts
CHANGED
|
@@ -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
|
* ===========
|