@happyvertical/smrt-secrets 0.49.5 → 0.49.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { i as createAuditEntry, n as Secret, r as SecretAuditLog, t as TenantKey } from "./chunks/TenantKey-M7lrY-vo.js";
2
- import { a as SecretAuditLogCollection, i as SecretCollection, n as SecretService, r as TenantKeyCollection, t as SecretKeyDriftError } from "./chunks/SecretService-C9Rlmwus.js";
1
+ import { i as createAuditEntry, n as Secret, r as SecretAuditLog, t as TenantKey } from "./chunks/TenantKey-C4R27-v-.js";
2
+ import { a as SecretAuditLogCollection, i as SecretCollection, n as SecretService, r as TenantKeyCollection, t as SecretKeyDriftError } from "./chunks/SecretService-DcUfuqqx.js";
3
3
  import { AMKUnavailableError, DecryptionError, EncryptionError, InvalidKeyFormatError, KeyNotFoundError, KeyRotationError, SecretError, StoreNotInitializedError, TenantKeyMissingError } from "@happyvertical/secrets";
4
4
  //#region src/index.ts
5
5
  /** @internal */
@@ -2,7 +2,7 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-secrets",
5
- "packageVersion": "0.49.5",
5
+ "packageVersion": "0.49.7",
6
6
  "objects": {
7
7
  "@happyvertical/smrt-secrets:SecretAuditLogCollection": {
8
8
  "name": "secretauditlogcollection",
@@ -335,7 +335,8 @@
335
335
  }
336
336
  ],
337
337
  "version": "af0d679d"
338
- }
338
+ },
339
+ "importPath": "@happyvertical/smrt-secrets"
339
340
  },
340
341
  "@happyvertical/smrt-secrets:SecretCollection": {
341
342
  "name": "secretcollection",
@@ -603,7 +604,8 @@
603
604
  }
604
605
  ],
605
606
  "version": "6298a980"
606
- }
607
+ },
608
+ "importPath": "@happyvertical/smrt-secrets"
607
609
  },
608
610
  "@happyvertical/smrt-secrets:TenantKeyCollection": {
609
611
  "name": "tenantkeycollection",
@@ -811,7 +813,8 @@
811
813
  }
812
814
  ],
813
815
  "version": "79fd7e46"
814
- }
816
+ },
817
+ "importPath": "@happyvertical/smrt-secrets"
815
818
  },
816
819
  "@happyvertical/smrt-secrets:Secret": {
817
820
  "name": "secret",
@@ -1073,7 +1076,8 @@
1073
1076
  }
1074
1077
  ],
1075
1078
  "version": "6298a980"
1076
- }
1079
+ },
1080
+ "importPath": "@happyvertical/smrt-secrets/models"
1077
1081
  },
1078
1082
  "@happyvertical/smrt-secrets:SecretAuditLog": {
1079
1083
  "name": "secretauditlog",
@@ -1331,7 +1335,8 @@
1331
1335
  }
1332
1336
  ],
1333
1337
  "version": "af0d679d"
1334
- }
1338
+ },
1339
+ "importPath": "@happyvertical/smrt-secrets/models"
1335
1340
  },
1336
1341
  "@happyvertical/smrt-secrets:TenantKey": {
1337
1342
  "name": "tenantkey",
@@ -1546,7 +1551,8 @@
1546
1551
  }
1547
1552
  ],
1548
1553
  "version": "79fd7e46"
1549
- }
1554
+ },
1555
+ "importPath": "@happyvertical/smrt-secrets/models"
1550
1556
  }
1551
1557
  },
1552
1558
  "moduleType": "smrt",
@@ -1,2 +1,2 @@
1
- import { i as createAuditEntry, n as Secret, r as SecretAuditLog, t as TenantKey } from "../chunks/TenantKey-M7lrY-vo.js";
1
+ import { i as createAuditEntry, n as Secret, r as SecretAuditLog, t as TenantKey } from "../chunks/TenantKey-C4R27-v-.js";
2
2
  export { Secret, SecretAuditLog, TenantKey, createAuditEntry };
@@ -1,2 +1,2 @@
1
- import { n as SecretService, t as SecretKeyDriftError } from "../chunks/SecretService-C9Rlmwus.js";
1
+ import { n as SecretService, t as SecretKeyDriftError } from "../chunks/SecretService-DcUfuqqx.js";
2
2
  export { SecretKeyDriftError, SecretService };
@@ -3,12 +3,12 @@
3
3
  "sensitiveFieldsExcluded": true,
4
4
  "generatedAt": "1970-01-01T00:00:00.000Z",
5
5
  "packageName": "@happyvertical/smrt-secrets",
6
- "packageVersion": "0.49.5",
6
+ "packageVersion": "0.49.7",
7
7
  "sourceManifestPath": "dist/manifest.json",
8
8
  "agentDocPath": "AGENTS.md",
9
9
  "sourceHashes": {
10
- "manifest": "455343814099cdfff6ca2643d3c1280fce7597338a3148bbd301a0b0f042c9a3",
11
- "packageJson": "09d239fd619dec0d0a5ee922e7d12e2553c0a139f89d80fde319fadcbf7c7b64",
10
+ "manifest": "b21330262080600403dcc4e55ad0ef8e0412255550923cc0bded1442b5464b3e",
11
+ "packageJson": "1f5b4a18c457db854fc09f7305acd0193a1ee7a40f24d6e2995129f6511c1daa",
12
12
  "agents": "96fe8095cb8a2673fb8752fdc2940b53ce09d83c42715396ba6812ce215e990b"
13
13
  },
14
14
  "exports": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-secrets",
3
- "version": "0.49.5",
3
+ "version": "0.49.7",
4
4
  "description": "Per-tenant secret management with envelope encryption for SMRT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -29,13 +29,13 @@
29
29
  "dependencies": {
30
30
  "@happyvertical/logger": "^0.89.6",
31
31
  "@happyvertical/secrets": "^0.89.6",
32
- "@happyvertical/smrt-core": "0.49.5",
33
- "@happyvertical/smrt-tenancy": "0.49.5",
32
+ "@happyvertical/smrt-core": "0.49.7",
33
+ "@happyvertical/smrt-tenancy": "0.49.7",
34
34
  "@happyvertical/sql": "^0.89.6",
35
35
  "@happyvertical/utils": "^0.89.6"
36
36
  },
37
37
  "devDependencies": {
38
- "@happyvertical/smrt-vitest": "0.49.5",
38
+ "@happyvertical/smrt-vitest": "0.49.7",
39
39
  "@types/node": "24.13.2",
40
40
  "typescript": "5.9.3",
41
41
  "vite": "8.1.4",
@@ -1,353 +0,0 @@
1
- import { ObjectRegistry, SmrtObject, crossPackageRef, foreignKey, smrt } from "@happyvertical/smrt-core";
2
- //#region src/__smrt-register__.ts
3
- ObjectRegistry.registerPackageManifest(JSON.parse("{\"version\":\"1.0.0\",\"timestamp\":0,\"packageName\":\"@happyvertical/smrt-secrets\",\"packageVersion\":\"0.49.5\",\"objects\":{\"@happyvertical/smrt-secrets:SecretAuditLogCollection\":{\"name\":\"secretauditlogcollection\",\"className\":\"SecretAuditLogCollection\",\"qualifiedName\":\"@happyvertical/smrt-secrets:SecretAuditLogCollection\",\"collection\":\"secretauditlogs\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/secrets/src/collections/SecretAuditLogCollection.ts\",\"packageName\":\"@happyvertical/smrt-secrets\",\"fields\":{},\"methods\":{\"listLogs\":{\"name\":\"listLogs\",\"async\":true,\"parameters\":[{\"name\":\"options\",\"type\":\"ListAuditLogsOptions\",\"optional\":true}],\"returnType\":\"Promise<SecretAuditLog[]>\",\"isStatic\":false,\"isPublic\":true},\"getSecretHistory\":{\"name\":\"getSecretHistory\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string | null\",\"optional\":false,\"unionBranches\":[{\"type\":\"string\"},{\"type\":\"null\"}]},{\"name\":\"secretName\",\"type\":\"string\",\"optional\":false},{\"name\":\"limit\",\"type\":\"number\",\"optional\":true}],\"returnType\":\"Promise<SecretAuditLog[]>\",\"isStatic\":false,\"isPublic\":true},\"getUserActivity\":{\"name\":\"getUserActivity\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string | null\",\"optional\":false,\"unionBranches\":[{\"type\":\"string\"},{\"type\":\"null\"}]},{\"name\":\"userId\",\"type\":\"string\",\"optional\":false},{\"name\":\"limit\",\"type\":\"number\",\"optional\":true}],\"returnType\":\"Promise<SecretAuditLog[]>\",\"isStatic\":false,\"isPublic\":true},\"getRecentFailures\":{\"name\":\"getRecentFailures\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string | null\",\"optional\":false,\"unionBranches\":[{\"type\":\"string\"},{\"type\":\"null\"}]},{\"name\":\"limit\",\"type\":\"number\",\"optional\":true}],\"returnType\":\"Promise<SecretAuditLog[]>\",\"isStatic\":false,\"isPublic\":true},\"getRecentDenials\":{\"name\":\"getRecentDenials\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string | null\",\"optional\":false,\"unionBranches\":[{\"type\":\"string\"},{\"type\":\"null\"}]},{\"name\":\"limit\",\"type\":\"number\",\"optional\":true}],\"returnType\":\"Promise<SecretAuditLog[]>\",\"isStatic\":false,\"isPublic\":true},\"countByAction\":{\"name\":\"countByAction\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string | null\",\"optional\":false,\"unionBranches\":[{\"type\":\"string\"},{\"type\":\"null\"}]},{\"name\":\"since\",\"type\":\"Date\",\"optional\":true}],\"returnType\":\"Promise<Record<SecretAuditAction, number>>\",\"isStatic\":false,\"isPublic\":true},\"countByResult\":{\"name\":\"countByResult\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string | null\",\"optional\":false,\"unionBranches\":[{\"type\":\"string\"},{\"type\":\"null\"}]},{\"name\":\"since\",\"type\":\"Date\",\"optional\":true}],\"returnType\":\"Promise<Record<SecretAuditResult, number>>\",\"isStatic\":false,\"isPublic\":true},\"cleanup\":{\"name\":\"cleanup\",\"async\":true,\"parameters\":[{\"name\":\"olderThanDays\",\"type\":\"number\",\"optional\":true}],\"returnType\":\"Promise<number>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"SecretAuditLog\",\"exportName\":\"SecretAuditLogCollection\",\"collectionExportName\":\"SecretAuditLogCollectionCollection\",\"schema\":{\"tableName\":\"secret_audit_logs\",\"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);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"secret_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false},\"secret_name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"user_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"action\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"read\"},\"result\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"success\"},\"ip_address\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"user_agent\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"details\":{\"type\":\"JSON\",\"notNull\":false,\"unique\":false,\"default\":{}}},\"indexes\":[{\"name\":\"secret_audit_logs_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"secret_audit_logs_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"secret_audit_logs_secret_id_idx\",\"columns\":[\"secret_id\"]},{\"name\":\"secret_audit_logs_user_id_idx\",\"columns\":[\"user_id\"]}],\"version\":\"af0d679d\"}},\"@happyvertical/smrt-secrets:SecretCollection\":{\"name\":\"secretcollection\",\"className\":\"SecretCollection\",\"qualifiedName\":\"@happyvertical/smrt-secrets:SecretCollection\",\"collection\":\"secrets\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/secrets/src/collections/SecretCollection.ts\",\"packageName\":\"@happyvertical/smrt-secrets\",\"fields\":{},\"methods\":{\"findByName\":{\"name\":\"findByName\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"name\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Secret | null>\",\"isStatic\":false,\"isPublic\":true},\"listSecrets\":{\"name\":\"listSecrets\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"options\",\"type\":\"ListSecretsOptions\",\"optional\":true}],\"returnType\":\"Promise<Secret[]>\",\"isStatic\":false,\"isPublic\":true},\"listActive\":{\"name\":\"listActive\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Secret[]>\",\"isStatic\":false,\"isPublic\":true},\"listByCategory\":{\"name\":\"listByCategory\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"category\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Secret[]>\",\"isStatic\":false,\"isPublic\":true},\"listExpiring\":{\"name\":\"listExpiring\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"daysAhead\",\"type\":\"number\",\"optional\":true}],\"returnType\":\"Promise<Secret[]>\",\"isStatic\":false,\"isPublic\":true},\"getCategories\":{\"name\":\"getCategories\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<string[]>\",\"isStatic\":false,\"isPublic\":true},\"countByStatus\":{\"name\":\"countByStatus\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<Record<SecretStatus, number>>\",\"isStatic\":false,\"isPublic\":true},\"deleteByName\":{\"name\":\"deleteByName\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"name\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<boolean>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"Secret\",\"exportName\":\"SecretCollection\",\"collectionExportName\":\"SecretCollectionCollection\",\"schema\":{\"tableName\":\"secrets\",\"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);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"description\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"category\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"encrypted_value\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"key_version\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":1},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"active\"},\"expires_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"last_accessed_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"access_count\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"metadata\":{\"type\":\"JSON\",\"notNull\":false,\"unique\":false,\"default\":{}}},\"indexes\":[{\"name\":\"secrets_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"secrets_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]}],\"version\":\"6298a980\"}},\"@happyvertical/smrt-secrets:TenantKeyCollection\":{\"name\":\"tenantkeycollection\",\"className\":\"TenantKeyCollection\",\"qualifiedName\":\"@happyvertical/smrt-secrets:TenantKeyCollection\",\"collection\":\"tenantkeys\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/secrets/src/collections/TenantKeyCollection.ts\",\"packageName\":\"@happyvertical/smrt-secrets\",\"fields\":{},\"methods\":{\"getActiveKey\":{\"name\":\"getActiveKey\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<TenantKey | null>\",\"isStatic\":false,\"isPublic\":true},\"listKeyVersions\":{\"name\":\"listKeyVersions\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<TenantKey[]>\",\"isStatic\":false,\"isPublic\":true},\"getKeyVersion\":{\"name\":\"getKeyVersion\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"version\",\"type\":\"number\",\"optional\":false}],\"returnType\":\"Promise<TenantKey | null>\",\"isStatic\":false,\"isPublic\":true},\"findKeysNeedingRotation\":{\"name\":\"findKeysNeedingRotation\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<TenantKey[]>\",\"isStatic\":false,\"isPublic\":true},\"listAllActiveKeys\":{\"name\":\"listAllActiveKeys\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<TenantKey[]>\",\"isStatic\":false,\"isPublic\":true},\"countByStatus\":{\"name\":\"countByStatus\",\"async\":true,\"parameters\":[],\"returnType\":\"Promise<Record<TenantKeyStatus, number>>\",\"isStatic\":false,\"isPublic\":true},\"markCompromised\":{\"name\":\"markCompromised\",\"async\":true,\"parameters\":[{\"name\":\"tenantId\",\"type\":\"string\",\"optional\":false},{\"name\":\"keyId\",\"type\":\"string\",\"optional\":false}],\"returnType\":\"Promise<boolean>\",\"isStatic\":false,\"isPublic\":true},\"cleanupRetiredKeys\":{\"name\":\"cleanupRetiredKeys\",\"async\":true,\"parameters\":[{\"name\":\"olderThanDays\",\"type\":\"number\",\"optional\":true}],\"returnType\":\"Promise<number>\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{},\"extends\":\"SmrtCollection\",\"extendsTypeArg\":\"TenantKey\",\"exportName\":\"TenantKeyCollection\",\"collectionExportName\":\"TenantKeyCollectionCollection\",\"schema\":{\"tableName\":\"tenant_keys\",\"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);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"wrapped_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"amk_key_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"active\"},\"version\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":1},\"rotate_after\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"retired_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"tenant_keys_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true},{\"name\":\"tenant_keys_created_at_idx\",\"columns\":[\"created_at\"]}],\"version\":\"79fd7e46\"}},\"@happyvertical/smrt-secrets:Secret\":{\"name\":\"secret\",\"className\":\"Secret\",\"qualifiedName\":\"@happyvertical/smrt-secrets:Secret\",\"collection\":\"secrets\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/secrets/src/models/Secret.ts\",\"packageName\":\"@happyvertical/smrt-secrets\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":false,\"default\":\"\",\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"mode\":\"required\",\"field\":\"tenantId\",\"autoFilter\":true,\"autoPopulate\":true,\"allowSuperAdminBypass\":false}}},\"name\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"description\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"category\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"encryptedValue\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"keyVersion\":{\"type\":\"integer\",\"required\":false,\"default\":1},\"status\":{\"type\":\"text\",\"required\":false,\"default\":\"active\"},\"expiresAt\":{\"type\":\"datetime\",\"required\":false},\"lastAccessedAt\":{\"type\":\"datetime\",\"required\":false},\"accessCount\":{\"type\":\"integer\",\"required\":false,\"default\":0},\"metadata\":{\"type\":\"json\",\"required\":false,\"default\":{}}},\"methods\":{\"isActive\":{\"name\":\"isActive\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isExpired\":{\"name\":\"isExpired\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isUsable\":{\"name\":\"isUsable\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"recordAccess\":{\"name\":\"recordAccess\",\"async\":false,\"parameters\":[],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"disable\":{\"name\":\"disable\",\"async\":false,\"parameters\":[],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"enable\":{\"name\":\"enable\",\"async\":false,\"parameters\":[],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tenantScoped\":true,\"api\":{\"include\":[]},\"mcp\":{\"include\":[]},\"cli\":{\"include\":[\"list\"],\"skipApiCheck\":true},\"conflictColumns\":[\"tenant_id\",\"slug\",\"context\"]},\"extends\":\"SmrtObject\",\"exportName\":\"Secret\",\"collectionExportName\":\"SecretCollection\",\"schema\":{\"tableName\":\"secrets\",\"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);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"description\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"category\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"encrypted_value\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"key_version\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":1},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"active\"},\"expires_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"last_accessed_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"access_count\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":0},\"metadata\":{\"type\":\"JSON\",\"notNull\":false,\"unique\":false,\"default\":{}}},\"indexes\":[{\"name\":\"secrets_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"secrets_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]}],\"version\":\"6298a980\"}},\"@happyvertical/smrt-secrets:SecretAuditLog\":{\"name\":\"secretauditlog\",\"className\":\"SecretAuditLog\",\"qualifiedName\":\"@happyvertical/smrt-secrets:SecretAuditLog\",\"collection\":\"secretauditlogs\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/secrets/src/models/SecretAuditLog.ts\",\"packageName\":\"@happyvertical/smrt-secrets\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":false,\"_meta\":{\"sqlType\":\"UUID\",\"__tenancy\":{\"isTenantIdField\":true,\"mode\":\"required\",\"field\":\"tenantId\",\"autoFilter\":true,\"autoPopulate\":true,\"allowSuperAdminBypass\":false}}},\"secretId\":{\"type\":\"foreignKey\",\"required\":false,\"related\":\"Secret\",\"_meta\":{\"constraint\":false}},\"secretName\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"userId\":{\"type\":\"crossPackageRef\",\"required\":false,\"related\":\"@happyvertical/smrt-users:User\"},\"action\":{\"type\":\"text\",\"required\":false,\"default\":\"read\"},\"result\":{\"type\":\"text\",\"required\":false,\"default\":\"success\"},\"ipAddress\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"userAgent\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"details\":{\"type\":\"json\",\"required\":false,\"default\":{}}},\"methods\":{\"isSuccess\":{\"name\":\"isSuccess\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isFailure\":{\"name\":\"isFailure\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isDenied\":{\"name\":\"isDenied\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isReadAction\":{\"name\":\"isReadAction\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isWriteAction\":{\"name\":\"isWriteAction\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isKeyOperation\":{\"name\":\"isKeyOperation\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"tenantScoped\":true,\"api\":{\"include\":[]},\"mcp\":{\"include\":[]},\"cli\":{\"include\":[\"list\"],\"skipApiCheck\":true},\"conflictColumns\":[\"tenant_id\",\"slug\",\"context\"]},\"extends\":\"SmrtObject\",\"exportName\":\"SecretAuditLog\",\"collectionExportName\":\"SecretAuditLogCollection\",\"schema\":{\"tableName\":\"secret_audit_logs\",\"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);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"UUID\",\"referenceKind\":\"tenantId\",\"notNull\":false,\"unique\":false},\"secret_id\":{\"type\":\"UUID\",\"referenceKind\":\"foreignKey\",\"notNull\":false,\"unique\":false},\"secret_name\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"user_id\":{\"type\":\"UUID\",\"referenceKind\":\"crossPackageRef\",\"notNull\":false,\"unique\":false},\"action\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"read\"},\"result\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"success\"},\"ip_address\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"user_agent\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"details\":{\"type\":\"JSON\",\"notNull\":false,\"unique\":false,\"default\":{}}},\"indexes\":[{\"name\":\"secret_audit_logs_slug_context_idx\",\"columns\":[\"tenant_id\",\"slug\",\"context\"],\"unique\":true,\"nullsNotDistinct\":true},{\"name\":\"secret_audit_logs_tenant_id_created_at_idx\",\"columns\":[\"tenant_id\",\"created_at\"]},{\"name\":\"secret_audit_logs_secret_id_idx\",\"columns\":[\"secret_id\"]},{\"name\":\"secret_audit_logs_user_id_idx\",\"columns\":[\"user_id\"]}],\"version\":\"af0d679d\"}},\"@happyvertical/smrt-secrets:TenantKey\":{\"name\":\"tenantkey\",\"className\":\"TenantKey\",\"qualifiedName\":\"@happyvertical/smrt-secrets:TenantKey\",\"collection\":\"tenantkeys\",\"filePath\":\"/home/runner/work/smrt/smrt/packages/secrets/src/models/TenantKey.ts\",\"packageName\":\"@happyvertical/smrt-secrets\",\"fields\":{\"tenantId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"wrappedKey\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"amkKeyId\":{\"type\":\"text\",\"required\":false,\"default\":\"\"},\"status\":{\"type\":\"text\",\"required\":false,\"default\":\"active\"},\"version\":{\"type\":\"integer\",\"required\":false,\"default\":1},\"rotateAfter\":{\"type\":\"datetime\",\"required\":false},\"retiredAt\":{\"type\":\"datetime\",\"required\":false}},\"methods\":{\"isActive\":{\"name\":\"isActive\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"needsRotation\":{\"name\":\"needsRotation\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isRetired\":{\"name\":\"isRetired\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"isCompromised\":{\"name\":\"isCompromised\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"canDecrypt\":{\"name\":\"canDecrypt\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"canEncrypt\":{\"name\":\"canEncrypt\",\"async\":false,\"parameters\":[],\"returnType\":\"boolean\",\"isStatic\":false,\"isPublic\":true},\"retire\":{\"name\":\"retire\",\"async\":false,\"parameters\":[],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true},\"markCompromised\":{\"name\":\"markCompromised\",\"async\":false,\"parameters\":[],\"returnType\":\"void\",\"isStatic\":false,\"isPublic\":true}},\"decoratorConfig\":{\"api\":{\"include\":[]},\"mcp\":{\"include\":[]},\"cli\":{\"include\":[\"list\",\"get\"],\"skipApiCheck\":true}},\"extends\":\"SmrtObject\",\"exportName\":\"TenantKey\",\"collectionExportName\":\"TenantKeyCollection\",\"schema\":{\"tableName\":\"tenant_keys\",\"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);\",\"columns\":{\"id\":{\"type\":\"UUID\",\"primaryKey\":true,\"referenceKind\":\"id\",\"notNull\":true},\"slug\":{\"type\":\"TEXT\",\"notNull\":true},\"context\":{\"type\":\"TEXT\",\"notNull\":true,\"default\":\"\"},\"created_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"updated_at\":{\"type\":\"TIMESTAMP\",\"notNull\":true,\"default\":\"current_timestamp\"},\"tenant_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"wrapped_key\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"amk_key_id\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"\"},\"status\":{\"type\":\"TEXT\",\"notNull\":false,\"unique\":false,\"default\":\"active\"},\"version\":{\"type\":\"INTEGER\",\"notNull\":false,\"unique\":false,\"default\":1},\"rotate_after\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false},\"retired_at\":{\"type\":\"TIMESTAMP\",\"notNull\":false,\"unique\":false}},\"indexes\":[{\"name\":\"tenant_keys_slug_context_idx\",\"columns\":[\"slug\",\"context\"],\"unique\":true},{\"name\":\"tenant_keys_created_at_idx\",\"columns\":[\"created_at\"]}],\"version\":\"79fd7e46\"}}},\"moduleType\":\"smrt\",\"smrtDependencies\":[\"@happyvertical/smrt-core\",\"@happyvertical/smrt-tenancy\"]}"));
4
- //#endregion
5
- //#region \0@oxc-project+runtime@0.138.0/helpers/esm/decorate.js
6
- function __decorate(decorators, target, key, desc) {
7
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
9
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10
- return c > 3 && r && Object.defineProperty(target, key, r), r;
11
- }
12
- //#endregion
13
- //#region src/models/SecretAuditLog.ts
14
- var SecretAuditLog = class SecretAuditLog extends SmrtObject {
15
- /**
16
- * Tenant associated with the audited secret operation.
17
- */
18
- tenantId = null;
19
- /**
20
- * ID of the secret (may identify a secret that has since been deleted).
21
- *
22
- * Compliance audit rows intentionally outlive their source secret, so this
23
- * remains an app-side relationship without a physical database constraint.
24
- */
25
- secretId = null;
26
- /**
27
- * Name of the secret at the time of the operation
28
- */
29
- secretName = "";
30
- /**
31
- * ID of the user who performed the action, or `null` for system-initiated
32
- * operations with no authenticated user. Stored as a native `uuid` column on
33
- * Postgres, so a non-UUID actor sentinel must never reach it —
34
- * {@link createAuditEntry} normalizes the `'system'` sentinel to null (#1444).
35
- */
36
- userId = null;
37
- /**
38
- * The action that was performed
39
- */
40
- action = "read";
41
- /**
42
- * Result of the operation
43
- */
44
- result = "success";
45
- /**
46
- * IP address of the client (if available)
47
- */
48
- ipAddress = "";
49
- /**
50
- * User agent string (if available)
51
- */
52
- userAgent = "";
53
- /**
54
- * Additional context about the operation
55
- */
56
- details = {};
57
- constructor(options = {}) {
58
- super(options);
59
- if (options.tenantId !== void 0) this.tenantId = options.tenantId;
60
- if (options.secretId !== void 0) this.secretId = options.secretId;
61
- if (options.secretName !== void 0) this.secretName = options.secretName;
62
- if (options.userId !== void 0) this.userId = options.userId;
63
- if (options.action !== void 0) this.action = options.action;
64
- if (options.result !== void 0) this.result = options.result;
65
- if (options.ipAddress !== void 0) this.ipAddress = options.ipAddress;
66
- if (options.userAgent !== void 0) this.userAgent = options.userAgent;
67
- if (options.details !== void 0) this.details = options.details;
68
- }
69
- /**
70
- * Check if this was a successful operation
71
- */
72
- isSuccess() {
73
- return this.result === "success";
74
- }
75
- /**
76
- * Check if this was a failed operation
77
- */
78
- isFailure() {
79
- return this.result === "failure";
80
- }
81
- /**
82
- * Check if this was a denied operation (permission denied)
83
- */
84
- isDenied() {
85
- return this.result === "denied";
86
- }
87
- /**
88
- * Check if this is a read operation
89
- */
90
- isReadAction() {
91
- return this.action === "read";
92
- }
93
- /**
94
- * Check if this is a write operation (create, update, delete)
95
- */
96
- isWriteAction() {
97
- return [
98
- "create",
99
- "update",
100
- "delete"
101
- ].includes(this.action);
102
- }
103
- /**
104
- * Check if this is a key operation
105
- */
106
- isKeyOperation() {
107
- return this.action === "rotate_key";
108
- }
109
- };
110
- __decorate([foreignKey("Secret", { constraint: false })], SecretAuditLog.prototype, "secretId", void 0);
111
- __decorate([crossPackageRef("@happyvertical/smrt-users:User")], SecretAuditLog.prototype, "userId", void 0);
112
- SecretAuditLog = __decorate([smrt({
113
- tenantScoped: true,
114
- api: { include: [] },
115
- mcp: { include: [] },
116
- cli: {
117
- include: ["list"],
118
- skipApiCheck: true
119
- }
120
- })], SecretAuditLog);
121
- /**
122
- * Create an audit log entry for a secret operation
123
- */
124
- function createAuditEntry(params) {
125
- const tenantId = params.tenantId === void 0 || params.tenantId === "system" ? null : params.tenantId;
126
- const userId = params.userId == null || params.userId === "system" || params.userId === "" ? null : params.userId;
127
- return {
128
- secretId: params.secretId ?? null,
129
- secretName: params.secretName,
130
- userId,
131
- action: params.action,
132
- result: params.result,
133
- ipAddress: params.ipAddress ?? "",
134
- userAgent: params.userAgent ?? "",
135
- details: params.details ?? {},
136
- tenantId
137
- };
138
- }
139
- //#endregion
140
- //#region src/models/Secret.ts
141
- var Secret = class Secret extends SmrtObject {
142
- /**
143
- * Tenant that owns this secret. Also stored in context for per-tenant name uniqueness.
144
- */
145
- tenantId = "";
146
- /**
147
- * Unique name for the secret within the tenant
148
- */
149
- name = "";
150
- /**
151
- * Human-readable description
152
- */
153
- description = "";
154
- /**
155
- * Category for organization (e.g., 'database', 'api-key', 'oauth')
156
- */
157
- category = "";
158
- /**
159
- * JSON-encoded EncryptedEnvelope from @happyvertical/secrets
160
- */
161
- encryptedValue = "";
162
- /**
163
- * Version of the tenant key used to encrypt this secret
164
- */
165
- keyVersion = 1;
166
- /**
167
- * Current status of the secret
168
- */
169
- status = "active";
170
- /**
171
- * Optional expiration date
172
- */
173
- expiresAt = null;
174
- /**
175
- * Last time this secret was accessed (decrypted)
176
- */
177
- lastAccessedAt = null;
178
- /**
179
- * Number of times this secret has been accessed
180
- */
181
- accessCount = 0;
182
- /**
183
- * Additional metadata stored with the secret
184
- */
185
- metadata = {};
186
- constructor(options = {}) {
187
- super(options);
188
- if (options.tenantId !== void 0) this.tenantId = options.tenantId;
189
- if (options.name !== void 0) this.name = options.name;
190
- if (options.description !== void 0) this.description = options.description;
191
- if (options.category !== void 0) this.category = options.category;
192
- if (options.encryptedValue !== void 0) this.encryptedValue = options.encryptedValue;
193
- if (options.keyVersion !== void 0) this.keyVersion = options.keyVersion;
194
- if (options.status !== void 0) this.status = options.status;
195
- if (options.expiresAt !== void 0) this.expiresAt = options.expiresAt instanceof Date ? options.expiresAt : options.expiresAt ? new Date(options.expiresAt) : null;
196
- if (options.lastAccessedAt !== void 0) this.lastAccessedAt = options.lastAccessedAt instanceof Date ? options.lastAccessedAt : options.lastAccessedAt ? new Date(options.lastAccessedAt) : null;
197
- if (options.accessCount !== void 0) this.accessCount = options.accessCount;
198
- if (options.metadata !== void 0) this.metadata = options.metadata;
199
- }
200
- /**
201
- * Check if the secret is currently active
202
- */
203
- isActive() {
204
- return this.status === "active";
205
- }
206
- /**
207
- * Check if the secret has expired
208
- */
209
- isExpired() {
210
- if (!this.expiresAt) return false;
211
- return /* @__PURE__ */ new Date() >= this.expiresAt;
212
- }
213
- /**
214
- * Check if the secret can be used (active and not expired)
215
- */
216
- isUsable() {
217
- return this.isActive() && !this.isExpired();
218
- }
219
- /**
220
- * Record an access to this secret
221
- */
222
- recordAccess() {
223
- this.lastAccessedAt = /* @__PURE__ */ new Date();
224
- this.accessCount += 1;
225
- }
226
- /**
227
- * Disable the secret
228
- */
229
- disable() {
230
- this.status = "disabled";
231
- }
232
- /**
233
- * Enable the secret
234
- */
235
- enable() {
236
- this.status = "active";
237
- }
238
- };
239
- Secret = __decorate([smrt({
240
- tenantScoped: true,
241
- api: { include: [] },
242
- mcp: { include: [] },
243
- cli: {
244
- include: ["list"],
245
- skipApiCheck: true
246
- }
247
- })], Secret);
248
- //#endregion
249
- //#region src/models/TenantKey.ts
250
- var TenantKey = class TenantKey extends SmrtObject {
251
- /**
252
- * Tenant ID this key belongs to
253
- */
254
- tenantId = "";
255
- /**
256
- * Wrapped key data (format: wrappedKey:iv:authTag)
257
- */
258
- wrappedKey = "";
259
- /**
260
- * ID of the AMK used to wrap this key
261
- */
262
- amkKeyId = "";
263
- /**
264
- * Current status of the key
265
- */
266
- status = "active";
267
- /**
268
- * Version number (increments on rotation)
269
- */
270
- version = 1;
271
- /**
272
- * Recommended rotation date
273
- */
274
- rotateAfter = null;
275
- /**
276
- * When the key was retired (if applicable)
277
- */
278
- retiredAt = null;
279
- constructor(options = {}) {
280
- super(options);
281
- if (options.tenantId !== void 0) this.tenantId = options.tenantId;
282
- if (options.wrappedKey !== void 0) this.wrappedKey = options.wrappedKey;
283
- if (options.amkKeyId !== void 0) this.amkKeyId = options.amkKeyId;
284
- if (options.status !== void 0) this.status = options.status;
285
- if (options.version !== void 0) this.version = options.version;
286
- if (options.rotateAfter !== void 0) this.rotateAfter = options.rotateAfter instanceof Date ? options.rotateAfter : options.rotateAfter ? new Date(options.rotateAfter) : null;
287
- if (options.retiredAt !== void 0) this.retiredAt = options.retiredAt instanceof Date ? options.retiredAt : options.retiredAt ? new Date(options.retiredAt) : null;
288
- }
289
- /**
290
- * Check if this key is currently active
291
- */
292
- isActive() {
293
- return this.status === "active";
294
- }
295
- /**
296
- * Check if this key needs rotation
297
- */
298
- needsRotation() {
299
- if (!this.rotateAfter) return false;
300
- return /* @__PURE__ */ new Date() >= this.rotateAfter;
301
- }
302
- /**
303
- * Check if this key is retired
304
- */
305
- isRetired() {
306
- return this.status === "retired";
307
- }
308
- /**
309
- * Check if this key is compromised
310
- */
311
- isCompromised() {
312
- return this.status === "compromised";
313
- }
314
- /**
315
- * Check if this key can be used for decryption
316
- * (active or retired keys can decrypt)
317
- */
318
- canDecrypt() {
319
- return this.status === "active" || this.status === "retired";
320
- }
321
- /**
322
- * Check if this key can be used for encryption
323
- * (only active keys should encrypt)
324
- */
325
- canEncrypt() {
326
- return this.status === "active";
327
- }
328
- /**
329
- * Mark this key as retired
330
- */
331
- retire() {
332
- this.status = "retired";
333
- this.retiredAt = /* @__PURE__ */ new Date();
334
- }
335
- /**
336
- * Mark this key as compromised
337
- */
338
- markCompromised() {
339
- this.status = "compromised";
340
- }
341
- };
342
- TenantKey = __decorate([smrt({
343
- api: { include: [] },
344
- mcp: { include: [] },
345
- cli: {
346
- include: ["list", "get"],
347
- skipApiCheck: true
348
- }
349
- })], TenantKey);
350
- //#endregion
351
- export { createAuditEntry as i, Secret as n, SecretAuditLog as r, TenantKey as t };
352
-
353
- //# sourceMappingURL=TenantKey-M7lrY-vo.js.map