@happyvertical/smrt-secrets 0.40.42 → 0.40.44

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