@happyvertical/smrt-secrets 0.51.14 → 0.51.16

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,158 +2,226 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-secrets",
5
- "packageVersion": "0.51.14",
5
+ "packageVersion": "0.51.16",
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
14
+ "fields": {},
15
+ "methods": {
16
+ "listLogs": {
17
+ "name": "listLogs",
18
+ "async": true,
19
+ "parameters": [
20
+ {
21
+ "name": "options",
22
+ "type": "ListAuditLogsOptions",
23
+ "optional": true
28
24
  }
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
25
+ ],
26
+ "returnType": "Promise<SecretAuditLog[]>",
27
+ "isStatic": false,
28
+ "isPublic": true
68
29
  },
69
- "accessCount": {
70
- "type": "integer",
71
- "required": false,
72
- "default": 0
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
73
61
  },
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",
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[]>",
86
91
  "isStatic": false,
87
92
  "isPublic": true
88
93
  },
89
- "isExpired": {
90
- "name": "isExpired",
91
- "async": false,
92
- "parameters": [],
93
- "returnType": "boolean",
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[]>",
94
118
  "isStatic": false,
95
119
  "isPublic": true
96
120
  },
97
- "isUsable": {
98
- "name": "isUsable",
99
- "async": false,
100
- "parameters": [],
101
- "returnType": "boolean",
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[]>",
102
145
  "isStatic": false,
103
146
  "isPublic": true
104
147
  },
105
- "recordAccess": {
106
- "name": "recordAccess",
107
- "async": false,
108
- "parameters": [],
109
- "returnType": "void",
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>>",
110
172
  "isStatic": false,
111
173
  "isPublic": true
112
174
  },
113
- "disable": {
114
- "name": "disable",
115
- "async": false,
116
- "parameters": [],
117
- "returnType": "void",
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>>",
118
199
  "isStatic": false,
119
200
  "isPublic": true
120
201
  },
121
- "enable": {
122
- "name": "enable",
123
- "async": false,
124
- "parameters": [],
125
- "returnType": "void",
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>",
126
213
  "isStatic": false,
127
214
  "isPublic": true
128
215
  }
129
216
  },
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",
217
+ "decoratorConfig": {},
218
+ "extends": "SmrtCollection",
219
+ "extendsTypeArg": "SecretAuditLog",
220
+ "exportName": "SecretAuditLogCollection",
221
+ "collectionExportName": "SecretAuditLogCollectionCollection",
154
222
  "schema": {
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);",
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);",
157
225
  "columns": {
158
226
  "id": {
159
227
  "type": "UUID",
@@ -186,59 +254,49 @@
186
254
  "notNull": false,
187
255
  "unique": false
188
256
  },
189
- "name": {
190
- "type": "TEXT",
257
+ "secret_id": {
258
+ "type": "UUID",
259
+ "referenceKind": "foreignKey",
191
260
  "notNull": false,
192
- "unique": false,
193
- "default": ""
261
+ "unique": false
194
262
  },
195
- "description": {
263
+ "secret_name": {
196
264
  "type": "TEXT",
197
265
  "notNull": false,
198
266
  "unique": false,
199
267
  "default": ""
200
268
  },
201
- "category": {
202
- "type": "TEXT",
269
+ "user_id": {
270
+ "type": "UUID",
271
+ "referenceKind": "crossPackageRef",
203
272
  "notNull": false,
204
- "unique": false,
205
- "default": ""
273
+ "unique": false
206
274
  },
207
- "encrypted_value": {
275
+ "action": {
208
276
  "type": "TEXT",
209
277
  "notNull": false,
210
278
  "unique": false,
211
- "default": ""
279
+ "default": "read"
212
280
  },
213
- "key_version": {
214
- "type": "INTEGER",
281
+ "result": {
282
+ "type": "TEXT",
215
283
  "notNull": false,
216
284
  "unique": false,
217
- "default": 1
285
+ "default": "success"
218
286
  },
219
- "status": {
287
+ "ip_address": {
220
288
  "type": "TEXT",
221
289
  "notNull": false,
222
290
  "unique": false,
223
- "default": "active"
224
- },
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
291
+ "default": ""
234
292
  },
235
- "access_count": {
236
- "type": "INTEGER",
293
+ "user_agent": {
294
+ "type": "TEXT",
237
295
  "notNull": false,
238
296
  "unique": false,
239
- "default": 0
297
+ "default": ""
240
298
  },
241
- "metadata": {
299
+ "details": {
242
300
  "type": "JSON",
243
301
  "notNull": false,
244
302
  "unique": false,
@@ -247,7 +305,7 @@
247
305
  },
248
306
  "indexes": [
249
307
  {
250
- "name": "secrets_slug_context_idx",
308
+ "name": "secret_audit_logs_slug_context_idx",
251
309
  "columns": [
252
310
  "tenant_id",
253
311
  "slug",
@@ -257,160 +315,184 @@
257
315
  "nullsNotDistinct": true
258
316
  },
259
317
  {
260
- "name": "secrets_tenant_id_created_at_idx",
318
+ "name": "secret_audit_logs_tenant_id_created_at_idx",
261
319
  "columns": [
262
320
  "tenant_id",
263
321
  "created_at"
264
322
  ]
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
+ ]
265
335
  }
266
336
  ],
267
- "version": "6298a980"
337
+ "version": "af0d679d"
268
338
  },
269
- "importPath": "@happyvertical/smrt-secrets/models"
339
+ "importPath": "@happyvertical/smrt-secrets"
270
340
  },
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",
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",
277
347
  "packageName": "@happyvertical/smrt-secrets",
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
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
291
363
  }
292
- }
293
- },
294
- "secretId": {
295
- "type": "foreignKey",
296
- "required": false,
297
- "related": "Secret",
298
- "_meta": {
299
- "constraint": false
300
- }
301
- },
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": ""
364
+ ],
365
+ "returnType": "Promise<Secret | null>",
366
+ "isStatic": false,
367
+ "isPublic": true
331
368
  },
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",
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[]>",
344
385
  "isStatic": false,
345
386
  "isPublic": true
346
387
  },
347
- "isFailure": {
348
- "name": "isFailure",
349
- "async": false,
350
- "parameters": [],
351
- "returnType": "boolean",
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[]>",
352
399
  "isStatic": false,
353
400
  "isPublic": true
354
401
  },
355
- "isDenied": {
356
- "name": "isDenied",
357
- "async": false,
358
- "parameters": [],
359
- "returnType": "boolean",
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[]>",
360
418
  "isStatic": false,
361
419
  "isPublic": true
362
420
  },
363
- "isReadAction": {
364
- "name": "isReadAction",
365
- "async": false,
366
- "parameters": [],
367
- "returnType": "boolean",
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[]>",
368
437
  "isStatic": false,
369
438
  "isPublic": true
370
439
  },
371
- "isWriteAction": {
372
- "name": "isWriteAction",
373
- "async": false,
374
- "parameters": [],
375
- "returnType": "boolean",
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[]>",
376
451
  "isStatic": false,
377
452
  "isPublic": true
378
453
  },
379
- "isKeyOperation": {
380
- "name": "isKeyOperation",
381
- "async": false,
382
- "parameters": [],
383
- "returnType": "boolean",
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>>",
384
465
  "isStatic": false,
385
466
  "isPublic": true
386
- }
387
- },
388
- "decoratorConfig": {
389
- "tenantScoped": true,
390
- "api": {
391
- "include": []
392
- },
393
- "mcp": {
394
- "include": []
395
467
  },
396
- "cli": {
397
- "include": [
398
- "list"
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
+ }
399
482
  ],
400
- "skipApiCheck": true
401
- },
402
- "conflictColumns": [
403
- "tenant_id",
404
- "slug",
405
- "context"
406
- ]
483
+ "returnType": "Promise<boolean>",
484
+ "isStatic": false,
485
+ "isPublic": true
486
+ }
407
487
  },
408
- "extends": "SmrtObject",
409
- "exportName": "SecretAuditLog",
410
- "collectionExportName": "SecretAuditLogCollection",
488
+ "decoratorConfig": {},
489
+ "extends": "SmrtCollection",
490
+ "extendsTypeArg": "Secret",
491
+ "exportName": "SecretCollection",
492
+ "collectionExportName": "SecretCollectionCollection",
411
493
  "schema": {
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);",
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);",
414
496
  "columns": {
415
497
  "id": {
416
498
  "type": "UUID",
@@ -443,49 +525,59 @@
443
525
  "notNull": false,
444
526
  "unique": false
445
527
  },
446
- "secret_id": {
447
- "type": "UUID",
448
- "referenceKind": "foreignKey",
528
+ "name": {
529
+ "type": "TEXT",
449
530
  "notNull": false,
450
- "unique": false
531
+ "unique": false,
532
+ "default": ""
451
533
  },
452
- "secret_name": {
534
+ "description": {
453
535
  "type": "TEXT",
454
536
  "notNull": false,
455
537
  "unique": false,
456
538
  "default": ""
457
539
  },
458
- "user_id": {
459
- "type": "UUID",
460
- "referenceKind": "crossPackageRef",
540
+ "category": {
541
+ "type": "TEXT",
461
542
  "notNull": false,
462
- "unique": false
543
+ "unique": false,
544
+ "default": ""
463
545
  },
464
- "action": {
546
+ "encrypted_value": {
465
547
  "type": "TEXT",
466
548
  "notNull": false,
467
549
  "unique": false,
468
- "default": "read"
550
+ "default": ""
469
551
  },
470
- "result": {
471
- "type": "TEXT",
552
+ "key_version": {
553
+ "type": "INTEGER",
472
554
  "notNull": false,
473
555
  "unique": false,
474
- "default": "success"
556
+ "default": 1
475
557
  },
476
- "ip_address": {
558
+ "status": {
477
559
  "type": "TEXT",
478
560
  "notNull": false,
479
561
  "unique": false,
480
- "default": ""
562
+ "default": "active"
481
563
  },
482
- "user_agent": {
483
- "type": "TEXT",
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
573
+ },
574
+ "access_count": {
575
+ "type": "INTEGER",
484
576
  "notNull": false,
485
577
  "unique": false,
486
- "default": ""
578
+ "default": 0
487
579
  },
488
- "details": {
580
+ "metadata": {
489
581
  "type": "JSON",
490
582
  "notNull": false,
491
583
  "unique": false,
@@ -494,7 +586,7 @@
494
586
  },
495
587
  "indexes": [
496
588
  {
497
- "name": "secret_audit_logs_slug_context_idx",
589
+ "name": "secrets_slug_context_idx",
498
590
  "columns": [
499
591
  "tenant_id",
500
592
  "slug",
@@ -504,156 +596,136 @@
504
596
  "nullsNotDistinct": true
505
597
  },
506
598
  {
507
- "name": "secret_audit_logs_tenant_id_created_at_idx",
599
+ "name": "secrets_tenant_id_created_at_idx",
508
600
  "columns": [
509
601
  "tenant_id",
510
602
  "created_at"
511
603
  ]
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
- ]
524
604
  }
525
605
  ],
526
- "version": "af0d679d"
606
+ "version": "6298a980"
527
607
  },
528
- "importPath": "@happyvertical/smrt-secrets/models"
608
+ "importPath": "@happyvertical/smrt-secrets"
529
609
  },
530
- "@happyvertical/smrt-secrets:TenantKey": {
531
- "name": "tenantkey",
532
- "className": "TenantKey",
533
- "qualifiedName": "@happyvertical/smrt-secrets:TenantKey",
610
+ "@happyvertical/smrt-secrets:TenantKeyCollection": {
611
+ "name": "tenantkeycollection",
612
+ "className": "TenantKeyCollection",
613
+ "qualifiedName": "@happyvertical/smrt-secrets:TenantKeyCollection",
534
614
  "collection": "tenantkeys",
535
- "filePath": "/home/runner/work/smrt/smrt/packages/secrets/src/models/TenantKey.ts",
615
+ "filePath": "/home/runner/work/smrt/smrt/packages/secrets/src/collections/TenantKeyCollection.ts",
536
616
  "packageName": "@happyvertical/smrt-secrets",
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
- },
572
- "methods": {
573
- "isActive": {
574
- "name": "isActive",
575
- "async": false,
576
- "parameters": [],
577
- "returnType": "boolean",
578
- "isStatic": false,
579
- "isPublic": true
580
- },
581
- "needsRotation": {
582
- "name": "needsRotation",
583
- "async": false,
584
- "parameters": [],
585
- "returnType": "boolean",
617
+ "fields": {},
618
+ "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>",
586
630
  "isStatic": false,
587
631
  "isPublic": true
588
632
  },
589
- "isRetired": {
590
- "name": "isRetired",
591
- "async": false,
592
- "parameters": [],
593
- "returnType": "boolean",
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[]>",
594
644
  "isStatic": false,
595
645
  "isPublic": true
596
646
  },
597
- "isCompromised": {
598
- "name": "isCompromised",
599
- "async": false,
600
- "parameters": [],
601
- "returnType": "boolean",
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>",
602
663
  "isStatic": false,
603
664
  "isPublic": true
604
665
  },
605
- "canDecrypt": {
606
- "name": "canDecrypt",
607
- "async": false,
666
+ "findKeysNeedingRotation": {
667
+ "name": "findKeysNeedingRotation",
668
+ "async": true,
608
669
  "parameters": [],
609
- "returnType": "boolean",
670
+ "returnType": "Promise<TenantKey[]>",
610
671
  "isStatic": false,
611
672
  "isPublic": true
612
673
  },
613
- "canEncrypt": {
614
- "name": "canEncrypt",
615
- "async": false,
674
+ "listAllActiveKeys": {
675
+ "name": "listAllActiveKeys",
676
+ "async": true,
616
677
  "parameters": [],
617
- "returnType": "boolean",
678
+ "returnType": "Promise<TenantKey[]>",
618
679
  "isStatic": false,
619
680
  "isPublic": true
620
681
  },
621
- "retire": {
622
- "name": "retire",
623
- "async": false,
682
+ "countByStatus": {
683
+ "name": "countByStatus",
684
+ "async": true,
624
685
  "parameters": [],
625
- "returnType": "void",
686
+ "returnType": "Promise<Record<TenantKeyStatus, number>>",
626
687
  "isStatic": false,
627
688
  "isPublic": true
628
689
  },
629
690
  "markCompromised": {
630
691
  "name": "markCompromised",
631
- "async": false,
632
- "parameters": [],
633
- "returnType": "void",
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>",
634
706
  "isStatic": false,
635
707
  "isPublic": true
636
- }
637
- },
638
- "decoratorConfig": {
639
- "sensitive": true,
640
- "api": {
641
- "include": []
642
708
  },
643
- "mcp": {
644
- "include": []
645
- },
646
- "cli": {
647
- "include": [
648
- "list",
649
- "get"
709
+ "cleanupRetiredKeys": {
710
+ "name": "cleanupRetiredKeys",
711
+ "async": true,
712
+ "parameters": [
713
+ {
714
+ "name": "olderThanDays",
715
+ "type": "number",
716
+ "optional": true
717
+ }
650
718
  ],
651
- "skipApiCheck": true
719
+ "returnType": "Promise<number>",
720
+ "isStatic": false,
721
+ "isPublic": true
652
722
  }
653
723
  },
654
- "extends": "SmrtObject",
655
- "exportName": "TenantKey",
656
- "collectionExportName": "TenantKeyCollection",
724
+ "decoratorConfig": {},
725
+ "extends": "SmrtCollection",
726
+ "extendsTypeArg": "TenantKey",
727
+ "exportName": "TenantKeyCollection",
728
+ "collectionExportName": "TenantKeyCollectionCollection",
657
729
  "schema": {
658
730
  "tableName": "tenant_keys",
659
731
  "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);",
@@ -742,226 +814,158 @@
742
814
  ],
743
815
  "version": "79fd7e46"
744
816
  },
745
- "importPath": "@happyvertical/smrt-secrets/models"
817
+ "importPath": "@happyvertical/smrt-secrets"
746
818
  },
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",
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",
753
825
  "packageName": "@happyvertical/smrt-secrets",
754
- "fields": {},
755
- "methods": {
756
- "listLogs": {
757
- "name": "listLogs",
758
- "async": true,
759
- "parameters": [
760
- {
761
- "name": "options",
762
- "type": "ListAuditLogsOptions",
763
- "optional": true
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
764
840
  }
765
- ],
766
- "returnType": "Promise<SecretAuditLog[]>",
767
- "isStatic": false,
768
- "isPublic": true
841
+ }
769
842
  },
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
843
+ "name": {
844
+ "type": "text",
845
+ "required": false,
846
+ "default": ""
801
847
  },
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[]>",
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
880
+ },
881
+ "accessCount": {
882
+ "type": "integer",
883
+ "required": false,
884
+ "default": 0
885
+ },
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",
831
898
  "isStatic": false,
832
899
  "isPublic": true
833
900
  },
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[]>",
901
+ "isExpired": {
902
+ "name": "isExpired",
903
+ "async": false,
904
+ "parameters": [],
905
+ "returnType": "boolean",
858
906
  "isStatic": false,
859
907
  "isPublic": true
860
908
  },
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[]>",
909
+ "isUsable": {
910
+ "name": "isUsable",
911
+ "async": false,
912
+ "parameters": [],
913
+ "returnType": "boolean",
885
914
  "isStatic": false,
886
915
  "isPublic": true
887
916
  },
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>>",
917
+ "recordAccess": {
918
+ "name": "recordAccess",
919
+ "async": false,
920
+ "parameters": [],
921
+ "returnType": "void",
912
922
  "isStatic": false,
913
923
  "isPublic": true
914
924
  },
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>>",
925
+ "disable": {
926
+ "name": "disable",
927
+ "async": false,
928
+ "parameters": [],
929
+ "returnType": "void",
939
930
  "isStatic": false,
940
931
  "isPublic": true
941
932
  },
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>",
933
+ "enable": {
934
+ "name": "enable",
935
+ "async": false,
936
+ "parameters": [],
937
+ "returnType": "void",
953
938
  "isStatic": false,
954
939
  "isPublic": true
955
940
  }
956
941
  },
957
- "decoratorConfig": {},
958
- "extends": "SmrtCollection",
959
- "extendsTypeArg": "SecretAuditLog",
960
- "exportName": "SecretAuditLogCollection",
961
- "collectionExportName": "SecretAuditLogCollectionCollection",
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",
962
966
  "schema": {
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);",
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);",
965
969
  "columns": {
966
970
  "id": {
967
971
  "type": "UUID",
@@ -994,49 +998,59 @@
994
998
  "notNull": false,
995
999
  "unique": false
996
1000
  },
997
- "secret_id": {
998
- "type": "UUID",
999
- "referenceKind": "foreignKey",
1001
+ "name": {
1002
+ "type": "TEXT",
1000
1003
  "notNull": false,
1001
- "unique": false
1004
+ "unique": false,
1005
+ "default": ""
1002
1006
  },
1003
- "secret_name": {
1007
+ "description": {
1004
1008
  "type": "TEXT",
1005
1009
  "notNull": false,
1006
1010
  "unique": false,
1007
1011
  "default": ""
1008
1012
  },
1009
- "user_id": {
1010
- "type": "UUID",
1011
- "referenceKind": "crossPackageRef",
1013
+ "category": {
1014
+ "type": "TEXT",
1012
1015
  "notNull": false,
1013
- "unique": false
1016
+ "unique": false,
1017
+ "default": ""
1014
1018
  },
1015
- "action": {
1019
+ "encrypted_value": {
1016
1020
  "type": "TEXT",
1017
1021
  "notNull": false,
1018
1022
  "unique": false,
1019
- "default": "read"
1023
+ "default": ""
1020
1024
  },
1021
- "result": {
1022
- "type": "TEXT",
1025
+ "key_version": {
1026
+ "type": "INTEGER",
1023
1027
  "notNull": false,
1024
1028
  "unique": false,
1025
- "default": "success"
1029
+ "default": 1
1026
1030
  },
1027
- "ip_address": {
1031
+ "status": {
1028
1032
  "type": "TEXT",
1029
1033
  "notNull": false,
1030
1034
  "unique": false,
1031
- "default": ""
1035
+ "default": "active"
1032
1036
  },
1033
- "user_agent": {
1034
- "type": "TEXT",
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
1046
+ },
1047
+ "access_count": {
1048
+ "type": "INTEGER",
1035
1049
  "notNull": false,
1036
1050
  "unique": false,
1037
- "default": ""
1051
+ "default": 0
1038
1052
  },
1039
- "details": {
1053
+ "metadata": {
1040
1054
  "type": "JSON",
1041
1055
  "notNull": false,
1042
1056
  "unique": false,
@@ -1045,7 +1059,7 @@
1045
1059
  },
1046
1060
  "indexes": [
1047
1061
  {
1048
- "name": "secret_audit_logs_slug_context_idx",
1062
+ "name": "secrets_slug_context_idx",
1049
1063
  "columns": [
1050
1064
  "tenant_id",
1051
1065
  "slug",
@@ -1055,184 +1069,160 @@
1055
1069
  "nullsNotDistinct": true
1056
1070
  },
1057
1071
  {
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",
1072
+ "name": "secrets_tenant_id_created_at_idx",
1072
1073
  "columns": [
1073
- "user_id"
1074
+ "tenant_id",
1075
+ "created_at"
1074
1076
  ]
1075
1077
  }
1076
1078
  ],
1077
- "version": "af0d679d"
1079
+ "version": "6298a980"
1078
1080
  },
1079
- "importPath": "@happyvertical/smrt-secrets"
1081
+ "importPath": "@happyvertical/smrt-secrets/models"
1080
1082
  },
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",
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",
1087
1089
  "packageName": "@happyvertical/smrt-secrets",
1088
- "fields": {},
1089
- "methods": {
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
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
1103
  }
1104
- ],
1105
- "returnType": "Promise<Secret | null>",
1106
- "isStatic": false,
1107
- "isPublic": true
1104
+ }
1108
1105
  },
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[]>",
1125
- "isStatic": false,
1126
- "isPublic": true
1106
+ "secretId": {
1107
+ "type": "foreignKey",
1108
+ "required": false,
1109
+ "related": "Secret",
1110
+ "_meta": {
1111
+ "constraint": false
1112
+ }
1127
1113
  },
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[]>",
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
+ },
1150
+ "methods": {
1151
+ "isSuccess": {
1152
+ "name": "isSuccess",
1153
+ "async": false,
1154
+ "parameters": [],
1155
+ "returnType": "boolean",
1139
1156
  "isStatic": false,
1140
1157
  "isPublic": true
1141
1158
  },
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[]>",
1159
+ "isFailure": {
1160
+ "name": "isFailure",
1161
+ "async": false,
1162
+ "parameters": [],
1163
+ "returnType": "boolean",
1158
1164
  "isStatic": false,
1159
1165
  "isPublic": true
1160
1166
  },
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[]>",
1167
+ "isDenied": {
1168
+ "name": "isDenied",
1169
+ "async": false,
1170
+ "parameters": [],
1171
+ "returnType": "boolean",
1177
1172
  "isStatic": false,
1178
1173
  "isPublic": true
1179
1174
  },
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[]>",
1175
+ "isReadAction": {
1176
+ "name": "isReadAction",
1177
+ "async": false,
1178
+ "parameters": [],
1179
+ "returnType": "boolean",
1191
1180
  "isStatic": false,
1192
1181
  "isPublic": true
1193
1182
  },
1194
- "countByStatus": {
1195
- "name": "countByStatus",
1196
- "async": true,
1197
- "parameters": [
1198
- {
1199
- "name": "tenantId",
1200
- "type": "string",
1201
- "optional": false
1202
- }
1203
- ],
1204
- "returnType": "Promise<Record<SecretStatus, number>>",
1183
+ "isWriteAction": {
1184
+ "name": "isWriteAction",
1185
+ "async": false,
1186
+ "parameters": [],
1187
+ "returnType": "boolean",
1205
1188
  "isStatic": false,
1206
1189
  "isPublic": true
1207
1190
  },
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>",
1191
+ "isKeyOperation": {
1192
+ "name": "isKeyOperation",
1193
+ "async": false,
1194
+ "parameters": [],
1195
+ "returnType": "boolean",
1224
1196
  "isStatic": false,
1225
1197
  "isPublic": true
1226
1198
  }
1227
1199
  },
1228
- "decoratorConfig": {},
1229
- "extends": "SmrtCollection",
1230
- "extendsTypeArg": "Secret",
1231
- "exportName": "SecretCollection",
1232
- "collectionExportName": "SecretCollectionCollection",
1200
+ "decoratorConfig": {
1201
+ "tenantScoped": true,
1202
+ "api": {
1203
+ "include": []
1204
+ },
1205
+ "mcp": {
1206
+ "include": []
1207
+ },
1208
+ "cli": {
1209
+ "include": [
1210
+ "list"
1211
+ ],
1212
+ "skipApiCheck": true
1213
+ },
1214
+ "conflictColumns": [
1215
+ "tenant_id",
1216
+ "slug",
1217
+ "context"
1218
+ ]
1219
+ },
1220
+ "extends": "SmrtObject",
1221
+ "exportName": "SecretAuditLog",
1222
+ "collectionExportName": "SecretAuditLogCollection",
1233
1223
  "schema": {
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);",
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);",
1236
1226
  "columns": {
1237
1227
  "id": {
1238
1228
  "type": "UUID",
@@ -1265,59 +1255,49 @@
1265
1255
  "notNull": false,
1266
1256
  "unique": false
1267
1257
  },
1268
- "name": {
1269
- "type": "TEXT",
1258
+ "secret_id": {
1259
+ "type": "UUID",
1260
+ "referenceKind": "foreignKey",
1270
1261
  "notNull": false,
1271
- "unique": false,
1272
- "default": ""
1262
+ "unique": false
1273
1263
  },
1274
- "description": {
1264
+ "secret_name": {
1275
1265
  "type": "TEXT",
1276
1266
  "notNull": false,
1277
1267
  "unique": false,
1278
1268
  "default": ""
1279
1269
  },
1280
- "category": {
1281
- "type": "TEXT",
1270
+ "user_id": {
1271
+ "type": "UUID",
1272
+ "referenceKind": "crossPackageRef",
1282
1273
  "notNull": false,
1283
- "unique": false,
1284
- "default": ""
1274
+ "unique": false
1285
1275
  },
1286
- "encrypted_value": {
1276
+ "action": {
1287
1277
  "type": "TEXT",
1288
1278
  "notNull": false,
1289
1279
  "unique": false,
1290
- "default": ""
1280
+ "default": "read"
1291
1281
  },
1292
- "key_version": {
1293
- "type": "INTEGER",
1282
+ "result": {
1283
+ "type": "TEXT",
1294
1284
  "notNull": false,
1295
1285
  "unique": false,
1296
- "default": 1
1286
+ "default": "success"
1297
1287
  },
1298
- "status": {
1288
+ "ip_address": {
1299
1289
  "type": "TEXT",
1300
1290
  "notNull": false,
1301
1291
  "unique": false,
1302
- "default": "active"
1303
- },
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
1292
+ "default": ""
1313
1293
  },
1314
- "access_count": {
1315
- "type": "INTEGER",
1294
+ "user_agent": {
1295
+ "type": "TEXT",
1316
1296
  "notNull": false,
1317
1297
  "unique": false,
1318
- "default": 0
1298
+ "default": ""
1319
1299
  },
1320
- "metadata": {
1300
+ "details": {
1321
1301
  "type": "JSON",
1322
1302
  "notNull": false,
1323
1303
  "unique": false,
@@ -1326,7 +1306,7 @@
1326
1306
  },
1327
1307
  "indexes": [
1328
1308
  {
1329
- "name": "secrets_slug_context_idx",
1309
+ "name": "secret_audit_logs_slug_context_idx",
1330
1310
  "columns": [
1331
1311
  "tenant_id",
1332
1312
  "slug",
@@ -1336,136 +1316,156 @@
1336
1316
  "nullsNotDistinct": true
1337
1317
  },
1338
1318
  {
1339
- "name": "secrets_tenant_id_created_at_idx",
1319
+ "name": "secret_audit_logs_tenant_id_created_at_idx",
1340
1320
  "columns": [
1341
1321
  "tenant_id",
1342
1322
  "created_at"
1343
1323
  ]
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
+ ]
1344
1336
  }
1345
1337
  ],
1346
- "version": "6298a980"
1338
+ "version": "af0d679d"
1347
1339
  },
1348
- "importPath": "@happyvertical/smrt-secrets"
1340
+ "importPath": "@happyvertical/smrt-secrets/models"
1349
1341
  },
1350
- "@happyvertical/smrt-secrets:TenantKeyCollection": {
1351
- "name": "tenantkeycollection",
1352
- "className": "TenantKeyCollection",
1353
- "qualifiedName": "@happyvertical/smrt-secrets:TenantKeyCollection",
1342
+ "@happyvertical/smrt-secrets:TenantKey": {
1343
+ "name": "tenantkey",
1344
+ "className": "TenantKey",
1345
+ "qualifiedName": "@happyvertical/smrt-secrets:TenantKey",
1354
1346
  "collection": "tenantkeys",
1355
- "filePath": "/home/runner/work/smrt/smrt/packages/secrets/src/collections/TenantKeyCollection.ts",
1347
+ "filePath": "/home/runner/work/smrt/smrt/packages/secrets/src/models/TenantKey.ts",
1356
1348
  "packageName": "@happyvertical/smrt-secrets",
1357
- "fields": {},
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
+ },
1358
1384
  "methods": {
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>",
1385
+ "isActive": {
1386
+ "name": "isActive",
1387
+ "async": false,
1388
+ "parameters": [],
1389
+ "returnType": "boolean",
1370
1390
  "isStatic": false,
1371
1391
  "isPublic": true
1372
1392
  },
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[]>",
1393
+ "needsRotation": {
1394
+ "name": "needsRotation",
1395
+ "async": false,
1396
+ "parameters": [],
1397
+ "returnType": "boolean",
1384
1398
  "isStatic": false,
1385
1399
  "isPublic": true
1386
1400
  },
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>",
1401
+ "isRetired": {
1402
+ "name": "isRetired",
1403
+ "async": false,
1404
+ "parameters": [],
1405
+ "returnType": "boolean",
1403
1406
  "isStatic": false,
1404
1407
  "isPublic": true
1405
1408
  },
1406
- "findKeysNeedingRotation": {
1407
- "name": "findKeysNeedingRotation",
1408
- "async": true,
1409
+ "isCompromised": {
1410
+ "name": "isCompromised",
1411
+ "async": false,
1409
1412
  "parameters": [],
1410
- "returnType": "Promise<TenantKey[]>",
1413
+ "returnType": "boolean",
1411
1414
  "isStatic": false,
1412
1415
  "isPublic": true
1413
1416
  },
1414
- "listAllActiveKeys": {
1415
- "name": "listAllActiveKeys",
1416
- "async": true,
1417
+ "canDecrypt": {
1418
+ "name": "canDecrypt",
1419
+ "async": false,
1417
1420
  "parameters": [],
1418
- "returnType": "Promise<TenantKey[]>",
1421
+ "returnType": "boolean",
1419
1422
  "isStatic": false,
1420
1423
  "isPublic": true
1421
1424
  },
1422
- "countByStatus": {
1423
- "name": "countByStatus",
1424
- "async": true,
1425
+ "canEncrypt": {
1426
+ "name": "canEncrypt",
1427
+ "async": false,
1425
1428
  "parameters": [],
1426
- "returnType": "Promise<Record<TenantKeyStatus, number>>",
1429
+ "returnType": "boolean",
1430
+ "isStatic": false,
1431
+ "isPublic": true
1432
+ },
1433
+ "retire": {
1434
+ "name": "retire",
1435
+ "async": false,
1436
+ "parameters": [],
1437
+ "returnType": "void",
1427
1438
  "isStatic": false,
1428
1439
  "isPublic": true
1429
1440
  },
1430
1441
  "markCompromised": {
1431
1442
  "name": "markCompromised",
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>",
1443
+ "async": false,
1444
+ "parameters": [],
1445
+ "returnType": "void",
1446
1446
  "isStatic": false,
1447
1447
  "isPublic": true
1448
+ }
1449
+ },
1450
+ "decoratorConfig": {
1451
+ "sensitive": true,
1452
+ "api": {
1453
+ "include": []
1448
1454
  },
1449
- "cleanupRetiredKeys": {
1450
- "name": "cleanupRetiredKeys",
1451
- "async": true,
1452
- "parameters": [
1453
- {
1454
- "name": "olderThanDays",
1455
- "type": "number",
1456
- "optional": true
1457
- }
1455
+ "mcp": {
1456
+ "include": []
1457
+ },
1458
+ "cli": {
1459
+ "include": [
1460
+ "list",
1461
+ "get"
1458
1462
  ],
1459
- "returnType": "Promise<number>",
1460
- "isStatic": false,
1461
- "isPublic": true
1463
+ "skipApiCheck": true
1462
1464
  }
1463
1465
  },
1464
- "decoratorConfig": {},
1465
- "extends": "SmrtCollection",
1466
- "extendsTypeArg": "TenantKey",
1467
- "exportName": "TenantKeyCollection",
1468
- "collectionExportName": "TenantKeyCollectionCollection",
1466
+ "extends": "SmrtObject",
1467
+ "exportName": "TenantKey",
1468
+ "collectionExportName": "TenantKeyCollection",
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"
1557
+ "importPath": "@happyvertical/smrt-secrets/models"
1558
1558
  }
1559
1559
  },
1560
1560
  "moduleType": "smrt",