@happyvertical/smrt-profiles 0.30.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.
Files changed (42) hide show
  1. package/AGENTS.md +53 -0
  2. package/CLAUDE.md +1 -0
  3. package/LICENSE +7 -0
  4. package/README.md +176 -0
  5. package/dist/chunks/ApiKey-B2LKEaP8.js +143 -0
  6. package/dist/chunks/ApiKey-B2LKEaP8.js.map +1 -0
  7. package/dist/chunks/ApiKeyCollection-B6Op817e.js +91 -0
  8. package/dist/chunks/ApiKeyCollection-B6Op817e.js.map +1 -0
  9. package/dist/chunks/AuditLogCollection-BYqCj0uE.js +195 -0
  10. package/dist/chunks/AuditLogCollection-BYqCj0uE.js.map +1 -0
  11. package/dist/chunks/NostrIdentityCollection-DadQBHWy.js +3065 -0
  12. package/dist/chunks/NostrIdentityCollection-DadQBHWy.js.map +1 -0
  13. package/dist/chunks/ProfileAssetCollection-D_tk1kKG.js +122 -0
  14. package/dist/chunks/ProfileAssetCollection-D_tk1kKG.js.map +1 -0
  15. package/dist/chunks/ProfileCollection-DU6wUJTO.js +782 -0
  16. package/dist/chunks/ProfileCollection-DU6wUJTO.js.map +1 -0
  17. package/dist/chunks/ProfileMetadataCollection-DEhmljMY.js +120 -0
  18. package/dist/chunks/ProfileMetadataCollection-DEhmljMY.js.map +1 -0
  19. package/dist/chunks/ProfileMetafieldCollection-DMKhSHXX.js +184 -0
  20. package/dist/chunks/ProfileMetafieldCollection-DMKhSHXX.js.map +1 -0
  21. package/dist/chunks/ProfileRelationshipCollection-C0IM8UQR.js +177 -0
  22. package/dist/chunks/ProfileRelationshipCollection-C0IM8UQR.js.map +1 -0
  23. package/dist/chunks/ProfileRelationshipTermCollection-CXem_qT-.js +117 -0
  24. package/dist/chunks/ProfileRelationshipTermCollection-CXem_qT-.js.map +1 -0
  25. package/dist/chunks/ProfileRelationshipType-BXBLldea.js +103 -0
  26. package/dist/chunks/ProfileRelationshipType-BXBLldea.js.map +1 -0
  27. package/dist/chunks/ProfileRelationshipTypeCollection-CF8YvLTV.js +48 -0
  28. package/dist/chunks/ProfileRelationshipTypeCollection-CF8YvLTV.js.map +1 -0
  29. package/dist/chunks/index-jFtOWsAV.js +1014 -0
  30. package/dist/chunks/index-jFtOWsAV.js.map +1 -0
  31. package/dist/index.d.ts +1848 -0
  32. package/dist/index.js +70 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/manifest.json +11829 -0
  35. package/dist/smrt-knowledge.json +3846 -0
  36. package/dist/types.d.ts +41 -0
  37. package/dist/types.js +2 -0
  38. package/dist/types.js.map +1 -0
  39. package/dist/utils.d.ts +61 -0
  40. package/dist/utils.js +49 -0
  41. package/dist/utils.js.map +1 -0
  42. package/package.json +75 -0
@@ -0,0 +1,122 @@
1
+ import { getOwnedAssetsFromCollection, addOwnedAssetFromCollection, removeOwnedAssetFromCollection } from "@happyvertical/smrt-assets";
2
+ import { foreignKey, crossPackageRef, field, smrt, SmrtObject, SmrtJunction } from "@happyvertical/smrt-core";
3
+ import { tenantId, TenantScoped } from "@happyvertical/smrt-tenancy";
4
+ var __defProp$1 = Object.defineProperty;
5
+ var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
6
+ var __decorateClass$1 = (decorators, target, key, kind) => {
7
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
8
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
9
+ if (decorator = decorators[i])
10
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11
+ if (kind && result) __defProp$1(target, key, result);
12
+ return result;
13
+ };
14
+ let ProfileAsset = class extends SmrtObject {
15
+ tenantId = null;
16
+ profileId = "";
17
+ assetId = "";
18
+ relationship = "attachment";
19
+ sortOrder = 0;
20
+ constructor(options = {}) {
21
+ super(options);
22
+ if (options.profileId) this.profileId = options.profileId;
23
+ if (options.assetId) this.assetId = options.assetId;
24
+ if (options.relationship) this.relationship = options.relationship;
25
+ if (options.sortOrder !== void 0) this.sortOrder = options.sortOrder;
26
+ if (options.tenantId !== void 0) this.tenantId = options.tenantId;
27
+ }
28
+ };
29
+ __decorateClass$1([
30
+ tenantId({ nullable: true })
31
+ ], ProfileAsset.prototype, "tenantId", 2);
32
+ __decorateClass$1([
33
+ foreignKey("Profile", { required: true })
34
+ ], ProfileAsset.prototype, "profileId", 2);
35
+ __decorateClass$1([
36
+ crossPackageRef("@happyvertical/smrt-assets:Asset", { required: true })
37
+ ], ProfileAsset.prototype, "assetId", 2);
38
+ __decorateClass$1([
39
+ field({ required: true })
40
+ ], ProfileAsset.prototype, "relationship", 2);
41
+ __decorateClass$1([
42
+ field()
43
+ ], ProfileAsset.prototype, "sortOrder", 2);
44
+ ProfileAsset = __decorateClass$1([
45
+ TenantScoped({ mode: "optional" }),
46
+ smrt({
47
+ tableName: "profile_assets",
48
+ conflictColumns: ["profile_id", "asset_id", "relationship"],
49
+ api: false,
50
+ mcp: false,
51
+ cli: false
52
+ })
53
+ ], ProfileAsset);
54
+ var __defProp = Object.defineProperty;
55
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
56
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
57
+ var __decorateClass = (decorators, target, key, kind) => {
58
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
59
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
60
+ if (decorator = decorators[i])
61
+ result = decorator(result) || result;
62
+ return result;
63
+ };
64
+ var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
65
+ let ProfileAssetCollection = class extends SmrtJunction {
66
+ leftField = "profileId";
67
+ rightField = "assetId";
68
+ profileCollectionPromise = null;
69
+ async getProfileCollection() {
70
+ if (!this.profileCollectionPromise) {
71
+ const { ProfileCollection } = await import("./ProfileCollection-DU6wUJTO.js").then((n) => n.d);
72
+ this.profileCollectionPromise = ProfileCollection.create({ db: this.db });
73
+ }
74
+ return this.profileCollectionPromise;
75
+ }
76
+ async getAssets(profileId, relationship) {
77
+ return getOwnedAssetsFromCollection(
78
+ await this.getProfileCollection(),
79
+ profileId,
80
+ relationship
81
+ );
82
+ }
83
+ async addAsset(profileId, asset, relationship = "attachment", sortOrder = 0) {
84
+ await addOwnedAssetFromCollection(
85
+ await this.getProfileCollection(),
86
+ "Profile",
87
+ profileId,
88
+ asset,
89
+ relationship,
90
+ sortOrder
91
+ );
92
+ }
93
+ async removeAsset(profileId, assetId, relationship) {
94
+ await removeOwnedAssetFromCollection(
95
+ await this.getProfileCollection(),
96
+ "Profile",
97
+ profileId,
98
+ assetId,
99
+ relationship
100
+ );
101
+ }
102
+ };
103
+ __publicField(ProfileAssetCollection, "_itemClass", ProfileAsset);
104
+ ProfileAssetCollection = __decorateClass([
105
+ smrt({
106
+ api: false,
107
+ mcp: false,
108
+ cli: false
109
+ })
110
+ ], ProfileAssetCollection);
111
+ const ProfileAssetCollection$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
112
+ __proto__: null,
113
+ get ProfileAssetCollection() {
114
+ return ProfileAssetCollection;
115
+ }
116
+ }, Symbol.toStringTag, { value: "Module" }));
117
+ export {
118
+ ProfileAsset as P,
119
+ ProfileAssetCollection as a,
120
+ ProfileAssetCollection$1 as b
121
+ };
122
+ //# sourceMappingURL=ProfileAssetCollection-D_tk1kKG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProfileAssetCollection-D_tk1kKG.js","sources":["../../src/models/ProfileAsset.ts","../../src/collections/ProfileAssetCollection.ts"],"sourcesContent":["import type { SmrtObjectOptions } from '@happyvertical/smrt-core';\nimport {\n crossPackageRef,\n field,\n foreignKey,\n SmrtObject,\n smrt,\n} from '@happyvertical/smrt-core';\nimport { TenantScoped, tenantId } from '@happyvertical/smrt-tenancy';\n\nexport interface ProfileAssetOptions extends SmrtObjectOptions {\n profileId?: string;\n assetId?: string;\n relationship?: string;\n sortOrder?: number;\n tenantId?: string | null;\n}\n\n@TenantScoped({ mode: 'optional' })\n@smrt({\n tableName: 'profile_assets',\n conflictColumns: ['profile_id', 'asset_id', 'relationship'],\n api: false,\n mcp: false,\n cli: false,\n})\nexport class ProfileAsset extends SmrtObject {\n @tenantId({ nullable: true })\n tenantId: string | null = null;\n\n @foreignKey('Profile', { required: true })\n profileId = '';\n\n @crossPackageRef('@happyvertical/smrt-assets:Asset', { required: true })\n assetId = '';\n\n @field({ required: true })\n relationship = 'attachment';\n\n @field()\n sortOrder = 0;\n\n constructor(options: ProfileAssetOptions = {}) {\n super(options);\n if (options.profileId) this.profileId = options.profileId;\n if (options.assetId) this.assetId = options.assetId;\n if (options.relationship) this.relationship = options.relationship;\n if (options.sortOrder !== undefined) this.sortOrder = options.sortOrder;\n if (options.tenantId !== undefined) this.tenantId = options.tenantId;\n }\n}\n","import type { Asset } from '@happyvertical/smrt-assets';\nimport {\n addOwnedAssetFromCollection,\n getOwnedAssetsFromCollection,\n removeOwnedAssetFromCollection,\n} from '@happyvertical/smrt-assets';\nimport type { SmrtCollectionOptions } from '@happyvertical/smrt-core';\nimport { SmrtJunction, smrt } from '@happyvertical/smrt-core';\nimport { ProfileAsset } from '../models/ProfileAsset';\nimport type { ProfileCollection } from './ProfileCollection';\n\nexport interface ProfileAssetCollectionOptions extends SmrtCollectionOptions {}\n\n@smrt({\n api: false,\n mcp: false,\n cli: false,\n})\nexport class ProfileAssetCollection extends SmrtJunction<ProfileAsset> {\n static readonly _itemClass = ProfileAsset;\n protected leftField = 'profileId';\n protected rightField = 'assetId';\n\n private profileCollectionPromise: Promise<ProfileCollection> | null = null;\n\n private async getProfileCollection(): Promise<ProfileCollection> {\n if (!this.profileCollectionPromise) {\n const { ProfileCollection } = await import('./ProfileCollection');\n this.profileCollectionPromise = ProfileCollection.create({ db: this.db });\n }\n\n return this.profileCollectionPromise;\n }\n\n async getAssets(profileId: string, relationship?: string): Promise<Asset[]> {\n return getOwnedAssetsFromCollection(\n await this.getProfileCollection(),\n profileId,\n relationship,\n );\n }\n\n async addAsset(\n profileId: string,\n asset: Asset,\n relationship = 'attachment',\n sortOrder = 0,\n ): Promise<void> {\n await addOwnedAssetFromCollection(\n await this.getProfileCollection(),\n 'Profile',\n profileId,\n asset,\n relationship,\n sortOrder,\n );\n }\n\n async removeAsset(\n profileId: string,\n assetId: string,\n relationship?: string,\n ): Promise<void> {\n await removeOwnedAssetFromCollection(\n await this.getProfileCollection(),\n 'Profile',\n profileId,\n assetId,\n relationship,\n );\n }\n}\n"],"names":["__decorateClass"],"mappings":";;;;;;;;;;;;;AA0BO,IAAM,eAAN,cAA2B,WAAW;AAAA,EAE3C,WAA0B;AAAA,EAG1B,YAAY;AAAA,EAGZ,UAAU;AAAA,EAGV,eAAe;AAAA,EAGf,YAAY;AAAA,EAEZ,YAAY,UAA+B,IAAI;AAC7C,UAAM,OAAO;AACb,QAAI,QAAQ,UAAW,MAAK,YAAY,QAAQ;AAChD,QAAI,QAAQ,QAAS,MAAK,UAAU,QAAQ;AAC5C,QAAI,QAAQ,aAAc,MAAK,eAAe,QAAQ;AACtD,QAAI,QAAQ,cAAc,OAAW,MAAK,YAAY,QAAQ;AAC9D,QAAI,QAAQ,aAAa,OAAW,MAAK,WAAW,QAAQ;AAAA,EAC9D;AACF;AAtBEA,kBAAA;AAAA,EADC,SAAS,EAAE,UAAU,KAAA,CAAM;AAAA,GADjB,aAEX,WAAA,YAAA,CAAA;AAGAA,kBAAA;AAAA,EADC,WAAW,WAAW,EAAE,UAAU,MAAM;AAAA,GAJ9B,aAKX,WAAA,aAAA,CAAA;AAGAA,kBAAA;AAAA,EADC,gBAAgB,oCAAoC,EAAE,UAAU,MAAM;AAAA,GAP5D,aAQX,WAAA,WAAA,CAAA;AAGAA,kBAAA;AAAA,EADC,MAAM,EAAE,UAAU,KAAA,CAAM;AAAA,GAVd,aAWX,WAAA,gBAAA,CAAA;AAGAA,kBAAA;AAAA,EADC,MAAA;AAAM,GAbI,aAcX,WAAA,aAAA,CA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