@happyvertical/smrt-users 0.57.40 → 0.57.42

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.
Files changed (30) hide show
  1. package/AGENTS.md +1 -0
  2. package/agents/family-invitations.md +62 -0
  3. package/dist/chunks/{PasswordCredentialService-bedKxkaa.js → PasswordCredentialService-DHJNKEeJ.js} +53 -7
  4. package/dist/chunks/PasswordCredentialService-DHJNKEeJ.js.map +1 -0
  5. package/dist/chunks/{TerminalAuthService-m9yX2iT-.js → TerminalAuthService-D8akZ7FE.js} +3 -3
  6. package/dist/chunks/TerminalAuthService-D8akZ7FE.js.map +1 -0
  7. package/dist/collections/UserCollection.d.ts +7 -0
  8. package/dist/collections/UserCollection.d.ts.map +1 -1
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +197 -17
  12. package/dist/index.js.map +1 -1
  13. package/dist/manifest.json +20 -1
  14. package/dist/operator.js +1 -1
  15. package/dist/services/LoginAttemptLimiter.d.ts +2 -0
  16. package/dist/services/LoginAttemptLimiter.d.ts.map +1 -1
  17. package/dist/services/MailboxAuthenticationService.d.ts +40 -1
  18. package/dist/services/MailboxAuthenticationService.d.ts.map +1 -1
  19. package/dist/services/TenantInvitationService.d.ts +17 -3
  20. package/dist/services/TenantInvitationService.d.ts.map +1 -1
  21. package/dist/services/index.d.ts +1 -1
  22. package/dist/services/index.d.ts.map +1 -1
  23. package/dist/smrt-knowledge.json +29 -6
  24. package/dist/sveltekit/index.d.ts +8 -3
  25. package/dist/sveltekit/index.d.ts.map +1 -1
  26. package/dist/sveltekit.js +2 -2
  27. package/dist/sveltekit.js.map +1 -1
  28. package/package.json +10 -10
  29. package/dist/chunks/PasswordCredentialService-bedKxkaa.js.map +0 -1
  30. package/dist/chunks/TerminalAuthService-m9yX2iT-.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"TerminalAuthService-m9yX2iT-.js","names":["encode","encode","encode","b64u","encode","#protectedHeader"],"sources":["../../src/__smrt-register__.ts","../../src/models/CliAuthRequest.ts","../../src/collections/CliAuthRequestCollection.ts","../../src/models/PasskeyChallenge.ts","../../src/collections/PasskeyChallengeCollection.ts","../../src/models/PasskeyCredential.ts","../../src/collections/PasskeyCredentialCollection.ts","../../src/models/PinCredential.ts","../../src/collections/PinCredentialCollection.ts","../../src/services/DeviceCredentialService.ts","../../../../node_modules/.pnpm/jose@6.2.12/node_modules/jose/dist/webapi/lib/buffer_utils.js","../../../../node_modules/.pnpm/jose@6.2.12/node_modules/jose/dist/webapi/util/errors.js","../../../../node_modules/.pnpm/jose@6.2.12/node_modules/jose/dist/webapi/util/base64url.js","../../../../node_modules/.pnpm/jose@6.2.12/node_modules/jose/dist/webapi/lib/validate.js","../../../../node_modules/.pnpm/jose@6.2.12/node_modules/jose/dist/webapi/lib/key.js","../../../../node_modules/.pnpm/jose@6.2.12/node_modules/jose/dist/webapi/lib/key_descriptor.js","../../../../node_modules/.pnpm/jose@6.2.12/node_modules/jose/dist/webapi/lib/jws_algorithms.js","../../../../node_modules/.pnpm/jose@6.2.12/node_modules/jose/dist/webapi/lib/jws_verify.js","../../../../node_modules/.pnpm/jose@6.2.12/node_modules/jose/dist/webapi/lib/jwt_claims_set.js","../../../../node_modules/.pnpm/jose@6.2.12/node_modules/jose/dist/webapi/jwt/verify.js","../../../../node_modules/.pnpm/jose@6.2.12/node_modules/jose/dist/webapi/lib/jws_sign.js","../../../../node_modules/.pnpm/jose@6.2.12/node_modules/jose/dist/webapi/jwt/sign.js","../../../../node_modules/.pnpm/jose@6.2.12/node_modules/jose/dist/webapi/jwks/local.js","../../../../node_modules/.pnpm/jose@6.2.12/node_modules/jose/dist/webapi/jwks/remote.js","../../../../node_modules/.pnpm/jose@6.2.12/node_modules/jose/dist/webapi/index.js","../../src/services/OidcLoginService.ts","../../src/services/MobileAuthService.ts","../../src/services/SessionPermissionContext.ts","../../src/services/OperationPermissionService.ts","../../src/services/PasskeyCredentialService.ts","../../src/services/TerminalAuthService.ts"],"sourcesContent":["// Generated by @happyvertical/smrt-core smrtPlugin at library build time.\n// The package manifest is inlined so self-registration cannot miss when a\n// downstream bundler relocates this module away from dist/manifest.json\n// (https://github.com/happyvertical/smrt/issues/1506,\n// https://github.com/happyvertical/smrt/issues/1507).\nimport { ObjectRegistry } from '@happyvertical/smrt-core';\n\nObjectRegistry.registerPackageManifest(JSON.parse(\"{\\\"version\\\":\\\"1.0.0\\\",\\\"timestamp\\\":0,\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"packageVersion\\\":\\\"0.57.40\\\",\\\"objects\\\":{\\\"@happyvertical/smrt-users:AccessRequestCollection\\\":{\\\"name\\\":\\\"accessrequestcollection\\\",\\\"className\\\":\\\"AccessRequestCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:AccessRequestCollection\\\",\\\"collection\\\":\\\"accessrequests\\\",\\\"description\\\":\\\"Collection for managing AccessRequest objects.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/AccessRequestCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"findByEmail\\\":{\\\"name\\\":\\\"findByEmail\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"email\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<AccessRequest[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findOpenByEmail\\\":{\\\"name\\\":\\\"findOpenByEmail\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"email\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<AccessRequest | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findByStatus\\\":{\\\"name\\\":\\\"findByStatus\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"status\\\",\\\"type\\\":\\\"AccessRequestStatus\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<AccessRequest[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findOpen\\\":{\\\"name\\\":\\\"findOpen\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<AccessRequest[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"access_requests\\\",\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"AccessRequest\\\",\\\"exportName\\\":\\\"AccessRequestCollection\\\",\\\"collectionExportName\\\":\\\"AccessRequestCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"access_requests\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"access_requests\\\\\\\" (\\\\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 \\\\\\\"email\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"name\\\\\\\" TEXT,\\\\n \\\\\\\"status\\\\\\\" TEXT,\\\\n \\\\\\\"source\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"request_context\\\\\\\" TEXT DEFAULT '{}',\\\\n \\\\\\\"note\\\\\\\" TEXT,\\\\n \\\\\\\"requested_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"decided_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"decided_by\\\\\\\" TEXT,\\\\n \\\\\\\"resulting_user_id\\\\\\\" TEXT,\\\\n \\\\\\\"tenant_hint\\\\\\\" TEXT\\\\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\\\"},\\\"email\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"source\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"request_context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"{}\\\"},\\\"note\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"requested_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"decided_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"decided_by\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"resulting_user_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"tenant_hint\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"access_requests_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"access_requests_email_idx\\\",\\\"columns\\\":[\\\"email\\\"]},{\\\"name\\\":\\\"access_requests_status_idx\\\",\\\"columns\\\":[\\\"status\\\"]},{\\\"name\\\":\\\"access_requests_source_idx\\\",\\\"columns\\\":[\\\"source\\\"]},{\\\"name\\\":\\\"access_requests_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"f396996f\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersCliAuthApproveLimitCollection\\\":{\\\"name\\\":\\\"userscliauthapprovelimitcollection\\\",\\\"className\\\":\\\"UsersCliAuthApproveLimitCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersCliAuthApproveLimitCollection\\\",\\\"collection\\\":\\\"userscliauthapprovelimits\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/CliAuthApproveLimitCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"reserveAttempt\\\":{\\\"name\\\":\\\"reserveAttempt\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":false,\\\"memberTypes\\\":[\\\"number\\\",\\\"string\\\"]}],\\\"returnType\\\":\\\"Promise<CliAuthApproveReservation>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"releaseAttempt\\\":{\\\"name\\\":\\\"releaseAttempt\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"windowStartedAt\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_cli_auth_approve_limits\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"UsersCliAuthApproveLimit\\\",\\\"exportName\\\":\\\"UsersCliAuthApproveLimitCollection\\\",\\\"collectionExportName\\\":\\\"UsersCliAuthApproveLimitCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"users_cli_auth_approve_limits\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_cli_auth_approve_limits\\\\\\\" (\\\\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 \\\\\\\"user_id\\\\\\\" UUID NOT NULL UNIQUE,\\\\n \\\\\\\"attempt_count\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"window_started_at\\\\\\\" TIMESTAMP NOT NULL\\\\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\\\"},\\\"user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":true,\\\"foreignKey\\\":{\\\"table\\\":\\\"users\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"attempt_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"window_started_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_cli_auth_approve_limits_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_cli_auth_approve_limits_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"c45c02de\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersCliAuthRequestCollection\\\":{\\\"name\\\":\\\"userscliauthrequestcollection\\\",\\\"className\\\":\\\"UsersCliAuthRequestCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersCliAuthRequestCollection\\\",\\\"collection\\\":\\\"userscliauthrequests\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/CliAuthRequestCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"approvePendingRequest\\\":{\\\"name\\\":\\\"approvePendingRequest\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"ApprovePendingCliAuthRequestInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<ApprovedCliAuthRequestSnapshot | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"consumeApprovedSession\\\":{\\\"name\\\":\\\"consumeApprovedSession\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"deviceCodeHash\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<string | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findByUserCode\\\":{\\\"name\\\":\\\"findByUserCode\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userCode\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<UsersCliAuthRequest | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findByDeviceCodeHash\\\":{\\\"name\\\":\\\"findByDeviceCodeHash\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"deviceCodeHash\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<UsersCliAuthRequest | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"deleteExpired\\\":{\\\"name\\\":\\\"deleteExpired\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"boolean\\\"]}],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_cli_auth_requests\\\",\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"UsersCliAuthRequest\\\",\\\"exportName\\\":\\\"UsersCliAuthRequestCollection\\\",\\\"collectionExportName\\\":\\\"UsersCliAuthRequestCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"users_cli_auth_requests\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_cli_auth_requests\\\\\\\" (\\\\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 \\\\\\\"user_code\\\\\\\" TEXT NOT NULL UNIQUE,\\\\n \\\\\\\"device_code_hash\\\\\\\" TEXT NOT NULL UNIQUE,\\\\n \\\\\\\"status\\\\\\\" TEXT,\\\\n \\\\\\\"user_id\\\\\\\" UUID,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"session_id\\\\\\\" UUID,\\\\n \\\\\\\"expires_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"approved_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\\\"},\\\"user_code\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":true},\\\"device_code_hash\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":true},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"users\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"tenants\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"session_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"sessions\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"expires_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"approved_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_cli_auth_requests_tenant_id_slug_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"users_cli_auth_requests_expires_at_idx\\\",\\\"columns\\\":[\\\"expires_at\\\"]},{\\\"name\\\":\\\"users_cli_auth_requests_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]},{\\\"name\\\":\\\"users_cli_auth_requests_user_id_idx\\\",\\\"columns\\\":[\\\"user_id\\\"]},{\\\"name\\\":\\\"users_cli_auth_requests_session_id_idx\\\",\\\"columns\\\":[\\\"session_id\\\"]}],\\\"version\\\":\\\"713ae04c\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:GroupCollection\\\":{\\\"name\\\":\\\"groupcollection\\\",\\\"className\\\":\\\"GroupCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:GroupCollection\\\",\\\"collection\\\":\\\"groups\\\",\\\"description\\\":\\\"Collection for managing Group objects\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/GroupCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"findByTenant\\\":{\\\"name\\\":\\\"findByTenant\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Group[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findBySlug\\\":{\\\"name\\\":\\\"findBySlug\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"slug\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Group | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"Group\\\",\\\"exportName\\\":\\\"GroupCollection\\\",\\\"collectionExportName\\\":\\\"GroupCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"groups\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"groups\\\\\\\" (\\\\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 NOT NULL,\\\\n \\\\\\\"name\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"description\\\\\\\" TEXT 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\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"tenants\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"description\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"}},\\\"indexes\\\":[{\\\"name\\\":\\\"groups_tenant_id_slug_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"groups_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"1824c19b\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:GroupMemberCollection\\\":{\\\"name\\\":\\\"groupmembercollection\\\",\\\"className\\\":\\\"GroupMemberCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:GroupMemberCollection\\\",\\\"collection\\\":\\\"groupmembers\\\",\\\"description\\\":\\\"Collection for managing GroupMember objects\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/GroupMemberCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"findByGroup\\\":{\\\"name\\\":\\\"findByGroup\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"groupId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<GroupMember[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findByUser\\\":{\\\"name\\\":\\\"findByUser\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<GroupMember[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isMember\\\":{\\\"name\\\":\\\"isMember\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"groupId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"addMember\\\":{\\\"name\\\":\\\"addMember\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"groupId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<GroupMember>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"removeMember\\\":{\\\"name\\\":\\\"removeMember\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"groupId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getGroupIds\\\":{\\\"name\\\":\\\"getGroupIds\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<string[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getGroupIdsForTenant\\\":{\\\"name\\\":\\\"getGroupIdsForTenant\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<string[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getUserIds\\\":{\\\"name\\\":\\\"getUserIds\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"groupId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<string[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"GroupMember\\\",\\\"exportName\\\":\\\"GroupMemberCollection\\\",\\\"collectionExportName\\\":\\\"GroupMemberCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"group_members\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"group_members\\\\\\\" (\\\\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 \\\\\\\"group_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"user_id\\\\\\\" UUID NOT NULL\\\\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\\\"},\\\"group_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"groups\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"users\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}}},\\\"indexes\\\":[{\\\"name\\\":\\\"group_members_group_id_user_id_idx\\\",\\\"columns\\\":[\\\"group_id\\\",\\\"user_id\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"group_members_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"group_members_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]},{\\\"name\\\":\\\"group_members_user_id_idx\\\",\\\"columns\\\":[\\\"user_id\\\"]}],\\\"version\\\":\\\"ed4d1187\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:GroupRoleCollection\\\":{\\\"name\\\":\\\"grouprolecollection\\\",\\\"className\\\":\\\"GroupRoleCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:GroupRoleCollection\\\",\\\"collection\\\":\\\"grouproles\\\",\\\"description\\\":\\\"Collection for managing GroupRole objects\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/GroupRoleCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"findByGroup\\\":{\\\"name\\\":\\\"findByGroup\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"groupId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<GroupRole[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findByRole\\\":{\\\"name\\\":\\\"findByRole\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"roleId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<GroupRole[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"hasRole\\\":{\\\"name\\\":\\\"hasRole\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"groupId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"roleId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"addRole\\\":{\\\"name\\\":\\\"addRole\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"groupId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"roleId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<GroupRole>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"removeRole\\\":{\\\"name\\\":\\\"removeRole\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"groupId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"roleId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getRoleIds\\\":{\\\"name\\\":\\\"getRoleIds\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"groupId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<string[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"GroupRole\\\",\\\"exportName\\\":\\\"GroupRoleCollection\\\",\\\"collectionExportName\\\":\\\"GroupRoleCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"group_roles\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"group_roles\\\\\\\" (\\\\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 \\\\\\\"group_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"role_id\\\\\\\" UUID NOT NULL\\\\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\\\"},\\\"group_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"groups\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"role_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"roles\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}}},\\\"indexes\\\":[{\\\"name\\\":\\\"group_roles_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"group_roles_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]},{\\\"name\\\":\\\"group_roles_group_id_idx\\\",\\\"columns\\\":[\\\"group_id\\\"]},{\\\"name\\\":\\\"group_roles_role_id_idx\\\",\\\"columns\\\":[\\\"role_id\\\"]}],\\\"version\\\":\\\"b1e35f93\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersLoginAttemptCollection\\\":{\\\"name\\\":\\\"usersloginattemptcollection\\\",\\\"className\\\":\\\"UsersLoginAttemptCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersLoginAttemptCollection\\\",\\\"collection\\\":\\\"usersloginattempts\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/LoginAttemptCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"reserveAttempt\\\":{\\\"name\\\":\\\"reserveAttempt\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"ReserveLoginAttemptInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<LoginAttemptReservation>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"recordFailure\\\":{\\\"name\\\":\\\"recordFailure\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"input\\\",\\\"type\\\":\\\"RecordLoginFailureInput\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<RecordedLoginFailure>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"releaseAttempt\\\":{\\\"name\\\":\\\"releaseAttempt\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"limiterKey\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"windowStartedAt\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"boolean\\\"]}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"deleteIdle\\\":{\\\"name\\\":\\\"deleteIdle\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"boolean\\\"]}],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_login_attempts\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"UsersLoginAttempt\\\",\\\"exportName\\\":\\\"UsersLoginAttemptCollection\\\",\\\"collectionExportName\\\":\\\"UsersLoginAttemptCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"users_login_attempts\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_login_attempts\\\\\\\" (\\\\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 \\\\\\\"limiter_key\\\\\\\" TEXT NOT NULL UNIQUE,\\\\n \\\\\\\"scope\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"attempt_count\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"window_started_at\\\\\\\" TIMESTAMP NOT NULL,\\\\n \\\\\\\"failure_streak\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"locked_until\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"last_failed_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"retain_until\\\\\\\" TIMESTAMP NOT NULL\\\\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\\\"},\\\"limiter_key\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":true},\\\"scope\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"attempt_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"window_started_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"failure_streak\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"locked_until\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"last_failed_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"retain_until\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_login_attempts_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_login_attempts_locked_until_idx\\\",\\\"columns\\\":[\\\"locked_until\\\"]},{\\\"name\\\":\\\"users_login_attempts_retain_until_idx\\\",\\\"columns\\\":[\\\"retain_until\\\"]},{\\\"name\\\":\\\"users_login_attempts_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"89dfe336\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersLoginAuditEventCollection\\\":{\\\"name\\\":\\\"usersloginauditeventcollection\\\",\\\"className\\\":\\\"UsersLoginAuditEventCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersLoginAuditEventCollection\\\",\\\"collection\\\":\\\"usersloginauditevents\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/LoginAuditEventCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"deleteOlderThan\\\":{\\\"name\\\":\\\"deleteOlderThan\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"maxAgeMs\\\",\\\"type\\\":\\\"number\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"boolean\\\"]}],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_login_audit_events\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"UsersLoginAuditEvent\\\",\\\"exportName\\\":\\\"UsersLoginAuditEventCollection\\\",\\\"collectionExportName\\\":\\\"UsersLoginAuditEventCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"users_login_audit_events\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_login_audit_events\\\\\\\" (\\\\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 \\\\\\\"kind\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"outcome\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"subject_key_hash\\\\\\\" TEXT,\\\\n \\\\\\\"source_key_hash\\\\\\\" TEXT,\\\\n \\\\\\\"retry_after_seconds\\\\\\\" INTEGER,\\\\n \\\\\\\"occurred_at\\\\\\\" TIMESTAMP NOT NULL,\\\\n \\\\\\\"metadata\\\\\\\" TEXT\\\\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\\\"},\\\"kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"outcome\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"subject_key_hash\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"source_key_hash\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"retry_after_seconds\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"occurred_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"metadata\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_login_audit_events_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_login_audit_events_subject_key_hash_idx\\\",\\\"columns\\\":[\\\"subject_key_hash\\\"]},{\\\"name\\\":\\\"users_login_audit_events_source_key_hash_idx\\\",\\\"columns\\\":[\\\"source_key_hash\\\"]},{\\\"name\\\":\\\"users_login_audit_events_occurred_at_idx\\\",\\\"columns\\\":[\\\"occurred_at\\\"]},{\\\"name\\\":\\\"users_login_audit_events_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"485105a9\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersMagicLinkTokenCollection\\\":{\\\"name\\\":\\\"usersmagiclinktokencollection\\\",\\\"className\\\":\\\"UsersMagicLinkTokenCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersMagicLinkTokenCollection\\\",\\\"collection\\\":\\\"usersmagiclinktokens\\\",\\\"description\\\":\\\"Collection for managing smrt-users magic link token records\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/MagicLinkTokenCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"findByNonce\\\":{\\\"name\\\":\\\"findByNonce\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"nonce\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<UsersMagicLinkToken | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isAvailable\\\":{\\\"name\\\":\\\"isAvailable\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"nonce\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"email\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"markUsed\\\":{\\\"name\\\":\\\"markUsed\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"nonce\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"deleteExpired\\\":{\\\"name\\\":\\\"deleteExpired\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"boolean\\\"]}],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_magic_link_tokens\\\",\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"UsersMagicLinkToken\\\",\\\"exportName\\\":\\\"UsersMagicLinkTokenCollection\\\",\\\"collectionExportName\\\":\\\"UsersMagicLinkTokenCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"users_magic_link_tokens\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_magic_link_tokens\\\\\\\" (\\\\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 \\\\\\\"nonce\\\\\\\" TEXT NOT NULL UNIQUE DEFAULT '',\\\\n \\\\\\\"email\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"used\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"expires_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\\\"},\\\"nonce\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":true,\\\"default\\\":\\\"\\\"},\\\"email\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"used\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":false},\\\"expires_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_magic_link_tokens_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_magic_link_tokens_expires_at_idx\\\",\\\"columns\\\":[\\\"expires_at\\\"]},{\\\"name\\\":\\\"users_magic_link_tokens_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"537853d3\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:MembershipCollection\\\":{\\\"name\\\":\\\"membershipcollection\\\",\\\"className\\\":\\\"MembershipCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:MembershipCollection\\\",\\\"collection\\\":\\\"memberships\\\",\\\"description\\\":\\\"Collection for managing Membership objects\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/MembershipCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"findByUser\\\":{\\\"name\\\":\\\"findByUser\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Membership[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findActiveByUser\\\":{\\\"name\\\":\\\"findActiveByUser\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Membership[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findByTenant\\\":{\\\"name\\\":\\\"findByTenant\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Membership[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findActiveByTenant\\\":{\\\"name\\\":\\\"findActiveByTenant\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Membership[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findByUserAndTenant\\\":{\\\"name\\\":\\\"findByUserAndTenant\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Membership | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findByRole\\\":{\\\"name\\\":\\\"findByRole\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"roleId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Membership[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findByStatus\\\":{\\\"name\\\":\\\"findByStatus\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"status\\\",\\\"type\\\":\\\"MembershipStatus\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Membership[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"Membership\\\",\\\"exportName\\\":\\\"MembershipCollection\\\",\\\"collectionExportName\\\":\\\"MembershipCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"memberships\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"memberships\\\\\\\" (\\\\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 \\\\\\\"user_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"role_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"status\\\\\\\" TEXT\\\\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\\\"},\\\"user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"users\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"tenants\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"role_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"roles\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"memberships_tenant_id_slug_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"memberships_tenant_id_user_id_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"user_id\\\"]},{\\\"name\\\":\\\"memberships_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]},{\\\"name\\\":\\\"memberships_user_id_idx\\\",\\\"columns\\\":[\\\"user_id\\\"]},{\\\"name\\\":\\\"memberships_role_id_idx\\\",\\\"columns\\\":[\\\"role_id\\\"]}],\\\"version\\\":\\\"ebfd11e0\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:MembershipOverrideCollection\\\":{\\\"name\\\":\\\"membershipoverridecollection\\\",\\\"className\\\":\\\"MembershipOverrideCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:MembershipOverrideCollection\\\",\\\"collection\\\":\\\"membershipoverrides\\\",\\\"description\\\":\\\"Collection for managing MembershipOverride objects\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/MembershipOverrideCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"findByMembership\\\":{\\\"name\\\":\\\"findByMembership\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"membershipId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<MembershipOverride[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findGrants\\\":{\\\"name\\\":\\\"findGrants\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"membershipId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<MembershipOverride[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findDenies\\\":{\\\"name\\\":\\\"findDenies\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"membershipId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<MembershipOverride[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getGrantedPermissionIds\\\":{\\\"name\\\":\\\"getGrantedPermissionIds\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"membershipId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<string[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getDeniedPermissionIds\\\":{\\\"name\\\":\\\"getDeniedPermissionIds\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"membershipId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<string[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setOverride\\\":{\\\"name\\\":\\\"setOverride\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"membershipId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"permissionId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"effect\\\",\\\"type\\\":\\\"OverrideEffect\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<MembershipOverride>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"removeOverride\\\":{\\\"name\\\":\\\"removeOverride\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"membershipId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"permissionId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"grantPermission\\\":{\\\"name\\\":\\\"grantPermission\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"membershipId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"permissionId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<MembershipOverride>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"denyPermission\\\":{\\\"name\\\":\\\"denyPermission\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"membershipId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"permissionId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<MembershipOverride>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"MembershipOverride\\\",\\\"exportName\\\":\\\"MembershipOverrideCollection\\\",\\\"collectionExportName\\\":\\\"MembershipOverrideCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"membership_overrides\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"membership_overrides\\\\\\\" (\\\\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 \\\\\\\"membership_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"permission_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"effect\\\\\\\" TEXT\\\\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\\\"},\\\"membership_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"memberships\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"permission_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"permissions\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"effect\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"membership_overrides_membership_id_permission_id_idx\\\",\\\"columns\\\":[\\\"membership_id\\\",\\\"permission_id\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"membership_overrides_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"membership_overrides_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]},{\\\"name\\\":\\\"membership_overrides_permission_id_idx\\\",\\\"columns\\\":[\\\"permission_id\\\"]}],\\\"version\\\":\\\"25fe9da8\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersOAuthClientCollection\\\":{\\\"name\\\":\\\"usersoauthclientcollection\\\",\\\"className\\\":\\\"UsersOAuthClientCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersOAuthClientCollection\\\",\\\"collection\\\":\\\"usersoauthclients\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/OAuthAuthorizationCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"findByClientId\\\":{\\\"name\\\":\\\"findByClientId\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"clientId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<UsersOAuthClient | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_oauth_clients\\\",\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"UsersOAuthClient\\\",\\\"exportName\\\":\\\"UsersOAuthClientCollection\\\",\\\"collectionExportName\\\":\\\"UsersOAuthClientCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"users_oauth_clients\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_oauth_clients\\\\\\\" (\\\\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 \\\\\\\"client_id\\\\\\\" TEXT NOT NULL UNIQUE,\\\\n \\\\\\\"redirect_uris\\\\\\\" TEXT,\\\\n \\\\\\\"allowed_scopes\\\\\\\" TEXT,\\\\n \\\\\\\"token_endpoint_auth_method\\\\\\\" TEXT DEFAULT 'none',\\\\n \\\\\\\"secret_hash\\\\\\\" TEXT,\\\\n \\\\\\\"allowed_resources\\\\\\\" TEXT\\\\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\\\"},\\\"client_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":true},\\\"redirect_uris\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"allowed_scopes\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"token_endpoint_auth_method\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"none\\\"},\\\"secret_hash\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"allowed_resources\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_oauth_clients_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_oauth_clients_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"0ecda18c\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersOAuthAuthorizationCodeCollection\\\":{\\\"name\\\":\\\"usersoauthauthorizationcodecollection\\\",\\\"className\\\":\\\"UsersOAuthAuthorizationCodeCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersOAuthAuthorizationCodeCollection\\\",\\\"collection\\\":\\\"usersoauthauthorizationcodes\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/OAuthAuthorizationCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"consume\\\":{\\\"name\\\":\\\"consume\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"id\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"codeHash\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"clientId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"redirectUri\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"resource\\\",\\\"type\\\":\\\"string | null\\\",\\\"optional\\\":false,\\\"unionBranches\\\":[{\\\"type\\\":\\\"string\\\"},{\\\"type\\\":\\\"null\\\"}]},{\\\"name\\\":\\\"now\\\",\\\"type\\\":\\\"Date\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_oauth_authorization_codes\\\",\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"UsersOAuthAuthorizationCode\\\",\\\"exportName\\\":\\\"UsersOAuthAuthorizationCodeCollection\\\",\\\"collectionExportName\\\":\\\"UsersOAuthAuthorizationCodeCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"users_oauth_authorization_codes\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_oauth_authorization_codes\\\\\\\" (\\\\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 \\\\\\\"authorization_id\\\\\\\" TEXT,\\\\n \\\\\\\"code_hash\\\\\\\" TEXT NOT NULL UNIQUE,\\\\n \\\\\\\"client_id\\\\\\\" TEXT,\\\\n \\\\\\\"subject\\\\\\\" TEXT,\\\\n \\\\\\\"tenant_id\\\\\\\" TEXT,\\\\n \\\\\\\"claims\\\\\\\" TEXT,\\\\n \\\\\\\"redirect_uri\\\\\\\" TEXT,\\\\n \\\\\\\"scopes\\\\\\\" TEXT,\\\\n \\\\\\\"resource\\\\\\\" TEXT,\\\\n \\\\\\\"code_challenge\\\\\\\" TEXT,\\\\n \\\\\\\"expires_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"consumed_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\\\"},\\\"authorization_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"code_hash\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":true},\\\"client_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"subject\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"tenant_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"claims\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"redirect_uri\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"scopes\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"resource\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"code_challenge\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"expires_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"consumed_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_oauth_authorization_codes_tenant_id_slug_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"users_oauth_authorization_codes_authorization_id_idx\\\",\\\"columns\\\":[\\\"authorization_id\\\"]},{\\\"name\\\":\\\"users_oauth_authorization_codes_client_id_idx\\\",\\\"columns\\\":[\\\"client_id\\\"]},{\\\"name\\\":\\\"users_oauth_authorization_codes_subject_idx\\\",\\\"columns\\\":[\\\"subject\\\"]},{\\\"name\\\":\\\"users_oauth_authorization_codes_tenant_id_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\"]},{\\\"name\\\":\\\"users_oauth_authorization_codes_expires_at_idx\\\",\\\"columns\\\":[\\\"expires_at\\\"]},{\\\"name\\\":\\\"users_oauth_authorization_codes_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"f5c5d615\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersOAuthRefreshGrantCollection\\\":{\\\"name\\\":\\\"usersoauthrefreshgrantcollection\\\",\\\"className\\\":\\\"UsersOAuthRefreshGrantCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersOAuthRefreshGrantCollection\\\",\\\"collection\\\":\\\"usersoauthrefreshgrants\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/OAuthAuthorizationCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"consume\\\":{\\\"name\\\":\\\"consume\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"id\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"tokenHash\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"clientId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"resource\\\",\\\"type\\\":\\\"string | null\\\",\\\"optional\\\":false,\\\"unionBranches\\\":[{\\\"type\\\":\\\"string\\\"},{\\\"type\\\":\\\"null\\\"}]},{\\\"name\\\":\\\"now\\\",\\\"type\\\":\\\"Date\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"revokeFamily\\\":{\\\"name\\\":\\\"revokeFamily\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"familyId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"now\\\",\\\"type\\\":\\\"Date\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_oauth_refresh_grants\\\",\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"UsersOAuthRefreshGrant\\\",\\\"exportName\\\":\\\"UsersOAuthRefreshGrantCollection\\\",\\\"collectionExportName\\\":\\\"UsersOAuthRefreshGrantCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"users_oauth_refresh_grants\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_oauth_refresh_grants\\\\\\\" (\\\\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 \\\\\\\"authorization_id\\\\\\\" TEXT,\\\\n \\\\\\\"token_hash\\\\\\\" TEXT NOT NULL UNIQUE,\\\\n \\\\\\\"family_id\\\\\\\" TEXT,\\\\n \\\\\\\"client_id\\\\\\\" TEXT,\\\\n \\\\\\\"subject\\\\\\\" TEXT,\\\\n \\\\\\\"tenant_id\\\\\\\" TEXT,\\\\n \\\\\\\"claims\\\\\\\" TEXT,\\\\n \\\\\\\"scopes\\\\\\\" TEXT,\\\\n \\\\\\\"resource\\\\\\\" TEXT,\\\\n \\\\\\\"expires_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"consumed_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"revoked_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\\\"},\\\"authorization_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"token_hash\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":true},\\\"family_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"client_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"subject\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"tenant_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"claims\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"scopes\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"resource\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"expires_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"consumed_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"revoked_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_oauth_refresh_grants_tenant_id_slug_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"users_oauth_refresh_grants_authorization_id_idx\\\",\\\"columns\\\":[\\\"authorization_id\\\"]},{\\\"name\\\":\\\"users_oauth_refresh_grants_family_id_idx\\\",\\\"columns\\\":[\\\"family_id\\\"]},{\\\"name\\\":\\\"users_oauth_refresh_grants_client_id_idx\\\",\\\"columns\\\":[\\\"client_id\\\"]},{\\\"name\\\":\\\"users_oauth_refresh_grants_subject_idx\\\",\\\"columns\\\":[\\\"subject\\\"]},{\\\"name\\\":\\\"users_oauth_refresh_grants_tenant_id_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\"]},{\\\"name\\\":\\\"users_oauth_refresh_grants_expires_at_idx\\\",\\\"columns\\\":[\\\"expires_at\\\"]},{\\\"name\\\":\\\"users_oauth_refresh_grants_revoked_at_idx\\\",\\\"columns\\\":[\\\"revoked_at\\\"]},{\\\"name\\\":\\\"users_oauth_refresh_grants_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"d332998e\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersOAuthAccessTokenRevocationCollection\\\":{\\\"name\\\":\\\"usersoauthaccesstokenrevocationcollection\\\",\\\"className\\\":\\\"UsersOAuthAccessTokenRevocationCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersOAuthAccessTokenRevocationCollection\\\",\\\"collection\\\":\\\"usersoauthaccesstokenrevocations\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/OAuthAuthorizationCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"findByJti\\\":{\\\"name\\\":\\\"findByJti\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"jti\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<UsersOAuthAccessTokenRevocation | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_oauth_access_token_revocations\\\",\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"UsersOAuthAccessTokenRevocation\\\",\\\"exportName\\\":\\\"UsersOAuthAccessTokenRevocationCollection\\\",\\\"collectionExportName\\\":\\\"UsersOAuthAccessTokenRevocationCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"users_oauth_access_token_revocations\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_oauth_access_token_revocations\\\\\\\" (\\\\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 \\\\\\\"jti\\\\\\\" TEXT NOT NULL UNIQUE,\\\\n \\\\\\\"expires_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\\\"},\\\"jti\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":true},\\\"expires_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_oauth_access_token_revocations_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_oauth_access_token_revocations_expires_at_idx\\\",\\\"columns\\\":[\\\"expires_at\\\"]},{\\\"name\\\":\\\"users_oauth_access_token_revocations_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"79147089\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersOAuthAuthorizationCollection\\\":{\\\"name\\\":\\\"usersoauthauthorizationcollection\\\",\\\"className\\\":\\\"UsersOAuthAuthorizationCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersOAuthAuthorizationCollection\\\",\\\"collection\\\":\\\"usersoauthauthorizations\\\",\\\"description\\\":\\\"Consent storage is intentionally inaccessible through generated surfaces.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/OAuthAuthorizationCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_oauth_authorizations\\\",\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"UsersOAuthAuthorization\\\",\\\"exportName\\\":\\\"UsersOAuthAuthorizationCollection\\\",\\\"collectionExportName\\\":\\\"UsersOAuthAuthorizationCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"users_oauth_authorizations\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_oauth_authorizations\\\\\\\" (\\\\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 \\\\\\\"subject\\\\\\\" TEXT,\\\\n \\\\\\\"session_id\\\\\\\" TEXT,\\\\n \\\\\\\"client_id\\\\\\\" TEXT,\\\\n \\\\\\\"tenant_id\\\\\\\" TEXT,\\\\n \\\\\\\"scopes\\\\\\\" TEXT,\\\\n \\\\\\\"permission_ceiling\\\\\\\" TEXT,\\\\n \\\\\\\"resource\\\\\\\" TEXT,\\\\n \\\\\\\"revoked_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\\\"},\\\"subject\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"session_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"client_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"tenant_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"scopes\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"permission_ceiling\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"resource\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"revoked_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_oauth_authorizations_tenant_id_slug_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"users_oauth_authorizations_subject_idx\\\",\\\"columns\\\":[\\\"subject\\\"]},{\\\"name\\\":\\\"users_oauth_authorizations_client_id_idx\\\",\\\"columns\\\":[\\\"client_id\\\"]},{\\\"name\\\":\\\"users_oauth_authorizations_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"291f8816\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersOAuthRefreshFamilyCollection\\\":{\\\"name\\\":\\\"usersoauthrefreshfamilycollection\\\",\\\"className\\\":\\\"UsersOAuthRefreshFamilyCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersOAuthRefreshFamilyCollection\\\",\\\"collection\\\":\\\"usersoauthrefreshfamilies\\\",\\\"description\\\":\\\"Family rows exist for the entire lifetime of every descendant refresh token.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/OAuthAuthorizationCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"lock\\\":{\\\"name\\\":\\\"lock\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"id\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"now\\\",\\\"type\\\":\\\"Date\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"revoke\\\":{\\\"name\\\":\\\"revoke\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"id\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"now\\\",\\\"type\\\":\\\"Date\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_oauth_refresh_families\\\",\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"UsersOAuthRefreshFamily\\\",\\\"exportName\\\":\\\"UsersOAuthRefreshFamilyCollection\\\",\\\"collectionExportName\\\":\\\"UsersOAuthRefreshFamilyCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"users_oauth_refresh_families\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_oauth_refresh_families\\\\\\\" (\\\\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 \\\\\\\"authorization_id\\\\\\\" TEXT,\\\\n \\\\\\\"revoked_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\\\"},\\\"authorization_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"revoked_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_oauth_refresh_families_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_oauth_refresh_families_authorization_id_idx\\\",\\\"columns\\\":[\\\"authorization_id\\\"]},{\\\"name\\\":\\\"users_oauth_refresh_families_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"37392f31\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersPasskeyChallengeCollection\\\":{\\\"name\\\":\\\"userspasskeychallengecollection\\\",\\\"className\\\":\\\"UsersPasskeyChallengeCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersPasskeyChallengeCollection\\\",\\\"collection\\\":\\\"userspasskeychallenges\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/PasskeyChallengeCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"consume\\\":{\\\"name\\\":\\\"consume\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"challengeHash\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"purpose\\\",\\\"type\\\":\\\"PasskeyChallengePurpose\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"expiresAt\\\",\\\"type\\\":\\\"Date\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"deleteExpired\\\":{\\\"name\\\":\\\"deleteExpired\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"boolean\\\"]}],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_passkey_challenges\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"UsersPasskeyChallenge\\\",\\\"exportName\\\":\\\"UsersPasskeyChallengeCollection\\\",\\\"collectionExportName\\\":\\\"UsersPasskeyChallengeCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"users_passkey_challenges\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_passkey_challenges\\\\\\\" (\\\\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 \\\\\\\"challenge_hash\\\\\\\" TEXT NOT NULL UNIQUE,\\\\n \\\\\\\"purpose\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"expires_at\\\\\\\" TIMESTAMP NOT NULL\\\\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\\\"},\\\"challenge_hash\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":true},\\\"purpose\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"expires_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_passkey_challenges_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_passkey_challenges_expires_at_idx\\\",\\\"columns\\\":[\\\"expires_at\\\"]},{\\\"name\\\":\\\"users_passkey_challenges_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"895dcef7\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersPasskeyCredentialCollection\\\":{\\\"name\\\":\\\"userspasskeycredentialcollection\\\",\\\"className\\\":\\\"UsersPasskeyCredentialCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersPasskeyCredentialCollection\\\",\\\"collection\\\":\\\"userspasskeycredentials\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/PasskeyCredentialCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"findByCredentialId\\\":{\\\"name\\\":\\\"findByCredentialId\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"credentialId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<UsersPasskeyCredential | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"listByUserId\\\":{\\\"name\\\":\\\"listByUserId\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<UsersPasskeyCredential[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"countByUserId\\\":{\\\"name\\\":\\\"countByUserId\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findOwned\\\":{\\\"name\\\":\\\"findOwned\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"id\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<UsersPasskeyCredential | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"insertIfAbsent\\\":{\\\"name\\\":\\\"insertIfAbsent\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"write\\\",\\\"type\\\":\\\"PasskeyCredentialWrite\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<UsersPasskeyCredential | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"recordUseIfCurrent\\\":{\\\"name\\\":\\\"recordUseIfCurrent\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"id\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"expectedSignCount\\\",\\\"type\\\":\\\"number\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"newSignCount\\\",\\\"type\\\":\\\"number\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"backedUp\\\",\\\"type\\\":\\\"boolean\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"now\\\",\\\"type\\\":\\\"Date\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"renameOwned\\\":{\\\"name\\\":\\\"renameOwned\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"id\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"name\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"deleteOwned\\\":{\\\"name\\\":\\\"deleteOwned\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"id\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"deleteAllForUser\\\":{\\\"name\\\":\\\"deleteAllForUser\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_passkey_credentials\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"UsersPasskeyCredential\\\",\\\"exportName\\\":\\\"UsersPasskeyCredentialCollection\\\",\\\"collectionExportName\\\":\\\"UsersPasskeyCredentialCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"users_passkey_credentials\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_passkey_credentials\\\\\\\" (\\\\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 \\\\\\\"user_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"credential_id\\\\\\\" TEXT NOT NULL UNIQUE,\\\\n \\\\\\\"public_key\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"sign_count\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"transports\\\\\\\" TEXT,\\\\n \\\\\\\"name\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"aaguid\\\\\\\" TEXT,\\\\n \\\\\\\"backed_up\\\\\\\" BOOLEAN NOT NULL DEFAULT FALSE,\\\\n \\\\\\\"device_type\\\\\\\" TEXT,\\\\n \\\\\\\"last_used_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"created_by\\\\\\\" TEXT\\\\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\\\"},\\\"user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"users\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"credential_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":true},\\\"public_key\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"sign_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"transports\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"aaguid\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"backed_up\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":false},\\\"device_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"last_used_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"created_by\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_passkey_credentials_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_passkey_credentials_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]},{\\\"name\\\":\\\"users_passkey_credentials_user_id_idx\\\",\\\"columns\\\":[\\\"user_id\\\"]}],\\\"version\\\":\\\"4483d2e2\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersPasswordCredentialCollection\\\":{\\\"name\\\":\\\"userspasswordcredentialcollection\\\",\\\"className\\\":\\\"UsersPasswordCredentialCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersPasswordCredentialCollection\\\",\\\"collection\\\":\\\"userspasswordcredentials\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/PasswordCredentialCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"findByUserId\\\":{\\\"name\\\":\\\"findByUserId\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<UsersPasswordCredential | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"insertIfAbsent\\\":{\\\"name\\\":\\\"insertIfAbsent\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"write\\\",\\\"type\\\":\\\"PasswordCredentialWrite\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<UsersPasswordCredential | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"upsertForUser\\\":{\\\"name\\\":\\\"upsertForUser\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"write\\\",\\\"type\\\":\\\"PasswordCredentialWrite\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<UsersPasswordCredential>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"replaceIfCurrent\\\":{\\\"name\\\":\\\"replaceIfCurrent\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"expected\\\",\\\"type\\\":\\\"UsersPasswordCredential\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"write\\\",\\\"type\\\":\\\"Omit<PasswordCredentialWrite, 'mustChange'>\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"deleteIfCurrent\\\":{\\\"name\\\":\\\"deleteIfCurrent\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"expected\\\",\\\"type\\\":\\\"UsersPasswordCredential\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"replaceHashIfUnchanged\\\":{\\\"name\\\":\\\"replaceHashIfUnchanged\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"expectedHash\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"upgradedHash\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"deleteByUserId\\\":{\\\"name\\\":\\\"deleteByUserId\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_password_credentials\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"UsersPasswordCredential\\\",\\\"exportName\\\":\\\"UsersPasswordCredentialCollection\\\",\\\"collectionExportName\\\":\\\"UsersPasswordCredentialCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"users_password_credentials\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_password_credentials\\\\\\\" (\\\\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 \\\\\\\"user_id\\\\\\\" UUID NOT NULL UNIQUE,\\\\n \\\\\\\"password_hash\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"version\\\\\\\" INTEGER NOT NULL DEFAULT 1,\\\\n \\\\\\\"must_change\\\\\\\" BOOLEAN NOT NULL DEFAULT FALSE,\\\\n \\\\\\\"rotated_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"rotated_by\\\\\\\" TEXT\\\\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\\\"},\\\"user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":true,\\\"foreignKey\\\":{\\\"table\\\":\\\"users\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"password_hash\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"version\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":1},\\\"must_change\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":false},\\\"rotated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"rotated_by\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_password_credentials_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_password_credentials_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"9a828f77\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:PermissionCollection\\\":{\\\"name\\\":\\\"permissioncollection\\\",\\\"className\\\":\\\"PermissionCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:PermissionCollection\\\",\\\"collection\\\":\\\"permissions\\\",\\\"description\\\":\\\"Collection for managing Permission objects\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/PermissionCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"findByCategory\\\":{\\\"name\\\":\\\"findByCategory\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"category\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Permission[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findBySlug\\\":{\\\"name\\\":\\\"findBySlug\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"slug\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Permission | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findByIds\\\":{\\\"name\\\":\\\"findByIds\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"ids\\\",\\\"type\\\":\\\"string[]\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Map<string, Permission>>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getCategories\\\":{\\\"name\\\":\\\"getCategories\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<string[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findOrCreate\\\":{\\\"name\\\":\\\"findOrCreate\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"slug\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"defaults\\\",\\\"type\\\":\\\"Partial<object>\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"string\\\"]}],\\\"returnType\\\":\\\"Promise<Permission>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"Permission\\\",\\\"exportName\\\":\\\"PermissionCollection\\\",\\\"collectionExportName\\\":\\\"PermissionCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"permissions\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"permissions\\\\\\\" (\\\\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 \\\\\\\"name\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"description\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"category\\\\\\\" TEXT 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\\\"},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"description\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"category\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"}},\\\"indexes\\\":[{\\\"name\\\":\\\"permissions_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"permissions_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"4c81b2af\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersPinCredentialCollection\\\":{\\\"name\\\":\\\"userspincredentialcollection\\\",\\\"className\\\":\\\"UsersPinCredentialCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersPinCredentialCollection\\\",\\\"collection\\\":\\\"userspincredentials\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/PinCredentialCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"findByUserId\\\":{\\\"name\\\":\\\"findByUserId\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<UsersPinCredential | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"upsertForUser\\\":{\\\"name\\\":\\\"upsertForUser\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"write\\\",\\\"type\\\":\\\"PinCredentialWrite\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<UsersPinCredential>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"deleteByUserId\\\":{\\\"name\\\":\\\"deleteByUserId\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_pin_credentials\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"UsersPinCredential\\\",\\\"exportName\\\":\\\"UsersPinCredentialCollection\\\",\\\"collectionExportName\\\":\\\"UsersPinCredentialCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"users_pin_credentials\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_pin_credentials\\\\\\\" (\\\\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 \\\\\\\"user_id\\\\\\\" UUID NOT NULL UNIQUE,\\\\n \\\\\\\"pin_hash\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"version\\\\\\\" INTEGER NOT NULL DEFAULT 1,\\\\n \\\\\\\"must_reset\\\\\\\" BOOLEAN NOT NULL DEFAULT FALSE,\\\\n \\\\\\\"rotated_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"rotated_by\\\\\\\" TEXT\\\\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\\\"},\\\"user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":true,\\\"foreignKey\\\":{\\\"table\\\":\\\"users\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"pin_hash\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"version\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":1},\\\"must_reset\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":false},\\\"rotated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"rotated_by\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_pin_credentials_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_pin_credentials_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"0e2fa003\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:ResourceGrantCollection\\\":{\\\"name\\\":\\\"resourcegrantcollection\\\",\\\"className\\\":\\\"ResourceGrantCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:ResourceGrantCollection\\\",\\\"collection\\\":\\\"resourcegrants\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/ResourceGrantCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"findExact\\\":{\\\"name\\\":\\\"findExact\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"resourceType\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"resourceId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"permission\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<ResourceGrant[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findChildren\\\":{\\\"name\\\":\\\"findChildren\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"parentGrantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<ResourceGrant[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"ResourceGrant\\\",\\\"exportName\\\":\\\"ResourceGrantCollection\\\",\\\"collectionExportName\\\":\\\"ResourceGrantCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"resource_grants\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"resource_grants\\\\\\\" (\\\\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 NOT NULL,\\\\n \\\\\\\"user_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"resource_type\\\\\\\" TEXT,\\\\n \\\\\\\"resource_id\\\\\\\" TEXT,\\\\n \\\\\\\"permission\\\\\\\" TEXT,\\\\n \\\\\\\"effect\\\\\\\" TEXT,\\\\n \\\\\\\"can_delegate\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"parent_grant_id\\\\\\\" UUID,\\\\n \\\\\\\"revoked_at\\\\\\\" TEXT\\\\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\\\":true,\\\"unique\\\":false},\\\"user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"users\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"resource_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"resource_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"permission\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"effect\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"can_delegate\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":false},\\\"parent_grant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"resource_grants\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"revoked_at\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"resource_grants_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"resource_grants_lookup_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"user_id\\\"]},{\\\"name\\\":\\\"resource_grants_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"resource_grants_user_id_idx\\\",\\\"columns\\\":[\\\"user_id\\\"]},{\\\"name\\\":\\\"resource_grants_parent_grant_id_idx\\\",\\\"columns\\\":[\\\"parent_grant_id\\\"]}],\\\"version\\\":\\\"52e03776\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:RoleCollection\\\":{\\\"name\\\":\\\"rolecollection\\\",\\\"className\\\":\\\"RoleCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:RoleCollection\\\",\\\"collection\\\":\\\"roles\\\",\\\"description\\\":\\\"Collection for managing Role objects\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/RoleCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"findSystemRoles\\\":{\\\"name\\\":\\\"findSystemRoles\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Role[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findByTenant\\\":{\\\"name\\\":\\\"findByTenant\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Role[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findTenantRoles\\\":{\\\"name\\\":\\\"findTenantRoles\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Role[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findBySlug\\\":{\\\"name\\\":\\\"findBySlug\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"slug\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Role | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findSystemRoleBySlug\\\":{\\\"name\\\":\\\"findSystemRoleBySlug\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"slug\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Role | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"seedSystemRoles\\\":{\\\"name\\\":\\\"seedSystemRoles\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SeedSystemRolesOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<Role[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"Role\\\",\\\"exportName\\\":\\\"RoleCollection\\\",\\\"collectionExportName\\\":\\\"RoleCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"roles\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"roles\\\\\\\" (\\\\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 \\\\\\\"is_system\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"inherits_to_descendants\\\\\\\" BOOLEAN DEFAULT FALSE\\\\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\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"tenants\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"description\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"is_system\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":false},\\\"inherits_to_descendants\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"roles_tenant_id_slug_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"roles_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"47369d9d\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:RolePermissionCollection\\\":{\\\"name\\\":\\\"rolepermissioncollection\\\",\\\"className\\\":\\\"RolePermissionCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:RolePermissionCollection\\\",\\\"collection\\\":\\\"rolepermissions\\\",\\\"description\\\":\\\"Collection for managing RolePermission objects\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/RolePermissionCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"findByRole\\\":{\\\"name\\\":\\\"findByRole\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"roleId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<RolePermission[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findByPermission\\\":{\\\"name\\\":\\\"findByPermission\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"permissionId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<RolePermission[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"hasPermission\\\":{\\\"name\\\":\\\"hasPermission\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"roleId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"permissionId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"addPermission\\\":{\\\"name\\\":\\\"addPermission\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"roleId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"permissionId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<RolePermission>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"removePermission\\\":{\\\"name\\\":\\\"removePermission\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"roleId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"permissionId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getPermissionIds\\\":{\\\"name\\\":\\\"getPermissionIds\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"roleId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<string[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"seedRolePermissions\\\":{\\\"name\\\":\\\"seedRolePermissions\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"matrix\\\",\\\"type\\\":\\\"RolePermissionPatternMatrix\\\",\\\"optional\\\":true},{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SeedRolePermissionsOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<SeedRolePermissionsResult>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"seedDefaultRolePersonalizationPermissions\\\":{\\\"name\\\":\\\"seedDefaultRolePersonalizationPermissions\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"Omit<SeedRolePermissionsOptions, 'prune'>\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<SeedRolePermissionsResult>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"RolePermission\\\",\\\"exportName\\\":\\\"RolePermissionCollection\\\",\\\"collectionExportName\\\":\\\"RolePermissionCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"role_permissions\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"role_permissions\\\\\\\" (\\\\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 \\\\\\\"role_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"permission_id\\\\\\\" UUID NOT NULL\\\\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\\\"},\\\"role_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"roles\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"permission_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"permissions\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}}},\\\"indexes\\\":[{\\\"name\\\":\\\"role_permissions_role_id_permission_id_idx\\\",\\\"columns\\\":[\\\"role_id\\\",\\\"permission_id\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"role_permissions_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"role_permissions_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]},{\\\"name\\\":\\\"role_permissions_permission_id_idx\\\",\\\"columns\\\":[\\\"permission_id\\\"]}],\\\"version\\\":\\\"4dfed3ac\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:SessionCollection\\\":{\\\"name\\\":\\\"sessioncollection\\\",\\\"className\\\":\\\"SessionCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:SessionCollection\\\",\\\"collection\\\":\\\"sessions\\\",\\\"description\\\":\\\"Collection for managing Session objects\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/SessionCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"createSession\\\":{\\\"name\\\":\\\"createSession\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"CreateSessionOptions\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Session>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findChildren\\\":{\\\"name\\\":\\\"findChildren\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"parentSessionId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Session[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"revokeChildren\\\":{\\\"name\\\":\\\"revokeChildren\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"parentSessionId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"string\\\"]}],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"revokeUserSessionsByAuthMethod\\\":{\\\"name\\\":\\\"revokeUserSessionsByAuthMethod\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"authMethod\\\",\\\"type\\\":\\\"SessionAuthMethod\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"string\\\"]}],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findValidSession\\\":{\\\"name\\\":\\\"findValidSession\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"sessionId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Session | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"touch\\\":{\\\"name\\\":\\\"touch\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"sessionId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"extendTtl\\\",\\\"type\\\":\\\"boolean\\\",\\\"optional\\\":true},{\\\"name\\\":\\\"ttl\\\",\\\"type\\\":\\\"number\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findByUser\\\":{\\\"name\\\":\\\"findByUser\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Session[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"deleteUserSessions\\\":{\\\"name\\\":\\\"deleteUserSessions\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"revokeUserSessions\\\":{\\\"name\\\":\\\"revokeUserSessions\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"string\\\"]}],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"revokeSession\\\":{\\\"name\\\":\\\"revokeSession\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"sessionId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"deleteExpired\\\":{\\\"name\\\":\\\"deleteExpired\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"boolean\\\"]}],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"countUserSessions\\\":{\\\"name\\\":\\\"countUserSessions\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"userId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setSessionTenant\\\":{\\\"name\\\":\\\"setSessionTenant\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"sessionId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string | null\\\",\\\"optional\\\":false,\\\"unionBranches\\\":[{\\\"type\\\":\\\"string\\\"},{\\\"type\\\":\\\"null\\\"}]}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setSessionData\\\":{\\\"name\\\":\\\"setSessionData\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"sessionId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"key\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"value\\\",\\\"type\\\":\\\"unknown\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getSessionData\\\":{\\\"name\\\":\\\"getSessionData\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"sessionId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"key\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<T | undefined>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"get\\\",\\\"delete\\\"]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"Session\\\",\\\"exportName\\\":\\\"SessionCollection\\\",\\\"collectionExportName\\\":\\\"SessionCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"sessions\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"sessions\\\\\\\" (\\\\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 \\\\\\\"user_id\\\\\\\" UUID,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"status\\\\\\\" TEXT,\\\\n \\\\\\\"expires_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"user_agent\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"ip_address\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"last_accessed_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"data\\\\\\\" JSON DEFAULT '{}',\\\\n \\\\\\\"auth_method\\\\\\\" TEXT,\\\\n \\\\\\\"parent_session_id\\\\\\\" UUID\\\\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\\\"},\\\"user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"users\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"tenants\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"expires_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"user_agent\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"ip_address\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"last_accessed_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"data\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":{}},\\\"auth_method\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"parent_session_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"sessions_tenant_id_slug_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"sessions_expires_at_idx\\\",\\\"columns\\\":[\\\"expires_at\\\"]},{\\\"name\\\":\\\"sessions_parent_session_id_idx\\\",\\\"columns\\\":[\\\"parent_session_id\\\"]},{\\\"name\\\":\\\"sessions_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]},{\\\"name\\\":\\\"sessions_user_id_idx\\\",\\\"columns\\\":[\\\"user_id\\\"]}],\\\"version\\\":\\\"b4260a0f\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:TenantCollection\\\":{\\\"name\\\":\\\"tenantcollection\\\",\\\"className\\\":\\\"TenantCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:TenantCollection\\\",\\\"collection\\\":\\\"tenants\\\",\\\"description\\\":\\\"Collection for managing Tenant objects with hierarchical support.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/TenantCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"findByStatus\\\":{\\\"name\\\":\\\"findByStatus\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"status\\\",\\\"type\\\":\\\"TenantStatus\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Tenant[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findActive\\\":{\\\"name\\\":\\\"findActive\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Tenant[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findBySlug\\\":{\\\"name\\\":\\\"findBySlug\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"slug\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Tenant | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findRoots\\\":{\\\"name\\\":\\\"findRoots\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<Tenant[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findChildren\\\":{\\\"name\\\":\\\"findChildren\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"parentTenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Tenant[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findParent\\\":{\\\"name\\\":\\\"findParent\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Tenant | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getAncestors\\\":{\\\"name\\\":\\\"getAncestors\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Tenant[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getAncestorIds\\\":{\\\"name\\\":\\\"getAncestorIds\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<string[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getAncestorsFromRoot\\\":{\\\"name\\\":\\\"getAncestorsFromRoot\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Tenant[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getDescendants\\\":{\\\"name\\\":\\\"getDescendants\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Tenant[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getDescendantIds\\\":{\\\"name\\\":\\\"getDescendantIds\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<string[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getSiblings\\\":{\\\"name\\\":\\\"getSiblings\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Tenant[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isAncestorOf\\\":{\\\"name\\\":\\\"isAncestorOf\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"potentialAncestorId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isDescendantOf\\\":{\\\"name\\\":\\\"isDescendantOf\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"potentialDescendantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"requireChildOf\\\":{\\\"name\\\":\\\"requireChildOf\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"parentId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"childId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"withTenantCatalogReadScope\\\":{\\\"name\\\":\\\"withTenantCatalogReadScope\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"TenantReadScopeOptions\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"callback\\\",\\\"type\\\":\\\"Function\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<T>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"withTenantHierarchyContext\\\":{\\\"name\\\":\\\"withTenantHierarchyContext\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"rootTenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"TenantReadScopeOptions\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"callback\\\",\\\"type\\\":\\\"Function\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<T>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"createChild\\\":{\\\"name\\\":\\\"createChild\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"parentTenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"CreateChildTenantOptions\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Tenant>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"moveToParent\\\":{\\\"name\\\":\\\"moveToParent\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"newParentId\\\",\\\"type\\\":\\\"string | null\\\",\\\"optional\\\":false,\\\"unionBranches\\\":[{\\\"type\\\":\\\"string\\\"},{\\\"type\\\":\\\"null\\\"}]}],\\\"returnType\\\":\\\"Promise<Tenant>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"makeRoot\\\":{\\\"name\\\":\\\"makeRoot\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Tenant>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"validateHierarchy\\\":{\\\"name\\\":\\\"validateHierarchy\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<string[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getTree\\\":{\\\"name\\\":\\\"getTree\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"rootTenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"Tenant\\\",\\\"exportName\\\":\\\"TenantCollection\\\",\\\"collectionExportName\\\":\\\"TenantCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"tenants\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"tenants\\\\\\\" (\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"_meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"_meta_data\\\\\\\" JSON,\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"name\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"status\\\\\\\" TEXT,\\\\n \\\\\\\"description\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"parent_tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"hierarchy_level\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"hierarchy_path\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"cascade_permissions\\\\\\\" BOOLEAN DEFAULT TRUE,\\\\n \\\\\\\"inherit_permissions\\\\\\\" BOOLEAN DEFAULT TRUE\\\\n);\\\",\\\"columns\\\":{\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"_meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"_meta_data\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"default\\\":\\\"\\\"},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"description\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"default\\\":\\\"\\\"},\\\"parent_tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"tenants\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"hierarchy_level\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"hierarchy_path\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"default\\\":\\\"\\\"},\\\"cascade_permissions\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":true},\\\"inherit_permissions\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":true}},\\\"indexes\\\":[{\\\"name\\\":\\\"tenants_slug_context_meta_type_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\",\\\"_meta_type\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"tenants_meta_type_idx\\\",\\\"columns\\\":[\\\"_meta_type\\\"]},{\\\"name\\\":\\\"tenants_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]},{\\\"name\\\":\\\"tenants_parent_tenant_id_idx\\\",\\\"columns\\\":[\\\"parent_tenant_id\\\"]}],\\\"version\\\":\\\"934f7025\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:TenantIntegrationCollection\\\":{\\\"name\\\":\\\"tenantintegrationcollection\\\",\\\"className\\\":\\\"TenantIntegrationCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:TenantIntegrationCollection\\\",\\\"collection\\\":\\\"tenantintegrations\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/TenantIntegrationCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"listForTenant\\\":{\\\"name\\\":\\\"listForTenant\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<TenantIntegration[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findFor\\\":{\\\"name\\\":\\\"findFor\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"provider\\\",\\\"type\\\":\\\"TenantIntegrationProvider\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<TenantIntegration | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findOrInit\\\":{\\\"name\\\":\\\"findOrInit\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"provider\\\",\\\"type\\\":\\\"TenantIntegrationProvider\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<TenantIntegration>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"tenant_integrations\\\",\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"TenantIntegration\\\",\\\"exportName\\\":\\\"TenantIntegrationCollection\\\",\\\"collectionExportName\\\":\\\"TenantIntegrationCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"tenant_integrations\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"tenant_integrations\\\\\\\" (\\\\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 NOT NULL,\\\\n \\\\\\\"provider\\\\\\\" TEXT DEFAULT 'aws',\\\\n \\\\\\\"external_ids\\\\\\\" TEXT,\\\\n \\\\\\\"status\\\\\\\" TEXT DEFAULT 'unprovisioned',\\\\n \\\\\\\"last_checked_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"last_check_summary\\\\\\\" TEXT,\\\\n \\\\\\\"last_error\\\\\\\" TEXT\\\\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\\\":true,\\\"unique\\\":false},\\\"provider\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"aws\\\"},\\\"external_ids\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"unprovisioned\\\"},\\\"last_checked_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"last_check_summary\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"last_error\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"tenant_integrations_tenant_id_provider_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"provider\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"tenant_integrations_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"tenant_integrations_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]}],\\\"version\\\":\\\"3ed31966\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:TenantPermissionOverrideCollection\\\":{\\\"name\\\":\\\"tenantpermissionoverridecollection\\\",\\\"className\\\":\\\"TenantPermissionOverrideCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:TenantPermissionOverrideCollection\\\",\\\"collection\\\":\\\"tenantpermissionoverrides\\\",\\\"description\\\":\\\"Collection for managing TenantPermissionOverride objects.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/TenantPermissionOverrideCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"findByTenant\\\":{\\\"name\\\":\\\"findByTenant\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<TenantPermissionOverride[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findGrants\\\":{\\\"name\\\":\\\"findGrants\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<TenantPermissionOverride[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findDenies\\\":{\\\"name\\\":\\\"findDenies\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<TenantPermissionOverride[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findInherits\\\":{\\\"name\\\":\\\"findInherits\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<TenantPermissionOverride[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getGrantedPermissionIds\\\":{\\\"name\\\":\\\"getGrantedPermissionIds\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<string[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getDeniedPermissionIds\\\":{\\\"name\\\":\\\"getDeniedPermissionIds\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<string[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getOverridesByEffect\\\":{\\\"name\\\":\\\"getOverridesByEffect\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<TenantPermissionOverrideResult>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getOverridesByEffectBatch\\\":{\\\"name\\\":\\\"getOverridesByEffectBatch\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantIds\\\",\\\"type\\\":\\\"string[]\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<Map<string, TenantPermissionOverrideResult>>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setOverride\\\":{\\\"name\\\":\\\"setOverride\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"permissionId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"effect\\\",\\\"type\\\":\\\"TenantPermissionEffect\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<TenantPermissionOverride>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"removeOverride\\\":{\\\"name\\\":\\\"removeOverride\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"permissionId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"removeAllOverrides\\\":{\\\"name\\\":\\\"removeAllOverrides\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<number>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"grantPermission\\\":{\\\"name\\\":\\\"grantPermission\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"permissionId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<TenantPermissionOverride>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"denyPermission\\\":{\\\"name\\\":\\\"denyPermission\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"permissionId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<TenantPermissionOverride>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"inheritPermission\\\":{\\\"name\\\":\\\"inheritPermission\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"permissionId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<TenantPermissionOverride>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"bulkSetOverrides\\\":{\\\"name\\\":\\\"bulkSetOverrides\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"overrides\\\",\\\"type\\\":\\\"Array<object>\\\",\\\"optional\\\":false,\\\"memberTypes\\\":[\\\"string\\\",\\\"TenantPermissionEffect\\\"]}],\\\"returnType\\\":\\\"Promise<TenantPermissionOverride[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"copyOverrides\\\":{\\\"name\\\":\\\"copyOverrides\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"fromTenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"toTenantId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<TenantPermissionOverride[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"TenantPermissionOverride\\\",\\\"exportName\\\":\\\"TenantPermissionOverrideCollection\\\",\\\"collectionExportName\\\":\\\"TenantPermissionOverrideCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"tenant_permission_overrides\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"tenant_permission_overrides\\\\\\\" (\\\\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 NOT NULL,\\\\n \\\\\\\"permission_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"effect\\\\\\\" TEXT\\\\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\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"tenants\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"permission_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"permissions\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"effect\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"tenant_permission_overrides_tenant_id_permission_id_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"permission_id\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"tenant_permission_overrides_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"tenant_permission_overrides_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]},{\\\"name\\\":\\\"tenant_permission_overrides_permission_id_idx\\\",\\\"columns\\\":[\\\"permission_id\\\"]}],\\\"version\\\":\\\"95b78bdd\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UserCollection\\\":{\\\"name\\\":\\\"usercollection\\\",\\\"className\\\":\\\"UserCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UserCollection\\\",\\\"collection\\\":\\\"users\\\",\\\"description\\\":\\\"Collection for managing User objects\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/collections/UserCollection.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"findByEmail\\\":{\\\"name\\\":\\\"findByEmail\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"email\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<User | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findCanonicalByEmail\\\":{\\\"name\\\":\\\"findCanonicalByEmail\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"email\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<User | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findByProfile\\\":{\\\"name\\\":\\\"findByProfile\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"profileId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<User | null>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findByStatus\\\":{\\\"name\\\":\\\"findByStatus\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"status\\\",\\\"type\\\":\\\"UserStatus\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<User[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findActive\\\":{\\\"name\\\":\\\"findActive\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<User[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"findPending\\\":{\\\"name\\\":\\\"findPending\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<User[]>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getOrCreateForProfile\\\":{\\\"name\\\":\\\"getOrCreateForProfile\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"profileId\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"email\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"defaults\\\",\\\"type\\\":\\\"Partial<object>\\\",\\\"optional\\\":true,\\\"memberTypes\\\":[\\\"UserStatus\\\"]}],\\\"returnType\\\":\\\"Promise<User>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getOrCreateFromOidc\\\":{\\\"name\\\":\\\"getOrCreateFromOidc\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"claims\\\",\\\"type\\\":\\\"OidcClaims\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"provider\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"GetOrCreateFromOidcOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<OidcIdentityResult>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"User\\\",\\\"exportName\\\":\\\"UserCollection\\\",\\\"collectionExportName\\\":\\\"UserCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"users\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users\\\\\\\" (\\\\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 \\\\\\\"profile_id\\\\\\\" UUID UNIQUE,\\\\n \\\\\\\"email\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"email_key\\\\\\\" TEXT UNIQUE,\\\\n \\\\\\\"username\\\\\\\" TEXT,\\\\n \\\\\\\"username_key\\\\\\\" TEXT UNIQUE,\\\\n \\\\\\\"status\\\\\\\" TEXT,\\\\n \\\\\\\"last_login_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\\\"},\\\"profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":true},\\\"email\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"email_key\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":true},\\\"username\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"username_key\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":true},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"last_login_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_email_idx\\\",\\\"columns\\\":[\\\"email\\\"]},{\\\"name\\\":\\\"users_username_idx\\\",\\\"columns\\\":[\\\"username\\\"]},{\\\"name\\\":\\\"users_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"3ee8f0f4\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:MemberClass\\\":{\\\"name\\\":\\\"memberclass\\\",\\\"className\\\":\\\"MemberClass\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:MemberClass\\\",\\\"collection\\\":\\\"memberclasses\\\",\\\"description\\\":\\\"A tenant-configured legal class; it has no authority or entitlement effect.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/member-register/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"sqlType\\\":\\\"UUID\\\",\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false}}},\\\"key\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"name\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false},\\\"description\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false},\\\"policyMetadata\\\":{\\\"type\\\":\\\"json\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"member_classes\\\",\\\"sensitive\\\":true,\\\"indexes\\\":[{\\\"name\\\":\\\"member_classes_tenant_key_uq\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"key\\\"],\\\"unique\\\":true}],\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"MemberClass\\\",\\\"collectionExportName\\\":\\\"MemberClassCollection\\\",\\\"displayLabelField\\\":\\\"name\\\",\\\"validationRules\\\":[],\\\"schema\\\":{\\\"tableName\\\":\\\"member_classes\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"member_classes\\\\\\\" (\\\\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 NOT NULL,\\\\n \\\\\\\"key\\\\\\\" TEXT,\\\\n \\\\\\\"name\\\\\\\" TEXT,\\\\n \\\\\\\"description\\\\\\\" TEXT,\\\\n \\\\\\\"policy_metadata\\\\\\\" JSON\\\\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\\\":true,\\\"unique\\\":false},\\\"key\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"description\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"policy_metadata\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"member_classes_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"member_classes_tenant_key_uq\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"key\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"member_classes_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]}],\\\"version\\\":\\\"0fa7a152\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:LegalMember\\\":{\\\"name\\\":\\\"legalmember\\\",\\\"className\\\":\\\"LegalMember\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:LegalMember\\\",\\\"collection\\\":\\\"legalmembers\\\",\\\"description\\\":\\\"The legal register entry, deliberately separate from RBAC Membership.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/member-register/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"sqlType\\\":\\\"UUID\\\",\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false}}},\\\"memberClassId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":false,\\\"related\\\":\\\"MemberClass\\\",\\\"_meta\\\":{\\\"onDelete\\\":\\\"RESTRICT\\\"}},\\\"kind\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{},\\\"enum\\\":[\\\"individual\\\",\\\"organisation\\\"]},\\\"displayName\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false},\\\"userId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":false,\\\"related\\\":\\\"User\\\",\\\"_meta\\\":{\\\"nullable\\\":true,\\\"onDelete\\\":\\\"RESTRICT\\\"}},\\\"profileId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-profiles:Profile\\\",\\\"_meta\\\":{\\\"nullable\\\":true,\\\"onDelete\\\":\\\"RESTRICT\\\"}},\\\"externalPartyRef\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"joinedOn\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"leftOn\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"status\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{},\\\"enum\\\":[\\\"active\\\",\\\"suspended\\\",\\\"resigned\\\",\\\"ceased\\\"]}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"legal_members\\\",\\\"sensitive\\\":true,\\\"indexes\\\":[{\\\"name\\\":\\\"legal_members_tenant_class_status_idx\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"memberClassId\\\",\\\"status\\\"]},{\\\"name\\\":\\\"legal_members_tenant_user_idx\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"userId\\\"]}],\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"LegalMember\\\",\\\"collectionExportName\\\":\\\"LegalMemberCollection\\\",\\\"validationRules\\\":[],\\\"schema\\\":{\\\"tableName\\\":\\\"legal_members\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"legal_members\\\\\\\" (\\\\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 NOT NULL,\\\\n \\\\\\\"member_class_id\\\\\\\" UUID,\\\\n \\\\\\\"kind\\\\\\\" TEXT,\\\\n \\\\\\\"display_name\\\\\\\" TEXT,\\\\n \\\\\\\"user_id\\\\\\\" UUID,\\\\n \\\\\\\"profile_id\\\\\\\" UUID,\\\\n \\\\\\\"external_party_ref\\\\\\\" TEXT,\\\\n \\\\\\\"joined_on\\\\\\\" TEXT,\\\\n \\\\\\\"left_on\\\\\\\" TEXT,\\\\n \\\\\\\"status\\\\\\\" TEXT\\\\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\\\":true,\\\"unique\\\":false},\\\"member_class_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"member_classes\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"RESTRICT\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"display_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"users\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"RESTRICT\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"external_party_ref\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"joined_on\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"left_on\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"legal_members_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"legal_members_tenant_class_status_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"member_class_id\\\",\\\"status\\\"]},{\\\"name\\\":\\\"legal_members_tenant_user_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"user_id\\\"]},{\\\"name\\\":\\\"legal_members_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"legal_members_member_class_id_idx\\\",\\\"columns\\\":[\\\"member_class_id\\\"]},{\\\"name\\\":\\\"legal_members_user_id_idx\\\",\\\"columns\\\":[\\\"user_id\\\"]},{\\\"name\\\":\\\"legal_members_profile_id_idx\\\",\\\"columns\\\":[\\\"profile_id\\\"]}],\\\"version\\\":\\\"b05fd9f3\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:LegalMemberStatusHistory\\\":{\\\"name\\\":\\\"legalmemberstatushistory\\\",\\\"className\\\":\\\"LegalMemberStatusHistory\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:LegalMemberStatusHistory\\\",\\\"collection\\\":\\\"legalmemberstatushistories\\\",\\\"description\\\":\\\"Append-only effective history; current status never erases it.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/member-register/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"sqlType\\\":\\\"UUID\\\",\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false}}},\\\"memberId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":false,\\\"related\\\":\\\"LegalMember\\\",\\\"_meta\\\":{\\\"onDelete\\\":\\\"RESTRICT\\\"}},\\\"status\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{},\\\"enum\\\":[\\\"active\\\",\\\"suspended\\\",\\\"resigned\\\",\\\"ceased\\\"]},\\\"effectiveOn\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"sequence\\\":{\\\"type\\\":\\\"integer\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"reason\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false},\\\"actorRef\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}}},\\\"methods\\\":{\\\"save\\\":{\\\"name\\\":\\\"save\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SmrtSaveOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"delete\\\":{\\\"name\\\":\\\"delete\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"legal_member_status_history\\\",\\\"sensitive\\\":true,\\\"indexes\\\":[{\\\"name\\\":\\\"legal_member_status_history_member_on_idx\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"memberId\\\",\\\"effectiveOn\\\"]}],\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"LegalMemberStatusHistory\\\",\\\"collectionExportName\\\":\\\"LegalMemberStatusHistoryCollection\\\",\\\"validationRules\\\":[],\\\"schema\\\":{\\\"tableName\\\":\\\"legal_member_status_history\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"legal_member_status_history\\\\\\\" (\\\\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 NOT NULL,\\\\n \\\\\\\"member_id\\\\\\\" UUID,\\\\n \\\\\\\"status\\\\\\\" TEXT,\\\\n \\\\\\\"effective_on\\\\\\\" TEXT,\\\\n \\\\\\\"sequence\\\\\\\" INTEGER,\\\\n \\\\\\\"reason\\\\\\\" TEXT,\\\\n \\\\\\\"actor_ref\\\\\\\" TEXT\\\\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\\\":true,\\\"unique\\\":false},\\\"member_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"legal_members\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"RESTRICT\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"effective_on\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"sequence\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"reason\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"actor_ref\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"legal_member_status_history_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"legal_member_status_history_member_on_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"member_id\\\",\\\"effective_on\\\"]},{\\\"name\\\":\\\"legal_member_status_history_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"legal_member_status_history_member_id_idx\\\",\\\"columns\\\":[\\\"member_id\\\"]}],\\\"version\\\":\\\"3885f61f\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:LegalMemberReference\\\":{\\\"name\\\":\\\"legalmemberreference\\\",\\\"className\\\":\\\"LegalMemberReference\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:LegalMemberReference\\\",\\\"collection\\\":\\\"legalmemberreferences\\\",\\\"description\\\":\\\"A link to authoritative share/dues/subscription/agreement/ledger evidence.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/member-register/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"sqlType\\\":\\\"UUID\\\",\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false}}},\\\"memberId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":false,\\\"related\\\":\\\"LegalMember\\\",\\\"_meta\\\":{\\\"onDelete\\\":\\\"RESTRICT\\\"}},\\\"kind\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{},\\\"enum\\\":[\\\"share\\\",\\\"dues\\\",\\\"subscription\\\",\\\"agreement\\\",\\\"ledger\\\"]},\\\"sourceType\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false},\\\"sourceId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false},\\\"authoritative\\\":{\\\"type\\\":\\\"boolean\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"effectiveFrom\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"effectiveTo\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"revokesId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":false,\\\"related\\\":\\\"LegalMemberReference\\\",\\\"_meta\\\":{\\\"nullable\\\":true,\\\"onDelete\\\":\\\"RESTRICT\\\"}}},\\\"methods\\\":{\\\"save\\\":{\\\"name\\\":\\\"save\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SmrtSaveOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"delete\\\":{\\\"name\\\":\\\"delete\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"legal_member_references\\\",\\\"sensitive\\\":true,\\\"indexes\\\":[{\\\"name\\\":\\\"legal_member_references_member_kind_idx\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"memberId\\\",\\\"kind\\\"]}],\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"LegalMemberReference\\\",\\\"collectionExportName\\\":\\\"LegalMemberReferenceCollection\\\",\\\"validationRules\\\":[],\\\"schema\\\":{\\\"tableName\\\":\\\"legal_member_references\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"legal_member_references\\\\\\\" (\\\\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 NOT NULL,\\\\n \\\\\\\"member_id\\\\\\\" UUID,\\\\n \\\\\\\"kind\\\\\\\" TEXT,\\\\n \\\\\\\"source_type\\\\\\\" TEXT,\\\\n \\\\\\\"source_id\\\\\\\" TEXT,\\\\n \\\\\\\"authoritative\\\\\\\" BOOLEAN,\\\\n \\\\\\\"effective_from\\\\\\\" TEXT,\\\\n \\\\\\\"effective_to\\\\\\\" TEXT,\\\\n \\\\\\\"revokes_id\\\\\\\" UUID\\\\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\\\":true,\\\"unique\\\":false},\\\"member_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"legal_members\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"RESTRICT\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"source_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"source_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"authoritative\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"effective_from\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"effective_to\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"revokes_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"legal_member_references\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"RESTRICT\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}}},\\\"indexes\\\":[{\\\"name\\\":\\\"legal_member_references_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"legal_member_references_member_kind_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"member_id\\\",\\\"kind\\\"]},{\\\"name\\\":\\\"legal_member_references_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"legal_member_references_member_id_idx\\\",\\\"columns\\\":[\\\"member_id\\\"]},{\\\"name\\\":\\\"legal_member_references_revokes_id_idx\\\",\\\"columns\\\":[\\\"revokes_id\\\"]}],\\\"version\\\":\\\"30237bd4\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:MemberOfficerAppointment\\\":{\\\"name\\\":\\\"memberofficerappointment\\\",\\\"className\\\":\\\"MemberOfficerAppointment\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:MemberOfficerAppointment\\\",\\\"collection\\\":\\\"memberofficerappointments\\\",\\\"description\\\":\\\"A dated register of board/officer appointments; it does not implement elections.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/member-register/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"sqlType\\\":\\\"UUID\\\",\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false}}},\\\"memberId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":false,\\\"related\\\":\\\"LegalMember\\\",\\\"_meta\\\":{\\\"onDelete\\\":\\\"RESTRICT\\\"}},\\\"role\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"effectiveFrom\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"effectiveTo\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"authority\\\":{\\\"type\\\":\\\"json\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"member_officer_appointments\\\",\\\"sensitive\\\":true,\\\"indexes\\\":[{\\\"name\\\":\\\"member_officer_appointments_member_term_idx\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"memberId\\\",\\\"effectiveFrom\\\"]}],\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"MemberOfficerAppointment\\\",\\\"collectionExportName\\\":\\\"MemberOfficerAppointmentCollection\\\",\\\"validationRules\\\":[],\\\"schema\\\":{\\\"tableName\\\":\\\"member_officer_appointments\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"member_officer_appointments\\\\\\\" (\\\\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 NOT NULL,\\\\n \\\\\\\"member_id\\\\\\\" UUID,\\\\n \\\\\\\"role\\\\\\\" TEXT,\\\\n \\\\\\\"effective_from\\\\\\\" TEXT,\\\\n \\\\\\\"effective_to\\\\\\\" TEXT,\\\\n \\\\\\\"authority\\\\\\\" JSON\\\\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\\\":true,\\\"unique\\\":false},\\\"member_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"legal_members\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"RESTRICT\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"role\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"effective_from\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"effective_to\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"authority\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"member_officer_appointments_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"member_officer_appointments_member_term_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"member_id\\\",\\\"effective_from\\\"]},{\\\"name\\\":\\\"member_officer_appointments_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"member_officer_appointments_member_id_idx\\\",\\\"columns\\\":[\\\"member_id\\\"]}],\\\"version\\\":\\\"eed54759\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:MemberEligibilitySnapshot\\\":{\\\"name\\\":\\\"membereligibilitysnapshot\\\",\\\"className\\\":\\\"MemberEligibilitySnapshot\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:MemberEligibilitySnapshot\\\",\\\"collection\\\":\\\"membereligibilitysnapshots\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/member-register/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"sqlType\\\":\\\"UUID\\\",\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false}}},\\\"memberId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":false,\\\"related\\\":\\\"LegalMember\\\",\\\"_meta\\\":{\\\"onDelete\\\":\\\"RESTRICT\\\"}},\\\"recordDate\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"eligible\\\":{\\\"type\\\":\\\"boolean\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"reason\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false},\\\"evidence\\\":{\\\"type\\\":\\\"json\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}}},\\\"methods\\\":{\\\"save\\\":{\\\"name\\\":\\\"save\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SmrtSaveOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"delete\\\":{\\\"name\\\":\\\"delete\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"member_eligibility_snapshots\\\",\\\"sensitive\\\":true,\\\"indexes\\\":[{\\\"name\\\":\\\"member_eligibility_snapshots_tenant_date_idx\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"recordDate\\\"]}],\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"MemberEligibilitySnapshot\\\",\\\"collectionExportName\\\":\\\"MemberEligibilitySnapshotCollection\\\",\\\"validationRules\\\":[],\\\"schema\\\":{\\\"tableName\\\":\\\"member_eligibility_snapshots\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"member_eligibility_snapshots\\\\\\\" (\\\\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 NOT NULL,\\\\n \\\\\\\"member_id\\\\\\\" UUID,\\\\n \\\\\\\"record_date\\\\\\\" TEXT,\\\\n \\\\\\\"eligible\\\\\\\" BOOLEAN,\\\\n \\\\\\\"reason\\\\\\\" TEXT,\\\\n \\\\\\\"evidence\\\\\\\" JSON\\\\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\\\":true,\\\"unique\\\":false},\\\"member_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"legal_members\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"RESTRICT\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"record_date\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"eligible\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"reason\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"evidence\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"member_eligibility_snapshots_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"member_eligibility_snapshots_tenant_date_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"record_date\\\"]},{\\\"name\\\":\\\"member_eligibility_snapshots_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"member_eligibility_snapshots_member_id_idx\\\",\\\"columns\\\":[\\\"member_id\\\"]}],\\\"version\\\":\\\"f3899c14\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:MemberClassCollection\\\":{\\\"name\\\":\\\"memberclasscollection\\\",\\\"className\\\":\\\"MemberClassCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:MemberClassCollection\\\",\\\"collection\\\":\\\"memberclasses\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/member-register/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"tableName\\\":\\\"member_classes\\\"},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"MemberClass\\\",\\\"exportName\\\":\\\"MemberClassCollection\\\",\\\"collectionExportName\\\":\\\"MemberClassCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"member_classes\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"member_classes\\\\\\\" (\\\\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 NOT NULL,\\\\n \\\\\\\"key\\\\\\\" TEXT,\\\\n \\\\\\\"name\\\\\\\" TEXT,\\\\n \\\\\\\"description\\\\\\\" TEXT,\\\\n \\\\\\\"policy_metadata\\\\\\\" JSON\\\\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\\\":true,\\\"unique\\\":false},\\\"key\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"description\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"policy_metadata\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"member_classes_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"member_classes_tenant_key_uq\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"key\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"member_classes_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]}],\\\"version\\\":\\\"0fa7a152\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:LegalMemberCollection\\\":{\\\"name\\\":\\\"legalmembercollection\\\",\\\"className\\\":\\\"LegalMemberCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:LegalMemberCollection\\\",\\\"collection\\\":\\\"legalmembers\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/member-register/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"tableName\\\":\\\"legal_members\\\"},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"LegalMember\\\",\\\"exportName\\\":\\\"LegalMemberCollection\\\",\\\"collectionExportName\\\":\\\"LegalMemberCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"legal_members\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"legal_members\\\\\\\" (\\\\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 NOT NULL,\\\\n \\\\\\\"member_class_id\\\\\\\" UUID,\\\\n \\\\\\\"kind\\\\\\\" TEXT,\\\\n \\\\\\\"display_name\\\\\\\" TEXT,\\\\n \\\\\\\"user_id\\\\\\\" UUID,\\\\n \\\\\\\"profile_id\\\\\\\" UUID,\\\\n \\\\\\\"external_party_ref\\\\\\\" TEXT,\\\\n \\\\\\\"joined_on\\\\\\\" TEXT,\\\\n \\\\\\\"left_on\\\\\\\" TEXT,\\\\n \\\\\\\"status\\\\\\\" TEXT\\\\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\\\":true,\\\"unique\\\":false},\\\"member_class_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"member_classes\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"RESTRICT\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"display_name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"users\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"RESTRICT\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"external_party_ref\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"joined_on\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"left_on\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"legal_members_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"legal_members_tenant_class_status_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"member_class_id\\\",\\\"status\\\"]},{\\\"name\\\":\\\"legal_members_tenant_user_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"user_id\\\"]},{\\\"name\\\":\\\"legal_members_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"legal_members_member_class_id_idx\\\",\\\"columns\\\":[\\\"member_class_id\\\"]},{\\\"name\\\":\\\"legal_members_user_id_idx\\\",\\\"columns\\\":[\\\"user_id\\\"]},{\\\"name\\\":\\\"legal_members_profile_id_idx\\\",\\\"columns\\\":[\\\"profile_id\\\"]}],\\\"version\\\":\\\"b05fd9f3\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:LegalMemberStatusHistoryCollection\\\":{\\\"name\\\":\\\"legalmemberstatushistorycollection\\\",\\\"className\\\":\\\"LegalMemberStatusHistoryCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:LegalMemberStatusHistoryCollection\\\",\\\"collection\\\":\\\"legalmemberstatushistories\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/member-register/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"tableName\\\":\\\"legal_member_status_history\\\"},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"LegalMemberStatusHistory\\\",\\\"exportName\\\":\\\"LegalMemberStatusHistoryCollection\\\",\\\"collectionExportName\\\":\\\"LegalMemberStatusHistoryCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"legal_member_status_history\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"legal_member_status_history\\\\\\\" (\\\\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 NOT NULL,\\\\n \\\\\\\"member_id\\\\\\\" UUID,\\\\n \\\\\\\"status\\\\\\\" TEXT,\\\\n \\\\\\\"effective_on\\\\\\\" TEXT,\\\\n \\\\\\\"sequence\\\\\\\" INTEGER,\\\\n \\\\\\\"reason\\\\\\\" TEXT,\\\\n \\\\\\\"actor_ref\\\\\\\" TEXT\\\\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\\\":true,\\\"unique\\\":false},\\\"member_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"legal_members\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"RESTRICT\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"effective_on\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"sequence\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"reason\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"actor_ref\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"legal_member_status_history_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"legal_member_status_history_member_on_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"member_id\\\",\\\"effective_on\\\"]},{\\\"name\\\":\\\"legal_member_status_history_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"legal_member_status_history_member_id_idx\\\",\\\"columns\\\":[\\\"member_id\\\"]}],\\\"version\\\":\\\"3885f61f\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:LegalMemberReferenceCollection\\\":{\\\"name\\\":\\\"legalmemberreferencecollection\\\",\\\"className\\\":\\\"LegalMemberReferenceCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:LegalMemberReferenceCollection\\\",\\\"collection\\\":\\\"legalmemberreferences\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/member-register/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"tableName\\\":\\\"legal_member_references\\\"},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"LegalMemberReference\\\",\\\"exportName\\\":\\\"LegalMemberReferenceCollection\\\",\\\"collectionExportName\\\":\\\"LegalMemberReferenceCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"legal_member_references\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"legal_member_references\\\\\\\" (\\\\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 NOT NULL,\\\\n \\\\\\\"member_id\\\\\\\" UUID,\\\\n \\\\\\\"kind\\\\\\\" TEXT,\\\\n \\\\\\\"source_type\\\\\\\" TEXT,\\\\n \\\\\\\"source_id\\\\\\\" TEXT,\\\\n \\\\\\\"authoritative\\\\\\\" BOOLEAN,\\\\n \\\\\\\"effective_from\\\\\\\" TEXT,\\\\n \\\\\\\"effective_to\\\\\\\" TEXT,\\\\n \\\\\\\"revokes_id\\\\\\\" UUID\\\\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\\\":true,\\\"unique\\\":false},\\\"member_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"legal_members\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"RESTRICT\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"source_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"source_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"authoritative\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"effective_from\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"effective_to\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"revokes_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"legal_member_references\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"RESTRICT\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}}},\\\"indexes\\\":[{\\\"name\\\":\\\"legal_member_references_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"legal_member_references_member_kind_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"member_id\\\",\\\"kind\\\"]},{\\\"name\\\":\\\"legal_member_references_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"legal_member_references_member_id_idx\\\",\\\"columns\\\":[\\\"member_id\\\"]},{\\\"name\\\":\\\"legal_member_references_revokes_id_idx\\\",\\\"columns\\\":[\\\"revokes_id\\\"]}],\\\"version\\\":\\\"30237bd4\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:MemberOfficerAppointmentCollection\\\":{\\\"name\\\":\\\"memberofficerappointmentcollection\\\",\\\"className\\\":\\\"MemberOfficerAppointmentCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:MemberOfficerAppointmentCollection\\\",\\\"collection\\\":\\\"memberofficerappointments\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/member-register/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"tableName\\\":\\\"member_officer_appointments\\\"},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"MemberOfficerAppointment\\\",\\\"exportName\\\":\\\"MemberOfficerAppointmentCollection\\\",\\\"collectionExportName\\\":\\\"MemberOfficerAppointmentCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"member_officer_appointments\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"member_officer_appointments\\\\\\\" (\\\\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 NOT NULL,\\\\n \\\\\\\"member_id\\\\\\\" UUID,\\\\n \\\\\\\"role\\\\\\\" TEXT,\\\\n \\\\\\\"effective_from\\\\\\\" TEXT,\\\\n \\\\\\\"effective_to\\\\\\\" TEXT,\\\\n \\\\\\\"authority\\\\\\\" JSON\\\\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\\\":true,\\\"unique\\\":false},\\\"member_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"legal_members\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"RESTRICT\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"role\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"effective_from\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"effective_to\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"authority\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"member_officer_appointments_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"member_officer_appointments_member_term_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"member_id\\\",\\\"effective_from\\\"]},{\\\"name\\\":\\\"member_officer_appointments_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"member_officer_appointments_member_id_idx\\\",\\\"columns\\\":[\\\"member_id\\\"]}],\\\"version\\\":\\\"eed54759\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:MemberEligibilitySnapshotCollection\\\":{\\\"name\\\":\\\"membereligibilitysnapshotcollection\\\",\\\"className\\\":\\\"MemberEligibilitySnapshotCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:MemberEligibilitySnapshotCollection\\\",\\\"collection\\\":\\\"membereligibilitysnapshots\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/member-register/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"tableName\\\":\\\"member_eligibility_snapshots\\\"},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"MemberEligibilitySnapshot\\\",\\\"exportName\\\":\\\"MemberEligibilitySnapshotCollection\\\",\\\"collectionExportName\\\":\\\"MemberEligibilitySnapshotCollectionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"member_eligibility_snapshots\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"member_eligibility_snapshots\\\\\\\" (\\\\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 NOT NULL,\\\\n \\\\\\\"member_id\\\\\\\" UUID,\\\\n \\\\\\\"record_date\\\\\\\" TEXT,\\\\n \\\\\\\"eligible\\\\\\\" BOOLEAN,\\\\n \\\\\\\"reason\\\\\\\" TEXT,\\\\n \\\\\\\"evidence\\\\\\\" JSON\\\\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\\\":true,\\\"unique\\\":false},\\\"member_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"legal_members\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"RESTRICT\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"record_date\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"eligible\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"reason\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"evidence\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"member_eligibility_snapshots_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"member_eligibility_snapshots_tenant_date_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"record_date\\\"]},{\\\"name\\\":\\\"member_eligibility_snapshots_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"member_eligibility_snapshots_member_id_idx\\\",\\\"columns\\\":[\\\"member_id\\\"]}],\\\"version\\\":\\\"f3899c14\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:AccessRequest\\\":{\\\"name\\\":\\\"accessrequest\\\",\\\"className\\\":\\\"AccessRequest\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:AccessRequest\\\",\\\"collection\\\":\\\"accessrequests\\\",\\\"description\\\":\\\"A prospective user's request for access, captured before they become a User.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/AccessRequest.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"email\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"default\\\":\\\"\\\",\\\"_meta\\\":{\\\"required\\\":true,\\\"indexed\\\":true}},\\\"name\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"status\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"indexed\\\":true}},\\\"source\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"default\\\":\\\"\\\",\\\"_meta\\\":{\\\"indexed\\\":true}},\\\"requestContext\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"default\\\":\\\"{}\\\"},\\\"note\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"requestedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false},\\\"decidedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"decidedBy\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"resultingUserId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"tenantHint\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}}},\\\"methods\\\":{\\\"getRequestContext\\\":{\\\"name\\\":\\\"getRequestContext\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Record<string, unknown>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setRequestContext\\\":{\\\"name\\\":\\\"setRequestContext\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"value\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getTenantHint\\\":{\\\"name\\\":\\\"getTenantHint\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Record<string, unknown> | null\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setTenantHint\\\":{\\\"name\\\":\\\"setTenantHint\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"value\\\",\\\"type\\\":\\\"Record<string, unknown> | null\\\",\\\"optional\\\":false,\\\"unionBranches\\\":[{\\\"type\\\":\\\"Record<string, unknown>\\\"},{\\\"type\\\":\\\"null\\\"}]}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isOpen\\\":{\\\"name\\\":\\\"isOpen\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isApproved\\\":{\\\"name\\\":\\\"isApproved\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isTerminal\\\":{\\\"name\\\":\\\"isTerminal\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"access_requests\\\",\\\"conflictColumns\\\":[\\\"id\\\"],\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"AccessRequest\\\",\\\"collectionExportName\\\":\\\"AccessRequestCollection\\\",\\\"displayLabelField\\\":\\\"name\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"email\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"access_requests\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"access_requests\\\\\\\" (\\\\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 \\\\\\\"email\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"name\\\\\\\" TEXT,\\\\n \\\\\\\"status\\\\\\\" TEXT,\\\\n \\\\\\\"source\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"request_context\\\\\\\" TEXT DEFAULT '{}',\\\\n \\\\\\\"note\\\\\\\" TEXT,\\\\n \\\\\\\"requested_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"decided_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"decided_by\\\\\\\" TEXT,\\\\n \\\\\\\"resulting_user_id\\\\\\\" TEXT,\\\\n \\\\\\\"tenant_hint\\\\\\\" TEXT\\\\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\\\"},\\\"email\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"source\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"request_context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"{}\\\"},\\\"note\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"requested_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"decided_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"decided_by\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"resulting_user_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"tenant_hint\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"access_requests_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"access_requests_email_idx\\\",\\\"columns\\\":[\\\"email\\\"]},{\\\"name\\\":\\\"access_requests_status_idx\\\",\\\"columns\\\":[\\\"status\\\"]},{\\\"name\\\":\\\"access_requests_source_idx\\\",\\\"columns\\\":[\\\"source\\\"]},{\\\"name\\\":\\\"access_requests_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"f396996f\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersCliAuthApproveLimit\\\":{\\\"name\\\":\\\"userscliauthapprovelimit\\\",\\\"className\\\":\\\"UsersCliAuthApproveLimit\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersCliAuthApproveLimit\\\",\\\"collection\\\":\\\"userscliauthapprovelimits\\\",\\\"description\\\":\\\"Private database arbiter shared by every terminal-auth process.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/CliAuthApproveLimit.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"userId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"User\\\",\\\"_meta\\\":{\\\"required\\\":true,\\\"unique\\\":true}},\\\"attemptCount\\\":{\\\"type\\\":\\\"integer\\\",\\\"required\\\":true,\\\"default\\\":0,\\\"_meta\\\":{\\\"required\\\":true,\\\"default\\\":0}},\\\"windowStartedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true}}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_cli_auth_approve_limits\\\",\\\"api\\\":false,\\\"cli\\\":false,\\\"mcp\\\":false},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"UsersCliAuthApproveLimit\\\",\\\"collectionExportName\\\":\\\"UsersCliAuthApproveLimitCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"userId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"},{\\\"field\\\":\\\"attemptCount\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"windowStartedAt\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"datetime\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"users_cli_auth_approve_limits\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_cli_auth_approve_limits\\\\\\\" (\\\\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 \\\\\\\"user_id\\\\\\\" UUID NOT NULL UNIQUE,\\\\n \\\\\\\"attempt_count\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"window_started_at\\\\\\\" TIMESTAMP NOT NULL\\\\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\\\"},\\\"user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":true,\\\"foreignKey\\\":{\\\"table\\\":\\\"users\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"attempt_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"window_started_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_cli_auth_approve_limits_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_cli_auth_approve_limits_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"c45c02de\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersCliAuthRequest\\\":{\\\"name\\\":\\\"userscliauthrequest\\\",\\\"className\\\":\\\"UsersCliAuthRequest\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersCliAuthRequest\\\",\\\"collection\\\":\\\"userscliauthrequests\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/CliAuthRequest.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"userCode\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true,\\\"unique\\\":true}},\\\"deviceCodeHash\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true,\\\"unique\\\":true}},\\\"status\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{},\\\"enum\\\":[\\\"pending\\\",\\\"approved\\\",\\\"consumed\\\",\\\"expired\\\"]},\\\"userId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":false,\\\"related\\\":\\\"User\\\",\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"tenantId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":false,\\\"related\\\":\\\"Tenant\\\",\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"sessionId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":false,\\\"related\\\":\\\"Session\\\",\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"expiresAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"indexed\\\":true}},\\\"approvedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_cli_auth_requests\\\",\\\"sensitive\\\":true,\\\"api\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"mcp\\\":{\\\"include\\\":[]},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"UsersCliAuthRequest\\\",\\\"collectionExportName\\\":\\\"UsersCliAuthRequestCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"userCode\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"deviceCodeHash\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"users_cli_auth_requests\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_cli_auth_requests\\\\\\\" (\\\\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 \\\\\\\"user_code\\\\\\\" TEXT NOT NULL UNIQUE,\\\\n \\\\\\\"device_code_hash\\\\\\\" TEXT NOT NULL UNIQUE,\\\\n \\\\\\\"status\\\\\\\" TEXT,\\\\n \\\\\\\"user_id\\\\\\\" UUID,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"session_id\\\\\\\" UUID,\\\\n \\\\\\\"expires_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"approved_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\\\"},\\\"user_code\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":true},\\\"device_code_hash\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":true},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"users\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"tenants\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"session_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"sessions\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"expires_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"approved_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_cli_auth_requests_tenant_id_slug_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"users_cli_auth_requests_expires_at_idx\\\",\\\"columns\\\":[\\\"expires_at\\\"]},{\\\"name\\\":\\\"users_cli_auth_requests_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]},{\\\"name\\\":\\\"users_cli_auth_requests_user_id_idx\\\",\\\"columns\\\":[\\\"user_id\\\"]},{\\\"name\\\":\\\"users_cli_auth_requests_session_id_idx\\\",\\\"columns\\\":[\\\"session_id\\\"]}],\\\"version\\\":\\\"713ae04c\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:Group\\\":{\\\"name\\\":\\\"group\\\",\\\"className\\\":\\\"Group\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:Group\\\",\\\"collection\\\":\\\"groups\\\",\\\"description\\\":\\\"Group represents a team or department within a tenant.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/Group.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"Tenant\\\",\\\"_meta\\\":{\\\"required\\\":true}},\\\"name\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"default\\\":\\\"\\\"},\\\"description\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"default\\\":\\\"\\\"}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"Group\\\",\\\"collectionExportName\\\":\\\"GroupCollection\\\",\\\"displayLabelField\\\":\\\"name\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"tenantId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"groups\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"groups\\\\\\\" (\\\\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 NOT NULL,\\\\n \\\\\\\"name\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"description\\\\\\\" TEXT 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\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"tenants\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"description\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"}},\\\"indexes\\\":[{\\\"name\\\":\\\"groups_tenant_id_slug_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"groups_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"1824c19b\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:GroupMember\\\":{\\\"name\\\":\\\"groupmember\\\",\\\"className\\\":\\\"GroupMember\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:GroupMember\\\",\\\"collection\\\":\\\"groupmembers\\\",\\\"description\\\":\\\"GroupMember is a join table linking Users to Groups.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/GroupMember.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"groupId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"Group\\\",\\\"_meta\\\":{\\\"required\\\":true,\\\"onDelete\\\":\\\"NO ACTION\\\"}},\\\"userId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"User\\\",\\\"_meta\\\":{\\\"required\\\":true,\\\"onDelete\\\":\\\"NO ACTION\\\"}}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"conflictColumns\\\":[\\\"group_id\\\",\\\"user_id\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"GroupMember\\\",\\\"collectionExportName\\\":\\\"GroupMemberCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"groupId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"},{\\\"field\\\":\\\"userId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"group_members\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"group_members\\\\\\\" (\\\\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 \\\\\\\"group_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"user_id\\\\\\\" UUID NOT NULL\\\\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\\\"},\\\"group_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"groups\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"users\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}}},\\\"indexes\\\":[{\\\"name\\\":\\\"group_members_group_id_user_id_idx\\\",\\\"columns\\\":[\\\"group_id\\\",\\\"user_id\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"group_members_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"group_members_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]},{\\\"name\\\":\\\"group_members_user_id_idx\\\",\\\"columns\\\":[\\\"user_id\\\"]}],\\\"version\\\":\\\"ed4d1187\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:GroupRole\\\":{\\\"name\\\":\\\"grouprole\\\",\\\"className\\\":\\\"GroupRole\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:GroupRole\\\",\\\"collection\\\":\\\"grouproles\\\",\\\"description\\\":\\\"GroupRole is a join table linking Groups to Roles.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/GroupRole.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"groupId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"Group\\\",\\\"_meta\\\":{\\\"required\\\":true}},\\\"roleId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"Role\\\",\\\"_meta\\\":{\\\"required\\\":true}}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"GroupRole\\\",\\\"collectionExportName\\\":\\\"GroupRoleCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"groupId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"},{\\\"field\\\":\\\"roleId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"group_roles\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"group_roles\\\\\\\" (\\\\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 \\\\\\\"group_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"role_id\\\\\\\" UUID NOT NULL\\\\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\\\"},\\\"group_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"groups\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"role_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"roles\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}}},\\\"indexes\\\":[{\\\"name\\\":\\\"group_roles_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"group_roles_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]},{\\\"name\\\":\\\"group_roles_group_id_idx\\\",\\\"columns\\\":[\\\"group_id\\\"]},{\\\"name\\\":\\\"group_roles_role_id_idx\\\",\\\"columns\\\":[\\\"role_id\\\"]}],\\\"version\\\":\\\"b1e35f93\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersLoginAttempt\\\":{\\\"name\\\":\\\"usersloginattempt\\\",\\\"className\\\":\\\"UsersLoginAttempt\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersLoginAttempt\\\",\\\"collection\\\":\\\"usersloginattempts\\\",\\\"description\\\":\\\"Private database arbiter shared by every process that authenticates.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/LoginAttempt.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"limiterKey\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true,\\\"unique\\\":true}},\\\"scope\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true},\\\"enum\\\":[\\\"subject\\\",\\\"source\\\"]},\\\"attemptCount\\\":{\\\"type\\\":\\\"integer\\\",\\\"required\\\":true,\\\"default\\\":0,\\\"_meta\\\":{\\\"required\\\":true,\\\"default\\\":0}},\\\"windowStartedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true}},\\\"failureStreak\\\":{\\\"type\\\":\\\"integer\\\",\\\"required\\\":true,\\\"default\\\":0,\\\"_meta\\\":{\\\"required\\\":true,\\\"default\\\":0}},\\\"lockedUntil\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true,\\\"indexed\\\":true}},\\\"lastFailedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"retainUntil\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true,\\\"indexed\\\":true}}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_login_attempts\\\",\\\"sensitive\\\":true,\\\"api\\\":false,\\\"cli\\\":false,\\\"mcp\\\":false},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"UsersLoginAttempt\\\",\\\"collectionExportName\\\":\\\"UsersLoginAttemptCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"limiterKey\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"scope\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"attemptCount\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"windowStartedAt\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"datetime\\\"},{\\\"field\\\":\\\"failureStreak\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"retainUntil\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"datetime\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"users_login_attempts\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_login_attempts\\\\\\\" (\\\\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 \\\\\\\"limiter_key\\\\\\\" TEXT NOT NULL UNIQUE,\\\\n \\\\\\\"scope\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"attempt_count\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"window_started_at\\\\\\\" TIMESTAMP NOT NULL,\\\\n \\\\\\\"failure_streak\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"locked_until\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"last_failed_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"retain_until\\\\\\\" TIMESTAMP NOT NULL\\\\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\\\"},\\\"limiter_key\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":true},\\\"scope\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"attempt_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"window_started_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"failure_streak\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"locked_until\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"last_failed_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"retain_until\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_login_attempts_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_login_attempts_locked_until_idx\\\",\\\"columns\\\":[\\\"locked_until\\\"]},{\\\"name\\\":\\\"users_login_attempts_retain_until_idx\\\",\\\"columns\\\":[\\\"retain_until\\\"]},{\\\"name\\\":\\\"users_login_attempts_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"89dfe336\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersLoginAuditEvent\\\":{\\\"name\\\":\\\"usersloginauditevent\\\",\\\"className\\\":\\\"UsersLoginAuditEvent\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersLoginAuditEvent\\\",\\\"collection\\\":\\\"usersloginauditevents\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/LoginAuditEvent.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"kind\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true}},\\\"outcome\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true},\\\"enum\\\":[\\\"denied\\\",\\\"failed\\\",\\\"succeeded\\\",\\\"locked\\\",\\\"source-locked\\\",\\\"managed\\\"]},\\\"subjectKeyHash\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true,\\\"indexed\\\":true}},\\\"sourceKeyHash\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true,\\\"indexed\\\":true}},\\\"retryAfterSeconds\\\":{\\\"type\\\":\\\"integer\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"occurredAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true,\\\"indexed\\\":true}},\\\"metadata\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}}},\\\"methods\\\":{\\\"getMetadata\\\":{\\\"name\\\":\\\"getMetadata\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Record<string, unknown>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setMetadata\\\":{\\\"name\\\":\\\"setMetadata\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"value\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_login_audit_events\\\",\\\"sensitive\\\":true,\\\"api\\\":false,\\\"cli\\\":false,\\\"mcp\\\":false},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"UsersLoginAuditEvent\\\",\\\"collectionExportName\\\":\\\"UsersLoginAuditEventCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"kind\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"outcome\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"occurredAt\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"datetime\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"users_login_audit_events\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_login_audit_events\\\\\\\" (\\\\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 \\\\\\\"kind\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"outcome\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"subject_key_hash\\\\\\\" TEXT,\\\\n \\\\\\\"source_key_hash\\\\\\\" TEXT,\\\\n \\\\\\\"retry_after_seconds\\\\\\\" INTEGER,\\\\n \\\\\\\"occurred_at\\\\\\\" TIMESTAMP NOT NULL,\\\\n \\\\\\\"metadata\\\\\\\" TEXT\\\\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\\\"},\\\"kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"outcome\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"subject_key_hash\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"source_key_hash\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"retry_after_seconds\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"occurred_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"metadata\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_login_audit_events_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_login_audit_events_subject_key_hash_idx\\\",\\\"columns\\\":[\\\"subject_key_hash\\\"]},{\\\"name\\\":\\\"users_login_audit_events_source_key_hash_idx\\\",\\\"columns\\\":[\\\"source_key_hash\\\"]},{\\\"name\\\":\\\"users_login_audit_events_occurred_at_idx\\\",\\\"columns\\\":[\\\"occurred_at\\\"]},{\\\"name\\\":\\\"users_login_audit_events_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"485105a9\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersMagicLinkToken\\\":{\\\"name\\\":\\\"usersmagiclinktoken\\\",\\\"className\\\":\\\"UsersMagicLinkToken\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersMagicLinkToken\\\",\\\"collection\\\":\\\"usersmagiclinktokens\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/MagicLinkToken.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"nonce\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"default\\\":\\\"\\\",\\\"_meta\\\":{\\\"required\\\":true,\\\"unique\\\":true}},\\\"email\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"default\\\":\\\"\\\"},\\\"used\\\":{\\\"type\\\":\\\"boolean\\\",\\\"required\\\":false,\\\"default\\\":false},\\\"expiresAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"indexed\\\":true}}},\\\"methods\\\":{\\\"isExpired\\\":{\\\"name\\\":\\\"isExpired\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isValid\\\":{\\\"name\\\":\\\"isValid\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_magic_link_tokens\\\",\\\"sensitive\\\":true,\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"UsersMagicLinkToken\\\",\\\"collectionExportName\\\":\\\"UsersMagicLinkTokenCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"nonce\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"users_magic_link_tokens\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_magic_link_tokens\\\\\\\" (\\\\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 \\\\\\\"nonce\\\\\\\" TEXT NOT NULL UNIQUE DEFAULT '',\\\\n \\\\\\\"email\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"used\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"expires_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\\\"},\\\"nonce\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":true,\\\"default\\\":\\\"\\\"},\\\"email\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"used\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":false},\\\"expires_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_magic_link_tokens_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_magic_link_tokens_expires_at_idx\\\",\\\"columns\\\":[\\\"expires_at\\\"]},{\\\"name\\\":\\\"users_magic_link_tokens_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"537853d3\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:Membership\\\":{\\\"name\\\":\\\"membership\\\",\\\"className\\\":\\\"Membership\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:Membership\\\",\\\"collection\\\":\\\"memberships\\\",\\\"description\\\":\\\"Membership represents a user's membership in a tenant with an assigned role.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/Membership.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"userId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"User\\\",\\\"description\\\":\\\"The person who belongs to this organization.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"The person who belongs to this organization.\\\",\\\"required\\\":true}},\\\"tenantId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"Tenant\\\",\\\"_meta\\\":{\\\"required\\\":true}},\\\"roleId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"Role\\\",\\\"description\\\":\\\"The role that determines this member's permissions.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"The role that determines this member's permissions.\\\",\\\"required\\\":true}},\\\"status\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"description\\\":\\\"Whether this membership is active, pending, or inactive.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"Whether this membership is active, pending, or inactive.\\\"}}},\\\"methods\\\":{\\\"isActive\\\":{\\\"name\\\":\\\"isActive\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isPending\\\":{\\\"name\\\":\\\"isPending\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"indexes\\\":[{\\\"name\\\":\\\"memberships_tenant_id_user_id_idx\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"userId\\\"]}],\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"Membership\\\",\\\"collectionExportName\\\":\\\"MembershipCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"userId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"},{\\\"field\\\":\\\"tenantId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"},{\\\"field\\\":\\\"roleId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"memberships\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"memberships\\\\\\\" (\\\\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 \\\\\\\"user_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"role_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"status\\\\\\\" TEXT\\\\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\\\"},\\\"user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"users\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"tenants\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"role_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"roles\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"memberships_tenant_id_slug_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"memberships_tenant_id_user_id_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"user_id\\\"]},{\\\"name\\\":\\\"memberships_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]},{\\\"name\\\":\\\"memberships_user_id_idx\\\",\\\"columns\\\":[\\\"user_id\\\"]},{\\\"name\\\":\\\"memberships_role_id_idx\\\",\\\"columns\\\":[\\\"role_id\\\"]}],\\\"version\\\":\\\"ebfd11e0\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:MembershipOverride\\\":{\\\"name\\\":\\\"membershipoverride\\\",\\\"className\\\":\\\"MembershipOverride\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:MembershipOverride\\\",\\\"collection\\\":\\\"membershipoverrides\\\",\\\"description\\\":\\\"MembershipOverride allows granting or denying specific permissions to a user beyond what their role and groups provide.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/MembershipOverride.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"membershipId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"Membership\\\",\\\"_meta\\\":{\\\"required\\\":true,\\\"onDelete\\\":\\\"NO ACTION\\\"}},\\\"permissionId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"Permission\\\",\\\"_meta\\\":{\\\"required\\\":true,\\\"onDelete\\\":\\\"NO ACTION\\\"}},\\\"effect\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}}},\\\"methods\\\":{\\\"isGrant\\\":{\\\"name\\\":\\\"isGrant\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isDeny\\\":{\\\"name\\\":\\\"isDeny\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"conflictColumns\\\":[\\\"membership_id\\\",\\\"permission_id\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"MembershipOverride\\\",\\\"collectionExportName\\\":\\\"MembershipOverrideCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"membershipId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"},{\\\"field\\\":\\\"permissionId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"membership_overrides\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"membership_overrides\\\\\\\" (\\\\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 \\\\\\\"membership_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"permission_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"effect\\\\\\\" TEXT\\\\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\\\"},\\\"membership_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"memberships\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"permission_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"permissions\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"effect\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"membership_overrides_membership_id_permission_id_idx\\\",\\\"columns\\\":[\\\"membership_id\\\",\\\"permission_id\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"membership_overrides_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"membership_overrides_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]},{\\\"name\\\":\\\"membership_overrides_permission_id_idx\\\",\\\"columns\\\":[\\\"permission_id\\\"]}],\\\"version\\\":\\\"25fe9da8\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersOAuthClient\\\":{\\\"name\\\":\\\"usersoauthclient\\\",\\\"className\\\":\\\"UsersOAuthClient\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersOAuthClient\\\",\\\"collection\\\":\\\"usersoauthclients\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/OAuthAuthorization.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"clientId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true,\\\"unique\\\":true}},\\\"redirectUris\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false},\\\"allowedScopes\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false},\\\"tokenEndpointAuthMethod\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"default\\\":\\\"none\\\",\\\"enum\\\":[\\\"none\\\",\\\"client_secret_post\\\"]},\\\"secretHash\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true,\\\"sensitive\\\":true},\\\"sensitive\\\":true},\\\"allowedResources\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false},\\\"createdAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{}}},\\\"methods\\\":{\\\"getRedirectUris\\\":{\\\"name\\\":\\\"getRedirectUris\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"string[]\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getAllowedScopes\\\":{\\\"name\\\":\\\"getAllowedScopes\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"string[]\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getAllowedResources\\\":{\\\"name\\\":\\\"getAllowedResources\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"string[] | undefined\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_oauth_clients\\\",\\\"sensitive\\\":true,\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"UsersOAuthClient\\\",\\\"collectionExportName\\\":\\\"UsersOAuthClientCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"clientId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"users_oauth_clients\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_oauth_clients\\\\\\\" (\\\\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 \\\\\\\"client_id\\\\\\\" TEXT NOT NULL UNIQUE,\\\\n \\\\\\\"redirect_uris\\\\\\\" TEXT,\\\\n \\\\\\\"allowed_scopes\\\\\\\" TEXT,\\\\n \\\\\\\"token_endpoint_auth_method\\\\\\\" TEXT DEFAULT 'none',\\\\n \\\\\\\"secret_hash\\\\\\\" TEXT,\\\\n \\\\\\\"allowed_resources\\\\\\\" TEXT\\\\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\\\"},\\\"client_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":true},\\\"redirect_uris\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"allowed_scopes\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"token_endpoint_auth_method\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"none\\\"},\\\"secret_hash\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"allowed_resources\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_oauth_clients_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_oauth_clients_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"0ecda18c\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersOAuthAuthorizationCode\\\":{\\\"name\\\":\\\"usersoauthauthorizationcode\\\",\\\"className\\\":\\\"UsersOAuthAuthorizationCode\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersOAuthAuthorizationCode\\\",\\\"collection\\\":\\\"usersoauthauthorizationcodes\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/OAuthAuthorization.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"authorizationId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true,\\\"indexed\\\":true}},\\\"codeHash\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true,\\\"unique\\\":true,\\\"sensitive\\\":true},\\\"sensitive\\\":true},\\\"clientId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"indexed\\\":true}},\\\"subject\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"indexed\\\":true}},\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true,\\\"indexed\\\":true}},\\\"claims\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false},\\\"redirectUri\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false},\\\"scopes\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false},\\\"resource\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"codeChallenge\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false},\\\"expiresAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"indexed\\\":true}},\\\"consumedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}}},\\\"methods\\\":{\\\"getScopes\\\":{\\\"name\\\":\\\"getScopes\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"string[]\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getClaims\\\":{\\\"name\\\":\\\"getClaims\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"OAuthTokenClaims\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_oauth_authorization_codes\\\",\\\"sensitive\\\":true,\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"UsersOAuthAuthorizationCode\\\",\\\"collectionExportName\\\":\\\"UsersOAuthAuthorizationCodeCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"codeHash\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"users_oauth_authorization_codes\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_oauth_authorization_codes\\\\\\\" (\\\\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 \\\\\\\"authorization_id\\\\\\\" TEXT,\\\\n \\\\\\\"code_hash\\\\\\\" TEXT NOT NULL UNIQUE,\\\\n \\\\\\\"client_id\\\\\\\" TEXT,\\\\n \\\\\\\"subject\\\\\\\" TEXT,\\\\n \\\\\\\"tenant_id\\\\\\\" TEXT,\\\\n \\\\\\\"claims\\\\\\\" TEXT,\\\\n \\\\\\\"redirect_uri\\\\\\\" TEXT,\\\\n \\\\\\\"scopes\\\\\\\" TEXT,\\\\n \\\\\\\"resource\\\\\\\" TEXT,\\\\n \\\\\\\"code_challenge\\\\\\\" TEXT,\\\\n \\\\\\\"expires_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"consumed_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\\\"},\\\"authorization_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"code_hash\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":true},\\\"client_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"subject\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"tenant_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"claims\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"redirect_uri\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"scopes\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"resource\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"code_challenge\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"expires_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"consumed_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_oauth_authorization_codes_tenant_id_slug_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"users_oauth_authorization_codes_authorization_id_idx\\\",\\\"columns\\\":[\\\"authorization_id\\\"]},{\\\"name\\\":\\\"users_oauth_authorization_codes_client_id_idx\\\",\\\"columns\\\":[\\\"client_id\\\"]},{\\\"name\\\":\\\"users_oauth_authorization_codes_subject_idx\\\",\\\"columns\\\":[\\\"subject\\\"]},{\\\"name\\\":\\\"users_oauth_authorization_codes_tenant_id_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\"]},{\\\"name\\\":\\\"users_oauth_authorization_codes_expires_at_idx\\\",\\\"columns\\\":[\\\"expires_at\\\"]},{\\\"name\\\":\\\"users_oauth_authorization_codes_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"f5c5d615\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersOAuthRefreshGrant\\\":{\\\"name\\\":\\\"usersoauthrefreshgrant\\\",\\\"className\\\":\\\"UsersOAuthRefreshGrant\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersOAuthRefreshGrant\\\",\\\"collection\\\":\\\"usersoauthrefreshgrants\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/OAuthAuthorization.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"authorizationId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true,\\\"indexed\\\":true}},\\\"tokenHash\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true,\\\"unique\\\":true,\\\"sensitive\\\":true},\\\"sensitive\\\":true},\\\"familyId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"indexed\\\":true}},\\\"clientId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"indexed\\\":true}},\\\"subject\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"indexed\\\":true}},\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true,\\\"indexed\\\":true}},\\\"claims\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false},\\\"scopes\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false},\\\"resource\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"expiresAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"indexed\\\":true}},\\\"consumedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"revokedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true,\\\"indexed\\\":true}}},\\\"methods\\\":{\\\"getScopes\\\":{\\\"name\\\":\\\"getScopes\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"string[]\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getClaims\\\":{\\\"name\\\":\\\"getClaims\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"OAuthTokenClaims\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_oauth_refresh_grants\\\",\\\"sensitive\\\":true,\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"UsersOAuthRefreshGrant\\\",\\\"collectionExportName\\\":\\\"UsersOAuthRefreshGrantCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"tokenHash\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"users_oauth_refresh_grants\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_oauth_refresh_grants\\\\\\\" (\\\\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 \\\\\\\"authorization_id\\\\\\\" TEXT,\\\\n \\\\\\\"token_hash\\\\\\\" TEXT NOT NULL UNIQUE,\\\\n \\\\\\\"family_id\\\\\\\" TEXT,\\\\n \\\\\\\"client_id\\\\\\\" TEXT,\\\\n \\\\\\\"subject\\\\\\\" TEXT,\\\\n \\\\\\\"tenant_id\\\\\\\" TEXT,\\\\n \\\\\\\"claims\\\\\\\" TEXT,\\\\n \\\\\\\"scopes\\\\\\\" TEXT,\\\\n \\\\\\\"resource\\\\\\\" TEXT,\\\\n \\\\\\\"expires_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"consumed_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"revoked_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\\\"},\\\"authorization_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"token_hash\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":true},\\\"family_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"client_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"subject\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"tenant_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"claims\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"scopes\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"resource\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"expires_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"consumed_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"revoked_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_oauth_refresh_grants_tenant_id_slug_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"users_oauth_refresh_grants_authorization_id_idx\\\",\\\"columns\\\":[\\\"authorization_id\\\"]},{\\\"name\\\":\\\"users_oauth_refresh_grants_family_id_idx\\\",\\\"columns\\\":[\\\"family_id\\\"]},{\\\"name\\\":\\\"users_oauth_refresh_grants_client_id_idx\\\",\\\"columns\\\":[\\\"client_id\\\"]},{\\\"name\\\":\\\"users_oauth_refresh_grants_subject_idx\\\",\\\"columns\\\":[\\\"subject\\\"]},{\\\"name\\\":\\\"users_oauth_refresh_grants_tenant_id_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\"]},{\\\"name\\\":\\\"users_oauth_refresh_grants_expires_at_idx\\\",\\\"columns\\\":[\\\"expires_at\\\"]},{\\\"name\\\":\\\"users_oauth_refresh_grants_revoked_at_idx\\\",\\\"columns\\\":[\\\"revoked_at\\\"]},{\\\"name\\\":\\\"users_oauth_refresh_grants_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"d332998e\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersOAuthAccessTokenRevocation\\\":{\\\"name\\\":\\\"usersoauthaccesstokenrevocation\\\",\\\"className\\\":\\\"UsersOAuthAccessTokenRevocation\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersOAuthAccessTokenRevocation\\\",\\\"collection\\\":\\\"usersoauthaccesstokenrevocations\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/OAuthAuthorization.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"jti\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true,\\\"unique\\\":true,\\\"sensitive\\\":true},\\\"sensitive\\\":true},\\\"expiresAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"indexed\\\":true}}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_oauth_access_token_revocations\\\",\\\"sensitive\\\":true,\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"UsersOAuthAccessTokenRevocation\\\",\\\"collectionExportName\\\":\\\"UsersOAuthAccessTokenRevocationCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"jti\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"users_oauth_access_token_revocations\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_oauth_access_token_revocations\\\\\\\" (\\\\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 \\\\\\\"jti\\\\\\\" TEXT NOT NULL UNIQUE,\\\\n \\\\\\\"expires_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\\\"},\\\"jti\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":true},\\\"expires_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_oauth_access_token_revocations_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_oauth_access_token_revocations_expires_at_idx\\\",\\\"columns\\\":[\\\"expires_at\\\"]},{\\\"name\\\":\\\"users_oauth_access_token_revocations_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"79147089\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersOAuthAuthorization\\\":{\\\"name\\\":\\\"usersoauthauthorization\\\",\\\"className\\\":\\\"UsersOAuthAuthorization\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersOAuthAuthorization\\\",\\\"collection\\\":\\\"usersoauthauthorizations\\\",\\\"description\\\":\\\"A consent decision bound to a server-side session; never exposes its bearer.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/OAuthAuthorization.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"subject\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"indexed\\\":true}},\\\"sessionId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"sensitive\\\":true},\\\"sensitive\\\":true},\\\"clientId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"indexed\\\":true}},\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"scopes\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false},\\\"permissionCeiling\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false},\\\"resource\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"revokedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}}},\\\"methods\\\":{\\\"getPermissionCeiling\\\":{\\\"name\\\":\\\"getPermissionCeiling\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"string[]\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getScopes\\\":{\\\"name\\\":\\\"getScopes\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"string[]\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_oauth_authorizations\\\",\\\"sensitive\\\":true,\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"UsersOAuthAuthorization\\\",\\\"collectionExportName\\\":\\\"UsersOAuthAuthorizationCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"users_oauth_authorizations\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_oauth_authorizations\\\\\\\" (\\\\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 \\\\\\\"subject\\\\\\\" TEXT,\\\\n \\\\\\\"session_id\\\\\\\" TEXT,\\\\n \\\\\\\"client_id\\\\\\\" TEXT,\\\\n \\\\\\\"tenant_id\\\\\\\" TEXT,\\\\n \\\\\\\"scopes\\\\\\\" TEXT,\\\\n \\\\\\\"permission_ceiling\\\\\\\" TEXT,\\\\n \\\\\\\"resource\\\\\\\" TEXT,\\\\n \\\\\\\"revoked_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\\\"},\\\"subject\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"session_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"client_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"tenant_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"scopes\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"permission_ceiling\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"resource\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"revoked_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_oauth_authorizations_tenant_id_slug_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"users_oauth_authorizations_subject_idx\\\",\\\"columns\\\":[\\\"subject\\\"]},{\\\"name\\\":\\\"users_oauth_authorizations_client_id_idx\\\",\\\"columns\\\":[\\\"client_id\\\"]},{\\\"name\\\":\\\"users_oauth_authorizations_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"291f8816\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersOAuthRefreshFamily\\\":{\\\"name\\\":\\\"usersoauthrefreshfamily\\\",\\\"className\\\":\\\"UsersOAuthRefreshFamily\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersOAuthRefreshFamily\\\",\\\"collection\\\":\\\"usersoauthrefreshfamilies\\\",\\\"description\\\":\\\"Stable lock row: rotation and revocation always serialize on this family.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/OAuthAuthorization.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"authorizationId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true,\\\"indexed\\\":true}},\\\"revokedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_oauth_refresh_families\\\",\\\"sensitive\\\":true,\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"UsersOAuthRefreshFamily\\\",\\\"collectionExportName\\\":\\\"UsersOAuthRefreshFamilyCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"users_oauth_refresh_families\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_oauth_refresh_families\\\\\\\" (\\\\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 \\\\\\\"authorization_id\\\\\\\" TEXT,\\\\n \\\\\\\"revoked_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\\\"},\\\"authorization_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"revoked_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_oauth_refresh_families_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_oauth_refresh_families_authorization_id_idx\\\",\\\"columns\\\":[\\\"authorization_id\\\"]},{\\\"name\\\":\\\"users_oauth_refresh_families_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"37392f31\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersPasskeyChallenge\\\":{\\\"name\\\":\\\"userspasskeychallenge\\\",\\\"className\\\":\\\"UsersPasskeyChallenge\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersPasskeyChallenge\\\",\\\"collection\\\":\\\"userspasskeychallenges\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/PasskeyChallenge.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"challengeHash\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true,\\\"unique\\\":true}},\\\"purpose\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true},\\\"enum\\\":[\\\"authentication\\\",\\\"registration\\\"]},\\\"expiresAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true,\\\"indexed\\\":true}}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_passkey_challenges\\\",\\\"sensitive\\\":true,\\\"api\\\":false,\\\"cli\\\":false,\\\"mcp\\\":false},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"UsersPasskeyChallenge\\\",\\\"collectionExportName\\\":\\\"UsersPasskeyChallengeCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"challengeHash\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"purpose\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"expiresAt\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"datetime\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"users_passkey_challenges\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_passkey_challenges\\\\\\\" (\\\\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 \\\\\\\"challenge_hash\\\\\\\" TEXT NOT NULL UNIQUE,\\\\n \\\\\\\"purpose\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"expires_at\\\\\\\" TIMESTAMP NOT NULL\\\\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\\\"},\\\"challenge_hash\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":true},\\\"purpose\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"expires_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_passkey_challenges_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_passkey_challenges_expires_at_idx\\\",\\\"columns\\\":[\\\"expires_at\\\"]},{\\\"name\\\":\\\"users_passkey_challenges_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"895dcef7\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersPasskeyCredential\\\":{\\\"name\\\":\\\"userspasskeycredential\\\",\\\"className\\\":\\\"UsersPasskeyCredential\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersPasskeyCredential\\\",\\\"collection\\\":\\\"userspasskeycredentials\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/PasskeyCredential.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"userId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"User\\\",\\\"_meta\\\":{\\\"required\\\":true}},\\\"credentialId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true,\\\"unique\\\":true,\\\"sensitive\\\":true},\\\"sensitive\\\":true},\\\"publicKey\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true,\\\"sensitive\\\":true},\\\"sensitive\\\":true},\\\"signCount\\\":{\\\"type\\\":\\\"integer\\\",\\\"required\\\":true,\\\"default\\\":0,\\\"_meta\\\":{\\\"required\\\":true,\\\"default\\\":0}},\\\"transports\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"name\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true}},\\\"aaguid\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"backedUp\\\":{\\\"type\\\":\\\"boolean\\\",\\\"required\\\":true,\\\"default\\\":false,\\\"_meta\\\":{\\\"required\\\":true,\\\"default\\\":false}},\\\"deviceType\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true},\\\"enum\\\":[\\\"singleDevice\\\",\\\"multiDevice\\\"]},\\\"lastUsedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"createdBy\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}}},\\\"methods\\\":{\\\"getTransports\\\":{\\\"name\\\":\\\"getTransports\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"string[]\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setTransports\\\":{\\\"name\\\":\\\"setTransports\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"value\\\",\\\"type\\\":\\\"any\\\",\\\"optional\\\":false,\\\"typeUnresolved\\\":true}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_passkey_credentials\\\",\\\"sensitive\\\":true,\\\"api\\\":false,\\\"cli\\\":false,\\\"mcp\\\":false},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"UsersPasskeyCredential\\\",\\\"collectionExportName\\\":\\\"UsersPasskeyCredentialCollection\\\",\\\"displayLabelField\\\":\\\"name\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"userId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"},{\\\"field\\\":\\\"credentialId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"publicKey\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"signCount\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"name\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"backedUp\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"users_passkey_credentials\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_passkey_credentials\\\\\\\" (\\\\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 \\\\\\\"user_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"credential_id\\\\\\\" TEXT NOT NULL UNIQUE,\\\\n \\\\\\\"public_key\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"sign_count\\\\\\\" INTEGER NOT NULL DEFAULT 0,\\\\n \\\\\\\"transports\\\\\\\" TEXT,\\\\n \\\\\\\"name\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"aaguid\\\\\\\" TEXT,\\\\n \\\\\\\"backed_up\\\\\\\" BOOLEAN NOT NULL DEFAULT FALSE,\\\\n \\\\\\\"device_type\\\\\\\" TEXT,\\\\n \\\\\\\"last_used_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"created_by\\\\\\\" TEXT\\\\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\\\"},\\\"user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"users\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"credential_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":true},\\\"public_key\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"sign_count\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":0},\\\"transports\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"aaguid\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"backed_up\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":false},\\\"device_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"last_used_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"created_by\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_passkey_credentials_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_passkey_credentials_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]},{\\\"name\\\":\\\"users_passkey_credentials_user_id_idx\\\",\\\"columns\\\":[\\\"user_id\\\"]}],\\\"version\\\":\\\"4483d2e2\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersPasswordCredential\\\":{\\\"name\\\":\\\"userspasswordcredential\\\",\\\"className\\\":\\\"UsersPasswordCredential\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersPasswordCredential\\\",\\\"collection\\\":\\\"userspasswordcredentials\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/PasswordCredential.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"userId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"User\\\",\\\"_meta\\\":{\\\"required\\\":true,\\\"unique\\\":true}},\\\"passwordHash\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true,\\\"sensitive\\\":true},\\\"sensitive\\\":true},\\\"version\\\":{\\\"type\\\":\\\"integer\\\",\\\"required\\\":true,\\\"default\\\":1,\\\"_meta\\\":{\\\"required\\\":true,\\\"default\\\":1}},\\\"mustChange\\\":{\\\"type\\\":\\\"boolean\\\",\\\"required\\\":true,\\\"default\\\":false,\\\"_meta\\\":{\\\"required\\\":true,\\\"default\\\":false}},\\\"rotatedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"rotatedBy\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_password_credentials\\\",\\\"sensitive\\\":true,\\\"api\\\":false,\\\"cli\\\":false,\\\"mcp\\\":false},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"UsersPasswordCredential\\\",\\\"collectionExportName\\\":\\\"UsersPasswordCredentialCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"userId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"},{\\\"field\\\":\\\"passwordHash\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"version\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"mustChange\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"users_password_credentials\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_password_credentials\\\\\\\" (\\\\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 \\\\\\\"user_id\\\\\\\" UUID NOT NULL UNIQUE,\\\\n \\\\\\\"password_hash\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"version\\\\\\\" INTEGER NOT NULL DEFAULT 1,\\\\n \\\\\\\"must_change\\\\\\\" BOOLEAN NOT NULL DEFAULT FALSE,\\\\n \\\\\\\"rotated_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"rotated_by\\\\\\\" TEXT\\\\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\\\"},\\\"user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":true,\\\"foreignKey\\\":{\\\"table\\\":\\\"users\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"password_hash\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"version\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":1},\\\"must_change\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":false},\\\"rotated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"rotated_by\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_password_credentials_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_password_credentials_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"9a828f77\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:Permission\\\":{\\\"name\\\":\\\"permission\\\",\\\"className\\\":\\\"Permission\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:Permission\\\",\\\"collection\\\":\\\"permissions\\\",\\\"description\\\":\\\"Permission represents a named capability in the system.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/Permission.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"name\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"default\\\":\\\"\\\",\\\"description\\\":\\\"The name of an action people can be allowed to perform.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"The name of an action people can be allowed to perform.\\\"}},\\\"description\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"default\\\":\\\"\\\",\\\"description\\\":\\\"What this permission allows someone to do.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"What this permission allows someone to do.\\\"}},\\\"category\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"default\\\":\\\"\\\",\\\"description\\\":\\\"The area of the application this permission belongs to.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"The area of the application this permission belongs to.\\\"}}},\\\"methods\\\":{\\\"parseSlug\\\":{\\\"name\\\":\\\"parseSlug\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"ParsedPermissionSlug\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getResource\\\":{\\\"name\\\":\\\"getResource\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"string\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getAction\\\":{\\\"name\\\":\\\"getAction\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"string\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isValidSlug\\\":{\\\"name\\\":\\\"isValidSlug\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"Permission\\\",\\\"collectionExportName\\\":\\\"PermissionCollection\\\",\\\"displayLabelField\\\":\\\"name\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"permissions\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"permissions\\\\\\\" (\\\\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 \\\\\\\"name\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"description\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"category\\\\\\\" TEXT 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\\\"},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"description\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"category\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"}},\\\"indexes\\\":[{\\\"name\\\":\\\"permissions_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"permissions_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"4c81b2af\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:UsersPinCredential\\\":{\\\"name\\\":\\\"userspincredential\\\",\\\"className\\\":\\\"UsersPinCredential\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:UsersPinCredential\\\",\\\"collection\\\":\\\"userspincredentials\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/PinCredential.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"userId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"User\\\",\\\"_meta\\\":{\\\"required\\\":true,\\\"unique\\\":true}},\\\"pinHash\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"required\\\":true,\\\"sensitive\\\":true},\\\"sensitive\\\":true},\\\"version\\\":{\\\"type\\\":\\\"integer\\\",\\\"required\\\":true,\\\"default\\\":1,\\\"_meta\\\":{\\\"required\\\":true,\\\"default\\\":1}},\\\"mustReset\\\":{\\\"type\\\":\\\"boolean\\\",\\\"required\\\":true,\\\"default\\\":false,\\\"_meta\\\":{\\\"required\\\":true,\\\"default\\\":false}},\\\"rotatedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"rotatedBy\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"nullable\\\":true}}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"users_pin_credentials\\\",\\\"sensitive\\\":true,\\\"api\\\":false,\\\"cli\\\":false,\\\"mcp\\\":false},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"UsersPinCredential\\\",\\\"collectionExportName\\\":\\\"UsersPinCredentialCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"userId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"},{\\\"field\\\":\\\"pinHash\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"version\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"integer\\\"},{\\\"field\\\":\\\"mustReset\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"boolean\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"users_pin_credentials\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users_pin_credentials\\\\\\\" (\\\\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 \\\\\\\"user_id\\\\\\\" UUID NOT NULL UNIQUE,\\\\n \\\\\\\"pin_hash\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"version\\\\\\\" INTEGER NOT NULL DEFAULT 1,\\\\n \\\\\\\"must_reset\\\\\\\" BOOLEAN NOT NULL DEFAULT FALSE,\\\\n \\\\\\\"rotated_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"rotated_by\\\\\\\" TEXT\\\\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\\\"},\\\"user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":true,\\\"foreignKey\\\":{\\\"table\\\":\\\"users\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"pin_hash\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"version\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":1},\\\"must_reset\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":false},\\\"rotated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"rotated_by\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_pin_credentials_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_pin_credentials_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"0e2fa003\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:ResourceGrant\\\":{\\\"name\\\":\\\"resourcegrant\\\",\\\"className\\\":\\\"ResourceGrant\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:ResourceGrant\\\",\\\"collection\\\":\\\"resourcegrants\\\",\\\"description\\\":\\\"An exact tenant/resource/user/permission decision.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/ResourceGrant.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"Tenant\\\",\\\"_meta\\\":{\\\"required\\\":true,\\\"sqlType\\\":\\\"UUID\\\",\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"autoFilter\\\":true,\\\"autoPopulate\\\":true,\\\"allowSuperAdminBypass\\\":false}}},\\\"userId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"User\\\",\\\"description\\\":\\\"The person receiving this record-specific access rule.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"The person receiving this record-specific access rule.\\\",\\\"required\\\":true}},\\\"resourceType\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"description\\\":\\\"The kind of record this access rule applies to.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"The kind of record this access rule applies to.\\\"}},\\\"resourceId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"description\\\":\\\"The specific record covered by this access rule.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"The specific record covered by this access rule.\\\"}},\\\"permission\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"description\\\":\\\"The action this rule allows or denies for the record.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"The action this rule allows or denies for the record.\\\"}},\\\"effect\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"description\\\":\\\"Whether this rule grants access or denies it. Denies take precedence.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"Whether this rule grants access or denies it. Denies take precedence.\\\"},\\\"enum\\\":[\\\"grant\\\",\\\"deny\\\"]},\\\"canDelegate\\\":{\\\"type\\\":\\\"boolean\\\",\\\"required\\\":false,\\\"default\\\":false,\\\"description\\\":\\\"Whether the recipient may pass this grant on to another person.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"Whether the recipient may pass this grant on to another person.\\\"}},\\\"parentGrantId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":false,\\\"related\\\":\\\"ResourceGrant\\\",\\\"description\\\":\\\"The earlier grant from which this access was delegated.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"The earlier grant from which this access was delegated.\\\"}},\\\"revokedAt\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"description\\\":\\\"When this access rule was revoked, if it has ended.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"When this access rule was revoked, if it has ended.\\\"}}},\\\"methods\\\":{\\\"isActive\\\":{\\\"name\\\":\\\"isActive\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tenantScoped\\\":true,\\\"api\\\":{\\\"include\\\":[]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"indexes\\\":[{\\\"name\\\":\\\"resource_grants_lookup_idx\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"userId\\\"]}],\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"ResourceGrant\\\",\\\"collectionExportName\\\":\\\"ResourceGrantCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"userId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"resource_grants\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"resource_grants\\\\\\\" (\\\\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 NOT NULL,\\\\n \\\\\\\"user_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"resource_type\\\\\\\" TEXT,\\\\n \\\\\\\"resource_id\\\\\\\" TEXT,\\\\n \\\\\\\"permission\\\\\\\" TEXT,\\\\n \\\\\\\"effect\\\\\\\" TEXT,\\\\n \\\\\\\"can_delegate\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"parent_grant_id\\\\\\\" UUID,\\\\n \\\\\\\"revoked_at\\\\\\\" TEXT\\\\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\\\":true,\\\"unique\\\":false},\\\"user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"users\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"resource_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"resource_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"permission\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"effect\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"can_delegate\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":false},\\\"parent_grant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"resource_grants\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"revoked_at\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"resource_grants_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"resource_grants_lookup_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"user_id\\\"]},{\\\"name\\\":\\\"resource_grants_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"resource_grants_user_id_idx\\\",\\\"columns\\\":[\\\"user_id\\\"]},{\\\"name\\\":\\\"resource_grants_parent_grant_id_idx\\\",\\\"columns\\\":[\\\"parent_grant_id\\\"]}],\\\"version\\\":\\\"52e03776\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:Role\\\":{\\\"name\\\":\\\"role\\\",\\\"className\\\":\\\"Role\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:Role\\\",\\\"collection\\\":\\\"roles\\\",\\\"description\\\":\\\"Role represents a permission template that can be assigned to users.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/Role.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":false,\\\"related\\\":\\\"Tenant\\\",\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"name\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"default\\\":\\\"\\\",\\\"description\\\":\\\"The name of this set of permissions.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"The name of this set of permissions.\\\"}},\\\"description\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"default\\\":\\\"\\\",\\\"description\\\":\\\"What this role allows and who should receive it.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"What this role allows and who should receive it.\\\"}},\\\"isSystem\\\":{\\\"type\\\":\\\"boolean\\\",\\\"required\\\":false,\\\"default\\\":false,\\\"description\\\":\\\"Whether this is a built-in role protected from deletion.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"Whether this is a built-in role protected from deletion.\\\"}},\\\"inheritsToDescendants\\\":{\\\"type\\\":\\\"boolean\\\",\\\"required\\\":false,\\\"default\\\":false,\\\"description\\\":\\\"Whether this role can give members access to organizations below theirs.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"Whether this role can give members access to organizations below theirs.\\\"}}},\\\"methods\\\":{\\\"isSystemRole\\\":{\\\"name\\\":\\\"isSystemRole\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isTenantRole\\\":{\\\"name\\\":\\\"isTenantRole\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"canDelete\\\":{\\\"name\\\":\\\"canDelete\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"delete\\\":{\\\"name\\\":\\\"delete\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"Role\\\",\\\"collectionExportName\\\":\\\"RoleCollection\\\",\\\"displayLabelField\\\":\\\"name\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"roles\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"roles\\\\\\\" (\\\\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 \\\\\\\"is_system\\\\\\\" BOOLEAN DEFAULT FALSE,\\\\n \\\\\\\"inherits_to_descendants\\\\\\\" BOOLEAN DEFAULT FALSE\\\\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\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"tenants\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"description\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"is_system\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":false},\\\"inherits_to_descendants\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"roles_tenant_id_slug_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"roles_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"47369d9d\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:RolePermission\\\":{\\\"name\\\":\\\"rolepermission\\\",\\\"className\\\":\\\"RolePermission\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:RolePermission\\\",\\\"collection\\\":\\\"rolepermissions\\\",\\\"description\\\":\\\"RolePermission is a join table linking Roles to Permissions.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/RolePermission.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"roleId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"Role\\\",\\\"_meta\\\":{\\\"required\\\":true,\\\"onDelete\\\":\\\"NO ACTION\\\"}},\\\"permissionId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"Permission\\\",\\\"_meta\\\":{\\\"required\\\":true,\\\"onDelete\\\":\\\"NO ACTION\\\"}}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"conflictColumns\\\":[\\\"role_id\\\",\\\"permission_id\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"RolePermission\\\",\\\"collectionExportName\\\":\\\"RolePermissionCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"roleId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"},{\\\"field\\\":\\\"permissionId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"role_permissions\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"role_permissions\\\\\\\" (\\\\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 \\\\\\\"role_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"permission_id\\\\\\\" UUID NOT NULL\\\\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\\\"},\\\"role_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"roles\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"permission_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"permissions\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}}},\\\"indexes\\\":[{\\\"name\\\":\\\"role_permissions_role_id_permission_id_idx\\\",\\\"columns\\\":[\\\"role_id\\\",\\\"permission_id\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"role_permissions_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"role_permissions_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]},{\\\"name\\\":\\\"role_permissions_permission_id_idx\\\",\\\"columns\\\":[\\\"permission_id\\\"]}],\\\"version\\\":\\\"4dfed3ac\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:Session\\\":{\\\"name\\\":\\\"session\\\",\\\"className\\\":\\\"Session\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:Session\\\",\\\"collection\\\":\\\"sessions\\\",\\\"description\\\":\\\"Session represents an authenticated user session.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/Session.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"userId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":false,\\\"related\\\":\\\"User\\\",\\\"description\\\":\\\"The person signed in through this session.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"The person signed in through this session.\\\"}},\\\"tenantId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":false,\\\"related\\\":\\\"Tenant\\\",\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"status\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"description\\\":\\\"Whether this sign-in session is active or has ended.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"Whether this sign-in session is active or has ended.\\\"}},\\\"expiresAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"description\\\":\\\"When this session expires unless renewed within its allowed limits.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"When this session expires unless renewed within its allowed limits.\\\",\\\"indexed\\\":true}},\\\"userAgent\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"default\\\":\\\"\\\",\\\"description\\\":\\\"The browser or device reported when this session was created.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"The browser or device reported when this session was created.\\\"}},\\\"ipAddress\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"default\\\":\\\"\\\",\\\"description\\\":\\\"The network address reported for this session.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"The network address reported for this session.\\\"}},\\\"lastAccessedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"description\\\":\\\"When this session was last used.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"When this session was last used.\\\"}},\\\"data\\\":{\\\"type\\\":\\\"json\\\",\\\"required\\\":false,\\\"default\\\":{},\\\"description\\\":\\\"Additional session details maintained by your application.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"Additional session details maintained by your application.\\\"}},\\\"authMethod\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"description\\\":\\\"The sign-in method used to establish this session.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"The sign-in method used to establish this session.\\\",\\\"nullable\\\":true}},\\\"parentSessionId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{\\\"sqlType\\\":\\\"UUID\\\",\\\"nullable\\\":true,\\\"indexed\\\":true,\\\"sensitive\\\":true},\\\"sensitive\\\":true}},\\\"methods\\\":{\\\"isLayered\\\":{\\\"name\\\":\\\"isLayered\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getAbsoluteExpiry\\\":{\\\"name\\\":\\\"getAbsoluteExpiry\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Date | null\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getIdleSeconds\\\":{\\\"name\\\":\\\"getIdleSeconds\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"number | null\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getAuthenticatedAt\\\":{\\\"name\\\":\\\"getAuthenticatedAt\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Date | null\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getPermissionCeiling\\\":{\\\"name\\\":\\\"getPermissionCeiling\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"string[] | null\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isValid\\\":{\\\"name\\\":\\\"isValid\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isExpired\\\":{\\\"name\\\":\\\"isExpired\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isRevoked\\\":{\\\"name\\\":\\\"isRevoked\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"touch\\\":{\\\"name\\\":\\\"touch\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"extend\\\":{\\\"name\\\":\\\"extend\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"ttlSeconds\\\",\\\"type\\\":\\\"number\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"recordActivity\\\":{\\\"name\\\":\\\"recordActivity\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"extendTtl\\\",\\\"type\\\":\\\"any\\\",\\\"optional\\\":true},{\\\"name\\\":\\\"ttlSeconds\\\",\\\"type\\\":\\\"number\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<boolean>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"revoke\\\":{\\\"name\\\":\\\"revoke\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setTenant\\\":{\\\"name\\\":\\\"setTenant\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"tenantId\\\",\\\"type\\\":\\\"string | null\\\",\\\"optional\\\":false,\\\"unionBranches\\\":[{\\\"type\\\":\\\"string\\\"},{\\\"type\\\":\\\"null\\\"}]}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getData\\\":{\\\"name\\\":\\\"getData\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"key\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"T | undefined\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setData\\\":{\\\"name\\\":\\\"setData\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"key\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"value\\\",\\\"type\\\":\\\"unknown\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"removeData\\\":{\\\"name\\\":\\\"removeData\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"key\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"sensitive\\\":true,\\\"api\\\":{\\\"include\\\":[\\\"get\\\",\\\"delete\\\"]},\\\"mcp\\\":{\\\"include\\\":[]},\\\"cli\\\":false,\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"Session\\\",\\\"collectionExportName\\\":\\\"SessionCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"sessions\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"sessions\\\\\\\" (\\\\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 \\\\\\\"user_id\\\\\\\" UUID,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"status\\\\\\\" TEXT,\\\\n \\\\\\\"expires_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"user_agent\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"ip_address\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"last_accessed_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"data\\\\\\\" JSON DEFAULT '{}',\\\\n \\\\\\\"auth_method\\\\\\\" TEXT,\\\\n \\\\\\\"parent_session_id\\\\\\\" UUID\\\\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\\\"},\\\"user_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"users\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"tenants\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"expires_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"user_agent\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"ip_address\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"last_accessed_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"data\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":{}},\\\"auth_method\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"parent_session_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"sessions_tenant_id_slug_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"sessions_expires_at_idx\\\",\\\"columns\\\":[\\\"expires_at\\\"]},{\\\"name\\\":\\\"sessions_parent_session_id_idx\\\",\\\"columns\\\":[\\\"parent_session_id\\\"]},{\\\"name\\\":\\\"sessions_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]},{\\\"name\\\":\\\"sessions_user_id_idx\\\",\\\"columns\\\":[\\\"user_id\\\"]}],\\\"version\\\":\\\"b4260a0f\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:Tenant\\\":{\\\"name\\\":\\\"tenant\\\",\\\"className\\\":\\\"Tenant\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:Tenant\\\",\\\"collection\\\":\\\"tenants\\\",\\\"description\\\":\\\"Tenant represents an organizational boundary in the multi-tenant system.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/Tenant.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"created_at\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false},\\\"updated_at\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false},\\\"name\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"default\\\":\\\"\\\"},\\\"status\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}},\\\"description\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"default\\\":\\\"\\\"},\\\"parentTenantId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":false,\\\"related\\\":\\\"Tenant\\\",\\\"_meta\\\":{\\\"nullable\\\":true}},\\\"hierarchyLevel\\\":{\\\"type\\\":\\\"integer\\\",\\\"required\\\":false,\\\"default\\\":0},\\\"hierarchyPath\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"default\\\":\\\"\\\"},\\\"cascadePermissions\\\":{\\\"type\\\":\\\"boolean\\\",\\\"required\\\":false,\\\"default\\\":true},\\\"inheritPermissions\\\":{\\\"type\\\":\\\"boolean\\\",\\\"required\\\":false,\\\"default\\\":true}},\\\"methods\\\":{\\\"isActive\\\":{\\\"name\\\":\\\"isActive\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isSuspended\\\":{\\\"name\\\":\\\"isSuspended\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isRoot\\\":{\\\"name\\\":\\\"isRoot\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"canCascadeToChildren\\\":{\\\"name\\\":\\\"canCascadeToChildren\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"acceptsInheritance\\\":{\\\"name\\\":\\\"acceptsInheritance\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"save\\\":{\\\"name\\\":\\\"save\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SmrtSaveOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getAncestorIds\\\":{\\\"name\\\":\\\"getAncestorIds\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"string[]\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableStrategy\\\":\\\"sti\\\",\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"Tenant\\\",\\\"collectionExportName\\\":\\\"TenantCollection\\\",\\\"displayLabelField\\\":\\\"name\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"tenants\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"tenants\\\\\\\" (\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"_meta_type\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"_meta_data\\\\\\\" JSON,\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"name\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"status\\\\\\\" TEXT,\\\\n \\\\\\\"description\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"parent_tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"hierarchy_level\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"hierarchy_path\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"cascade_permissions\\\\\\\" BOOLEAN DEFAULT TRUE,\\\\n \\\\\\\"inherit_permissions\\\\\\\" BOOLEAN DEFAULT TRUE\\\\n);\\\",\\\"columns\\\":{\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"_meta_type\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"_meta_data\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"name\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"default\\\":\\\"\\\"},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false},\\\"description\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"default\\\":\\\"\\\"},\\\"parent_tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"tenants\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"hierarchy_level\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"default\\\":0},\\\"hierarchy_path\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"default\\\":\\\"\\\"},\\\"cascade_permissions\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":true},\\\"inherit_permissions\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"default\\\":true}},\\\"indexes\\\":[{\\\"name\\\":\\\"tenants_slug_context_meta_type_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\",\\\"_meta_type\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"tenants_meta_type_idx\\\",\\\"columns\\\":[\\\"_meta_type\\\"]},{\\\"name\\\":\\\"tenants_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]},{\\\"name\\\":\\\"tenants_parent_tenant_id_idx\\\",\\\"columns\\\":[\\\"parent_tenant_id\\\"]}],\\\"version\\\":\\\"934f7025\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:TenantIntegration\\\":{\\\"name\\\":\\\"tenantintegration\\\",\\\"className\\\":\\\"TenantIntegration\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:TenantIntegration\\\",\\\"collection\\\":\\\"tenantintegrations\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/TenantIntegration.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":true,\\\"_meta\\\":{\\\"sqlType\\\":\\\"UUID\\\",\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false}}},\\\"provider\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"default\\\":\\\"aws\\\"},\\\"externalIds\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false},\\\"status\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"default\\\":\\\"unprovisioned\\\",\\\"enum\\\":[\\\"unprovisioned\\\",\\\"provisioning\\\",\\\"active\\\",\\\"drifted\\\",\\\"failed\\\"]},\\\"lastCheckedAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false},\\\"lastCheckSummary\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false},\\\"lastError\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false}},\\\"methods\\\":{\\\"initialize\\\":{\\\"name\\\":\\\"initialize\\\",\\\"async\\\":true,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getExternalIds\\\":{\\\"name\\\":\\\"getExternalIds\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"Record<string, string>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setExternalIds\\\":{\\\"name\\\":\\\"setExternalIds\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"externalIds\\\",\\\"type\\\":\\\"Record<string, string> | string\\\",\\\"optional\\\":false,\\\"unionBranches\\\":[{\\\"type\\\":\\\"Record<string, string>\\\"},{\\\"type\\\":\\\"string\\\"}]}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getExternalId\\\":{\\\"name\\\":\\\"getExternalId\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"key\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"string | undefined\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setExternalId\\\":{\\\"name\\\":\\\"setExternalId\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"key\\\",\\\"type\\\":\\\"string\\\",\\\"optional\\\":false},{\\\"name\\\":\\\"value\\\",\\\"type\\\":\\\"string | undefined\\\",\\\"optional\\\":false,\\\"unionBranches\\\":[{\\\"type\\\":\\\"string\\\"},{\\\"type\\\":\\\"undefined\\\"}]}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"getLastCheckSummary\\\":{\\\"name\\\":\\\"getLastCheckSummary\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"TenantIntegrationCheckSummary[]\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"setLastCheckSummary\\\":{\\\"name\\\":\\\"setLastCheckSummary\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"summary\\\",\\\"type\\\":\\\"TenantIntegrationCheckSummary[] | string\\\",\\\"optional\\\":false,\\\"unionBranches\\\":[{\\\"type\\\":\\\"TenantIntegrationCheckSummary[]\\\"},{\\\"type\\\":\\\"string\\\"}]}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"recordDoctorRun\\\":{\\\"name\\\":\\\"recordDoctorRun\\\",\\\"async\\\":false,\\\"parameters\\\":[{\\\"name\\\":\\\"outcome\\\",\\\"type\\\":\\\"object\\\",\\\"optional\\\":false,\\\"memberTypes\\\":[\\\"TenantIntegrationStatus\\\",\\\"TenantIntegrationCheckSummary[]\\\",\\\"string | null\\\"]}],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"tenant_integrations\\\",\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"provider\\\"],\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"}},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"TenantIntegration\\\",\\\"collectionExportName\\\":\\\"TenantIntegrationCollection\\\",\\\"validationRules\\\":[],\\\"schema\\\":{\\\"tableName\\\":\\\"tenant_integrations\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"tenant_integrations\\\\\\\" (\\\\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 NOT NULL,\\\\n \\\\\\\"provider\\\\\\\" TEXT DEFAULT 'aws',\\\\n \\\\\\\"external_ids\\\\\\\" TEXT,\\\\n \\\\\\\"status\\\\\\\" TEXT DEFAULT 'unprovisioned',\\\\n \\\\\\\"last_checked_at\\\\\\\" TIMESTAMP,\\\\n \\\\\\\"last_check_summary\\\\\\\" TEXT,\\\\n \\\\\\\"last_error\\\\\\\" TEXT\\\\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\\\":true,\\\"unique\\\":false},\\\"provider\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"aws\\\"},\\\"external_ids\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"unprovisioned\\\"},\\\"last_checked_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"last_check_summary\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"last_error\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"tenant_integrations_tenant_id_provider_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"provider\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"tenant_integrations_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"tenant_integrations_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]}],\\\"version\\\":\\\"3ed31966\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:TenantPermissionOverride\\\":{\\\"name\\\":\\\"tenantpermissionoverride\\\",\\\"className\\\":\\\"TenantPermissionOverride\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:TenantPermissionOverride\\\",\\\"collection\\\":\\\"tenantpermissionoverrides\\\",\\\"description\\\":\\\"TenantPermissionOverride allows setting explicit permission values at the tenant level.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/TenantPermissionOverride.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"Tenant\\\",\\\"_meta\\\":{\\\"required\\\":true,\\\"onDelete\\\":\\\"NO ACTION\\\"}},\\\"permissionId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"required\\\":true,\\\"related\\\":\\\"Permission\\\",\\\"_meta\\\":{\\\"required\\\":true,\\\"onDelete\\\":\\\"NO ACTION\\\"}},\\\"effect\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"_meta\\\":{}}},\\\"methods\\\":{\\\"isInherit\\\":{\\\"name\\\":\\\"isInherit\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isGrant\\\":{\\\"name\\\":\\\"isGrant\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isDeny\\\":{\\\"name\\\":\\\"isDeny\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"hasExplicitEffect\\\":{\\\"name\\\":\\\"hasExplicitEffect\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"permission_id\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"TenantPermissionOverride\\\",\\\"collectionExportName\\\":\\\"TenantPermissionOverrideCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"tenantId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"},{\\\"field\\\":\\\"permissionId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"foreignKey\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"tenant_permission_overrides\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"tenant_permission_overrides\\\\\\\" (\\\\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 NOT NULL,\\\\n \\\\\\\"permission_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"effect\\\\\\\" TEXT\\\\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\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"tenants\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"permission_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"permissions\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"NO ACTION\\\",\\\"onUpdate\\\":\\\"CASCADE\\\"}},\\\"effect\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"tenant_permission_overrides_tenant_id_permission_id_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"permission_id\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"tenant_permission_overrides_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"]},{\\\"name\\\":\\\"tenant_permission_overrides_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]},{\\\"name\\\":\\\"tenant_permission_overrides_permission_id_idx\\\",\\\"columns\\\":[\\\"permission_id\\\"]}],\\\"version\\\":\\\"95b78bdd\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"},\\\"@happyvertical/smrt-users:User\\\":{\\\"name\\\":\\\"user\\\",\\\"className\\\":\\\"User\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-users:User\\\",\\\"collection\\\":\\\"users\\\",\\\"description\\\":\\\"User represents an authenticated identity in the system.\\\",\\\"filePath\\\":\\\"/home/runner/work/smrt/smrt/packages/users/src/models/User.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-users\\\",\\\"fields\\\":{\\\"profileId\\\":{\\\"type\\\":\\\"crossPackageRef\\\",\\\"required\\\":false,\\\"related\\\":\\\"@happyvertical/smrt-profiles:Profile\\\",\\\"description\\\":\\\"The personal profile linked to this account.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"The personal profile linked to this account.\\\",\\\"unique\\\":true}},\\\"email\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"default\\\":\\\"\\\",\\\"description\\\":\\\"The email address used for this account.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"The email address used for this account.\\\",\\\"indexed\\\":true}},\\\"emailKey\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"description\\\":\\\"The standardized email address used to recognize this account; maintained automatically.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"The standardized email address used to recognize this account; maintained automatically.\\\",\\\"nullable\\\":true,\\\"unique\\\":true,\\\"readonly\\\":true},\\\"readonly\\\":true},\\\"username\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"description\\\":\\\"Optional username used to sign in; lowercase and globally unique.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"Optional username used to sign in; lowercase and globally unique.\\\",\\\"nullable\\\":true,\\\"indexed\\\":true}},\\\"usernameKey\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"description\\\":\\\"The standardized username used to recognize this account; maintained automatically.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"The standardized username used to recognize this account; maintained automatically.\\\",\\\"nullable\\\":true,\\\"unique\\\":true,\\\"readonly\\\":true},\\\"readonly\\\":true},\\\"status\\\":{\\\"type\\\":\\\"text\\\",\\\"required\\\":false,\\\"description\\\":\\\"Whether this account is active, inactive, pending, or suspended.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"Whether this account is active, inactive, pending, or suspended.\\\"}},\\\"lastLoginAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"required\\\":false,\\\"description\\\":\\\"When this person most recently signed in.\\\",\\\"_meta\\\":{\\\"description\\\":\\\"When this person most recently signed in.\\\"}}},\\\"methods\\\":{\\\"hasValidEmail\\\":{\\\"name\\\":\\\"hasValidEmail\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isActive\\\":{\\\"name\\\":\\\"isActive\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isSuspended\\\":{\\\"name\\\":\\\"isSuspended\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"isPending\\\":{\\\"name\\\":\\\"isPending\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"boolean\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"recordLogin\\\":{\\\"name\\\":\\\"recordLogin\\\",\\\"async\\\":false,\\\"parameters\\\":[],\\\"returnType\\\":\\\"void\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"save\\\":{\\\"name\\\":\\\"save\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SmrtSaveOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"api\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"mcp\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]},\\\"cli\\\":{\\\"include\\\":[\\\"list\\\",\\\"get\\\"]}},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"User\\\",\\\"collectionExportName\\\":\\\"UserCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"users\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"users\\\\\\\" (\\\\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 \\\\\\\"profile_id\\\\\\\" UUID UNIQUE,\\\\n \\\\\\\"email\\\\\\\" TEXT DEFAULT '',\\\\n \\\\\\\"email_key\\\\\\\" TEXT UNIQUE,\\\\n \\\\\\\"username\\\\\\\" TEXT,\\\\n \\\\\\\"username_key\\\\\\\" TEXT UNIQUE,\\\\n \\\\\\\"status\\\\\\\" TEXT,\\\\n \\\\\\\"last_login_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\\\"},\\\"profile_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"crossPackageRef\\\",\\\"notNull\\\":false,\\\"unique\\\":true},\\\"email\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"email_key\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":true},\\\"username\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"username_key\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":true},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"last_login_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"users_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"users_email_idx\\\",\\\"columns\\\":[\\\"email\\\"]},{\\\"name\\\":\\\"users_username_idx\\\",\\\"columns\\\":[\\\"username\\\"]},{\\\"name\\\":\\\"users_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"3ee8f0f4\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-users\\\"}},\\\"moduleType\\\":\\\"smrt\\\",\\\"recipes\\\":[{\\\"id\\\":\\\"users.roles-and-permissions\\\",\\\"className\\\":\\\"UsersRolesAndPermissionsRecipe\\\",\\\"label\\\":\\\"Roles and permissions\\\",\\\"summary\\\":\\\"Manage tenant roles, memberships, permissions, and controlled sharing.\\\",\\\"synonyms\\\":[\\\"access control\\\",\\\"rbac\\\",\\\"sharing\\\"],\\\"models\\\":[\\\"@happyvertical/smrt-users:Role\\\",\\\"@happyvertical/smrt-users:Permission\\\",\\\"@happyvertical/smrt-users:Membership\\\",\\\"@happyvertical/smrt-users:ResourceGrant\\\"],\\\"nav\\\":[{\\\"label\\\":\\\"Roles\\\",\\\"model\\\":\\\"@happyvertical/smrt-users:Role\\\",\\\"icon\\\":\\\"users\\\",\\\"description\\\":\\\"Define tenant permission bundles.\\\",\\\"noun\\\":\\\"role\\\"},{\\\"label\\\":\\\"Permissions\\\",\\\"model\\\":\\\"@happyvertical/smrt-users:Permission\\\",\\\"icon\\\":\\\"settings\\\",\\\"description\\\":\\\"Review operations available to roles.\\\",\\\"noun\\\":\\\"permission\\\"}],\\\"requires\\\":[],\\\"group\\\":{\\\"id\\\":\\\"account-access\\\",\\\"label\\\":\\\"Account access\\\",\\\"summary\\\":\\\"Sign in and manage account sessions.\\\"},\\\"section\\\":{\\\"id\\\":\\\"access-control\\\",\\\"label\\\":\\\"Access control\\\",\\\"icon\\\":\\\"users\\\",\\\"description\\\":\\\"Manage tenant roles, permissions, and reviewed sharing.\\\"},\\\"options\\\":{\\\"@happyvertical/smrt-users:ResourceGrant\\\":{\\\"exposure\\\":{\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false}}},\\\"help\\\":{\\\"markdown\\\":\\\"## Overview\\\\n\\\\nRoles and permissions control access to your organization. Denies take precedence, and role changes should be reviewed before they are applied.\\\\n\\\\n## Tasks\\\\n\\\\n- Ask an authorized administrator to create a role and assign only the permissions required for its work.\\\\n- Add a member to the correct organization through your approved membership settings and assign a role through {field:Membership.roleId}.\\\\n- Use a resource grant only when a record needs a reviewed exception to its ordinary role rules.\\\\n\\\",\\\"fieldRefs\\\":[\\\"Membership.roleId\\\"]},\\\"demo\\\":{\\\"mode\\\":\\\"server\\\",\\\"reasons\\\":[\\\"Needs a server because its package does not build for a browser: node:crypto/async_hooks; core migrations; and its package depends on @happyvertical/smrt-profiles, @happyvertical/smrt-tenancy, which do not build for a browser (#3617, #3624, #3626).\\\"]}},{\\\"id\\\":\\\"users.sign-in\\\",\\\"className\\\":\\\"UsersSignInRecipe\\\",\\\"label\\\":\\\"Sign in\\\",\\\"summary\\\":\\\"Access an account through an application-authorized sign-in flow.\\\",\\\"synonyms\\\":[\\\"log in\\\",\\\"authentication\\\",\\\"single sign-on\\\"],\\\"models\\\":[\\\"@happyvertical/smrt-users:User\\\",\\\"@happyvertical/smrt-users:Session\\\"],\\\"nav\\\":[{\\\"label\\\":\\\"Security sessions\\\",\\\"model\\\":\\\"@happyvertical/smrt-users:Session\\\",\\\"icon\\\":\\\"settings\\\",\\\"description\\\":\\\"Review active sessions and sign out unrecognized devices.\\\",\\\"noun\\\":\\\"security session\\\"}],\\\"requires\\\":[],\\\"group\\\":{\\\"id\\\":\\\"account-access\\\",\\\"label\\\":\\\"Account access\\\",\\\"summary\\\":\\\"Sign in and manage account sessions.\\\"},\\\"section\\\":{\\\"id\\\":\\\"account-security\\\",\\\"label\\\":\\\"Account security\\\",\\\"icon\\\":\\\"settings\\\",\\\"description\\\":\\\"Review account access and active sessions.\\\"},\\\"options\\\":{\\\"@happyvertical/smrt-users:Session\\\":{\\\"exposure\\\":{\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false}}},\\\"help\\\":{\\\"markdown\\\":\\\"## Overview\\\\n\\\\nUse your organization’s approved sign-in method. Review your signed-in devices on your account security page.\\\\n\\\\n## Tasks\\\\n\\\\n- Review active sign-in sessions from your account security page and end sessions you no longer recognize.\\\\n- Ask an administrator for recovery help if you lose access to every available credential.\\\\n\\\",\\\"fieldRefs\\\":[]},\\\"surfaces\\\":[{\\\"kind\\\":\\\"settings-panel\\\",\\\"export\\\":\\\"@happyvertical/smrt-users/svelte#AccountSecurityPanel\\\",\\\"label\\\":\\\"Account security\\\"}],\\\"providers\\\":[{\\\"id\\\":\\\"oidc\\\",\\\"kind\\\":\\\"oauth\\\",\\\"options\\\":[\\\"oidc\\\"],\\\"required\\\":false}],\\\"demo\\\":{\\\"mode\\\":\\\"server\\\",\\\"reasons\\\":[\\\"Needs a server because its package does not build for a browser: node:crypto/async_hooks; core migrations; and its package depends on @happyvertical/smrt-profiles, @happyvertical/smrt-tenancy, which do not build for a browser (#3617, #3624, #3626).\\\"]}}],\\\"smrtDependencies\\\":[\\\"@happyvertical/smrt-core\\\",\\\"@happyvertical/smrt-mobile-contract\\\",\\\"@happyvertical/smrt-profiles\\\",\\\"@happyvertical/smrt-tenancy\\\"],\\\"browser\\\":{\\\"status\\\":\\\"server-only\\\",\\\"issues\\\":[\\\"#3617\\\",\\\"#3624\\\",\\\"#3626\\\"],\\\"reason\\\":\\\"node:crypto/async_hooks; core migrations\\\",\\\"via\\\":[\\\"@happyvertical/smrt-profiles\\\",\\\"@happyvertical/smrt-tenancy\\\"]},\\\"stampsConstructors\\\":true}\"));\n","/**\n * UsersCliAuthRequest model — device-code grant for terminal/CLI logins.\n *\n * Backs the \"browser approves a terminal\" flow: a CLI starts a request, the\n * server returns a short user code, the user signs in on a browser and\n * approves the code, then the CLI polls and gets back a session token bound\n * to the approving user. Records are short-lived (TTL is enforced by\n * `expiresAt`) and store only a hash of the device code so the raw device\n * code is never recoverable from the database.\n *\n * @packageDocumentation\n */\n\nimport { field, foreignKey, SmrtObject, smrt } from '@happyvertical/smrt-core';\n\n/**\n * CLI auth request lifecycle states.\n */\nexport type CliAuthRequestStatus =\n | 'pending'\n | 'approved'\n | 'consumed'\n | 'expired';\n\n@smrt({\n tableName: 'users_cli_auth_requests',\n // Device-code state: a plaintext `userCode`, a `deviceCodeHash`, and the\n // session id minted on approval. Never in the change feed (#2937).\n sensitive: true,\n api: { include: [] },\n cli: false,\n mcp: { include: [] },\n})\nexport class UsersCliAuthRequest extends SmrtObject { static __smrtPackage__ = \"@happyvertical/smrt-users\";\n /**\n * Short, human-typeable code the user enters in the browser to approve the session.\n *\n * Indexed: `findByUserCode()` looks requests up by this column (#2364,\n * epic #2382 finding A3).\n */\n @field({ type: 'text', required: true, unique: true })\n userCode = '';\n\n /**\n * SHA-256 hash of the long device code the CLI keeps secret.\n *\n * Indexed: `findByDeviceCodeHash()` — the CLI's poll loop — looks requests\n * up by this column (#2364, epic #2382 finding A3).\n */\n @field({ type: 'text', required: true, unique: true })\n deviceCodeHash = '';\n\n /** Lifecycle state — `pending` → `approved` → `consumed`, or `expired`. */\n @field({ type: 'text' })\n status: CliAuthRequestStatus = 'pending';\n\n /** User id of the human who approved the request (set on approval). */\n @foreignKey('User', { nullable: true })\n userId: string | null = null;\n\n /** Tenant id captured from the approving session (set on approval). */\n @foreignKey('Tenant', { nullable: true })\n tenantId: string | null = null;\n\n /** Session id minted on approval; cleared by the winning single-use exchange. */\n @foreignKey('Session', { nullable: true })\n sessionId: string | null = null;\n\n /**\n * When the pending request stops accepting approvals.\n *\n * Indexed: `deleteExpired()` — and the retention sweep that now schedules\n * it (#2375) — scans this column on every pass.\n */\n @field({ type: 'datetime', indexed: true })\n expiresAt = new Date();\n\n /** When approval happened — null while the request is still pending. */\n @field({ type: 'datetime', nullable: true })\n approvedAt: Date | null = null;\n}\n\nexport { UsersCliAuthRequest as CliAuthRequest };\n","/**\n * UsersCliAuthRequestCollection — lookups for the device-code grant flow.\n *\n * @packageDocumentation\n */\n\nimport { SmrtCollection } from '@happyvertical/smrt-core';\nimport { UsersCliAuthRequest } from '../models/CliAuthRequest.js';\nimport { SessionCollection } from './SessionCollection.js';\n\nexport interface ApprovePendingCliAuthRequestInput {\n approvedBy: string;\n ipAddress?: string;\n sessionTtlSeconds: number;\n tenantId: string;\n userAgent?: string;\n userCode: string;\n userId: string;\n}\n\nexport interface ApprovedCliAuthRequestSnapshot {\n approvedAt: Date;\n id: string;\n sessionId: string;\n tenantId: string;\n userId: string;\n}\n\nclass CliAuthApprovalLostError extends Error {}\n\nexport class UsersCliAuthRequestCollection extends SmrtCollection<UsersCliAuthRequest> {\n static readonly _itemClass = UsersCliAuthRequest;\n\n /**\n * Atomically approve one pending request and mint its bearer session.\n *\n * The session is created inside the same transaction as the conditional\n * pending-to-approved transition. If another approver wins, or persisting\n * the approval fails, throwing rolls the losing session back with the\n * request write so no usable orphan credential can remain.\n */\n async approvePendingRequest(\n input: ApprovePendingCliAuthRequestInput,\n ): Promise<ApprovedCliAuthRequestSnapshot | null> {\n const transaction = this.db.transaction?.bind(this.db);\n if (!transaction) {\n throw new Error(\n 'Terminal approval requires database transaction support.',\n );\n }\n\n try {\n return await transaction(async (tx) => {\n const sessions = await SessionCollection.create({ db: tx });\n const session = await sessions.createSession({\n authMethod: 'terminal',\n data: {\n approvedBy: input.approvedBy,\n kind: 'terminal',\n },\n ipAddress: input.ipAddress,\n tenantId: input.tenantId,\n ttl: input.sessionTtlSeconds,\n userAgent: input.userAgent,\n userId: input.userId,\n });\n const createdSessionId = session.id;\n if (!createdSessionId) {\n throw new Error('Terminal approval failed to mint a session.');\n }\n\n const approvedAt = new Date();\n const now = approvedAt.toISOString();\n const approved = await tx.query(\n `UPDATE ${this.tableName}\n SET approved_at = ?, session_id = ?, status = 'approved',\n tenant_id = ?, user_id = ?, updated_at = ?\n WHERE user_code = ? AND status = 'pending' AND expires_at > ?\n RETURNING id`,\n now,\n createdSessionId,\n input.tenantId,\n input.userId,\n now,\n input.userCode.trim().toUpperCase(),\n now,\n );\n if (approved.rows?.length !== 1) {\n throw new CliAuthApprovalLostError();\n }\n const id = approved.rows[0]?.id;\n if (typeof id !== 'string') {\n throw new Error('Terminal approval did not return its request id.');\n }\n return {\n approvedAt,\n id,\n sessionId: createdSessionId,\n tenantId: input.tenantId,\n userId: input.userId,\n };\n });\n } catch (error) {\n if (error instanceof CliAuthApprovalLostError) return null;\n throw error;\n }\n }\n\n /**\n * Atomically consume the bearer session attached to an approved request.\n *\n * The conditional update is the arbiter: concurrent exchangers may observe\n * the same candidate, but only one can change `approved` to `consumed` while\n * matching the same session id. The winning transaction returns the token\n * from its locked candidate and clears it from durable storage.\n */\n async consumeApprovedSession(deviceCodeHash: string): Promise<string | null> {\n const transaction = this.db.transaction?.bind(this.db);\n if (!transaction) {\n throw new Error(\n 'Terminal device exchange requires database transaction support.',\n );\n }\n return transaction(async (tx) => {\n const selected = await tx.query(\n `SELECT id, session_id FROM ${this.tableName}\n WHERE device_code_hash = ? AND status = 'approved' AND session_id IS NOT NULL\n LIMIT 1`,\n deviceCodeHash,\n );\n const candidate = selected.rows?.[0];\n const id = typeof candidate?.id === 'string' ? candidate.id : null;\n const sessionId =\n typeof candidate?.session_id === 'string' ? candidate.session_id : null;\n if (!id || !sessionId) return null;\n\n const consumed = await tx.query(\n `UPDATE ${this.tableName}\n SET status = 'consumed', session_id = NULL, updated_at = ?\n WHERE id = ? AND status = 'approved' AND session_id = ?\n RETURNING id`,\n new Date().toISOString(),\n id,\n sessionId,\n );\n return consumed.rows?.length === 1 ? sessionId : null;\n });\n }\n\n /**\n * Look up a pending or completed request by the short user code shown in the CLI.\n */\n async findByUserCode(userCode: string): Promise<UsersCliAuthRequest | null> {\n const [request] = await this.list({\n limit: 1,\n where: { userCode: userCode.trim().toUpperCase() },\n });\n return request ?? null;\n }\n\n /**\n * Look up a request by the hash of its device code (the CLI's polling key).\n */\n async findByDeviceCodeHash(\n deviceCodeHash: string,\n ): Promise<UsersCliAuthRequest | null> {\n const [request] = await this.list({\n limit: 1,\n where: { deviceCodeHash },\n });\n return request ?? null;\n }\n\n /**\n * Delete expired pending, lazily-expired, or already-consumed requests.\n *\n * Scheduled by the framework retention sweep (#2375); `expiresAt` carries an\n * index for this predicate.\n *\n * @param options.dryRun - Count the requests the predicate selects without\n * deleting them.\n * @returns Number of requests deleted (or, under `dryRun`, matched)\n */\n async deleteExpired(options: { dryRun?: boolean } = {}): Promise<number> {\n // One statement, for the same reason `SessionCollection.deleteExpired()`\n // is one (#1400): this runs unattended on the retention sweep's timer, and\n // a per-row delete that throws part-way leaves the rest of the expired\n // requests un-reaped. It also avoids hydrating every row just to delete it.\n const now = new Date().toISOString();\n const predicate =\n \"status IN ('pending', 'expired', 'consumed') AND expires_at < ?\";\n\n const counted = await this.db.query(\n `SELECT COUNT(*) AS total FROM ${this.tableName} WHERE ${predicate}`,\n now,\n );\n const total = Number(counted.rows?.[0]?.total ?? 0);\n if (!Number.isFinite(total) || total <= 0) return 0;\n\n if (!options.dryRun) {\n await this.db.query(\n `DELETE FROM ${this.tableName} WHERE ${predicate}`,\n now,\n );\n }\n\n return total;\n }\n}\n\nexport { UsersCliAuthRequestCollection as CliAuthRequestCollection };\n","/**\n * Single-use ledger of CONSUMED passkey ceremony challenges (#3275).\n *\n * A ceremony challenge is issued statelessly (an HMAC-signed `ceremonyId`, so\n * an unauthenticated \"begin\" request writes nothing). Single use is enforced\n * here instead: when a ceremony is verified its challenge hash is inserted,\n * and the unique `challengeHash` turns a replay into a conflict. Rows are\n * worthless once `expiresAt` has passed (the signed ceremony itself no longer\n * verifies), so the retention sweep reaps them.\n *\n * Only the sha256 of the challenge is stored, never the challenge.\n *\n * @packageDocumentation\n */\n\nimport { field, SmrtObject, smrt } from '@happyvertical/smrt-core';\n\n/** No configuration may keep a ceremony open longer than this (10 minutes). */\nexport const PASSKEY_CHALLENGE_TTL_CEILING_SECONDS = 10 * 60;\n\n/** What a consumed challenge was issued for. */\nexport type PasskeyChallengePurpose = 'authentication' | 'registration';\n\n@smrt({\n tableName: 'users_passkey_challenges',\n // Replay-protection material. Never in the change feed (#2937).\n sensitive: true,\n api: false,\n cli: false,\n mcp: false,\n})\nexport class UsersPasskeyChallenge extends SmrtObject { static __smrtPackage__ = \"@happyvertical/smrt-users\";\n /** sha256 hex of the consumed challenge (base64url string). Unique. */\n @field({ type: 'text', required: true, unique: true })\n challengeHash = '';\n\n /** `authentication` or `registration`. */\n @field({ type: 'text', required: true })\n purpose: PasskeyChallengePurpose = 'authentication';\n\n /**\n * When the ceremony stops verifying anyway.\n *\n * Indexed: the retention sweep prunes by this column.\n */\n @field({ type: 'datetime', required: true, indexed: true })\n expiresAt = new Date();\n}\n","/**\n * Collection for {@link UsersPasskeyChallenge} (#3275).\n *\n * @packageDocumentation\n */\n\nimport { randomUUID } from 'node:crypto';\nimport { SmrtCollection } from '@happyvertical/smrt-core';\nimport {\n PASSKEY_CHALLENGE_TTL_CEILING_SECONDS,\n type PasskeyChallengePurpose,\n UsersPasskeyChallenge,\n} from '../models/PasskeyChallenge.js';\n\nexport class UsersPasskeyChallengeCollection extends SmrtCollection<UsersPasskeyChallenge> {\n static readonly _itemClass = UsersPasskeyChallenge;\n\n /**\n * Consume a challenge: insert its hash. Returns false, writing nothing,\n * when the hash was already consumed — a replay. One\n * `INSERT … ON CONFLICT DO NOTHING` against the unique `challenge_hash`\n * decides between concurrent consumers, so of any number of simultaneous\n * uses exactly one gets true. A constraint error is deliberately never the\n * arbiter: a failed statement on a shared connection can be reported to the\n * wrong caller, and a database failure must not read as \"consumed\" or\n * \"fresh\".\n */\n async consume(\n challengeHash: string,\n purpose: PasskeyChallengePurpose,\n expiresAt: Date,\n ): Promise<boolean> {\n const id = randomUUID();\n const now = new Date().toISOString();\n const { rowCount } = await this.db.query(\n `INSERT INTO ${this.tableName} (\n id, slug, context, challenge_hash, purpose, expires_at,\n created_at, updated_at\n ) VALUES (?, ?, '', ?, ?, ?, ?, ?)\n ON CONFLICT (challenge_hash) DO NOTHING`,\n id,\n id,\n challengeHash,\n purpose,\n expiresAt.toISOString(),\n now,\n now,\n );\n return rowCount > 0;\n }\n\n /**\n * Delete consumed challenges whose ceremonies can no longer verify ANYWHERE.\n * A row is kept for {@link PASSKEY_CHALLENGE_TTL_CEILING_SECONDS} past its\n * `expires_at`: another process whose clock runs behind this one's could\n * still accept the signed ceremony after this one's clock says it expired,\n * and deleting the row inside that window would reopen replay. One\n * statement (see `UsersMagicLinkTokenCollection.deleteExpired`);\n * `expiresAt` carries an index for this predicate.\n *\n * @param options.dryRun - Count the rows the predicate selects without\n * deleting them.\n */\n async deleteExpired(options: { dryRun?: boolean } = {}): Promise<number> {\n const horizon = new Date(\n Date.now() - PASSKEY_CHALLENGE_TTL_CEILING_SECONDS * 1000,\n ).toISOString();\n const predicate = 'expires_at < ?';\n const counted = await this.db.query(\n `SELECT COUNT(*) AS total FROM ${this.tableName} WHERE ${predicate}`,\n horizon,\n );\n const total = Number(counted.rows?.[0]?.total ?? 0);\n if (!Number.isFinite(total) || total <= 0) return 0;\n if (!options.dryRun) {\n await this.db.query(\n `DELETE FROM ${this.tableName} WHERE ${predicate}`,\n horizon,\n );\n }\n return total;\n }\n}\n","/**\n * Per-person passkey (WebAuthn) credentials (#3275).\n *\n * Its own object rather than a column on `User`, like the password and PIN\n * credentials: authentication extends without touching the identity model, the\n * key material is never selected by the many existing user reads, and it is\n * never serialized by accident. Unlike a password, a person may hold SEVERAL\n * passkeys (a laptop, a phone, a security key), so `userId` is not unique;\n * `credentialId` is, because the authenticator names the credential and the\n * discoverable sign-in finds the person from it.\n *\n * Tenant access still comes only from an active Membership, which sign-in\n * checks separately. See {@link PasskeyCredentialService}; that service and its\n * SvelteKit handlers are the only read and write paths.\n *\n * @packageDocumentation\n */\n\nimport { field, foreignKey, SmrtObject, smrt } from '@happyvertical/smrt-core';\n\n/** Whether a credential can be synced between devices (WebAuthn `credentialDeviceType`). */\nexport type PasskeyDeviceType = 'singleDevice' | 'multiDevice';\n\n/** The transport hints WebAuthn defines; anything else stored is dropped on read. */\nconst KNOWN_TRANSPORTS: ReadonlySet<string> = new Set([\n 'ble',\n 'cable',\n 'hybrid',\n 'internal',\n 'nfc',\n 'smart-card',\n 'usb',\n]);\n\n/** The transport hints worth storing, in order; anything unknown is dropped. */\nexport function knownPasskeyTransports(\n values: readonly unknown[] | null | undefined,\n): string[] {\n return (values ?? []).filter(\n (value): value is string =>\n typeof value === 'string' && KNOWN_TRANSPORTS.has(value),\n );\n}\n\n@smrt({\n tableName: 'users_passkey_credentials',\n // Credential material. Never in the change feed (#2937), never on an API.\n sensitive: true,\n api: false,\n cli: false,\n mcp: false,\n})\nexport class UsersPasskeyCredential extends SmrtObject { static __smrtPackage__ = \"@happyvertical/smrt-users\";\n /** The person this passkey signs in. A person may hold several. */\n @foreignKey('User', { required: true })\n userId = '';\n\n /** The authenticator's credential id, base64url. Unique across all people. */\n @field({ type: 'text', required: true, unique: true, sensitive: true })\n credentialId = '';\n\n /** The credential public key (COSE), base64url. */\n @field({ type: 'text', required: true, sensitive: true })\n publicKey = '';\n\n /** The authenticator's signature counter at its last accepted assertion. */\n @field({ type: 'integer', required: true, default: 0 })\n signCount = 0;\n\n /** JSON array of transport hints; use {@link getTransports}. */\n @field({ type: 'text', nullable: true })\n transports: string | null = null;\n\n /** The name the person gave this passkey (\"MacBook\", \"YubiKey\"). */\n @field({ type: 'text', required: true })\n name = '';\n\n /** The authenticator model's AAGUID, when it reported one. */\n @field({ type: 'text', nullable: true })\n aaguid: string | null = null;\n\n /** Whether the credential is currently backed up (synced) by its provider. */\n @field({ type: 'boolean', required: true, default: false })\n backedUp = false;\n\n /** `singleDevice` or `multiDevice`, as reported at registration. */\n @field({ type: 'text', nullable: true })\n deviceType: PasskeyDeviceType | null = null;\n\n /** When this passkey last signed the person in. */\n @field({ type: 'datetime', nullable: true })\n lastUsedAt: Date | null = null;\n\n /** `self` (the only value today: a passkey is always registered by its owner). */\n @field({ type: 'text', nullable: true })\n createdBy: string | null = null;\n\n /** Transport hints, guarded: malformed or unknown entries are dropped. */\n getTransports(): string[] {\n if (!this.transports) return [];\n try {\n const parsed: unknown = JSON.parse(this.transports);\n return Array.isArray(parsed) ? knownPasskeyTransports(parsed) : [];\n } catch {\n return [];\n }\n }\n\n setTransports(value: readonly string[] | null | undefined): void {\n const known = knownPasskeyTransports(value);\n this.transports = known.length > 0 ? JSON.stringify(known) : null;\n }\n}\n","/**\n * Collection for {@link UsersPasskeyCredential} (#3275).\n *\n * @packageDocumentation\n */\n\nimport { randomUUID } from 'node:crypto';\nimport { SmrtCollection } from '@happyvertical/smrt-core';\nimport {\n knownPasskeyTransports,\n UsersPasskeyCredential,\n} from '../models/PasskeyCredential.js';\n\nexport interface PasskeyCredentialWrite {\n userId: string;\n credentialId: string;\n publicKey: string;\n signCount: number;\n transports: readonly string[] | null;\n name: string;\n aaguid: string | null;\n backedUp: boolean;\n deviceType: 'singleDevice' | 'multiDevice' | null;\n createdBy: string;\n}\n\nexport class UsersPasskeyCredentialCollection extends SmrtCollection<UsersPasskeyCredential> {\n static readonly _itemClass = UsersPasskeyCredential;\n\n /**\n * The row for an authenticator's credential id. `credentialId` is a\n * sensitive field, which `list()` refuses as a filter, so the id comes from\n * a raw read (as `Session.parentSessionId` does) and the row is then loaded.\n */\n async findByCredentialId(\n credentialId: string,\n ): Promise<UsersPasskeyCredential | null> {\n const result = await this.db.query(\n `SELECT id FROM ${this.tableName} WHERE credential_id = ?`,\n credentialId,\n );\n const id = result.rows?.[0]?.id;\n return typeof id === 'string' ? this.get(id) : null;\n }\n\n /**\n * Every passkey of one person, oldest first. Read through the collection a\n * service created WITHOUT list bounds: a truncated list would hide passkeys\n * from `excludeCredentials` and from the per-person limit.\n */\n async listByUserId(userId: string): Promise<UsersPasskeyCredential[]> {\n const rows = await this.list({ where: { userId } });\n return rows.sort(\n (a, b) =>\n (a.created_at?.getTime() ?? 0) - (b.created_at?.getTime() ?? 0) ||\n String(a.id).localeCompare(String(b.id)),\n );\n }\n\n /** How many passkeys the person holds (raw count: never list-bounded). */\n async countByUserId(userId: string): Promise<number> {\n const result = await this.db.query(\n `SELECT COUNT(*) AS total FROM ${this.tableName} WHERE user_id = ?`,\n userId,\n );\n const total = Number(result.rows?.[0]?.total ?? 0);\n return Number.isFinite(total) ? total : 0;\n }\n\n /** The passkey `id`, only if it belongs to `userId`. */\n async findOwned(\n id: string,\n userId: string,\n ): Promise<UsersPasskeyCredential | null> {\n const credential = await this.get(id);\n return credential && credential.userId === userId ? credential : null;\n }\n\n /**\n * Insert a new passkey. Returns null, writing nothing, when the credential\n * id is already registered. One `INSERT … ON CONFLICT DO NOTHING` against\n * the unique `credential_id` decides, so a concurrent duplicate loses too;\n * a constraint error is deliberately never the arbiter (a failed statement\n * on a shared connection can be reported to the wrong caller).\n *\n * Raw, because the base object slugs `name` — a person-chosen label that\n * may be empty after slugging (an emoji or non-Latin name) and collides\n * across people — whereas the id is the one slug that always exists and is\n * unique.\n */\n async insertIfAbsent(\n write: PasskeyCredentialWrite,\n ): Promise<UsersPasskeyCredential | null> {\n const id = randomUUID();\n const now = new Date().toISOString();\n const transports = knownPasskeyTransports(write.transports);\n const { rowCount } = await this.db.query(\n `INSERT INTO ${this.tableName} (\n id, slug, context, user_id, credential_id, public_key, sign_count,\n transports, name, aaguid, backed_up, device_type, last_used_at,\n created_by, created_at, updated_at\n ) VALUES (?, ?, '', ?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?, ?)\n ON CONFLICT (credential_id) DO NOTHING`,\n id,\n id,\n write.userId,\n write.credentialId,\n write.publicKey,\n write.signCount,\n transports.length > 0 ? JSON.stringify(transports) : null,\n write.name,\n write.aaguid,\n write.backedUp,\n write.deviceType,\n write.createdBy,\n now,\n now,\n );\n return rowCount > 0 ? this.get(id) : null;\n }\n\n /**\n * Record an accepted assertion: advance the counter and `last_used_at` only\n * if the row still exists with the counter that was verified against. One\n * guarded statement, so a passkey removed after the verification — or a\n * concurrent assertion that already advanced the counter — is detected and\n * the caller refuses. Returns false when nothing was updated.\n */\n async recordUseIfCurrent(\n id: string,\n userId: string,\n expectedSignCount: number,\n newSignCount: number,\n backedUp: boolean,\n now: Date = new Date(),\n ): Promise<boolean> {\n const { rowCount } = await this.db.query(\n `UPDATE ${this.tableName}\n SET sign_count = ?, backed_up = ?, last_used_at = ?, updated_at = ?\n WHERE id = ? AND user_id = ? AND sign_count = ?`,\n newSignCount,\n backedUp,\n now.toISOString(),\n now.toISOString(),\n id,\n userId,\n expectedSignCount,\n );\n return rowCount > 0;\n }\n\n /** Rename a passkey owned by `userId`. Returns false when it is not theirs. */\n async renameOwned(\n id: string,\n userId: string,\n name: string,\n ): Promise<boolean> {\n const { rowCount } = await this.db.query(\n `UPDATE ${this.tableName} SET name = ?, updated_at = ? WHERE id = ? AND user_id = ?`,\n name,\n new Date().toISOString(),\n id,\n userId,\n );\n return rowCount > 0;\n }\n\n /** Delete one passkey owned by `userId`. Returns false when it was already gone. */\n async deleteOwned(id: string, userId: string): Promise<boolean> {\n const { rowCount } = await this.db.query(\n `DELETE FROM ${this.tableName} WHERE id = ? AND user_id = ?`,\n id,\n userId,\n );\n return rowCount > 0;\n }\n\n /** Delete every passkey of one person. Returns how many were removed. */\n async deleteAllForUser(userId: string): Promise<number> {\n const before = await this.countByUserId(userId);\n if (before === 0) return 0;\n await this.db.query(\n `DELETE FROM ${this.tableName} WHERE user_id = ?`,\n userId,\n );\n return before - (await this.countByUserId(userId));\n }\n}\n","/**\n * Per-person PIN credential, usable only on an enrolled device (#3276).\n *\n * Deliberately its own object rather than a column on `User`, so the hash is\n * never selected by the many existing user reads and never serialized by\n * accident. One row per user.\n *\n * The hash is scrypt over `pepper || pin` with a per-row random salt. A PIN is\n * a 4–8 digit secret: without a server-side pepper a leaked table would be\n * brute-forced in seconds, and even with one the PIN is only accepted behind\n * a live device bearer session and the login limiter — see\n * {@link DeviceCredentialService}.\n *\n * @packageDocumentation\n */\n\nimport { field, foreignKey, SmrtObject, smrt } from '@happyvertical/smrt-core';\n\n@smrt({\n tableName: 'users_pin_credentials',\n // Credential material. Never in the change feed (#2937), never on an API.\n sensitive: true,\n api: false,\n cli: false,\n mcp: false,\n})\nexport class UsersPinCredential extends SmrtObject { static __smrtPackage__ = \"@happyvertical/smrt-users\";\n /** The person this PIN signs in. */\n @foreignKey('User', { required: true, unique: true })\n userId = '';\n\n /** Encoded hash: `scrypt$N$r$p$saltB64$hashB64`. */\n @field({ type: 'text', required: true, sensitive: true })\n pinHash = '';\n\n /** Bumped on every set/reset so audits and sessions can reference a generation. */\n @field({ type: 'integer', required: true, default: 1 })\n version = 1;\n\n /** Set by an administrative reset; the person must choose a new PIN on next use. */\n @field({ type: 'boolean', required: true, default: false })\n mustReset = false;\n\n /** When the current hash was written. */\n @field({ type: 'datetime', nullable: true })\n rotatedAt: Date | null = null;\n\n /** `self`, or the user id of the administrator who last set it. */\n @field({ type: 'text', nullable: true })\n rotatedBy: string | null = null;\n}\n","/**\n * Collection for {@link UsersPinCredential} (#3276).\n *\n * @packageDocumentation\n */\n\nimport { SmrtCollection } from '@happyvertical/smrt-core';\nimport { UsersPinCredential } from '../models/PinCredential.js';\n\nexport interface PinCredentialWrite {\n pinHash: string;\n mustReset: boolean;\n rotatedAt: Date;\n rotatedBy: string;\n}\n\nexport class UsersPinCredentialCollection extends SmrtCollection<UsersPinCredential> {\n static readonly _itemClass = UsersPinCredential;\n\n async findByUserId(userId: string): Promise<UsersPinCredential | null> {\n const [credential] = await this.list({ limit: 1, where: { userId } });\n return credential ?? null;\n }\n\n /**\n * Create or replace the one credential row for `userId`, bumping `version`\n * on replace. Save conflicts from a concurrent set are retried once by\n * re-reading; the last writer wins, which is the intended semantics for a\n * credential rotation.\n */\n async upsertForUser(\n userId: string,\n write: PinCredentialWrite,\n ): Promise<UsersPinCredential> {\n for (let attempt = 0; attempt < 2; attempt++) {\n const existing = await this.findByUserId(userId);\n if (!existing) {\n const created = await this.create({\n userId,\n pinHash: write.pinHash,\n mustReset: write.mustReset,\n rotatedAt: write.rotatedAt,\n rotatedBy: write.rotatedBy,\n version: 1,\n });\n try {\n await created.save();\n return created;\n } catch (error) {\n if (attempt === 0) continue; // lost a concurrent first insert; replace it\n throw error;\n }\n }\n existing.pinHash = write.pinHash;\n existing.mustReset = write.mustReset;\n existing.rotatedAt = write.rotatedAt;\n existing.rotatedBy = write.rotatedBy;\n existing.version = (existing.version ?? 0) + 1;\n try {\n await existing.save();\n return existing;\n } catch (error) {\n if (attempt === 0) continue;\n throw error;\n }\n }\n throw new Error('Unable to persist PIN credential.');\n }\n\n async deleteByUserId(userId: string): Promise<boolean> {\n const existing = await this.findByUserId(userId);\n if (!existing) return false;\n await existing.delete();\n return true;\n }\n}\n","/**\n * DeviceCredentialService — per-person sign-in on an enrolled device,\n * layered on the device's own bearer session (#3276).\n *\n * ## The problem\n *\n * A shared tablet is enrolled once through the terminal device-code grant and\n * holds a long-lived bearer session bound to a *device* account. Everything\n * done on it is attributed to that account. This service lets a person\n * present a short credential (a PIN today; a fob or badge later) **on that\n * device only**, and mints a short-lived session for the person that is\n * valid exactly as long as the device session is.\n *\n * ## The pipeline (shared by every credential kind)\n *\n * 1. Resolve the device bearer token to a live session and require that it\n * was established by device enrollment (`authMethod === 'terminal'` by\n * default) and is not itself a layered session.\n * 2. Ask the host whether this device is still enrolled and active\n * (`assertEnrolledDevice`) — smrt-users does not own a Device object.\n * 3. Reserve a login attempt: subject = whatever the verifier derives from\n * the input, source = the device account.\n * 4. Run the credential verifier. It must do equal work for a missing and a\n * present credential.\n * 5. Require the person to hold an active membership in the device session's\n * tenant — a device credential never widens tenant scope.\n * 6. Ask the host for the device's permission ceiling (`deviceCeiling`,\n * optional) and mint the person's session with `authMethod =\n * verifier.kind` and `parentSessionId = device session`, and return its\n * id. The client sends that id as its bearer from then on;\n * `SessionService.loadSessionContext` enforces parent liveness and exposes\n * `parent` for host gates.\n * 7. On a single-occupant device (the default), end every other person's\n * session on that device: signing in is how people hand the tablet over.\n *\n * ## Whose authority\n *\n * The device session authenticates the tablet; the person's session\n * authorizes the work. Its permissions are resolved from the *person's* own\n * membership in the device tenant (role plus per-membership overrides) on\n * every load — never the device account's — then intersected with the\n * ceiling snapshotted at sign-in, if the host supplied one. Both identities\n * are on the resolved context (`user` and `parent`).\n *\n * Anything that is not an enrolled-device bearer session — a browser cookie\n * session, a mobile session, a layered session — is refused before any\n * credential work, with the same error a wrong credential produces.\n *\n * ## Adding a credential kind\n *\n * Implement {@link DeviceCredentialVerifier} and pass it to\n * {@link DeviceCredentialService.signIn}. {@link PinVerifier} is the\n * reference implementation. A fob verifier differs mainly in that the\n * subject is unknown until the tag is read, which is why `subjectKey` lives\n * on the verifier.\n *\n * @packageDocumentation\n */\n\nimport { randomBytes } from 'node:crypto';\nimport { createLogger } from '@happyvertical/logger';\nimport type { SmrtClassOptions } from '@happyvertical/smrt-core';\nimport { withSystemContext } from '@happyvertical/smrt-tenancy';\nimport { MembershipCollection } from '../collections/MembershipCollection.js';\nimport { UsersPinCredentialCollection } from '../collections/PinCredentialCollection.js';\nimport { UserCollection } from '../collections/UserCollection.js';\nimport type { UsersPinCredential } from '../models/PinCredential.js';\nimport {\n SESSION_DATA_KEYS,\n type SessionAuthMethod,\n} from '../models/Session.js';\nimport { withoutListBounds } from './authorization-read-options.js';\nimport {\n hashSecret,\n type ScryptParams,\n verifySecretHash,\n} from './credential-hash.js';\nimport {\n InvalidCredentialsError,\n LoginAttemptLimiter,\n type LoginAttemptLimiterOptions,\n LoginRateLimitError,\n} from './LoginAttemptLimiter.js';\nimport {\n type PermissionDefinition,\n registerPermissionDefinitions,\n} from './PermissionCatalogService.js';\nimport { type SessionContext, SessionService } from './SessionService.js';\n\nconst logger = createLogger({ level: 'info' });\n\n/** Default idle timeout of a per-person device session (8 hours — a shift). */\nexport const DEFAULT_DEVICE_PERSON_IDLE_SECONDS = 8 * 60 * 60;\n/** Default permission required to set, reset, or clear another person's PIN. */\nexport const DEFAULT_PIN_MANAGE_PERMISSION = 'users.pin.manage';\n/** Login-limiter kind reported for PIN attempts. */\nexport const PIN_LOGIN_KIND = 'pin';\n\n/** Catalog definition for {@link DEFAULT_PIN_MANAGE_PERMISSION}. */\nexport const PIN_PERMISSION_DEFINITIONS: PermissionDefinition[] = [\n {\n slug: DEFAULT_PIN_MANAGE_PERMISSION,\n category: 'users',\n name: 'Manage device PINs',\n description: \"Set, reset, or clear another person's device PIN\",\n },\n];\n\nlet pinPermissionsRegistered = false;\n\n/** Register the PIN management permission once when the service is used. */\nexport function ensurePinPermissionsRegistered(): void {\n if (pinPermissionsRegistered) return;\n pinPermissionsRegistered = true;\n registerPermissionDefinitions(PIN_PERMISSION_DEFINITIONS);\n}\n\n/** Thrown when the caller is not an enrolled device, or the credential is wrong. */\nexport class DeviceCredentialError extends InvalidCredentialsError {\n constructor(message = 'Invalid credentials.') {\n super(message);\n this.name = 'DeviceCredentialError';\n }\n}\n\n/** Thrown by set/reset/clear when the actor may not manage the credential. */\nexport class DeviceCredentialForbiddenError extends Error {\n constructor(message = 'Not permitted to manage this credential.') {\n super(message);\n this.name = 'DeviceCredentialForbiddenError';\n }\n}\n\n/** Thrown by set/reset when the new secret fails policy. */\nexport class DeviceCredentialPolicyError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'DeviceCredentialPolicyError';\n }\n}\n\n/** Everything a verifier gets to see about the device the attempt came from. */\nexport interface DeviceSignInContext {\n /** The enrolled device's resolved bearer session. */\n device: SessionContext;\n}\n\n/**\n * One credential kind. Implementations must do equal work whether or not a\n * credential is enrolled for the subject (compare against a dummy hash).\n */\nexport interface DeviceCredentialVerifier<Input> {\n /** Becomes `authMethod` on the minted session and the limiter's audit kind. */\n readonly kind: SessionAuthMethod;\n /** The identifier the limiter keys the subject budget on. */\n subjectKey(input: Input): string;\n /**\n * Returns the authenticated user id, or null for any failure. `stillValid`,\n * when supplied, is called AFTER the session is minted: return false if the\n * credential that was verified has since been rotated or removed, and the\n * sign-in is undone. Checking after the mint is what closes the race with\n * a concurrent reset/clear — their revocation sweep runs after their write,\n * so either this check sees the write or that sweep sees the session.\n */\n verify(\n input: Input,\n context: DeviceSignInContext,\n ): Promise<DeviceCredentialVerification | null>;\n}\n\nexport interface DeviceCredentialVerification {\n userId: string;\n stillValid?: () => Promise<boolean>;\n}\n\nexport interface DeviceCredentialServiceOptions extends SmrtClassOptions {\n /**\n * Cookie name passed to the {@link SessionService}; should match the host's\n * session cookie so one service resolves cookies and bearers alike.\n */\n sessionCookieName?: string;\n /**\n * Sliding idle timeout of the person's session: it ends this long after\n * its last activity, independently of the device session's own (long)\n * life. Stored on the session, so it slides by this value whichever\n * `SessionService` resolves it. Defaults to\n * {@link DEFAULT_DEVICE_PERSON_IDLE_SECONDS}.\n */\n personIdleSeconds?: number;\n /**\n * Absolute lifetime of the person's session: once this long after sign-in\n * it ends whatever its activity. Default: no absolute cap (the device\n * session's life still bounds it).\n */\n personMaxSeconds?: number;\n /**\n * One person at a time. When true (the default) a successful sign-in ends\n * every other person's session on the same device session, so signing in\n * as the next person is the hand-over. Set false for devices several\n * people stay signed in on at once.\n */\n singleOccupant?: boolean;\n /**\n * Host hook: the most any person may do on this device, as permission\n * slugs. Called on each successful sign-in; a non-null result is\n * snapshotted into the person's session and intersected with their own\n * resolved permissions on every load (an empty array leaves none), and\n * such a session never receives super-admin bypass or system context.\n * Return null for no ceiling (the default). The snapshot is taken at\n * sign-in: a ceiling change applies from each person's next sign-in.\n * Throwing refuses the sign-in without counting a failed attempt.\n */\n deviceCeiling?: (device: SessionContext) => Promise<string[] | null>;\n /**\n * Auth methods that count as an enrolled device session. Defaults to\n * `['terminal']` — the device-code grant is how devices enrol.\n */\n deviceAuthMethods?: SessionAuthMethod[];\n /**\n * Host hook: return false (or throw) when the device session's account is\n * not an enrolled, active device. Either refuses the request; only an\n * explicit `false` is treated as un-enrolment by `loadPersonSession`,\n * which then revokes the person session — a throw (for example a registry\n * outage) refuses that one request without revoking anything. smrt-users guarantees only that the\n * bearer is a live, non-layered device-enrolled session; whether that\n * device is still active is the host's data. Required.\n */\n assertEnrolledDevice: (device: SessionContext) => Promise<boolean | void>;\n /**\n * Shared {@link LoginAttemptLimiter}. When omitted one is created from\n * `limiter` (or defaults). Supplying the host's instance keeps PIN,\n * password and terminal budgets in one table with one audit sink.\n */\n loginLimiter?: LoginAttemptLimiter;\n /** Options for the private limiter when `loginLimiter` is not supplied. */\n limiter?: Omit<LoginAttemptLimiterOptions, keyof SmrtClassOptions>;\n /** Permission slug an administrator needs to manage others' PINs. */\n managePermission?: string;\n /** PIN policy. */\n pin?: PinPolicyOptions;\n}\n\nexport interface PinPolicyOptions {\n /** Minimum digits. Default 4. */\n minLength?: number;\n /** Maximum digits. Default 8. */\n maxLength?: number;\n /**\n * Server-side secret mixed into every hash. Strongly recommended: a 4–8\n * digit secret is only as strong as the pepper once the table leaks.\n */\n pepper?: string;\n /** Reject repeated and sequential digits (`0000`, `1234`, `9876`). Default true. */\n rejectTrivial?: boolean;\n /** scrypt parameters. Defaults: N=2^15, r=8, p=1. */\n scrypt?: { N?: number; r?: number; p?: number };\n}\n\nexport interface DeviceSignInInput {\n /** The device's bearer token (`Authorization: Bearer …`). */\n deviceToken: string;\n ipAddress?: string;\n userAgent?: string;\n}\n\nexport interface DeviceSignInResult {\n /** The person's session id — the new bearer for person-attributed work. */\n sessionId: string;\n userId: string;\n tenantId: string | null;\n authMethod: SessionAuthMethod;\n /** When the session ends if it sees no further activity. */\n expiresAt: string;\n /** When the session ends regardless of activity; null without `personMaxSeconds`. */\n absoluteExpiresAt: string | null;\n /**\n * True when the person must choose a new PIN before continuing. Enforced\n * server-side: this session resolves to no permissions and can only call\n * `setPin`, which ends it; the person then signs in with the new PIN.\n */\n mustReset: boolean;\n}\n\nexport interface PinSignInInput extends DeviceSignInInput {\n userId: string;\n pin: string;\n}\n\nexport interface SetPinInput {\n /** Resolved session of whoever is making the change. */\n actor: SessionContext;\n userId: string;\n pin: string;\n /** Required when a person changes their own PIN from a PIN session. */\n currentPin?: string;\n ipAddress?: string;\n}\n\nexport interface ResetPinInput {\n actor: SessionContext;\n userId: string;\n pin: string;\n ipAddress?: string;\n}\n\nexport interface ClearPinInput {\n actor: SessionContext;\n userId: string;\n ipAddress?: string;\n}\n\n// ---------------------------------------------------------------------------\n// PIN hashing\n// ---------------------------------------------------------------------------\n\n/** Canonical id shape; anything else cannot name a credential row. */\nconst UUID_PATTERN =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;\n\nconst DEFAULT_SCRYPT: ScryptParams = { N: 2 ** 15, r: 8, p: 1 };\n\nconst hashPin = hashSecret;\nconst verifyPinHash = verifySecretHash;\n\nfunction isTrivialPin(pin: string): boolean {\n if (/^(\\d)\\1+$/u.test(pin)) return true;\n let ascending = true;\n let descending = true;\n for (let i = 1; i < pin.length; i++) {\n const diff = pin.charCodeAt(i) - pin.charCodeAt(i - 1);\n if (diff !== 1) ascending = false;\n if (diff !== -1) descending = false;\n }\n return ascending || descending;\n}\n\n// ---------------------------------------------------------------------------\n// PIN verifier\n// ---------------------------------------------------------------------------\n\n/**\n * Reference {@link DeviceCredentialVerifier}: `{ userId, pin }` against\n * {@link UsersPinCredential}. Always runs scrypt, against a precomputed dummy\n * hash when the user has no PIN, so timing does not reveal enrollment.\n */\nexport class PinVerifier implements DeviceCredentialVerifier<PinSignInInput> {\n readonly kind: SessionAuthMethod = PIN_LOGIN_KIND;\n\n constructor(\n private readonly credentials: UsersPinCredentialCollection,\n private readonly pepper: string,\n private readonly dummyHash: string,\n ) {}\n\n subjectKey(input: PinSignInInput): string {\n return input.userId;\n }\n\n async verify(\n input: PinSignInInput,\n ): Promise<DeviceCredentialVerification | null> {\n // A malformed id is just an unknown user: never let it reach a native\n // UUID predicate (PostgreSQL 22P02), which would answer differently and\n // skip the equal-work hash below.\n const credential = UUID_PATTERN.test(input.userId)\n ? await this.credentials.findByUserId(input.userId)\n : null;\n const encoded = credential?.pinHash || this.dummyHash;\n const ok = await verifyPinHash(input.pin, this.pepper, encoded);\n if (!ok || !credential) return null;\n const { userId, pinHash } = credential;\n return {\n userId,\n // The salted hash is unique per write, so it identifies the credential\n // generation across both rotation and delete-then-recreate.\n stillValid: async () =>\n (await this.credentials.findByUserId(userId))?.pinHash === pinHash,\n };\n }\n}\n\n// ---------------------------------------------------------------------------\n// Service\n// ---------------------------------------------------------------------------\n\nexport class DeviceCredentialService {\n private readonly options: DeviceCredentialServiceOptions;\n private readonly personIdleSeconds: number;\n private readonly personMaxSeconds: number | null;\n private readonly singleOccupant: boolean;\n private readonly deviceAuthMethods: Set<string>;\n private readonly managePermission: string;\n private readonly pinPolicy: Required<\n Omit<PinPolicyOptions, 'scrypt' | 'pepper'>\n > & {\n pepper: string;\n scrypt: ScryptParams;\n };\n private sessionService!: SessionService;\n /**\n * Resolves *other* sessions (the device bearer, an actor) without touching\n * their expiry: `sessionService` auto-extends with the person idle timeout,\n * which must never be applied to a device session with its own lifetime.\n */\n private readonlySessionService!: SessionService;\n private memberships!: MembershipCollection;\n private users!: UserCollection;\n private pinCredentials!: UsersPinCredentialCollection;\n private limiter!: LoginAttemptLimiter;\n private pinVerifier!: PinVerifier;\n\n constructor(options: DeviceCredentialServiceOptions) {\n if (typeof options.assertEnrolledDevice !== 'function') {\n throw new Error(\n 'DeviceCredentialService requires an assertEnrolledDevice hook.',\n );\n }\n this.options = options;\n ensurePinPermissionsRegistered();\n this.personIdleSeconds =\n options.personIdleSeconds ?? DEFAULT_DEVICE_PERSON_IDLE_SECONDS;\n this.personMaxSeconds = options.personMaxSeconds ?? null;\n for (const [name, value] of [\n ['personIdleSeconds', this.personIdleSeconds],\n ['personMaxSeconds', this.personMaxSeconds],\n ] as const) {\n if (value !== null && !(Number.isFinite(value) && value > 0)) {\n throw new Error(\n `DeviceCredentialService ${name} must be a positive number.`,\n );\n }\n }\n this.singleOccupant = options.singleOccupant ?? true;\n this.deviceAuthMethods = new Set(options.deviceAuthMethods ?? ['terminal']);\n this.managePermission =\n options.managePermission ?? DEFAULT_PIN_MANAGE_PERMISSION;\n this.pinPolicy = {\n minLength: options.pin?.minLength ?? 4,\n maxLength: options.pin?.maxLength ?? 8,\n rejectTrivial: options.pin?.rejectTrivial ?? true,\n pepper: options.pin?.pepper ?? '',\n scrypt: { ...DEFAULT_SCRYPT, ...options.pin?.scrypt },\n };\n }\n\n static async create(\n options: DeviceCredentialServiceOptions,\n ): Promise<DeviceCredentialService> {\n const service = new DeviceCredentialService(options);\n await service.initialize();\n return service;\n }\n\n async initialize(): Promise<void> {\n this.sessionService = await SessionService.create({\n ...this.options,\n autoExtend: true,\n cookieName: this.options.sessionCookieName,\n defaultTTL: this.personIdleSeconds,\n });\n this.readonlySessionService = await SessionService.create({\n ...this.options,\n autoExtend: false,\n cookieName: this.options.sessionCookieName,\n });\n // Unbounded: membership reads here back authorization decisions.\n this.memberships = await MembershipCollection.create(\n withoutListBounds(this.options),\n );\n this.users = await UserCollection.create(this.options);\n this.pinCredentials = await UsersPinCredentialCollection.create(\n this.options,\n );\n this.limiter =\n this.options.loginLimiter ??\n (await LoginAttemptLimiter.create({\n ...this.options,\n ...this.options.limiter,\n }));\n if (!this.pinPolicy.pepper) {\n logger.warn(\n 'DeviceCredentialService: no pin.pepper configured. PIN hashes are only as strong as scrypt over a 4-8 digit space if the table leaks; set a server-side pepper in production.',\n );\n }\n // The dummy hash is derived once per service so a missing credential\n // costs the same scrypt call as a present one.\n const dummy = await hashPin(\n randomBytes(8).toString('hex'),\n this.pinPolicy.pepper,\n this.pinPolicy.scrypt,\n );\n this.pinVerifier = new PinVerifier(\n this.pinCredentials,\n this.pinPolicy.pepper,\n dummy,\n );\n }\n\n /** The reference PIN verifier bound to this service's policy. */\n get pin(): PinVerifier {\n return this.pinVerifier;\n }\n\n /** The limiter in use (shared or private), for hosts that add verifiers. */\n get loginLimiter(): LoginAttemptLimiter {\n return this.limiter;\n }\n\n // -------------------------------------------------------------------------\n // Sign in\n // -------------------------------------------------------------------------\n\n /** PIN sign-in: {@link signIn} with the built-in {@link PinVerifier}. */\n async signInWithPin(input: PinSignInInput): Promise<DeviceSignInResult> {\n return this.signIn(this.pinVerifier, input);\n }\n\n /**\n * Generic sign-in pipeline. See the module docs for the sequence. Throws\n * {@link DeviceCredentialError} for every refusal that is not a rate limit\n * (not a device, inactive device, unknown user, wrong credential, no\n * membership) and {@link LoginRateLimitError} when the budget is exhausted.\n */\n async signIn<Input extends DeviceSignInInput>(\n verifier: DeviceCredentialVerifier<Input>,\n input: Input,\n ): Promise<DeviceSignInResult> {\n const { device } = await this.resolveEnrolledDevice(input.deviceToken);\n if (!device) throw new DeviceCredentialError();\n\n const lease = await this.limiter.reserve({\n kind: String(verifier.kind),\n subject: verifier.subjectKey(input),\n source: device.user.id ?? undefined,\n // No session ids or user ids in audit metadata: the session id is a\n // bearer credential and the subject/source hashes already identify\n // the attempt for correlation.\n metadata: { tenantId: device.tenantId ?? null },\n });\n if (!lease.allowed) throw new LoginRateLimitError(lease);\n\n let verified: DeviceCredentialVerification | null = null;\n let credentialFailed = false;\n let mintedSessionId: string | null = null;\n try {\n verified = await verifier.verify(input, { device });\n if (!verified) {\n credentialFailed = true;\n throw new DeviceCredentialError();\n }\n\n const person = await this.users.get(verified.userId);\n if (!person?.isActive()) {\n credentialFailed = true;\n throw new DeviceCredentialError();\n }\n\n // Never widen tenant scope: the person must belong to the device's\n // tenant. A device with no tenant context mints no tenant context.\n const tenantId = device.tenantId;\n if (tenantId) {\n const membership = await this.memberships.findByUserAndTenant(\n verified.userId,\n tenantId,\n );\n if (!membership?.isActive()) {\n credentialFailed = true;\n throw new DeviceCredentialError();\n }\n }\n\n let mustReset = false;\n if (verifier.kind === PIN_LOGIN_KIND) {\n const credential = await this.pinCredentials.findByUserId(\n verified.userId,\n );\n mustReset = credential?.mustReset ?? false;\n }\n // A temporary PIN from an administrative reset authenticates the person\n // only far enough to choose a new one: the session carries an empty\n // ceiling (no permissions, no bypass) and `setPin` ends it, so the flag\n // cannot be ignored by the client.\n const permissionCeiling = mustReset\n ? []\n : await this.resolveDeviceCeiling(device);\n const now = Date.now();\n const absoluteExpiresAt =\n this.personMaxSeconds === null\n ? null\n : new Date(now + this.personMaxSeconds * 1000).toISOString();\n\n const sessionId = await this.sessionService.createSession(\n verified.userId,\n tenantId ?? undefined,\n {\n ttl: this.personIdleSeconds,\n ipAddress: input.ipAddress,\n userAgent: input.userAgent,\n authMethod: verifier.kind,\n parentSessionId: device.sessionId,\n data: {\n deviceUserId: device.user.id,\n [SESSION_DATA_KEYS.idleSeconds]: this.personIdleSeconds,\n ...(absoluteExpiresAt && {\n [SESSION_DATA_KEYS.absoluteExpiresAt]: absoluteExpiresAt,\n }),\n ...(permissionCeiling && {\n [SESSION_DATA_KEYS.permissionCeiling]: permissionCeiling,\n }),\n },\n },\n );\n mintedSessionId = sessionId;\n\n // Bind the session to the credential generation that was verified: a\n // reset or clear that completed while this sign-in was in flight must\n // not leave a fresh session behind its revocation sweep.\n if (verified.stillValid && !(await verified.stillValid())) {\n // The presented credential is no longer the person's: a credential\n // failure like any other, so the reservation is kept.\n credentialFailed = true;\n throw new DeviceCredentialError();\n }\n\n // Hand-over: the device now belongs to this person alone. Done after\n // the mint so a failed sign-in never signs the previous person out.\n if (this.singleOccupant) {\n await this.sessionService.destroyChildSessions(device.sessionId, {\n exceptSessionId: sessionId,\n });\n // Two overlapping sign-ins can each sweep the other. Never hand\n // back a session a concurrent hand-over already ended.\n if (\n !(await this.readonlySessionService.getParentSessionId(sessionId))\n ) {\n throw new DeviceCredentialError();\n }\n }\n\n await lease.succeed();\n return {\n sessionId,\n userId: verified.userId,\n tenantId: tenantId ?? null,\n authMethod: verifier.kind,\n expiresAt: new Date(\n Math.min(\n now + this.personIdleSeconds * 1000,\n absoluteExpiresAt ? Date.parse(absoluteExpiresAt) : Infinity,\n ),\n ).toISOString(),\n absoluteExpiresAt,\n mustReset,\n };\n } catch (error) {\n if (credentialFailed) await lease.fail().catch(() => undefined);\n else await lease.release().catch(() => undefined);\n // Never leave a session behind for a sign-in that reported failure.\n if (mintedSessionId) {\n await this.sessionService\n .destroySession(mintedSessionId)\n .catch(() => undefined);\n }\n throw error;\n }\n }\n\n /**\n * Sign the person out. Ends only the person's layered session; the device\n * session is untouched. Returns false for anything that is not a live\n * layered session (never reveals which).\n */\n async signOut(personToken: string): Promise<boolean> {\n const token = personToken?.trim();\n if (!token) return false;\n // Decide without recording activity: `sessionService` auto-extends with\n // the person idle timeout, and a device (or browser) bearer presented\n // here must not have its own expiry rewritten.\n if (!(await this.readonlySessionService.getParentSessionId(token))) {\n return false;\n }\n return this.sessionService.destroySession(token);\n }\n\n /**\n * Resolve a person's bearer. Returns null unless it is a live layered\n * session whose parent is still an enrolled device — the host's\n * `assertEnrolledDevice` is consulted on every call, and a person session\n * on a device that fails it is revoked. Hosts that resolve person bearers\n * through their own `SessionService` instead must revoke the device's\n * bearer session when they un-enrol it.\n */\n async loadPersonSession(personToken: string): Promise<SessionContext | null> {\n const token = personToken?.trim();\n if (!token) return null;\n // Vet the device BEFORE the child is accepted or its idle expiry\n // extended: un-enrolling a device in the host's registry ends the people\n // on it even if the host never revoked the device bearer.\n const parentSessionId =\n await this.readonlySessionService.getParentSessionId(token);\n if (!parentSessionId) return null;\n const enrolled = await this.resolveEnrolledDevice(parentSessionId);\n if (!enrolled.device) {\n // Revoke only when the host said this device is un-enrolled. A hook\n // that threw (a registry outage, say) refuses this request and leaves\n // the session to be judged again on the next one; and a parent that\n // is simply not this service's kind of device session is not this\n // service's to revoke.\n if (enrolled.unenrolled) {\n await this.sessionService.destroySession(token).catch(() => false);\n }\n return null;\n }\n const context = await this.sessionService.loadSessionContext(token);\n if (!context?.parent) return null;\n return context;\n }\n\n /**\n * Resolve any bearer or cookie session id to its context without applying\n * this service's person TTL to it — for handlers that need the acting\n * session (`setPin` and friends) when the host's hook has not already\n * resolved it into `locals`. A person (layered) session goes through\n * {@link loadPersonSession}: the device's enrollment is re-checked, and\n * resolving it is activity, so it slides by its own idle timeout.\n */\n async resolveActor(sessionToken: string): Promise<SessionContext | null> {\n const token = sessionToken?.trim();\n if (!token) return null;\n // A person session is accepted only through the same enrolled-device\n // gate as everywhere else, so a tablet the host has un-enrolled cannot\n // keep acting (or keep its person sessions alive) through PIN management.\n if (await this.readonlySessionService.getParentSessionId(token)) {\n return this.loadPersonSession(token);\n }\n return this.readonlySessionService.loadSessionContext(token);\n }\n\n // -------------------------------------------------------------------------\n // PIN management\n // -------------------------------------------------------------------------\n\n /**\n * A person sets or changes their own PIN, or an administrator sets one for\n * them. A person acting from a PIN session must supply their current PIN\n * (checked through the limiter, so it cannot be used as an oracle); a\n * person acting from any first-class session (browser, mobile) may set it\n * outright, and so may an administrator holding `managePermission`.\n */\n async setPin(input: SetPinInput): Promise<void> {\n this.assertPinPolicy(input.pin);\n const self = input.actor.user.id === input.userId;\n if (!self) await this.assertCanManage(input.actor, input.userId);\n\n let endResetSessions = false;\n // Any layered session — PIN or another device credential kind — sits on\n // a possibly unattended device, so it must prove the current PIN.\n if (\n self &&\n (input.actor.authMethod === PIN_LOGIN_KIND || input.actor.parent)\n ) {\n const existing = await this.pinCredentials.findByUserId(input.userId);\n if (existing) {\n if (!input.currentPin) throw new DeviceCredentialForbiddenError();\n const lease = await this.limiter.reserve({\n kind: PIN_LOGIN_KIND,\n subject: input.userId,\n source: input.actor.parent?.userId ?? input.ipAddress,\n metadata: { purpose: 'change-pin' },\n });\n if (!lease.allowed) throw new LoginRateLimitError(lease);\n const ok = await verifyPinHash(\n input.currentPin,\n this.pinPolicy.pepper,\n existing.pinHash,\n );\n if (!ok) {\n await lease.fail().catch(() => undefined);\n throw new DeviceCredentialError();\n }\n await lease.succeed().catch(() => undefined);\n endResetSessions = existing.mustReset;\n }\n }\n\n await this.writePin(input.userId, input.pin, {\n mustReset: false,\n rotatedBy: self ? 'self' : (input.actor.user.id ?? 'admin'),\n });\n // A rotated PIN ends the sessions minted under the old one — the reason\n // to rotate may be that it leaked. A person changing their own PIN keeps\n // the session they are changing it from, unless it is the restricted\n // reset session: that one has done its one job, and the person signs in\n // again with the new PIN to get a session carrying their authority.\n await this.sessionService.destroyUserSessionsByAuthMethod(\n input.userId,\n PIN_LOGIN_KIND,\n {\n exceptSessionId:\n self && !endResetSessions ? input.actor.sessionId : undefined,\n },\n );\n await this.limiter.recordManagement({\n kind: PIN_LOGIN_KIND,\n subject: input.userId,\n source: input.ipAddress,\n // The subject is stored hashed; for a self-service change the actor IS\n // the subject, so its raw id stays out of the metadata.\n metadata: {\n action: 'set',\n self,\n ...(self ? {} : { actorId: input.actor.user.id }),\n },\n });\n }\n\n /**\n * Administrative reset: writes a temporary PIN the person must change on\n * next use, and revokes every live PIN session the person holds.\n */\n async resetPin(input: ResetPinInput): Promise<{ revokedSessions: number }> {\n await this.assertCanManage(input.actor, input.userId);\n this.assertPinPolicy(input.pin);\n await this.writePin(input.userId, input.pin, {\n mustReset: true,\n rotatedBy: input.actor.user.id ?? 'admin',\n });\n const revokedSessions =\n await this.sessionService.destroyUserSessionsByAuthMethod(\n input.userId,\n PIN_LOGIN_KIND,\n );\n await this.limiter.recordManagement({\n kind: PIN_LOGIN_KIND,\n subject: input.userId,\n source: input.ipAddress,\n metadata: {\n action: 'reset',\n actorId: input.actor.user.id,\n revokedSessions,\n },\n });\n return { revokedSessions };\n }\n\n /** Remove a person's PIN entirely and revoke their live PIN sessions. */\n async clearPin(input: ClearPinInput): Promise<{ revokedSessions: number }> {\n const self = input.actor.user.id === input.userId;\n if (\n !self ||\n input.actor.authMethod === PIN_LOGIN_KIND ||\n input.actor.parent\n ) {\n await this.assertCanManage(input.actor, input.userId);\n }\n await this.pinCredentials.deleteByUserId(input.userId);\n const revokedSessions =\n await this.sessionService.destroyUserSessionsByAuthMethod(\n input.userId,\n PIN_LOGIN_KIND,\n );\n await this.limiter.recordManagement({\n kind: PIN_LOGIN_KIND,\n subject: input.userId,\n source: input.ipAddress,\n metadata: {\n action: 'clear',\n self,\n ...(self ? {} : { actorId: input.actor.user.id }),\n revokedSessions,\n },\n });\n return { revokedSessions };\n }\n\n /** Whether the person has a PIN enrolled (for admin UIs; never for login responses). */\n async hasPin(userId: string): Promise<boolean> {\n return (await this.pinCredentials.findByUserId(userId)) !== null;\n }\n\n // -------------------------------------------------------------------------\n // Internals\n // -------------------------------------------------------------------------\n\n private async resolveEnrolledDevice(deviceToken: string): Promise<{\n device: SessionContext | null;\n /** The host hook answered `false`: a definite un-enrolment. */\n unenrolled?: boolean;\n }> {\n const refused = { device: null };\n const token = deviceToken?.trim();\n if (!token) return refused;\n // Never through `sessionService`: that one auto-extends with the person\n // TTL and would rewrite the device session's own expiry on every attempt.\n const device = await this.readonlySessionService.loadSessionContext(token);\n if (!device) return refused;\n // Only a first-class, device-enrolled session may carry a person: a\n // browser cookie, a mobile session, or another person's layered session\n // is not a device.\n if (device.parent) return refused;\n if (!this.deviceAuthMethods.has(String(device.authMethod ?? ''))) {\n return refused;\n }\n try {\n const ok = await this.options.assertEnrolledDevice(device);\n if (ok === false) return { device: null, unenrolled: true };\n } catch {\n return refused;\n }\n return { device };\n }\n\n private async resolveDeviceCeiling(\n device: SessionContext,\n ): Promise<string[] | null> {\n if (!this.options.deviceCeiling) return null;\n const ceiling = await this.options.deviceCeiling(device);\n if (ceiling === null || ceiling === undefined) return null;\n if (\n !Array.isArray(ceiling) ||\n ceiling.some((slug) => typeof slug !== 'string')\n ) {\n // Fail closed: a malformed policy must not read as \"no ceiling\".\n throw new Error(\n 'DeviceCredentialService deviceCeiling must resolve to an array of permission slugs or null.',\n );\n }\n return [...new Set(ceiling)];\n }\n\n private async assertCanManage(\n actor: SessionContext,\n targetUserId: string,\n ): Promise<void> {\n // A PIN session can never administer PINs, whatever permissions the\n // person holds: a stolen unlocked tablet must not be able to rotate\n // other people's credentials.\n if (actor.authMethod === PIN_LOGIN_KIND || actor.parent) {\n throw new DeviceCredentialForbiddenError();\n }\n if (!actor.permissions.includes(this.managePermission)) {\n throw new DeviceCredentialForbiddenError();\n }\n // `permissions` were resolved for the actor's tenant, so they confer\n // authority only over that tenant's people. The PIN (and the session\n // sweep a rotation triggers) is one per person across every tenant, so\n // the target must be an active member of the actor's tenant AND of no\n // other: otherwise a tenant-A admin could set a PIN and use it on a\n // tenant-B device, or sign the person out there. People who belong to\n // several tenants manage their own PIN. Unknown, malformed and foreign\n // targets are refused alike.\n // Read outside any ambient tenant filter, like the permission resolver:\n // a host that registers Membership tenant-scoped would otherwise narrow\n // this to the actor's tenant and hide exactly the rows being checked.\n // Keyed by the explicit target id; only a yes/no leaves this method.\n const active =\n actor.tenantId && UUID_PATTERN.test(targetUserId)\n ? (\n await withSystemContext(() =>\n this.memberships.findByUser(targetUserId),\n )\n ).filter((membership) => membership.isActive())\n : [];\n if (\n active.length === 0 ||\n active.some((membership) => membership.tenantId !== actor.tenantId)\n ) {\n throw new DeviceCredentialForbiddenError();\n }\n }\n\n private assertPinPolicy(pin: string): void {\n if (typeof pin !== 'string' || !/^\\d+$/u.test(pin)) {\n throw new DeviceCredentialPolicyError('PIN must contain only digits.');\n }\n if (\n pin.length < this.pinPolicy.minLength ||\n pin.length > this.pinPolicy.maxLength\n ) {\n throw new DeviceCredentialPolicyError(\n `PIN must be ${this.pinPolicy.minLength}–${this.pinPolicy.maxLength} digits.`,\n );\n }\n if (this.pinPolicy.rejectTrivial && isTrivialPin(pin)) {\n throw new DeviceCredentialPolicyError(\n 'PIN must not be a repeated or sequential run of digits.',\n );\n }\n }\n\n private async writePin(\n userId: string,\n pin: string,\n meta: { mustReset: boolean; rotatedBy: string },\n ): Promise<UsersPinCredential> {\n const user = await this.users.get(userId);\n if (!user) throw new DeviceCredentialForbiddenError('Unknown user.');\n const pinHash = await hashPin(\n pin,\n this.pinPolicy.pepper,\n this.pinPolicy.scrypt,\n );\n return this.pinCredentials.upsertForUser(userId, {\n pinHash,\n mustReset: meta.mustReset,\n rotatedAt: new Date(),\n rotatedBy: meta.rotatedBy,\n });\n }\n}\n","const encoder = new TextEncoder(), decoder = new TextDecoder(), strictDecoder = new TextDecoder(\"utf-8\", { fatal: !0 }), MAX_INT32 = 2 ** 32;\nfunction concat(...buffers) {\n const size = buffers.reduce((acc, { length }) => acc + length, 0), buf = new Uint8Array(size);\n let i = 0;\n for (const buffer of buffers)\n buf.set(buffer, i), i += buffer.length;\n return buf;\n}\nfunction writeUInt32BE(buf, value, offset) {\n if (value < 0 || value >= MAX_INT32)\n throw new RangeError(`value must be >= 0 and <= ${MAX_INT32 - 1}. Received ${value}`);\n buf.set([value >>> 24, value >>> 16, value >>> 8, value & 255], offset);\n}\nfunction uint64be(value) {\n const high = Math.floor(value / MAX_INT32), low = value % MAX_INT32, buf = new Uint8Array(8);\n return writeUInt32BE(buf, high, 0), writeUInt32BE(buf, low, 4), buf;\n}\nfunction uint32be(value) {\n const buf = new Uint8Array(4);\n return writeUInt32BE(buf, value), buf;\n}\nconst NON_ASCII = /[^\\x00-\\x7f]/;\nfunction encode(string) {\n if (typeof string == \"string\" && string.length >= 128) {\n if (NON_ASCII.test(string))\n throw new TypeError(\"non-ASCII string encountered in encode()\");\n return encoder.encode(string);\n }\n const bytes = new Uint8Array(string.length);\n for (let i = 0; i < string.length; i++) {\n const code = string.charCodeAt(i);\n if (code > 127)\n throw new TypeError(\"non-ASCII string encountered in encode()\");\n bytes[i] = code;\n }\n return bytes;\n}\nfunction encodeBase64(input, url = !1) {\n if (Uint8Array.prototype.toBase64)\n return input.toBase64({ alphabet: url ? \"base64url\" : \"base64\", omitPadding: url });\n const CHUNK_SIZE = 32768, arr = [];\n for (let i = 0; i < input.length; i += CHUNK_SIZE)\n arr.push(String.fromCharCode.apply(null, input.subarray(i, i + CHUNK_SIZE)));\n const encoded = btoa(arr.join(\"\"));\n return url ? encoded.replace(/=/g, \"\").replace(/\\+/g, \"-\").replace(/\\//g, \"_\") : encoded;\n}\nfunction decodeBase64(encoded, url = !1) {\n if (Uint8Array.fromBase64)\n return Uint8Array.fromBase64(encoded, { alphabet: url ? \"base64url\" : \"base64\" });\n if (url) {\n if (encoded.includes(\"+\") || encoded.includes(\"/\"))\n throw new TypeError(\"Invalid base64url\");\n encoded = encoded.replace(/-/g, \"+\").replace(/_/g, \"/\");\n }\n const binary = atob(encoded), bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++)\n bytes[i] = binary.charCodeAt(i);\n return bytes;\n}\nasync function digest(algorithm, data) {\n const subtleDigest = `SHA-${algorithm.slice(-3)}`;\n return new Uint8Array(await crypto.subtle.digest(subtleDigest, data));\n}\nexport {\n concat,\n decodeBase64,\n decoder,\n digest,\n encode,\n encodeBase64,\n encoder,\n strictDecoder,\n uint32be,\n uint64be\n};\n","class JOSEError extends Error {\n static code = \"ERR_JOSE_GENERIC\";\n code = \"ERR_JOSE_GENERIC\";\n constructor(message, options) {\n super(message, options), this.name = this.constructor.name, Error.captureStackTrace?.(this, this.constructor);\n }\n}\nclass JWTClaimValidationFailed extends JOSEError {\n static code = \"ERR_JWT_CLAIM_VALIDATION_FAILED\";\n code = \"ERR_JWT_CLAIM_VALIDATION_FAILED\";\n claim;\n reason;\n payload;\n constructor(message, payload, claim = \"unspecified\", reason = \"unspecified\") {\n super(message, { cause: { claim, reason, payload } }), this.claim = claim, this.reason = reason, this.payload = payload;\n }\n}\nclass JWTExpired extends JOSEError {\n static code = \"ERR_JWT_EXPIRED\";\n code = \"ERR_JWT_EXPIRED\";\n claim;\n reason;\n payload;\n constructor(message, payload, claim = \"unspecified\", reason = \"unspecified\") {\n super(message, { cause: { claim, reason, payload } }), this.claim = claim, this.reason = reason, this.payload = payload;\n }\n}\nclass JOSEAlgNotAllowed extends JOSEError {\n static code = \"ERR_JOSE_ALG_NOT_ALLOWED\";\n code = \"ERR_JOSE_ALG_NOT_ALLOWED\";\n}\nclass JOSENotSupported extends JOSEError {\n static code = \"ERR_JOSE_NOT_SUPPORTED\";\n code = \"ERR_JOSE_NOT_SUPPORTED\";\n}\nclass JWEDecryptionFailed extends JOSEError {\n static code = \"ERR_JWE_DECRYPTION_FAILED\";\n code = \"ERR_JWE_DECRYPTION_FAILED\";\n constructor(message = \"decryption operation failed\", options) {\n super(message, options);\n }\n}\nclass JWEInvalid extends JOSEError {\n static code = \"ERR_JWE_INVALID\";\n code = \"ERR_JWE_INVALID\";\n}\nclass JWSInvalid extends JOSEError {\n static code = \"ERR_JWS_INVALID\";\n code = \"ERR_JWS_INVALID\";\n}\nclass JWTInvalid extends JOSEError {\n static code = \"ERR_JWT_INVALID\";\n code = \"ERR_JWT_INVALID\";\n}\nclass JWKInvalid extends JOSEError {\n static code = \"ERR_JWK_INVALID\";\n code = \"ERR_JWK_INVALID\";\n}\nclass JWKSInvalid extends JOSEError {\n static code = \"ERR_JWKS_INVALID\";\n code = \"ERR_JWKS_INVALID\";\n}\nclass JWKSNoMatchingKey extends JOSEError {\n static code = \"ERR_JWKS_NO_MATCHING_KEY\";\n code = \"ERR_JWKS_NO_MATCHING_KEY\";\n constructor(message = \"no applicable key found in the JSON Web Key Set\", options) {\n super(message, options);\n }\n}\nclass JWKSMultipleMatchingKeys extends JOSEError {\n [Symbol.asyncIterator] = async function* () {\n };\n static code = \"ERR_JWKS_MULTIPLE_MATCHING_KEYS\";\n code = \"ERR_JWKS_MULTIPLE_MATCHING_KEYS\";\n constructor(message = \"multiple matching keys found in the JSON Web Key Set\", options) {\n super(message, options);\n }\n}\nclass JWKSTimeout extends JOSEError {\n static code = \"ERR_JWKS_TIMEOUT\";\n code = \"ERR_JWKS_TIMEOUT\";\n constructor(message = \"request timed out\", options) {\n super(message, options);\n }\n}\nclass JWSSignatureVerificationFailed extends JOSEError {\n static code = \"ERR_JWS_SIGNATURE_VERIFICATION_FAILED\";\n code = \"ERR_JWS_SIGNATURE_VERIFICATION_FAILED\";\n constructor(message = \"signature verification failed\", options) {\n super(message, options);\n }\n}\nexport {\n JOSEAlgNotAllowed,\n JOSEError,\n JOSENotSupported,\n JWEDecryptionFailed,\n JWEInvalid,\n JWKInvalid,\n JWKSInvalid,\n JWKSMultipleMatchingKeys,\n JWKSNoMatchingKey,\n JWKSTimeout,\n JWSInvalid,\n JWSSignatureVerificationFailed,\n JWTClaimValidationFailed,\n JWTExpired,\n JWTInvalid\n};\n","import { encoder, decoder, encodeBase64, decodeBase64 } from \"../lib/buffer_utils.js\";\nconst invalid = \"The input to be decoded is not correctly encoded.\";\nfunction decode(input) {\n try {\n return decodeBase64(typeof input == \"string\" ? input : decoder.decode(input), !0);\n } catch (cause) {\n throw new TypeError(invalid, { cause });\n }\n}\nfunction encode(input) {\n return encodeBase64(typeof input == \"string\" ? encoder.encode(input) : input, !0);\n}\nexport {\n decode,\n encode\n};\n","import { JOSENotSupported, JWSInvalid } from \"../util/errors.js\";\nimport { decode } from \"../util/base64url.js\";\nimport { encode, strictDecoder } from \"./buffer_utils.js\";\nfunction assertUint8Array(input, label) {\n if (!(input instanceof Uint8Array))\n throw new TypeError(`${label} must be an instance of Uint8Array`);\n}\nfunction isObject(input) {\n if (typeof input != \"object\" || input === null || Object.prototype.toString.call(input) !== \"[object Object]\")\n return !1;\n const prototype = Object.getPrototypeOf(input);\n return prototype === null || Object.getPrototypeOf(prototype) === null;\n}\nfunction isJwkSet(input) {\n return isObject(input) && Array.isArray(input.keys) && Array.from(input.keys).every(isObject);\n}\nfunction isDisjoint(...headers) {\n const parameters = /* @__PURE__ */ new Set();\n for (const header of headers)\n if (header)\n for (const parameter of Object.keys(header)) {\n if (parameters.has(parameter))\n return !1;\n parameters.add(parameter);\n }\n return !0;\n}\nfunction assertNotSet(value, name) {\n if (value !== void 0)\n throw new TypeError(`${name} can only be called once`);\n}\nfunction decodeBase64url(value, label, ErrorClass) {\n try {\n return decode(value);\n } catch {\n throw new ErrorClass(`Failed to base64url decode the ${label}`);\n }\n}\nfunction encodeBase64url(value, label, ErrorClass) {\n try {\n return encode(value);\n } catch {\n throw new ErrorClass(`The ${label} is not a valid base64url string`);\n }\n}\nfunction parseJoseHeader(b64, ErrorClass, message) {\n let parsed;\n try {\n parsed = JSON.parse(strictDecoder.decode(decode(b64)));\n } catch {\n throw new ErrorClass(message);\n }\n if (!isObject(parsed))\n throw new ErrorClass(message);\n return parsed;\n}\nconst JWS_RECOGNIZED = { __proto__: null, b64: !0 }, JWE_RECOGNIZED = { __proto__: null };\nfunction validateAlgorithms(option, algorithms) {\n if (algorithms !== void 0 && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s != \"string\")))\n throw new TypeError(`\"${option}\" option must be an array of strings`);\n return algorithms === void 0 ? void 0 : new Set(algorithms);\n}\nfunction validateCritDuplicates(Err, protectedHeader) {\n const { crit } = protectedHeader ?? {};\n if (Array.isArray(crit) && new Set(crit).size !== crit.length)\n throw new Err('\"crit\" (Critical) Header Parameter MUST NOT contain duplicate values');\n}\nfunction validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {\n if (joseHeader.crit !== void 0 && protectedHeader?.crit === void 0)\n throw new Err('\"crit\" (Critical) Header Parameter MUST be integrity protected');\n if (!protectedHeader || protectedHeader.crit === void 0)\n return [];\n if (!Array.isArray(protectedHeader.crit) || protectedHeader.crit.length === 0 || protectedHeader.crit.some((input) => typeof input != \"string\" || input.length === 0))\n throw new Err('\"crit\" (Critical) Header Parameter MUST be an array of non-empty strings when present');\n const recognized = recognizedOption === void 0 ? recognizedDefault : { __proto__: null, ...recognizedOption, ...recognizedDefault };\n for (const parameter of protectedHeader.crit) {\n if (!(parameter in recognized))\n throw new JOSENotSupported(`Extension Header Parameter \"${parameter}\" is not recognized`);\n if (!Object.hasOwn(joseHeader, parameter) || joseHeader[parameter] === void 0)\n throw new Err(`Extension Header Parameter \"${parameter}\" is missing`);\n if (recognized[parameter] && (!Object.hasOwn(protectedHeader, parameter) || protectedHeader[parameter] === void 0))\n throw new Err(`Extension Header Parameter \"${parameter}\" MUST be integrity protected`);\n }\n return protectedHeader.crit;\n}\nfunction validateB64(protectedHeader, extensions) {\n if (extensions.includes(\"b64\")) {\n const b64 = protectedHeader.b64;\n if (typeof b64 != \"boolean\")\n throw new JWSInvalid('The \"b64\" (base64url-encode payload) Header Parameter must be a boolean');\n return b64;\n }\n return !0;\n}\nfunction serializeJoseHeader(Err, header) {\n let serialized, parsed;\n try {\n serialized = JSON.stringify(header), parsed = JSON.parse(serialized);\n } catch (cause) {\n throw new Err(\"JOSE Header is not valid JSON\", { cause });\n }\n if (!isObject(parsed))\n throw new Err(\"JOSE Header is not a JSON object\");\n return [parsed, serialized];\n}\nexport {\n JWE_RECOGNIZED,\n JWS_RECOGNIZED,\n assertNotSet,\n assertUint8Array,\n decodeBase64url,\n encodeBase64url,\n isDisjoint,\n isJwkSet,\n isObject,\n parseJoseHeader,\n serializeJoseHeader,\n validateAlgorithms,\n validateB64,\n validateCrit,\n validateCritDuplicates\n};\n","import { isObject } from \"./validate.js\";\nimport { decode } from \"../util/base64url.js\";\nimport { JOSENotSupported } from \"../util/errors.js\";\nconst tag = (key) => key[Symbol.toStringTag], jwkMatchesOp = (entry, key, usage) => {\n const { alg } = entry;\n if (key.use !== void 0) {\n const expected = usage === \"sign\" || usage === \"verify\" ? \"sig\" : \"enc\";\n if (key.use !== expected)\n throw new TypeError(`Invalid key for this operation, its \"use\" must be \"${expected}\" when present`);\n }\n if (key.alg !== void 0 && key.alg !== alg)\n throw new TypeError(`Invalid key for this operation, its \"alg\" must be \"${alg}\" when present`);\n if (Array.isArray(key.key_ops)) {\n const expectedKeyOp = usage === \"encrypt\" || usage === \"decrypt\" ? entry.ops?.[usage === \"encrypt\" ? 0 : 1] : usage;\n if (expectedKeyOp && !key.key_ops.includes(expectedKeyOp))\n throw new TypeError(`Invalid key for this operation, its \"key_ops\" must include \"${expectedKeyOp}\" when present`);\n }\n};\nasync function prepareKey(entry, key, usage) {\n const { alg, secret } = entry, privateKey = usage === \"decrypt\" || usage === \"sign\";\n if (secret && key instanceof Uint8Array)\n return key;\n let normalized, keyObject;\n if (isObject(key)) {\n if (normalized = normalizeJwk(key), typeof normalized.kty != \"string\")\n throw invalidKeyType(alg, key, secret);\n if (!(secret ? normalized.kty === \"oct\" && typeof normalized.k == \"string\" : normalized.kty !== \"oct\" && (privateKey ? normalized.kty === \"AKP\" && typeof normalized.priv == \"string\" || typeof normalized.d == \"string\" : normalized.d === void 0 && normalized.priv === void 0)))\n throw new TypeError(secret ? 'JSON Web Key for symmetric algorithms must have JWK \"kty\" (Key Type) equal to \"oct\" and the JWK \"k\" (Key Value) present' : `JSON Web Key for this operation must be a ${privateKey ? \"private\" : \"public\"} JWK`);\n if (jwkMatchesOp(entry, normalized, usage), normalized.kty === \"oct\")\n return decode(normalized.k);\n if (!Object.isFrozen(key)) {\n const { key_ops } = key;\n Array.isArray(key_ops) && Object.freeze(key_ops), Object.freeze(key);\n }\n } else {\n if (!isKeyLike(key))\n throw invalidKeyType(alg, key, secret);\n const expectedType = secret ? \"secret\" : privateKey ? \"private\" : \"public\";\n if (key.type !== expectedType && (secret || [\"secret\", \"public\", \"private\"].includes(key.type)))\n throw new TypeError(`${tag(key)} instances must be of type \"${expectedType}\" for the ${alg} algorithm`);\n if (isCryptoKey(key))\n return key;\n if (keyObject = key, keyObject.type === \"secret\")\n return keyObject.export();\n }\n cache ||= /* @__PURE__ */ new WeakMap();\n const cacheKey = key;\n let cached = cache.get(cacheKey);\n if (cached?.[alg])\n return cached[alg];\n if (cached || cache.set(cacheKey, cached = {}), keyObject && typeof keyObject.toCryptoKey == \"function\") {\n const isPublic = keyObject.type === \"public\", crv = nist[keyObject.asymmetricKeyDetails?.namedCurve], params = entry.resolve?.({ crv, asymmetricKeyType: keyObject.asymmetricKeyType }) ?? entry.subtle;\n return cached[alg] = keyObject.toCryptoKey(params, isPublic, entry.usages[isPublic ? 0 : 1]);\n }\n return normalized ??= keyObject.export({ format: \"jwk\" }), normalized.alg = alg, cached[alg] = await jwkToKey(entry, normalized);\n}\nlet cache;\nconst nist = {\n __proto__: null,\n prime256v1: \"P-256\",\n secp384r1: \"P-384\",\n secp521r1: \"P-521\"\n};\nfunction assertCryptoKey(key) {\n if (!isCryptoKey(key))\n throw new Error(\"CryptoKey instance expected\");\n}\nconst isCryptoKey = (key) => {\n if (key?.[Symbol.toStringTag] === \"CryptoKey\")\n return !0;\n try {\n return key instanceof CryptoKey;\n } catch {\n return !1;\n }\n}, isKeyObject = (key) => key?.[Symbol.toStringTag] === \"KeyObject\", isKeyLike = (key) => isCryptoKey(key) || isKeyObject(key);\nfunction message(msg, actual, ...types) {\n if (types.length > 2) {\n const last = types.pop();\n msg += `one of type ${types.join(\", \")}, or ${last}.`;\n } else types.length === 2 ? msg += `one of type ${types[0]} or ${types[1]}.` : msg += `of type ${types[0]}.`;\n return actual == null ? msg += ` Received ${actual}` : typeof actual == \"function\" && actual.name ? msg += ` Received function ${actual.name}` : typeof actual == \"object\" && actual != null && actual.constructor?.name && (msg += ` Received an instance of ${actual.constructor.name}`), msg;\n}\nconst invalidKeyInput = (actual, ...types) => message(\"Key must be \", actual, ...types);\nfunction invalidKeyType(alg, actual, secret) {\n const types = [\"CryptoKey\", \"KeyObject\", \"JSON Web Key\"];\n return secret && types.push(\"Uint8Array\"), new TypeError(message(`Key for the ${alg} algorithm must be `, actual, ...types));\n}\nconst unusable = (name, prop = \"algorithm.name\") => new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);\nfunction checkUsage(key, usage) {\n if (usage && !key.usages.includes(usage))\n throw new TypeError(`CryptoKey does not support this operation, its usages must include ${usage}.`);\n}\nfunction checkModulusLength(alg, key) {\n const { modulusLength } = key.algorithm;\n if (typeof modulusLength != \"number\" || modulusLength < 2048)\n throw new TypeError(`${alg} requires key modulusLength to be 2048 bits or larger`);\n}\nfunction checkCryptoKey(key, expected, usage) {\n const algorithm = key.algorithm;\n if (algorithm.name !== expected.name)\n throw unusable(expected.name);\n if (expected.hash && algorithm.hash?.name !== expected.hash)\n throw unusable(expected.hash, \"algorithm.hash\");\n if (expected.namedCurve && algorithm.namedCurve !== expected.namedCurve)\n throw unusable(expected.namedCurve, \"algorithm.namedCurve\");\n if (expected.length !== void 0 && algorithm.length !== expected.length)\n throw unusable(expected.length, \"algorithm.length\");\n checkUsage(key, usage);\n}\nfunction snapshotJwk(jwk) {\n return { __proto__: null, ...jwk };\n}\nfunction normalizeJwk(jwk) {\n const normalized = snapshotJwk(jwk);\n if (normalized.ext !== void 0 && typeof normalized.ext != \"boolean\")\n throw new TypeError('\"ext\" (Extractable) Parameter must be a boolean');\n if (normalized.key_ops !== void 0) {\n const value = normalized.key_ops, keyOps = Array.isArray(value) ? [...value] : void 0;\n if (!keyOps || keyOps.some((operation) => typeof operation != \"string\") || new Set(keyOps).size !== keyOps.length)\n throw new TypeError('\"key_ops\" (Key Operations) Parameter must be an array of unique strings');\n normalized.key_ops = keyOps;\n }\n return normalized;\n}\nfunction validateExtractableOption(extractable) {\n if (extractable !== void 0 && typeof extractable != \"boolean\")\n throw new TypeError('\"extractable\" option must be a boolean');\n return extractable;\n}\nasync function jwkToKey(entry, jwk, extractable) {\n if (!entry.kty.includes(jwk.kty))\n throw new JOSENotSupported('Invalid or unsupported JWK \"alg\" (Algorithm) Parameter value');\n const algorithm = entry.resolve?.({ kty: jwk.kty, crv: jwk.crv }) ?? entry.subtle, isPrivate = !!(jwk.d || jwk.priv), keyData = { ...jwk, ext: extractable ?? jwk.ext };\n return keyData.kty !== \"AKP\" && delete keyData.alg, delete keyData.use, crypto.subtle.importKey(\"jwk\", keyData, algorithm, keyData.ext ?? !isPrivate, jwk.key_ops ?? entry.usages[isPrivate ? 1 : 0]);\n}\nasync function rawKey(key, expected, usage, extractable = !1) {\n return key instanceof Uint8Array && (key = await crypto.subtle.importKey(\"raw\", key, expected, extractable, [usage])), checkCryptoKey(key, expected, usage), key;\n}\nexport {\n assertCryptoKey,\n checkCryptoKey,\n checkModulusLength,\n checkUsage,\n invalidKeyInput,\n isCryptoKey,\n isKeyLike,\n isKeyObject,\n jwkToKey,\n normalizeJwk,\n prepareKey,\n rawKey,\n snapshotJwk,\n validateExtractableOption\n};\n","function table(entries) {\n const out = { __proto__: null };\n for (const alg in entries)\n out[alg] = { ...entries[alg], alg };\n return out;\n}\nexport {\n table\n};\n","import { JOSENotSupported } from \"../util/errors.js\";\nimport { table } from \"./key_descriptor.js\";\nconst sig = [[\"verify\"], [\"sign\"]];\nfunction hmac(bits) {\n const subtle = { name: \"HMAC\", hash: `SHA-${bits}` };\n return { kty: [\"oct\"], secret: !0, subtle, signing: subtle, usages: sig };\n}\nfunction rsa(bits, saltLength) {\n const subtle = { name: saltLength ? \"RSA-PSS\" : \"RSASSA-PKCS1-v1_5\", hash: `SHA-${bits}` };\n return {\n kty: [\"RSA\"],\n subtle,\n signing: saltLength ? { ...subtle, saltLength } : subtle,\n usages: sig,\n minRsaBits: 2048\n };\n}\nfunction ecdsa(crv, bits) {\n return {\n kty: [\"EC\"],\n crv,\n subtle: { name: \"ECDSA\", namedCurve: crv },\n signing: { name: \"ECDSA\", hash: `SHA-${bits}` },\n usages: sig\n };\n}\nfunction eddsa() {\n const subtle = { name: \"Ed25519\" };\n return {\n kty: [\"OKP\"],\n crv: \"Ed25519\",\n subtle,\n signing: subtle,\n usages: sig\n };\n}\nfunction mldsa(bits) {\n const subtle = { name: `ML-DSA-${bits}` };\n return {\n kty: [\"AKP\"],\n subtle,\n signing: subtle,\n usages: sig\n };\n}\nconst JWS = table({\n HS256: hmac(256),\n HS384: hmac(384),\n HS512: hmac(512),\n RS256: rsa(256),\n RS384: rsa(384),\n RS512: rsa(512),\n PS256: rsa(256, 32),\n PS384: rsa(384, 48),\n PS512: rsa(512, 64),\n ES256: ecdsa(\"P-256\", 256),\n ES384: ecdsa(\"P-384\", 384),\n ES512: ecdsa(\"P-521\", 512),\n EdDSA: eddsa(),\n Ed25519: eddsa(),\n \"ML-DSA-44\": mldsa(44),\n \"ML-DSA-65\": mldsa(65),\n \"ML-DSA-87\": mldsa(87)\n});\nfunction jwsAlgorithm(alg) {\n const entry = typeof alg == \"string\" ? JWS[alg] : void 0;\n if (!entry)\n throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);\n return entry;\n}\nexport {\n JWS,\n jwsAlgorithm\n};\n","import { jwsAlgorithm } from \"./jws_algorithms.js\";\nimport { JOSEAlgNotAllowed, JWSInvalid, JWSSignatureVerificationFailed } from \"../util/errors.js\";\nimport { concat, decoder, encoder, encode } from \"./buffer_utils.js\";\nimport { decodeBase64url, encodeBase64url, parseJoseHeader, isDisjoint, isObject, validateB64, validateCrit, validateAlgorithms, JWS_RECOGNIZED } from \"./validate.js\";\nimport { prepareKey, rawKey, checkModulusLength } from \"./key.js\";\nfunction snapshotJws(jws, sharedPayload) {\n const encodedProtected = jws.protected, inputHeader = jws.header, header = isObject(inputHeader) ? { ...inputHeader } : inputHeader;\n let payload = sharedPayload ? sharedPayload[0] : jws.payload;\n !sharedPayload && payload instanceof Uint8Array && (payload = new Uint8Array(payload));\n const signature = jws.signature, snapshot = { payload, signature };\n if (encodedProtected !== void 0 && (snapshot.protected = encodedProtected), inputHeader !== void 0 && (snapshot.header = header), encodedProtected === void 0 && header === void 0)\n throw new JWSInvalid('Flattened JWS must have either of the \"protected\" or \"header\" members');\n if (encodedProtected !== void 0 && typeof encodedProtected != \"string\")\n throw new JWSInvalid(\"JWS Protected Header incorrect type\");\n if (payload === void 0)\n throw new JWSInvalid(\"JWS Payload missing\");\n if (typeof signature != \"string\")\n throw new JWSInvalid(\"JWS Signature missing or incorrect type\");\n if (header !== void 0 && !isObject(header))\n throw new JWSInvalid(\"JWS Unprotected Header incorrect type\");\n return snapshot;\n}\nfunction prepareVerify(options) {\n return [options && validateAlgorithms(\"algorithms\", options.algorithms), options?.crit];\n}\nfunction parseProtectedHeader(encodedProtected) {\n return encodedProtected === void 0 ? {} : parseJoseHeader(encodedProtected, JWSInvalid, \"JWS Protected Header is invalid\");\n}\nfunction encodeJsonUnencodedPayload(payload) {\n const invalid = /[\\p{Cs}\\p{Cn}]/u.exec(payload)?.[0];\n if (invalid !== void 0)\n throw new JWSInvalid(/\\p{Cs}/u.test(invalid) ? \"JWS Payload must be a well-formed Unicode string\" : \"JWS Payload must not contain unassigned Unicode code points\");\n return encoder.encode(payload);\n}\nfunction encodeCompactUnencodedPayload(payload) {\n try {\n return encode(payload);\n } catch {\n throw new JWSInvalid(\"JWS Compact Serialization payload must use only ASCII characters\");\n }\n}\nasync function verifySignature(jws, shared, key, encodeUnencodedPayload, parsedProtected) {\n const { protected: encodedProtected, header, payload: inputPayload } = jws, parsedProt = parsedProtected ?? parseProtectedHeader(encodedProtected);\n if (!isDisjoint(parsedProt, header))\n throw new JWSInvalid(\"JWS Protected and JWS Unprotected Header Parameter names must be disjoint\");\n const joseHeader = { ...parsedProt, ...header }, b64 = validateB64(parsedProt, validateCrit(JWSInvalid, JWS_RECOGNIZED, shared[1], parsedProt, joseHeader)), { alg } = joseHeader;\n if (typeof alg != \"string\" || !alg)\n throw new JWSInvalid('JWS \"alg\" (Algorithm) Header Parameter missing or invalid');\n if (shared[0] && !shared[0].has(alg))\n throw new JOSEAlgNotAllowed('\"alg\" (Algorithm) Header Parameter value not allowed');\n if (b64) {\n if (typeof inputPayload != \"string\")\n throw new JWSInvalid(\"JWS Payload must be a string\");\n } else if (typeof inputPayload != \"string\" && !(inputPayload instanceof Uint8Array))\n throw new JWSInvalid(\"JWS Payload must be a string or an Uint8Array instance\");\n const signingPayload = b64 || typeof inputPayload != \"string\" ? inputPayload : encodeUnencodedPayload(inputPayload);\n let resolvedKey = !1;\n typeof key == \"function\" && (key = await key(parsedProt, jws), resolvedKey = !0);\n const entry = jwsAlgorithm(alg), data = concat(encodedProtected !== void 0 ? encode(encodedProtected) : new Uint8Array(), encode(\".\"), typeof signingPayload == \"string\" ? shared[2] ??= encodeBase64url(signingPayload, \"payload\", JWSInvalid) : signingPayload), signature = decodeBase64url(jws.signature, \"signature\", JWSInvalid), k = await prepareKey(entry, key, \"verify\"), cryptoKey = await rawKey(k, entry.subtle, \"verify\");\n entry.minRsaBits && checkModulusLength(entry.alg, cryptoKey);\n let verified = !1;\n try {\n verified = await crypto.subtle.verify(entry.signing, cryptoKey, signature, data);\n } catch {\n }\n if (!verified)\n throw new JWSSignatureVerificationFailed();\n const result = { payload: typeof signingPayload == \"string\" ? decodeBase64url(signingPayload, \"payload\", JWSInvalid) : signingPayload };\n return encodedProtected !== void 0 && (result.protectedHeader = parsedProt), header !== void 0 && (result.unprotectedHeader = header), resolvedKey ? [{ ...result, key: k }, b64] : [result, b64];\n}\nasync function verifyCompact(jws, shared, key) {\n if (jws instanceof Uint8Array && (jws = decoder.decode(jws)), typeof jws != \"string\")\n throw new JWSInvalid(\"Compact JWS must be a string or Uint8Array\");\n const { 0: protectedHeader, 1: payload, 2: signature, length } = jws.split(\".\");\n if (length !== 3)\n throw new JWSInvalid(\"Invalid Compact JWS\");\n return verifySignature({ payload, protected: protectedHeader, signature }, shared, key, encodeCompactUnencodedPayload);\n}\nexport {\n encodeJsonUnencodedPayload,\n parseProtectedHeader,\n prepareVerify,\n snapshotJws,\n verifyCompact,\n verifySignature\n};\n","import { JWTClaimValidationFailed, JWTExpired, JWTInvalid } from \"../util/errors.js\";\nimport { encoder, strictDecoder } from \"./buffer_utils.js\";\nimport { isObject } from \"./validate.js\";\nconst epoch = (date) => Math.floor(date.getTime() / 1e3), multipliers = {\n s: 1,\n m: 60,\n h: 3600,\n d: 86400,\n w: 604800,\n y: 31557600\n}, REGEX = /^(\\+|\\-)? ?(\\d+|\\d+\\.\\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, checkFailed = \"check_failed\";\nfunction invalidDuration() {\n throw new TypeError(\"Invalid time period format\");\n}\nfunction secs(str) {\n typeof str != \"string\" && invalidDuration();\n const matched = REGEX.exec(str);\n (!matched || matched[4] && matched[1]) && invalidDuration();\n const value = parseFloat(matched[2]), numericDate2 = Math.round(value * multipliers[matched[3][0].toLowerCase()]);\n return Number.isFinite(numericDate2) || invalidDuration(), matched[1] === \"-\" || matched[4] === \"ago\" ? -numericDate2 : numericDate2;\n}\nfunction validateInput(label, input) {\n if (!Number.isFinite(input))\n throw new TypeError(`Invalid ${label} input`);\n return input;\n}\nfunction validateStringClaim(claim, value) {\n if (typeof value != \"string\")\n throw new TypeError(`\"${claim}\" claim must be a string`);\n}\nfunction validateAudienceClaim(value) {\n if (typeof value != \"string\" && (!Array.isArray(value) || Array.from(value).some((member) => typeof member != \"string\")))\n throw new TypeError('\"aud\" claim must be a string or an array of strings');\n}\nfunction numericDate(value, label) {\n return typeof value == \"number\" ? validateInput(label, value) : value instanceof Date ? validateInput(label, epoch(value)) : epoch(/* @__PURE__ */ new Date()) + secs(value);\n}\nconst normalizeTyp = (value) => {\n const normalized = value.toLowerCase();\n return value.includes(\"/\") ? normalized : `application/${normalized}`;\n}, checkAudiencePresence = (audPayload, audOption) => typeof audPayload == \"string\" ? audOption.includes(audPayload) : Array.isArray(audPayload) ? audOption.some((aud) => audPayload.includes(aud)) : !1;\nfunction validateNumericDate(payload, claim, required = !1) {\n const value = payload[claim];\n if (!(value === void 0 && !required)) {\n if (typeof value != \"number\")\n throw new JWTClaimValidationFailed(`\"${claim}\" claim must be a number`, payload, claim, \"invalid\");\n return value;\n }\n}\nfunction unexpectedClaim(payload, claim) {\n throw new JWTClaimValidationFailed(`unexpected \"${claim}\" claim value`, payload, claim, checkFailed);\n}\nfunction validateClaimsSet(protectedHeader, encodedPayload, options = {}) {\n let payload;\n try {\n payload = JSON.parse(strictDecoder.decode(encodedPayload));\n } catch {\n }\n if (!isObject(payload))\n throw new JWTInvalid(\"JWT Claims Set must be a top-level JSON object\");\n const { typ } = options;\n if (typ !== void 0 && (typeof protectedHeader.typ != \"string\" || normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ)))\n throw new JWTClaimValidationFailed('unexpected \"typ\" JWT header value', payload, \"typ\", checkFailed);\n const { requiredClaims = [], issuer, subject, audience, maxTokenAge } = options, presenceCheck = [...requiredClaims];\n maxTokenAge !== void 0 && presenceCheck.push(\"iat\"), audience !== void 0 && presenceCheck.push(\"aud\"), subject !== void 0 && presenceCheck.push(\"sub\"), issuer !== void 0 && presenceCheck.push(\"iss\");\n for (const claim of new Set(presenceCheck.reverse()))\n if (!Object.hasOwn(payload, claim))\n throw new JWTClaimValidationFailed(`missing required \"${claim}\" claim`, payload, claim, \"missing\");\n issuer !== void 0 && !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss) && unexpectedClaim(payload, \"iss\"), subject !== void 0 && payload.sub !== subject && unexpectedClaim(payload, \"sub\"), audience !== void 0 && !checkAudiencePresence(payload.aud, typeof audience == \"string\" ? [audience] : audience) && unexpectedClaim(payload, \"aud\");\n const { clockTolerance } = options;\n let tolerance = 0;\n if (typeof clockTolerance == \"string\")\n tolerance = secs(clockTolerance);\n else if (clockTolerance !== void 0) {\n if (typeof clockTolerance != \"number\")\n throw new TypeError(\"Invalid clockTolerance option type\");\n tolerance = clockTolerance;\n }\n validateInput(\"clockTolerance option\", tolerance);\n const { currentDate } = options, now = validateInput(\"currentDate option\", epoch(currentDate === void 0 ? /* @__PURE__ */ new Date() : currentDate)), iat = validateNumericDate(payload, \"iat\", maxTokenAge !== void 0), nbf = validateNumericDate(payload, \"nbf\");\n if (nbf !== void 0 && nbf > now + tolerance)\n throw new JWTClaimValidationFailed('\"nbf\" claim timestamp check failed', payload, \"nbf\", checkFailed);\n const exp = validateNumericDate(payload, \"exp\");\n if (exp !== void 0 && exp <= now - tolerance)\n throw new JWTExpired('\"exp\" claim timestamp check failed', payload, \"exp\", checkFailed);\n if (maxTokenAge !== void 0) {\n const age = now - iat, max = validateInput(\"maxTokenAge option\", typeof maxTokenAge == \"number\" ? maxTokenAge : secs(maxTokenAge));\n if (age - tolerance > max)\n throw new JWTExpired('\"iat\" claim timestamp check failed (too far in the past)', payload, \"iat\", checkFailed);\n if (age < -tolerance)\n throw new JWTClaimValidationFailed('\"iat\" claim timestamp check failed (it should be in the past)', payload, \"iat\", checkFailed);\n }\n return payload;\n}\nlet producerPayloads;\nfunction producerPayload(producer) {\n return producerPayloads.get(producer);\n}\nfunction jwtData(producer) {\n const payload = producerPayload(producer);\n for (const claim of [\"iat\", \"nbf\", \"exp\"]) {\n const value = payload[claim];\n if (typeof value == \"number\" && !Number.isFinite(value))\n throw new TypeError(`\"${claim}\" claim must be a finite number`);\n }\n return encoder.encode(JSON.stringify(payload));\n}\nfunction jwtClaim(producer, claim) {\n return producerPayload(producer)[claim];\n}\nclass JWTClaimsBuilder {\n constructor(payload = {}) {\n if (!isObject(payload))\n throw new TypeError(\"JWT Claims Set MUST be an object\");\n (producerPayloads ||= /* @__PURE__ */ new WeakMap()).set(this, structuredClone(payload));\n }\n setIssuer(value) {\n return validateStringClaim(\"iss\", value), producerPayload(this).iss = value, this;\n }\n setSubject(value) {\n return validateStringClaim(\"sub\", value), producerPayload(this).sub = value, this;\n }\n setAudience(value) {\n return validateAudienceClaim(value), producerPayload(this).aud = value, this;\n }\n setJti(value) {\n return validateStringClaim(\"jti\", value), producerPayload(this).jti = value, this;\n }\n setNotBefore(value) {\n return producerPayload(this).nbf = numericDate(value, \"setNotBefore\"), this;\n }\n setExpirationTime(value) {\n return producerPayload(this).exp = numericDate(value, \"setExpirationTime\"), this;\n }\n setIssuedAt(value) {\n const payload = producerPayload(this);\n return value === void 0 ? payload.iat = epoch(/* @__PURE__ */ new Date()) : typeof value == \"string\" ? payload.iat = validateInput(\"setIssuedAt\", epoch(/* @__PURE__ */ new Date()) + secs(value)) : payload.iat = numericDate(value, \"setIssuedAt\"), this;\n }\n}\nexport {\n JWTClaimsBuilder,\n jwtClaim,\n jwtData,\n secs,\n validateClaimsSet\n};\n","import { prepareVerify, verifyCompact } from \"../lib/jws_verify.js\";\nimport { validateClaimsSet } from \"../lib/jwt_claims_set.js\";\nimport { JWTInvalid } from \"../util/errors.js\";\nasync function jwtVerify(jwt, key, options) {\n const [verified, b64] = await verifyCompact(jwt, prepareVerify(options), key);\n if (!b64)\n throw new JWTInvalid(\"JWTs MUST NOT use unencoded payload\");\n const payload = validateClaimsSet(verified.protectedHeader, verified.payload, options);\n return { ...verified, payload };\n}\nexport {\n jwtVerify\n};\n","import { encode as b64u } from \"../util/base64url.js\";\nimport { jwsAlgorithm } from \"./jws_algorithms.js\";\nimport { isDisjoint, serializeJoseHeader, validateB64, validateCrit, validateCritDuplicates, JWS_RECOGNIZED } from \"./validate.js\";\nimport { JWSInvalid } from \"../util/errors.js\";\nimport { concat, encode, encoder } from \"./buffer_utils.js\";\nimport { prepareKey, rawKey, checkModulusLength } from \"./key.js\";\nasync function createSignature(input, key, rejectUnencoded) {\n let [payload, protectedHeader, unprotectedHeader, crit] = input, protectedHeaderString = \"\";\n if (protectedHeader !== void 0) {\n const normalized = serializeJoseHeader(JWSInvalid, protectedHeader);\n protectedHeader = normalized[0], protectedHeaderString = b64u(normalized[1]);\n }\n if (unprotectedHeader !== void 0 && (unprotectedHeader = serializeJoseHeader(JWSInvalid, unprotectedHeader)[0]), !protectedHeader && !unprotectedHeader)\n throw new JWSInvalid(\"either setProtectedHeader or setUnprotectedHeader must be called before #sign()\");\n if (!isDisjoint(protectedHeader, unprotectedHeader))\n throw new JWSInvalid(\"JWS Protected and JWS Unprotected Header Parameter names must be disjoint\");\n const joseHeader = { ...protectedHeader, ...unprotectedHeader };\n validateCritDuplicates(JWSInvalid, protectedHeader);\n const b64 = validateB64(protectedHeader, validateCrit(JWSInvalid, JWS_RECOGNIZED, crit, protectedHeader, joseHeader));\n b64 || rejectUnencoded?.();\n const { alg } = joseHeader;\n if (typeof alg != \"string\" || !alg)\n throw new JWSInvalid('JWS \"alg\" (Algorithm) Header Parameter missing or invalid');\n const entry = jwsAlgorithm(alg);\n let payloadS = \"\", payloadB = payload, data;\n if (b64) {\n const encoded = input[4];\n encoded ? (payloadS = encoded[0] ??= b64u(payload), payloadB = encoded[1] ??= encode(payloadS)) : (payloadS = b64u(payload), data = encoder.encode(`${protectedHeaderString}.${payloadS}`));\n }\n data ??= concat(encode(protectedHeaderString), encode(\".\"), payloadB);\n const k = await rawKey(await prepareKey(entry, key, \"sign\"), entry.subtle, \"sign\");\n entry.minRsaBits && checkModulusLength(entry.alg, k);\n const jws = {\n signature: b64u(new Uint8Array(await crypto.subtle.sign(entry.signing, k, data))),\n payload: payloadS\n };\n return protectedHeader && (jws.protected = protectedHeaderString), unprotectedHeader && (jws.header = unprotectedHeader), [jws, b64];\n}\nasync function createCompactSignature(payload, protectedHeader, crit, key, rejectUnencoded) {\n const [jws] = await createSignature([payload, protectedHeader, void 0, crit], key, rejectUnencoded);\n return `${jws.protected}.${jws.payload}.${jws.signature}`;\n}\nexport {\n createCompactSignature,\n createSignature\n};\n","import { createCompactSignature } from \"../lib/jws_sign.js\";\nimport { JWTInvalid } from \"../util/errors.js\";\nimport { JWTClaimsBuilder, jwtData } from \"../lib/jwt_claims_set.js\";\nimport { assertNotSet } from \"../lib/validate.js\";\nconst SignJWT_base = JWTClaimsBuilder;\nclass SignJWT extends SignJWT_base {\n #protectedHeader;\n setProtectedHeader(protectedHeader) {\n return assertNotSet(this.#protectedHeader, \"setProtectedHeader\"), this.#protectedHeader = protectedHeader, this;\n }\n async sign(key, options) {\n return createCompactSignature(jwtData(this), this.#protectedHeader, options?.crit, key, () => {\n throw new JWTInvalid(\"JWTs MUST NOT use unencoded payload\");\n });\n }\n}\nexport {\n SignJWT\n};\n","import { jwkToKey, snapshotJwk } from \"../lib/key.js\";\nimport { JWS } from \"../lib/jws_algorithms.js\";\nimport { JWKSInvalid, JOSENotSupported, JWKSNoMatchingKey, JWKSMultipleMatchingKeys } from \"../util/errors.js\";\nimport { isJwkSet } from \"../lib/validate.js\";\nfunction isUsableJWK(jwk, entry, alg, kid) {\n const { kty, key_ops: keyOps, ext, kid: jwkKid, alg: jwkAlg, use, crv } = jwk;\n return (ext === void 0 || typeof ext == \"boolean\") && (keyOps === void 0 || Array.isArray(keyOps) && keyOps.every((operation, index) => typeof operation == \"string\" && keyOps.indexOf(operation) === index) && keyOps.includes(\"verify\")) && entry.kty.includes(kty) && (kid === void 0 || typeof kid == \"string\" && kid === jwkKid) && (jwkAlg === void 0 ? kty !== \"AKP\" : alg === jwkAlg) && (use === void 0 || use === \"sig\") && (!entry.crv || crv === entry.crv);\n}\nasync function importWithAlgCache(cache, jwk, entry) {\n const cached = cache.get(jwk) || cache.set(jwk, {}).get(jwk), { alg } = entry;\n if (cached[alg] === void 0) {\n const pending = jwkToKey(entry, jwk, !0).then((key) => {\n if (key.type !== \"public\")\n throw new JWKSInvalid(\"JSON Web Key Set members must be public keys\");\n return cached[alg] = key, key;\n }).catch((error) => {\n throw cached[alg] === pending && delete cached[alg], error;\n });\n cached[alg] = pending;\n }\n return cached[alg];\n}\nfunction createLocalJWKSet(jwks) {\n let snapshot;\n try {\n snapshot = structuredClone(jwks);\n } catch {\n }\n if (!isJwkSet(snapshot))\n throw new JWKSInvalid(\"JSON Web Key Set malformed\");\n const metadata = snapshot.keys.map((jwk) => {\n const normalized = snapshotJwk(jwk);\n return Array.isArray(normalized.key_ops) && (normalized.key_ops = [...normalized.key_ops]), normalized;\n }), cached = /* @__PURE__ */ new WeakMap();\n return Object.defineProperty(async (protectedHeader, token) => {\n const { alg, kid } = { ...protectedHeader, ...token?.header }, entry = typeof alg == \"string\" ? JWS[alg] : void 0;\n if (!entry || entry.secret)\n throw new JOSENotSupported('Unsupported \"alg\" value for a JSON Web Key Set');\n const candidates = snapshot.keys.filter((_, index) => isUsableJWK(metadata[index], entry, alg, kid)), { 0: jwk, length } = candidates;\n if (!length)\n throw new JWKSNoMatchingKey();\n if (length !== 1) {\n const error = new JWKSMultipleMatchingKeys();\n throw error[Symbol.asyncIterator] = async function* () {\n for (const jwk2 of candidates)\n try {\n yield await importWithAlgCache(cached, jwk2, entry);\n } catch {\n }\n }, error;\n }\n return importWithAlgCache(cached, jwk, entry);\n }, \"jwks\", {\n value: () => structuredClone(snapshot)\n });\n}\nexport {\n createLocalJWKSet\n};\n","import { JOSEError, JWKSNoMatchingKey, JWKSTimeout } from \"../util/errors.js\";\nimport { createLocalJWKSet } from \"./local.js\";\nimport { isJwkSet } from \"../lib/validate.js\";\nfunction isCloudflareWorkers() {\n return typeof WebSocketPair < \"u\" || typeof navigator < \"u\" && navigator.userAgent === \"Cloudflare-Workers\" || typeof EdgeRuntime < \"u\" && EdgeRuntime === \"vercel\";\n}\nlet USER_AGENT;\n(typeof navigator > \"u\" || !navigator.userAgent?.startsWith?.(\"Mozilla/5.0 \")) && (USER_AGENT = \"jose/v6.2.12\");\nconst customFetch = /* @__PURE__ */ Symbol();\nasync function fetchJwks(url, headers, signal, fetchImpl = fetch) {\n const response = await fetchImpl(url, {\n method: \"GET\",\n signal,\n redirect: \"manual\",\n headers\n }).catch((err) => {\n throw err.name === \"TimeoutError\" ? new JWKSTimeout() : err;\n });\n if (response.status !== 200)\n throw new JOSEError(\"Expected 200 OK from the JSON Web Key Set HTTP response\");\n try {\n return await response.json();\n } catch {\n throw new JOSEError(\"Failed to parse the JSON Web Key Set HTTP response as JSON\");\n }\n}\nconst jwksCache = /* @__PURE__ */ Symbol();\nfunction isFreshFor(timestamp, duration) {\n return Number.isFinite(timestamp) && Date.now() < timestamp + duration;\n}\nfunction validateDuration(value, fallback, option) {\n if (Number.isNaN(value))\n throw new TypeError(`\"${option}\" option must not be NaN`);\n return typeof value == \"number\" ? value : fallback;\n}\nfunction createRemoteJWKSet(url, options) {\n if (!(url instanceof URL))\n throw new TypeError(\"url must be an instance of URL\");\n const href = new URL(url.href).href, opts = options ?? {}, timeoutOption = opts.timeoutDuration;\n if (typeof timeoutOption == \"number\" && (!Number.isInteger(timeoutOption) || timeoutOption < 0))\n throw new TypeError('\"timeoutDuration\" option must be a non-negative integer');\n const timeoutDuration = typeof timeoutOption == \"number\" ? timeoutOption : 5e3, cooldownDuration = validateDuration(opts.cooldownDuration, 3e4, \"cooldownDuration\"), cacheMaxAge = validateDuration(opts.cacheMaxAge, 6e5, \"cacheMaxAge\"), headers = new Headers(opts.headers);\n USER_AGENT && !headers.has(\"User-Agent\") && headers.set(\"User-Agent\", USER_AGENT), headers.has(\"accept\") || headers.set(\"accept\", \"application/json, application/jwk-set+json\");\n const fetchImpl = opts[customFetch], cache = opts[jwksCache];\n let jwksTimestamp, pendingFetch, reloadSequence = 0, appliedSequence = 0, local;\n if (cache && typeof cache == \"object\") {\n const { uat, jwks } = cache;\n isFreshFor(uat, cacheMaxAge) && isJwkSet(jwks) && (jwksTimestamp = uat, local = createLocalJWKSet(jwks));\n }\n const reload = async () => {\n if (pendingFetch && isCloudflareWorkers() && (pendingFetch = void 0), !pendingFetch) {\n const sequence = ++reloadSequence, current = pendingFetch = fetchJwks(href, headers, AbortSignal.timeout(timeoutDuration), fetchImpl).then((json) => {\n const next = createLocalJWKSet(json);\n if (sequence <= appliedSequence)\n return;\n local = next;\n const updatedAt = Date.now();\n cache && (cache.uat = updatedAt, cache.jwks = json), jwksTimestamp = updatedAt, appliedSequence = sequence;\n }).finally(() => {\n pendingFetch === current && (pendingFetch = void 0);\n });\n }\n await pendingFetch;\n };\n return Object.defineProperties(async (protectedHeader, token) => {\n (!local || !isFreshFor(jwksTimestamp, cacheMaxAge)) && await reload();\n try {\n return await local(protectedHeader, token);\n } catch (err) {\n if (err instanceof JWKSNoMatchingKey && !isFreshFor(jwksTimestamp, cooldownDuration))\n return await reload(), local(protectedHeader, token);\n throw err;\n }\n }, {\n coolingDown: {\n get: () => isFreshFor(jwksTimestamp, cooldownDuration),\n enumerable: !0\n },\n fresh: {\n get: () => isFreshFor(jwksTimestamp, cacheMaxAge),\n enumerable: !0\n },\n reload: {\n value: reload,\n enumerable: !0\n },\n reloading: {\n get: () => !!pendingFetch,\n enumerable: !0\n },\n jwks: {\n value: () => local?.jwks(),\n enumerable: !0\n }\n });\n}\nexport {\n createRemoteJWKSet,\n customFetch,\n jwksCache\n};\n","import { compactDecrypt } from \"./jwe/compact/decrypt.js\";\nimport { flattenedDecrypt } from \"./jwe/flattened/decrypt.js\";\nimport { generalDecrypt } from \"./jwe/general/decrypt.js\";\nimport { GeneralEncrypt } from \"./jwe/general/encrypt.js\";\nimport { compactVerify } from \"./jws/compact/verify.js\";\nimport { flattenedVerify } from \"./jws/flattened/verify.js\";\nimport { generalVerify } from \"./jws/general/verify.js\";\nimport { jwtVerify } from \"./jwt/verify.js\";\nimport { jwtDecrypt } from \"./jwt/decrypt.js\";\nimport { CompactEncrypt } from \"./jwe/compact/encrypt.js\";\nimport { FlattenedEncrypt } from \"./jwe/flattened/encrypt.js\";\nimport { CompactSign } from \"./jws/compact/sign.js\";\nimport { FlattenedSign } from \"./jws/flattened/sign.js\";\nimport { GeneralSign } from \"./jws/general/sign.js\";\nimport { SignJWT } from \"./jwt/sign.js\";\nimport { EncryptJWT } from \"./jwt/encrypt.js\";\nimport { calculateJwkThumbprint, calculateJwkThumbprintUri } from \"./jwk/thumbprint.js\";\nimport { EmbeddedJWK } from \"./jwk/embedded.js\";\nimport { createLocalJWKSet } from \"./jwks/local.js\";\nimport { createRemoteJWKSet, jwksCache, customFetch } from \"./jwks/remote.js\";\nimport { UnsecuredJWT } from \"./jwt/unsecured.js\";\nimport { exportPKCS8, exportSPKI, exportJWK } from \"./key/export.js\";\nimport { importSPKI, importPKCS8, importX509, importJWK } from \"./key/import.js\";\nimport { decodeProtectedHeader } from \"./util/decode_protected_header.js\";\nimport { decodeJwt } from \"./util/decode_jwt.js\";\nimport * as errors from \"./util/errors.js\";\nimport { generateKeyPair } from \"./key/generate_key_pair.js\";\nimport { generateSecret } from \"./key/generate_secret.js\";\nimport * as base64url from \"./util/base64url.js\";\nconst cryptoRuntime = \"WebCryptoAPI\";\nexport {\n CompactEncrypt,\n CompactSign,\n EmbeddedJWK,\n EncryptJWT,\n FlattenedEncrypt,\n FlattenedSign,\n GeneralEncrypt,\n GeneralSign,\n SignJWT,\n UnsecuredJWT,\n base64url,\n calculateJwkThumbprint,\n calculateJwkThumbprintUri,\n compactDecrypt,\n compactVerify,\n createLocalJWKSet,\n createRemoteJWKSet,\n cryptoRuntime,\n customFetch,\n decodeJwt,\n decodeProtectedHeader,\n errors,\n exportJWK,\n exportPKCS8,\n exportSPKI,\n flattenedDecrypt,\n flattenedVerify,\n generalDecrypt,\n generalVerify,\n generateKeyPair,\n generateSecret,\n importJWK,\n importPKCS8,\n importSPKI,\n importX509,\n jwksCache,\n jwtDecrypt,\n jwtVerify\n};\n","/**\n * OidcLoginService - OAuth2/OIDC authorization-code login with PKCE.\n *\n * The service is provider-generic and works with standards-compliant IdPs such\n * as Kanidm, Dex, Keycloak, Authentik, Google, and others. It handles provider\n * discovery, authorization URL construction, token exchange, ID token\n * verification, and SMRT User/Profile creation.\n *\n * @packageDocumentation\n */\n\nimport { getPackageConfig } from '@happyvertical/smrt-config';\nimport type { SmrtClassOptions } from '@happyvertical/smrt-core';\nimport {\n createRemoteJWKSet,\n customFetch,\n type JWTPayload,\n type JWTVerifyGetKey,\n jwtVerify,\n} from 'jose';\nimport {\n type OidcClaims,\n type OidcIdentityResult,\n type OidcProfileOwnerAuthorizer,\n type OidcProfileResolver,\n UserCollection,\n} from '../collections/UserCollection.js';\n\nconst DEFAULT_SCOPES = ['openid', 'profile', 'email'] as const;\nconst DEFAULT_CLOCK_TOLERANCE_SECONDS = 15;\nconst DEFAULT_METADATA_CACHE_TTL_MS = 5 * 60 * 1000;\nconst WELL_KNOWN_PATH = '/.well-known/openid-configuration';\n\nexport type OidcProviderKind = 'kanidm' | 'dex' | 'generic';\n\nexport type OidcTokenEndpointAuthMethod =\n | 'client_secret_basic'\n | 'client_secret_post'\n | 'none';\n\nexport interface OidcProviderConfig {\n /**\n * Optional preset label for documentation and UI.\n *\n * Kanidm and Dex are standards-compliant OIDC providers, so the preset does\n * not change protocol behavior; it lets apps name their intent clearly.\n */\n kind?: OidcProviderKind;\n /** OIDC issuer URL, e.g. https://id.example.com/dex */\n issuer: string;\n /** OAuth2/OIDC client ID registered with the provider */\n clientId: string;\n /** OAuth2/OIDC client secret for confidential clients */\n clientSecret?: string;\n /**\n * Redirect URI registered with the provider.\n *\n * SvelteKit helpers can derive this from the current request when omitted.\n */\n redirectUri?: string;\n /** Scopes to request. Defaults to openid profile email. */\n scopes?: string[];\n /** Override the discovery document URL when needed. */\n discoveryUrl?: string;\n /** Additional authorization request parameters. */\n authorizationParams?: Record<string, string | number | boolean | undefined>;\n /**\n * Client authentication method for the token endpoint.\n *\n * Defaults to client_secret_basic when clientSecret exists, otherwise none.\n */\n tokenEndpointAuthMethod?: OidcTokenEndpointAuthMethod;\n}\n\nexport interface OidcProviderResolutionOptions {\n defaultProvider?: string;\n providers?: Record<string, OidcProviderConfig>;\n}\n\nexport interface UsersOidcConfig extends OidcProviderResolutionOptions {\n /** Seconds before login transaction cookies expire. */\n transactionTtl?: number;\n}\n\nexport interface OidcProviderResolution {\n provider: OidcProviderConfig;\n providerName: string;\n}\n\nexport interface ResolvedOidcProviderConfig extends OidcProviderConfig {\n redirectUri: string;\n}\n\nexport interface OidcProviderMetadata {\n authorization_response_iss_parameter_supported?: boolean;\n authorization_endpoint: string;\n end_session_endpoint?: string;\n issuer: string;\n jwks_uri: string;\n token_endpoint: string;\n userinfo_endpoint?: string;\n [key: string]: unknown;\n}\n\nexport interface OidcTransaction {\n codeVerifier: string;\n createdAt: number;\n nonce: string;\n provider: string;\n returnTo?: string;\n state: string;\n}\n\nexport interface CreateAuthorizationUrlOptions {\n authorizationParams?: Record<string, string | number | boolean | undefined>;\n transaction?: OidcTransaction;\n}\n\nexport interface OidcTokenSet {\n accessToken?: string;\n expiresAt?: Date;\n idToken: string;\n refreshToken?: string;\n scope?: string;\n tokenType?: string;\n}\n\nexport interface OidcCallbackResult {\n claims: OidcClaims;\n tokens: OidcTokenSet;\n}\n\nexport interface OidcLoginResult extends OidcIdentityResult {\n claims: OidcClaims;\n tokens: OidcTokenSet;\n}\n\nexport interface OidcLoginServiceOptions extends SmrtClassOptions {\n /** Provider key, e.g. kanidm or dex */\n providerName: string;\n /** Fully resolved provider config. redirectUri is required here. */\n provider: ResolvedOidcProviderConfig;\n /** Optional fetch override for tests or custom runtimes. */\n fetch?: typeof fetch;\n /** JWT clock tolerance passed to jose. Defaults to 15 seconds. */\n clockTolerance?: number | string;\n /** Provider metadata cache TTL in milliseconds. Defaults to 5 minutes. */\n metadataCacheTtlMs?: number;\n /**\n * Application Profile resolver invoked after claims validation and before\n * OIDC identity, User, or session creation.\n */\n resolveProfile?: OidcProfileResolver;\n /**\n * Explicitly authorize first binding to a pre-provisioned canonical Profile\n * and its existing User owner after protocol claim validation.\n */\n authorizeProfileOwner?: OidcProfileOwnerAuthorizer;\n}\n\nexport class OidcLoginError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'OidcLoginError';\n }\n}\n\ninterface UsersAuthPackageConfig extends Record<string, unknown> {\n auth?: {\n oidc?: UsersOidcConfig;\n };\n}\n\ninterface TokenEndpointResponse {\n access_token?: unknown;\n error?: unknown;\n error_description?: unknown;\n expires_in?: unknown;\n id_token?: unknown;\n refresh_token?: unknown;\n scope?: unknown;\n token_type?: unknown;\n}\n\ntype OidcClaimSource = JWTPayload | Record<string, unknown>;\n\nexport function getUsersOidcConfig(): UsersOidcConfig {\n const config = getPackageConfig<UsersAuthPackageConfig>('users', {});\n return config.auth?.oidc ?? {};\n}\n\nfunction normalizeIssuer(issuer: string): string {\n return issuer.replace(/\\/+$/u, '');\n}\n\nfunction resolveDiscoveryUrl(provider: OidcProviderConfig): string {\n if (provider.discoveryUrl) return provider.discoveryUrl;\n return `${normalizeIssuer(provider.issuer)}${WELL_KNOWN_PATH}`;\n}\n\nfunction bytesToBase64Url(bytes: Uint8Array): string {\n let binary = '';\n for (const byte of bytes) {\n binary += String.fromCharCode(byte);\n }\n\n return btoa(binary)\n .replaceAll('+', '-')\n .replaceAll('/', '_')\n .replace(/=+$/u, '');\n}\n\nfunction base64UrlToBytes(value: string): Uint8Array {\n const normalized = value.replaceAll('-', '+').replaceAll('_', '/');\n const padded = normalized.padEnd(\n normalized.length + ((4 - (normalized.length % 4)) % 4),\n '=',\n );\n const binary = atob(padded);\n const bytes = new Uint8Array(binary.length);\n\n for (let index = 0; index < binary.length; index += 1) {\n bytes[index] = binary.charCodeAt(index);\n }\n\n return bytes;\n}\n\nfunction randomBase64Url(byteLength = 32): string {\n const bytes = new Uint8Array(byteLength);\n crypto.getRandomValues(bytes);\n return bytesToBase64Url(bytes);\n}\n\nasync function pkceChallenge(codeVerifier: string): Promise<string> {\n const bytes = new TextEncoder().encode(codeVerifier);\n const digest = await crypto.subtle.digest('SHA-256', bytes);\n return bytesToBase64Url(new Uint8Array(digest));\n}\n\nfunction bytesToBase64(bytes: Uint8Array): string {\n let binary = '';\n\n for (const byte of bytes) {\n binary += String.fromCharCode(byte);\n }\n\n return btoa(binary);\n}\n\nfunction formUrlEncode(value: string): string {\n const params = new URLSearchParams();\n params.set('value', value);\n return params.toString().slice('value='.length);\n}\n\nfunction encodeBasicAuth(clientId: string, clientSecret: string): string {\n const credentials = `${formUrlEncode(clientId)}:${formUrlEncode(clientSecret)}`;\n return bytesToBase64(new TextEncoder().encode(credentials));\n}\n\nfunction asString(value: unknown): string | undefined {\n return typeof value === 'string' && value.length > 0 ? value : undefined;\n}\n\nfunction asBoolean(value: unknown): boolean | undefined {\n if (typeof value === 'boolean') return value;\n if (value === 'true') return true;\n if (value === 'false') return false;\n return undefined;\n}\n\nfunction ensureFetch(fetchOverride?: typeof fetch): typeof fetch {\n const runtimeFetch = fetchOverride ?? globalThis.fetch;\n if (!runtimeFetch) {\n throw new OidcLoginError('OIDC login requires a fetch implementation.');\n }\n return runtimeFetch;\n}\n\nfunction requireString(value: unknown, field: string): string {\n if (typeof value !== 'string' || value.length === 0) {\n throw new OidcLoginError(`OIDC provider metadata missing \"${field}\".`);\n }\n return value;\n}\n\nasync function readJsonResponse<T>(\n response: Response,\n context: string,\n): Promise<T> {\n try {\n return (await response.json()) as T;\n } catch {\n throw new OidcLoginError(`${context} returned invalid JSON.`);\n }\n}\n\nfunction normalizeClaims(\n payload: OidcClaimSource,\n issuer: string,\n sourceName = 'OIDC claims',\n): OidcClaims {\n const sub = asString(payload.sub);\n if (!sub) {\n throw new OidcLoginError(`${sourceName} missing required \"sub\" claim.`);\n }\n\n return {\n sub,\n iss: asString(payload.iss) ?? issuer,\n email: asString(payload.email),\n email_verified: asBoolean(payload.email_verified),\n name: asString(payload.name),\n preferred_username: asString(payload.preferred_username),\n };\n}\n\nfunction mergeClaims(\n idTokenClaims: OidcClaims,\n userInfoClaims: OidcClaims,\n): OidcClaims {\n if (userInfoClaims.sub !== idTokenClaims.sub) {\n throw new OidcLoginError('OIDC userinfo subject does not match ID token.');\n }\n\n const useIdTokenEmail = idTokenClaims.email !== undefined;\n return {\n ...idTokenClaims,\n // Email verification is meaningful only for the email asserted by the\n // same source. Never borrow an ID-token verification flag for a userinfo\n // address (or vice versa).\n email: useIdTokenEmail ? idTokenClaims.email : userInfoClaims.email,\n email_verified: useIdTokenEmail\n ? idTokenClaims.email_verified\n : userInfoClaims.email_verified,\n name: idTokenClaims.name ?? userInfoClaims.name,\n preferred_username:\n idTokenClaims.preferred_username ?? userInfoClaims.preferred_username,\n };\n}\n\nfunction validateAuthorizedParty(payload: JWTPayload, clientId: string): void {\n const authorizedParty = asString(payload.azp);\n\n if (authorizedParty && authorizedParty !== clientId) {\n throw new OidcLoginError('OIDC authorized party validation failed.');\n }\n\n if (\n Array.isArray(payload.aud) &&\n payload.aud.length > 1 &&\n authorizedParty !== clientId\n ) {\n throw new OidcLoginError('OIDC authorized party validation failed.');\n }\n}\n\nfunction getTokenEndpointAuthMethod(\n provider: OidcProviderConfig,\n): OidcTokenEndpointAuthMethod {\n return (\n provider.tokenEndpointAuthMethod ??\n (provider.clientSecret ? 'client_secret_basic' : 'none')\n );\n}\n\nfunction getScopes(provider: OidcProviderConfig): string[] {\n return provider.scopes?.length ? provider.scopes : [...DEFAULT_SCOPES];\n}\n\nfunction parseTokenResponse(json: TokenEndpointResponse): OidcTokenSet {\n if (typeof json.id_token !== 'string') {\n throw new OidcLoginError('OIDC token response missing \"id_token\".');\n }\n\n return {\n accessToken: asString(json.access_token),\n expiresAt:\n typeof json.expires_in === 'number'\n ? new Date(Date.now() + json.expires_in * 1000)\n : undefined,\n idToken: json.id_token,\n refreshToken: asString(json.refresh_token),\n scope: asString(json.scope),\n tokenType: asString(json.token_type),\n };\n}\n\nfunction parseTransaction(value: unknown): OidcTransaction {\n if (!value || typeof value !== 'object') {\n throw new OidcLoginError('Invalid OIDC login transaction.');\n }\n\n const record = value as Partial<OidcTransaction>;\n if (\n !record.provider ||\n !record.state ||\n !record.nonce ||\n !record.codeVerifier ||\n typeof record.createdAt !== 'number'\n ) {\n throw new OidcLoginError('Invalid OIDC login transaction.');\n }\n\n return {\n codeVerifier: record.codeVerifier,\n createdAt: record.createdAt,\n nonce: record.nonce,\n provider: record.provider,\n returnTo: asString(record.returnTo),\n state: record.state,\n };\n}\n\nexport function encodeOidcTransaction(transaction: OidcTransaction): string {\n const json = JSON.stringify(transaction);\n return bytesToBase64Url(new TextEncoder().encode(json));\n}\n\nexport function decodeOidcTransaction(value: string): OidcTransaction {\n try {\n const json = new TextDecoder().decode(base64UrlToBytes(value));\n return parseTransaction(JSON.parse(json));\n } catch (error) {\n if (error instanceof OidcLoginError) throw error;\n throw new OidcLoginError('Invalid OIDC login transaction.');\n }\n}\n\nexport function resolveOidcProviderConfig(\n providerName?: string,\n options: OidcProviderResolutionOptions = {},\n): OidcProviderResolution {\n const oidcConfig = getUsersOidcConfig();\n const providers = {\n ...(oidcConfig.providers ?? {}),\n ...(options.providers ?? {}),\n };\n const resolvedProviderName =\n providerName ?? options.defaultProvider ?? oidcConfig.defaultProvider;\n\n if (!resolvedProviderName) {\n throw new OidcLoginError(\n 'No OIDC provider specified. Pass a provider name or configure packages.users.auth.oidc.defaultProvider.',\n );\n }\n\n const provider = providers[resolvedProviderName];\n if (!provider) {\n throw new OidcLoginError(\n `Unknown OIDC provider \"${resolvedProviderName}\". Configure it under packages.users.auth.oidc.providers.`,\n );\n }\n\n if (!provider.issuer || !provider.clientId) {\n throw new OidcLoginError(\n `OIDC provider \"${resolvedProviderName}\" requires issuer and clientId.`,\n );\n }\n\n return {\n provider,\n providerName: resolvedProviderName,\n };\n}\n\nexport class OidcLoginService {\n private readonly classOptions: SmrtClassOptions;\n private readonly clockTolerance: number | string;\n private readonly fetchImpl: typeof fetch;\n private readonly metadataCacheTtlMs: number;\n private readonly authorizeProfileOwner?: OidcProfileOwnerAuthorizer;\n private readonly resolveProfile?: OidcProfileResolver;\n private metadataFetchedAt = 0;\n private metadataPromise?: Promise<OidcProviderMetadata>;\n private remoteJwks?: JWTVerifyGetKey;\n readonly provider: ResolvedOidcProviderConfig;\n readonly providerName: string;\n\n constructor(options: OidcLoginServiceOptions) {\n const {\n clockTolerance,\n fetch: fetchOverride,\n metadataCacheTtlMs,\n provider,\n providerName,\n authorizeProfileOwner,\n resolveProfile,\n ...classOptions\n } = options;\n\n if (!provider.redirectUri) {\n throw new OidcLoginError(\n `OIDC provider \"${providerName}\" requires a redirectUri.`,\n );\n }\n\n this.classOptions = classOptions;\n this.clockTolerance = clockTolerance ?? DEFAULT_CLOCK_TOLERANCE_SECONDS;\n this.fetchImpl = ensureFetch(fetchOverride);\n this.metadataCacheTtlMs =\n metadataCacheTtlMs ?? DEFAULT_METADATA_CACHE_TTL_MS;\n this.authorizeProfileOwner = authorizeProfileOwner;\n this.resolveProfile = resolveProfile;\n this.provider = {\n ...provider,\n issuer: normalizeIssuer(provider.issuer),\n };\n this.providerName = providerName;\n }\n\n createTransaction(returnTo?: string): OidcTransaction {\n return {\n codeVerifier: randomBase64Url(32),\n createdAt: Date.now(),\n nonce: randomBase64Url(32),\n provider: this.providerName,\n returnTo,\n state: randomBase64Url(32),\n };\n }\n\n async getMetadata(): Promise<OidcProviderMetadata> {\n const cacheExpired =\n this.metadataFetchedAt > 0 &&\n Date.now() - this.metadataFetchedAt > this.metadataCacheTtlMs;\n\n if (!this.metadataPromise || cacheExpired) {\n this.metadataPromise = this.fetchMetadata()\n .then((metadata) => {\n this.metadataFetchedAt = Date.now();\n this.remoteJwks = undefined;\n return metadata;\n })\n .catch((error) => {\n this.metadataPromise = undefined;\n throw error;\n });\n }\n\n return this.metadataPromise;\n }\n\n private async fetchMetadata(): Promise<OidcProviderMetadata> {\n const discoveryUrl = resolveDiscoveryUrl(this.provider);\n const response = await this.fetchImpl(discoveryUrl, {\n headers: { accept: 'application/json' },\n });\n\n if (!response.ok) {\n throw new OidcLoginError(\n `OIDC discovery failed for \"${this.providerName}\" (${response.status}).`,\n );\n }\n\n const metadata = await readJsonResponse<Partial<OidcProviderMetadata>>(\n response,\n 'OIDC discovery',\n );\n const issuer = requireString(\n metadata.issuer ?? this.provider.issuer,\n 'issuer',\n );\n\n if (normalizeIssuer(issuer) !== this.provider.issuer) {\n throw new OidcLoginError(\n `OIDC discovery issuer mismatch for \"${this.providerName}\".`,\n );\n }\n\n return {\n ...metadata,\n authorization_endpoint: requireString(\n metadata.authorization_endpoint,\n 'authorization_endpoint',\n ),\n issuer,\n jwks_uri: requireString(metadata.jwks_uri, 'jwks_uri'),\n token_endpoint: requireString(metadata.token_endpoint, 'token_endpoint'),\n };\n }\n\n async createAuthorizationUrl(\n options: CreateAuthorizationUrlOptions = {},\n ): Promise<{ transaction: OidcTransaction; url: URL }> {\n const metadata = await this.getMetadata();\n const transaction = options.transaction ?? this.createTransaction();\n const codeChallenge = await pkceChallenge(transaction.codeVerifier);\n const url = new URL(metadata.authorization_endpoint);\n\n url.searchParams.set('response_type', 'code');\n url.searchParams.set('client_id', this.provider.clientId);\n url.searchParams.set('redirect_uri', this.provider.redirectUri);\n url.searchParams.set('scope', getScopes(this.provider).join(' '));\n url.searchParams.set('state', transaction.state);\n url.searchParams.set('nonce', transaction.nonce);\n url.searchParams.set('code_challenge', codeChallenge);\n url.searchParams.set('code_challenge_method', 'S256');\n\n for (const [key, value] of Object.entries({\n ...this.provider.authorizationParams,\n ...options.authorizationParams,\n })) {\n if (value !== undefined) {\n url.searchParams.set(key, String(value));\n }\n }\n\n return { transaction, url };\n }\n\n async exchangeCallback(\n callbackUrl: string | URL,\n transaction: OidcTransaction,\n ): Promise<OidcCallbackResult> {\n this.validateCallbackEnvelope(callbackUrl, transaction);\n const metadata = await this.getMetadata();\n const code = this.validateCallback(callbackUrl, transaction, metadata);\n const tokens = await this.exchangeCode(code, transaction);\n const idTokenClaims = await this.verifyIdToken(\n tokens.idToken,\n transaction.nonce,\n );\n const claims = await this.enrichClaimsFromUserInfo(idTokenClaims, tokens);\n\n return { claims, tokens };\n }\n\n async completeLogin(\n callbackUrl: string | URL,\n transaction: OidcTransaction,\n ): Promise<OidcLoginResult> {\n const { claims, tokens } = await this.exchangeCallback(\n callbackUrl,\n transaction,\n );\n const users = await UserCollection.create(this.classOptions);\n const result = await users.getOrCreateFromOidc(claims, this.providerName, {\n authorizeProfileOwner: this.authorizeProfileOwner,\n resolveProfile: this.resolveProfile,\n });\n\n return {\n ...result,\n claims,\n tokens,\n };\n }\n\n private validateCallback(\n callbackUrl: string | URL,\n _transaction: OidcTransaction,\n metadata: OidcProviderMetadata,\n ): string {\n const url = callbackUrl instanceof URL ? callbackUrl : new URL(callbackUrl);\n\n const responseIssuer = url.searchParams.get('iss');\n if (\n !responseIssuer &&\n metadata.authorization_response_iss_parameter_supported === true\n ) {\n throw new OidcLoginError(\n 'OIDC callback missing authorization response issuer.',\n );\n }\n if (responseIssuer && responseIssuer !== metadata.issuer) {\n throw new OidcLoginError('OIDC response issuer validation failed.');\n }\n\n const error = url.searchParams.get('error');\n if (error) {\n const description = url.searchParams.get('error_description');\n throw new OidcLoginError(\n description\n ? `OIDC provider returned \"${error}\": ${description}`\n : `OIDC provider returned \"${error}\".`,\n );\n }\n\n const code = url.searchParams.get('code');\n if (!code) {\n throw new OidcLoginError('OIDC callback missing authorization code.');\n }\n\n return code;\n }\n\n private validateCallbackEnvelope(\n callbackUrl: string | URL,\n transaction: OidcTransaction,\n ): void {\n if (transaction.provider !== this.providerName) {\n throw new OidcLoginError('OIDC login transaction provider mismatch.');\n }\n\n const url = callbackUrl instanceof URL ? callbackUrl : new URL(callbackUrl);\n const state = url.searchParams.get('state');\n if (!state || state !== transaction.state) {\n throw new OidcLoginError('OIDC state validation failed.');\n }\n }\n\n private async exchangeCode(\n code: string,\n transaction: OidcTransaction,\n ): Promise<OidcTokenSet> {\n const metadata = await this.getMetadata();\n const body = new URLSearchParams({\n code,\n code_verifier: transaction.codeVerifier,\n grant_type: 'authorization_code',\n redirect_uri: this.provider.redirectUri,\n });\n const headers = new Headers({\n accept: 'application/json',\n 'content-type': 'application/x-www-form-urlencoded',\n });\n\n const authMethod = getTokenEndpointAuthMethod(this.provider);\n if (authMethod === 'client_secret_basic') {\n if (!this.provider.clientSecret) {\n throw new OidcLoginError(\n `OIDC provider \"${this.providerName}\" is missing clientSecret.`,\n );\n }\n headers.set(\n 'authorization',\n `Basic ${encodeBasicAuth(this.provider.clientId, this.provider.clientSecret)}`,\n );\n } else {\n body.set('client_id', this.provider.clientId);\n if (authMethod === 'client_secret_post') {\n if (!this.provider.clientSecret) {\n throw new OidcLoginError(\n `OIDC provider \"${this.providerName}\" is missing clientSecret.`,\n );\n }\n body.set('client_secret', this.provider.clientSecret);\n }\n }\n\n const response = await this.fetchImpl(metadata.token_endpoint, {\n body,\n headers,\n method: 'POST',\n });\n const json = await readJsonResponse<TokenEndpointResponse>(\n response,\n 'OIDC token endpoint',\n );\n\n if (!response.ok) {\n const providerError = asString(json.error);\n const description = asString(json.error_description);\n throw new OidcLoginError(\n description\n ? `OIDC token exchange failed (${providerError ?? response.status}): ${description}`\n : `OIDC token exchange failed (${providerError ?? response.status}).`,\n );\n }\n\n return parseTokenResponse(json);\n }\n\n private async enrichClaimsFromUserInfo(\n claims: OidcClaims,\n tokens: OidcTokenSet,\n ): Promise<OidcClaims> {\n if (claims.email || !tokens.accessToken) {\n return claims;\n }\n\n const metadata = await this.getMetadata();\n if (!metadata.userinfo_endpoint) {\n return claims;\n }\n\n const tokenType = tokens.tokenType ?? 'Bearer';\n const response = await this.fetchImpl(metadata.userinfo_endpoint, {\n headers: {\n accept: 'application/json',\n authorization: `${tokenType} ${tokens.accessToken}`,\n },\n });\n\n if (!response.ok) {\n throw new OidcLoginError(\n `OIDC userinfo request failed (${response.status}).`,\n );\n }\n\n const userInfo = await readJsonResponse<Record<string, unknown>>(\n response,\n 'OIDC userinfo endpoint',\n );\n\n return mergeClaims(\n claims,\n normalizeClaims(userInfo, metadata.issuer, 'OIDC userinfo'),\n );\n }\n\n private async verifyIdToken(\n idToken: string,\n expectedNonce: string,\n ): Promise<OidcClaims> {\n const metadata = await this.getMetadata();\n this.remoteJwks ??= createRemoteJWKSet(new URL(metadata.jwks_uri), {\n [customFetch]: this.fetchImpl,\n });\n\n const { payload } = await jwtVerify(idToken, this.remoteJwks, {\n audience: this.provider.clientId,\n clockTolerance: this.clockTolerance,\n issuer: metadata.issuer,\n });\n\n validateAuthorizedParty(payload, this.provider.clientId);\n\n if (payload.nonce !== expectedNonce) {\n throw new OidcLoginError('OIDC nonce validation failed.');\n }\n\n return normalizeClaims(payload, metadata.issuer, 'OIDC ID token');\n }\n}\n","/**\n * MobileAuthService — server side of the SMRT mobile `/api/mobile` contract\n * (ADR 0001 Phase 3.5, issue #1748).\n *\n * Implements server-brokered OIDC/PKCE for native mobile clients on top of\n * the existing building blocks: {@link OidcLoginService} for the protocol\n * work, {@link SessionService} for the opaque bearer session (the session id\n * IS the bearer token — the same convention `TerminalAuthService` ships), and\n * the membership/role/tenant collections for the session bootstrap.\n *\n * Wire DTOs come from `@happyvertical/smrt-mobile-contract` — the owning\n * package for both the Kotlin client contract and these TypeScript types.\n *\n * ## Stateless completion: the state token\n *\n * The mobile flow has no cookie jar, so the web flow's HMAC-signed\n * transaction cookie cannot carry `state`/`nonce`/`codeVerifier` across the\n * redirect. Instead (per the frozen contract) the CLIENT persists and echoes\n * `state` + `codeVerifier`, and the server stays stateless by making the\n * OAuth `state` value itself a signed token: base64url JSON carrying the\n * nonce, provider, and creation time, plus an HMAC-SHA256 signature when a\n * secret is available (`stateSecret` option, defaulting to the provider's\n * `clientSecret` — the same fallback the web transaction cookie uses). The\n * client treats `state` as opaque; `MobileSessionManager` just compares the\n * redirect's `state` to the persisted one and echoes it back.\n *\n * The `codeVerifier` deliberately NEVER rides inside the state token: state\n * appears in the authorization URL (browser history, proxy logs), and a\n * verifier there would defeat PKCE. It stays client-held — returned once in\n * the `auth/start` response body and echoed once in the `auth/complete`\n * request body, both over TLS POSTs. The nonce, by contrast, is already a\n * query parameter of the authorization URL, so embedding it in `state`\n * leaks nothing while letting the server enforce full ID-token nonce\n * verification without server-side pending state.\n *\n * @packageDocumentation\n */\n\nimport type { SmrtClassOptions } from '@happyvertical/smrt-core';\nimport type {\n MobileAuthCompleteRequest,\n MobileAuthSession,\n MobileAuthStartRequest,\n MobileAuthStartResponse,\n MobileSessionBootstrap,\n MobileTenantOption,\n MobileUserSummary,\n} from '@happyvertical/smrt-mobile-contract';\nimport { MembershipCollection } from '../collections/MembershipCollection.js';\nimport { RoleCollection } from '../collections/RoleCollection.js';\nimport { TenantCollection } from '../collections/TenantCollection.js';\nimport {\n type OidcClaims,\n UserCollection,\n} from '../collections/UserCollection.js';\nimport type { Membership } from '../models/Membership.js';\nimport type { Role } from '../models/Role.js';\nimport type { Tenant } from '../models/Tenant.js';\nimport { withoutListBounds } from './authorization-read-options.js';\nimport {\n OidcLoginError,\n OidcLoginService,\n type OidcProviderResolutionOptions,\n type OidcTokenSet,\n type OidcTransaction,\n resolveOidcProviderConfig,\n} from './OidcLoginService.js';\nimport type { SessionContext } from './SessionService.js';\nimport { SessionService } from './SessionService.js';\n\n/** 30 days — mobile sessions outlive browser sessions by design. */\nconst DEFAULT_MOBILE_SESSION_TTL_SECONDS = 30 * 24 * 60 * 60;\n/** 10 minutes — matches the web flow's transaction-cookie TTL. */\nconst DEFAULT_MOBILE_TRANSACTION_TTL_SECONDS = 10 * 60;\n/** Tolerated forward clock skew when checking state-token freshness. */\nconst STATE_TOKEN_CLOCK_SKEW_MS = 60 * 1000;\n/** Upper bound for a client-supplied correlation `state` value. */\nconst MAX_CLIENT_STATE_LENGTH = 512;\n/** Cap for the per-(provider, redirectUri) OIDC service cache. */\nconst MAX_OIDC_SERVICE_CACHE = 16;\n/** Cap for IdP-sourced strings persisted in the session data blob. */\nconst MAX_STORED_CLAIM_LENGTH = 1024;\n\n/**\n * Machine-readable error codes carried on {@link MobileAuthError} and in the\n * JSON error body (`{ error, code }`) the SvelteKit handlers emit.\n */\nexport type MobileAuthErrorCode =\n | 'invalid_request'\n | 'unknown_provider'\n | 'invalid_redirect_uri'\n | 'missing_code_verifier'\n | 'invalid_state'\n | 'expired_transaction'\n | 'exchange_failed'\n | 'signin_not_permitted'\n | 'missing_bearer_token'\n | 'invalid_bearer_token'\n | 'provider_unavailable'\n | 'server_misconfigured';\n\n/**\n * HTTP-mapped mobile-auth failure. `status` drives the response code; `code`\n * gives clients a stable discriminator (messages may change).\n */\nexport class MobileAuthError extends Error {\n readonly status: number;\n readonly code: MobileAuthErrorCode;\n\n constructor(status: number, code: MobileAuthErrorCode, message: string) {\n super(message);\n this.name = 'MobileAuthError';\n this.status = status;\n this.code = code;\n }\n}\n\n/** Context handed to the {@link MobileAuthServiceOptions.resolveUser} hook. */\nexport interface MobileLoginContext {\n claims: OidcClaims;\n tokens: OidcTokenSet;\n providerName: string;\n}\n\n/** Minimal user identity a {@link MobileAuthServiceOptions.resolveUser} hook returns. */\nexport interface MobileResolvedUser {\n id: string;\n email?: string | null;\n}\n\n/** Context handed to the {@link MobileAuthServiceOptions.resolveTenantId} hook. */\nexport interface MobileTenantContext {\n userId: string;\n claims: OidcClaims;\n providerName: string;\n}\n\n/** Context handed to the {@link MobileAuthServiceOptions.buildExtras} hook. */\nexport interface MobileBootstrapContext {\n /** Full session context (user, membership, tenantId, sessionId). */\n session: SessionContext;\n /**\n * The session's resolved permission slugs. Any MODEL JSON placed into\n * `extras` must be projected with `toPublicJSON({ permissions })` using\n * THIS set, or the response leaks fields the generated routes redact\n * (`@field({ readPermission })`, #1822). Fail closed.\n */\n permissions: string[];\n tenants: MobileTenantOption[];\n activeTenant: MobileTenantOption | null;\n}\n\n/** Request metadata recorded onto the minted session. */\nexport interface MobileRequestMeta {\n userAgent?: string;\n ipAddress?: string;\n}\n\nexport interface MobileAuthServiceOptions\n extends SmrtClassOptions,\n OidcProviderResolutionOptions {\n /** Optional fetch override for tests or custom runtimes. */\n fetch?: typeof fetch;\n /** JWT clock tolerance passed to jose. */\n clockTolerance?: number | string;\n /**\n * Allowed mobile redirect URIs. Entries are exact matches, except entries\n * ending in `/` which allow any sub-path of that prefix. When omitted or\n * empty, any structurally valid mobile redirect URI is accepted (https,\n * loopback http, or a private app scheme — RFC 8252); configure this in\n * production so authorization responses cannot be pointed at an\n * attacker-controlled URI.\n */\n redirectUris?: string[];\n /** Mobile bearer session TTL in seconds. Default: 30 days. */\n sessionTtl?: number;\n /**\n * Auth handshake (start → complete) TTL in seconds. Default: 10 minutes,\n * matching the web flow's transaction cookie.\n */\n transactionTtl?: number;\n /**\n * HMAC secret for state-token integrity. Defaults to the resolved\n * provider's `clientSecret`.\n *\n * State signing binds the `nonce`/provider/createdAt in the OAuth `state`\n * so they cannot be forged, so it is REQUIRED by default: if neither\n * `stateSecret` nor the provider's `clientSecret` is available, sign-in\n * fails closed (500 `server_misconfigured`). A public OIDC client (no\n * client secret — the PKCE case) just supplies a `stateSecret`; it is a\n * server-side HMAC key unrelated to OAuth client authentication, so any\n * deployment can set one. Set {@link allowUnsignedState} to opt into\n * unsigned tokens (NOT recommended — then `redirectUris` is the only\n * defense against state forgery).\n */\n stateSecret?: string;\n /**\n * Permit unsigned state tokens when no `stateSecret`/`clientSecret` is\n * configured. Default false (fail closed). Only enable for local\n * development or a deployment that accepts the state-forgery risk;\n * production should configure a `stateSecret` instead.\n */\n allowUnsignedState?: boolean;\n /**\n * Include descendant tenants reachable through ACTIVE memberships whose\n * role has `inheritsToDescendants: true` (#1867) in the bootstrap tenant\n * list. Default true.\n */\n includeInheritedTenants?: boolean;\n /**\n * Provision a user even when the IdP explicitly reported the email as\n * unverified. Passed through to `UserCollection.getOrCreateFromOidc`.\n */\n allowUnverifiedEmail?: boolean;\n /**\n * Map verified IdP claims to a SMRT user. The default provisions (or\n * resolves) the user via `UserCollection.getOrCreateFromOidc`. Return\n * `null`/`undefined` to REFUSE sign-in (403 `signin_not_permitted`) —\n * invite-gated apps resolve against their own membership rules here\n * without any user row being created. THROWING (vs returning null) is\n * treated as an unexpected server error and surfaces as a generic 500;\n * translate expected denials into a `null` return or a thrown\n * {@link MobileAuthError}.\n */\n resolveUser?: (\n context: MobileLoginContext,\n ) => Promise<MobileResolvedUser | null | undefined>;\n /**\n * Choose the tenant the minted session is bound to. Return a tenant id,\n * `null` for an explicitly tenant-less session, or `undefined` to fall\n * back to the default (the first direct ACTIVE membership's tenant,\n * sorted by tenant name). The session's tenant is the isolation key for\n * every `@TenantScoped` query, so only return tenants the user can\n * actually resolve permissions in.\n */\n resolveTenantId?: (\n context: MobileTenantContext,\n ) => Promise<string | null | undefined>;\n /**\n * App-defined `extras` object for the session bootstrap. Must be a plain\n * JSON object (the Kotlin client decodes it as `JsonObject`). See\n * {@link MobileBootstrapContext.permissions} for the read-permission\n * redaction requirement on model JSON.\n */\n buildExtras?: (\n context: MobileBootstrapContext,\n ) => Promise<Record<string, unknown> | null | undefined>;\n}\n\n/** Result of {@link MobileAuthService.logout}. */\nexport interface MobileLogoutResult {\n ok: true;\n /** Whether a live session was actually revoked. */\n destroyed: boolean;\n}\n\n/**\n * Payload encoded into the OAuth `state` value. Short keys keep the\n * authorization URL compact.\n */\ninterface MobileStatePayload {\n /** Version discriminator. */\n v: 1;\n /** Random entropy (CSRF binding for the client's opaque comparison). */\n s: string;\n /** OIDC nonce echoed for ID-token verification at complete time. */\n n: string;\n /** Provider name the handshake was started for. */\n p: string;\n /** Creation time (epoch ms) for TTL enforcement. */\n t: number;\n /** Optional client-supplied correlation value (opaque passthrough). */\n c?: string;\n}\n\nfunction bytesToBase64Url(bytes: Uint8Array): string {\n let binary = '';\n for (const byte of bytes) {\n binary += String.fromCharCode(byte);\n }\n return btoa(binary)\n .replaceAll('+', '-')\n .replaceAll('/', '_')\n .replace(/=+$/u, '');\n}\n\nfunction base64UrlToBytes(value: string): Uint8Array {\n const normalized = value.replaceAll('-', '+').replaceAll('_', '/');\n const padded = normalized.padEnd(\n normalized.length + ((4 - (normalized.length % 4)) % 4),\n '=',\n );\n const binary = atob(padded);\n const bytes = new Uint8Array(binary.length);\n for (let index = 0; index < binary.length; index += 1) {\n bytes[index] = binary.charCodeAt(index);\n }\n return bytes;\n}\n\nfunction randomBase64Url(byteLength = 16): string {\n const bytes = new Uint8Array(byteLength);\n crypto.getRandomValues(bytes);\n return bytesToBase64Url(bytes);\n}\n\nasync function hmacBase64Url(payload: string, secret: string): Promise<string> {\n const key = await crypto.subtle.importKey(\n 'raw',\n new TextEncoder().encode(secret),\n { hash: 'SHA-256', name: 'HMAC' },\n false,\n ['sign'],\n );\n const signature = await crypto.subtle.sign(\n 'HMAC',\n key,\n new TextEncoder().encode(payload),\n );\n return bytesToBase64Url(new Uint8Array(signature));\n}\n\nfunction timingSafeEqual(left: string, right: string): boolean {\n const leftBytes = new TextEncoder().encode(left);\n const rightBytes = new TextEncoder().encode(right);\n let diff = leftBytes.length ^ rightBytes.length;\n const length = Math.max(leftBytes.length, rightBytes.length);\n for (let index = 0; index < length; index += 1) {\n diff |= (leftBytes[index] ?? 0) ^ (rightBytes[index] ?? 0);\n }\n return diff === 0;\n}\n\nasync function encodeMobileState(\n payload: MobileStatePayload,\n secret: string | undefined,\n): Promise<string> {\n const encoded = bytesToBase64Url(\n new TextEncoder().encode(JSON.stringify(payload)),\n );\n if (!secret) return encoded;\n return `${encoded}.${await hmacBase64Url(encoded, secret)}`;\n}\n\nasync function decodeMobileState(\n raw: string,\n secret: string | undefined,\n): Promise<MobileStatePayload> {\n const invalid = () =>\n new MobileAuthError(401, 'invalid_state', 'Invalid mobile auth state.');\n\n let encoded = raw;\n if (secret) {\n const separator = raw.lastIndexOf('.');\n if (separator < 0) throw invalid();\n encoded = raw.slice(0, separator);\n const signature = raw.slice(separator + 1);\n const expected = await hmacBase64Url(encoded, secret);\n if (!timingSafeEqual(signature, expected)) throw invalid();\n }\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(new TextDecoder().decode(base64UrlToBytes(encoded)));\n } catch {\n throw invalid();\n }\n\n if (!parsed || typeof parsed !== 'object') throw invalid();\n const record = parsed as Partial<MobileStatePayload>;\n if (\n record.v !== 1 ||\n typeof record.s !== 'string' ||\n record.s.length === 0 ||\n typeof record.n !== 'string' ||\n record.n.length === 0 ||\n typeof record.p !== 'string' ||\n record.p.length === 0 ||\n typeof record.t !== 'number' ||\n !Number.isFinite(record.t) ||\n (record.c !== undefined && typeof record.c !== 'string')\n ) {\n throw invalid();\n }\n\n return {\n v: 1,\n s: record.s,\n n: record.n,\n p: record.p,\n t: record.t,\n c: record.c,\n };\n}\n\n/**\n * Pull the token out of an `Authorization: Bearer <token>` header. Returns\n * `null` when the header is missing or malformed.\n */\nexport function readMobileBearerToken(\n authorizationHeader: string | null | undefined,\n): string | null {\n const match = authorizationHeader?.match(/^Bearer\\s+(.+)$/iu);\n const token = match?.[1]?.trim();\n return token && token.length > 0 ? token : null;\n}\n\n// Schemes that could execute script or read local resources if a redirect\n// value ever reached a browser context. Rejected regardless of allow list.\nconst DANGEROUS_REDIRECT_SCHEMES = new Set([\n 'javascript:',\n 'data:',\n 'vbscript:',\n 'file:',\n 'blob:',\n 'about:',\n]);\n\n// Well-known IANA schemes that are neither `https`, loopback `http`, nor a\n// private-use app scheme (RFC 8252 §7.1). A mobile OAuth redirect would never\n// legitimately use one of these, so reject them even when no `redirectUris`\n// allow list is configured — an app-owned custom scheme (e.g.\n// `com.example.app://`) still passes.\nconst NON_APP_REDIRECT_SCHEMES = new Set([\n 'ftp:',\n 'ftps:',\n 'ws:',\n 'wss:',\n 'mailto:',\n 'tel:',\n 'sms:',\n 'gopher:',\n 'ldap:',\n 'ldaps:',\n]);\n\nfunction isLoopbackHost(hostname: string): boolean {\n const host = hostname.toLowerCase();\n return (\n host === 'localhost' ||\n host === '127.0.0.1' ||\n host === '::1' ||\n host === '[::1]'\n );\n}\n\nfunction normalizeOptionalString(value: unknown): string | undefined {\n return typeof value === 'string' && value.trim().length > 0\n ? value.trim()\n : undefined;\n}\n\n/**\n * Validate a mobile redirect URI: absolute, a safe scheme (https, loopback\n * http, or a private app scheme per RFC 8252), and — when an allow list is\n * configured — present on it. Returns the normalized URI.\n */\nexport function validateMobileRedirectUri(\n value: unknown,\n allowList: string[] = [],\n): string {\n const redirectUri = normalizeOptionalString(value);\n if (!redirectUri) {\n throw new MobileAuthError(\n 400,\n 'invalid_redirect_uri',\n 'Missing mobile redirect URI.',\n );\n }\n\n let parsed: URL;\n try {\n parsed = new URL(redirectUri);\n } catch {\n throw new MobileAuthError(\n 400,\n 'invalid_redirect_uri',\n 'Mobile redirect URI must be an absolute URL.',\n );\n }\n\n const scheme = parsed.protocol.toLowerCase();\n if (\n DANGEROUS_REDIRECT_SCHEMES.has(scheme) ||\n NON_APP_REDIRECT_SCHEMES.has(scheme)\n ) {\n throw new MobileAuthError(\n 400,\n 'invalid_redirect_uri',\n 'Mobile redirect URI uses an unsupported scheme.',\n );\n }\n // Plain http is only permitted for native loopback redirects (RFC 8252).\n // https and private-use app schemes (e.g. com.example.app://) are allowed.\n if (scheme === 'http:' && !isLoopbackHost(parsed.hostname)) {\n throw new MobileAuthError(\n 400,\n 'invalid_redirect_uri',\n 'Mobile redirect URI must use https, a loopback address, or an app scheme.',\n );\n }\n\n const entries = allowList.map((entry) => entry.trim()).filter(Boolean);\n if (entries.length > 0) {\n const allowed = entries.some((entry) =>\n redirectUriMatchesAllowEntry(parsed, redirectUri, entry),\n );\n if (!allowed) {\n throw new MobileAuthError(\n 400,\n 'invalid_redirect_uri',\n 'Mobile redirect URI is not allowed.',\n );\n }\n }\n\n return redirectUri;\n}\n\n/**\n * Does a validated redirect URI match one allow-list entry?\n *\n * - A NON-prefix entry (no trailing `/`) is an exact string match.\n * - A prefix entry (trailing `/`) matches on the PARSED URL — same protocol,\n * same host (incl. port), and the candidate's NORMALIZED pathname starting\n * with the entry's pathname. Comparing normalized pathnames is what defeats\n * path traversal: `http://127.0.0.1/cb/../evil/` parses to pathname\n * `/evil/`, which does not start with `/cb/`, so a raw-string\n * `startsWith('http://127.0.0.1/cb/')` false-positive can't slip a code to\n * an unregistered path.\n */\nfunction redirectUriMatchesAllowEntry(\n parsedCandidate: URL,\n candidate: string,\n entry: string,\n): boolean {\n if (!entry.endsWith('/')) {\n return candidate === entry;\n }\n let parsedEntry: URL;\n try {\n parsedEntry = new URL(entry);\n } catch {\n return false;\n }\n return (\n parsedCandidate.protocol === parsedEntry.protocol &&\n parsedCandidate.host === parsedEntry.host &&\n parsedCandidate.pathname.startsWith(parsedEntry.pathname)\n );\n}\n\nfunction isModuleNotFoundError(error: unknown): boolean {\n return (\n error instanceof Error &&\n ((error as NodeJS.ErrnoException).code === 'ERR_MODULE_NOT_FOUND' ||\n /Cannot find package '@happyvertical\\/smrt-tenancy'/.test(error.message))\n );\n}\n\n/**\n * Run `fn` inside smrt-tenancy's system context when the package is\n * available (mirrors `SessionPermissionContext`'s tolerance). Mobile session\n * resolution and tenant enumeration are inherently CROSS-tenant reads —\n * under strict tenancy interceptors they must not be pinned to any single\n * tenant context.\n */\nasync function runWithSystemContext<T>(fn: () => Promise<T>): Promise<T> {\n try {\n const tenancy = await import('@happyvertical/smrt-tenancy');\n return await tenancy.withSystemContext(fn);\n } catch (error) {\n if (isModuleNotFoundError(error)) {\n return await fn();\n }\n throw error;\n }\n}\n\ninterface TenantOptionSources {\n memberships: Membership[];\n tenantById: Map<string, Tenant>;\n roleById: Map<string, Role>;\n}\n\n/**\n * Server implementation of the `/api/mobile` auth + session contract.\n *\n * Framework-agnostic: methods take plain wire DTOs and header strings and\n * return wire DTOs or throw {@link MobileAuthError}. The SvelteKit adapters\n * live in `@happyvertical/smrt-users/sveltekit`\n * (`createMobileAuthHandlers`).\n */\nexport class MobileAuthService {\n private readonly options: MobileAuthServiceOptions;\n private readonly classOptions: SmrtClassOptions;\n private readonly sessionTtl: number;\n private readonly transactionTtl: number;\n private sessionService!: SessionService;\n private userCollection!: UserCollection;\n private membershipCollection!: MembershipCollection;\n private roleCollection!: RoleCollection;\n private tenantCollection!: TenantCollection;\n /** Per-(provider, redirectUri) service cache preserving metadata caches. */\n private readonly oidcServices = new Map<string, OidcLoginService>();\n\n constructor(options: MobileAuthServiceOptions) {\n const {\n fetch: _fetch,\n clockTolerance: _clockTolerance,\n redirectUris: _redirectUris,\n sessionTtl,\n transactionTtl,\n stateSecret: _stateSecret,\n allowUnsignedState: _allowUnsignedState,\n includeInheritedTenants: _includeInheritedTenants,\n allowUnverifiedEmail: _allowUnverifiedEmail,\n resolveUser: _resolveUser,\n resolveTenantId: _resolveTenantId,\n buildExtras: _buildExtras,\n defaultProvider: _defaultProvider,\n providers: _providers,\n ...classOptions\n } = options;\n this.options = options;\n this.classOptions = classOptions;\n this.sessionTtl =\n sessionTtl && sessionTtl > 0\n ? Math.floor(sessionTtl)\n : DEFAULT_MOBILE_SESSION_TTL_SECONDS;\n this.transactionTtl =\n transactionTtl && transactionTtl > 0\n ? Math.floor(transactionTtl)\n : DEFAULT_MOBILE_TRANSACTION_TTL_SECONDS;\n }\n\n private async initialize(): Promise<void> {\n this.sessionService = await SessionService.create({\n ...this.classOptions,\n defaultTTL: this.sessionTtl,\n });\n this.userCollection = await UserCollection.create(this.classOptions);\n this.membershipCollection = await MembershipCollection.create(\n withoutListBounds(this.classOptions),\n );\n this.roleCollection = await RoleCollection.create(this.classOptions);\n this.tenantCollection = await TenantCollection.create(this.classOptions);\n }\n\n static async create(\n options: MobileAuthServiceOptions,\n ): Promise<MobileAuthService> {\n const service = new MobileAuthService(options);\n await service.initialize();\n return service;\n }\n\n /**\n * The underlying {@link SessionService}. Exposed so route guards can share\n * it with `withSessionPermissionContext` instead of minting a second one.\n */\n getSessionService(): SessionService {\n return this.sessionService;\n }\n\n private resolveProvider(requested: string | null | undefined) {\n try {\n return resolveOidcProviderConfig(\n normalizeOptionalString(requested),\n this.options,\n );\n } catch (error) {\n const message =\n error instanceof OidcLoginError\n ? error.message\n : 'Unknown mobile auth provider.';\n throw new MobileAuthError(400, 'unknown_provider', message);\n }\n }\n\n private getOidcService(\n providerName: string,\n redirectUri: string,\n ): OidcLoginService {\n const key = `${providerName}\\n${redirectUri}`;\n const cached = this.oidcServices.get(key);\n if (cached) {\n // LRU: re-insert so the hot entry moves to the newest slot and eviction\n // drops a genuinely-cold provider rather than the one in active use.\n this.oidcServices.delete(key);\n this.oidcServices.set(key, cached);\n return cached;\n }\n\n const { provider } = this.resolveProvider(providerName);\n const service = new OidcLoginService({\n ...this.classOptions,\n fetch: this.options.fetch,\n clockTolerance: this.options.clockTolerance,\n provider: { ...provider, redirectUri },\n providerName,\n });\n\n // Bounded cache: redirect URIs are allow-list validated before we get\n // here, but a no-allow-list dev setup must not grow this unboundedly.\n // Map iteration is insertion-order, so with re-insert-on-hit above the\n // first key is the least-recently-used entry.\n if (this.oidcServices.size >= MAX_OIDC_SERVICE_CACHE) {\n const lru = this.oidcServices.keys().next().value;\n if (lru !== undefined) this.oidcServices.delete(lru);\n }\n this.oidcServices.set(key, service);\n return service;\n }\n\n /**\n * The HMAC secret for state signing, or `undefined` when unsigned tokens\n * are explicitly permitted via {@link MobileAuthServiceOptions.allowUnsignedState}.\n * Fails closed (throws → 500 `server_misconfigured`) when no secret is\n * available and unsigned tokens are not opted in, so a deployment can never\n * silently fall back to forgeable state tokens.\n */\n private stateSecretFor(provider: {\n clientSecret?: string;\n }): string | undefined {\n const secret = this.options.stateSecret ?? provider.clientSecret;\n if (secret && secret.length > 0) {\n return secret;\n }\n if (this.options.allowUnsignedState === true) {\n return undefined;\n }\n throw new MobileAuthError(\n 500,\n 'server_misconfigured',\n 'Mobile auth is not configured for signed state. Set a stateSecret (or provider clientSecret), or opt into allowUnsignedState.',\n );\n }\n\n /**\n * `POST /api/mobile/auth/start` — begin the server-brokered PKCE\n * handshake. Returns the authorization URL plus the `state` and\n * `codeVerifier` the client must persist and echo back on complete.\n */\n async start(input: MobileAuthStartRequest): Promise<MobileAuthStartResponse> {\n const resolution = this.resolveProvider(input.providerId);\n const redirectUri = validateMobileRedirectUri(\n input.redirectUri,\n this.options.redirectUris,\n );\n\n const clientState = normalizeOptionalString(input.state);\n if (clientState && clientState.length > MAX_CLIENT_STATE_LENGTH) {\n throw new MobileAuthError(\n 400,\n 'invalid_request',\n `Client state exceeds ${MAX_CLIENT_STATE_LENGTH} characters.`,\n );\n }\n\n const service = this.getOidcService(resolution.providerName, redirectUri);\n const base = service.createTransaction();\n const state = await encodeMobileState(\n {\n v: 1,\n s: randomBase64Url(16),\n n: base.nonce,\n p: resolution.providerName,\n t: Date.now(),\n c: clientState,\n },\n this.stateSecretFor(resolution.provider),\n );\n const transaction: OidcTransaction = { ...base, state };\n\n const scopes = Array.isArray(input.scopes)\n ? input.scopes\n .filter((scope): scope is string => typeof scope === 'string')\n .map((scope) => scope.trim())\n .filter(Boolean)\n : [];\n const loginHint = normalizeOptionalString(input.loginHint);\n\n let url: URL;\n try {\n ({ url } = await service.createAuthorizationUrl({\n transaction,\n authorizationParams: {\n ...(scopes.length > 0 ? { scope: scopes.join(' ') } : {}),\n ...(loginHint ? { login_hint: loginHint } : {}),\n },\n }));\n } catch (error) {\n const message =\n error instanceof OidcLoginError\n ? error.message\n : 'Mobile auth provider is unavailable.';\n throw new MobileAuthError(502, 'provider_unavailable', message);\n }\n\n return {\n providerId: resolution.providerName,\n authorizationUrl: url.toString(),\n state,\n codeVerifier: transaction.codeVerifier,\n nonce: transaction.nonce,\n redirectUri,\n };\n }\n\n /**\n * `POST /api/mobile/auth/complete` — exchange the authorization code (with\n * the echoed `state` + `codeVerifier`) for a mobile bearer session.\n */\n async complete(\n input: MobileAuthCompleteRequest,\n meta: MobileRequestMeta = {},\n ): Promise<MobileAuthSession> {\n const code = normalizeOptionalString(input.code);\n if (!code) {\n throw new MobileAuthError(\n 400,\n 'invalid_request',\n 'Missing authorization code.',\n );\n }\n const rawState = normalizeOptionalString(input.state);\n if (!rawState) {\n throw new MobileAuthError(\n 401,\n 'invalid_state',\n 'Missing mobile auth state.',\n );\n }\n const codeVerifier = normalizeOptionalString(input.codeVerifier);\n if (!codeVerifier) {\n throw new MobileAuthError(\n 400,\n 'missing_code_verifier',\n 'Missing PKCE code verifier.',\n );\n }\n const redirectUri = validateMobileRedirectUri(\n input.redirectUri,\n this.options.redirectUris,\n );\n\n // The state token names the provider the handshake was started for; a\n // client-supplied providerId must agree with it.\n const requestedProvider = normalizeOptionalString(input.providerId);\n const probe = this.resolveProvider(requestedProvider);\n const payload = await decodeMobileState(\n rawState,\n this.stateSecretFor(probe.provider),\n );\n if (payload.p !== probe.providerName) {\n throw new MobileAuthError(\n 401,\n 'invalid_state',\n 'Mobile auth state does not match the requested provider.',\n );\n }\n const age = Date.now() - payload.t;\n if (age > this.transactionTtl * 1000 || age < -STATE_TOKEN_CLOCK_SKEW_MS) {\n throw new MobileAuthError(\n 401,\n 'expired_transaction',\n 'Mobile auth handshake has expired. Start a new sign-in.',\n );\n }\n\n const transaction: OidcTransaction = {\n codeVerifier,\n createdAt: payload.t,\n nonce: payload.n,\n provider: payload.p,\n state: rawState,\n };\n\n const service = this.getOidcService(probe.providerName, redirectUri);\n const callbackUrl = new URL(redirectUri);\n callbackUrl.searchParams.set('code', code);\n callbackUrl.searchParams.set('state', rawState);\n\n let claims: OidcClaims;\n let tokens: OidcTokenSet;\n try {\n ({ claims, tokens } = await service.exchangeCallback(\n callbackUrl,\n transaction,\n ));\n } catch (error) {\n const message =\n error instanceof OidcLoginError\n ? error.message\n : 'Mobile auth code exchange failed.';\n throw new MobileAuthError(401, 'exchange_failed', message);\n }\n\n const resolved = await this.resolveUserFromLogin({\n claims,\n tokens,\n providerName: probe.providerName,\n });\n if (!resolved?.id) {\n throw new MobileAuthError(\n 403,\n 'signin_not_permitted',\n 'This account is not permitted to sign in.',\n );\n }\n\n const tenants = await this.listTenantOptions(resolved.id);\n const tenantId = await this.resolveSessionTenantId(\n { userId: resolved.id, claims, providerName: probe.providerName },\n tenants,\n );\n\n const sessionId = await this.sessionService.createSession(\n resolved.id,\n tenantId ?? undefined,\n {\n ttl: this.sessionTtl,\n userAgent: meta.userAgent,\n ipAddress: meta.ipAddress,\n authMethod: 'mobile',\n data: {\n source: 'mobile',\n oidcProvider: probe.providerName,\n // Cap the stored IdP-sourced strings so a hostile/misbehaving IdP\n // cannot bloat every session row (iss is already constrained to the\n // configured issuer; sub is bounded defensively).\n oidcIssuer: claims.iss.slice(0, MAX_STORED_CLAIM_LENGTH),\n oidcSubject: claims.sub.slice(0, MAX_STORED_CLAIM_LENGTH),\n },\n },\n );\n\n const email = resolved.email ?? claims.email ?? '';\n return {\n accessToken: sessionId,\n tokenType: 'Bearer',\n expiresAt: new Date(Date.now() + this.sessionTtl * 1000).toISOString(),\n user: this.toUserSummary(resolved.id, email),\n activeTenant: tenants.find((tenant) => tenant.id === tenantId) ?? null,\n tenants,\n };\n }\n\n private async resolveUserFromLogin(\n context: MobileLoginContext,\n ): Promise<MobileResolvedUser | null | undefined> {\n if (this.options.resolveUser) {\n return this.options.resolveUser(context);\n }\n const result = await this.userCollection.getOrCreateFromOidc(\n context.claims,\n context.providerName,\n { allowUnverifiedEmail: this.options.allowUnverifiedEmail },\n );\n const id = result.user.id as string | undefined;\n if (!id) return null;\n return { id, email: result.user.email };\n }\n\n private async resolveSessionTenantId(\n context: MobileTenantContext,\n tenants: MobileTenantOption[],\n ): Promise<string | null> {\n if (this.options.resolveTenantId) {\n const chosen = await this.options.resolveTenantId(context);\n if (chosen !== undefined) return chosen;\n }\n // Default: the first DIRECT membership tenant (options are sorted by\n // name; inherited descendants are excluded because `switchTenant` — and\n // any flow that verifies direct membership — must accept the default).\n const direct = await runWithSystemContext(() =>\n this.membershipCollection.findActiveByUser(context.userId),\n );\n const directIds = new Set(\n direct\n .map((membership) => membership.tenantId)\n .filter((id): id is string => Boolean(id)),\n );\n return tenants.find((tenant) => directIds.has(tenant.id))?.id ?? null;\n }\n\n /**\n * `GET /api/mobile/session` — bootstrap the app from a bearer token.\n * Throws 401 when the token is missing, unknown, expired, or revoked.\n */\n async bootstrap(\n authorizationHeader: string | null | undefined,\n ): Promise<MobileSessionBootstrap> {\n const context = await this.resolveSessionContext(authorizationHeader);\n const userId = context.user.id as string;\n const tenants = await this.listTenantOptions(userId);\n const activeTenant =\n tenants.find((tenant) => tenant.id === context.tenantId) ?? null;\n\n const extras = this.options.buildExtras\n ? await this.options.buildExtras({\n session: context,\n permissions: context.permissions,\n tenants,\n activeTenant,\n })\n : undefined;\n\n return {\n user: this.toUserSummary(userId, context.user.email ?? ''),\n activeTenant,\n tenants,\n ...(extras ? { extras } : {}),\n };\n }\n\n /**\n * Resolve a bearer header into a full {@link SessionContext} (user,\n * membership, resolved permissions, tenant). Throws {@link MobileAuthError}\n * with the 401 semantics the mobile client's re-auth flow expects.\n */\n async resolveSessionContext(\n authorizationHeader: string | null | undefined,\n ): Promise<SessionContext> {\n const token = readMobileBearerToken(authorizationHeader);\n if (!token) {\n throw new MobileAuthError(\n 401,\n 'missing_bearer_token',\n 'Missing mobile bearer token.',\n );\n }\n // System context: session loading resolves permissions across the\n // user's memberships, which strict tenancy interceptors reject outside\n // an explicit context. Request-scoped tenant entry belongs to the route\n // guard (`withSessionPermissionContext`), not here.\n const context = await runWithSystemContext(() =>\n this.sessionService.loadSessionContext(token),\n );\n if (!context?.user?.id) {\n throw new MobileAuthError(\n 401,\n 'invalid_bearer_token',\n 'Invalid or expired mobile bearer token.',\n );\n }\n return context;\n }\n\n /**\n * `DELETE /api/mobile/session` — revoke the bearer session. Idempotent:\n * a missing or unknown token reports `destroyed: false` with 200.\n */\n async logout(\n authorizationHeader: string | null | undefined,\n ): Promise<MobileLogoutResult> {\n const token = readMobileBearerToken(authorizationHeader);\n if (!token) return { ok: true, destroyed: false };\n const destroyed = await this.sessionService.destroySession(token);\n return { ok: true, destroyed };\n }\n\n /**\n * The user's selectable tenants: direct ACTIVE memberships plus — when\n * `includeInheritedTenants` is on (default) — descendant tenants reachable\n * through an ACTIVE membership whose role has `inheritsToDescendants:\n * true` (#1867). Selection mirrors the permission resolver: the NEAREST\n * flagged ancestor membership labels an inherited option, unflagged or\n * inactive ancestors neither confer nor block, and ANY direct membership\n * row on a tenant pins it (active → its own role; inactive → excluded,\n * since a pinned inactive row resolves to the empty permission set).\n *\n * This list is informational — per-request authorization always re-runs\n * through `PermissionResolver`, which additionally fail-closes on\n * malformed hierarchy paths.\n */\n async listTenantOptions(userId: string): Promise<MobileTenantOption[]> {\n // One system-context entry for the whole cross-tenant computation (session\n // resolution and tenant enumeration span tenants, so a single-tenant\n // context would be wrong); the nested reads below inherit it.\n return runWithSystemContext(() => this.buildTenantOptions(userId));\n }\n\n private async buildTenantOptions(\n userId: string,\n ): Promise<MobileTenantOption[]> {\n const { memberships, tenantById, roleById } =\n await this.loadTenantOptionSources(userId);\n\n const active = memberships.filter(\n (membership) => membership.isActive() && membership.tenantId,\n );\n // Pin from ALL rows (any status), NOT just active ones: a direct\n // membership row always pins its tenant in the resolver, and an INACTIVE\n // direct row pins to the empty set. So an inactive direct row on a\n // descendant must EXCLUDE that descendant from the inherited list (below)\n // — narrowing this to active-only would wrongly surface it as inherited.\n const pinnedTenantIds = new Set(\n memberships\n .map((membership) => membership.tenantId)\n .filter((id): id is string => Boolean(id)),\n );\n\n const options: MobileTenantOption[] = [];\n for (const membership of active) {\n const tenant = tenantById.get(membership.tenantId as string);\n if (!tenant?.id) continue;\n const role = membership.roleId\n ? roleById.get(membership.roleId)\n : undefined;\n options.push(this.toTenantOption(tenant, role));\n }\n\n if (this.options.includeInheritedTenants !== false) {\n const activeByTenant = new Map<string, Membership>();\n for (const membership of active) {\n activeByTenant.set(membership.tenantId as string, membership);\n }\n const isFlagged = (membership: Membership | undefined): boolean => {\n const role = membership?.roleId\n ? roleById.get(membership.roleId)\n : undefined;\n return role?.inheritsToDescendants === true;\n };\n\n // Batch the descendant reads across all flagged memberships instead of\n // awaiting one per membership in series.\n const flaggedTenantIds = active\n .filter(isFlagged)\n .map((membership) => membership.tenantId as string);\n const descendantLists = await Promise.all(\n flaggedTenantIds.map((tenantId) =>\n this.tenantCollection.getDescendants(tenantId),\n ),\n );\n\n const candidates = new Map<string, Tenant>();\n for (const descendants of descendantLists) {\n for (const descendant of descendants) {\n if (!descendant.id) continue;\n if (pinnedTenantIds.has(descendant.id)) continue;\n if (!candidates.has(descendant.id)) {\n candidates.set(descendant.id, descendant);\n }\n }\n }\n\n for (const descendant of candidates.values()) {\n // Nearest ancestor first (getAncestorIds is root → parent order).\n const ancestorIds = descendant.getAncestorIds();\n for (let i = ancestorIds.length - 1; i >= 0; i -= 1) {\n const ancestorMembership = activeByTenant.get(ancestorIds[i]);\n if (!isFlagged(ancestorMembership)) continue;\n const role = roleById.get(ancestorMembership?.roleId as string);\n options.push(this.toTenantOption(descendant, role));\n break;\n }\n }\n }\n\n return options.sort(\n (a, b) =>\n (a.name ?? '').localeCompare(b.name ?? '', undefined, {\n sensitivity: 'base',\n }) || a.id.localeCompare(b.id),\n );\n }\n\n private async loadTenantOptionSources(\n userId: string,\n ): Promise<TenantOptionSources> {\n const memberships = await this.membershipCollection.findByUser(userId);\n const active = memberships.filter(\n (membership) => membership.isActive() && membership.tenantId,\n );\n\n const tenantIds = [\n ...new Set(active.map((membership) => membership.tenantId as string)),\n ];\n const roleIds = [\n ...new Set(\n active\n .map((membership) => membership.roleId)\n .filter((id): id is string => Boolean(id)),\n ),\n ];\n\n const [tenants, roles] = await Promise.all([\n tenantIds.length > 0\n ? this.tenantCollection.listByIds(tenantIds)\n : Promise.resolve([]),\n roleIds.length > 0\n ? this.roleCollection.listByIds(roleIds)\n : Promise.resolve([]),\n ]);\n\n return {\n memberships,\n tenantById: new Map(\n tenants\n .filter((tenant): tenant is Tenant => Boolean(tenant?.id))\n .map((tenant) => [tenant.id as string, tenant]),\n ),\n roleById: new Map(\n roles\n .filter((role): role is Role => Boolean(role?.id))\n .map((role) => [role.id as string, role]),\n ),\n };\n }\n\n private toTenantOption(tenant: Tenant, role: Role | undefined) {\n return {\n id: tenant.id as string,\n name: tenant.name ?? '',\n slug: tenant.slug ?? '',\n roleSlug: role?.slug ?? '',\n roleLabel: role?.name || role?.slug || '',\n } satisfies MobileTenantOption;\n }\n\n private toUserSummary(id: string, email: string): MobileUserSummary {\n return { id, email, label: email || id };\n }\n}\n","/**\n * Request-scoped session permission context helpers\n * @packageDocumentation\n */\n\nimport { AsyncLocalStorage } from 'node:async_hooks';\nimport { getPackageConfig } from '@happyvertical/smrt-config';\nimport type { SmrtClassOptions } from '@happyvertical/smrt-core';\nimport type { DatabaseInterface } from '@happyvertical/sql';\nimport type { Membership } from '../models/Membership.js';\nimport { PermissionResolver } from './PermissionResolver.js';\nimport {\n type SessionContext,\n SessionService,\n type SessionServiceOptions,\n} from './SessionService.js';\n\ninterface QueryableDatabase extends DatabaseInterface {\n beginTransaction?: () => Promise<TransactionDatabase>;\n url: string;\n}\n\ninterface TransactionDatabase extends QueryableDatabase {\n commit: () => Promise<void>;\n isActive: () => boolean;\n rollback: () => Promise<void>;\n}\n\nexport interface SessionPermissionRuntimeContext {\n database?: QueryableDatabase;\n permissions: string[];\n permissionSet: Set<string>;\n membership: SessionContext['membership'];\n postgresRls: boolean;\n session: SessionContext | null;\n sessionId: string | null;\n superAdminBypass: boolean;\n systemContext: boolean;\n tenantId: string | null;\n user: SessionContext['user'] | null;\n userId: string | null;\n}\n\nexport interface SessionPermissionRuntimeOptions extends SmrtClassOptions {\n enterTenantContext?: boolean;\n postgresRls?: boolean;\n sessionId?: string | null;\n sessionService?: SessionService;\n superAdminBypass?: boolean;\n systemContext?: boolean;\n}\n\n/**\n * Options for {@link withPrincipalPermissionContext}.\n *\n * Where {@link SessionPermissionRuntimeOptions} sources the principal from a\n * loaded session, this sources it directly from a `(userId, tenantId)` pair —\n * used to run work AS a bound principal (e.g. an agent persona's `runAsUserId`)\n * with that principal's *live* resolved permissions.\n */\nexport interface PrincipalPermissionRuntimeOptions extends SmrtClassOptions {\n /** Enter tenant context so tenant auto-filtering applies on every adapter. */\n enterTenantContext?: boolean;\n /**\n * Raw membership row for the `(userId, tenantId)` pair, forwarded to\n * {@link PermissionResolver.resolvePermissions}. Only consulted when\n * `permissions` is not supplied. Pass `null` to assert \"no direct membership\"\n * (enabling opt-in ancestor inheritance); leave `undefined` to let the\n * resolver look it up.\n */\n membership?: Membership | null;\n /**\n * Pre-resolved permission slugs. When omitted, the principal's permissions\n * are resolved LIVE via {@link PermissionResolver.resolvePermissions} so role\n * changes reflect on the next call.\n */\n permissions?: string[];\n /** Opt into Postgres RLS transaction wrapping (defaults to package config). */\n postgresRls?: boolean;\n /** Reuse an initialized resolver instead of creating one per call. */\n resolver?: PermissionResolver;\n /** Tenant the principal acts within. `null` resolves to no permissions. */\n tenantId: string | null;\n /** The user whose live permissions bound this execution. */\n userId: string;\n}\n\n/**\n * The controls shared by both permission-context entry points that influence\n * transaction wrapping and tenant-context entry.\n */\ninterface PermissionRuntimeControls {\n enterTenantContext?: boolean;\n postgresRls?: boolean;\n systemContext?: boolean;\n}\n\ntype PermissionRuntimeDatabaseConfig =\n | SmrtClassOptions['db']\n | SmrtClassOptions['persistence'];\n\ndeclare global {\n // eslint-disable-next-line no-var\n var __smrtGetRequestPermissionContext:\n | (() => SessionPermissionRuntimeContext | undefined)\n | undefined;\n // `__smrtGetRequestScopedDatabase` is declared canonically by\n // @happyvertical/smrt-core (see DatabaseConfig in core/src/database.ts).\n // Redeclaring it here with the package-private QueryableDatabase type broke\n // consumer type-checking (#2342); QueryableDatabase extends DatabaseInterface\n // and so already satisfies the canonical DatabaseConfig signature.\n}\n\n// globalThis key for the shared AsyncLocalStorage. Bundler pipelines can\n// evaluate this module more than once from a single copy on disk; a\n// module-local storage would strand context entered through one instance\n// (the `globalThis.__smrtGetRequestPermissionContext` getter below only helps\n// readers reach the FIRST instance's storage — a second instance running\n// `.run()` would still be invisible). Symbol.for() resolves identically in\n// every instance, so all of them share the one storage.\nconst PERMISSION_STORAGE_KEY = Symbol.for(\n 'smrt:session-permission-context-storage',\n);\n\nfunction resolvePermissionContextStorage(): AsyncLocalStorage<SessionPermissionRuntimeContext> {\n const root = globalThis as typeof globalThis & {\n [PERMISSION_STORAGE_KEY]?: AsyncLocalStorage<SessionPermissionRuntimeContext>;\n };\n root[PERMISSION_STORAGE_KEY] ??=\n new AsyncLocalStorage<SessionPermissionRuntimeContext>();\n return root[PERMISSION_STORAGE_KEY];\n}\n\nconst requestPermissionContextStorage = resolvePermissionContextStorage();\n\nexport function getCurrentSessionPermissionContext():\n | SessionPermissionRuntimeContext\n | undefined {\n return requestPermissionContextStorage.getStore();\n}\n\nexport function getRequestScopedDatabase(): QueryableDatabase | undefined {\n return getCurrentSessionPermissionContext()?.database;\n}\n\nglobalThis.__smrtGetRequestPermissionContext ??=\n getCurrentSessionPermissionContext;\nglobalThis.__smrtGetRequestScopedDatabase ??= getRequestScopedDatabase;\n\nfunction isProbablyPostgres(\n configDb: SmrtClassOptions['db'],\n database: QueryableDatabase,\n): boolean {\n if (\n configDb &&\n typeof configDb === 'object' &&\n !('query' in configDb) &&\n 'type' in configDb &&\n configDb.type === 'postgres'\n ) {\n return true;\n }\n\n if (typeof database.url === 'string' && database.url.startsWith('postgres')) {\n return true;\n }\n\n return (database.constructor?.name || '').toLowerCase().includes('postgres');\n}\n\nasync function setPostgresSessionVariables(\n database: QueryableDatabase,\n context: SessionPermissionRuntimeContext,\n): Promise<void> {\n await database.query(\n \"SELECT set_config('smrt.tenant_id', $1, true)\",\n context.tenantId ?? '',\n );\n await database.query(\n \"SELECT set_config('smrt.user_id', $1, true)\",\n context.userId ?? '',\n );\n await database.query(\n \"SELECT set_config('smrt.session_id', $1, true)\",\n context.sessionId ?? '',\n );\n await database.query(\n \"SELECT set_config('smrt.permissions', $1, true)\",\n JSON.stringify(context.permissions),\n );\n await database.query(\n \"SELECT set_config('smrt.super_admin_bypass', $1, true)\",\n context.superAdminBypass ? 'true' : 'false',\n );\n await database.query(\n \"SELECT set_config('smrt.system_context', $1, true)\",\n context.systemContext ? 'true' : 'false',\n );\n}\n\nfunction isModuleNotFoundError(error: unknown): boolean {\n return (\n error instanceof Error &&\n ((error as NodeJS.ErrnoException).code === 'ERR_MODULE_NOT_FOUND' ||\n /Cannot find package '@happyvertical\\/smrt-tenancy'/.test(error.message))\n );\n}\n\nasync function runWithOptionalTenantContext<T>(\n controls: PermissionRuntimeControls,\n context: SessionPermissionRuntimeContext,\n fn: () => Promise<T>,\n): Promise<T> {\n if (controls.systemContext) {\n try {\n const tenancy = await import('@happyvertical/smrt-tenancy');\n return await tenancy.withSystemContext(fn);\n } catch (error) {\n if (isModuleNotFoundError(error)) {\n return await fn();\n }\n throw error;\n }\n }\n\n if (!controls.enterTenantContext || !context.tenantId) {\n return await fn();\n }\n\n try {\n const tenancy = await import('@happyvertical/smrt-tenancy');\n return await tenancy.withTenant(\n {\n database: context.database,\n permissions: context.permissionSet,\n superAdminBypass: context.superAdminBypass,\n tenantId: context.tenantId,\n user: context.user ?? undefined,\n userId: context.userId ?? undefined,\n },\n fn,\n );\n } catch (error) {\n if (isModuleNotFoundError(error)) {\n return await fn();\n }\n throw error;\n }\n}\n\n/**\n * Shared runtime: given an already-resolved principal `spec` and the base\n * database, optionally open a Postgres RLS transaction, publish the principal\n * onto the DB session (`set_config(..., is_local=true)`), and run `fn` inside\n * the request-scoped ALS store (and optional tenant context).\n *\n * Both {@link withSessionPermissionContext} (principal from a loaded session)\n * and {@link withPrincipalPermissionContext} (principal from a `userId` +\n * live-resolved permissions) funnel through here, so the transaction lifecycle\n * and the exact DB-session publication stay identical no matter which door the\n * principal entered through.\n */\nasync function runWithinPermissionRuntime<T>(\n controls: PermissionRuntimeControls,\n configuredDb: PermissionRuntimeDatabaseConfig,\n baseDatabase: QueryableDatabase,\n spec: {\n permissions: string[];\n membership: SessionContext['membership'];\n session: SessionContext | null;\n sessionId: string | null;\n superAdminBypass: boolean;\n systemContext: boolean;\n tenantId: string | null;\n user: SessionContext['user'] | null;\n userId: string | null;\n },\n fn: (context: SessionPermissionRuntimeContext) => Promise<T>,\n): Promise<T> {\n const config = getPackageConfig<{\n permissions?: { postgres?: { enabled?: boolean } };\n }>('users', {});\n const usePostgresRls =\n (controls.postgresRls ?? config.permissions?.postgres?.enabled ?? false) &&\n isProbablyPostgres(configuredDb, baseDatabase);\n\n let transaction: TransactionDatabase | undefined;\n let rolledBack = false;\n if (usePostgresRls) {\n if (!baseDatabase.beginTransaction) {\n throw new Error(\n 'Postgres RLS requires a database adapter that supports beginTransaction().',\n );\n }\n transaction = await baseDatabase.beginTransaction();\n }\n\n const runtimeContext: SessionPermissionRuntimeContext = {\n database: transaction ?? baseDatabase,\n permissions: spec.permissions,\n permissionSet: new Set(spec.permissions),\n membership: spec.membership,\n postgresRls: usePostgresRls,\n session: spec.session,\n sessionId: spec.sessionId,\n superAdminBypass: spec.superAdminBypass,\n systemContext: spec.systemContext,\n tenantId: spec.tenantId,\n user: spec.user,\n userId: spec.userId,\n };\n\n try {\n if (transaction) {\n await setPostgresSessionVariables(transaction, runtimeContext);\n }\n\n return await requestPermissionContextStorage.run(runtimeContext, async () =>\n runWithOptionalTenantContext(controls, runtimeContext, () =>\n fn(runtimeContext),\n ),\n );\n } catch (error) {\n if (transaction) {\n const active = transaction.isActive ? transaction.isActive() : true;\n if (active) {\n rolledBack = true;\n await transaction.rollback();\n }\n }\n throw error;\n } finally {\n if (transaction && !rolledBack) {\n const active = transaction.isActive ? transaction.isActive() : true;\n if (active) {\n await transaction.commit();\n }\n }\n }\n}\n\nexport async function withSessionPermissionContext<T>(\n options: SessionPermissionRuntimeOptions,\n fn: (context: SessionPermissionRuntimeContext) => Promise<T>,\n): Promise<T> {\n const {\n enterTenantContext: _enterTenantContext,\n postgresRls: _postgresRls,\n sessionId: _sessionId,\n sessionService: _sessionService,\n superAdminBypass: _superAdminBypass,\n systemContext: _systemContext,\n ...sessionServiceOptions\n } = options;\n const sessionService =\n options.sessionService ??\n (await SessionService.create({\n ...sessionServiceOptions,\n } as SessionServiceOptions));\n const configuredDb =\n (sessionServiceOptions as SessionServiceOptions).db ??\n (sessionServiceOptions as SessionServiceOptions).persistence;\n const session =\n options.sessionId === undefined || options.sessionId === null\n ? null\n : await sessionService.loadSessionContext(options.sessionId);\n const baseDatabase = sessionService.getDatabase() as QueryableDatabase;\n // A session under a permission ceiling (#3276) is capped by policy that\n // bypass and system context would void, so it never receives either —\n // whatever the host asked for on this request.\n const ceilinged = Array.isArray(session?.permissionCeiling);\n const superAdminBypass = !ceilinged && (options.superAdminBypass ?? false);\n const systemContext = !ceilinged && (options.systemContext ?? false);\n\n return runWithinPermissionRuntime(\n {\n enterTenantContext: options.enterTenantContext,\n postgresRls: options.postgresRls,\n systemContext,\n },\n configuredDb,\n baseDatabase,\n {\n permissions: session?.permissions ?? [],\n membership: session?.membership ?? null,\n session,\n sessionId: session?.sessionId ?? null,\n superAdminBypass,\n systemContext,\n tenantId: session?.tenantId ?? null,\n user: session?.user ?? null,\n userId: session?.user.id ?? null,\n },\n fn,\n );\n}\n\n/**\n * Run `fn` AS a bound principal — a `(userId, tenantId)` pair rather than a\n * session — inside a session-permission context carrying that principal's\n * **live** resolved permissions.\n *\n * This is the door-agnostic mechanism behind \"execute as principal\": it does\n * NOT introduce a new authorization layer. It resolves the principal's\n * permissions through the standard {@link PermissionResolver} cascade (unless\n * the caller passes a pre-resolved set) and publishes `(smrt.user_id,\n * smrt.tenant_id, smrt.permissions[])` onto the DB session exactly like\n * {@link withSessionPermissionContext}, so the manifest-derived Postgres RLS\n * policies bound every query on that session per-`(table, action)`.\n *\n * A principal run never bypasses: `super_admin_bypass` and `system_context`\n * are always published as `false`. Resolution runs on the base connection\n * BEFORE any RLS transaction opens (identical ordering to session loading), so\n * the trusted cascade is never bounded by the not-yet-published principal.\n *\n * With RLS off (SQLite/dev) the same permission set is still resolved and\n * carried, but the DB has no per-operation teeth — callers relying on this on a\n * non-Postgres adapter must additionally assert the catalog permission for the\n * `(collection, action)` at their tool/exec seam (see\n * `assertOperationPermission`).\n */\nexport async function withPrincipalPermissionContext<T>(\n options: PrincipalPermissionRuntimeOptions,\n fn: (context: SessionPermissionRuntimeContext) => Promise<T>,\n): Promise<T> {\n const {\n enterTenantContext: _enterTenantContext,\n membership,\n permissions: providedPermissions,\n postgresRls: _postgresRls,\n resolver: providedResolver,\n tenantId,\n userId,\n ...serviceOptions\n } = options;\n\n // Reuse SessionService purely as the blessed database accessor — no session\n // is loaded on this path; the principal comes straight from (userId,\n // tenantId).\n const sessionService = await SessionService.create({\n ...serviceOptions,\n } as SessionServiceOptions);\n const configuredDb =\n (serviceOptions as SessionServiceOptions).db ??\n (serviceOptions as SessionServiceOptions).persistence;\n const baseDatabase = sessionService.getDatabase() as QueryableDatabase;\n\n // Resolve the bound principal's LIVE permission set unless the caller passed\n // one explicitly. Distinguish \"not provided\" (`undefined` → resolve live)\n // from \"explicitly empty\" (`[]` → run with ZERO permissions): a truthy test\n // would treat an intentional empty set as \"not provided\" and fail open. A\n // missing tenant likewise resolves to no permissions (fail closed).\n let permissions: string[];\n if (providedPermissions !== undefined) {\n permissions = providedPermissions;\n } else if (tenantId) {\n const resolver =\n providedResolver ??\n (await PermissionResolver.create({\n ...serviceOptions,\n } as SmrtClassOptions));\n const resolved = await resolver.resolvePermissions(\n userId,\n tenantId,\n membership === undefined ? {} : { membership },\n );\n permissions = Array.from(resolved.permissions);\n } else {\n permissions = [];\n }\n\n return runWithinPermissionRuntime(\n {\n enterTenantContext: options.enterTenantContext,\n postgresRls: options.postgresRls,\n systemContext: false,\n },\n configuredDb,\n baseDatabase,\n {\n permissions,\n membership: null,\n session: null,\n sessionId: null,\n superAdminBypass: false,\n systemContext: false,\n tenantId: tenantId ?? null,\n user: null,\n userId,\n },\n fn,\n );\n}\n","/**\n * Reusable operation-level permission guard for hand-written server surfaces.\n * @packageDocumentation\n */\n\nimport type { SmrtClassOptions } from '@happyvertical/smrt-core';\nimport {\n deriveOperationPermissionSlug,\n type OperationPermissionCollectionInput,\n type PermissionCatalog,\n PermissionCatalogService,\n} from './PermissionCatalogService.js';\nimport {\n type PermissionResolutionOptions,\n PermissionResolver,\n} from './PermissionResolver.js';\nimport { getCurrentSessionPermissionContext } from './SessionPermissionContext.js';\n\nexport type OperationPermissionDenyReason =\n | 'invalid_operation'\n | 'missing_principal'\n | 'resolution_error'\n | 'unknown_permission'\n | 'permission_denied';\n\nexport type OperationPermissionAllowReason =\n | 'permission_granted'\n | 'super_admin_bypass'\n | 'system_context_bypass';\n\nexport interface OperationPermissionDecision {\n allowed: boolean;\n permission: string | null;\n reason: OperationPermissionAllowReason | OperationPermissionDenyReason;\n error?: unknown;\n}\n\nexport interface OperationPermissionOptions\n extends SmrtClassOptions,\n PermissionResolutionOptions {\n /**\n * Collection slug, model class, model instance, or collection instance.\n */\n collection: OperationPermissionCollectionInput;\n /**\n * Operation action. `list` and `get` normalize to the catalog's `.read`.\n */\n action: string;\n /**\n * Default true. When false, a super-admin tenant context must still hold the\n * resolved permission.\n */\n allowSuperAdminBypass?: boolean;\n /**\n * Default true. System context represents trusted server-side execution.\n */\n allowSystemContextBypass?: boolean;\n catalog?: PermissionCatalog;\n onDeny?: 'return' | 'throw';\n resolver?: PermissionResolver;\n tenantId?: string | null;\n userId?: string | null;\n /**\n * When provided, authorize against THIS exact permission set instead of\n * re-resolving live RBAC. Pass the published principal set\n * (`context.permissionSet`) so an RLS-off catalog gate enforces the same\n * snapshot authority the RLS-on session published — keeping the authority\n * bound adapter-independent. Without it a mid-run role grant, or a reduced\n * pre-resolved `permissions` set, could let SQLite/dev allow an operation the\n * Postgres RLS path for the same principal context would deny.\n */\n permissionSet?: ReadonlySet<string> | readonly string[];\n}\n\nexport class OperationPermissionError extends Error {\n readonly decision: OperationPermissionDecision;\n readonly permission: string | null;\n readonly status = 403;\n\n constructor(decision: OperationPermissionDecision) {\n super(\n decision.permission\n ? `Permission denied for '${decision.permission}'.`\n : 'Permission denied.',\n );\n this.name = 'OperationPermissionError';\n this.decision = decision;\n this.permission = decision.permission;\n }\n}\n\ninterface RuntimeBypassContext {\n superAdminBypass: boolean;\n systemContext: boolean;\n}\n\nfunction isModuleNotFoundError(error: unknown): boolean {\n return (\n error instanceof Error &&\n ((error as NodeJS.ErrnoException).code === 'ERR_MODULE_NOT_FOUND' ||\n /Cannot find package '@happyvertical\\/smrt-tenancy'/.test(error.message))\n );\n}\n\nasync function readTenancyBypassContext(): Promise<RuntimeBypassContext> {\n try {\n const tenancy = await import('@happyvertical/smrt-tenancy');\n return {\n superAdminBypass: tenancy.isSuperAdminBypass(),\n systemContext: tenancy.isSystemContext(),\n };\n } catch (error) {\n if (!isModuleNotFoundError(error)) {\n throw error;\n }\n\n return {\n superAdminBypass: false,\n systemContext: false,\n };\n }\n}\n\nfunction deny(\n permission: string | null,\n reason: OperationPermissionDenyReason,\n error?: unknown,\n): OperationPermissionDecision {\n return {\n allowed: false,\n error,\n permission,\n reason,\n };\n}\n\nfunction allow(\n permission: string,\n reason: OperationPermissionAllowReason,\n): OperationPermissionDecision {\n return {\n allowed: true,\n permission,\n reason,\n };\n}\n\nfunction hasCatalogSlug(\n catalog: PermissionCatalog,\n permission: string,\n): boolean {\n return catalog.permissions.some(\n (definition) => definition.slug === permission,\n );\n}\n\nexport async function checkOperationPermission(\n options: OperationPermissionOptions,\n): Promise<OperationPermissionDecision> {\n let permission: string;\n try {\n permission = deriveOperationPermissionSlug(\n options.collection,\n options.action,\n );\n } catch (error) {\n return deny(null, 'invalid_operation', error);\n }\n\n const catalog =\n options.catalog ?? PermissionCatalogService.create(options).getCatalog();\n if (!hasCatalogSlug(catalog, permission)) {\n return deny(permission, 'unknown_permission');\n }\n\n const sessionContext = getCurrentSessionPermissionContext();\n let tenancyContext: RuntimeBypassContext;\n try {\n tenancyContext = await readTenancyBypassContext();\n } catch (error) {\n return deny(permission, 'resolution_error', error);\n }\n // A session under a permission ceiling (#3276) is capped by policy: no\n // bypass applies inside it, whatever the ambient tenancy context says.\n const ceiling = sessionContext?.session?.permissionCeiling;\n const ceilinged = Array.isArray(ceiling);\n const systemContext =\n !ceilinged &&\n (sessionContext?.systemContext === true || tenancyContext.systemContext);\n const superAdminBypass =\n !ceilinged &&\n (sessionContext?.superAdminBypass === true ||\n tenancyContext.superAdminBypass);\n\n if (systemContext && options.allowSystemContextBypass !== false) {\n return allow(permission, 'system_context_bypass');\n }\n\n if (superAdminBypass && options.allowSuperAdminBypass !== false) {\n return allow(permission, 'super_admin_bypass');\n }\n\n const userId = options.userId ?? sessionContext?.userId ?? null;\n const tenantId = options.tenantId ?? sessionContext?.tenantId ?? null;\n if (!userId || !tenantId) {\n return deny(permission, 'missing_principal');\n }\n\n // The live resolve below returns the person's full role authority; the\n // session's ceiling must cap it here too, or the guard would allow what\n // `SessionContext.permissions` (and RLS) deny for the same session.\n // Whatever tenant the guarded resource is in: a resource-tenant check for\n // the session's own person must not step around the device policy.\n if (\n ceilinged &&\n userId === sessionContext?.userId &&\n !ceiling.includes(permission)\n ) {\n return deny(permission, 'permission_denied');\n }\n\n // Explicit set wins over a live re-resolve: authorize against the exact\n // published principal set so the gate matches what an RLS session enforces\n // for the same context (adapter-independent, snapshot-consistent).\n if (options.permissionSet !== undefined) {\n const granted = Array.isArray(options.permissionSet)\n ? options.permissionSet.includes(permission)\n : (options.permissionSet as ReadonlySet<string>).has(permission);\n return granted\n ? allow(permission, 'permission_granted')\n : deny(permission, 'permission_denied');\n }\n\n try {\n const resolver =\n options.resolver ?? (await PermissionResolver.create(options));\n const hasPermission = await resolver.hasPermission(\n userId,\n tenantId,\n permission,\n { membership: options.membership },\n );\n return hasPermission\n ? allow(permission, 'permission_granted')\n : deny(permission, 'permission_denied');\n } catch (error) {\n return deny(permission, 'resolution_error', error);\n }\n}\n\nexport async function hasOperationPermission(\n options: OperationPermissionOptions,\n): Promise<boolean> {\n return (await checkOperationPermission(options)).allowed;\n}\n\nexport async function assertOperationPermission(\n options: OperationPermissionOptions,\n): Promise<OperationPermissionDecision> {\n const decision = await checkOperationPermission(options);\n if (decision.allowed || options.onDeny === 'return') {\n return decision;\n }\n\n throw new OperationPermissionError(decision);\n}\n","/**\n * PasskeyCredentialService — passkey (WebAuthn) sign-in for an existing,\n * active user, and the lifecycle of the person's passkeys (#3275).\n *\n * All WebAuthn parsing and verification is `@simplewebauthn/server`; this\n * module owns the ceremony state, the sign-in order, and the authority rules.\n *\n * ## Ceremonies\n *\n * `beginAuthentication` / `beginRegistration` return an opaque `ceremonyId`:\n * `base64url(payload) + '.' + base64url(HMAC-SHA256(secret, payload))`, where\n * the payload carries the purpose, the random 32-byte challenge, an expiry\n * and, for registration, the person and the SHA-256 of the actor's session id\n * (never the raw id). Issuing writes nothing, so an unauthenticated \"begin\"\n * request costs no storage. Single use is enforced when a ceremony is\n * finished: its challenge hash is inserted into the unique\n * {@link UsersPasskeyChallenge} ledger, and a conflict is a replay. Set\n * `challengeSecret` (at least 32 characters) in any deployment with more than\n * one process, or a ceremony begun on one will not verify on another.\n *\n * ## Sign-in (discoverable / usernameless)\n *\n * 1. Take the submitted credential id (what the client sent, never a resolved\n * user) and RESERVE a login attempt on it, source = the client address.\n * 2. Verify and consume the ceremony; load the credential; verify the\n * assertion (origin, RP id, user verification REQUIRED); check the\n * user handle, the signature counter, that the user is ACTIVE and, when a\n * tenant is given, holds an ACTIVE membership in it. Never create a user.\n * 3. Mint a first-class session (`authMethod: 'passkey'`) through\n * `SessionService.createSession`, then re-check the credential with one\n * guarded UPDATE of the counter (a passkey removed meanwhile, or a\n * concurrent assertion, makes it a no-op and the session is destroyed).\n *\n * Every refusal other than a rate limit is one {@link PasskeyCredentialError}\n * (\"Invalid credentials.\"); a rate limit is {@link LoginRateLimitError}.\n *\n * ## Management and authority\n *\n * Registering a passkey, or a person removing their own, needs a session\n * minted within `freshSessionSeconds` (decided on the STORED session row): a\n * stolen long-lived session cannot enrol an attacker's authenticator. A\n * layered (device PIN) session never manages passkeys, and an administrator\n * may only manage people whose every active membership is in the\n * administrator's session tenant — passkeys, like the password, are one set\n * per person across tenants.\n *\n * @packageDocumentation\n */\n\nimport {\n createHash,\n createHmac,\n randomBytes,\n timingSafeEqual,\n} from 'node:crypto';\nimport { createLogger } from '@happyvertical/logger';\nimport type { SmrtClassOptions } from '@happyvertical/smrt-core';\nimport { withSystemContext } from '@happyvertical/smrt-tenancy';\nimport type {\n AuthenticationResponseJSON,\n PublicKeyCredentialCreationOptionsJSON,\n PublicKeyCredentialRequestOptionsJSON,\n RegistrationResponseJSON,\n} from '@simplewebauthn/server';\nimport { MembershipCollection } from '../collections/MembershipCollection.js';\nimport { UsersPasskeyChallengeCollection } from '../collections/PasskeyChallengeCollection.js';\nimport { UsersPasskeyCredentialCollection } from '../collections/PasskeyCredentialCollection.js';\nimport { SessionCollection } from '../collections/SessionCollection.js';\nimport { UserCollection } from '../collections/UserCollection.js';\nimport {\n PASSKEY_CHALLENGE_TTL_CEILING_SECONDS,\n type PasskeyChallengePurpose,\n} from '../models/PasskeyChallenge.js';\nimport type { UsersPasskeyCredential } from '../models/PasskeyCredential.js';\nimport {\n DEFAULT_SESSION_TTL,\n SESSION_DATA_KEYS,\n type Session,\n type SessionAuthMethod,\n} from '../models/Session.js';\nimport type { User } from '../models/User.js';\nimport { withoutListBounds } from './authorization-read-options.js';\nimport {\n InvalidCredentialsError,\n LoginAttemptLimiter,\n type LoginAttemptLimiterOptions,\n LoginRateLimitError,\n} from './LoginAttemptLimiter.js';\nimport {\n type PermissionDefinition,\n registerPermissionDefinitions,\n} from './PermissionCatalogService.js';\nimport { type SessionContext, SessionService } from './SessionService.js';\n\nconst logger = createLogger({ level: 'info' });\n\n/**\n * `@simplewebauthn/server` is loaded on first use, never at import time. It\n * depends on `reflect-metadata`, a process-wide polyfill (`Reflect.decorate`,\n * `Reflect.metadata`) that changes how decorators are applied. smrt-core\n * tolerates it, but an application that never uses passkeys should not have\n * it installed just because it imported this package (the package entry\n * re-exports this module).\n */\nlet webauthnModule: Promise<typeof import('@simplewebauthn/server')> | null =\n null;\nconst webauthn = () => {\n webauthnModule ??= import('@simplewebauthn/server');\n return webauthnModule;\n};\ntype WebAuthn = Awaited<ReturnType<typeof webauthn>>;\n\n/** Login-limiter kind and session `authMethod` for passkey sign-ins. */\nexport const PASSKEY_LOGIN_KIND = 'passkey';\n/** Default permission required to list or remove another person's passkeys. */\nexport const DEFAULT_PASSKEY_MANAGE_PERMISSION = 'users.passkey.manage';\n/**\n * Server-set `Session.data` key naming the passkey row a session was signed\n * in with. Never write it from client input.\n */\nexport const PASSKEY_SESSION_DATA_KEY = SESSION_DATA_KEYS.passkeyCredentialId;\n/** Default lifetime of a ceremony (5 minutes). */\nexport const DEFAULT_PASSKEY_CHALLENGE_TTL_SECONDS = 5 * 60;\nexport { PASSKEY_CHALLENGE_TTL_CEILING_SECONDS };\n/** Default age a session may have when it registers or removes a passkey (15 minutes). */\nexport const DEFAULT_PASSKEY_FRESH_SESSION_SECONDS = 15 * 60;\n/** Smallest accepted `freshSessionSeconds`. */\nexport const PASSKEY_FRESH_SESSION_FLOOR_SECONDS = 60;\n/** Largest accepted `freshSessionSeconds` (1 hour). */\nexport const PASSKEY_FRESH_SESSION_CEILING_SECONDS = 60 * 60;\n/** Sign-in methods that count as a fresh authentication by default. */\nexport const DEFAULT_PASSKEY_FRESH_AUTH_METHODS: readonly SessionAuthMethod[] =\n Object.freeze(['password', 'passkey', 'oidc', 'magic-link']);\n/** Methods that can never count as fresh (see `freshAuthMethods`). */\nconst NEVER_FRESH_AUTH_METHODS: ReadonlySet<string> = new Set([\n 'terminal',\n 'pin',\n]);\n/** Default passkeys per person. */\nexport const DEFAULT_MAX_PASSKEYS_PER_USER = 10;\n/** No configuration may allow more passkeys per person than this. */\nexport const PASSKEY_MAX_PER_USER_CEILING = 100;\n/** Longest passkey name, in code points. */\nexport const PASSKEY_NAME_MAX_LENGTH = 64;\n/** Name given to a passkey registered without one. */\nexport const DEFAULT_PASSKEY_NAME = 'Passkey';\n/** Longest ceremony id accepted, in characters. */\nconst MAX_CEREMONY_ID_LENGTH = 4096;\n/** Longest credential id accepted, in characters (the WebAuthn bound is 1023 bytes). */\nconst MAX_CREDENTIAL_ID_LENGTH = 1024;\n/** Longest base64url member of a client response accepted, in characters. */\nconst MAX_RESPONSE_FIELD_LENGTH = 32 * 1024;\n/** Challenge size, in bytes. */\nconst CHALLENGE_BYTES = 32;\n/** Shortest accepted `challengeSecret`. */\nconst MIN_CHALLENGE_SECRET_LENGTH = 32;\n\nconst UUID_PATTERN =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;\nconst BASE64URL_PATTERN = /^[A-Za-z0-9_-]+$/u;\nconst SHA256_HEX_PATTERN = /^[0-9a-f]{64}$/u;\nconst LOOPBACK_HOSTS: ReadonlySet<string> = new Set([\n 'localhost',\n '127.0.0.1',\n '[::1]',\n]);\n\n/** Catalog definition for {@link DEFAULT_PASSKEY_MANAGE_PERMISSION}. */\nexport const PASSKEY_PERMISSION_DEFINITIONS: PermissionDefinition[] = [\n {\n slug: DEFAULT_PASSKEY_MANAGE_PERMISSION,\n category: 'users',\n name: 'Manage passkeys',\n description: \"List or remove another person's passkeys\",\n },\n];\n\nlet passkeyPermissionsRegistered = false;\n\n/** Register the passkey management permission once when the service is used. */\nexport function ensurePasskeyPermissionsRegistered(): void {\n if (passkeyPermissionsRegistered) return;\n passkeyPermissionsRegistered = true;\n registerPermissionDefinitions(PASSKEY_PERMISSION_DEFINITIONS);\n}\n\n/**\n * Every sign-in refusal that is not a rate limit: unknown credential, bad or\n * replayed or expired ceremony, failed verification, counter regression,\n * inactive user, no membership. One message, so responses cannot enumerate\n * accounts.\n */\nexport class PasskeyCredentialError extends InvalidCredentialsError {\n constructor(message = 'Invalid credentials.') {\n super(message);\n this.name = 'PasskeyCredentialError';\n }\n}\n\n/** Thrown by the management calls when the actor may not manage the passkey. */\nexport class PasskeyCredentialForbiddenError extends Error {\n constructor(message = 'Not permitted to manage this passkey.') {\n super(message);\n this.name = 'PasskeyCredentialForbiddenError';\n }\n}\n\n/**\n * Thrown when a management call needs a session minted recently and the\n * actor's is older: the person must sign in again, then retry.\n */\nexport class PasskeyReauthenticationRequiredError extends Error {\n constructor(message = 'Sign in again to manage your passkeys.') {\n super(message);\n this.name = 'PasskeyReauthenticationRequiredError';\n }\n}\n\n/**\n * Thrown by register and rename for a refusal whose message is safe to show\n * the person: a bad name, the passkey limit, an authenticator that is already\n * registered, or a registration that did not verify.\n */\nexport class PasskeyRegistrationError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'PasskeyRegistrationError';\n }\n}\n\n/** Where passkeys are valid: the origin(s) and relying party identity. */\nexport interface PasskeyRelyingPartyOptions {\n /**\n * Every origin a ceremony may run on: an absolute `https:` URL with no path\n * (or `http:` for localhost, 127.0.0.1 and [::1] only).\n */\n origin: string | readonly string[];\n /**\n * The RP id passkeys are scoped to. Defaults to the hostname of the first\n * origin; must be that hostname, or a parent domain of EVERY origin's. It\n * cannot be changed later without orphaning every registered passkey.\n */\n rpId?: string;\n /** Name the authenticator shows the person. */\n rpName: string;\n}\n\nexport interface PasskeyCredentialServiceOptions extends SmrtClassOptions {\n /** Required: passkeys are bound to the relying party. */\n relyingParty: PasskeyRelyingPartyOptions;\n /** Lifetime of a passkey session in seconds. Default seven days. */\n sessionTtl?: number;\n /**\n * Shared {@link LoginAttemptLimiter}. When omitted one is created from\n * `limiter` (or defaults). Supplying the host's instance keeps password,\n * passkey and PIN budgets in one table with one audit sink.\n */\n loginLimiter?: LoginAttemptLimiter;\n /** Options for the private limiter when `loginLimiter` is not supplied. */\n limiter?: Omit<LoginAttemptLimiterOptions, keyof SmrtClassOptions>;\n /** Permission slug an administrator needs to manage others' passkeys. */\n managePermission?: string;\n /**\n * Secret that signs ceremony ids (at least 32 characters). When omitted a\n * random per-instance secret is used, which only works while the process\n * that began a ceremony is the one that finishes it: set it for any\n * multi-process deployment.\n */\n challengeSecret?: string;\n /** Seconds a ceremony stays valid, 1 to 600. Default 300. */\n challengeTtlSeconds?: number;\n /**\n * How recently the session must have been minted to register a passkey or\n * remove one's own, 60 to 3600 seconds. Default 900.\n */\n freshSessionSeconds?: number;\n /**\n * Session `authMethod`s whose sign-in counts as a fresh authentication for\n * registering or removing one's own passkey. Read from the STORED session\n * row; a null or unlisted method is never fresh. Default\n * {@link DEFAULT_PASSKEY_FRESH_AUTH_METHODS}. `terminal` and `pin` are\n * refused at construction: a terminal approval lets any session (even a\n * stolen stale one) mint a brand new first-class `terminal` session, and a\n * PIN session is layered.\n */\n freshAuthMethods?: readonly SessionAuthMethod[];\n /** Passkeys one person may hold, 1 to 100. Default 10. */\n maxPasskeysPerUser?: number;\n}\n\nexport interface PasskeyAuthenticationBegin {\n /** Opaque, signed ceremony state: send it back with the assertion. */\n ceremonyId: string;\n options: PublicKeyCredentialRequestOptionsJSON;\n}\n\nexport interface PasskeyRegistrationBegin {\n ceremonyId: string;\n options: PublicKeyCredentialCreationOptionsJSON;\n}\n\nexport interface PasskeySignInInput {\n ceremonyId: string;\n /** The `AuthenticationResponseJSON` the browser produced; validated here. */\n response: unknown;\n /**\n * Tenant to sign into. When set, the person must hold an ACTIVE membership\n * in it; when null/omitted the session carries no tenant context (and so\n * no tenant permissions) until `switchSessionTenant`.\n */\n tenantId?: string | null | 'unique-active-membership';\n ipAddress?: string;\n userAgent?: string;\n /**\n * The session id the client presented before signing in (its old cookie),\n * if any. Revoked after a successful sign-in (session fixation).\n */\n replaceSessionId?: string | null;\n}\n\nexport interface PasskeySignInResult {\n /** The new session id: the cookie value. Never send it to client script. */\n sessionId: string;\n userId: string;\n tenantId: string | null;\n authMethod: SessionAuthMethod;\n expiresAt: string;\n}\n\n/** A passkey as shown to its owner or an administrator. No key material, no credential id. */\nexport interface PasskeySummary {\n id: string;\n name: string;\n createdAt: string | null;\n lastUsedAt: string | null;\n backedUp: boolean;\n deviceType: 'singleDevice' | 'multiDevice' | null;\n transports: string[];\n}\n\nexport interface BeginPasskeyRegistrationInput {\n /** Resolved session of the person registering. */\n actor: SessionContext;\n}\n\nexport interface FinishPasskeyRegistrationInput {\n actor: SessionContext;\n ceremonyId: string;\n /** The `RegistrationResponseJSON` the browser produced; validated here. */\n response: unknown;\n /** Shown name; trimmed, at most 64 characters, defaults to \"Passkey\". */\n name?: string;\n ipAddress?: string;\n}\n\nexport interface ListPasskeysInput {\n actor: SessionContext;\n /** Another person's passkeys (administrators); omitted for the actor's own. */\n userId?: string;\n}\n\nexport interface RenamePasskeyInput {\n actor: SessionContext;\n passkeyId: string;\n name: string;\n ipAddress?: string;\n}\n\nexport interface RemovePasskeyInput {\n actor: SessionContext;\n passkeyId: string;\n ipAddress?: string;\n}\n\nexport interface RemoveAllPasskeysInput {\n actor: SessionContext;\n userId: string;\n ipAddress?: string;\n}\n\n/** The verified, signed contents of a ceremony id. */\ninterface CeremonyPayload {\n v: 1;\n purpose: PasskeyChallengePurpose;\n /** base64url of the 32 random bytes. */\n challenge: string;\n /** Expiry, epoch milliseconds. */\n exp: number;\n /** Registration only: the person registering. */\n userId?: string;\n /** Registration only: sha256 hex of the registering session id. */\n sessionHash?: string;\n}\n\n/** Internal: a ceremony id that did not verify. Never leaves this module. */\nclass CeremonyRejectedError extends Error {}\n\nconst toBase64Url = (value: Uint8Array | string): string =>\n Buffer.from(value).toString('base64url');\n\nconst sha256Hex = (value: string): string =>\n createHash('sha256').update(value).digest('hex');\n\nfunction codePointLength(value: string): number {\n let length = 0;\n for (const _ of value) length++;\n return length;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === 'object' && !Array.isArray(value);\n}\n\n/** A bounded base64url string, or null. */\nfunction base64urlField(value: unknown, max: number): string | null {\n return typeof value === 'string' &&\n value.length > 0 &&\n value.length <= max &&\n BASE64URL_PATTERN.test(value)\n ? value\n : null;\n}\n\n/** The credential id a response claims, when it is a plausible one. */\nfunction submittedCredentialId(response: unknown): string | null {\n return isRecord(response)\n ? base64urlField(response.id, MAX_CREDENTIAL_ID_LENGTH)\n : null;\n}\n\n/**\n * Copy an assertion into the shape the library expects, dropping everything\n * else the client sent. Null when any required member is missing or unbounded.\n */\nfunction parseAuthenticationResponse(\n raw: unknown,\n): AuthenticationResponseJSON | null {\n if (!isRecord(raw) || raw.type !== 'public-key') return null;\n const id = base64urlField(raw.id, MAX_CREDENTIAL_ID_LENGTH);\n const rawId = base64urlField(raw.rawId, MAX_CREDENTIAL_ID_LENGTH);\n if (!id || !rawId || !isRecord(raw.response)) return null;\n const inner = raw.response;\n const clientDataJSON = base64urlField(\n inner.clientDataJSON,\n MAX_RESPONSE_FIELD_LENGTH,\n );\n const authenticatorData = base64urlField(\n inner.authenticatorData,\n MAX_RESPONSE_FIELD_LENGTH,\n );\n const signature = base64urlField(inner.signature, MAX_RESPONSE_FIELD_LENGTH);\n if (!clientDataJSON || !authenticatorData || !signature) return null;\n let userHandle: string | undefined;\n if (inner.userHandle !== undefined && inner.userHandle !== null) {\n // An empty handle is \"none\"; anything else must be base64url.\n if (inner.userHandle !== '') {\n const handle = base64urlField(inner.userHandle, MAX_CREDENTIAL_ID_LENGTH);\n if (!handle) return null;\n userHandle = handle;\n }\n }\n return {\n id,\n rawId,\n type: 'public-key',\n response: {\n clientDataJSON,\n authenticatorData,\n signature,\n ...(userHandle !== undefined && { userHandle }),\n },\n clientExtensionResults: {},\n };\n}\n\n/** The registration counterpart of {@link parseAuthenticationResponse}. */\nfunction parseRegistrationResponse(\n raw: unknown,\n): RegistrationResponseJSON | null {\n if (!isRecord(raw) || raw.type !== 'public-key') return null;\n const id = base64urlField(raw.id, MAX_CREDENTIAL_ID_LENGTH);\n const rawId = base64urlField(raw.rawId, MAX_CREDENTIAL_ID_LENGTH);\n if (!id || !rawId || !isRecord(raw.response)) return null;\n const inner = raw.response;\n const clientDataJSON = base64urlField(\n inner.clientDataJSON,\n MAX_RESPONSE_FIELD_LENGTH,\n );\n const attestationObject = base64urlField(\n inner.attestationObject,\n MAX_RESPONSE_FIELD_LENGTH,\n );\n if (!clientDataJSON || !attestationObject) return null;\n const transports = Array.isArray(inner.transports)\n ? inner.transports\n .filter((entry): entry is string => typeof entry === 'string')\n .slice(0, 8)\n : undefined;\n return {\n id,\n rawId,\n type: 'public-key',\n response: {\n clientDataJSON,\n attestationObject,\n ...(transports && { transports: transports as never }),\n },\n clientExtensionResults: {},\n };\n}\n\n/** Validate the relying party and resolve its origins and RP id. */\nfunction resolveRelyingParty(\n relyingParty: PasskeyRelyingPartyOptions | undefined,\n): { origins: string[]; rpId: string; rpName: string } {\n const fail = (detail: string): never => {\n throw new Error(`PasskeyCredentialService relyingParty ${detail}`);\n };\n if (!isRecord(relyingParty)) fail('is required.');\n const configured = relyingParty as PasskeyRelyingPartyOptions;\n const rawOrigins = Array.isArray(configured.origin)\n ? configured.origin\n : [configured.origin];\n if (rawOrigins.length === 0) fail('needs at least one origin.');\n\n const origins: string[] = [];\n const hostnames: string[] = [];\n for (const rawOrigin of rawOrigins) {\n let url: URL;\n try {\n url = new URL(String(rawOrigin));\n } catch {\n return fail(\n `origin ${JSON.stringify(rawOrigin)} is not an absolute URL.`,\n );\n }\n const secure =\n url.protocol === 'https:' ||\n (url.protocol === 'http:' && LOOPBACK_HOSTS.has(url.hostname));\n if (\n typeof rawOrigin !== 'string' ||\n !secure ||\n url.pathname !== '/' ||\n url.search ||\n url.hash ||\n url.username ||\n url.password\n ) {\n return fail(\n `origin ${JSON.stringify(rawOrigin)} must be an https origin with no path (http only for localhost, 127.0.0.1 or [::1]).`,\n );\n }\n if (!origins.includes(url.origin)) origins.push(url.origin);\n hostnames.push(url.hostname);\n }\n\n const rpId = (configured.rpId ?? hostnames[0] ?? '').toLowerCase();\n if (!rpId) fail('rpId is required.');\n for (const hostname of hostnames) {\n // A registrable suffix: the hostname itself, or a parent domain that is\n // not a bare top-level label (\"com\") and not part of an IP address.\n const isSuffix =\n hostname === rpId ||\n (hostname.endsWith(`.${rpId}`) &&\n rpId.includes('.') &&\n !/^[\\d.]+$/u.test(hostname) &&\n !hostname.startsWith('['));\n if (!isSuffix) {\n fail(\n `rpId \"${rpId}\" must be the hostname of, or a parent domain of, every origin (\"${hostname}\").`,\n );\n }\n }\n const rpName =\n typeof configured.rpName === 'string' ? configured.rpName.trim() : '';\n if (!rpName || codePointLength(rpName) > 128) {\n fail('rpName must be a name of 1 to 128 characters.');\n }\n return { origins, rpId, rpName };\n}\n\nfunction boundedInteger(\n value: number | undefined,\n fallback: number,\n min: number,\n max: number,\n name: string,\n): number {\n const resolved = value ?? fallback;\n if (!Number.isSafeInteger(resolved) || resolved < min || resolved > max) {\n throw new Error(\n `PasskeyCredentialService ${name} must be an integer from ${min} to ${max}.`,\n );\n }\n return resolved;\n}\n\nexport class PasskeyCredentialService {\n private readonly options: PasskeyCredentialServiceOptions;\n private readonly sessionTtl: number;\n private readonly managePermission: string;\n private readonly origins: string[];\n private readonly rpId: string;\n private readonly rpName: string;\n private readonly challengeSecret: Buffer;\n private readonly challengeTtlMs: number;\n private readonly freshSessionMs: number;\n private readonly maxPasskeys: number;\n private readonly freshAuthMethods: ReadonlySet<string>;\n private sessionService!: SessionService;\n private sessionRows!: SessionCollection;\n private memberships!: MembershipCollection;\n private users!: UserCollection;\n private credentials!: UsersPasskeyCredentialCollection;\n private challenges!: UsersPasskeyChallengeCollection;\n private limiter!: LoginAttemptLimiter;\n\n constructor(options: PasskeyCredentialServiceOptions) {\n this.options = options;\n ensurePasskeyPermissionsRegistered();\n this.sessionTtl = options.sessionTtl ?? DEFAULT_SESSION_TTL;\n if (!(Number.isFinite(this.sessionTtl) && this.sessionTtl > 0)) {\n throw new Error(\n 'PasskeyCredentialService sessionTtl must be a positive number.',\n );\n }\n this.managePermission =\n options.managePermission ?? DEFAULT_PASSKEY_MANAGE_PERMISSION;\n const relyingParty = resolveRelyingParty(options.relyingParty);\n this.origins = relyingParty.origins;\n this.rpId = relyingParty.rpId;\n this.rpName = relyingParty.rpName;\n if (options.challengeSecret !== undefined) {\n if (\n typeof options.challengeSecret !== 'string' ||\n options.challengeSecret.length < MIN_CHALLENGE_SECRET_LENGTH\n ) {\n throw new Error(\n `PasskeyCredentialService challengeSecret must be at least ${MIN_CHALLENGE_SECRET_LENGTH} characters.`,\n );\n }\n this.challengeSecret = Buffer.from(options.challengeSecret, 'utf8');\n } else {\n this.challengeSecret = randomBytes(32);\n logger.warn(\n 'PasskeyCredentialService has no challengeSecret: ceremony ids only verify in the process that issued them. Set challengeSecret for any multi-process deployment.',\n );\n }\n this.challengeTtlMs =\n 1000 *\n boundedInteger(\n options.challengeTtlSeconds,\n DEFAULT_PASSKEY_CHALLENGE_TTL_SECONDS,\n 1,\n PASSKEY_CHALLENGE_TTL_CEILING_SECONDS,\n 'challengeTtlSeconds',\n );\n this.freshSessionMs =\n 1000 *\n boundedInteger(\n options.freshSessionSeconds,\n DEFAULT_PASSKEY_FRESH_SESSION_SECONDS,\n PASSKEY_FRESH_SESSION_FLOOR_SECONDS,\n PASSKEY_FRESH_SESSION_CEILING_SECONDS,\n 'freshSessionSeconds',\n );\n const freshMethods = options.freshAuthMethods ?? [\n ...DEFAULT_PASSKEY_FRESH_AUTH_METHODS,\n ];\n if (\n !Array.isArray(freshMethods) ||\n freshMethods.length === 0 ||\n freshMethods.some(\n (method) =>\n typeof method !== 'string' ||\n !method.trim() ||\n NEVER_FRESH_AUTH_METHODS.has(method),\n )\n ) {\n throw new Error(\n 'PasskeyCredentialService freshAuthMethods must list interactive sign-in methods (never terminal or pin).',\n );\n }\n this.freshAuthMethods = new Set<string>(freshMethods);\n this.maxPasskeys = boundedInteger(\n options.maxPasskeysPerUser,\n DEFAULT_MAX_PASSKEYS_PER_USER,\n 1,\n PASSKEY_MAX_PER_USER_CEILING,\n 'maxPasskeysPerUser',\n );\n }\n\n static async create(\n options: PasskeyCredentialServiceOptions,\n ): Promise<PasskeyCredentialService> {\n const service = new PasskeyCredentialService(options);\n await service.initialize();\n return service;\n }\n\n async initialize(): Promise<void> {\n this.sessionService = await SessionService.create({\n ...this.options,\n defaultTTL: this.sessionTtl,\n });\n // Unbounded: these reads back authorization decisions and quotas.\n const unbounded = withoutListBounds(this.options);\n this.memberships = await MembershipCollection.create(unbounded);\n this.credentials = await UsersPasskeyCredentialCollection.create(unbounded);\n this.users = await UserCollection.create(this.options);\n this.sessionRows = await SessionCollection.create(this.options);\n this.challenges = await UsersPasskeyChallengeCollection.create(\n this.options,\n );\n this.limiter =\n this.options.loginLimiter ??\n (await LoginAttemptLimiter.create({\n ...this.options,\n ...this.options.limiter,\n }));\n }\n\n /** The limiter in use (shared or private). */\n get loginLimiter(): LoginAttemptLimiter {\n return this.limiter;\n }\n\n // -------------------------------------------------------------------------\n // Sign in\n // -------------------------------------------------------------------------\n\n /**\n * Start a usernameless sign-in: the options to hand to the browser's\n * `navigator.credentials.get`. Writes nothing and says nothing about any\n * account (`allowCredentials` is empty: the authenticator offers its own).\n */\n async beginAuthentication(): Promise<PasskeyAuthenticationBegin> {\n const { ceremonyId, challenge } = this.issueCeremony('authentication');\n const { generateAuthenticationOptions } = await webauthn();\n const options = await generateAuthenticationOptions({\n rpID: this.rpId,\n challenge: Buffer.from(challenge, 'base64url'),\n userVerification: 'required',\n allowCredentials: [],\n timeout: this.challengeTtlMs,\n });\n return { ceremonyId, options };\n }\n\n /**\n * Verify a passkey assertion and mint a session. Throws\n * {@link PasskeyCredentialError} for every refusal that is not a rate limit\n * and {@link LoginRateLimitError} when the budget is exhausted.\n */\n async finishAuthentication(\n input: PasskeySignInInput,\n ): Promise<PasskeySignInResult> {\n const submittedId = submittedCredentialId(input.response);\n const source = input.ipAddress?.trim() || null;\n // Nothing to key any budget on (a disabled source budget keys nothing):\n // refuse like a wrong credential. Every other request, malformed or not,\n // reserves before anything else.\n if (!submittedId && !(source && this.limiter.limitsSource)) {\n throw new PasskeyCredentialError();\n }\n\n const requestedTenantId = input.tenantId || null;\n const lease = await this.limiter.reserve({\n kind: PASSKEY_LOGIN_KIND,\n // What the client submitted, never a resolved user: unknown and wrong\n // credentials take the same path. Prefixed so a submitted id that\n // happens to equal a user id (any UUID is valid base64url) never pools\n // with that person's PIN or password budget: an unauthenticated caller\n // must not be able to lock another credential kind.\n subject: submittedId ? `${PASSKEY_LOGIN_KIND}:${submittedId}` : null,\n source,\n metadata: {\n tenantId:\n requestedTenantId === 'unique-active-membership'\n ? null\n : requestedTenantId,\n },\n });\n if (!lease.allowed) throw new LoginRateLimitError(lease);\n\n let credentialFailed = false;\n let failMetadata: Record<string, unknown> | undefined;\n let mintedSessionId: string | null = null;\n const refuse = (metadata?: Record<string, unknown>): never => {\n credentialFailed = true;\n failMetadata = metadata;\n throw new PasskeyCredentialError();\n };\n try {\n const response = parseAuthenticationResponse(input.response);\n if (!response || !submittedId) return refuse();\n\n // The ceremony: signed, unexpired, for authentication, and consumed\n // (single use) before any credential lookup.\n const ceremony = await this.consumeCeremony(\n input.ceremonyId,\n 'authentication',\n ).catch((error) => {\n if (error instanceof CeremonyRejectedError) return null;\n throw error;\n });\n if (!ceremony) return refuse();\n\n const stored = await this.credentials.findByCredentialId(submittedId);\n if (!stored?.id || !UUID_PATTERN.test(stored.userId)) return refuse();\n const user = await this.users.get(stored.userId);\n if (!user?.id) return refuse();\n\n const { verifyAuthenticationResponse } = await webauthn();\n let verification: Awaited<\n ReturnType<WebAuthn['verifyAuthenticationResponse']>\n >;\n try {\n verification = await verifyAuthenticationResponse({\n response,\n expectedChallenge: ceremony.challenge,\n expectedOrigin: this.origins,\n expectedRPID: this.rpId,\n requireUserVerification: true,\n credential: {\n id: stored.credentialId,\n publicKey: new Uint8Array(\n Buffer.from(stored.publicKey, 'base64url'),\n ),\n // The counter is checked below, where a regression can be\n // reported as such; 0 disables the library's own (redundant) check.\n counter: 0,\n transports: stored.getTransports(),\n },\n });\n } catch {\n return refuse();\n }\n if (!verification.verified) return refuse();\n\n // A discoverable credential reports its user handle; when it does it\n // must name the person the credential row belongs to.\n const userHandle = response.response.userHandle;\n if (userHandle && userHandle !== toBase64Url(user.id)) return refuse();\n\n // A counter that does not advance means a cloned authenticator (or a\n // replayed assertion). Authenticators that never count stay at 0.\n const newCounter = verification.authenticationInfo.newCounter;\n const storedCounter = stored.signCount ?? 0;\n if (\n !Number.isSafeInteger(newCounter) ||\n ((storedCounter > 0 || newCounter > 0) && newCounter <= storedCounter)\n ) {\n return refuse({ reason: 'counter' });\n }\n\n if (!user.isActive()) return refuse();\n const userId = user.id;\n\n const tenantId =\n requestedTenantId === 'unique-active-membership'\n ? await this.resolveUniqueActiveMembershipTenant(userId)\n : requestedTenantId;\n if (!tenantId && requestedTenantId === 'unique-active-membership') {\n return refuse();\n }\n if (tenantId) {\n const membership = await this.memberships.findByUserAndTenant(\n userId,\n tenantId,\n );\n if (!membership?.isActive()) return refuse();\n }\n\n const now = Date.now();\n const sessionId = await this.sessionService.createSession(\n userId,\n tenantId ?? undefined,\n {\n ttl: this.sessionTtl,\n ipAddress: input.ipAddress,\n userAgent: input.userAgent,\n authMethod: PASSKEY_LOGIN_KIND,\n data: { [PASSKEY_SESSION_DATA_KEY]: stored.id },\n },\n );\n mintedSessionId = sessionId;\n\n // Bind the session to the credential that was verified: one guarded\n // UPDATE that applies only while the row still exists with the counter\n // it was verified against. A passkey removed after the lookup (whose\n // revocation sweep may already have run), or a concurrent assertion\n // that advanced the counter first, makes it a no-op.\n const recorded = await this.credentials.recordUseIfCurrent(\n stored.id,\n userId,\n storedCounter,\n newCounter,\n verification.authenticationInfo.credentialBackedUp === true,\n );\n if (!recorded) return refuse({ reason: 'superseded' });\n\n // The sign-in is complete once the lease is settled; revoking the\n // presented session is best effort after that (and never turns a\n // success into a failure that would destroy the new session).\n await lease.succeed();\n const previous = input.replaceSessionId?.trim();\n if (previous && previous !== sessionId) {\n await this.sessionService\n .destroySession(previous)\n .catch(() => undefined);\n }\n return {\n sessionId,\n userId,\n tenantId,\n authMethod: PASSKEY_LOGIN_KIND,\n expiresAt: new Date(now + this.sessionTtl * 1000).toISOString(),\n };\n } catch (error) {\n if (credentialFailed)\n await lease.fail(failMetadata).catch(() => undefined);\n else await lease.release().catch(() => undefined);\n // Never leave a session behind for a sign-in that reported failure.\n if (mintedSessionId) {\n await this.sessionService\n .destroySession(mintedSessionId)\n .catch(() => undefined);\n }\n throw error;\n }\n }\n\n // -------------------------------------------------------------------------\n // Registration\n // -------------------------------------------------------------------------\n\n /**\n * Start registering a passkey for the actor: the options to hand to\n * `navigator.credentials.create`. The actor's session must be fresh, first\n * class, and without a permission ceiling.\n */\n async beginRegistration(\n input: BeginPasskeyRegistrationInput,\n ): Promise<PasskeyRegistrationBegin> {\n const { user } = await this.assertFreshManager(input.actor);\n const existing = await this.credentials.listByUserId(user.id as string);\n if (existing.length >= this.maxPasskeys) throw this.limitReached();\n\n const userName = user.email || user.username || (user.id as string);\n const { ceremonyId, challenge } = this.issueCeremony('registration', {\n userId: user.id as string,\n sessionHash: sha256Hex(input.actor.sessionId),\n });\n const { generateRegistrationOptions } = await webauthn();\n const options = await generateRegistrationOptions({\n rpName: this.rpName,\n rpID: this.rpId,\n userName,\n userDisplayName: userName,\n // The stable WebAuthn user handle: sign-in checks it against the row.\n userID: new TextEncoder().encode(user.id as string),\n challenge: Buffer.from(challenge, 'base64url'),\n attestationType: 'none',\n excludeCredentials: existing.map((passkey) => ({\n id: passkey.credentialId,\n transports: passkey.getTransports(),\n })),\n authenticatorSelection: {\n residentKey: 'required',\n userVerification: 'required',\n },\n timeout: this.challengeTtlMs,\n });\n return { ceremonyId, options };\n }\n\n /**\n * Verify a registration and store the passkey. Same guards as\n * {@link beginRegistration}, and the ceremony must have been begun by this\n * actor's own session.\n */\n async finishRegistration(\n input: FinishPasskeyRegistrationInput,\n ): Promise<{ passkey: PasskeySummary }> {\n const { user } = await this.assertFreshManager(input.actor);\n const userId = user.id as string;\n const name = this.normalizeName(input.name, true);\n const response = parseRegistrationResponse(input.response);\n if (!response) throw this.registrationFailed();\n\n const ceremony = await this.consumeCeremony(\n input.ceremonyId,\n 'registration',\n ).catch((error) => {\n if (error instanceof CeremonyRejectedError) {\n throw new PasskeyRegistrationError(\n 'This request expired or was already used. Start again.',\n );\n }\n throw error;\n });\n if (\n ceremony.userId !== userId ||\n ceremony.sessionHash !== sha256Hex(input.actor.sessionId)\n ) {\n throw this.registrationFailed();\n }\n\n const { verifyRegistrationResponse } = await webauthn();\n let verification: Awaited<\n ReturnType<WebAuthn['verifyRegistrationResponse']>\n >;\n try {\n verification = await verifyRegistrationResponse({\n response,\n expectedChallenge: ceremony.challenge,\n expectedOrigin: this.origins,\n expectedRPID: this.rpId,\n requireUserPresence: true,\n requireUserVerification: true,\n });\n } catch {\n throw this.registrationFailed();\n }\n if (!verification.verified) throw this.registrationFailed();\n const registered = verification.registrationInfo;\n\n if ((await this.credentials.countByUserId(userId)) >= this.maxPasskeys) {\n throw this.limitReached();\n }\n const inserted = await this.credentials.insertIfAbsent({\n userId,\n credentialId: registered.credential.id,\n publicKey: toBase64Url(registered.credential.publicKey),\n signCount: Math.max(0, Math.trunc(registered.credential.counter) || 0),\n transports: registered.credential.transports ?? null,\n name,\n aaguid: registered.aaguid || null,\n backedUp: registered.credentialBackedUp === true,\n deviceType: registered.credentialDeviceType,\n createdBy: 'self',\n });\n if (!inserted?.id) {\n throw new PasskeyRegistrationError('This passkey is already registered.');\n }\n // The session was validated before the insert, and an administrator's\n // removeAllPasskeys can have swept sessions and credentials in between.\n // Re-read the stored session AFTER the insert: a sweep that revoked it has\n // already committed (refuse and undo); a sweep that has not will delete\n // this row when it clears the person's credentials, which it does after\n // revoking sessions.\n try {\n await this.assertFreshManager(input.actor);\n } catch (error) {\n await this.credentials.deleteOwned(inserted.id, userId);\n throw error;\n }\n // Concurrent registrations can each pass the count above; settle it with\n // one deterministic loser (the newest row by creation time, then id), never\n // \"every request that sees the overflow removes itself\", which would fail\n // every concurrent registration.\n if ((await this.credentials.countByUserId(userId)) > this.maxPasskeys) {\n const kept = (await this.credentials.listByUserId(userId))\n .slice(0, this.maxPasskeys)\n .some((passkey) => passkey.id === inserted.id);\n if (!kept) {\n await this.credentials.deleteOwned(inserted.id, userId);\n throw this.limitReached();\n }\n }\n await this.recordManagement(userId, input.ipAddress, {\n action: 'register',\n self: true,\n deviceType: inserted.deviceType,\n });\n return { passkey: this.summarize(inserted) };\n }\n\n // -------------------------------------------------------------------------\n // Management\n // -------------------------------------------------------------------------\n\n /**\n * The person's passkeys, oldest first: their own, or — for an\n * administrator holding `managePermission` under the single-tenant target\n * rule — someone else's. Never key material or credential ids.\n */\n async listPasskeys(input: ListPasskeysInput): Promise<PasskeySummary[]> {\n this.assertNotLayered(input.actor);\n const actorId = input.actor.user?.id;\n if (!actorId || !UUID_PATTERN.test(actorId)) {\n throw new PasskeyCredentialForbiddenError();\n }\n const targetId = input.userId?.trim() || actorId;\n if (targetId !== actorId) {\n await this.assertCanManage(input.actor, targetId);\n } else {\n // Self: decided on the stored session, like registration.\n await this.assertOwnSession(input.actor);\n }\n return (await this.credentials.listByUserId(targetId)).map((passkey) =>\n this.summarize(passkey),\n );\n }\n\n /** The person renames one of their own passkeys. */\n async renamePasskey(\n input: RenamePasskeyInput,\n ): Promise<{ passkey: PasskeySummary }> {\n this.assertNotLayered(input.actor);\n const userId = input.actor.user?.id;\n if (!userId || !UUID_PATTERN.test(userId)) {\n throw new PasskeyCredentialForbiddenError();\n }\n await this.assertOwnSession(input.actor);\n const passkey = await this.requireOwned(input.passkeyId, userId);\n const name = this.normalizeName(input.name, false);\n if (\n !(await this.credentials.renameOwned(passkey.id as string, userId, name))\n ) {\n throw new PasskeyCredentialForbiddenError();\n }\n await this.recordManagement(userId, input.ipAddress, {\n action: 'rename',\n self: true,\n });\n passkey.name = name;\n return { passkey: this.summarize(passkey) };\n }\n\n /**\n * Remove one passkey: the person's own (from a fresh session) or, for an\n * administrator under the single-tenant target rule, anyone's. Sessions\n * end before AND after the delete, so a failure between the two leaves the\n * person signed out, never signed in on a passkey that is gone: for an\n * administrator every passkey session of the person; for the person every\n * one except the current session — unless the current session was signed in\n * with the removed passkey, which then ends too.\n */\n async removePasskey(\n input: RemovePasskeyInput,\n ): Promise<{ revokedSessions: number; endedCurrentSession: boolean }> {\n this.assertNotLayered(input.actor);\n const actorId = input.actor.user?.id;\n if (!actorId || !UUID_PATTERN.test(actorId)) {\n throw new PasskeyCredentialForbiddenError();\n }\n const passkey = UUID_PATTERN.test(input.passkeyId)\n ? await this.credentials.get(input.passkeyId)\n : null;\n if (!passkey?.id) throw new PasskeyCredentialForbiddenError();\n const passkeyId = passkey.id;\n const targetId = passkey.userId;\n const self = targetId === actorId;\n\n let endedCurrentSession = false;\n if (self) {\n const { session } = await this.assertFreshManager(input.actor);\n endedCurrentSession =\n session.getData<unknown>(PASSKEY_SESSION_DATA_KEY) === passkeyId;\n } else {\n await this.assertCanManage(input.actor, targetId);\n }\n\n const endSessions = () =>\n this.sessionService.destroyUserSessionsByAuthMethod(\n targetId,\n PASSKEY_LOGIN_KIND,\n {\n exceptSessionId:\n self && !endedCurrentSession ? input.actor.sessionId : undefined,\n },\n );\n let revokedSessions = await endSessions();\n if (!(await this.credentials.deleteOwned(passkeyId, targetId))) {\n throw new PasskeyCredentialForbiddenError();\n }\n revokedSessions += await endSessions();\n await this.recordManagement(targetId, input.ipAddress, {\n action: 'remove',\n self,\n ...(self ? {} : { actorId }),\n revokedSessions,\n });\n return { revokedSessions, endedCurrentSession };\n }\n\n /**\n * Administrative recovery for a person who lost every authenticator: delete\n * all their passkeys and end every passkey session of theirs. Holding\n * `managePermission` under the single-tenant target rule; never on oneself.\n * The person then signs in with another credential and registers anew.\n */\n async removeAllPasskeys(\n input: RemoveAllPasskeysInput,\n ): Promise<{ removed: number; revokedSessions: number }> {\n this.assertNotLayered(input.actor);\n const actorId = input.actor.user?.id;\n if (!actorId || input.userId === actorId) {\n throw new PasskeyCredentialForbiddenError();\n }\n await this.assertCanManage(input.actor, input.userId);\n const endSessions = () =>\n this.sessionService.destroyUserSessionsByAuthMethod(\n input.userId,\n PASSKEY_LOGIN_KIND,\n );\n let revokedSessions = await endSessions();\n const removed = await this.credentials.deleteAllForUser(input.userId);\n revokedSessions += await endSessions();\n await this.recordManagement(input.userId, input.ipAddress, {\n action: 'remove-all',\n self: false,\n actorId,\n removed,\n revokedSessions,\n });\n return { removed, revokedSessions };\n }\n\n /** Whether the person has a passkey (for admin UIs; never for sign-in responses). */\n async hasPasskeys(userId: string): Promise<boolean> {\n if (!UUID_PATTERN.test(userId)) return false;\n return (await this.credentials.countByUserId(userId)) > 0;\n }\n\n // -------------------------------------------------------------------------\n // Ceremonies\n // -------------------------------------------------------------------------\n\n private sign(payloadB64: string): Buffer {\n return createHmac('sha256', this.challengeSecret)\n .update(payloadB64)\n .digest();\n }\n\n private issueCeremony(\n purpose: PasskeyChallengePurpose,\n registration?: { userId: string; sessionHash: string },\n ): { ceremonyId: string; challenge: string } {\n const challenge = toBase64Url(randomBytes(CHALLENGE_BYTES));\n const payload: CeremonyPayload = {\n v: 1,\n purpose,\n challenge,\n exp: Date.now() + this.challengeTtlMs,\n ...registration,\n };\n const payloadB64 = toBase64Url(JSON.stringify(payload));\n return {\n ceremonyId: `${payloadB64}.${toBase64Url(this.sign(payloadB64))}`,\n challenge,\n };\n }\n\n /**\n * Check a ceremony id: bounded, well formed, correctly signed (constant\n * time), for `purpose`, and unexpired. Throws {@link CeremonyRejectedError}.\n */\n private readCeremony(\n ceremonyId: unknown,\n purpose: PasskeyChallengePurpose,\n ): CeremonyPayload {\n if (\n typeof ceremonyId !== 'string' ||\n ceremonyId.length === 0 ||\n ceremonyId.length > MAX_CEREMONY_ID_LENGTH\n ) {\n throw new CeremonyRejectedError();\n }\n const parts = ceremonyId.split('.');\n const [payloadB64, macB64] = parts;\n if (\n parts.length !== 2 ||\n !payloadB64 ||\n !macB64 ||\n !BASE64URL_PATTERN.test(payloadB64) ||\n !BASE64URL_PATTERN.test(macB64)\n ) {\n throw new CeremonyRejectedError();\n }\n const presented = Buffer.from(macB64, 'base64url');\n const expected = this.sign(payloadB64);\n if (\n presented.length !== expected.length ||\n !timingSafeEqual(presented, expected)\n ) {\n throw new CeremonyRejectedError();\n }\n let payload: unknown;\n try {\n payload = JSON.parse(\n Buffer.from(payloadB64, 'base64url').toString('utf8'),\n );\n } catch {\n throw new CeremonyRejectedError();\n }\n if (\n !isRecord(payload) ||\n payload.v !== 1 ||\n payload.purpose !== purpose ||\n typeof payload.exp !== 'number' ||\n !Number.isFinite(payload.exp) ||\n payload.exp <= Date.now() ||\n typeof payload.challenge !== 'string' ||\n payload.challenge.length !== 43 ||\n !BASE64URL_PATTERN.test(payload.challenge)\n ) {\n throw new CeremonyRejectedError();\n }\n if (purpose === 'registration') {\n if (\n typeof payload.userId !== 'string' ||\n typeof payload.sessionHash !== 'string' ||\n !SHA256_HEX_PATTERN.test(payload.sessionHash)\n ) {\n throw new CeremonyRejectedError();\n }\n }\n return payload as unknown as CeremonyPayload;\n }\n\n /**\n * {@link readCeremony}, then consume it: of any number of uses of one\n * ceremony exactly one gets past the unique challenge hash.\n */\n private async consumeCeremony(\n ceremonyId: unknown,\n purpose: PasskeyChallengePurpose,\n ): Promise<CeremonyPayload> {\n const payload = this.readCeremony(ceremonyId, purpose);\n const consumed = await this.challenges.consume(\n sha256Hex(payload.challenge),\n purpose,\n new Date(payload.exp),\n );\n if (!consumed) throw new CeremonyRejectedError();\n return payload;\n }\n\n // -------------------------------------------------------------------------\n // Internals\n // -------------------------------------------------------------------------\n\n /**\n * Select a tenant only when a passkey-authenticated person has exactly one\n * active direct membership; resolved after the assertion verifies, so\n * ambiguity cannot turn a successful sign-in into an unscoped session.\n */\n private async resolveUniqueActiveMembershipTenant(\n userId: string,\n ): Promise<string | null> {\n const memberships = await withSystemContext(() =>\n this.memberships.findActiveByUser(userId),\n );\n return memberships.length === 1 && memberships[0]?.tenantId\n ? memberships[0].tenantId\n : null;\n }\n\n private assertNotLayered(actor: SessionContext): void {\n // A session layered on a shared device (a PIN session) may sit on an\n // unattended tablet: it never manages passkeys, its own included.\n if (actor.parent || actor.authMethod === 'pin') {\n throw new PasskeyCredentialForbiddenError();\n }\n }\n\n /**\n * The actor's own STORED session row, never the caller-built context: it\n * must exist and still be valid, belong to the actor, not be layered, and\n * carry no permission ceiling — a restricted session, such as a\n * must-change password session, cannot manage an authenticator.\n */\n private async assertOwnSession(actor: SessionContext): Promise<Session> {\n this.assertNotLayered(actor);\n const userId = actor.user?.id;\n if (\n !userId ||\n !UUID_PATTERN.test(userId) ||\n typeof actor.sessionId !== 'string' ||\n !UUID_PATTERN.test(actor.sessionId)\n ) {\n throw new PasskeyCredentialForbiddenError();\n }\n const session = await this.sessionRows.findValidSession(actor.sessionId);\n if (\n !session ||\n session.userId !== userId ||\n session.parentSessionId ||\n session.authMethod === 'pin' ||\n session.getPermissionCeiling() !== null\n ) {\n throw new PasskeyCredentialForbiddenError();\n }\n return session;\n }\n\n /**\n * The actor may enrol or remove their own passkey only from an\n * {@link assertOwnSession} session that was authenticated within\n * `freshSessionSeconds` by an interactive method in `freshAuthMethods`.\n * The method is read from the stored row: a `terminal` approval can mint a\n * brand new first-class session for anyone holding any session, so its\n * `created_at` proves nothing about the person.\n */\n private async assertFreshManager(\n actor: SessionContext,\n ): Promise<{ user: User; session: Session }> {\n const session = await this.assertOwnSession(actor);\n if (\n typeof session.authMethod !== 'string' ||\n !this.freshAuthMethods.has(session.authMethod)\n ) {\n throw new PasskeyReauthenticationRequiredError();\n }\n // The authentication time, not the row's age: tenant-switch rotation\n // mints a new row but carries the original time forward, and a malformed\n // stamp reads as null (stale).\n const mintedAt = session.getAuthenticatedAt()?.getTime();\n if (\n typeof mintedAt !== 'number' ||\n Date.now() - mintedAt > this.freshSessionMs\n ) {\n throw new PasskeyReauthenticationRequiredError();\n }\n const user = await this.users.get(actor.user.id as string);\n if (!user?.id || !user.isActive()) {\n throw new PasskeyCredentialForbiddenError();\n }\n return { user, session };\n }\n\n private async assertCanManage(\n actor: SessionContext,\n targetUserId: string,\n ): Promise<void> {\n if (!actor.permissions.includes(this.managePermission)) {\n throw new PasskeyCredentialForbiddenError();\n }\n // `permissions` were resolved for the actor's tenant, so they confer\n // authority only over that tenant's people. A person's passkeys (and the\n // session sweep a removal triggers) are one set across every tenant, so\n // the target must be an active member of the actor's tenant AND of no\n // other — otherwise a tenant-A admin could remove a tenant-B account's\n // passkeys. Unknown, malformed and foreign targets are refused alike.\n // Read outside any ambient tenant filter, like the permission resolver.\n const active =\n actor.tenantId && UUID_PATTERN.test(targetUserId)\n ? (\n await withSystemContext(() =>\n this.memberships.findByUser(targetUserId),\n )\n ).filter((membership) => membership.isActive())\n : [];\n if (\n active.length === 0 ||\n active.some((membership) => membership.tenantId !== actor.tenantId)\n ) {\n throw new PasskeyCredentialForbiddenError();\n }\n }\n\n private async requireOwned(\n passkeyId: string,\n userId: string,\n ): Promise<UsersPasskeyCredential> {\n const passkey = UUID_PATTERN.test(passkeyId)\n ? await this.credentials.findOwned(passkeyId, userId)\n : null;\n if (!passkey) throw new PasskeyCredentialForbiddenError();\n return passkey;\n }\n\n /** Trim and bound a passkey name; throws {@link PasskeyRegistrationError}. */\n private normalizeName(name: unknown, allowDefault: boolean): string {\n const trimmed =\n typeof name === 'string' ? name.normalize('NFC').trim() : '';\n if (!trimmed) {\n if (allowDefault) return DEFAULT_PASSKEY_NAME;\n throw new PasskeyRegistrationError('Enter a name for this passkey.');\n }\n if (codePointLength(trimmed) > PASSKEY_NAME_MAX_LENGTH) {\n throw new PasskeyRegistrationError(\n `A passkey name can be at most ${PASSKEY_NAME_MAX_LENGTH} characters.`,\n );\n }\n // Control and format characters are never part of a visible name.\n if (/\\p{C}/u.test(trimmed)) {\n throw new PasskeyRegistrationError(\n 'A passkey name cannot contain control characters.',\n );\n }\n return trimmed;\n }\n\n private limitReached(): PasskeyRegistrationError {\n return new PasskeyRegistrationError(\n `You can register at most ${this.maxPasskeys} passkeys. Remove one first.`,\n );\n }\n\n private registrationFailed(): PasskeyRegistrationError {\n return new PasskeyRegistrationError(\n 'Your passkey could not be verified. Try again.',\n );\n }\n\n private summarize(passkey: UsersPasskeyCredential): PasskeySummary {\n return {\n id: passkey.id as string,\n name: passkey.name,\n createdAt: passkey.created_at ? passkey.created_at.toISOString() : null,\n lastUsedAt: passkey.lastUsedAt\n ? new Date(passkey.lastUsedAt).toISOString()\n : null,\n backedUp: passkey.backedUp === true,\n deviceType: passkey.deviceType ?? null,\n transports: passkey.getTransports(),\n };\n }\n\n private async recordManagement(\n userId: string,\n ipAddress: string | undefined,\n metadata: Record<string, unknown>,\n ): Promise<void> {\n await this.limiter.recordManagement({\n kind: PASSKEY_LOGIN_KIND,\n subject: userId,\n source: ipAddress,\n metadata,\n });\n }\n}\n","/**\n * TerminalAuthService — device-code grant for terminal/CLI logins.\n *\n * Flow:\n * 1. CLI calls `createRequest(origin)` → user code (short, displayed) + device\n * code (long, kept secret) + verification URL.\n * 2. User opens the verification URL in a browser, signs in normally, and\n * POSTs the user code via `approveRequest({ user, tenantId, userCode })`.\n * 3. CLI polls `exchangeDeviceCode(deviceCode)`; once approved, gets back the\n * bearer session id (an opaque token usable as `Authorization: Bearer …`).\n * 4. Server-side request handlers resolve incoming bearer tokens via\n * `loadBearerSession(token)`, and revoke them via `destroyBearerSession`.\n *\n * The service is framework-agnostic: it does not set cookies, parse Request\n * objects, or render pages. SvelteKit glue lives in the package's\n * `./sveltekit` subpath.\n *\n * @packageDocumentation\n */\n\nimport { createHash, randomBytes } from 'node:crypto';\nimport {\n isUniqueViolationError,\n type SmrtClassOptions,\n} from '@happyvertical/smrt-core';\nimport { UsersCliAuthRequestCollection } from '../collections/CliAuthRequestCollection.js';\nimport type {\n CliAuthRequestStatus,\n UsersCliAuthRequest,\n} from '../models/CliAuthRequest.js';\nimport type { User } from '../models/User.js';\nimport {\n LoginAttemptLimiter,\n type LoginAuditSink,\n} from './LoginAttemptLimiter.js';\nimport { type SessionContext, SessionService } from './SessionService.js';\n\n/** Default polling interval the CLI should honour while waiting for approval. */\nexport const DEFAULT_CLI_AUTH_POLL_INTERVAL_SECONDS = 2;\n/** Default lifetime of a pending request (10 minutes). */\nexport const DEFAULT_CLI_AUTH_REQUEST_TTL_SECONDS = 10 * 60;\n/** Default lifetime of the session minted on approval (30 days). */\nexport const DEFAULT_CLI_SESSION_TTL_SECONDS = 30 * 24 * 60 * 60;\n/** Default cap on consecutive failed approve attempts per user before lockout. */\nexport const DEFAULT_CLI_AUTH_MAX_APPROVE_ATTEMPTS = 5;\n/** Default sliding window for counting failed approve attempts (5 minutes). */\nexport const DEFAULT_CLI_AUTH_APPROVE_ATTEMPT_WINDOW_SECONDS = 5 * 60;\n\n/**\n * Options for {@link TerminalAuthService}.\n */\nexport interface TerminalAuthServiceOptions extends SmrtClassOptions {\n /**\n * Cookie name passed through to {@link SessionService}. Should match the\n * site's normal session cookie name so the same SessionService can\n * resolve both browser cookies and CLI bearer tokens.\n */\n sessionCookieName?: string;\n /**\n * Prefix prepended to randomly generated user codes — purely for human\n * recognition (\"WG-1A2B3C4D\"). Defaults to no prefix.\n */\n userCodePrefix?: string;\n /** TTL of a pending request, in seconds. */\n requestTtlSeconds?: number;\n /** TTL of the session minted on approval, in seconds. */\n sessionTtlSeconds?: number;\n /** Polling interval hint returned to clients. */\n pollIntervalSeconds?: number;\n /**\n * Path on the site's origin where the approval page is mounted. Used to\n * build the verification URL returned to the CLI. Defaults to\n * `/terminal-login`.\n */\n verificationPath?: string;\n /** Whether the underlying SessionService should auto-extend on access. */\n sessionAutoExtend?: boolean;\n /**\n * Maximum consecutive failed approve attempts allowed per user inside the\n * sliding window before the user is locked out from approving any further\n * codes. Defaults to {@link DEFAULT_CLI_AUTH_MAX_APPROVE_ATTEMPTS}.\n *\n * User codes are only 32 bits of entropy; without this throttle, an\n * authenticated attacker could brute-force pending codes and hijack\n * another user's CLI session by approving it themselves.\n */\n maxApproveAttempts?: number;\n /**\n * Sliding window (seconds) over which {@link maxApproveAttempts} counts.\n * Defaults to {@link DEFAULT_CLI_AUTH_APPROVE_ATTEMPT_WINDOW_SECONDS}.\n */\n approveAttemptWindowSeconds?: number;\n /**\n * Shared {@link LoginAttemptLimiter} (#3273). When supplied, its budget,\n * backoff and audit configuration win and the two options above are\n * ignored; otherwise a private limiter is created from them with the\n * fixed window only (no exponential lockout), which is the behaviour\n * terminal approval always had.\n */\n loginLimiter?: LoginAttemptLimiter;\n /** Audit sink for the private limiter. Ignored when `loginLimiter` is set. */\n loginAudit?: LoginAuditSink | false;\n}\n\n/** Credential kind the terminal approve flow reports to the login limiter. */\nexport const TERMINAL_APPROVE_LOGIN_KIND = 'terminal-approve';\n\n/**\n * What `createRequest` returns to the CLI.\n */\nexport interface CliAuthStartResult {\n deviceCode: string;\n expiresAt: string;\n interval: number;\n /** Stable issuer used by clients to bind the resulting bearer credential. */\n issuer: string;\n userCode: string;\n verificationUrl: string;\n}\n\n/**\n * What `exchangeDeviceCode` returns to the polling CLI.\n */\nexport type CliAuthTokenResult =\n | { status: 'pending'; expiresAt: string; interval: number }\n | { status: 'expired' }\n | {\n status: 'approved';\n accessToken: string;\n expiresIn: number;\n tokenType: 'Bearer';\n };\n\n/**\n * Inputs for `approveRequest`. The caller is responsible for authenticating\n * the user via its existing browser session before calling this.\n */\nexport interface ApproveCliAuthRequestInput {\n userCode: string;\n user: Pick<User, 'id' | 'email'>;\n tenantId: string | null | undefined;\n ipAddress?: string;\n userAgent?: string;\n}\n\nfunction base64url(bytes: Buffer): string {\n return bytes.toString('base64url');\n}\n\nfunction hashDeviceCode(deviceCode: string): string {\n return createHash('sha256').update(deviceCode).digest('hex');\n}\n\nfunction isExpired(request: UsersCliAuthRequest): boolean {\n return new Date(request.expiresAt).getTime() <= Date.now();\n}\n\n/**\n * High-level orchestration of the terminal device-code flow.\n */\nexport class TerminalAuthService {\n private readonly options: TerminalAuthServiceOptions;\n private readonly userCodePrefix: string;\n private readonly requestTtlSeconds: number;\n private readonly sessionTtlSeconds: number;\n private readonly pollIntervalSeconds: number;\n private readonly verificationPath: string;\n private readonly maxApproveAttempts: number;\n private readonly approveAttemptWindowMs: number;\n private readonly approveQueuesByUser = new Map<string, Promise<void>>();\n private loginLimiter!: LoginAttemptLimiter;\n private requestCollection!: UsersCliAuthRequestCollection;\n private sessionService!: SessionService;\n\n constructor(options: TerminalAuthServiceOptions) {\n this.options = options;\n // Lookups uppercase the submitted code before querying, so the stored\n // form must also be uppercase — normalize once here so consumers can\n // pass any case.\n this.userCodePrefix = (options.userCodePrefix ?? '').trim().toUpperCase();\n this.requestTtlSeconds =\n options.requestTtlSeconds ?? DEFAULT_CLI_AUTH_REQUEST_TTL_SECONDS;\n this.sessionTtlSeconds =\n options.sessionTtlSeconds ?? DEFAULT_CLI_SESSION_TTL_SECONDS;\n this.pollIntervalSeconds =\n options.pollIntervalSeconds ?? DEFAULT_CLI_AUTH_POLL_INTERVAL_SECONDS;\n this.maxApproveAttempts =\n options.maxApproveAttempts ?? DEFAULT_CLI_AUTH_MAX_APPROVE_ATTEMPTS;\n this.approveAttemptWindowMs =\n (options.approveAttemptWindowSeconds ??\n DEFAULT_CLI_AUTH_APPROVE_ATTEMPT_WINDOW_SECONDS) * 1000;\n const verificationPath = options.verificationPath ?? '/terminal-login';\n this.verificationPath = verificationPath.startsWith('/')\n ? verificationPath\n : `/${verificationPath}`;\n }\n\n async initialize(): Promise<void> {\n this.loginLimiter =\n this.options.loginLimiter ??\n (await LoginAttemptLimiter.create({\n ...this.options,\n audit: this.options.loginAudit,\n lockout: false,\n maxAttempts: this.maxApproveAttempts,\n windowSeconds: this.approveAttemptWindowMs / 1000,\n }));\n this.requestCollection = await UsersCliAuthRequestCollection.create(\n this.options,\n );\n this.sessionService = await SessionService.create({\n ...this.options,\n autoExtend: this.options.sessionAutoExtend ?? true,\n cookieName: this.options.sessionCookieName,\n defaultTTL: this.sessionTtlSeconds,\n });\n }\n\n static async create(\n options: TerminalAuthServiceOptions,\n ): Promise<TerminalAuthService> {\n const service = new TerminalAuthService(options);\n await service.initialize();\n return service;\n }\n\n private makeUserCode(): string {\n const raw = randomBytes(6).toString('hex').toUpperCase().slice(0, 8);\n return this.userCodePrefix ? `${this.userCodePrefix}-${raw}` : raw;\n }\n\n /**\n * Generate a user code that is not present in durable request history.\n * Collisions are vanishingly rare (1 in 2^32 per attempt) but happen at\n * scale; retrying keeps the affected CLI from being locked out.\n */\n private async makeUniqueUserCode(maxAttempts = 5): Promise<string> {\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n const candidate = this.makeUserCode();\n const existing = await this.requestCollection.findByUserCode(candidate);\n if (!existing) return candidate;\n }\n throw new TerminalAuthError(\n 'Unable to generate a unique terminal user code; try again.',\n );\n }\n\n /**\n * Start a new request. Returns the device code the CLI keeps secret, the\n * user code the human types into the browser, and the verification URL to\n * open. The device code is stored only as a hash.\n */\n async createRequest(origin: string): Promise<CliAuthStartResult> {\n const trimmedOrigin = origin.replace(/\\/+$/u, '');\n for (let attempt = 0; attempt < 5; attempt++) {\n const deviceCode = base64url(randomBytes(32));\n const userCode = await this.makeUniqueUserCode();\n const expiresAt = new Date(Date.now() + this.requestTtlSeconds * 1000);\n\n try {\n await this.requestCollection.create({\n deviceCodeHash: hashDeviceCode(deviceCode),\n expiresAt,\n status: 'pending',\n userCode,\n });\n } catch (error) {\n if (isUniqueViolationError(error) && attempt < 4) continue;\n throw error;\n }\n\n return {\n deviceCode,\n expiresAt: expiresAt.toISOString(),\n interval: this.pollIntervalSeconds,\n issuer: trimmedOrigin,\n userCode,\n verificationUrl: `${trimmedOrigin}${this.verificationPath}?code=${encodeURIComponent(userCode)}`,\n };\n }\n\n throw new TerminalAuthError(\n 'Unable to create a unique terminal login request; try again.',\n );\n }\n\n /**\n * Look up a request by user code. Performs lazy expiry: pending requests\n * past their TTL are flipped to `expired` and persisted.\n */\n async getRequestForUserCode(\n userCode: string,\n ): Promise<UsersCliAuthRequest | null> {\n const request = await this.requestCollection.findByUserCode(userCode);\n if (!request) return null;\n\n if (request.status === 'pending' && isExpired(request)) {\n request.status = 'expired';\n await request.save();\n }\n return request;\n }\n\n /**\n * Mark a pending request as approved and mint a bearer session bound to the\n * approving user. Idempotent: re-approving an already-approved request is a\n * no-op. Throws if the user/tenant are missing, the request is unknown, or\n * the request has expired.\n */\n async approveRequest(\n input: ApproveCliAuthRequestInput,\n ): Promise<UsersCliAuthRequest> {\n if (!input.user.id || !input.tenantId) {\n throw new TerminalAuthError(\n 'An authenticated tenant session is required.',\n );\n }\n const userId = input.user.id;\n const tenantId = input.tenantId;\n\n return await this.withSerializedApprove(userId, async () => {\n // The limiter is the cross-replica arbiter (#3273), keyed on the\n // approving user alone, as this throttle always was: the approver is\n // already authenticated, and a per-address budget would let one user\n // behind a shared address refuse approvals for everyone else there.\n // The reservation is only kept for attempts that fail the code check.\n const lease = await this.loginLimiter.reserve({\n kind: TERMINAL_APPROVE_LOGIN_KIND,\n // Prefixed so this budget never pools with the same person's PIN\n // or password budget, whichever limiter instance is in use: wrong\n // PINs typed at a tablet must not refuse their terminal approvals,\n // and an approval must not clear a PIN backoff.\n subject: `${TERMINAL_APPROVE_LOGIN_KIND}:${userId}`,\n });\n if (!lease.allowed) {\n throw new TerminalAuthRateLimitError(\n 'Too many failed terminal-login attempts. Try again later.',\n lease.retryAfterSeconds,\n );\n }\n\n // How to settle the reservation: a wrong/expired code keeps it (fail),\n // the approval of a pending request hands it back and clears the\n // streak (succeed), and an idempotent re-approval or an unexpected\n // error hands it back untouched (release).\n let settle: 'fail' | 'succeed' | 'release' = 'release';\n try {\n const request = await this.getRequestForUserCode(input.userCode);\n if (!request) {\n settle = 'fail';\n throw new TerminalAuthError('Terminal login request not found.');\n }\n if (request.status === 'approved' || request.status === 'consumed') {\n // Idempotent success — don't penalize a re-approval or a\n // double-click after the CLI already exchanged the approved token.\n // Released, not `succeed`: re-submitting an old approved code must\n // not clear the streak from guessing at other codes.\n settle = 'release';\n return request;\n }\n if (request.status !== 'pending' || isExpired(request)) {\n request.status = 'expired';\n await request.save();\n settle = 'fail';\n throw new TerminalAuthError('Terminal login request has expired.');\n }\n\n const approved = await this.requestCollection.approvePendingRequest({\n approvedBy: input.user.email ?? userId,\n ipAddress: input.ipAddress,\n sessionTtlSeconds: this.sessionTtlSeconds,\n tenantId,\n userAgent: input.userAgent,\n userCode: input.userCode,\n userId,\n });\n if (!approved) {\n const concurrent = await this.getRequestForUserCode(input.userCode);\n if (\n concurrent?.status === 'approved' ||\n concurrent?.status === 'consumed'\n ) {\n settle = 'release';\n return concurrent;\n }\n settle = 'fail';\n throw new TerminalAuthError('Terminal login request has expired.');\n }\n request.approvedAt = approved.approvedAt;\n request.sessionId = approved.sessionId;\n request.status = 'approved';\n request.tenantId = approved.tenantId;\n request.userId = approved.userId;\n settle = 'succeed';\n return request;\n } finally {\n // A reservation that cannot be settled stays reserved: it is\n // fail-closed and expires with its window, which is the safe side\n // when the CLI may already be able to exchange a minted credential.\n await lease[settle]().catch(() => undefined);\n }\n });\n }\n\n /**\n * Serialize approval attempts per user within this process so a burst of\n * parallel approvals of one valid code settles one reservation at a time\n * instead of each holding its own; the shared limiter row remains the\n * cross-replica arbiter.\n */\n private async withSerializedApprove<T>(\n userId: string,\n operation: () => Promise<T>,\n ): Promise<T> {\n const previous = this.approveQueuesByUser.get(userId) ?? Promise.resolve();\n let release = () => {};\n const gate = new Promise<void>((resolve) => {\n release = resolve;\n });\n const tail = previous.then(() => gate);\n this.approveQueuesByUser.set(userId, tail);\n\n await previous;\n try {\n return await operation();\n } finally {\n release();\n if (this.approveQueuesByUser.get(userId) === tail) {\n this.approveQueuesByUser.delete(userId);\n }\n }\n }\n\n /**\n * Exchange a device code (the secret the CLI keeps) for an access token\n * once the request has been approved. Returns `{ status: 'pending' }` while\n * the CLI should keep polling, and `{ status: 'expired' }` if the request\n * was never approved within its TTL.\n */\n async exchangeDeviceCode(deviceCode: string): Promise<CliAuthTokenResult> {\n const deviceCodeHash = hashDeviceCode(deviceCode);\n const request =\n await this.requestCollection.findByDeviceCodeHash(deviceCodeHash);\n if (!request) {\n return { status: 'expired' };\n }\n\n // Approved requests stay claimable even after the original request TTL —\n // the session has its own (longer) lifetime, and the CLI may poll just\n // after approval but after `expiresAt`. Check this before TTL expiry so\n // freshly minted sessions don't get orphaned.\n if (request.status === 'approved' && request.sessionId) {\n const accessToken =\n await this.requestCollection.consumeApprovedSession(deviceCodeHash);\n if (!accessToken) return { status: 'expired' };\n return {\n accessToken,\n expiresIn: this.sessionTtlSeconds,\n status: 'approved',\n tokenType: 'Bearer',\n };\n }\n\n if (isExpired(request)) {\n if (request.status === 'pending') {\n request.status = 'expired';\n await request.save();\n }\n return { status: 'expired' };\n }\n\n if (request.status === 'pending') {\n return {\n expiresAt: new Date(request.expiresAt).toISOString(),\n interval: this.pollIntervalSeconds,\n status: 'pending',\n };\n }\n\n return { status: 'expired' };\n }\n\n /**\n * Resolve a bearer token issued by this service into a full session\n * context — load the user, permissions, and tenant just like the cookie\n * path does. Returns `null` if the token is unknown, expired, or revoked.\n */\n async loadBearerSession(token: string): Promise<SessionContext | null> {\n return this.sessionService.loadSessionContext(token);\n }\n\n /**\n * Revoke a bearer token (CLI logout). Returns true if a session was\n * actually revoked.\n */\n async destroyBearerSession(token: string): Promise<boolean> {\n return this.sessionService.destroySession(token);\n }\n\n /**\n * Delete expired pending or already-consumed requests (cleanup job).\n */\n async cleanupExpiredRequests(): Promise<number> {\n return this.requestCollection.deleteExpired();\n }\n\n /** The default polling interval clients should use. Exposed for tests. */\n get pollInterval(): number {\n return this.pollIntervalSeconds;\n }\n}\n\n/**\n * Error class for terminal auth failures the caller is expected to surface to\n * the user (vs. unexpected internal errors).\n */\nexport class TerminalAuthError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'TerminalAuthError';\n }\n}\n\n/**\n * Thrown when a user has exceeded the configured failed-approve budget. The\n * caller (SvelteKit handler, REST adapter, etc.) is expected to surface this\n * as HTTP 429 with `Retry-After: retryAfterSeconds`.\n */\nexport class TerminalAuthRateLimitError extends TerminalAuthError {\n readonly retryAfterSeconds: number;\n\n constructor(message: string, retryAfterSeconds: number) {\n super(message);\n this.name = 'TerminalAuthRateLimitError';\n this.retryAfterSeconds = retryAfterSeconds;\n }\n}\n\nexport type { CliAuthRequestStatus };\n"],"x_google_ignoreList":[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24],"mappings":";;;;;;;;AAOA,eAAe,wBAAwB,KAAK,MAAM,w6/PAAm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