@happyvertical/smrt-secrets 0.51.12 → 0.51.14

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