@happyvertical/smrt-profiles 0.62.14 → 0.63.0
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/chunks/{ApiKey-BhseCX_J.js → ApiKey-DILxIM21.js} +3 -3
- package/dist/chunks/{ApiKey-BhseCX_J.js.map → ApiKey-DILxIM21.js.map} +1 -1
- package/dist/chunks/{ApiKeyCollection-BK2Wn-wa.js → ApiKeyCollection-BAoIu1NT.js} +3 -3
- package/dist/chunks/{ApiKeyCollection-BK2Wn-wa.js.map → ApiKeyCollection-BAoIu1NT.js.map} +1 -1
- package/dist/chunks/{AuditLogCollection-NYUFFPni.js → AuditLogCollection-BvJ39Qa7.js} +2 -3
- package/dist/chunks/{AuditLogCollection-NYUFFPni.js.map → AuditLogCollection-BvJ39Qa7.js.map} +1 -1
- package/dist/chunks/{NostrIdentity-joAS5ZlD.js → NostrIdentity-CRClZAF0.js} +4 -4
- package/dist/chunks/{NostrIdentity-joAS5ZlD.js.map → NostrIdentity-CRClZAF0.js.map} +1 -1
- package/dist/chunks/{NostrIdentityCollection-B9G_vrWL.js → NostrIdentityCollection-6eKkDSnZ.js} +2 -4
- package/dist/chunks/NostrIdentityCollection-6eKkDSnZ.js.map +1 -0
- package/dist/chunks/{OidcIdentity-B06GwRj2.js → OidcIdentity-CzZbq7Lv.js} +3 -3
- package/dist/chunks/{OidcIdentity-B06GwRj2.js.map → OidcIdentity-CzZbq7Lv.js.map} +1 -1
- package/dist/chunks/{OidcIdentityCollection-lHtQmTFB.js → OidcIdentityCollection-C5r_toph.js} +3 -3
- package/dist/chunks/{OidcIdentityCollection-lHtQmTFB.js.map → OidcIdentityCollection-C5r_toph.js.map} +1 -1
- package/dist/chunks/{ProfileAssetCollection-CijIwtKj.js → ProfileAssetCollection-DwLqpZe0.js} +3 -3
- package/dist/chunks/{ProfileAssetCollection-CijIwtKj.js.map → ProfileAssetCollection-DwLqpZe0.js.map} +1 -1
- package/dist/chunks/{ProfileCollection-CSFLzcXp.js → ProfileCollection-CO74zsSf.js} +28 -28
- package/dist/chunks/{ProfileCollection-CSFLzcXp.js.map → ProfileCollection-CO74zsSf.js.map} +1 -1
- package/dist/chunks/{ProfileLinkCollection-BHgVmkly.js → ProfileLinkCollection-CzmFe8_n.js} +3 -3
- package/dist/chunks/{ProfileLinkCollection-BHgVmkly.js.map → ProfileLinkCollection-CzmFe8_n.js.map} +1 -1
- package/dist/chunks/{ProfileMetadataCollection-BStSVlUX.js → ProfileMetadataCollection-LAWIrnCP.js} +2 -2
- package/dist/chunks/{ProfileMetadataCollection-BStSVlUX.js.map → ProfileMetadataCollection-LAWIrnCP.js.map} +1 -1
- package/dist/chunks/{ProfileMetafieldCollection-DCZi2Ba1.js → ProfileMetafieldCollection-DsumXtKX.js} +2 -2
- package/dist/chunks/{ProfileMetafieldCollection-DCZi2Ba1.js.map → ProfileMetafieldCollection-DsumXtKX.js.map} +1 -1
- package/dist/chunks/{ProfileRelationshipCollection-Cat8A3R3.js → ProfileRelationshipCollection-BsRbLqaH.js} +5 -5
- package/dist/chunks/{ProfileRelationshipCollection-Cat8A3R3.js.map → ProfileRelationshipCollection-BsRbLqaH.js.map} +1 -1
- package/dist/chunks/{ProfileRelationshipTermCollection-CInZSL7B.js → ProfileRelationshipTermCollection-MN3A0ZPp.js} +2 -2
- package/dist/chunks/{ProfileRelationshipTermCollection-CInZSL7B.js.map → ProfileRelationshipTermCollection-MN3A0ZPp.js.map} +1 -1
- package/dist/chunks/{ProfileRelationshipType-tp6iZQVQ.js → ProfileRelationshipType-BqFwMM-w.js} +2 -2
- package/dist/chunks/{ProfileRelationshipType-tp6iZQVQ.js.map → ProfileRelationshipType-BqFwMM-w.js.map} +1 -1
- package/dist/chunks/{ProfileRelationshipTypeCollection-Dkb0nsnt.js → ProfileRelationshipTypeCollection-BmKtnlaP.js} +3 -3
- package/dist/chunks/{ProfileRelationshipTypeCollection-Dkb0nsnt.js.map → ProfileRelationshipTypeCollection-BmKtnlaP.js.map} +1 -1
- package/dist/chunks/{ProfileTypeCollection-BYSvknkE.js → ProfileTypeCollection-BRxbs9mz.js} +3 -3
- package/dist/chunks/{ProfileTypeCollection-BYSvknkE.js.map → ProfileTypeCollection-BRxbs9mz.js.map} +1 -1
- package/dist/chunks/{oidcProvisioningPrimitives-ClLJDotp.js → oidcProvisioningPrimitives-HMb3NIi3.js} +5 -5
- package/dist/chunks/{oidcProvisioningPrimitives-ClLJDotp.js.map → oidcProvisioningPrimitives-HMb3NIi3.js.map} +1 -1
- package/dist/chunks/{resolveIdentity-CBP8wpBI.js → resolveIdentity-CQfLpOeY.js} +16 -16
- package/dist/chunks/{resolveIdentity-CBP8wpBI.js.map → resolveIdentity-CQfLpOeY.js.map} +1 -1
- package/dist/collections/AuditLogCollection.d.ts.map +1 -1
- package/dist/collections/NostrIdentityCollection.d.ts.map +1 -1
- package/dist/index.js +24 -24
- package/dist/index.js.map +1 -1
- package/dist/internal/oidc-provisioning.js +2 -2
- package/dist/manifest.json +1 -1
- package/dist/smrt-knowledge.json +3 -3
- package/dist/utils.js +4 -4
- package/package.json +6 -6
- package/dist/chunks/NostrIdentityCollection-B9G_vrWL.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as isOidcProvisioningRaceConflict, f as saveOidcRaceArbiter, l as coordinateOidcProvisioning, u as isOidcAbortedTransactionError } from "../chunks/ProfileCollection-
|
|
2
|
-
import { n as insertOidcProvisioningIdentity$1, t as createOidcProvisioningPerson$1 } from "../chunks/oidcProvisioningPrimitives-
|
|
1
|
+
import { d as isOidcProvisioningRaceConflict, f as saveOidcRaceArbiter, l as coordinateOidcProvisioning, u as isOidcAbortedTransactionError } from "../chunks/ProfileCollection-CO74zsSf.js";
|
|
2
|
+
import { n as insertOidcProvisioningIdentity$1, t as createOidcProvisioningPerson$1 } from "../chunks/oidcProvisioningPrimitives-HMb3NIi3.js";
|
|
3
3
|
//#region src/internal/oidc-provisioning.ts
|
|
4
4
|
async function createOidcProvisioningPerson(db, input) {
|
|
5
5
|
return await createOidcProvisioningPerson$1(db, input);
|
package/dist/manifest.json
CHANGED
package/dist/smrt-knowledge.json
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
"sensitiveFieldsExcluded": true,
|
|
4
4
|
"generatedAt": "1970-01-01T00:00:00.000Z",
|
|
5
5
|
"packageName": "@happyvertical/smrt-profiles",
|
|
6
|
-
"packageVersion": "0.
|
|
6
|
+
"packageVersion": "0.63.0",
|
|
7
7
|
"sourceManifestPath": "dist/manifest.json",
|
|
8
8
|
"agentDocPath": "AGENTS.md",
|
|
9
9
|
"sourceHashes": {
|
|
10
|
-
"manifest": "
|
|
11
|
-
"packageJson": "
|
|
10
|
+
"manifest": "ff783d68526bfc773b6aa0711f4d51f133de6bec1fca88e2285190b6fd415826",
|
|
11
|
+
"packageJson": "634cece6575c5f206846588295189527ffb0c8ffc55f9a9eb4776b9354246382",
|
|
12
12
|
"agents": "d92d03c2765795f1a984b02f9cd51dff3ded3a7b68e41b9cb133cf6df2c5c83b"
|
|
13
13
|
},
|
|
14
14
|
"exports": [
|
package/dist/utils.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
//#region src/utils.ts
|
|
2
2
|
async function getProfileMetadata(profileId, options = {}) {
|
|
3
|
-
const { ProfileMetadataCollection } = await import("./chunks/ProfileMetadataCollection-
|
|
3
|
+
const { ProfileMetadataCollection } = await import("./chunks/ProfileMetadataCollection-LAWIrnCP.js").then((n) => n.n);
|
|
4
4
|
return await (await ProfileMetadataCollection.create(options)).getMetadataObject(profileId);
|
|
5
5
|
}
|
|
6
6
|
async function setProfileMetadata(profileId, metafieldSlug, value, options = {}) {
|
|
7
|
-
const { ProfileCollection } = await import("./chunks/ProfileCollection-
|
|
7
|
+
const { ProfileCollection } = await import("./chunks/ProfileCollection-CO74zsSf.js").then((n) => n.r);
|
|
8
8
|
const profile = await (await ProfileCollection.create(options)).get({ id: profileId });
|
|
9
9
|
if (!profile) throw new Error(`Profile '${profileId}' not found`);
|
|
10
10
|
await profile.addMetadata(metafieldSlug, value);
|
|
11
11
|
}
|
|
12
12
|
async function findProfilesByMeta(metafieldSlug, value, options = {}) {
|
|
13
|
-
const { ProfileMetafieldCollection } = await import("./chunks/ProfileMetafieldCollection-
|
|
14
|
-
const { ProfileMetadataCollection } = await import("./chunks/ProfileMetadataCollection-
|
|
13
|
+
const { ProfileMetafieldCollection } = await import("./chunks/ProfileMetafieldCollection-DsumXtKX.js").then((n) => n.n);
|
|
14
|
+
const { ProfileMetadataCollection } = await import("./chunks/ProfileMetadataCollection-LAWIrnCP.js").then((n) => n.n);
|
|
15
15
|
const metafield = await (await ProfileMetafieldCollection.create(options)).getBySlug(metafieldSlug);
|
|
16
16
|
if (!metafield) throw new Error(`Metafield '${metafieldSlug}' not found`);
|
|
17
17
|
return await (await ProfileMetadataCollection.create(options)).findProfilesByMetadata(metafield.id, value);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-profiles",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.63.0",
|
|
4
4
|
"description": "Profile management system with relationships, metadata, and reciprocal associations for SMRT framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"@happyvertical/ai": "^0.115.0",
|
|
31
31
|
"@happyvertical/files": "^0.115.0",
|
|
32
32
|
"@happyvertical/logger": "^0.115.0",
|
|
33
|
-
"@happyvertical/smrt-assets": "0.
|
|
34
|
-
"@happyvertical/smrt-core": "0.
|
|
35
|
-
"@happyvertical/smrt-prompts": "0.
|
|
36
|
-
"@happyvertical/smrt-tenancy": "0.
|
|
33
|
+
"@happyvertical/smrt-assets": "0.63.0",
|
|
34
|
+
"@happyvertical/smrt-core": "0.63.0",
|
|
35
|
+
"@happyvertical/smrt-prompts": "0.63.0",
|
|
36
|
+
"@happyvertical/smrt-tenancy": "0.63.0",
|
|
37
37
|
"@happyvertical/sql": "^0.115.0",
|
|
38
38
|
"@happyvertical/utils": "^0.115.0",
|
|
39
39
|
"@noble/curves": "^2.4.0",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@faker-js/faker": "^10.6.0",
|
|
44
|
-
"@happyvertical/smrt-vitest": "0.
|
|
44
|
+
"@happyvertical/smrt-vitest": "0.63.0",
|
|
45
45
|
"@types/node": "24.13.6",
|
|
46
46
|
"typescript": "6.0.3",
|
|
47
47
|
"vite": "8.1.6",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NostrIdentityCollection-B9G_vrWL.js","names":[],"sources":["../../src/collections/NostrIdentityCollection.ts"],"sourcesContent":["/**\n * NostrIdentityCollection - Collection for managing Nostr identity records\n */\n\nimport { SmrtCollection } from '@happyvertical/smrt-core';\nimport { encryptPrivkey, generateNostrKeypair } from '../auth/nostrCrypto';\nimport { NostrIdentity } from '../models/NostrIdentity';\nimport type { Profile } from '../models/Profile';\n\nexport interface Nip05Response {\n names: Record<string, string>;\n relays?: Record<string, string[]>;\n}\n\nexport class NostrIdentityCollection extends SmrtCollection<NostrIdentity> {\n static readonly _itemClass = NostrIdentity;\n\n /**\n * Find identities for a profile\n */\n async findByProfile(profileId: string): Promise<NostrIdentity[]> {\n return await this.list({\n where: { profileId },\n });\n }\n\n /**\n * Find identity by public key\n */\n async findByPubkey(pubkey: string): Promise<NostrIdentity | null> {\n return await this.findOne({\n where: { pubkey },\n });\n }\n\n /**\n * Find identity by email\n */\n async findByEmail(email: string): Promise<NostrIdentity | null> {\n return await this.findOne({\n where: { email: email.toLowerCase() },\n });\n }\n\n /**\n * Find identity by NIP-05 username\n */\n async findByNip05(username: string): Promise<NostrIdentity | null> {\n return await this.findOne({\n where: { nip05Username: username.toLowerCase() },\n });\n }\n\n /**\n * Link a new Nostr identity to a profile with a new keypair\n * @param profile - The profile to link to\n * @param email - Email address for this identity\n * @param masterSecret - Server master secret for encryption\n * @param nip05Username - Optional NIP-05 username (defaults to email local part)\n */\n async createForProfile(\n profile: Profile,\n email: string,\n masterSecret: string,\n nip05Username?: string,\n ): Promise<NostrIdentity> {\n const normalizedEmail = email.toLowerCase();\n\n // Check if already exists for this email\n const existing = await this.findByEmail(normalizedEmail);\n if (existing) {\n throw new Error(`Nostr identity already exists for email: ${email}`);\n }\n\n // Generate new keypair\n const keypair = generateNostrKeypair();\n\n // Encrypt private key\n const encrypted = encryptPrivkey(keypair.privkey, masterSecret);\n\n // Derive NIP-05 username from email if not provided\n const username =\n nip05Username?.toLowerCase() || normalizedEmail.split('@')[0];\n\n // Create identity\n const identity = await this.create({\n ...this.options,\n profileId: profile.id as string,\n pubkey: keypair.pubkey,\n encryptedPrivkey: encrypted.ciphertext,\n encryptionIv: encrypted.iv,\n encryptionTag: encrypted.tag,\n email: normalizedEmail,\n nip05Username: username,\n });\n\n return identity;\n }\n\n /**\n * Link an existing Nostr identity (with encrypted keypair) to a profile\n */\n async linkToProfile(\n profile: Profile,\n nostrData: {\n pubkey: string;\n encryptedPrivkey: string;\n encryptionIv: string;\n encryptionTag: string;\n email: string;\n nip05Username?: string;\n },\n ): Promise<NostrIdentity> {\n // Check if pubkey already exists\n const existingPubkey = await this.findByPubkey(nostrData.pubkey);\n if (existingPubkey) {\n throw new Error('Nostr identity with this public key already exists');\n }\n\n // Check if email already exists\n const existingEmail = await this.findByEmail(nostrData.email);\n if (existingEmail) {\n throw new Error('Nostr identity with this email already exists');\n }\n\n const identity = await this.create({\n ...this.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: nostrData.email.toLowerCase(),\n nip05Username:\n nostrData.nip05Username?.toLowerCase() ||\n nostrData.email.toLowerCase().split('@')[0],\n });\n\n return identity;\n }\n\n /**\n * Unlink a Nostr identity from a profile\n */\n async unlinkFromProfile(profileId: string, pubkey: string): Promise<boolean> {\n const identity = await this.findOne({\n where: { profileId, pubkey },\n });\n\n if (identity) {\n await identity.delete();\n return true;\n }\n return false;\n }\n\n /**\n * Get NIP-05 response data for the /.well-known/nostr.json endpoint\n * @param username - Optional username filter, returns all if not provided\n */\n async getNip05Response(username?: string): Promise<Nip05Response> {\n const where = username ? { nip05Username: username.toLowerCase() } : {};\n\n const identities = await this.list({\n where,\n // Only return verified identities for NIP-05\n // Uncomment if you want to require verification:\n // where: { ...where, 'verifiedAt IS NOT': null },\n });\n\n const names: Record<string, string> = {};\n for (const identity of identities) {\n if (identity.nip05Username && identity.pubkey) {\n names[identity.nip05Username] = identity.pubkey;\n }\n }\n\n return { names };\n }\n\n /**\n * Check if a NIP-05 username is available\n */\n async isNip05Available(username: string): Promise<boolean> {\n const existing = await this.findByNip05(username);\n return existing === null;\n }\n\n /**\n * Update NIP-05 username for an identity\n */\n async updateNip05Username(\n identity: NostrIdentity,\n newUsername: string,\n ): Promise<NostrIdentity> {\n const normalizedUsername = newUsername.toLowerCase();\n\n // Check if username is available\n const existing = await this.findByNip05(normalizedUsername);\n if (existing && existing.id !== identity.id) {\n throw new Error(`NIP-05 username \"${newUsername}\" is already taken`);\n }\n\n identity.nip05Username = normalizedUsername;\n await identity.save();\n\n return identity;\n }\n}\n"],"mappings":";;;;AAcO,IAAM,0BAAN,cAAsC,eAA8B;CACzE,OAAgB,aAAa;;;;CAK7B,MAAM,cAAc,WAA6C;EAC/D,OAAO,MAAM,KAAK,KAAK,EACrB,OAAO,EAAE,UAAU,EACrB,CAAC;CACH;;;;CAKA,MAAM,aAAa,QAA+C;EAChE,OAAO,MAAM,KAAK,QAAQ,EACxB,OAAO,EAAE,OAAO,EAClB,CAAC;CACH;;;;CAKA,MAAM,YAAY,OAA8C;EAC9D,OAAO,MAAM,KAAK,QAAQ,EACxB,OAAO,EAAE,OAAO,MAAM,YAAY,EAAE,EACtC,CAA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