@happyvertical/smrt-profiles 0.51.32 → 0.51.34
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/__smrt-register__.d.ts +2 -0
- package/dist/__smrt-register__.d.ts.map +1 -0
- package/dist/agent-profile.d.ts +71 -0
- package/dist/agent-profile.d.ts.map +1 -0
- package/dist/auth/index.d.ts +12 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/magicLinkService.d.ts +79 -0
- package/dist/auth/magicLinkService.d.ts.map +1 -0
- package/dist/auth/nip05Handler.d.ts +73 -0
- package/dist/auth/nip05Handler.d.ts.map +1 -0
- package/dist/auth/normalizeIdentityEmail.d.ts +8 -0
- package/dist/auth/normalizeIdentityEmail.d.ts.map +1 -0
- package/dist/auth/nostrCrypto.d.ts +111 -0
- package/dist/auth/nostrCrypto.d.ts.map +1 -0
- package/dist/auth/oidcProvisioningCoordinator.d.ts +58 -0
- package/dist/auth/oidcProvisioningCoordinator.d.ts.map +1 -0
- package/dist/auth/oidcProvisioningPrimitives.d.ts +23 -0
- package/dist/auth/oidcProvisioningPrimitives.d.ts.map +1 -0
- package/dist/auth/resolveIdentity.d.ts +188 -0
- package/dist/auth/resolveIdentity.d.ts.map +1 -0
- package/dist/collections/ApiKeyCollection.d.ts +46 -0
- package/dist/collections/ApiKeyCollection.d.ts.map +1 -0
- package/dist/collections/AuditLogCollection.d.ts +50 -0
- package/dist/collections/AuditLogCollection.d.ts.map +1 -0
- package/dist/collections/MagicLinkTokenCollection.d.ts +58 -0
- package/dist/collections/MagicLinkTokenCollection.d.ts.map +1 -0
- package/dist/collections/NostrIdentityCollection.d.ts +66 -0
- package/dist/collections/NostrIdentityCollection.d.ts.map +1 -0
- package/dist/collections/OidcIdentityCollection.d.ts +45 -0
- package/dist/collections/OidcIdentityCollection.d.ts.map +1 -0
- package/dist/collections/OidcProfileEmailReservationCollection.d.ts +7 -0
- package/dist/collections/OidcProfileEmailReservationCollection.d.ts.map +1 -0
- package/dist/collections/ProfileAssetCollection.d.ts +17 -0
- package/dist/collections/ProfileAssetCollection.d.ts.map +1 -0
- package/dist/collections/ProfileCollection.d.ts +130 -0
- package/dist/collections/ProfileCollection.d.ts.map +1 -0
- package/dist/collections/ProfileMetadataCollection.d.ts +33 -0
- package/dist/collections/ProfileMetadataCollection.d.ts.map +1 -0
- package/dist/collections/ProfileMetafieldCollection.d.ts +31 -0
- package/dist/collections/ProfileMetafieldCollection.d.ts.map +1 -0
- package/dist/collections/ProfileRelationshipCollection.d.ts +44 -0
- package/dist/collections/ProfileRelationshipCollection.d.ts.map +1 -0
- package/dist/collections/ProfileRelationshipTermCollection.d.ts +32 -0
- package/dist/collections/ProfileRelationshipTermCollection.d.ts.map +1 -0
- package/dist/collections/ProfileRelationshipTypeCollection.d.ts +41 -0
- package/dist/collections/ProfileRelationshipTypeCollection.d.ts.map +1 -0
- package/dist/collections/ProfileTypeCollection.d.ts +40 -0
- package/dist/collections/ProfileTypeCollection.d.ts.map +1 -0
- package/dist/collections/index.d.ts +18 -0
- package/dist/collections/index.d.ts.map +1 -0
- package/dist/index.d.ts +55 -2059
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/internal/oidc-provisioning.d.ts +14 -119
- package/dist/internal/oidc-provisioning.d.ts.map +1 -0
- package/dist/manifest.json +1 -1
- package/dist/migrations/backfillProfileEmailKeys.d.ts +16 -0
- package/dist/migrations/backfillProfileEmailKeys.d.ts.map +1 -0
- package/dist/models/ApiKey.d.ts +94 -0
- package/dist/models/ApiKey.d.ts.map +1 -0
- package/dist/models/AuditLog.d.ts +71 -0
- package/dist/models/AuditLog.d.ts.map +1 -0
- package/dist/models/MagicLinkToken.d.ts +104 -0
- package/dist/models/MagicLinkToken.d.ts.map +1 -0
- package/dist/models/NostrIdentity.d.ts +112 -0
- package/dist/models/NostrIdentity.d.ts.map +1 -0
- package/dist/models/OidcIdentity.d.ts +82 -0
- package/dist/models/OidcIdentity.d.ts.map +1 -0
- package/dist/models/OidcProfileEmailReservation.d.ts +12 -0
- package/dist/models/OidcProfileEmailReservation.d.ts.map +1 -0
- package/dist/models/Profile.d.ts +243 -0
- package/dist/models/Profile.d.ts.map +1 -0
- package/dist/models/ProfileAsset.d.ts +18 -0
- package/dist/models/ProfileAsset.d.ts.map +1 -0
- package/dist/models/ProfileMetadata.d.ts +33 -0
- package/dist/models/ProfileMetadata.d.ts.map +1 -0
- package/dist/models/ProfileMetafield.d.ts +62 -0
- package/dist/models/ProfileMetafield.d.ts.map +1 -0
- package/dist/models/ProfileRelationship.d.ts +56 -0
- package/dist/models/ProfileRelationship.d.ts.map +1 -0
- package/dist/models/ProfileRelationshipTerm.d.ts +37 -0
- package/dist/models/ProfileRelationshipTerm.d.ts.map +1 -0
- package/dist/models/ProfileRelationshipType.d.ts +59 -0
- package/dist/models/ProfileRelationshipType.d.ts.map +1 -0
- package/dist/models/ProfileType.d.ts +27 -0
- package/dist/models/ProfileType.d.ts.map +1 -0
- package/dist/models/ProfileTypes.d.ts +32 -0
- package/dist/models/ProfileTypes.d.ts.map +1 -0
- package/dist/models/index.d.ts +18 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/prompts.d.ts +17 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/smrt-knowledge.json +4 -4
- package/dist/testing/oidcProvisioningDecisionMatrix.d.ts +1168 -0
- package/dist/testing/oidcProvisioningDecisionMatrix.d.ts.map +1 -0
- package/dist/types.d.ts +33 -732
- package/dist/types.d.ts.map +1 -0
- package/dist/utils.d.ts +52 -817
- package/dist/utils.d.ts.map +1 -0
- package/package.json +7 -7
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SmrtObject, type SmrtObjectOptions } from '@happyvertical/smrt-core';
|
|
2
|
+
export interface OidcProfileEmailReservationOptions extends SmrtObjectOptions {
|
|
3
|
+
emailKey?: string;
|
|
4
|
+
profileId?: string;
|
|
5
|
+
}
|
|
6
|
+
/** Private database arbiter for canonical OIDC email provisioning races. */
|
|
7
|
+
export declare class OidcProfileEmailReservation extends SmrtObject {
|
|
8
|
+
profileId?: string;
|
|
9
|
+
emailKey: string;
|
|
10
|
+
constructor(options?: OidcProfileEmailReservationOptions);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=OidcProfileEmailReservation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OidcProfileEmailReservation.d.ts","sourceRoot":"","sources":["../../src/models/OidcProfileEmailReservation.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EACV,KAAK,iBAAiB,EAEvB,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,kCAAmC,SAAQ,iBAAiB;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,4EAA4E;AAC5E,qBAMa,2BAA4B,SAAQ,UAAU;IAEzD,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,QAAQ,EAAE,MAAM,CAAM;gBAEV,OAAO,GAAE,kCAAuC;CAK7D"}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Profile model - Core entity representing any profile type
|
|
3
|
+
*
|
|
4
|
+
* Central table holding all primary entities with type, email, name, and description.
|
|
5
|
+
* Uses UUID primary key with relationships to ProfileType for classification.
|
|
6
|
+
*/
|
|
7
|
+
import type { Asset } from '@happyvertical/smrt-assets';
|
|
8
|
+
import { SmrtObject, type SmrtObjectOptions } from '@happyvertical/smrt-core';
|
|
9
|
+
import type { ApiKey, GenerateKeyResult } from './ApiKey';
|
|
10
|
+
import type { AuditLog } from './AuditLog';
|
|
11
|
+
import type { NostrIdentity } from './NostrIdentity';
|
|
12
|
+
import type { OidcIdentity } from './OidcIdentity';
|
|
13
|
+
import type { ProfileMetadata } from './ProfileMetadata';
|
|
14
|
+
import type { ProfileRelationship } from './ProfileRelationship';
|
|
15
|
+
export interface ProfileOptions extends SmrtObjectOptions {
|
|
16
|
+
typeId?: string;
|
|
17
|
+
email?: string;
|
|
18
|
+
name?: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
tenantId?: string | null;
|
|
21
|
+
}
|
|
22
|
+
export declare class Profile extends SmrtObject {
|
|
23
|
+
tenantId: string | null;
|
|
24
|
+
typeId?: string;
|
|
25
|
+
email?: string;
|
|
26
|
+
/** Adapter-independent identity lookup key derived from email on save. */
|
|
27
|
+
emailKey: string | null;
|
|
28
|
+
name: string;
|
|
29
|
+
description?: string;
|
|
30
|
+
metadata: ProfileMetadata[];
|
|
31
|
+
relationshipsFrom: ProfileRelationship[];
|
|
32
|
+
relationshipsTo: ProfileRelationship[];
|
|
33
|
+
constructor(options?: ProfileOptions);
|
|
34
|
+
/** Keep the durable identity key derived from the public email field. */
|
|
35
|
+
save(): Promise<this>;
|
|
36
|
+
/**
|
|
37
|
+
* Get the profile type slug for this profile
|
|
38
|
+
*
|
|
39
|
+
* @returns The slug of the profile type
|
|
40
|
+
*/
|
|
41
|
+
getTypeSlug(): Promise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Set the profile type by slug
|
|
44
|
+
*
|
|
45
|
+
* @param slug - The slug of the profile type
|
|
46
|
+
* @throws Error if profile type not found
|
|
47
|
+
*/
|
|
48
|
+
setTypeBySlug(slug: string): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Add metadata to this profile
|
|
51
|
+
*
|
|
52
|
+
* @param metafieldSlug - The slug of the metafield
|
|
53
|
+
* @param value - The value to set
|
|
54
|
+
*/
|
|
55
|
+
addMetadata(metafieldSlug: string, value: unknown): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Get all metadata for this profile as key-value object
|
|
58
|
+
*
|
|
59
|
+
* @returns Object with metafield slugs as keys
|
|
60
|
+
*/
|
|
61
|
+
getMetadata(): Promise<Record<string, string>>;
|
|
62
|
+
/**
|
|
63
|
+
* Update multiple metadata values
|
|
64
|
+
*
|
|
65
|
+
* @param metadata - Object with metafield slugs as keys and values
|
|
66
|
+
*/
|
|
67
|
+
updateMetadata(metadata: Record<string, unknown>): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Remove metadata by metafield slug
|
|
70
|
+
*
|
|
71
|
+
* @param metafieldSlug - The slug of the metafield to remove
|
|
72
|
+
*/
|
|
73
|
+
removeMetadata(metafieldSlug: string): Promise<void>;
|
|
74
|
+
private getProfileAssetCollection;
|
|
75
|
+
getAssets(relationship?: string): Promise<Asset[]>;
|
|
76
|
+
addAsset(asset: Asset, relationship?: string, sortOrder?: number): Promise<void>;
|
|
77
|
+
removeAsset(assetId: string, relationship?: string): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Add a relationship to another profile
|
|
80
|
+
*
|
|
81
|
+
* @param toProfile - The target profile
|
|
82
|
+
* @param relationshipSlug - The type of relationship
|
|
83
|
+
* @param contextProfile - Optional context profile for tertiary relationships
|
|
84
|
+
*/
|
|
85
|
+
addRelationship(toProfile: Profile, relationshipSlug: string, contextProfile?: Profile): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Get all relationships for this profile
|
|
88
|
+
*
|
|
89
|
+
* @param options - Filter options (typeSlug, direction)
|
|
90
|
+
* @returns Array of ProfileRelationship instances
|
|
91
|
+
*/
|
|
92
|
+
getRelationships(options?: {
|
|
93
|
+
typeSlug?: string;
|
|
94
|
+
direction?: 'from' | 'to' | 'all';
|
|
95
|
+
}): Promise<ProfileRelationship[]>;
|
|
96
|
+
/**
|
|
97
|
+
* Get related profiles
|
|
98
|
+
*
|
|
99
|
+
* @param relationshipSlug - Optional filter by relationship type slug
|
|
100
|
+
* @returns Array of related Profile instances
|
|
101
|
+
*/
|
|
102
|
+
getRelatedProfiles(relationshipSlug?: string): Promise<Profile[]>;
|
|
103
|
+
/**
|
|
104
|
+
* Remove a relationship to another profile
|
|
105
|
+
*
|
|
106
|
+
* @param toProfile - The target profile
|
|
107
|
+
* @param relationshipSlug - The type of relationship to remove
|
|
108
|
+
*/
|
|
109
|
+
removeRelationship(toProfile: Profile, relationshipSlug: string): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* AI-powered: Generate a professional bio for this profile
|
|
112
|
+
*
|
|
113
|
+
* Uses the `smrtProfiles.profile.generateBio` prompt registered via
|
|
114
|
+
* `@happyvertical/smrt-prompts`, allowing tenant- or instance-level
|
|
115
|
+
* overrides of the template, model, and parameters at runtime.
|
|
116
|
+
*
|
|
117
|
+
* @returns Generated bio text
|
|
118
|
+
*/
|
|
119
|
+
generateBio(): Promise<string>;
|
|
120
|
+
/**
|
|
121
|
+
* AI-powered: Check if profile matches criteria
|
|
122
|
+
*
|
|
123
|
+
* @param criteria - Criteria to match against
|
|
124
|
+
* @returns True if matches criteria
|
|
125
|
+
*/
|
|
126
|
+
matches(criteria: string): Promise<boolean>;
|
|
127
|
+
/**
|
|
128
|
+
* Find profiles by metadata key-value pair
|
|
129
|
+
*
|
|
130
|
+
* @param metafieldSlug - The metafield slug to search
|
|
131
|
+
* @param value - The value to match
|
|
132
|
+
* @returns Array of matching profiles
|
|
133
|
+
*/
|
|
134
|
+
static findByMetadata(_metafieldSlug: string, _value: unknown): Promise<Profile[]>;
|
|
135
|
+
/**
|
|
136
|
+
* Find profiles by type slug
|
|
137
|
+
*
|
|
138
|
+
* @param typeSlug - The profile type slug
|
|
139
|
+
* @returns Array of matching profiles
|
|
140
|
+
*/
|
|
141
|
+
static findByType(_typeSlug: string): Promise<Profile[]>;
|
|
142
|
+
/**
|
|
143
|
+
* Find related profiles for a given profile
|
|
144
|
+
*
|
|
145
|
+
* @param profileId - The profile UUID
|
|
146
|
+
* @param relationshipSlug - Optional filter by relationship type
|
|
147
|
+
* @returns Array of related profiles
|
|
148
|
+
*/
|
|
149
|
+
static findRelated(_profileId: string, _relationshipSlug?: string): Promise<Profile[]>;
|
|
150
|
+
/**
|
|
151
|
+
* Search profiles by email
|
|
152
|
+
*
|
|
153
|
+
* @param email - The email to search for
|
|
154
|
+
* @returns Profile or null if not found
|
|
155
|
+
*/
|
|
156
|
+
static searchByEmail(_email: string): Promise<Profile | null>;
|
|
157
|
+
/**
|
|
158
|
+
* Get all API keys for this profile
|
|
159
|
+
*
|
|
160
|
+
* @returns Array of API keys
|
|
161
|
+
*/
|
|
162
|
+
getApiKeys(): Promise<ApiKey[]>;
|
|
163
|
+
/**
|
|
164
|
+
* Get active (non-revoked, non-expired) API keys for this profile
|
|
165
|
+
*
|
|
166
|
+
* @returns Array of active API keys
|
|
167
|
+
*/
|
|
168
|
+
getActiveApiKeys(): Promise<ApiKey[]>;
|
|
169
|
+
/**
|
|
170
|
+
* Generate a new API key for this profile
|
|
171
|
+
*
|
|
172
|
+
* @param options - Key options (name, scopes, expiration)
|
|
173
|
+
* @returns The generated key (plaintext) and ApiKey record
|
|
174
|
+
*/
|
|
175
|
+
generateApiKey(options: {
|
|
176
|
+
name: string;
|
|
177
|
+
scopes?: string[];
|
|
178
|
+
expiresAt?: Date | null;
|
|
179
|
+
}): Promise<GenerateKeyResult>;
|
|
180
|
+
/**
|
|
181
|
+
* Get all OIDC identities linked to this profile
|
|
182
|
+
*
|
|
183
|
+
* @returns Array of OIDC identity records
|
|
184
|
+
*/
|
|
185
|
+
getOidcIdentities(): Promise<OidcIdentity[]>;
|
|
186
|
+
/**
|
|
187
|
+
* Reuse an existing exact OIDC identity for this unchanged Profile.
|
|
188
|
+
*
|
|
189
|
+
* @param oidcData - OIDC provider data
|
|
190
|
+
* @returns The linked OIDC identity record
|
|
191
|
+
* @deprecated New authentication links require owner-aware transactional
|
|
192
|
+
* provisioning. This compatibility helper may refresh a legacy Profile
|
|
193
|
+
* type, but refuses to create or rebind authority.
|
|
194
|
+
*/
|
|
195
|
+
linkOidcIdentity(oidcData: {
|
|
196
|
+
provider: string;
|
|
197
|
+
issuer: string;
|
|
198
|
+
subject: string;
|
|
199
|
+
email?: string;
|
|
200
|
+
}): Promise<OidcIdentity>;
|
|
201
|
+
/**
|
|
202
|
+
* Get all Nostr identities linked to this profile
|
|
203
|
+
*
|
|
204
|
+
* @returns Array of Nostr identity records
|
|
205
|
+
*/
|
|
206
|
+
getNostrIdentities(): Promise<NostrIdentity[]>;
|
|
207
|
+
/**
|
|
208
|
+
* Link a new Nostr identity to this profile
|
|
209
|
+
*
|
|
210
|
+
* @param nostrData - Nostr identity data (encrypted keypair)
|
|
211
|
+
* @returns The linked Nostr identity record
|
|
212
|
+
*/
|
|
213
|
+
linkNostrIdentity(nostrData: {
|
|
214
|
+
pubkey: string;
|
|
215
|
+
encryptedPrivkey: string;
|
|
216
|
+
encryptionIv: string;
|
|
217
|
+
encryptionTag: string;
|
|
218
|
+
email: string;
|
|
219
|
+
nip05Username?: string;
|
|
220
|
+
}): Promise<NostrIdentity>;
|
|
221
|
+
/**
|
|
222
|
+
* Get audit logs for actions performed by this profile
|
|
223
|
+
*
|
|
224
|
+
* @param limit - Maximum number of logs to return
|
|
225
|
+
* @returns Array of audit log entries
|
|
226
|
+
*/
|
|
227
|
+
getAuditLogs(limit?: number): Promise<AuditLog[]>;
|
|
228
|
+
/**
|
|
229
|
+
* Record an audit log entry for an action by this profile
|
|
230
|
+
*
|
|
231
|
+
* @param options - Audit log options
|
|
232
|
+
* @returns The created audit log entry
|
|
233
|
+
*/
|
|
234
|
+
recordAction(options: {
|
|
235
|
+
action: string;
|
|
236
|
+
resourceType: string;
|
|
237
|
+
resourceId: string;
|
|
238
|
+
source?: 'web' | 'cli' | 'ci' | 'webhook' | 'mcp';
|
|
239
|
+
metadata?: Record<string, unknown>;
|
|
240
|
+
onBehalfOf?: Profile | null;
|
|
241
|
+
}): Promise<AuditLog>;
|
|
242
|
+
}
|
|
243
|
+
//# sourceMappingURL=Profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Profile.d.ts","sourceRoot":"","sources":["../../src/models/Profile.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AA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,GAAG,OAAO,CAAC,YAAY,CAAC;IAQzB;;;;OAIG;IACG,kBAAkB,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAQpD;;;;;OAKG;IACG,iBAAiB,CAAC,SAAS,EAAE;QACjC,MAAM,EAAE,MAAM,CAAC;QACf,gBAAgB,EAAE,MAAM,CAAC;QACzB,YAAY,EAAE,MAAM,CAAC;QACrB,aAAa,EAAE,MAAM,CAAC;QACtB,KAAK,EAAE,MAAM,CAAC;QACd,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC,aAAa,CAAC;IAQ1B;;;;;OAKG;IACG,YAAY,CAAC,KAAK,GAAE,MAAW,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAQ3D;;;;;OAKG;IACG,YAAY,CAAC,OAAO,EAAE;QAC1B,MAAM,EAAE,MAAM,CAAC;QACf,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,GAAG,KAAK,CAAC;QAClD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACnC,UAAU,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;KAC7B,GAAG,OAAO,CAAC,QAAQ,CAAC;CAUtB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SmrtObjectOptions } from '@happyvertical/smrt-core';
|
|
2
|
+
import { SmrtObject } from '@happyvertical/smrt-core';
|
|
3
|
+
export interface ProfileAssetOptions extends SmrtObjectOptions {
|
|
4
|
+
profileId?: string;
|
|
5
|
+
assetId?: string;
|
|
6
|
+
relationship?: string;
|
|
7
|
+
sortOrder?: number;
|
|
8
|
+
tenantId?: string | null;
|
|
9
|
+
}
|
|
10
|
+
export declare class ProfileAsset extends SmrtObject {
|
|
11
|
+
tenantId: string | null;
|
|
12
|
+
profileId: string;
|
|
13
|
+
assetId: string;
|
|
14
|
+
relationship: string;
|
|
15
|
+
sortOrder: number;
|
|
16
|
+
constructor(options?: ProfileAssetOptions);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=ProfileAsset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProfileAsset.d.ts","sourceRoot":"","sources":["../../src/models/ProfileAsset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAIL,UAAU,EAEX,MAAM,0BAA0B,CAAC;AAGlC,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,qBAQa,YAAa,SAAQ,UAAU;IAE1C,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAG/B,SAAS,SAAM;IAGf,OAAO,SAAM;IAGb,YAAY,SAAgB;IAG5B,SAAS,SAAK;gBAEF,OAAO,GAAE,mBAAwB;CAQ9C"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProfileMetadata model - Stores metadata values for profiles
|
|
3
|
+
*
|
|
4
|
+
* Links profiles to metafield definitions with actual values.
|
|
5
|
+
* Uses UUID primary key with foreign keys to Profile and ProfileMetafield.
|
|
6
|
+
*/
|
|
7
|
+
import { SmrtObject, type SmrtObjectOptions } from '@happyvertical/smrt-core';
|
|
8
|
+
export interface ProfileMetadataOptions extends SmrtObjectOptions {
|
|
9
|
+
profileId?: string;
|
|
10
|
+
metafieldId?: string;
|
|
11
|
+
value?: string;
|
|
12
|
+
tenantId?: string | null;
|
|
13
|
+
}
|
|
14
|
+
export declare class ProfileMetadata extends SmrtObject {
|
|
15
|
+
tenantId: string | null;
|
|
16
|
+
profileId?: string;
|
|
17
|
+
metafieldId?: string;
|
|
18
|
+
value: string;
|
|
19
|
+
constructor(options?: ProfileMetadataOptions);
|
|
20
|
+
/**
|
|
21
|
+
* Validate this metadata value against the metafield's validation schema
|
|
22
|
+
*
|
|
23
|
+
* @returns True if valid, throws error if invalid
|
|
24
|
+
*/
|
|
25
|
+
validate(): Promise<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
* Get the metafield slug for this metadata
|
|
28
|
+
*
|
|
29
|
+
* @returns The slug of the metafield
|
|
30
|
+
*/
|
|
31
|
+
getMetafieldSlug(): Promise<string>;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=ProfileMetadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProfileMetadata.d.ts","sourceRoot":"","sources":["../../src/models/ProfileMetadata.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAGL,UAAU,EACV,KAAK,iBAAiB,EAEvB,MAAM,0BAA0B,CAAC;AAGlC,MAAM,WAAW,sBAAuB,SAAQ,iBAAiB;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,qBAOa,eAAgB,SAAQ,UAAU;IAE7C,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAI/B,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,KAAK,EAAE,MAAM,CAAM;gBAEP,OAAO,GAAE,sBAA2B;IAQhD;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IASlC;;;;OAIG;IACG,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;CAI1C"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProfileMetafield model - Controlled vocabulary for metadata fields
|
|
3
|
+
*
|
|
4
|
+
* Defines allowed metadata keys with validation rules.
|
|
5
|
+
* Uses UUID primary key with unique slug for human-readable lookups.
|
|
6
|
+
*/
|
|
7
|
+
import { SmrtObject, type SmrtObjectOptions } from '@happyvertical/smrt-core';
|
|
8
|
+
import type { ValidationSchema, ValidatorFunction } from '../types';
|
|
9
|
+
export interface ProfileMetafieldOptions extends SmrtObjectOptions {
|
|
10
|
+
slug?: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
validation?: ValidationSchema;
|
|
14
|
+
tenantId?: string | null;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Extend globalThis to include custom validators registry.
|
|
18
|
+
* Using globalThis ensures all module instances share the same validators,
|
|
19
|
+
* which is critical in monorepos where the same package can be loaded
|
|
20
|
+
* from different paths (e.g., pnpm store vs workspace symlink).
|
|
21
|
+
*
|
|
22
|
+
* @see https://github.com/happyvertical/smrt/issues/543
|
|
23
|
+
*/
|
|
24
|
+
declare global {
|
|
25
|
+
var __smrtProfileMetafieldValidators: Map<string, ValidatorFunction> | undefined;
|
|
26
|
+
}
|
|
27
|
+
export declare class ProfileMetafield extends SmrtObject {
|
|
28
|
+
tenantId: string | null;
|
|
29
|
+
name: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
validation?: ValidationSchema;
|
|
32
|
+
constructor(options?: ProfileMetafieldOptions);
|
|
33
|
+
/**
|
|
34
|
+
* Convenience method for slug-based lookup
|
|
35
|
+
*
|
|
36
|
+
* @param slug - The slug to search for
|
|
37
|
+
* @returns ProfileMetafield instance or null if not found
|
|
38
|
+
*/
|
|
39
|
+
static getBySlug(_slug: string): Promise<ProfileMetafield | null>;
|
|
40
|
+
/**
|
|
41
|
+
* Register a custom validator function
|
|
42
|
+
*
|
|
43
|
+
* @param name - Name of the validator (used in validation.custom field)
|
|
44
|
+
* @param validator - The validator function
|
|
45
|
+
*/
|
|
46
|
+
static registerValidator(name: string, validator: ValidatorFunction): void;
|
|
47
|
+
/**
|
|
48
|
+
* Get a registered custom validator
|
|
49
|
+
*
|
|
50
|
+
* @param name - Name of the validator
|
|
51
|
+
* @returns The validator function or undefined
|
|
52
|
+
*/
|
|
53
|
+
static getValidator(name: string): ValidatorFunction | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Validate a value against this metafield's validation schema
|
|
56
|
+
*
|
|
57
|
+
* @param value - The value to validate
|
|
58
|
+
* @returns True if valid, throws ValidationError if invalid
|
|
59
|
+
*/
|
|
60
|
+
validateValue(value: unknown): Promise<boolean>;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=ProfileMetafield.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProfileMetafield.d.ts","sourceRoot":"","sources":["../../src/models/ProfileMetafield.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAEL,UAAU,EACV,KAAK,iBAAiB,EAEvB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAEpE,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;IAChE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,gCAAgC,EAChC,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAC9B,SAAS,CAAC;CACf;AAeD,qBAOa,gBAAiB,SAAQ,UAAU;IAE9C,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAK/B,IAAI,EAAE,MAAM,CAAM;IAElB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,UAAU,CAAC,EAAE,gBAAgB,CAAC;gBAElB,OAAO,GAAE,uBAA4B;IAQjD;;;;;OAKG;WACU,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAKvE;;;;;OAKG;IACH,MAAM,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,GAAG,IAAI;IAI1E;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS;IAIhE;;;;;OAKG;IACG,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CAqFtD"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProfileRelationship model - Connects two profiles with a relationship type
|
|
3
|
+
*
|
|
4
|
+
* Represents directional or reciprocal relationships between profiles.
|
|
5
|
+
* Uses UUID primary key with foreign keys to profiles and relationship type.
|
|
6
|
+
*/
|
|
7
|
+
import { SmrtObject, type SmrtObjectOptions } from '@happyvertical/smrt-core';
|
|
8
|
+
import type { ProfileRelationshipTerm } from './ProfileRelationshipTerm';
|
|
9
|
+
export interface ProfileRelationshipOptions extends SmrtObjectOptions {
|
|
10
|
+
fromProfileId?: string;
|
|
11
|
+
toProfileId?: string;
|
|
12
|
+
typeId?: string;
|
|
13
|
+
contextProfileId?: string;
|
|
14
|
+
tenantId?: string | null;
|
|
15
|
+
}
|
|
16
|
+
export declare class ProfileRelationship extends SmrtObject {
|
|
17
|
+
tenantId: string | null;
|
|
18
|
+
fromProfileId?: string;
|
|
19
|
+
toProfileId?: string;
|
|
20
|
+
typeId?: string;
|
|
21
|
+
contextProfileId?: string;
|
|
22
|
+
terms: ProfileRelationshipTerm[];
|
|
23
|
+
constructor(options?: ProfileRelationshipOptions);
|
|
24
|
+
/**
|
|
25
|
+
* Get the relationship type slug
|
|
26
|
+
*
|
|
27
|
+
* @returns The slug of the relationship type
|
|
28
|
+
*/
|
|
29
|
+
getTypeSlug(): Promise<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Add a term (time period) to this relationship
|
|
32
|
+
*
|
|
33
|
+
* @param startedAt - Start date of the term
|
|
34
|
+
* @param endedAt - Optional end date of the term
|
|
35
|
+
*/
|
|
36
|
+
addTerm(startedAt: Date, endedAt?: Date): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* End the current active term
|
|
39
|
+
*
|
|
40
|
+
* @param endedAt - End date for the term
|
|
41
|
+
*/
|
|
42
|
+
endCurrentTerm(endedAt: Date): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Get all terms for this relationship
|
|
45
|
+
*
|
|
46
|
+
* @returns Array of ProfileRelationshipTerm instances
|
|
47
|
+
*/
|
|
48
|
+
getTerms(): Promise<ProfileRelationshipTerm[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Get the active term (no end date)
|
|
51
|
+
*
|
|
52
|
+
* @returns Current term or null if none active
|
|
53
|
+
*/
|
|
54
|
+
getActiveTerm(): Promise<ProfileRelationshipTerm | null>;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=ProfileRelationship.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProfileRelationship.d.ts","sourceRoot":"","sources":["../../src/models/ProfileRelationship.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAGL,UAAU,EACV,KAAK,iBAAiB,EAEvB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEzE,MAAM,WAAW,0BAA2B,SAAQ,iBAAiB;IACnE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,qBAOa,mBAAoB,SAAQ,UAAU;IAEjD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAI/B,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAI1B,KAAK,EAAE,uBAAuB,EAAE,CAAM;gBAE1B,OAAO,GAAE,0BAA+B;IAWpD;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAKpC;;;;;OAKG;IACG,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAyB7D;;;;OAIG;IACG,cAAc,CAAC,OAAO,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAOlD;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,uBAAuB,EAAE,CAAC;IAYpD;;;;OAIG;IACG,aAAa,IAAI,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC;CAW/D"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProfileRelationshipTerm model - Temporal data for relationships
|
|
3
|
+
*
|
|
4
|
+
* Defines the duration or terms of a specific relationship.
|
|
5
|
+
* Uses UUID primary key with foreign key to ProfileRelationship.
|
|
6
|
+
*/
|
|
7
|
+
import { SmrtObject, type SmrtObjectOptions } from '@happyvertical/smrt-core';
|
|
8
|
+
export interface ProfileRelationshipTermOptions extends SmrtObjectOptions {
|
|
9
|
+
relationshipId?: string;
|
|
10
|
+
startedAt?: Date;
|
|
11
|
+
endedAt?: Date;
|
|
12
|
+
}
|
|
13
|
+
export declare class ProfileRelationshipTerm extends SmrtObject {
|
|
14
|
+
relationshipId?: string;
|
|
15
|
+
startedAt: Date;
|
|
16
|
+
endedAt?: Date;
|
|
17
|
+
constructor(options?: ProfileRelationshipTermOptions);
|
|
18
|
+
/**
|
|
19
|
+
* Check if this term is currently active
|
|
20
|
+
*
|
|
21
|
+
* @returns True if active (no end date or end date in future)
|
|
22
|
+
*/
|
|
23
|
+
isActive(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* End this term
|
|
26
|
+
*
|
|
27
|
+
* @param endedAt - End date for the term (defaults to now)
|
|
28
|
+
*/
|
|
29
|
+
end(endedAt?: Date): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Get the duration of this term in days
|
|
32
|
+
*
|
|
33
|
+
* @returns Duration in days
|
|
34
|
+
*/
|
|
35
|
+
getDurationDays(): number;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=ProfileRelationshipTerm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProfileRelationshipTerm.d.ts","sourceRoot":"","sources":["../../src/models/ProfileRelationshipTerm.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAGL,UAAU,EACV,KAAK,iBAAiB,EAEvB,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,8BAA+B,SAAQ,iBAAiB;IACvE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,OAAO,CAAC,EAAE,IAAI,CAAC;CAChB;AAED,qBAMa,uBAAwB,SAAQ,UAAU;IAGrD,cAAc,CAAC,EAAE,MAAM,CAAC;IAGxB,SAAS,EAAE,IAAI,CAAc;IAE7B,OAAO,CAAC,EAAE,IAAI,CAAC;gBAEH,OAAO,GAAE,8BAAmC;IAQxD;;;;OAIG;IACH,QAAQ,IAAI,OAAO;IAKnB;;;;OAIG;IACG,GAAG,CAAC,OAAO,GAAE,IAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKpD;;;;OAIG;IACH,eAAe,IAAI,MAAM;CAK1B"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProfileRelationshipType model - Lookup table for relationship types
|
|
3
|
+
*
|
|
4
|
+
* Defines the kinds of relationships that can exist between profiles.
|
|
5
|
+
* Uses UUID primary key with unique slug for human-readable lookups.
|
|
6
|
+
*/
|
|
7
|
+
import { SmrtObject, type SmrtObjectOptions } from '@happyvertical/smrt-core';
|
|
8
|
+
import type { ReciprocalHandler } from '../types';
|
|
9
|
+
export interface ProfileRelationshipTypeOptions extends SmrtObjectOptions {
|
|
10
|
+
slug?: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
reciprocal?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Extend globalThis to include reciprocal handlers registry.
|
|
16
|
+
* Using globalThis ensures all module instances share the same handlers,
|
|
17
|
+
* which is critical in monorepos where the same package can be loaded
|
|
18
|
+
* from different paths (e.g., pnpm store vs workspace symlink).
|
|
19
|
+
*
|
|
20
|
+
* @see https://github.com/happyvertical/smrt/issues/543
|
|
21
|
+
*/
|
|
22
|
+
declare global {
|
|
23
|
+
var __smrtProfileRelationshipHandlers: Map<string, ReciprocalHandler> | undefined;
|
|
24
|
+
var __smrtProfileRelationshipHandlersInitialized: boolean | undefined;
|
|
25
|
+
}
|
|
26
|
+
export declare class ProfileRelationshipType extends SmrtObject {
|
|
27
|
+
name: string;
|
|
28
|
+
reciprocal: boolean;
|
|
29
|
+
constructor(options?: ProfileRelationshipTypeOptions);
|
|
30
|
+
/**
|
|
31
|
+
* Convenience method for slug-based lookup
|
|
32
|
+
*
|
|
33
|
+
* @param slug - The slug to search for
|
|
34
|
+
* @returns ProfileRelationshipType instance or null if not found
|
|
35
|
+
*/
|
|
36
|
+
static getBySlug(_slug: string): Promise<ProfileRelationshipType | null>;
|
|
37
|
+
/**
|
|
38
|
+
* Register a custom reciprocal handler for a relationship type
|
|
39
|
+
*
|
|
40
|
+
* @param slug - The relationship type slug
|
|
41
|
+
* @param handler - The handler function to execute when creating reciprocal relationship
|
|
42
|
+
*/
|
|
43
|
+
static registerReciprocalHandler(slug: string, handler: ReciprocalHandler): void;
|
|
44
|
+
/**
|
|
45
|
+
* Get the reciprocal handler for a relationship type
|
|
46
|
+
*
|
|
47
|
+
* @param slug - The relationship type slug
|
|
48
|
+
* @returns The handler function or undefined
|
|
49
|
+
*/
|
|
50
|
+
static getReciprocalHandler(slug: string): ReciprocalHandler | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Check if a relationship type is reciprocal
|
|
53
|
+
*
|
|
54
|
+
* @param slug - The relationship type slug
|
|
55
|
+
* @returns True if reciprocal, false otherwise
|
|
56
|
+
*/
|
|
57
|
+
static isReciprocal(slug: string): Promise<boolean>;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=ProfileRelationshipType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProfileRelationshipType.d.ts","sourceRoot":"","sources":["../../src/models/ProfileRelationshipType.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAEL,UAAU,EACV,KAAK,iBAAiB,EAEvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD,MAAM,WAAW,8BAA+B,SAAQ,iBAAiB;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,iCAAiC,EACjC,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAC9B,SAAS,CAAC;IAEd,IAAI,4CAA4C,EAAE,OAAO,GAAG,SAAS,CAAC;CACvE;AAiDD,qBAMa,uBAAwB,SAAQ,UAAU;IAIrD,IAAI,EAAE,MAAM,CAAM;IAElB,UAAU,EAAE,OAAO,CAAQ;gBAEf,OAAO,GAAE,8BAAmC;IAMxD;;;;;OAKG;WACU,SAAS,CACpB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC;IAK1C;;;;;OAKG;IACH,MAAM,CAAC,yBAAyB,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,iBAAiB,GACzB,IAAI;IAIP;;;;;OAKG;IACH,MAAM,CAAC,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS;IAIxE;;;;;OAKG;WACU,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAI1D"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProfileType model - Lookup table defining profile types
|
|
3
|
+
*
|
|
4
|
+
* Represents the nature of a profile (e.g., 'human', 'org', 'robot').
|
|
5
|
+
* Uses UUID primary key with unique slug for human-readable lookups.
|
|
6
|
+
*/
|
|
7
|
+
import { SmrtObject, type SmrtObjectOptions } from '@happyvertical/smrt-core';
|
|
8
|
+
export interface ProfileTypeOptions extends SmrtObjectOptions {
|
|
9
|
+
slug?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
tenantId?: string | null;
|
|
13
|
+
}
|
|
14
|
+
export declare class ProfileType extends SmrtObject {
|
|
15
|
+
tenantId: string | null;
|
|
16
|
+
name: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
constructor(options?: ProfileTypeOptions);
|
|
19
|
+
/**
|
|
20
|
+
* Convenience method for slug-based lookup
|
|
21
|
+
*
|
|
22
|
+
* @param slug - The slug to search for
|
|
23
|
+
* @returns ProfileType instance or null if not found
|
|
24
|
+
*/
|
|
25
|
+
static getBySlug(_slug: string): Promise<ProfileType | null>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=ProfileType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProfileType.d.ts","sourceRoot":"","sources":["../../src/models/ProfileType.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAEL,UAAU,EACV,KAAK,iBAAiB,EAEvB,MAAM,0BAA0B,CAAC;AAGlC,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,qBAOa,WAAY,SAAQ,UAAU;IAEzC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAK/B,IAAI,EAAE,MAAM,CAAM;IAElB,WAAW,CAAC,EAAE,MAAM,CAAC;gBAET,OAAO,GAAE,kBAAuB;IAO5C;;;;;OAKG;WACU,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;CAInE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Profile subclasses for STI (Single Table Inheritance)
|
|
3
|
+
*
|
|
4
|
+
* These classes inherit from Profile and automatically use the shared
|
|
5
|
+
* profiles table with _meta_type discriminator.
|
|
6
|
+
*/
|
|
7
|
+
import { Profile, type ProfileOptions } from './Profile';
|
|
8
|
+
/**
|
|
9
|
+
* Person profile type
|
|
10
|
+
*
|
|
11
|
+
* Represents individual people/users.
|
|
12
|
+
*/
|
|
13
|
+
export declare class Person extends Profile {
|
|
14
|
+
constructor(options?: ProfileOptions);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Organization profile type
|
|
18
|
+
*
|
|
19
|
+
* Represents companies, groups, institutions, and other organizational entities.
|
|
20
|
+
*/
|
|
21
|
+
export declare class Organization extends Profile {
|
|
22
|
+
constructor(options?: ProfileOptions);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Bot profile type
|
|
26
|
+
*
|
|
27
|
+
* Represents automated agents, bots, and AI entities.
|
|
28
|
+
*/
|
|
29
|
+
export declare class Bot extends Profile {
|
|
30
|
+
constructor(options?: ProfileOptions);
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=ProfileTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProfileTypes.d.ts","sourceRoot":"","sources":["../../src/models/ProfileTypes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAEzD;;;;GAIG;AACH,qBAGa,MAAO,SAAQ,OAAO;gBACrB,OAAO,GAAE,cAAmB;CAIzC;AAED;;;;GAIG;AACH,qBAGa,YAAa,SAAQ,OAAO;gBAC3B,OAAO,GAAE,cAAmB;CAIzC;AAED;;;;GAIG;AACH,qBAGa,GAAI,SAAQ,OAAO;gBAClB,OAAO,GAAE,cAAmB;CAIzC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMRT model exports for profiles package
|
|
3
|
+
*/
|
|
4
|
+
export { ApiKey, type ApiKeyOptions, type GenerateKeyResult } from './ApiKey';
|
|
5
|
+
export { AuditLog, type AuditLogOptions, type AuditSource } from './AuditLog';
|
|
6
|
+
export { type GenerateTokenResult, MagicLinkToken, type MagicLinkTokenOptions, } from './MagicLinkToken';
|
|
7
|
+
export { NostrIdentity, type NostrIdentityOptions } from './NostrIdentity';
|
|
8
|
+
export { OidcIdentity, type OidcIdentityOptions } from './OidcIdentity';
|
|
9
|
+
export { OidcProfileEmailReservation, type OidcProfileEmailReservationOptions, } from './OidcProfileEmailReservation';
|
|
10
|
+
export { Profile } from './Profile';
|
|
11
|
+
export { ProfileMetadata } from './ProfileMetadata';
|
|
12
|
+
export { ProfileMetafield } from './ProfileMetafield';
|
|
13
|
+
export { ProfileRelationship } from './ProfileRelationship';
|
|
14
|
+
export { ProfileRelationshipTerm } from './ProfileRelationshipTerm';
|
|
15
|
+
export { ProfileRelationshipType } from './ProfileRelationshipType';
|
|
16
|
+
export { ProfileType } from './ProfileType';
|
|
17
|
+
export { Bot, Organization, Person } from './ProfileTypes';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9E,OAAO,EACL,KAAK,mBAAmB,EACxB,cAAc,EACd,KAAK,qBAAqB,GAC3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EACL,2BAA2B,EAC3B,KAAK,kCAAkC,GACxC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC"}
|