@happyvertical/smrt-secrets 0.34.9 → 0.35.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,153 +1,149 @@
1
1
  {
2
2
  "version": "1.0.0",
3
- "timestamp": 1782329189998,
3
+ "timestamp": 1782330599956,
4
4
  "packageName": "@happyvertical/smrt-secrets",
5
- "packageVersion": "0.34.9",
5
+ "packageVersion": "0.35.0",
6
6
  "objects": {
7
- "@happyvertical/smrt-secrets:Secret": {
8
- "name": "secret",
9
- "className": "Secret",
10
- "qualifiedName": "@happyvertical/smrt-secrets:Secret",
11
- "collection": "secrets",
12
- "filePath": "/home/runner/_work/smrt/smrt/packages/secrets/src/models/Secret.ts",
7
+ "@happyvertical/smrt-secrets:SecretAuditLogCollection": {
8
+ "name": "secretauditlogcollection",
9
+ "className": "SecretAuditLogCollection",
10
+ "qualifiedName": "@happyvertical/smrt-secrets:SecretAuditLogCollection",
11
+ "collection": "secretauditlogs",
12
+ "filePath": "/home/runner/_work/smrt/smrt/packages/secrets/src/collections/SecretAuditLogCollection.ts",
13
13
  "packageName": "@happyvertical/smrt-secrets",
14
- "fields": {
15
- "tenantId": {
16
- "type": "text",
17
- "required": false,
18
- "default": "",
19
- "_meta": {
20
- "sqlType": "UUID",
21
- "__tenancy": {
22
- "isTenantIdField": true,
23
- "mode": "required",
24
- "field": "tenantId",
25
- "autoFilter": true,
26
- "autoPopulate": true,
27
- "allowSuperAdminBypass": false
28
- }
29
- }
30
- },
31
- "name": {
32
- "type": "text",
33
- "required": false,
34
- "default": ""
35
- },
36
- "description": {
37
- "type": "text",
38
- "required": false,
39
- "default": ""
40
- },
41
- "category": {
42
- "type": "text",
43
- "required": false,
44
- "default": ""
45
- },
46
- "encryptedValue": {
47
- "type": "text",
48
- "required": false,
49
- "default": ""
50
- },
51
- "keyVersion": {
52
- "type": "integer",
53
- "required": false,
54
- "default": 1
55
- },
56
- "status": {
57
- "type": "text",
58
- "required": false,
59
- "default": "active"
60
- },
61
- "expiresAt": {
62
- "type": "datetime",
63
- "required": false
64
- },
65
- "lastAccessedAt": {
66
- "type": "datetime",
67
- "required": false
68
- },
69
- "accessCount": {
70
- "type": "integer",
71
- "required": false,
72
- "default": 0
73
- },
74
- "metadata": {
75
- "type": "json",
76
- "required": false,
77
- "default": {}
78
- }
79
- },
14
+ "fields": {},
80
15
  "methods": {
81
- "isActive": {
82
- "name": "isActive",
83
- "async": false,
84
- "parameters": [],
85
- "returnType": "boolean",
16
+ "listLogs": {
17
+ "name": "listLogs",
18
+ "async": true,
19
+ "parameters": [
20
+ {
21
+ "name": "options",
22
+ "type": "ListAuditLogsOptions",
23
+ "optional": true
24
+ }
25
+ ],
26
+ "returnType": "Promise<SecretAuditLog[]>",
86
27
  "isStatic": false,
87
28
  "isPublic": true
88
29
  },
89
- "isExpired": {
90
- "name": "isExpired",
91
- "async": false,
92
- "parameters": [],
93
- "returnType": "boolean",
30
+ "getSecretHistory": {
31
+ "name": "getSecretHistory",
32
+ "async": true,
33
+ "parameters": [
34
+ {
35
+ "name": "secretName",
36
+ "type": "string",
37
+ "optional": false
38
+ },
39
+ {
40
+ "name": "limit",
41
+ "type": "number",
42
+ "optional": true
43
+ }
44
+ ],
45
+ "returnType": "Promise<SecretAuditLog[]>",
94
46
  "isStatic": false,
95
47
  "isPublic": true
96
48
  },
97
- "isUsable": {
98
- "name": "isUsable",
99
- "async": false,
100
- "parameters": [],
101
- "returnType": "boolean",
49
+ "getUserActivity": {
50
+ "name": "getUserActivity",
51
+ "async": true,
52
+ "parameters": [
53
+ {
54
+ "name": "userId",
55
+ "type": "string",
56
+ "optional": false
57
+ },
58
+ {
59
+ "name": "limit",
60
+ "type": "number",
61
+ "optional": true
62
+ }
63
+ ],
64
+ "returnType": "Promise<SecretAuditLog[]>",
102
65
  "isStatic": false,
103
66
  "isPublic": true
104
67
  },
105
- "recordAccess": {
106
- "name": "recordAccess",
107
- "async": false,
108
- "parameters": [],
109
- "returnType": "void",
68
+ "getRecentFailures": {
69
+ "name": "getRecentFailures",
70
+ "async": true,
71
+ "parameters": [
72
+ {
73
+ "name": "limit",
74
+ "type": "number",
75
+ "optional": true
76
+ }
77
+ ],
78
+ "returnType": "Promise<SecretAuditLog[]>",
110
79
  "isStatic": false,
111
80
  "isPublic": true
112
81
  },
113
- "disable": {
114
- "name": "disable",
115
- "async": false,
116
- "parameters": [],
117
- "returnType": "void",
82
+ "getRecentDenials": {
83
+ "name": "getRecentDenials",
84
+ "async": true,
85
+ "parameters": [
86
+ {
87
+ "name": "limit",
88
+ "type": "number",
89
+ "optional": true
90
+ }
91
+ ],
92
+ "returnType": "Promise<SecretAuditLog[]>",
118
93
  "isStatic": false,
119
94
  "isPublic": true
120
95
  },
121
- "enable": {
122
- "name": "enable",
123
- "async": false,
124
- "parameters": [],
125
- "returnType": "void",
96
+ "countByAction": {
97
+ "name": "countByAction",
98
+ "async": true,
99
+ "parameters": [
100
+ {
101
+ "name": "since",
102
+ "type": "Date",
103
+ "optional": true
104
+ }
105
+ ],
106
+ "returnType": "Promise<Record<SecretAuditAction, number>>",
126
107
  "isStatic": false,
127
108
  "isPublic": true
128
- }
129
- },
130
- "decoratorConfig": {
131
- "tenantScoped": true,
132
- "api": {
133
- "include": []
134
109
  },
135
- "mcp": {
136
- "include": []
110
+ "countByResult": {
111
+ "name": "countByResult",
112
+ "async": true,
113
+ "parameters": [
114
+ {
115
+ "name": "since",
116
+ "type": "Date",
117
+ "optional": true
118
+ }
119
+ ],
120
+ "returnType": "Promise<Record<SecretAuditResult, number>>",
121
+ "isStatic": false,
122
+ "isPublic": true
137
123
  },
138
- "cli": {
139
- "include": [
140
- "list"
124
+ "cleanup": {
125
+ "name": "cleanup",
126
+ "async": true,
127
+ "parameters": [
128
+ {
129
+ "name": "olderThanDays",
130
+ "type": "number",
131
+ "optional": true
132
+ }
141
133
  ],
142
- "skipApiCheck": true
134
+ "returnType": "Promise<number>",
135
+ "isStatic": false,
136
+ "isPublic": true
143
137
  }
144
138
  },
145
- "extends": "SmrtObject",
146
- "exportName": "Secret",
147
- "collectionExportName": "SecretCollection",
139
+ "decoratorConfig": {},
140
+ "extends": "SmrtCollection",
141
+ "extendsTypeArg": "SecretAuditLog",
142
+ "exportName": "SecretAuditLogCollection",
143
+ "collectionExportName": "SecretAuditLogCollectionCollection",
148
144
  "schema": {
149
- "tableName": "secrets",
150
- "ddl": "CREATE TABLE IF NOT EXISTS \"secrets\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT DEFAULT '',\n \"description\" TEXT DEFAULT '',\n \"category\" TEXT DEFAULT '',\n \"encrypted_value\" TEXT DEFAULT '',\n \"key_version\" INTEGER DEFAULT 1,\n \"status\" TEXT DEFAULT 'active',\n \"expires_at\" TIMESTAMP,\n \"last_accessed_at\" TIMESTAMP,\n \"access_count\" INTEGER DEFAULT 0,\n \"metadata\" JSON DEFAULT '{}'\n);",
145
+ "tableName": "secret_audit_log_collections",
146
+ "ddl": "CREATE TABLE IF NOT EXISTS \"secret_audit_log_collections\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
151
147
  "columns": {
152
148
  "id": {
153
149
  "type": "UUID",
@@ -173,81 +169,17 @@
173
169
  "type": "TIMESTAMP",
174
170
  "notNull": true,
175
171
  "default": "current_timestamp"
172
+ }
173
+ },
174
+ "indexes": [
175
+ {
176
+ "name": "secret_audit_log_collections_id_idx",
177
+ "columns": [
178
+ "id"
179
+ ]
176
180
  },
177
- "tenant_id": {
178
- "type": "UUID",
179
- "referenceKind": "tenantId",
180
- "notNull": false,
181
- "unique": false
182
- },
183
- "name": {
184
- "type": "TEXT",
185
- "notNull": false,
186
- "unique": false,
187
- "default": ""
188
- },
189
- "description": {
190
- "type": "TEXT",
191
- "notNull": false,
192
- "unique": false,
193
- "default": ""
194
- },
195
- "category": {
196
- "type": "TEXT",
197
- "notNull": false,
198
- "unique": false,
199
- "default": ""
200
- },
201
- "encrypted_value": {
202
- "type": "TEXT",
203
- "notNull": false,
204
- "unique": false,
205
- "default": ""
206
- },
207
- "key_version": {
208
- "type": "INTEGER",
209
- "notNull": false,
210
- "unique": false,
211
- "default": 1
212
- },
213
- "status": {
214
- "type": "TEXT",
215
- "notNull": false,
216
- "unique": false,
217
- "default": "active"
218
- },
219
- "expires_at": {
220
- "type": "TIMESTAMP",
221
- "notNull": false,
222
- "unique": false
223
- },
224
- "last_accessed_at": {
225
- "type": "TIMESTAMP",
226
- "notNull": false,
227
- "unique": false
228
- },
229
- "access_count": {
230
- "type": "INTEGER",
231
- "notNull": false,
232
- "unique": false,
233
- "default": 0
234
- },
235
- "metadata": {
236
- "type": "JSON",
237
- "notNull": false,
238
- "unique": false,
239
- "default": {}
240
- }
241
- },
242
- "indexes": [
243
181
  {
244
- "name": "secrets_id_idx",
245
- "columns": [
246
- "id"
247
- ]
248
- },
249
- {
250
- "name": "secrets_slug_context_idx",
182
+ "name": "secret_audit_log_collections_slug_context_idx",
251
183
  "columns": [
252
184
  "slug",
253
185
  "context"
@@ -255,144 +187,164 @@
255
187
  "unique": true
256
188
  }
257
189
  ],
258
- "version": "6298a980"
190
+ "version": "7bb61130"
259
191
  }
260
192
  },
261
- "@happyvertical/smrt-secrets:SecretAuditLog": {
262
- "name": "secretauditlog",
263
- "className": "SecretAuditLog",
264
- "qualifiedName": "@happyvertical/smrt-secrets:SecretAuditLog",
265
- "collection": "secretauditlogs",
266
- "filePath": "/home/runner/_work/smrt/smrt/packages/secrets/src/models/SecretAuditLog.ts",
193
+ "@happyvertical/smrt-secrets:SecretCollection": {
194
+ "name": "secretcollection",
195
+ "className": "SecretCollection",
196
+ "qualifiedName": "@happyvertical/smrt-secrets:SecretCollection",
197
+ "collection": "secrets",
198
+ "filePath": "/home/runner/_work/smrt/smrt/packages/secrets/src/collections/SecretCollection.ts",
267
199
  "packageName": "@happyvertical/smrt-secrets",
268
- "fields": {
269
- "tenantId": {
270
- "type": "text",
271
- "required": false,
272
- "_meta": {
273
- "sqlType": "UUID",
274
- "__tenancy": {
275
- "isTenantIdField": true,
276
- "mode": "required",
277
- "field": "tenantId",
278
- "autoFilter": true,
279
- "autoPopulate": true,
280
- "allowSuperAdminBypass": false
281
- }
282
- }
283
- },
284
- "secretId": {
285
- "type": "foreignKey",
286
- "required": false,
287
- "related": "Secret"
288
- },
289
- "secretName": {
290
- "type": "text",
291
- "required": false,
292
- "default": ""
293
- },
294
- "userId": {
295
- "type": "crossPackageRef",
296
- "required": false,
297
- "related": "@happyvertical/smrt-users:User"
298
- },
299
- "action": {
300
- "type": "text",
301
- "required": false,
302
- "default": "read"
303
- },
304
- "result": {
305
- "type": "text",
306
- "required": false,
307
- "default": "success"
308
- },
309
- "ipAddress": {
310
- "type": "text",
311
- "required": false,
312
- "default": ""
313
- },
314
- "userAgent": {
315
- "type": "text",
316
- "required": false,
317
- "default": ""
318
- },
319
- "details": {
320
- "type": "json",
321
- "required": false,
322
- "default": {}
323
- }
324
- },
200
+ "fields": {},
325
201
  "methods": {
326
- "isSuccess": {
327
- "name": "isSuccess",
328
- "async": false,
329
- "parameters": [],
330
- "returnType": "boolean",
202
+ "findByName": {
203
+ "name": "findByName",
204
+ "async": true,
205
+ "parameters": [
206
+ {
207
+ "name": "tenantId",
208
+ "type": "string",
209
+ "optional": false
210
+ },
211
+ {
212
+ "name": "name",
213
+ "type": "string",
214
+ "optional": false
215
+ }
216
+ ],
217
+ "returnType": "Promise<Secret | null>",
331
218
  "isStatic": false,
332
219
  "isPublic": true
333
220
  },
334
- "isFailure": {
335
- "name": "isFailure",
336
- "async": false,
337
- "parameters": [],
338
- "returnType": "boolean",
221
+ "listSecrets": {
222
+ "name": "listSecrets",
223
+ "async": true,
224
+ "parameters": [
225
+ {
226
+ "name": "tenantId",
227
+ "type": "string",
228
+ "optional": false
229
+ },
230
+ {
231
+ "name": "options",
232
+ "type": "ListSecretsOptions",
233
+ "optional": true
234
+ }
235
+ ],
236
+ "returnType": "Promise<Secret[]>",
339
237
  "isStatic": false,
340
238
  "isPublic": true
341
239
  },
342
- "isDenied": {
343
- "name": "isDenied",
344
- "async": false,
345
- "parameters": [],
346
- "returnType": "boolean",
240
+ "listActive": {
241
+ "name": "listActive",
242
+ "async": true,
243
+ "parameters": [
244
+ {
245
+ "name": "tenantId",
246
+ "type": "string",
247
+ "optional": false
248
+ }
249
+ ],
250
+ "returnType": "Promise<Secret[]>",
347
251
  "isStatic": false,
348
252
  "isPublic": true
349
253
  },
350
- "isReadAction": {
351
- "name": "isReadAction",
352
- "async": false,
353
- "parameters": [],
354
- "returnType": "boolean",
254
+ "listByCategory": {
255
+ "name": "listByCategory",
256
+ "async": true,
257
+ "parameters": [
258
+ {
259
+ "name": "tenantId",
260
+ "type": "string",
261
+ "optional": false
262
+ },
263
+ {
264
+ "name": "category",
265
+ "type": "string",
266
+ "optional": false
267
+ }
268
+ ],
269
+ "returnType": "Promise<Secret[]>",
355
270
  "isStatic": false,
356
271
  "isPublic": true
357
272
  },
358
- "isWriteAction": {
359
- "name": "isWriteAction",
360
- "async": false,
361
- "parameters": [],
362
- "returnType": "boolean",
273
+ "listExpiring": {
274
+ "name": "listExpiring",
275
+ "async": true,
276
+ "parameters": [
277
+ {
278
+ "name": "tenantId",
279
+ "type": "string",
280
+ "optional": false
281
+ },
282
+ {
283
+ "name": "daysAhead",
284
+ "type": "number",
285
+ "optional": true
286
+ }
287
+ ],
288
+ "returnType": "Promise<Secret[]>",
363
289
  "isStatic": false,
364
290
  "isPublic": true
365
291
  },
366
- "isKeyOperation": {
367
- "name": "isKeyOperation",
368
- "async": false,
369
- "parameters": [],
370
- "returnType": "boolean",
292
+ "getCategories": {
293
+ "name": "getCategories",
294
+ "async": true,
295
+ "parameters": [
296
+ {
297
+ "name": "tenantId",
298
+ "type": "string",
299
+ "optional": false
300
+ }
301
+ ],
302
+ "returnType": "Promise<string[]>",
371
303
  "isStatic": false,
372
304
  "isPublic": true
373
- }
374
- },
375
- "decoratorConfig": {
376
- "tenantScoped": true,
377
- "api": {
378
- "include": []
379
305
  },
380
- "mcp": {
381
- "include": []
306
+ "countByStatus": {
307
+ "name": "countByStatus",
308
+ "async": true,
309
+ "parameters": [
310
+ {
311
+ "name": "tenantId",
312
+ "type": "string",
313
+ "optional": false
314
+ }
315
+ ],
316
+ "returnType": "Promise<Record<SecretStatus, number>>",
317
+ "isStatic": false,
318
+ "isPublic": true
382
319
  },
383
- "cli": {
384
- "include": [
385
- "list"
320
+ "deleteByName": {
321
+ "name": "deleteByName",
322
+ "async": true,
323
+ "parameters": [
324
+ {
325
+ "name": "tenantId",
326
+ "type": "string",
327
+ "optional": false
328
+ },
329
+ {
330
+ "name": "name",
331
+ "type": "string",
332
+ "optional": false
333
+ }
386
334
  ],
387
- "skipApiCheck": true
335
+ "returnType": "Promise<boolean>",
336
+ "isStatic": false,
337
+ "isPublic": true
388
338
  }
389
339
  },
390
- "extends": "SmrtObject",
391
- "exportName": "SecretAuditLog",
392
- "collectionExportName": "SecretAuditLogCollection",
340
+ "decoratorConfig": {},
341
+ "extends": "SmrtCollection",
342
+ "extendsTypeArg": "Secret",
343
+ "exportName": "SecretCollection",
344
+ "collectionExportName": "SecretCollectionCollection",
393
345
  "schema": {
394
- "tableName": "secret_audit_logs",
395
- "ddl": "CREATE TABLE IF NOT EXISTS \"secret_audit_logs\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"secret_id\" UUID,\n \"secret_name\" TEXT DEFAULT '',\n \"user_id\" UUID,\n \"action\" TEXT DEFAULT 'read',\n \"result\" TEXT DEFAULT 'success',\n \"ip_address\" TEXT DEFAULT '',\n \"user_agent\" TEXT DEFAULT '',\n \"details\" JSON DEFAULT '{}'\n);",
346
+ "tableName": "secret_collections",
347
+ "ddl": "CREATE TABLE IF NOT EXISTS \"secret_collections\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
396
348
  "columns": {
397
349
  "id": {
398
350
  "type": "UUID",
@@ -418,71 +370,17 @@
418
370
  "type": "TIMESTAMP",
419
371
  "notNull": true,
420
372
  "default": "current_timestamp"
421
- },
422
- "tenant_id": {
423
- "type": "UUID",
424
- "referenceKind": "tenantId",
425
- "notNull": false,
426
- "unique": false
427
- },
428
- "secret_id": {
429
- "type": "UUID",
430
- "referenceKind": "foreignKey",
431
- "notNull": false,
432
- "unique": false
433
- },
434
- "secret_name": {
435
- "type": "TEXT",
436
- "notNull": false,
437
- "unique": false,
438
- "default": ""
439
- },
440
- "user_id": {
441
- "type": "UUID",
442
- "referenceKind": "crossPackageRef",
443
- "notNull": false,
444
- "unique": false
445
- },
446
- "action": {
447
- "type": "TEXT",
448
- "notNull": false,
449
- "unique": false,
450
- "default": "read"
451
- },
452
- "result": {
453
- "type": "TEXT",
454
- "notNull": false,
455
- "unique": false,
456
- "default": "success"
457
- },
458
- "ip_address": {
459
- "type": "TEXT",
460
- "notNull": false,
461
- "unique": false,
462
- "default": ""
463
- },
464
- "user_agent": {
465
- "type": "TEXT",
466
- "notNull": false,
467
- "unique": false,
468
- "default": ""
469
- },
470
- "details": {
471
- "type": "JSON",
472
- "notNull": false,
473
- "unique": false,
474
- "default": {}
475
373
  }
476
374
  },
477
375
  "indexes": [
478
376
  {
479
- "name": "secret_audit_logs_id_idx",
377
+ "name": "secret_collections_id_idx",
480
378
  "columns": [
481
379
  "id"
482
380
  ]
483
381
  },
484
382
  {
485
- "name": "secret_audit_logs_slug_context_idx",
383
+ "name": "secret_collections_slug_context_idx",
486
384
  "columns": [
487
385
  "slug",
488
386
  "context"
@@ -490,138 +388,131 @@
490
388
  "unique": true
491
389
  }
492
390
  ],
493
- "version": "af0d679d"
391
+ "version": "5f18a721"
494
392
  }
495
393
  },
496
- "@happyvertical/smrt-secrets:TenantKey": {
497
- "name": "tenantkey",
498
- "className": "TenantKey",
499
- "qualifiedName": "@happyvertical/smrt-secrets:TenantKey",
394
+ "@happyvertical/smrt-secrets:TenantKeyCollection": {
395
+ "name": "tenantkeycollection",
396
+ "className": "TenantKeyCollection",
397
+ "qualifiedName": "@happyvertical/smrt-secrets:TenantKeyCollection",
500
398
  "collection": "tenantkeys",
501
- "filePath": "/home/runner/_work/smrt/smrt/packages/secrets/src/models/TenantKey.ts",
399
+ "filePath": "/home/runner/_work/smrt/smrt/packages/secrets/src/collections/TenantKeyCollection.ts",
502
400
  "packageName": "@happyvertical/smrt-secrets",
503
- "fields": {
504
- "tenantId": {
505
- "type": "text",
506
- "required": false,
507
- "default": ""
508
- },
509
- "wrappedKey": {
510
- "type": "text",
511
- "required": false,
512
- "default": ""
513
- },
514
- "amkKeyId": {
515
- "type": "text",
516
- "required": false,
517
- "default": ""
518
- },
519
- "status": {
520
- "type": "text",
521
- "required": false,
522
- "default": "active"
523
- },
524
- "version": {
525
- "type": "integer",
526
- "required": false,
527
- "default": 1
528
- },
529
- "rotateAfter": {
530
- "type": "datetime",
531
- "required": false
532
- },
533
- "retiredAt": {
534
- "type": "datetime",
535
- "required": false
536
- }
537
- },
401
+ "fields": {},
538
402
  "methods": {
539
- "isActive": {
540
- "name": "isActive",
541
- "async": false,
542
- "parameters": [],
543
- "returnType": "boolean",
544
- "isStatic": false,
545
- "isPublic": true
546
- },
547
- "needsRotation": {
548
- "name": "needsRotation",
549
- "async": false,
550
- "parameters": [],
551
- "returnType": "boolean",
403
+ "getActiveKey": {
404
+ "name": "getActiveKey",
405
+ "async": true,
406
+ "parameters": [
407
+ {
408
+ "name": "tenantId",
409
+ "type": "string",
410
+ "optional": false
411
+ }
412
+ ],
413
+ "returnType": "Promise<TenantKey | null>",
552
414
  "isStatic": false,
553
415
  "isPublic": true
554
416
  },
555
- "isRetired": {
556
- "name": "isRetired",
557
- "async": false,
558
- "parameters": [],
559
- "returnType": "boolean",
417
+ "listKeyVersions": {
418
+ "name": "listKeyVersions",
419
+ "async": true,
420
+ "parameters": [
421
+ {
422
+ "name": "tenantId",
423
+ "type": "string",
424
+ "optional": false
425
+ }
426
+ ],
427
+ "returnType": "Promise<TenantKey[]>",
560
428
  "isStatic": false,
561
429
  "isPublic": true
562
430
  },
563
- "isCompromised": {
564
- "name": "isCompromised",
565
- "async": false,
566
- "parameters": [],
567
- "returnType": "boolean",
431
+ "getKeyVersion": {
432
+ "name": "getKeyVersion",
433
+ "async": true,
434
+ "parameters": [
435
+ {
436
+ "name": "tenantId",
437
+ "type": "string",
438
+ "optional": false
439
+ },
440
+ {
441
+ "name": "version",
442
+ "type": "number",
443
+ "optional": false
444
+ }
445
+ ],
446
+ "returnType": "Promise<TenantKey | null>",
568
447
  "isStatic": false,
569
448
  "isPublic": true
570
449
  },
571
- "canDecrypt": {
572
- "name": "canDecrypt",
573
- "async": false,
450
+ "findKeysNeedingRotation": {
451
+ "name": "findKeysNeedingRotation",
452
+ "async": true,
574
453
  "parameters": [],
575
- "returnType": "boolean",
454
+ "returnType": "Promise<TenantKey[]>",
576
455
  "isStatic": false,
577
456
  "isPublic": true
578
457
  },
579
- "canEncrypt": {
580
- "name": "canEncrypt",
581
- "async": false,
458
+ "listAllActiveKeys": {
459
+ "name": "listAllActiveKeys",
460
+ "async": true,
582
461
  "parameters": [],
583
- "returnType": "boolean",
462
+ "returnType": "Promise<TenantKey[]>",
584
463
  "isStatic": false,
585
464
  "isPublic": true
586
465
  },
587
- "retire": {
588
- "name": "retire",
589
- "async": false,
466
+ "countByStatus": {
467
+ "name": "countByStatus",
468
+ "async": true,
590
469
  "parameters": [],
591
- "returnType": "void",
470
+ "returnType": "Promise<Record<TenantKeyStatus, number>>",
592
471
  "isStatic": false,
593
472
  "isPublic": true
594
473
  },
595
474
  "markCompromised": {
596
475
  "name": "markCompromised",
597
- "async": false,
598
- "parameters": [],
599
- "returnType": "void",
476
+ "async": true,
477
+ "parameters": [
478
+ {
479
+ "name": "tenantId",
480
+ "type": "string",
481
+ "optional": false
482
+ },
483
+ {
484
+ "name": "keyId",
485
+ "type": "string",
486
+ "optional": false
487
+ }
488
+ ],
489
+ "returnType": "Promise<boolean>",
600
490
  "isStatic": false,
601
491
  "isPublic": true
602
- }
603
- },
604
- "decoratorConfig": {
605
- "api": {
606
- "include": []
607
- },
608
- "mcp": {
609
- "include": []
610
492
  },
611
- "cli": {
612
- "include": [
613
- "list",
614
- "get"
493
+ "cleanupRetiredKeys": {
494
+ "name": "cleanupRetiredKeys",
495
+ "async": true,
496
+ "parameters": [
497
+ {
498
+ "name": "olderThanDays",
499
+ "type": "number",
500
+ "optional": true
501
+ }
615
502
  ],
616
- "skipApiCheck": true
503
+ "returnType": "Promise<number>",
504
+ "isStatic": false,
505
+ "isPublic": true
617
506
  }
618
507
  },
619
- "extends": "SmrtObject",
620
- "exportName": "TenantKey",
621
- "collectionExportName": "TenantKeyCollection",
508
+ "decoratorConfig": {},
509
+ "extends": "SmrtCollection",
510
+ "extendsTypeArg": "TenantKey",
511
+ "exportName": "TenantKeyCollection",
512
+ "collectionExportName": "TenantKeyCollectionCollection",
622
513
  "schema": {
623
- "tableName": "tenant_keys",
624
- "ddl": "CREATE TABLE IF NOT EXISTS \"tenant_keys\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" TEXT DEFAULT '',\n \"wrapped_key\" TEXT DEFAULT '',\n \"amk_key_id\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'active',\n \"version\" INTEGER DEFAULT 1,\n \"rotate_after\" TIMESTAMP,\n \"retired_at\" TIMESTAMP\n);",
514
+ "tableName": "tenant_key_collections",
515
+ "ddl": "CREATE TABLE IF NOT EXISTS \"tenant_key_collections\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
625
516
  "columns": {
626
517
  "id": {
627
518
  "type": "UUID",
@@ -647,57 +538,17 @@
647
538
  "type": "TIMESTAMP",
648
539
  "notNull": true,
649
540
  "default": "current_timestamp"
650
- },
651
- "tenant_id": {
652
- "type": "TEXT",
653
- "notNull": false,
654
- "unique": false,
655
- "default": ""
656
- },
657
- "wrapped_key": {
658
- "type": "TEXT",
659
- "notNull": false,
660
- "unique": false,
661
- "default": ""
662
- },
663
- "amk_key_id": {
664
- "type": "TEXT",
665
- "notNull": false,
666
- "unique": false,
667
- "default": ""
668
- },
669
- "status": {
670
- "type": "TEXT",
671
- "notNull": false,
672
- "unique": false,
673
- "default": "active"
674
- },
675
- "version": {
676
- "type": "INTEGER",
677
- "notNull": false,
678
- "unique": false,
679
- "default": 1
680
- },
681
- "rotate_after": {
682
- "type": "TIMESTAMP",
683
- "notNull": false,
684
- "unique": false
685
- },
686
- "retired_at": {
687
- "type": "TIMESTAMP",
688
- "notNull": false,
689
- "unique": false
690
541
  }
691
542
  },
692
543
  "indexes": [
693
544
  {
694
- "name": "tenant_keys_id_idx",
545
+ "name": "tenant_key_collections_id_idx",
695
546
  "columns": [
696
547
  "id"
697
548
  ]
698
549
  },
699
550
  {
700
- "name": "tenant_keys_slug_context_idx",
551
+ "name": "tenant_key_collections_slug_context_idx",
701
552
  "columns": [
702
553
  "slug",
703
554
  "context"
@@ -705,149 +556,153 @@
705
556
  "unique": true
706
557
  }
707
558
  ],
708
- "version": "79fd7e46"
559
+ "version": "26616d13"
709
560
  }
710
561
  },
711
- "@happyvertical/smrt-secrets:SecretAuditLogCollection": {
712
- "name": "secretauditlogcollection",
713
- "className": "SecretAuditLogCollection",
714
- "qualifiedName": "@happyvertical/smrt-secrets:SecretAuditLogCollection",
715
- "collection": "secretauditlogs",
716
- "filePath": "/home/runner/_work/smrt/smrt/packages/secrets/src/collections/SecretAuditLogCollection.ts",
562
+ "@happyvertical/smrt-secrets:Secret": {
563
+ "name": "secret",
564
+ "className": "Secret",
565
+ "qualifiedName": "@happyvertical/smrt-secrets:Secret",
566
+ "collection": "secrets",
567
+ "filePath": "/home/runner/_work/smrt/smrt/packages/secrets/src/models/Secret.ts",
717
568
  "packageName": "@happyvertical/smrt-secrets",
718
- "fields": {},
719
- "methods": {
720
- "listLogs": {
721
- "name": "listLogs",
722
- "async": true,
723
- "parameters": [
724
- {
725
- "name": "options",
726
- "type": "ListAuditLogsOptions",
727
- "optional": true
569
+ "fields": {
570
+ "tenantId": {
571
+ "type": "text",
572
+ "required": false,
573
+ "default": "",
574
+ "_meta": {
575
+ "sqlType": "UUID",
576
+ "__tenancy": {
577
+ "isTenantIdField": true,
578
+ "mode": "required",
579
+ "field": "tenantId",
580
+ "autoFilter": true,
581
+ "autoPopulate": true,
582
+ "allowSuperAdminBypass": false
728
583
  }
729
- ],
730
- "returnType": "Promise<SecretAuditLog[]>",
584
+ }
585
+ },
586
+ "name": {
587
+ "type": "text",
588
+ "required": false,
589
+ "default": ""
590
+ },
591
+ "description": {
592
+ "type": "text",
593
+ "required": false,
594
+ "default": ""
595
+ },
596
+ "category": {
597
+ "type": "text",
598
+ "required": false,
599
+ "default": ""
600
+ },
601
+ "encryptedValue": {
602
+ "type": "text",
603
+ "required": false,
604
+ "default": ""
605
+ },
606
+ "keyVersion": {
607
+ "type": "integer",
608
+ "required": false,
609
+ "default": 1
610
+ },
611
+ "status": {
612
+ "type": "text",
613
+ "required": false,
614
+ "default": "active"
615
+ },
616
+ "expiresAt": {
617
+ "type": "datetime",
618
+ "required": false
619
+ },
620
+ "lastAccessedAt": {
621
+ "type": "datetime",
622
+ "required": false
623
+ },
624
+ "accessCount": {
625
+ "type": "integer",
626
+ "required": false,
627
+ "default": 0
628
+ },
629
+ "metadata": {
630
+ "type": "json",
631
+ "required": false,
632
+ "default": {}
633
+ }
634
+ },
635
+ "methods": {
636
+ "isActive": {
637
+ "name": "isActive",
638
+ "async": false,
639
+ "parameters": [],
640
+ "returnType": "boolean",
731
641
  "isStatic": false,
732
642
  "isPublic": true
733
643
  },
734
- "getSecretHistory": {
735
- "name": "getSecretHistory",
736
- "async": true,
737
- "parameters": [
738
- {
739
- "name": "secretName",
740
- "type": "string",
741
- "optional": false
742
- },
743
- {
744
- "name": "limit",
745
- "type": "number",
746
- "optional": true
747
- }
748
- ],
749
- "returnType": "Promise<SecretAuditLog[]>",
644
+ "isExpired": {
645
+ "name": "isExpired",
646
+ "async": false,
647
+ "parameters": [],
648
+ "returnType": "boolean",
750
649
  "isStatic": false,
751
650
  "isPublic": true
752
651
  },
753
- "getUserActivity": {
754
- "name": "getUserActivity",
755
- "async": true,
756
- "parameters": [
757
- {
758
- "name": "userId",
759
- "type": "string",
760
- "optional": false
761
- },
762
- {
763
- "name": "limit",
764
- "type": "number",
765
- "optional": true
766
- }
767
- ],
768
- "returnType": "Promise<SecretAuditLog[]>",
652
+ "isUsable": {
653
+ "name": "isUsable",
654
+ "async": false,
655
+ "parameters": [],
656
+ "returnType": "boolean",
769
657
  "isStatic": false,
770
658
  "isPublic": true
771
659
  },
772
- "getRecentFailures": {
773
- "name": "getRecentFailures",
774
- "async": true,
775
- "parameters": [
776
- {
777
- "name": "limit",
778
- "type": "number",
779
- "optional": true
780
- }
781
- ],
782
- "returnType": "Promise<SecretAuditLog[]>",
660
+ "recordAccess": {
661
+ "name": "recordAccess",
662
+ "async": false,
663
+ "parameters": [],
664
+ "returnType": "void",
783
665
  "isStatic": false,
784
666
  "isPublic": true
785
667
  },
786
- "getRecentDenials": {
787
- "name": "getRecentDenials",
788
- "async": true,
789
- "parameters": [
790
- {
791
- "name": "limit",
792
- "type": "number",
793
- "optional": true
794
- }
795
- ],
796
- "returnType": "Promise<SecretAuditLog[]>",
668
+ "disable": {
669
+ "name": "disable",
670
+ "async": false,
671
+ "parameters": [],
672
+ "returnType": "void",
797
673
  "isStatic": false,
798
674
  "isPublic": true
799
675
  },
800
- "countByAction": {
801
- "name": "countByAction",
802
- "async": true,
803
- "parameters": [
804
- {
805
- "name": "since",
806
- "type": "Date",
807
- "optional": true
808
- }
809
- ],
810
- "returnType": "Promise<Record<SecretAuditAction, number>>",
676
+ "enable": {
677
+ "name": "enable",
678
+ "async": false,
679
+ "parameters": [],
680
+ "returnType": "void",
811
681
  "isStatic": false,
812
682
  "isPublic": true
683
+ }
684
+ },
685
+ "decoratorConfig": {
686
+ "tenantScoped": true,
687
+ "api": {
688
+ "include": []
813
689
  },
814
- "countByResult": {
815
- "name": "countByResult",
816
- "async": true,
817
- "parameters": [
818
- {
819
- "name": "since",
820
- "type": "Date",
821
- "optional": true
822
- }
823
- ],
824
- "returnType": "Promise<Record<SecretAuditResult, number>>",
825
- "isStatic": false,
826
- "isPublic": true
690
+ "mcp": {
691
+ "include": []
827
692
  },
828
- "cleanup": {
829
- "name": "cleanup",
830
- "async": true,
831
- "parameters": [
832
- {
833
- "name": "olderThanDays",
834
- "type": "number",
835
- "optional": true
836
- }
693
+ "cli": {
694
+ "include": [
695
+ "list"
837
696
  ],
838
- "returnType": "Promise<number>",
839
- "isStatic": false,
840
- "isPublic": true
697
+ "skipApiCheck": true
841
698
  }
842
699
  },
843
- "decoratorConfig": {},
844
- "extends": "SmrtCollection",
845
- "extendsTypeArg": "SecretAuditLog",
846
- "exportName": "SecretAuditLogCollection",
847
- "collectionExportName": "SecretAuditLogCollectionCollection",
700
+ "extends": "SmrtObject",
701
+ "exportName": "Secret",
702
+ "collectionExportName": "SecretCollection",
848
703
  "schema": {
849
- "tableName": "secret_audit_log_collections",
850
- "ddl": "CREATE TABLE IF NOT EXISTS \"secret_audit_log_collections\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
704
+ "tableName": "secrets",
705
+ "ddl": "CREATE TABLE IF NOT EXISTS \"secrets\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT DEFAULT '',\n \"description\" TEXT DEFAULT '',\n \"category\" TEXT DEFAULT '',\n \"encrypted_value\" TEXT DEFAULT '',\n \"key_version\" INTEGER DEFAULT 1,\n \"status\" TEXT DEFAULT 'active',\n \"expires_at\" TIMESTAMP,\n \"last_accessed_at\" TIMESTAMP,\n \"access_count\" INTEGER DEFAULT 0,\n \"metadata\" JSON DEFAULT '{}'\n);",
851
706
  "columns": {
852
707
  "id": {
853
708
  "type": "UUID",
@@ -873,17 +728,81 @@
873
728
  "type": "TIMESTAMP",
874
729
  "notNull": true,
875
730
  "default": "current_timestamp"
731
+ },
732
+ "tenant_id": {
733
+ "type": "UUID",
734
+ "referenceKind": "tenantId",
735
+ "notNull": false,
736
+ "unique": false
737
+ },
738
+ "name": {
739
+ "type": "TEXT",
740
+ "notNull": false,
741
+ "unique": false,
742
+ "default": ""
743
+ },
744
+ "description": {
745
+ "type": "TEXT",
746
+ "notNull": false,
747
+ "unique": false,
748
+ "default": ""
749
+ },
750
+ "category": {
751
+ "type": "TEXT",
752
+ "notNull": false,
753
+ "unique": false,
754
+ "default": ""
755
+ },
756
+ "encrypted_value": {
757
+ "type": "TEXT",
758
+ "notNull": false,
759
+ "unique": false,
760
+ "default": ""
761
+ },
762
+ "key_version": {
763
+ "type": "INTEGER",
764
+ "notNull": false,
765
+ "unique": false,
766
+ "default": 1
767
+ },
768
+ "status": {
769
+ "type": "TEXT",
770
+ "notNull": false,
771
+ "unique": false,
772
+ "default": "active"
773
+ },
774
+ "expires_at": {
775
+ "type": "TIMESTAMP",
776
+ "notNull": false,
777
+ "unique": false
778
+ },
779
+ "last_accessed_at": {
780
+ "type": "TIMESTAMP",
781
+ "notNull": false,
782
+ "unique": false
783
+ },
784
+ "access_count": {
785
+ "type": "INTEGER",
786
+ "notNull": false,
787
+ "unique": false,
788
+ "default": 0
789
+ },
790
+ "metadata": {
791
+ "type": "JSON",
792
+ "notNull": false,
793
+ "unique": false,
794
+ "default": {}
876
795
  }
877
796
  },
878
797
  "indexes": [
879
798
  {
880
- "name": "secret_audit_log_collections_id_idx",
799
+ "name": "secrets_id_idx",
881
800
  "columns": [
882
801
  "id"
883
802
  ]
884
803
  },
885
804
  {
886
- "name": "secret_audit_log_collections_slug_context_idx",
805
+ "name": "secrets_slug_context_idx",
887
806
  "columns": [
888
807
  "slug",
889
808
  "context"
@@ -891,164 +810,144 @@
891
810
  "unique": true
892
811
  }
893
812
  ],
894
- "version": "7bb61130"
813
+ "version": "6298a980"
895
814
  }
896
815
  },
897
- "@happyvertical/smrt-secrets:SecretCollection": {
898
- "name": "secretcollection",
899
- "className": "SecretCollection",
900
- "qualifiedName": "@happyvertical/smrt-secrets:SecretCollection",
901
- "collection": "secrets",
902
- "filePath": "/home/runner/_work/smrt/smrt/packages/secrets/src/collections/SecretCollection.ts",
816
+ "@happyvertical/smrt-secrets:SecretAuditLog": {
817
+ "name": "secretauditlog",
818
+ "className": "SecretAuditLog",
819
+ "qualifiedName": "@happyvertical/smrt-secrets:SecretAuditLog",
820
+ "collection": "secretauditlogs",
821
+ "filePath": "/home/runner/_work/smrt/smrt/packages/secrets/src/models/SecretAuditLog.ts",
903
822
  "packageName": "@happyvertical/smrt-secrets",
904
- "fields": {},
823
+ "fields": {
824
+ "tenantId": {
825
+ "type": "text",
826
+ "required": false,
827
+ "_meta": {
828
+ "sqlType": "UUID",
829
+ "__tenancy": {
830
+ "isTenantIdField": true,
831
+ "mode": "required",
832
+ "field": "tenantId",
833
+ "autoFilter": true,
834
+ "autoPopulate": true,
835
+ "allowSuperAdminBypass": false
836
+ }
837
+ }
838
+ },
839
+ "secretId": {
840
+ "type": "foreignKey",
841
+ "required": false,
842
+ "related": "Secret"
843
+ },
844
+ "secretName": {
845
+ "type": "text",
846
+ "required": false,
847
+ "default": ""
848
+ },
849
+ "userId": {
850
+ "type": "crossPackageRef",
851
+ "required": false,
852
+ "related": "@happyvertical/smrt-users:User"
853
+ },
854
+ "action": {
855
+ "type": "text",
856
+ "required": false,
857
+ "default": "read"
858
+ },
859
+ "result": {
860
+ "type": "text",
861
+ "required": false,
862
+ "default": "success"
863
+ },
864
+ "ipAddress": {
865
+ "type": "text",
866
+ "required": false,
867
+ "default": ""
868
+ },
869
+ "userAgent": {
870
+ "type": "text",
871
+ "required": false,
872
+ "default": ""
873
+ },
874
+ "details": {
875
+ "type": "json",
876
+ "required": false,
877
+ "default": {}
878
+ }
879
+ },
905
880
  "methods": {
906
- "findByName": {
907
- "name": "findByName",
908
- "async": true,
909
- "parameters": [
910
- {
911
- "name": "tenantId",
912
- "type": "string",
913
- "optional": false
914
- },
915
- {
916
- "name": "name",
917
- "type": "string",
918
- "optional": false
919
- }
920
- ],
921
- "returnType": "Promise<Secret | null>",
881
+ "isSuccess": {
882
+ "name": "isSuccess",
883
+ "async": false,
884
+ "parameters": [],
885
+ "returnType": "boolean",
922
886
  "isStatic": false,
923
887
  "isPublic": true
924
888
  },
925
- "listSecrets": {
926
- "name": "listSecrets",
927
- "async": true,
928
- "parameters": [
929
- {
930
- "name": "tenantId",
931
- "type": "string",
932
- "optional": false
933
- },
934
- {
935
- "name": "options",
936
- "type": "ListSecretsOptions",
937
- "optional": true
938
- }
939
- ],
940
- "returnType": "Promise<Secret[]>",
889
+ "isFailure": {
890
+ "name": "isFailure",
891
+ "async": false,
892
+ "parameters": [],
893
+ "returnType": "boolean",
941
894
  "isStatic": false,
942
895
  "isPublic": true
943
896
  },
944
- "listActive": {
945
- "name": "listActive",
946
- "async": true,
947
- "parameters": [
948
- {
949
- "name": "tenantId",
950
- "type": "string",
951
- "optional": false
952
- }
953
- ],
954
- "returnType": "Promise<Secret[]>",
897
+ "isDenied": {
898
+ "name": "isDenied",
899
+ "async": false,
900
+ "parameters": [],
901
+ "returnType": "boolean",
955
902
  "isStatic": false,
956
903
  "isPublic": true
957
904
  },
958
- "listByCategory": {
959
- "name": "listByCategory",
960
- "async": true,
961
- "parameters": [
962
- {
963
- "name": "tenantId",
964
- "type": "string",
965
- "optional": false
966
- },
967
- {
968
- "name": "category",
969
- "type": "string",
970
- "optional": false
971
- }
972
- ],
973
- "returnType": "Promise<Secret[]>",
905
+ "isReadAction": {
906
+ "name": "isReadAction",
907
+ "async": false,
908
+ "parameters": [],
909
+ "returnType": "boolean",
974
910
  "isStatic": false,
975
911
  "isPublic": true
976
912
  },
977
- "listExpiring": {
978
- "name": "listExpiring",
979
- "async": true,
980
- "parameters": [
981
- {
982
- "name": "tenantId",
983
- "type": "string",
984
- "optional": false
985
- },
986
- {
987
- "name": "daysAhead",
988
- "type": "number",
989
- "optional": true
990
- }
991
- ],
992
- "returnType": "Promise<Secret[]>",
913
+ "isWriteAction": {
914
+ "name": "isWriteAction",
915
+ "async": false,
916
+ "parameters": [],
917
+ "returnType": "boolean",
993
918
  "isStatic": false,
994
919
  "isPublic": true
995
920
  },
996
- "getCategories": {
997
- "name": "getCategories",
998
- "async": true,
999
- "parameters": [
1000
- {
1001
- "name": "tenantId",
1002
- "type": "string",
1003
- "optional": false
1004
- }
1005
- ],
1006
- "returnType": "Promise<string[]>",
921
+ "isKeyOperation": {
922
+ "name": "isKeyOperation",
923
+ "async": false,
924
+ "parameters": [],
925
+ "returnType": "boolean",
1007
926
  "isStatic": false,
1008
927
  "isPublic": true
928
+ }
929
+ },
930
+ "decoratorConfig": {
931
+ "tenantScoped": true,
932
+ "api": {
933
+ "include": []
1009
934
  },
1010
- "countByStatus": {
1011
- "name": "countByStatus",
1012
- "async": true,
1013
- "parameters": [
1014
- {
1015
- "name": "tenantId",
1016
- "type": "string",
1017
- "optional": false
1018
- }
1019
- ],
1020
- "returnType": "Promise<Record<SecretStatus, number>>",
1021
- "isStatic": false,
1022
- "isPublic": true
935
+ "mcp": {
936
+ "include": []
1023
937
  },
1024
- "deleteByName": {
1025
- "name": "deleteByName",
1026
- "async": true,
1027
- "parameters": [
1028
- {
1029
- "name": "tenantId",
1030
- "type": "string",
1031
- "optional": false
1032
- },
1033
- {
1034
- "name": "name",
1035
- "type": "string",
1036
- "optional": false
1037
- }
938
+ "cli": {
939
+ "include": [
940
+ "list"
1038
941
  ],
1039
- "returnType": "Promise<boolean>",
1040
- "isStatic": false,
1041
- "isPublic": true
942
+ "skipApiCheck": true
1042
943
  }
1043
944
  },
1044
- "decoratorConfig": {},
1045
- "extends": "SmrtCollection",
1046
- "extendsTypeArg": "Secret",
1047
- "exportName": "SecretCollection",
1048
- "collectionExportName": "SecretCollectionCollection",
945
+ "extends": "SmrtObject",
946
+ "exportName": "SecretAuditLog",
947
+ "collectionExportName": "SecretAuditLogCollection",
1049
948
  "schema": {
1050
- "tableName": "secret_collections",
1051
- "ddl": "CREATE TABLE IF NOT EXISTS \"secret_collections\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
949
+ "tableName": "secret_audit_logs",
950
+ "ddl": "CREATE TABLE IF NOT EXISTS \"secret_audit_logs\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"secret_id\" UUID,\n \"secret_name\" TEXT DEFAULT '',\n \"user_id\" UUID,\n \"action\" TEXT DEFAULT 'read',\n \"result\" TEXT DEFAULT 'success',\n \"ip_address\" TEXT DEFAULT '',\n \"user_agent\" TEXT DEFAULT '',\n \"details\" JSON DEFAULT '{}'\n);",
1052
951
  "columns": {
1053
952
  "id": {
1054
953
  "type": "UUID",
@@ -1060,31 +959,85 @@
1060
959
  "type": "TEXT",
1061
960
  "notNull": true
1062
961
  },
1063
- "context": {
962
+ "context": {
963
+ "type": "TEXT",
964
+ "notNull": true,
965
+ "default": ""
966
+ },
967
+ "created_at": {
968
+ "type": "TIMESTAMP",
969
+ "notNull": true,
970
+ "default": "current_timestamp"
971
+ },
972
+ "updated_at": {
973
+ "type": "TIMESTAMP",
974
+ "notNull": true,
975
+ "default": "current_timestamp"
976
+ },
977
+ "tenant_id": {
978
+ "type": "UUID",
979
+ "referenceKind": "tenantId",
980
+ "notNull": false,
981
+ "unique": false
982
+ },
983
+ "secret_id": {
984
+ "type": "UUID",
985
+ "referenceKind": "foreignKey",
986
+ "notNull": false,
987
+ "unique": false
988
+ },
989
+ "secret_name": {
990
+ "type": "TEXT",
991
+ "notNull": false,
992
+ "unique": false,
993
+ "default": ""
994
+ },
995
+ "user_id": {
996
+ "type": "UUID",
997
+ "referenceKind": "crossPackageRef",
998
+ "notNull": false,
999
+ "unique": false
1000
+ },
1001
+ "action": {
1002
+ "type": "TEXT",
1003
+ "notNull": false,
1004
+ "unique": false,
1005
+ "default": "read"
1006
+ },
1007
+ "result": {
1008
+ "type": "TEXT",
1009
+ "notNull": false,
1010
+ "unique": false,
1011
+ "default": "success"
1012
+ },
1013
+ "ip_address": {
1014
+ "type": "TEXT",
1015
+ "notNull": false,
1016
+ "unique": false,
1017
+ "default": ""
1018
+ },
1019
+ "user_agent": {
1064
1020
  "type": "TEXT",
1065
- "notNull": true,
1021
+ "notNull": false,
1022
+ "unique": false,
1066
1023
  "default": ""
1067
1024
  },
1068
- "created_at": {
1069
- "type": "TIMESTAMP",
1070
- "notNull": true,
1071
- "default": "current_timestamp"
1072
- },
1073
- "updated_at": {
1074
- "type": "TIMESTAMP",
1075
- "notNull": true,
1076
- "default": "current_timestamp"
1025
+ "details": {
1026
+ "type": "JSON",
1027
+ "notNull": false,
1028
+ "unique": false,
1029
+ "default": {}
1077
1030
  }
1078
1031
  },
1079
1032
  "indexes": [
1080
1033
  {
1081
- "name": "secret_collections_id_idx",
1034
+ "name": "secret_audit_logs_id_idx",
1082
1035
  "columns": [
1083
1036
  "id"
1084
1037
  ]
1085
1038
  },
1086
1039
  {
1087
- "name": "secret_collections_slug_context_idx",
1040
+ "name": "secret_audit_logs_slug_context_idx",
1088
1041
  "columns": [
1089
1042
  "slug",
1090
1043
  "context"
@@ -1092,131 +1045,138 @@
1092
1045
  "unique": true
1093
1046
  }
1094
1047
  ],
1095
- "version": "5f18a721"
1048
+ "version": "af0d679d"
1096
1049
  }
1097
1050
  },
1098
- "@happyvertical/smrt-secrets:TenantKeyCollection": {
1099
- "name": "tenantkeycollection",
1100
- "className": "TenantKeyCollection",
1101
- "qualifiedName": "@happyvertical/smrt-secrets:TenantKeyCollection",
1051
+ "@happyvertical/smrt-secrets:TenantKey": {
1052
+ "name": "tenantkey",
1053
+ "className": "TenantKey",
1054
+ "qualifiedName": "@happyvertical/smrt-secrets:TenantKey",
1102
1055
  "collection": "tenantkeys",
1103
- "filePath": "/home/runner/_work/smrt/smrt/packages/secrets/src/collections/TenantKeyCollection.ts",
1056
+ "filePath": "/home/runner/_work/smrt/smrt/packages/secrets/src/models/TenantKey.ts",
1104
1057
  "packageName": "@happyvertical/smrt-secrets",
1105
- "fields": {},
1058
+ "fields": {
1059
+ "tenantId": {
1060
+ "type": "text",
1061
+ "required": false,
1062
+ "default": ""
1063
+ },
1064
+ "wrappedKey": {
1065
+ "type": "text",
1066
+ "required": false,
1067
+ "default": ""
1068
+ },
1069
+ "amkKeyId": {
1070
+ "type": "text",
1071
+ "required": false,
1072
+ "default": ""
1073
+ },
1074
+ "status": {
1075
+ "type": "text",
1076
+ "required": false,
1077
+ "default": "active"
1078
+ },
1079
+ "version": {
1080
+ "type": "integer",
1081
+ "required": false,
1082
+ "default": 1
1083
+ },
1084
+ "rotateAfter": {
1085
+ "type": "datetime",
1086
+ "required": false
1087
+ },
1088
+ "retiredAt": {
1089
+ "type": "datetime",
1090
+ "required": false
1091
+ }
1092
+ },
1106
1093
  "methods": {
1107
- "getActiveKey": {
1108
- "name": "getActiveKey",
1109
- "async": true,
1110
- "parameters": [
1111
- {
1112
- "name": "tenantId",
1113
- "type": "string",
1114
- "optional": false
1115
- }
1116
- ],
1117
- "returnType": "Promise<TenantKey | null>",
1094
+ "isActive": {
1095
+ "name": "isActive",
1096
+ "async": false,
1097
+ "parameters": [],
1098
+ "returnType": "boolean",
1118
1099
  "isStatic": false,
1119
1100
  "isPublic": true
1120
1101
  },
1121
- "listKeyVersions": {
1122
- "name": "listKeyVersions",
1123
- "async": true,
1124
- "parameters": [
1125
- {
1126
- "name": "tenantId",
1127
- "type": "string",
1128
- "optional": false
1129
- }
1130
- ],
1131
- "returnType": "Promise<TenantKey[]>",
1102
+ "needsRotation": {
1103
+ "name": "needsRotation",
1104
+ "async": false,
1105
+ "parameters": [],
1106
+ "returnType": "boolean",
1132
1107
  "isStatic": false,
1133
1108
  "isPublic": true
1134
1109
  },
1135
- "getKeyVersion": {
1136
- "name": "getKeyVersion",
1137
- "async": true,
1138
- "parameters": [
1139
- {
1140
- "name": "tenantId",
1141
- "type": "string",
1142
- "optional": false
1143
- },
1144
- {
1145
- "name": "version",
1146
- "type": "number",
1147
- "optional": false
1148
- }
1149
- ],
1150
- "returnType": "Promise<TenantKey | null>",
1110
+ "isRetired": {
1111
+ "name": "isRetired",
1112
+ "async": false,
1113
+ "parameters": [],
1114
+ "returnType": "boolean",
1151
1115
  "isStatic": false,
1152
1116
  "isPublic": true
1153
1117
  },
1154
- "findKeysNeedingRotation": {
1155
- "name": "findKeysNeedingRotation",
1156
- "async": true,
1118
+ "isCompromised": {
1119
+ "name": "isCompromised",
1120
+ "async": false,
1157
1121
  "parameters": [],
1158
- "returnType": "Promise<TenantKey[]>",
1122
+ "returnType": "boolean",
1159
1123
  "isStatic": false,
1160
1124
  "isPublic": true
1161
1125
  },
1162
- "listAllActiveKeys": {
1163
- "name": "listAllActiveKeys",
1164
- "async": true,
1126
+ "canDecrypt": {
1127
+ "name": "canDecrypt",
1128
+ "async": false,
1165
1129
  "parameters": [],
1166
- "returnType": "Promise<TenantKey[]>",
1130
+ "returnType": "boolean",
1167
1131
  "isStatic": false,
1168
1132
  "isPublic": true
1169
1133
  },
1170
- "countByStatus": {
1171
- "name": "countByStatus",
1172
- "async": true,
1134
+ "canEncrypt": {
1135
+ "name": "canEncrypt",
1136
+ "async": false,
1173
1137
  "parameters": [],
1174
- "returnType": "Promise<Record<TenantKeyStatus, number>>",
1138
+ "returnType": "boolean",
1139
+ "isStatic": false,
1140
+ "isPublic": true
1141
+ },
1142
+ "retire": {
1143
+ "name": "retire",
1144
+ "async": false,
1145
+ "parameters": [],
1146
+ "returnType": "void",
1175
1147
  "isStatic": false,
1176
1148
  "isPublic": true
1177
1149
  },
1178
1150
  "markCompromised": {
1179
1151
  "name": "markCompromised",
1180
- "async": true,
1181
- "parameters": [
1182
- {
1183
- "name": "tenantId",
1184
- "type": "string",
1185
- "optional": false
1186
- },
1187
- {
1188
- "name": "keyId",
1189
- "type": "string",
1190
- "optional": false
1191
- }
1192
- ],
1193
- "returnType": "Promise<boolean>",
1152
+ "async": false,
1153
+ "parameters": [],
1154
+ "returnType": "void",
1194
1155
  "isStatic": false,
1195
1156
  "isPublic": true
1157
+ }
1158
+ },
1159
+ "decoratorConfig": {
1160
+ "api": {
1161
+ "include": []
1196
1162
  },
1197
- "cleanupRetiredKeys": {
1198
- "name": "cleanupRetiredKeys",
1199
- "async": true,
1200
- "parameters": [
1201
- {
1202
- "name": "olderThanDays",
1203
- "type": "number",
1204
- "optional": true
1205
- }
1163
+ "mcp": {
1164
+ "include": []
1165
+ },
1166
+ "cli": {
1167
+ "include": [
1168
+ "list",
1169
+ "get"
1206
1170
  ],
1207
- "returnType": "Promise<number>",
1208
- "isStatic": false,
1209
- "isPublic": true
1171
+ "skipApiCheck": true
1210
1172
  }
1211
1173
  },
1212
- "decoratorConfig": {},
1213
- "extends": "SmrtCollection",
1214
- "extendsTypeArg": "TenantKey",
1215
- "exportName": "TenantKeyCollection",
1216
- "collectionExportName": "TenantKeyCollectionCollection",
1174
+ "extends": "SmrtObject",
1175
+ "exportName": "TenantKey",
1176
+ "collectionExportName": "TenantKeyCollection",
1217
1177
  "schema": {
1218
- "tableName": "tenant_key_collections",
1219
- "ddl": "CREATE TABLE IF NOT EXISTS \"tenant_key_collections\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
1178
+ "tableName": "tenant_keys",
1179
+ "ddl": "CREATE TABLE IF NOT EXISTS \"tenant_keys\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" TEXT DEFAULT '',\n \"wrapped_key\" TEXT DEFAULT '',\n \"amk_key_id\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'active',\n \"version\" INTEGER DEFAULT 1,\n \"rotate_after\" TIMESTAMP,\n \"retired_at\" TIMESTAMP\n);",
1220
1180
  "columns": {
1221
1181
  "id": {
1222
1182
  "type": "UUID",
@@ -1242,17 +1202,57 @@
1242
1202
  "type": "TIMESTAMP",
1243
1203
  "notNull": true,
1244
1204
  "default": "current_timestamp"
1205
+ },
1206
+ "tenant_id": {
1207
+ "type": "TEXT",
1208
+ "notNull": false,
1209
+ "unique": false,
1210
+ "default": ""
1211
+ },
1212
+ "wrapped_key": {
1213
+ "type": "TEXT",
1214
+ "notNull": false,
1215
+ "unique": false,
1216
+ "default": ""
1217
+ },
1218
+ "amk_key_id": {
1219
+ "type": "TEXT",
1220
+ "notNull": false,
1221
+ "unique": false,
1222
+ "default": ""
1223
+ },
1224
+ "status": {
1225
+ "type": "TEXT",
1226
+ "notNull": false,
1227
+ "unique": false,
1228
+ "default": "active"
1229
+ },
1230
+ "version": {
1231
+ "type": "INTEGER",
1232
+ "notNull": false,
1233
+ "unique": false,
1234
+ "default": 1
1235
+ },
1236
+ "rotate_after": {
1237
+ "type": "TIMESTAMP",
1238
+ "notNull": false,
1239
+ "unique": false
1240
+ },
1241
+ "retired_at": {
1242
+ "type": "TIMESTAMP",
1243
+ "notNull": false,
1244
+ "unique": false
1245
1245
  }
1246
1246
  },
1247
1247
  "indexes": [
1248
1248
  {
1249
- "name": "tenant_key_collections_id_idx",
1249
+ "name": "tenant_keys_id_idx",
1250
1250
  "columns": [
1251
1251
  "id"
1252
1252
  ]
1253
1253
  },
1254
1254
  {
1255
- "name": "tenant_key_collections_slug_context_idx",
1255
+ "name": "tenant_keys_slug_context_idx",
1256
1256
  "columns": [
1257
1257
  "slug",
1258
1258
  "context"
@@ -1260,7 +1260,7 @@
1260
1260
  "unique": true
1261
1261
  }
1262
1262
  ],
1263
- "version": "26616d13"
1263
+ "version": "79fd7e46"
1264
1264
  }
1265
1265
  }
1266
1266
  },