@happyvertical/smrt-profiles 0.61.2 → 0.61.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/audit-trail.d.ts +1 -1
- package/dist/audit-trail.d.ts.map +1 -1
- package/dist/auth/magicLinkService.d.ts +1 -1
- package/dist/auth/magicLinkService.d.ts.map +1 -1
- package/dist/auth/oidcProvisioningPrimitives.d.ts.map +1 -1
- package/dist/auth/resolveIdentity.d.ts.map +1 -1
- package/dist/chunks/{ApiKey-9YuYcpWy.js → ApiKey-BhseCX_J.js} +9 -6
- package/dist/chunks/ApiKey-BhseCX_J.js.map +1 -0
- package/dist/chunks/{ApiKeyCollection-BrJT9vo_.js → ApiKeyCollection-BK2Wn-wa.js} +3 -3
- package/dist/chunks/{ApiKeyCollection-BrJT9vo_.js.map → ApiKeyCollection-BK2Wn-wa.js.map} +1 -1
- package/dist/chunks/{AuditLogCollection-BBbvr8Qc.js → AuditLogCollection-NYUFFPni.js} +9 -9
- package/dist/chunks/AuditLogCollection-NYUFFPni.js.map +1 -0
- package/dist/chunks/{NostrIdentity-RJaATTCt.js → NostrIdentity-joAS5ZlD.js} +8 -5
- package/dist/chunks/{NostrIdentity-RJaATTCt.js.map → NostrIdentity-joAS5ZlD.js.map} +1 -1
- package/dist/chunks/{NostrIdentityCollection-BPNgPOBE.js → NostrIdentityCollection-B9G_vrWL.js} +4 -10
- package/dist/chunks/{NostrIdentityCollection-BPNgPOBE.js.map → NostrIdentityCollection-B9G_vrWL.js.map} +1 -1
- package/dist/chunks/{OidcIdentity-CFsyI8H1.js → OidcIdentity-uX-K-vHR.js} +7 -4
- package/dist/chunks/OidcIdentity-uX-K-vHR.js.map +1 -0
- package/dist/chunks/{OidcIdentityCollection-SMH6SHxF.js → OidcIdentityCollection-CwgUAk_O.js} +3 -3
- package/dist/chunks/{OidcIdentityCollection-SMH6SHxF.js.map → OidcIdentityCollection-CwgUAk_O.js.map} +1 -1
- package/dist/chunks/{ProfileAssetCollection-2Jhy3vhC.js → ProfileAssetCollection-CkzuPlWl.js} +5 -3
- package/dist/chunks/ProfileAssetCollection-CkzuPlWl.js.map +1 -0
- package/dist/chunks/{ProfileCollection-5UJJmUW5.js → ProfileCollection-5Ams2c-J.js} +36 -31
- package/dist/chunks/ProfileCollection-5Ams2c-J.js.map +1 -0
- package/dist/chunks/{ProfileLinkCollection-D9rfzly5.js → ProfileLinkCollection-Cl9rY_U_.js} +5 -3
- package/dist/chunks/ProfileLinkCollection-Cl9rY_U_.js.map +1 -0
- package/dist/chunks/{ProfileMetadataCollection-CAgJyjze.js → ProfileMetadataCollection-BStSVlUX.js} +11 -5
- package/dist/chunks/ProfileMetadataCollection-BStSVlUX.js.map +1 -0
- package/dist/chunks/{ProfileMetafieldCollection-19ae6Lpf.js → ProfileMetafieldCollection-DCZi2Ba1.js} +3 -3
- package/dist/chunks/ProfileMetafieldCollection-DCZi2Ba1.js.map +1 -0
- package/dist/chunks/{ProfileRelationshipCollection-BFSlTQ7J.js → ProfileRelationshipCollection-Cat8A3R3.js} +17 -8
- package/dist/chunks/ProfileRelationshipCollection-Cat8A3R3.js.map +1 -0
- package/dist/chunks/{ProfileRelationshipTermCollection-OluL8BGP.js → ProfileRelationshipTermCollection-CInZSL7B.js} +6 -3
- package/dist/chunks/ProfileRelationshipTermCollection-CInZSL7B.js.map +1 -0
- package/dist/chunks/{ProfileRelationshipType-Cevy-vaF.js → ProfileRelationshipType-tp6iZQVQ.js} +3 -3
- package/dist/chunks/ProfileRelationshipType-tp6iZQVQ.js.map +1 -0
- package/dist/chunks/{ProfileRelationshipTypeCollection-BRBpX00F.js → ProfileRelationshipTypeCollection-Dkb0nsnt.js} +3 -3
- package/dist/chunks/{ProfileRelationshipTypeCollection-BRBpX00F.js.map → ProfileRelationshipTypeCollection-Dkb0nsnt.js.map} +1 -1
- package/dist/chunks/{ProfileTypeCollection-DYA74l6-.js → ProfileTypeCollection-2fjo--pR.js} +3 -3
- package/dist/chunks/{ProfileTypeCollection-DYA74l6-.js.map → ProfileTypeCollection-2fjo--pR.js.map} +1 -1
- package/dist/chunks/{oidcProvisioningPrimitives-iQUIWC7F.js → oidcProvisioningPrimitives-ChynZ3aX.js} +8 -8
- package/dist/chunks/oidcProvisioningPrimitives-ChynZ3aX.js.map +1 -0
- package/dist/chunks/{resolveIdentity-CT1tK-Kn.js → resolveIdentity-Bsjd2yDj.js} +20 -20
- package/dist/chunks/resolveIdentity-Bsjd2yDj.js.map +1 -0
- package/dist/collections/AuditLogCollection.d.ts.map +1 -1
- package/dist/collections/NostrIdentityCollection.d.ts.map +1 -1
- package/dist/collections/ProfileCollection.d.ts.map +1 -1
- package/dist/index.js +33 -30
- package/dist/index.js.map +1 -1
- package/dist/internal/oidc-provisioning.js +2 -2
- package/dist/manifest.json +905 -342
- package/dist/models/ApiKey.d.ts.map +1 -1
- package/dist/models/AuditLog.d.ts.map +1 -1
- package/dist/models/MagicLinkToken.d.ts.map +1 -1
- package/dist/models/OidcProfileEmailReservation.d.ts.map +1 -1
- package/dist/models/ProfileAsset.d.ts.map +1 -1
- package/dist/models/ProfileLink.d.ts.map +1 -1
- package/dist/models/ProfileRelationship.d.ts.map +1 -1
- package/dist/models/ProfileRelationshipTerm.d.ts.map +1 -1
- package/dist/smrt-knowledge.json +11 -11
- package/dist/utils.js +4 -4
- package/package.json +11 -11
- package/dist/chunks/ApiKey-9YuYcpWy.js.map +0 -1
- package/dist/chunks/AuditLogCollection-BBbvr8Qc.js.map +0 -1
- package/dist/chunks/OidcIdentity-CFsyI8H1.js.map +0 -1
- package/dist/chunks/ProfileAssetCollection-2Jhy3vhC.js.map +0 -1
- package/dist/chunks/ProfileCollection-5UJJmUW5.js.map +0 -1
- package/dist/chunks/ProfileLinkCollection-D9rfzly5.js.map +0 -1
- package/dist/chunks/ProfileMetadataCollection-CAgJyjze.js.map +0 -1
- package/dist/chunks/ProfileMetafieldCollection-19ae6Lpf.js.map +0 -1
- package/dist/chunks/ProfileRelationshipCollection-BFSlTQ7J.js.map +0 -1
- package/dist/chunks/ProfileRelationshipTermCollection-OluL8BGP.js.map +0 -1
- package/dist/chunks/ProfileRelationshipType-Cevy-vaF.js.map +0 -1
- package/dist/chunks/oidcProvisioningPrimitives-iQUIWC7F.js.map +0 -1
- package/dist/chunks/resolveIdentity-CT1tK-Kn.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileMetadataCollection-CAgJyjze.js","names":[],"sources":["../../src/models/ProfileMetadata.ts","../../src/collections/ProfileMetadataCollection.ts"],"sourcesContent":["/**\n * ProfileMetadata model - Stores metadata values for profiles\n *\n * Links profiles to metafield definitions with actual values.\n * Uses UUID primary key with foreign keys to Profile and ProfileMetafield.\n */\n\nimport {\n field,\n foreignKey,\n SmrtObject,\n type SmrtObjectOptions,\n smrt,\n} from '@happyvertical/smrt-core';\nimport { TenantScoped, tenantId } from '@happyvertical/smrt-tenancy';\n\nexport interface ProfileMetadataOptions extends SmrtObjectOptions {\n profileId?: string;\n metafieldId?: string;\n value?: string;\n tenantId?: string | null;\n}\n\n@TenantScoped({ mode: 'optional' })\n@smrt({\n tableStrategy: 'sti',\n api: { include: ['list', 'get', 'create', 'update', 'delete'] },\n mcp: { include: ['list', 'get'] },\n cli: { skipApiCheck: true },\n})\nexport class ProfileMetadata extends SmrtObject { static __smrtPackage__ = \"@happyvertical/smrt-profiles\";\n @tenantId({ nullable: true })\n tenantId: string | null = null;\n\n // id: UUID (auto-generated by SmrtObject)\n @foreignKey('Profile', { required: true })\n profileId?: string; // References Profile.id\n\n @foreignKey('ProfileMetafield', { required: true })\n metafieldId?: string; // References ProfileMetafield.id\n\n @field({ required: true })\n value: string = ''; // The metadata value (stored as text)\n\n constructor(options: ProfileMetadataOptions = {}) {\n super(options);\n if (options.profileId !== undefined) this.profileId = options.profileId;\n if (options.metafieldId !== undefined)\n this.metafieldId = options.metafieldId;\n if (options.value) this.value = options.value;\n // The class-field initializer above runs after super(), so an explicit\n // tenant must be re-applied here or it is silently dropped.\n if (options.tenantId !== undefined) this.tenantId = options.tenantId;\n }\n\n /**\n * Validate this metadata value against the metafield's validation schema\n *\n * @returns True if valid, throws error if invalid\n */\n async validate(): Promise<boolean> {\n const metafield = await this.loadRelated('metafieldId');\n if (!metafield) {\n throw new Error('Metafield not found');\n }\n\n return await metafield.validateValue(this.value);\n }\n\n /**\n * Get the metafield slug for this metadata\n *\n * @returns The slug of the metafield\n */\n async getMetafieldSlug(): Promise<string> {\n const metafield = await this.loadRelated('metafieldId');\n return metafield?.slug || '';\n }\n}\n","/**\n * ProfileMetadataCollection - Collection manager for ProfileMetadata objects\n *\n * Provides querying and batch operations for profile metadata.\n */\n\nimport { SmrtCollection } from '@happyvertical/smrt-core';\nimport { ProfileMetadata } from '../models/ProfileMetadata';\n\nexport class ProfileMetadataCollection extends SmrtCollection<ProfileMetadata> {\n static readonly _itemClass = ProfileMetadata;\n\n /**\n * Get all metadata for a profile\n *\n * @param profileId - The profile UUID\n * @returns Array of ProfileMetadata instances\n */\n async getByProfile(profileId: string): Promise<ProfileMetadata[]> {\n return await this.list({ where: { profileId } });\n }\n\n /**\n * Get metadata as key-value object for a profile\n *\n * @param profileId - The profile UUID\n * @returns Object with metafield slugs as keys\n */\n async getMetadataObject(profileId: string): Promise<Record<string, string>> {\n const metadata = await this.getByProfile(profileId);\n const result: Record<string, string> = {};\n\n for (const item of metadata) {\n const slug = await item.getMetafieldSlug();\n if (slug) {\n result[slug] = item.value;\n }\n }\n\n return result;\n }\n\n /**\n * Find all profiles with a specific metadata key-value pair\n *\n * @param metafieldId - The metafield UUID\n * @param value - The value to match\n * @returns Array of profile UUIDs\n */\n async findProfilesByMetadata(\n metafieldId: string,\n value: unknown,\n ): Promise<string[]> {\n const matches = await this.list({\n where: { metafieldId, value: String(value) },\n });\n\n return matches\n .map((m) => m.profileId)\n .filter((id) => typeof id === 'string') as string[];\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA8BO,IAA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B,CAAC,CAAA,GACY,eAAA;;;;ACrBN,IAAM,4BAAN,cAAwC,eAAgC;CAC7E,OAAgB,aAAa;;;;;;;CAQ7B,MAAM,aAAa,WAA+C;EAChE,OAAO,MAAM,KAAK,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;CACjD;;;;;;;CAQA,MAAM,kBAAkB,WAAoD;EAC1E,MAAM,WAAW,MAAM,KAAK,aAAa,SAAS;EAClD,MAAM,SAAiC,CAAC;EAExC,KAAA,MAAW,QAAQ,UAAU;GAC3B,MAAM,OAAO,MAAM,KAAK,iBAAiB;GACzC,IAAI,MACF,OAAO,QAAQ,KAAK;EAExB;EAEA,OAAO;CACT;;;;;;;;CASA,MAAM,uBACJ,aACA,OACmB;EAKnB,QAAO,MAJe,KAAK,KAAK,EAC9B,OAAO;GAAE;GAAa,OAAO,OAAO,KAAK;EAAE,EAC7C,CAAC,EAAA,CAGE,KAAK,MAAM,EAAE,SAAS,CAAA,CACtB,QAAQ,OAAO,OAAO,OAAO,QAAQ;CAC1C;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileMetafieldCollection-19ae6Lpf.js","names":[],"sources":["../../src/models/ProfileMetafield.ts","../../src/collections/ProfileMetafieldCollection.ts"],"sourcesContent":["/**\n * ProfileMetafield model - Controlled vocabulary for metadata fields\n *\n * Defines allowed metadata keys with validation rules.\n * Uses UUID primary key with unique slug for human-readable lookups.\n */\n\nimport {\n field,\n SmrtObject,\n type SmrtObjectOptions,\n smrt,\n} from '@happyvertical/smrt-core';\nimport { TenantScoped, tenantId } from '@happyvertical/smrt-tenancy';\nimport type { ValidationSchema, ValidatorFunction } from '../types';\n\nexport interface ProfileMetafieldOptions extends SmrtObjectOptions {\n slug?: string;\n name?: string;\n description?: string;\n validation?: ValidationSchema;\n tenantId?: string | null;\n}\n\n/**\n * Extend globalThis to include custom validators registry.\n * Using globalThis ensures all module instances share the same validators,\n * which is critical in monorepos where the same package can be loaded\n * from different paths (e.g., pnpm store vs workspace symlink).\n *\n * @see https://github.com/happyvertical/smrt/issues/543\n */\ndeclare global {\n // eslint-disable-next-line no-var\n var __smrtProfileMetafieldValidators:\n | Map<string, ValidatorFunction>\n | undefined;\n}\n\n/**\n * Get the custom validators Map from globalThis\n */\nfunction getCustomValidators(): Map<string, ValidatorFunction> {\n if (!globalThis.__smrtProfileMetafieldValidators) {\n globalThis.__smrtProfileMetafieldValidators = new Map<\n string,\n ValidatorFunction\n >();\n }\n return globalThis.__smrtProfileMetafieldValidators;\n}\n\n@TenantScoped({ mode: 'optional' })\n@smrt({\n tableStrategy: 'sti',\n api: { include: ['list', 'get', 'create', 'update'] },\n mcp: { include: ['list', 'get'] },\n cli: { skipApiCheck: true },\n})\nexport class ProfileMetafield extends SmrtObject { static __smrtPackage__ = \"@happyvertical/smrt-profiles\";\n @tenantId({ nullable: true })\n tenantId: string | null = null;\n\n // id: UUID (auto-generated by SmrtObject)\n // slug is inherited from SmrtObject (auto-generated from name)\n @field({ required: true })\n name: string = '';\n\n description?: string;\n\n validation?: ValidationSchema; // Validation schema as JSON\n\n constructor(options: ProfileMetafieldOptions = {}) {\n super(options);\n if (options.name) this.name = options.name;\n if (options.description !== undefined)\n this.description = options.description;\n if (options.validation !== undefined) this.validation = options.validation;\n // The class-field initializer above runs after super(), so an explicit\n // tenant must be re-applied here or it is silently dropped.\n if (options.tenantId !== undefined) this.tenantId = options.tenantId;\n }\n\n /**\n * Convenience method for slug-based lookup\n *\n * @param slug - The slug to search for\n * @returns ProfileMetafield instance or null if not found\n */\n static async getBySlug(_slug: string): Promise<ProfileMetafield | null> {\n // Will be auto-implemented by SMRT\n return null;\n }\n\n /**\n * Register a custom validator function\n *\n * @param name - Name of the validator (used in validation.custom field)\n * @param validator - The validator function\n */\n static registerValidator(name: string, validator: ValidatorFunction): void {\n getCustomValidators().set(name, validator);\n }\n\n /**\n * Get a registered custom validator\n *\n * @param name - Name of the validator\n * @returns The validator function or undefined\n */\n static getValidator(name: string): ValidatorFunction | undefined {\n return getCustomValidators().get(name);\n }\n\n /**\n * Validate a value against this metafield's validation schema\n *\n * @param value - The value to validate\n * @returns True if valid, throws ValidationError if invalid\n */\n async validateValue(value: unknown): Promise<boolean> {\n if (!this.validation) return true;\n\n const schema = this.validation;\n\n // Type validation\n if (schema.type) {\n const actualType = typeof value;\n const expectedType = schema.type;\n\n if (expectedType === 'number' && actualType !== 'number') {\n throw new Error(\n schema.message || `Expected ${expectedType}, got ${actualType}`,\n );\n }\n if (expectedType === 'string' && actualType !== 'string') {\n throw new Error(\n schema.message || `Expected ${expectedType}, got ${actualType}`,\n );\n }\n if (expectedType === 'boolean' && actualType !== 'boolean') {\n throw new Error(\n schema.message || `Expected ${expectedType}, got ${actualType}`,\n );\n }\n }\n\n // String validations\n if (schema.pattern && typeof value === 'string') {\n const regex = new RegExp(schema.pattern);\n if (!regex.test(value)) {\n throw new Error(schema.message || 'Pattern validation failed');\n }\n }\n\n if (schema.minLength && typeof value === 'string') {\n if (value.length < schema.minLength) {\n throw new Error(\n schema.message ||\n `Minimum length is ${schema.minLength}, got ${value.length}`,\n );\n }\n }\n\n if (schema.maxLength && typeof value === 'string') {\n if (value.length > schema.maxLength) {\n throw new Error(\n schema.message ||\n `Maximum length is ${schema.maxLength}, got ${value.length}`,\n );\n }\n }\n\n // Numeric validations\n if (schema.min !== undefined && typeof value === 'number') {\n if (value < schema.min) {\n throw new Error(\n schema.message || `Value must be at least ${schema.min}`,\n );\n }\n }\n\n if (schema.max !== undefined && typeof value === 'number') {\n if (value > schema.max) {\n throw new Error(\n schema.message || `Value must be at most ${schema.max}`,\n );\n }\n }\n\n // Custom validator\n if (schema.custom) {\n const validator = ProfileMetafield.getValidator(schema.custom);\n if (!validator) {\n throw new Error(`Custom validator '${schema.custom}' not registered`);\n }\n\n const result = await validator(value);\n if (!result) {\n throw new Error(schema.message || 'Custom validation failed');\n }\n }\n\n return true;\n }\n}\n","/**\n * ProfileMetafieldCollection - Collection manager for ProfileMetafield objects\n *\n * Provides querying for profile metafield lookup table.\n */\n\nimport { SmrtCollection } from '@happyvertical/smrt-core';\nimport { ProfileMetafield } from '../models/ProfileMetafield';\nimport type { ValidationSchema } from '../types';\n\nexport class ProfileMetafieldCollection extends SmrtCollection<ProfileMetafield> {\n static readonly _itemClass = ProfileMetafield;\n\n /**\n * Get metafield by slug\n *\n * @param slug - The slug to search for\n * @returns ProfileMetafield instance or null\n */\n async getBySlug(slug: string): Promise<ProfileMetafield | null> {\n return await this.get({ slug });\n }\n\n /**\n * Get or create a metafield by slug\n *\n * @param slug - The slug to search for\n * @param defaults - Default values if creating\n * @returns ProfileMetafield instance\n */\n async getOrCreateBySlug(\n slug: string,\n defaults: {\n name: string;\n description?: string;\n validation?: ValidationSchema;\n },\n ): Promise<ProfileMetafield> {\n const existing = await this.getBySlug(slug);\n if (existing) return existing;\n\n const metafield = await this.create({ slug, ...defaults });\n await metafield.save();\n return metafield;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA0CA,SAAS,sBAAsD;CAC7D,IAAI,CAAC,WAAW,kCACd,WAAW,mDAAmC,IAAI,IAGhD;CAEJ,OAAO,WAAW;AACpB;AASO,IAAM,mBAAN,cAA+B,WAAW;CAE/C,WAA0B;CAK1B,OAAe;CAEf;CAEA;CAEA,YAAY,UAAmC,CAAC,GAAG;EACjD,MAAM,OAAO;EACb,IAAI,QAAQ,MAAM,KAAK,OAAO,QAAQ;EACtC,IAAI,QAAQ,gBAAgB,KAAA,GAC1B,KAAK,cAAc,QAAQ;EAC7B,IAAI,QAAQ,eAAe,KAAA,GAAW,KAAK,aAAa,QAAQ;EAGhE,IAAI,QAAQ,aAAa,KAAA,GAAW,KAAK,WAAW,QAAQ;CAC9D;;;;;;;CAQA,aAAa,UAAU,OAAiD;EAEtE,OAAO;CACT;;;;;;;CAQA,OAAO,kBAAkB,MAAc,WAAoC;EACzE,oBAAoB,CAAA,CAAE,IAAI,MAAM,SAAS;CAC3C;;;;;;;CAQA,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AO,QAAQ;GACjB,MAAM,YAAY,iBAAiB,aAAa,OAAO,MAAM;GAC7D,IAAI,CAAC,WACH,MAAM,IAAI,MAAM,qBAAqB,OAAO,OAAM,iBAAkB;GAItE,IAAI,CAAC,MADgB,UAAU,KAAK,GAElC,MAAM,IAAI,MAAM,OAAO,WAAW,0BAA0B;EAEhE;EAEA,OAAO;CACT;AACF;AAlJmD,cAAtC,kBAA6C,mBAAkB,8BAAA;AAE1E,gBAAA,CADC,SAAS,EAAE,UAAU,KAAK,CAAC,CAAA,GADjB,iBAEX,WAAA,YAAA,CAAA;AAKA,gBAAA,CADC,MAAM,EAAE,UAAU,KAAK,CAAC,CAAA,GANd,iBAOX,WAAA,QAAA,CAAA;AAPW,mBAAN,gBAAA,CAPN,aAAa,EAAE,MAAM,WAAW,CAAC,GACjC,KAAK;CACJ,eAAe;CACf,KAAK,EAAE,SAAS;EAAC;EAAQ;EAAO;EAAU;CAAQ,EAAE;CACpD,KAAK,EAAE,SAAS,CAAC,QAAQ,KAAK,EAAE;CAChC,KAAK,EAAE,cAAc,KAAK;AAC5B,CAAC,CAAA,GACY,gBAAA;;;;ACjDN,IAAM,6BAAN,cAAyC,eAAiC;CAC/E,OAAgB,aAAa;;;;;;;CAQ7B,MAAM,UAAU,MAAgD;EAC9D,OAAO,MAAM,KAAK,IAAI,EAAE,KAAK,CAAC;CAChC;;;;;;;;CASA,MAAM,kBACJ,MACA,UAK2B;EAC3B,MAAM,WAAW,MAAM,KAAK,UAAU,IAAI;EAC1C,IAAI,UAAU,OAAO;EAErB,MAAM,YAAY,MAAM,KAAK,OAAO;GAAE;GAAM,GAAG;EAAS,CAAC;EACzD,MAAM,UAAU,KAAK;EACrB,OAAO;CACT;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileRelationshipCollection-BFSlTQ7J.js","names":[],"sources":["../../src/models/ProfileRelationship.ts","../../src/collections/ProfileRelationshipCollection.ts"],"sourcesContent":["/**\n * ProfileRelationship model - Connects two profiles with a relationship type\n *\n * Represents directional or reciprocal relationships between profiles.\n * Uses UUID primary key with foreign keys to profiles and relationship type.\n */\n\nimport {\n foreignKey,\n oneToMany,\n SmrtObject,\n type SmrtObjectOptions,\n smrt,\n} from '@happyvertical/smrt-core';\nimport { TenantScoped, tenantId } from '@happyvertical/smrt-tenancy';\nimport type { ProfileRelationshipTerm } from './ProfileRelationshipTerm';\n\nexport interface ProfileRelationshipOptions extends SmrtObjectOptions {\n fromProfileId?: string;\n toProfileId?: string;\n typeId?: string;\n contextProfileId?: string;\n tenantId?: string | null;\n}\n\n@TenantScoped({ mode: 'optional' })\n@smrt({\n tableStrategy: 'sti',\n api: { include: ['list', 'get', 'create', 'delete'] },\n mcp: { include: ['list', 'get'] },\n cli: { skipApiCheck: true },\n})\nexport class ProfileRelationship extends SmrtObject { static __smrtPackage__ = \"@happyvertical/smrt-profiles\";\n @tenantId({ nullable: true })\n tenantId: string | null = null;\n\n // id: UUID (auto-generated by SmrtObject)\n @foreignKey('Profile', { required: true })\n fromProfileId?: string; // Origin profile\n\n @foreignKey('Profile', { required: true })\n toProfileId?: string; // Target profile\n\n @foreignKey('ProfileRelationshipType', { required: true })\n typeId?: string; // Relationship type\n\n @foreignKey('Profile')\n contextProfileId?: string; // Optional tertiary context\n\n // Relationships\n @oneToMany('ProfileRelationshipTerm')\n terms: ProfileRelationshipTerm[] = [];\n\n constructor(options: ProfileRelationshipOptions = {}) {\n super(options);\n if (options.fromProfileId !== undefined)\n this.fromProfileId = options.fromProfileId;\n if (options.toProfileId !== undefined)\n this.toProfileId = options.toProfileId;\n if (options.typeId !== undefined) this.typeId = options.typeId;\n if (options.contextProfileId !== undefined)\n this.contextProfileId = options.contextProfileId;\n }\n\n /**\n * Get the relationship type slug\n *\n * @returns The slug of the relationship type\n */\n async getTypeSlug(): Promise<string> {\n const type = await this.loadRelated('typeId');\n return type?.slug || '';\n }\n\n /**\n * Add a term (time period) to this relationship\n *\n * @param startedAt - Start date of the term\n * @param endedAt - Optional end date of the term\n */\n async addTerm(startedAt: Date, endedAt?: Date): Promise<void> {\n if (!this.id) {\n throw new Error(\n 'ProfileRelationship.addTerm requires a persisted relationship (missing id)',\n );\n }\n const relationshipId = this.id;\n\n const { ProfileRelationshipTermCollection } = await import(\n '../collections/ProfileRelationshipTermCollection'\n );\n\n const termCollection = await ProfileRelationshipTermCollection.create(\n this.options,\n );\n\n const term = await termCollection.create({\n relationshipId,\n startedAt,\n endedAt,\n });\n\n await term.save();\n }\n\n /**\n * End the current active term\n *\n * @param endedAt - End date for the term\n */\n async endCurrentTerm(endedAt: Date): Promise<void> {\n const activeTerm = await this.getActiveTerm();\n if (activeTerm) {\n await activeTerm.end(endedAt);\n }\n }\n\n /**\n * Get all terms for this relationship\n *\n * @returns Array of ProfileRelationshipTerm instances\n */\n async getTerms(): Promise<ProfileRelationshipTerm[]> {\n const { ProfileRelationshipTermCollection } = await import(\n '../collections/ProfileRelationshipTermCollection'\n );\n\n const termCollection = await ProfileRelationshipTermCollection.create(\n this.options,\n );\n\n return await termCollection.getByRelationship(this.id as string);\n }\n\n /**\n * Get the active term (no end date)\n *\n * @returns Current term or null if none active\n */\n async getActiveTerm(): Promise<ProfileRelationshipTerm | null> {\n const { ProfileRelationshipTermCollection } = await import(\n '../collections/ProfileRelationshipTermCollection'\n );\n\n const termCollection = await ProfileRelationshipTermCollection.create(\n this.options,\n );\n\n return await termCollection.getActiveTerm(this.id as string);\n }\n}\n","/**\n * ProfileRelationshipCollection - Collection manager for ProfileRelationship objects\n *\n * Provides querying for relationships between profiles.\n */\n\nimport { SmrtCollection } from '@happyvertical/smrt-core';\nimport { ProfileRelationship } from '../models/ProfileRelationship';\n\nexport class ProfileRelationshipCollection extends SmrtCollection<ProfileRelationship> {\n static readonly _itemClass = ProfileRelationship;\n\n /**\n * Get all relationships from a profile\n *\n * @param fromProfileId - The origin profile UUID\n * @param typeId - Optional filter by relationship type UUID\n * @returns Array of ProfileRelationship instances\n */\n async getFromProfile(\n fromProfileId: string,\n typeId?: string,\n ): Promise<ProfileRelationship[]> {\n const where: Record<string, unknown> = { fromProfileId };\n if (typeId) where.typeId = typeId;\n\n return await this.list({ where });\n }\n\n /**\n * Get all relationships to a profile\n *\n * @param toProfileId - The target profile UUID\n * @param typeId - Optional filter by relationship type UUID\n * @returns Array of ProfileRelationship instances\n */\n async getToProfile(\n toProfileId: string,\n typeId?: string,\n ): Promise<ProfileRelationship[]> {\n const where: Record<string, unknown> = { toProfileId };\n if (typeId) where.typeId = typeId;\n\n return await this.list({ where });\n }\n\n /**\n * Get all relationships for a profile (both directions)\n *\n * @param profileId - The profile UUID\n * @param typeId - Optional filter by relationship type UUID\n * @returns Array of ProfileRelationship instances\n */\n async getForProfile(\n profileId: string,\n typeId?: string,\n ): Promise<ProfileRelationship[]> {\n const fromRelationships = await this.getFromProfile(profileId, typeId);\n const toRelationships = await this.getToProfile(profileId, typeId);\n\n return [...fromRelationships, ...toRelationships];\n }\n\n /**\n * Check if a relationship exists between two profiles\n *\n * @param fromProfileId - The origin profile UUID\n * @param toProfileId - The target profile UUID\n * @param typeId - The relationship type UUID\n * @returns True if relationship exists\n */\n async exists(\n fromProfileId: string,\n toProfileId: string,\n typeId: string,\n ): Promise<boolean> {\n const matches = await this.list({\n where: { fromProfileId, toProfileId, typeId },\n limit: 1,\n });\n\n return matches.length > 0;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgCO,IAAM,sBAAN,cAAkC,WAAW;CAElD,WAA0B;CAI1B;CAGA;CAGA;CAGA;CAIA,QAAmC,CAAC;CAEpC,YAAY,UAAsC,CAAC,GAAG;EACpD,MAAM,OAAO;EACb,IAAI,QAAQ,kBAAkB,KAAA,GAC5B,KAAK,gBAAgB,QAAQ;EAC/B,IAAI,QAAQ,gBAAgB,KAAA,GAC1B,KAAK,cAAc,QAAQ;EAC7B,IAAI,QAAQ,WAAW,KAAA,GAAW,KAAK,SAAS,QAAQ;EACxD,IAAI,QAAQ,qBAAqB,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S;CAC1B;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileRelationshipTermCollection-OluL8BGP.js","names":[],"sources":["../../src/models/ProfileRelationshipTerm.ts","../../src/collections/ProfileRelationshipTermCollection.ts"],"sourcesContent":["/**\n * ProfileRelationshipTerm model - Temporal data for relationships\n *\n * Defines the duration or terms of a specific relationship.\n * Uses UUID primary key with foreign key to ProfileRelationship.\n */\n\nimport {\n field,\n foreignKey,\n SmrtObject,\n type SmrtObjectOptions,\n smrt,\n} from '@happyvertical/smrt-core';\n\nexport interface ProfileRelationshipTermOptions extends SmrtObjectOptions {\n relationshipId?: string;\n startedAt?: Date;\n endedAt?: Date;\n}\n\n@smrt({\n tableStrategy: 'sti',\n api: { include: ['list', 'get', 'create', 'update', 'delete'] },\n mcp: { include: ['list', 'get'] },\n cli: { skipApiCheck: true },\n})\nexport class ProfileRelationshipTerm extends SmrtObject { static __smrtPackage__ = \"@happyvertical/smrt-profiles\";\n // id: UUID (auto-generated by SmrtObject)\n @foreignKey('ProfileRelationship', { required: true })\n relationshipId?: string; // References ProfileRelationship.id\n\n @field({ required: true })\n startedAt: Date = new Date(); // Start date of the term\n\n endedAt?: Date; // Optional end date\n\n constructor(options: ProfileRelationshipTermOptions = {}) {\n super(options);\n if (options.relationshipId !== undefined)\n this.relationshipId = options.relationshipId;\n if (options.startedAt) this.startedAt = options.startedAt;\n if (options.endedAt !== undefined) this.endedAt = options.endedAt;\n }\n\n /**\n * Check if this term is currently active\n *\n * @returns True if active (no end date or end date in future)\n */\n isActive(): boolean {\n if (!this.endedAt) return true;\n return this.endedAt > new Date();\n }\n\n /**\n * End this term\n *\n * @param endedAt - End date for the term (defaults to now)\n */\n async end(endedAt: Date = new Date()): Promise<void> {\n this.endedAt = endedAt;\n await this.save();\n }\n\n /**\n * Get the duration of this term in days\n *\n * @returns Duration in days\n */\n getDurationDays(): number {\n const endValue = this.endedAt || new Date();\n const diffMs = endValue.getTime() - this.startedAt.getTime();\n return Math.floor(diffMs / (1000 * 60 * 60 * 24));\n }\n}\n","/**\n * ProfileRelationshipTermCollection - Collection manager for ProfileRelationshipTerm objects\n *\n * Provides querying for relationship terms (temporal data).\n */\n\nimport { SmrtCollection } from '@happyvertical/smrt-core';\nimport { ProfileRelationshipTerm } from '../models/ProfileRelationshipTerm';\n\nexport class ProfileRelationshipTermCollection extends SmrtCollection<ProfileRelationshipTerm> {\n static readonly _itemClass = ProfileRelationshipTerm;\n\n /**\n * Get all terms for a relationship\n *\n * @param relationshipId - The relationship UUID\n * @returns Array of ProfileRelationshipTerm instances\n */\n async getByRelationship(\n relationshipId: string,\n ): Promise<ProfileRelationshipTerm[]> {\n return await this.list({\n where: { relationshipId },\n orderBy: ['startedAt DESC'],\n });\n }\n\n /**\n * Get the active term for a relationship (no end date or future end date)\n *\n * @param relationshipId - The relationship UUID\n * @returns Active term or null\n */\n async getActiveTerm(\n relationshipId: string,\n ): Promise<ProfileRelationshipTerm | null> {\n const terms = await this.getByRelationship(relationshipId);\n\n for (const term of terms) {\n if (term.isActive()) {\n return term;\n }\n }\n\n return null;\n }\n\n /**\n * Get all historical (ended) terms for a relationship\n *\n * @param relationshipId - The relationship UUID\n * @returns Array of ended ProfileRelationshipTerm instances\n */\n async getHistoricalTerms(\n relationshipId: string,\n ): Promise<ProfileRelationshipTerm[]> {\n const terms = await this.getByRelationship(relationshipId);\n return terms.filter((term) => !term.isActive());\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2BO,IAAM,0BAAN,cAAsC,WAAW;CAGtD;CAGA,4BAAkB,IAAI,KAAK;CAE3B;CAEA,YAAY,UAA0C,CAAC,GAAG;EACxD,MAAM,OAAO;EACb,IAAI,QAAQ,mBAAmB,KAAA,GAC7B,KAAK,iBAAiB,QAAQ;EAChC,IAAI,QAAQ,WAAW,KAAK,YAAY,QAAQ;EAChD,IAAI,QAAQ,YAAY,KAAA,GAAW,KAAK,UAAU,QAAQ;CAC5D;;;;;;CAOA,WA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5C,QAAQ,SAAS,CAAC,KAAK,SAAS,CAAC;CAChD;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileRelationshipType-Cevy-vaF.js","names":[],"sources":["../../src/models/ProfileRelationshipType.ts"],"sourcesContent":["/**\n * ProfileRelationshipType model - Lookup table for relationship types\n *\n * Defines the kinds of relationships that can exist between profiles.\n * Uses UUID primary key with unique slug for human-readable lookups.\n */\n\nimport {\n field,\n SmrtObject,\n type SmrtObjectOptions,\n smrt,\n} from '@happyvertical/smrt-core';\nimport type { ReciprocalHandler } from '../types';\n\nexport interface ProfileRelationshipTypeOptions extends SmrtObjectOptions {\n slug?: string;\n name?: string;\n reciprocal?: boolean;\n}\n\n/**\n * Extend globalThis to include reciprocal handlers registry.\n * Using globalThis ensures all module instances share the same handlers,\n * which is critical in monorepos where the same package can be loaded\n * from different paths (e.g., pnpm store vs workspace symlink).\n *\n * @see https://github.com/happyvertical/smrt/issues/543\n */\ndeclare global {\n // eslint-disable-next-line no-var\n var __smrtProfileRelationshipHandlers:\n | Map<string, ReciprocalHandler>\n | undefined;\n // eslint-disable-next-line no-var\n var __smrtProfileRelationshipHandlersInitialized: boolean | undefined;\n}\n\n/**\n * Get the reciprocal handlers Map from globalThis\n */\nfunction getReciprocalHandlers(): Map<string, ReciprocalHandler> {\n if (!globalThis.__smrtProfileRelationshipHandlers) {\n globalThis.__smrtProfileRelationshipHandlers = new Map<\n string,\n ReciprocalHandler\n >();\n }\n return globalThis.__smrtProfileRelationshipHandlers;\n}\n\n/**\n * Default handlers for common reciprocal relationship patterns\n */\nconst DEFAULT_HANDLERS: Record<string, ReciprocalHandler> = {\n // Symmetric relationships (same type in both directions)\n friend: async (from, to, context) => {\n await to.addRelationship(from, 'friend', context);\n },\n\n spouse: async (from, to) => {\n await to.addRelationship(from, 'spouse');\n },\n\n partner: async (from, to, context) => {\n await to.addRelationship(from, 'partner', context);\n },\n\n colleague: async (from, to, context) => {\n await to.addRelationship(from, 'colleague', context);\n },\n\n sibling: async (from, to) => {\n await to.addRelationship(from, 'sibling');\n },\n};\n\n// Register default handlers (only once across all module instances)\nif (!globalThis.__smrtProfileRelationshipHandlersInitialized) {\n globalThis.__smrtProfileRelationshipHandlersInitialized = true;\n for (const [slug, handler] of Object.entries(DEFAULT_HANDLERS)) {\n getReciprocalHandlers().set(slug, handler);\n }\n}\n\n@smrt({\n tableStrategy: 'sti',\n api: { include: ['list', 'get', 'create', 'update'] },\n mcp: { include: ['list', 'get'] },\n cli: { skipApiCheck: true },\n})\nexport class ProfileRelationshipType extends SmrtObject { static __smrtPackage__ = \"@happyvertical/smrt-profiles\";\n // id: UUID (auto-generated by SmrtObject)\n // slug is inherited from SmrtObject (auto-generated from name)\n @field({ required: true })\n name: string = '';\n\n reciprocal: boolean = true; // True for two-way relationships\n\n constructor(options: ProfileRelationshipTypeOptions = {}) {\n super(options);\n if (options.name) this.name = options.name;\n if (options.reciprocal !== undefined) this.reciprocal = options.reciprocal;\n }\n\n /**\n * Convenience method for slug-based lookup\n *\n * @param slug - The slug to search for\n * @returns ProfileRelationshipType instance or null if not found\n */\n static async getBySlug(\n _slug: string,\n ): Promise<ProfileRelationshipType | null> {\n // Will be auto-implemented by SMRT\n return null;\n }\n\n /**\n * Register a custom reciprocal handler for a relationship type\n *\n * @param slug - The relationship type slug\n * @param handler - The handler function to execute when creating reciprocal relationship\n */\n static registerReciprocalHandler(\n slug: string,\n handler: ReciprocalHandler,\n ): void {\n getReciprocalHandlers().set(slug, handler);\n }\n\n /**\n * Get the reciprocal handler for a relationship type\n *\n * @param slug - The relationship type slug\n * @returns The handler function or undefined\n */\n static getReciprocalHandler(slug: string): ReciprocalHandler | undefined {\n return getReciprocalHandlers().get(slug);\n }\n\n /**\n * Check if a relationship type is reciprocal\n *\n * @param slug - The relationship type slug\n * @returns True if reciprocal, false otherwise\n */\n static async isReciprocal(slug: string): Promise<boolean> {\n const type = await ProfileRelationshipType.getBySlug(slug);\n return type?.reciprocal || false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O,MADY,wBAAwB,UAAU,IAAI,EAAA,EAC5C,cAAc;CAC7B;AACF;AA5D0D,cAA7C,yBAAoD,mBAAkB,8BAAA;AAIjF,gBAAA,CADC,MAAM,EAAE,UAAU,KAAK,CAAC,CAAA,GAHd,wBAIX,WAAA,QAAA,CAAA;AAJW,0BAAN,gBAAA,CANN,KAAK;CACJ,eAAe;CACf,KAAK,EAAE,SAAS;EAAC;EAAQ;EAAO;EAAU;CAAQ,EAAE;CACpD,KAAK,EAAE,SAAS,CAAC,QAAQ,KAAK,EAAE;CAChC,KAAK,EAAE,cAAc,KAAK;AAC5B,CAAC,CAAA,GACY,uBAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"oidcProvisioningPrimitives-iQUIWC7F.js","names":[],"sources":["../../src/models/ProfileTypes.ts","../../src/auth/oidcProvisioningPrimitives.ts"],"sourcesContent":["/**\n * Profile subclasses for STI (Single Table Inheritance)\n *\n * These classes inherit from Profile and automatically use the shared\n * profiles table with _meta_type discriminator.\n */\n\nimport { smrt } from '@happyvertical/smrt-core';\nimport { Profile, type ProfileOptions } from './Profile';\n\n/**\n * Person profile type\n *\n * Represents individual people/users.\n */\n@smrt({\n tableStrategy: 'sti',\n})\nexport class Person extends Profile { static __smrtPackage__ = \"@happyvertical/smrt-profiles\";\n constructor(options: ProfileOptions = {}) {\n super(options);\n // Person-specific initialization can go here\n }\n}\n\n/**\n * Organization profile type\n *\n * Represents companies, groups, institutions, and other organizational entities.\n */\n@smrt({\n tableStrategy: 'sti',\n})\nexport class Organization extends Profile { static __smrtPackage__ = \"@happyvertical/smrt-profiles\";\n constructor(options: ProfileOptions = {}) {\n super(options);\n // Organization-specific initialization can go here\n }\n}\n\n/**\n * Bot profile type\n *\n * Represents automated agents, bots, and AI entities.\n */\n@smrt({\n tableStrategy: 'sti',\n})\nexport class Bot extends Profile { static __smrtPackage__ = \"@happyvertical/smrt-profiles\";\n constructor(options: ProfileOptions = {}) {\n super(options);\n // Bot-specific initialization can go here\n }\n}\n","import type { getDatabase } from '@happyvertical/sql';\nimport { ProfileCollection } from '../collections/ProfileCollection';\nimport { ProfileTypeCollection } from '../collections/ProfileTypeCollection';\nimport { OidcIdentity } from '../models/OidcIdentity';\nimport type { Profile } from '../models/Profile';\nimport { Person } from '../models/ProfileTypes';\nimport { saveOidcRaceArbiter } from './oidcProvisioningCoordinator';\n\ntype DatabaseInterface = Awaited<ReturnType<typeof getDatabase>>;\n\nexport interface OidcProvisioningPersonInput {\n email?: string;\n name?: string;\n preferredUsername?: string;\n subject: string;\n}\n\nexport interface OidcProvisioningIdentityInput {\n email?: string;\n issuer: string;\n profileId: string;\n provider: string;\n subject: string;\n}\n\n/** Create and reserve a fresh global Person inside the caller's transaction. */\nexport async function createOidcProvisioningPerson(\n db: DatabaseInterface,\n input: OidcProvisioningPersonInput,\n): Promise<Profile> {\n const typeCollection = await ProfileTypeCollection.create({ db });\n const personType = await typeCollection.getOrCreateGlobalBySlug('person', {\n name: 'Person',\n description: 'Individual person profile',\n });\n const typeId = requireProvisioningId(personType.id, 'Person ProfileType');\n let profile: Profile = new Person({\n db,\n // OIDC display names are not identity keys. A per-profile slug keeps\n // SMRT's natural-key upsert from replacing an unrelated Person.\n slug: `oidc-${crypto.randomUUID()}`,\n tenantId: null,\n typeId,\n email: input.email ?? '',\n name: input.name || input.preferredUsername || input.subject,\n });\n await profile.initialize();\n await saveOidcRaceArbiter(() => profile.save());\n\n if (input.email) {\n const profiles = await ProfileCollection.create({ db });\n profile = await profiles.reserveCanonicalIdentityEmail(\n requireProvisioningId(profile.id, 'Created Profile'),\n input.email,\n );\n }\n return profile;\n}\n\n/** Insert the identity after the caller proves Profile ownership. */\nexport async function insertOidcProvisioningIdentity(\n db: DatabaseInterface,\n input: OidcProvisioningIdentityInput,\n): Promise<OidcIdentity> {\n const identity = new OidcIdentity({\n db,\n email: input.email ?? '',\n issuer: input.issuer,\n profileId: input.profileId,\n provider: input.provider,\n subject: input.subject,\n });\n await identity.initialize();\n await saveOidcRaceArbiter(() => identity.save());\n return identity;\n}\n\nfunction requireProvisioningId(value: unknown, label: string): string {\n if (typeof value !== 'string' || !value) {\n throw new Error(`${label} did not produce an id.`);\n }\n return value;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkBO,IAAM,SAAN,cAAqB,QAAQ;CAClC,YAAY,UAA0B,CAAC,GAAG;EACxC,MAAM,OAAO;CAEf;AACF;AALsC,cAAzB,QAAgC,mBAAkB,8BAAA;AAAlD,SAAN,gBAAA,CAHN,KAAK,EACJ,eAAe,MACjB,CAAC,CAAA,GACY,MAAA;AAeN,IAAM,eAAN,cAA2B,QAAQ;CACxC,YAAY,UAA0B,CAAC,GAAG;EACxC,MAAM,OAAO;CAEf;AACF;AAL4C,cAA/B,cAAsC,mBAAkB,8BAAA;AAAxD,eAAN,gBAAA,CAHN,KAAK,EACJ,eAAe,MACjB,CAAC,CAAA,GACY,YAAA;AAeN,IAAM,MAAN,cAAkB,QAAQ;CAC/B,YAAY,UAA0B,CAAC,GAAG;EACxC,MAAM,OAAO;CAEf;AACF;AALmC,cAAtB,KAA6B,mBAAkB,8BAAA;AAA/C,MAAN,gBAAA,CAHN,KAAK,EACJ,eAAe,MACjB,CAAC,CAAA,GACY,GAAA;;;ACtBb,eAAsB,6BACpB,IACA,OACkB;CAMlB,MAAM,SAAS,uBAAsB,OAJZ,MADI,sBAAsB,OAAO,EAAE,GAAG,CAAC,EAAA,CACxB,wBAAwB,UAAU;EACxE,MAAM;EACN,aAAa;CACf,CAAC,EAAA,CAC+C,IAAI,oBAAoB;CACxE,IAAI,UAAmB,IAAI,OAAO;EAChC;EAGA,MAAM,QAAQ,OAAO,WAAW;EAChC,UAAU;EACV;EACA,OAAO,MAAM,SAAS;EACtB,MAAM,MAAM,QAAQ,MAAM,qBAAqB,MAAM;CACvD,CAAC;CACD,MAAM,QAAQ,WAAW;CACzB,MAAM,0BAA0B,QAAQ,KAAK,CAAC;CAE9C,IAAI,MAAM,OAER,UAAU,OAAM,MADO,kBAAkB,OAAO,EAAE,GAAG,CAAC,EAAA,CAC7B,8BACvB,sBAAsB,QAAQ,IAAI,iBAAiB,GACnD,MAAM,KACR;CAEF,OAAO;AACT;AAGA,eAAsB,+BACpB,IACA,OACuB;CACvB,MAAM,WAAW,IAAI,aAAa;EAChC;EACA,OAAO,MAAM,SAAS;EACtB,QAAQ,MAAM;EACd,WAAW,MAAM;EACjB,UAAU,MAAM;EAChB,SAAS,MAAM;CACjB,CAAC;CACD,MAAM,SAAS,WAAW;CAC1B,MAAM,0BAA0B,SAAS,KAAK,CAAC;CAC/C,OAAO;AACT;AAEA,SAAS,sBAAsB,OAAgB,OAAuB;CACpE,IAAI,OAAO,UAAU,YAAY,CAAC,OAChC,MAAM,IAAI,MAAM,GAAG,MAAK,wBAAyB;CAEnD,OAAO;AACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveIdentity-CT1tK-Kn.js","names":["profile"],"sources":["../../src/auth/resolveIdentity.ts"],"sourcesContent":["/**\n * resolveIdentity - Resolves authentication context to a Profile\n *\n * Used by apps (blindmanpress.com) to resolve incoming auth to a Profile.\n * Modules (aedile, praeco) should receive the resolved profile from the app.\n *\n * Resolution order:\n * 1. API key header → ApiKey → Profile\n * 2. OIDC session → OidcIdentity → Profile\n * 3. Nostr auth → NostrIdentity → Profile\n * 4. Actor header (CI pass-through) → Profile lookup\n */\n\nimport {\n resolveDatabase,\n type SmrtObjectOptions,\n} from '@happyvertical/smrt-core';\nimport { withSystemContext } from '@happyvertical/smrt-tenancy';\nimport type { DatabaseInterface } from '@happyvertical/sql';\nimport { ApiKey } from '../models/ApiKey';\nimport { NostrIdentity } from '../models/NostrIdentity';\nimport { OidcIdentity } from '../models/OidcIdentity';\nimport type { Profile } from '../models/Profile';\nimport { normalizeIdentityEmail } from './normalizeIdentityEmail';\nimport { type NostrEvent, verifyAuthEvent } from './nostrCrypto';\nimport {\n coordinateOidcProvisioning,\n isOidcProvisioningRaceConflict,\n} from './oidcProvisioningCoordinator';\nimport {\n createOidcProvisioningPerson,\n insertOidcProvisioningIdentity,\n} from './oidcProvisioningPrimitives';\n\n/**\n * Context provided to resolveIdentity\n */\nexport interface AuthContext {\n /**\n * API key from X-API-Key header or similar\n */\n apiKey?: string | null;\n\n /**\n * OIDC session data (from @auth/sveltekit or similar)\n */\n oidcSession?: {\n sub?: string;\n iss?: string;\n email?: string;\n name?: string;\n } | null;\n\n /**\n * Actor identifier for CI pass-through identity\n * Usually the GitHub actor (username) who triggered the workflow\n */\n actor?: string | null;\n\n /**\n * Nostr authentication data (NIP-42 style)\n */\n nostrAuth?: {\n /** Signed Nostr event for authentication */\n event: NostrEvent;\n /** Expected challenge (to prevent replay attacks) */\n challenge: string;\n } | null;\n\n /**\n * Database/persistence options\n */\n db?: SmrtObjectOptions['db'];\n}\n\n/**\n * Result of identity resolution\n */\nexport interface ResolveIdentityResult {\n /**\n * The resolved profile, or null if not authenticated\n */\n profile: Profile | null;\n\n /**\n * How the identity was resolved\n */\n source: 'api_key' | 'oidc' | 'nostr' | 'actor' | 'none';\n\n /**\n * The API key record if authenticated via API key\n */\n apiKey?: ApiKey;\n\n /**\n * The OIDC identity record if authenticated via OIDC\n */\n oidcIdentity?: OidcIdentity;\n\n /**\n * The Nostr identity record if authenticated via Nostr\n */\n nostrIdentity?: NostrIdentity;\n}\n\n/**\n * Resolve authentication context to a Profile\n *\n * @param context - The authentication context from the request\n * @returns The resolved profile and metadata\n *\n * @example\n * ```typescript\n * // In SvelteKit hooks.server.ts\n * import { resolveIdentity } from '@happyvertical/smrt-profiles';\n *\n * const identityMiddleware: Handle = async ({ event, resolve }) => {\n * const session = await event.locals.auth();\n *\n * const { profile, source } = await resolveIdentity({\n * oidcSession: session,\n * apiKey: event.request.headers.get('X-API-Key'),\n * actor: event.request.headers.get('X-Actor'),\n * db: { type: 'postgres', url: DATABASE_URL },\n * });\n *\n * event.locals.profile = profile;\n * event.locals.authSource = source;\n *\n * return resolve(event);\n * };\n * ```\n */\nexport async function resolveIdentity(\n context: AuthContext,\n): Promise<ResolveIdentityResult> {\n const options: SmrtObjectOptions = { db: context.db };\n\n // 1. Check API key header first (highest priority for programmatic access)\n if (context.apiKey) {\n const apiKey = await ApiKey.verify(context.apiKey, options);\n if (apiKey) {\n const profile = await apiKey.getProfile();\n if (profile) {\n return {\n profile,\n source: 'api_key',\n apiKey,\n };\n }\n }\n }\n\n // 2. Check OIDC session (web users)\n if (context.oidcSession?.sub && context.oidcSession?.iss) {\n const oidcIdentity = await OidcIdentity.findBySubject(\n context.oidcSession.iss,\n context.oidcSession.sub,\n options,\n );\n\n if (oidcIdentity) {\n // Record usage\n await oidcIdentity.recordUsage();\n\n const profile = await oidcIdentity.getProfile();\n if (profile) {\n return {\n profile,\n source: 'oidc',\n oidcIdentity,\n };\n }\n }\n }\n\n // 3. Check Nostr auth (NIP-42 style signed event)\n if (context.nostrAuth?.event && context.nostrAuth?.challenge) {\n const { event, challenge } = context.nostrAuth;\n\n // Verify the auth event\n const verifyResult = verifyAuthEvent(event, challenge);\n if (verifyResult.valid) {\n // Look up identity by public key\n const nostrIdentity = await NostrIdentity.findByPubkey(\n event.pubkey,\n options,\n );\n\n if (nostrIdentity) {\n // Record usage\n await nostrIdentity.recordUsage();\n\n const profile = await nostrIdentity.getProfile();\n if (profile) {\n return {\n profile,\n source: 'nostr',\n nostrIdentity,\n };\n }\n }\n }\n }\n\n // 4. Check actor for CI pass-through (look up by metadata)\n if (context.actor) {\n const profile = await findProfileByExternalId(\n 'github',\n context.actor,\n options,\n );\n if (profile) {\n return {\n profile,\n source: 'actor',\n };\n }\n }\n\n // No authentication found\n return {\n profile: null,\n source: 'none',\n };\n}\n\n/**\n * Find a profile by external ID (e.g., GitHub username)\n *\n * This looks up profiles by their linked external identities or metadata.\n *\n * @param provider - The external provider (e.g., 'github')\n * @param externalId - The external identifier (e.g., GitHub username)\n * @param options - Database options\n * @returns The profile or null\n */\nasync function findProfileByExternalId(\n provider: string,\n externalId: string,\n options: SmrtObjectOptions,\n): Promise<Profile | null> {\n // First check OIDC identities (if they use the provider)\n const { OidcIdentityCollection } = await import(\n '../collections/OidcIdentityCollection'\n );\n\n const oidcCollection = await OidcIdentityCollection.create(options);\n const identities = await oidcCollection.findByProvider(provider);\n\n for (const identity of identities) {\n // Check if the subject matches the external ID\n if (\n identity.subject === externalId ||\n identity.email?.includes(externalId)\n ) {\n const profile = await identity.getProfile();\n if (profile) return profile;\n }\n }\n\n // Could also check profile metadata for external IDs\n // This would require a standardized metadata field like 'github_username'\n const { ProfileCollection } = await import(\n '../collections/ProfileCollection'\n );\n const profileCollection = await ProfileCollection.create(options);\n\n // Try to find by email that looks like a GitHub noreply\n const profiles = await profileCollection.list({\n where: {\n email: `${externalId}@users.noreply.github.com`,\n },\n limit: 1,\n });\n\n if (profiles.length > 0) {\n return profiles[0];\n }\n\n return null;\n}\n\n/**\n * Create a profile from OIDC claims if it doesn't exist\n *\n * Resolution order:\n * 1. If OIDC identity (iss + sub) already exists → return linked profile\n * 2. If the email matches an existing Profile, fail closed because this\n * package cannot prove whether a User owns it\n * 3. Otherwise, create new profile + identity\n *\n * Security considerations:\n * - Existing issuer/subject links always keep their already-linked Profile,\n * including legacy tenant-scoped or non-Person Profiles, and refresh the\n * cached identity email. This exact-link compatibility does not perform\n * email-based canonical reuse.\n * - New identities never attach to an existing email match through this\n * Profile-only helper because Profile ownership belongs to the users package.\n * Use `UserCollection.getOrCreateFromOidc()` for owner-aware verified-email\n * reuse and its supported pre-provision resolver hook.\n * - This function trusts the OIDC provider to assert correct email_verified status.\n * Only use with trusted providers.\n *\n * @param claims - OIDC token claims\n * @param provider - Provider name (e.g., 'keycloak', 'google', 'github')\n * @param options - Database options\n * @returns The created or existing profile with linked OIDC identity\n */\nexport async function createProfileFromOidc(\n claims: {\n sub: string;\n iss: string;\n email?: string;\n email_verified?: boolean;\n name?: string;\n preferred_username?: string;\n },\n provider: string,\n options: SmrtObjectOptions,\n): Promise<{ profile: Profile; oidcIdentity: OidcIdentity; created: boolean }> {\n return coordinateProfileOidcProvisioning(claims, provider, options);\n}\n\n/**\n * @internal Transactionally reuse one exact legacy issuer/subject link.\n *\n * This path cannot create or rebind authority. It intentionally preserves\n * existing tenant-scoped and non-Person Profile links; canonical global Person\n * validation remains mandatory for every path that creates a User/session.\n */\nexport async function reuseExistingOidcIdentityForProfile(\n profileId: string,\n claims: {\n sub: string;\n iss: string;\n email?: string;\n email_verified?: boolean;\n name?: string;\n preferred_username?: string;\n },\n provider: string,\n options: SmrtObjectOptions,\n): Promise<{ profile: Profile; oidcIdentity: OidcIdentity; created: false }> {\n const normalizedClaims = normalizeOidcProfileClaims(claims);\n const db = await resolveOidcProfileDatabase(options.db);\n return coordinateOidcProvisioning({\n db,\n lockKeys: [\n `identity:${OidcIdentity.buildIdentityKey(\n normalizedClaims.iss,\n normalizedClaims.sub,\n )}`,\n ],\n isRaceConflict: isOidcProvisioningRaceConflict,\n createTransactionError: (message, cause) =>\n new Error(message, cause === undefined ? undefined : { cause }),\n createConcurrencyError: (cause) =>\n new Error(\n 'Concurrent exact OIDC identity reuse did not converge.',\n cause === undefined ? undefined : { cause },\n ),\n rebindRootResult: rebindOidcProfileResult,\n provision: (tx) =>\n withSystemContext(async () => {\n const { OidcIdentityCollection } = await import(\n '../collections/OidcIdentityCollection'\n );\n const identity = await (\n await OidcIdentityCollection.create({ db: tx })\n ).findBySubject(normalizedClaims.iss, normalizedClaims.sub);\n if (!identity) {\n throw new Error(\n 'OidcIdentity.findOrCreate() no longer creates authentication links; use UserCollection.getOrCreateFromOidc() or createProfileFromOidc().',\n );\n }\n if (identity.profileId !== profileId) {\n throw new Error(\n `OIDC identity ${normalizedClaims.iss} subject ${normalizedClaims.sub} belongs to a different Profile.`,\n );\n }\n const profile = await identity.getProfile();\n if (!profile) {\n throw new Error('The exact OIDC identity has no linked Profile.');\n }\n identity.provider = provider;\n if (normalizedClaims.email) identity.email = normalizedClaims.email;\n identity.lastUsedAt = new Date();\n await identity.save();\n return { profile, oidcIdentity: identity, created: false as const };\n }),\n });\n}\n\nasync function coordinateProfileOidcProvisioning(\n claims: {\n sub: string;\n iss: string;\n email?: string;\n email_verified?: boolean;\n name?: string;\n preferred_username?: string;\n },\n provider: string,\n options: SmrtObjectOptions,\n): Promise<{ profile: Profile; oidcIdentity: OidcIdentity; created: boolean }> {\n const normalizedClaims = normalizeOidcProfileClaims(claims);\n const db = await resolveOidcProfileDatabase(options.db);\n return coordinateOidcProvisioning({\n db,\n lockKeys: [\n `identity:${OidcIdentity.buildIdentityKey(\n normalizedClaims.iss,\n normalizedClaims.sub,\n )}`,\n ...(normalizedClaims.email ? [`email:${normalizedClaims.email}`] : []),\n ],\n isRaceConflict: isOidcProvisioningRaceConflict,\n createTransactionError: (message, cause) =>\n new Error(message, cause === undefined ? undefined : { cause }),\n createConcurrencyError: (cause) =>\n new Error(\n 'Concurrent OIDC Profile provisioning did not converge.',\n cause === undefined ? undefined : { cause },\n ),\n rebindRootResult: rebindOidcProfileResult,\n provision: (tx) =>\n withSystemContext(() =>\n provisionOidcProfile(normalizedClaims, provider, {\n ...options,\n db: tx,\n }),\n ),\n });\n}\n\nasync function provisionOidcProfile(\n claims: {\n sub: string;\n iss: string;\n email?: string;\n email_verified?: boolean;\n name?: string;\n preferred_username?: string;\n },\n provider: string,\n options: SmrtObjectOptions & { db: DatabaseInterface },\n): Promise<{ profile: Profile; oidcIdentity: OidcIdentity; created: boolean }> {\n const { OidcIdentityCollection } = await import(\n '../collections/OidcIdentityCollection'\n );\n const identityCollection = await OidcIdentityCollection.create(options);\n const existingIdentity = await identityCollection.findBySubject(\n claims.iss,\n claims.sub,\n );\n if (existingIdentity) {\n const profile = await existingIdentity.getProfile();\n if (!profile) {\n throw new Error('The exact OIDC identity has no linked Profile.');\n }\n // `findBySubject()` normalizes the FK at this authentication boundary;\n // keep the related object on that portable identity as well for native\n // DuckDB adapters whose raw UUID values are represented as objects.\n profile.id = requireOidcProfileId(existingIdentity.profileId);\n if (claims.email) existingIdentity.email = claims.email;\n existingIdentity.lastUsedAt = new Date();\n await existingIdentity.save();\n return { profile, oidcIdentity: existingIdentity, created: false };\n }\n\n const { ProfileCollection } = await import(\n '../collections/ProfileCollection'\n );\n const profileCollection = await ProfileCollection.create(options);\n if (claims.email) {\n const collision = await profileCollection.findUniqueGlobalPersonByEmail(\n claims.email,\n );\n if (collision) {\n if (claims.email_verified !== true) {\n throw new Error(\n `OIDC email ${claims.email} is not verified and already belongs to a Profile.`,\n );\n }\n throw new Error(\n `OIDC email ${claims.email} already belongs to a Profile; createProfileFromOidc() cannot prove that Profile is unowned. Use UserCollection.getOrCreateFromOidc() for owner-aware linking.`,\n );\n }\n }\n\n const profile = await createOidcProvisioningPerson(options.db, {\n email: claims.email ?? '',\n name: claims.name,\n preferredUsername: claims.preferred_username,\n subject: claims.sub,\n });\n const oidcIdentity = await insertOidcProvisioningIdentity(options.db, {\n email: claims.email,\n issuer: claims.iss,\n profileId: requireOidcProfileId(profile.id),\n provider,\n subject: claims.sub,\n });\n return { profile, oidcIdentity, created: true };\n}\n\nasync function rebindOidcProfileResult<\n T extends {\n profile: Profile;\n oidcIdentity: OidcIdentity;\n created: boolean;\n },\n>(result: T, rootDb: DatabaseInterface): Promise<T> {\n const { OidcIdentityCollection } = await import(\n '../collections/OidcIdentityCollection'\n );\n const { ProfileCollection } = await import(\n '../collections/ProfileCollection'\n );\n const profileId = requireOidcProfileId(result.profile.id);\n const identityId = requireOidcProfileId(result.oidcIdentity.id);\n const [profile, oidcIdentity] = await withSystemContext(async () => {\n const profiles = await ProfileCollection.create({ db: rootDb });\n const identities = await OidcIdentityCollection.create({ db: rootDb });\n // Read one statement at a time. SQLite and DuckDB handles multiplex a\n // single native connection, so overlapping statements on it fail the\n // losing prepared statement or abort the process outright (#2352). These\n // are primary-key reads, so the sequential cost is one extra round trip.\n const rebound = await profiles.get({ id: profileId });\n const reboundIdentity = await identities.get({ id: identityId });\n return [rebound, reboundIdentity] as const;\n });\n if (!profile || !oidcIdentity) {\n throw new Error(\n 'Committed OIDC Profile provisioning result was not found.',\n );\n }\n profile.id = profileId;\n oidcIdentity.id = identityId;\n oidcIdentity.profileId = profileId;\n return { ...result, profile, oidcIdentity };\n}\n\nfunction normalizeOidcProfileClaims(claims: {\n sub: string;\n iss: string;\n email?: string;\n email_verified?: boolean;\n name?: string;\n preferred_username?: string;\n}) {\n const sub = claims?.sub;\n const iss = claims?.iss;\n if (\n typeof sub !== 'string' ||\n sub.trim().length === 0 ||\n typeof iss !== 'string' ||\n iss.trim().length === 0\n ) {\n throw new Error(\n 'Invalid OIDC claims: both \"sub\" and \"iss\" must be non-empty strings.',\n );\n }\n const suppliedEmail = claims.email;\n return {\n ...claims,\n sub,\n iss,\n email:\n typeof suppliedEmail === 'string' && suppliedEmail.trim()\n ? normalizeIdentityEmail(suppliedEmail)\n : undefined,\n };\n}\n\nfunction requireOidcProfileId(value: unknown): string {\n if (typeof value !== 'string' || !value) {\n throw new Error('OIDC Profile provisioning did not produce an id.');\n }\n return value;\n}\n\nasync function resolveOidcProfileDatabase(\n db: SmrtObjectOptions['db'],\n): Promise<DatabaseInterface> {\n if (!db) {\n throw new Error(\n 'OIDC Profile provisioning requires an initialized database.',\n );\n }\n return resolveDatabase(db as Parameters<typeof resolveDatabase>[0]);\n}\n\n/**\n * Create a profile from Nostr identity (used by magic link service)\n *\n * This is typically called internally by the magic link service,\n * but can be used directly if needed.\n *\n * @param email - Email address for the profile\n * @param nostrData - Encrypted Nostr keypair data\n * @param options - Database options\n * @returns The created profile with linked Nostr identity\n */\nexport async function createProfileFromNostr(\n email: string,\n nostrData: {\n pubkey: string;\n encryptedPrivkey: string;\n encryptionIv: string;\n encryptionTag: string;\n nip05Username?: string;\n },\n options: SmrtObjectOptions,\n): Promise<{\n profile: Profile;\n nostrIdentity: NostrIdentity;\n created: boolean;\n}> {\n const normalizedEmail = normalizeIdentityEmail(email);\n\n // Check if Nostr identity already exists\n const existingIdentity = await NostrIdentity.findByEmail(\n normalizedEmail,\n options,\n );\n\n if (existingIdentity) {\n const profile = await existingIdentity.getProfile();\n if (profile) {\n return {\n profile,\n nostrIdentity: existingIdentity,\n created: false,\n };\n }\n }\n\n // Create new profile\n const { Person } = await import('../models/ProfileTypes');\n const { ProfileTypeCollection } = await import(\n '../collections/ProfileTypeCollection'\n );\n\n // Get or create the 'person' type\n const typeCollection = await ProfileTypeCollection.create(options);\n let personType = await typeCollection.getBySlug('person');\n\n if (!personType) {\n const { ProfileType } = await import('../models/ProfileType');\n personType = new ProfileType({\n ...options,\n slug: 'person',\n name: 'Person',\n description: 'Individual person profile',\n });\n await personType.initialize();\n await personType.save();\n }\n\n const profile = new Person({\n ...options,\n typeId: personType.id as string,\n email: normalizedEmail,\n name: normalizedEmail.split('@')[0], // Default name from email\n });\n await profile.initialize();\n await profile.save();\n\n // Create Nostr identity\n const nostrIdentity = new NostrIdentity({\n ...options,\n profileId: profile.id as string,\n pubkey: nostrData.pubkey,\n encryptedPrivkey: nostrData.encryptedPrivkey,\n encryptionIv: nostrData.encryptionIv,\n encryptionTag: nostrData.encryptionTag,\n email: normalizedEmail,\n nip05Username:\n nostrData.nip05Username?.toLowerCase() || normalizedEmail.split('@')[0],\n });\n await nostrIdentity.initialize();\n await nostrIdentity.save();\n\n return {\n profile,\n nostrIdentity,\n created: true,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAqIA,eAAsB,gBACpB,SACgC;CAChC,MAAM,UAA6B,EAAE,IAAI,QAAQ,GAAG;CAGpD,IAAI,QAAQ,QAAQ;EAClB,MAAM,SAAS,MAAM,OAAO,OAAO,QAAQ,QAAQ,OAAO;EAC1D,IAAI,QAAQ;GACV,MAAM,UAAU,MAAM,OAAO,WAAW;GACxC,IAAI,SACF,OAAO;IACL;IACA,QAAQ;IACR;GACF;EAEJ;CACF;CAGA,IAAI,QAAQ,aAAa,OAAO,QAAQ,aAAa,KAAK;EACxD,MAAM,eAAe,MAAM,aAAa,cACtC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