@powerhousedao/builder-profile 0.0.2 → 0.0.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.
Files changed (161) hide show
  1. package/dist/document-models/builder-profile/actions.d.ts +22 -0
  2. package/dist/document-models/builder-profile/actions.d.ts.map +1 -0
  3. package/dist/document-models/builder-profile/actions.js +4 -0
  4. package/dist/document-models/builder-profile/gen/actions.d.ts +3 -3
  5. package/dist/document-models/builder-profile/gen/actions.d.ts.map +1 -1
  6. package/dist/document-models/builder-profile/gen/actions.js +1 -1
  7. package/dist/document-models/builder-profile/gen/builders/actions.d.ts +44 -0
  8. package/dist/document-models/builder-profile/gen/builders/actions.d.ts.map +1 -0
  9. package/dist/document-models/builder-profile/gen/builders/actions.js +1 -0
  10. package/dist/document-models/builder-profile/gen/builders/creators.d.ts +13 -0
  11. package/dist/document-models/builder-profile/gen/builders/creators.d.ts.map +1 -0
  12. package/dist/document-models/builder-profile/gen/builders/creators.js +12 -0
  13. package/dist/document-models/builder-profile/gen/builders/error.d.ts.map +1 -0
  14. package/dist/document-models/builder-profile/gen/builders/operations.d.ts +16 -0
  15. package/dist/document-models/builder-profile/gen/builders/operations.d.ts.map +1 -0
  16. package/dist/document-models/builder-profile/gen/builders/operations.js +3 -0
  17. package/dist/document-models/builder-profile/gen/creators.d.ts +2 -1
  18. package/dist/document-models/builder-profile/gen/creators.d.ts.map +1 -1
  19. package/dist/document-models/builder-profile/gen/creators.js +2 -1
  20. package/dist/document-models/builder-profile/gen/document-model.d.ts +2 -2
  21. package/dist/document-models/builder-profile/gen/document-model.d.ts.map +1 -1
  22. package/dist/document-models/builder-profile/gen/document-model.js +107 -8
  23. package/dist/document-models/builder-profile/gen/document-schema.d.ts +370 -0
  24. package/dist/document-models/builder-profile/gen/document-schema.d.ts.map +1 -0
  25. package/dist/document-models/builder-profile/gen/document-schema.js +33 -0
  26. package/dist/document-models/builder-profile/gen/document-type.d.ts +2 -0
  27. package/dist/document-models/builder-profile/gen/document-type.d.ts.map +1 -0
  28. package/dist/document-models/builder-profile/gen/document-type.js +1 -0
  29. package/dist/document-models/builder-profile/gen/index.d.ts +7 -3
  30. package/dist/document-models/builder-profile/gen/index.d.ts.map +1 -1
  31. package/dist/document-models/builder-profile/gen/index.js +7 -2
  32. package/dist/document-models/builder-profile/gen/ph-factories.d.ts +6 -10
  33. package/dist/document-models/builder-profile/gen/ph-factories.d.ts.map +1 -1
  34. package/dist/document-models/builder-profile/gen/ph-factories.js +9 -4
  35. package/dist/document-models/builder-profile/gen/reducer.d.ts +1 -3
  36. package/dist/document-models/builder-profile/gen/reducer.d.ts.map +1 -1
  37. package/dist/document-models/builder-profile/gen/reducer.js +42 -9
  38. package/dist/document-models/builder-profile/gen/schema/index.d.ts +1 -1
  39. package/dist/document-models/builder-profile/gen/schema/index.d.ts.map +1 -1
  40. package/dist/document-models/builder-profile/gen/schema/index.js +1 -1
  41. package/dist/document-models/builder-profile/gen/schema/types.d.ts +55 -0
  42. package/dist/document-models/builder-profile/gen/schema/types.d.ts.map +1 -1
  43. package/dist/document-models/builder-profile/gen/schema/zod.d.ts +19 -1
  44. package/dist/document-models/builder-profile/gen/schema/zod.d.ts.map +1 -1
  45. package/dist/document-models/builder-profile/gen/schema/zod.js +126 -0
  46. package/dist/document-models/builder-profile/gen/types.d.ts +9 -7
  47. package/dist/document-models/builder-profile/gen/types.d.ts.map +1 -1
  48. package/dist/document-models/builder-profile/gen/types.js +1 -1
  49. package/dist/document-models/builder-profile/gen/utils.d.ts +13 -20
  50. package/dist/document-models/builder-profile/gen/utils.d.ts.map +1 -1
  51. package/dist/document-models/builder-profile/gen/utils.js +54 -37
  52. package/dist/document-models/builder-profile/hooks.d.ts +11 -0
  53. package/dist/document-models/builder-profile/hooks.d.ts.map +1 -0
  54. package/dist/document-models/builder-profile/hooks.js +26 -0
  55. package/dist/document-models/builder-profile/index.d.ts +5 -20
  56. package/dist/document-models/builder-profile/index.d.ts.map +1 -1
  57. package/dist/document-models/builder-profile/index.js +5 -17
  58. package/dist/document-models/builder-profile/module.d.ts +5 -0
  59. package/dist/document-models/builder-profile/module.d.ts.map +1 -0
  60. package/dist/document-models/builder-profile/module.js +10 -0
  61. package/dist/document-models/builder-profile/src/index.d.ts +2 -0
  62. package/dist/document-models/builder-profile/src/index.d.ts.map +1 -0
  63. package/dist/document-models/builder-profile/src/index.js +1 -0
  64. package/dist/document-models/builder-profile/src/reducers/builders.d.ts +3 -0
  65. package/dist/document-models/builder-profile/src/reducers/builders.d.ts.map +1 -0
  66. package/dist/document-models/builder-profile/src/reducers/builders.js +108 -0
  67. package/dist/document-models/builder-profile/src/tests/builders.test.d.ts +6 -0
  68. package/dist/document-models/builder-profile/src/tests/builders.test.d.ts.map +1 -0
  69. package/dist/document-models/builder-profile/src/tests/builders.test.js +19 -0
  70. package/dist/document-models/builder-profile/src/tests/document-model.test.d.ts +4 -0
  71. package/dist/document-models/builder-profile/src/tests/document-model.test.d.ts.map +1 -1
  72. package/dist/document-models/builder-profile/src/tests/document-model.test.js +91 -5
  73. package/dist/document-models/builder-profile/utils.d.ts +14 -0
  74. package/dist/document-models/builder-profile/utils.d.ts.map +1 -0
  75. package/dist/document-models/builder-profile/utils.js +7 -0
  76. package/dist/document-models/document-models.d.ts +3 -0
  77. package/dist/document-models/document-models.d.ts.map +1 -0
  78. package/dist/document-models/document-models.js +4 -0
  79. package/dist/document-models/index.d.ts +1 -2
  80. package/dist/document-models/index.d.ts.map +1 -1
  81. package/dist/document-models/index.js +1 -1
  82. package/dist/editors/builder-profile/components/ContributorsSection.d.ts +8 -0
  83. package/dist/editors/builder-profile/components/ContributorsSection.d.ts.map +1 -0
  84. package/dist/editors/builder-profile/components/ContributorsSection.js +177 -0
  85. package/dist/editors/builder-profile/components/ImageUrlInput.d.ts +9 -0
  86. package/dist/editors/builder-profile/components/ImageUrlInput.d.ts.map +1 -0
  87. package/dist/editors/builder-profile/components/ImageUrlInput.js +57 -0
  88. package/dist/editors/builder-profile/components/LinksSection.d.ts +18 -0
  89. package/dist/editors/builder-profile/components/LinksSection.d.ts.map +1 -0
  90. package/dist/editors/builder-profile/components/LinksSection.js +74 -0
  91. package/dist/editors/builder-profile/components/ProfilePreview.d.ts +7 -0
  92. package/dist/editors/builder-profile/components/ProfilePreview.d.ts.map +1 -0
  93. package/dist/editors/builder-profile/components/ProfilePreview.js +55 -0
  94. package/dist/editors/builder-profile/components/ScopesSection.d.ts +9 -0
  95. package/dist/editors/builder-profile/components/ScopesSection.d.ts.map +1 -0
  96. package/dist/editors/builder-profile/components/ScopesSection.js +58 -0
  97. package/dist/editors/builder-profile/components/SkillsSection.d.ts +9 -0
  98. package/dist/editors/builder-profile/components/SkillsSection.d.ts.map +1 -0
  99. package/dist/editors/builder-profile/components/SkillsSection.js +66 -0
  100. package/dist/editors/builder-profile/editor.d.ts +0 -2
  101. package/dist/editors/builder-profile/editor.d.ts.map +1 -1
  102. package/dist/editors/builder-profile/editor.js +216 -97
  103. package/dist/editors/builder-profile/module.d.ts +4 -0
  104. package/dist/editors/builder-profile/module.d.ts.map +1 -0
  105. package/dist/editors/builder-profile/module.js +10 -0
  106. package/dist/editors/editors.d.ts +3 -0
  107. package/dist/editors/editors.d.ts.map +1 -0
  108. package/dist/editors/editors.js +2 -0
  109. package/dist/editors/index.d.ts +1 -2
  110. package/dist/editors/index.d.ts.map +1 -1
  111. package/dist/editors/index.js +1 -1
  112. package/dist/index.d.ts +2 -2
  113. package/dist/index.d.ts.map +1 -1
  114. package/dist/index.js +2 -2
  115. package/dist/powerhouse.manifest.json +5 -13
  116. package/dist/processors/index.d.ts.map +1 -1
  117. package/dist/style.css +642 -4847
  118. package/dist/subgraphs/builder-profile/index.d.ts +2 -2
  119. package/dist/subgraphs/builder-profile/index.d.ts.map +1 -1
  120. package/dist/subgraphs/builder-profile/index.js +2 -2
  121. package/dist/subgraphs/builder-profile/resolvers.d.ts +2 -2
  122. package/dist/subgraphs/builder-profile/resolvers.d.ts.map +1 -1
  123. package/dist/subgraphs/builder-profile/resolvers.js +112 -4
  124. package/dist/subgraphs/builder-profile/schema.d.ts.map +1 -1
  125. package/dist/subgraphs/builder-profile/schema.js +119 -13
  126. package/dist/subgraphs/index.d.ts +0 -1
  127. package/dist/subgraphs/index.d.ts.map +1 -1
  128. package/dist/vite.config.d.ts +3 -0
  129. package/dist/vite.config.d.ts.map +1 -0
  130. package/dist/vite.config.js +13 -0
  131. package/package.json +56 -42
  132. package/dist/document-models/builder-profile/gen/builder/actions.d.ts +0 -8
  133. package/dist/document-models/builder-profile/gen/builder/actions.d.ts.map +0 -1
  134. package/dist/document-models/builder-profile/gen/builder/actions.js +0 -1
  135. package/dist/document-models/builder-profile/gen/builder/creators.d.ts +0 -4
  136. package/dist/document-models/builder-profile/gen/builder/creators.d.ts.map +0 -1
  137. package/dist/document-models/builder-profile/gen/builder/creators.js +0 -3
  138. package/dist/document-models/builder-profile/gen/builder/error.d.ts.map +0 -1
  139. package/dist/document-models/builder-profile/gen/builder/object.d.ts +0 -7
  140. package/dist/document-models/builder-profile/gen/builder/object.d.ts.map +0 -1
  141. package/dist/document-models/builder-profile/gen/builder/object.js +0 -7
  142. package/dist/document-models/builder-profile/gen/builder/operations.d.ts +0 -7
  143. package/dist/document-models/builder-profile/gen/builder/operations.d.ts.map +0 -1
  144. package/dist/document-models/builder-profile/gen/builder/operations.js +0 -1
  145. package/dist/document-models/builder-profile/gen/object.d.ts +0 -15
  146. package/dist/document-models/builder-profile/gen/object.d.ts.map +0 -1
  147. package/dist/document-models/builder-profile/gen/object.js +0 -25
  148. package/dist/document-models/builder-profile/src/reducers/builder.d.ts +0 -3
  149. package/dist/document-models/builder-profile/src/reducers/builder.d.ts.map +0 -1
  150. package/dist/document-models/builder-profile/src/reducers/builder.js +0 -9
  151. package/dist/document-models/builder-profile/src/tests/builder.test.d.ts +0 -2
  152. package/dist/document-models/builder-profile/src/tests/builder.test.d.ts.map +0 -1
  153. package/dist/document-models/builder-profile/src/tests/builder.test.js +0 -116
  154. package/dist/editors/builder-profile/index.d.ts +0 -3
  155. package/dist/editors/builder-profile/index.d.ts.map +0 -1
  156. package/dist/editors/builder-profile/index.js +0 -11
  157. package/dist/editors/hooks/useBuilderProfileDocument.d.ts +0 -4
  158. package/dist/editors/hooks/useBuilderProfileDocument.d.ts.map +0 -1
  159. package/dist/editors/hooks/useBuilderProfileDocument.js +0 -8
  160. /package/dist/document-models/builder-profile/gen/{builder → builders}/error.d.ts +0 -0
  161. /package/dist/document-models/builder-profile/gen/{builder → builders}/error.js +0 -0
@@ -1,25 +0,0 @@
1
- import { BaseDocumentClass, applyMixins, } from "document-model";
2
- import { reducer } from "./reducer.js";
3
- import { createDocument } from "./utils.js";
4
- import BuilderProfile_Builder from "./builder/object.js";
5
- export * from "./builder/object.js";
6
- // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
7
- class BuilderProfile extends BaseDocumentClass {
8
- static fileExtension = ".phdm";
9
- constructor(initialState, dispatch) {
10
- super(reducer, createDocument(initialState), dispatch);
11
- }
12
- saveToFile(path, name) {
13
- return super.saveToFile(path, BuilderProfile.fileExtension, name);
14
- }
15
- loadFromFile(path) {
16
- return super.loadFromFile(path);
17
- }
18
- static async fromFile(path) {
19
- const document = new this();
20
- await document.loadFromFile(path);
21
- return document;
22
- }
23
- }
24
- applyMixins(BuilderProfile, [BuilderProfile_Builder]);
25
- export { BuilderProfile };
@@ -1,3 +0,0 @@
1
- import type { BuilderProfileBuilderOperations } from "../../gen/builder/operations.js";
2
- export declare const reducer: BuilderProfileBuilderOperations;
3
- //# sourceMappingURL=builder.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-profile/src/reducers/builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,iCAAiC,CAAC;AAEvF,eAAO,MAAM,OAAO,EAAE,+BAQrB,CAAC"}
@@ -1,9 +0,0 @@
1
- export const reducer = {
2
- updateProfileOperation(state, action, dispatch) {
3
- state.id = action.input.id ?? state.id;
4
- state.slug = action.input.slug ?? state.slug;
5
- state.name = action.input.name ?? state.name;
6
- state.icon = action.input.icon ?? state.icon;
7
- state.description = action.input.description ?? state.description;
8
- }
9
- };
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=builder.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"builder.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-profile/src/tests/builder.test.ts"],"names":[],"mappings":""}
@@ -1,116 +0,0 @@
1
- import { describe, it, expect, beforeEach } from "vitest";
2
- import utils from "../../gen/utils.js";
3
- import { reducer } from "../../gen/reducer.js";
4
- import * as creators from "../../gen/builder/creators.js";
5
- import { z } from "../../gen/schema/index.js";
6
- /**
7
- * BuilderProfile Document Model: Comprehensive Tests
8
- * Focus: PHID and URL field validation, update, and expected behaviors
9
- */
10
- const VALID_PHID = "phd:baefc2a4-f9a0-4950-8161-fd8d8cc7dea7";
11
- const VALID_URL = "https://powerhouse.inc/icon.png";
12
- const INVALID_PHID = "invalid:format:phid";
13
- const INVALID_URL = "not-a-url";
14
- describe("BuilderProfile Document Model", () => {
15
- let document;
16
- beforeEach(() => {
17
- document = utils.createDocument();
18
- });
19
- it("should accept a valid PHID and URL in updateProfile", () => {
20
- const input = {
21
- id: VALID_PHID,
22
- slug: "builder-slug",
23
- name: "Builder Name",
24
- icon: VALID_URL,
25
- description: "A valid builder description"
26
- };
27
- // Should not throw during reducer/update
28
- const updatedDocument = reducer(document, creators.updateProfile(input));
29
- // Check operation appended with strict equality
30
- expect(updatedDocument.operations.global).toHaveLength(1);
31
- const op = updatedDocument.operations.global[0];
32
- expect(op.action.type).toBe("UPDATE_PROFILE");
33
- expect(op.action.input).toStrictEqual(input);
34
- // Ensure the PHID and URL fields persisted in state
35
- expect(updatedDocument.state.global.id).toBe(VALID_PHID);
36
- expect(updatedDocument.state.global.icon).toBe(VALID_URL);
37
- });
38
- it("should reject an invalid PHID using Zod validation", () => {
39
- const input = {
40
- id: INVALID_PHID,
41
- slug: "builder-slug",
42
- name: "Builder Name",
43
- icon: VALID_URL,
44
- description: "should fail phid"
45
- };
46
- // Zod parsing should throw
47
- expect(() => z.UpdateProfileInputSchema().parse(input)).toThrow();
48
- });
49
- it("should reject an invalid URL using Zod validation", () => {
50
- const input = {
51
- id: VALID_PHID,
52
- slug: "builder-slug",
53
- name: "Builder Name",
54
- icon: INVALID_URL,
55
- description: "should fail url"
56
- };
57
- // Zod parsing should throw
58
- expect(() => z.UpdateProfileInputSchema().parse(input)).toThrow();
59
- });
60
- it("should update only the URL and PHID fields if only they are provided", () => {
61
- // The rest of the state is initialized to undefined by utils.createDocument()
62
- // Set initial values
63
- const initialInput = {
64
- id: VALID_PHID,
65
- slug: "slug-main",
66
- name: "Initial Name",
67
- icon: VALID_URL,
68
- description: "Initial desc"
69
- };
70
- let currDoc = reducer(document, creators.updateProfile(initialInput));
71
- // Now, update only id and icon
72
- const updateInput = {
73
- id: "phd:12345678-1111-2222-3333-abcdefabcdef:main:public",
74
- icon: "https://updated-url.com/icon.svg"
75
- };
76
- currDoc = reducer(currDoc, creators.updateProfile(updateInput));
77
- // id & icon changed, others remain
78
- expect(currDoc.state.global.id).toBe(updateInput.id);
79
- expect(currDoc.state.global.icon).toBe(updateInput.icon);
80
- expect(currDoc.state.global.slug).toBe(initialInput.slug);
81
- expect(currDoc.state.global.name).toBe(initialInput.name);
82
- expect(currDoc.state.global.description).toBe(initialInput.description);
83
- });
84
- it("should allow updateProfile with partial inputs, always keeping PHID format valid", () => {
85
- // Start with valid state
86
- const initialState = {
87
- id: VALID_PHID,
88
- slug: "val-slug",
89
- name: "val-name",
90
- icon: VALID_URL,
91
- description: "val desc"
92
- };
93
- let doc = reducer(document, creators.updateProfile(initialState));
94
- // Now update only slug
95
- const partialInput = {
96
- slug: "new-slug"
97
- };
98
- doc = reducer(doc, creators.updateProfile(partialInput));
99
- // id is preserved and still valid PHID
100
- expect(doc.state.global.id).toBe(VALID_PHID);
101
- // slug should update
102
- expect(doc.state.global.slug).toBe("new-slug");
103
- });
104
- it("should throw if after a partial update the PHID is not valid", () => {
105
- // Start with bad PHID in state
106
- document.state.global.id = INVALID_PHID;
107
- const input = {
108
- slug: "doesnt-matter"
109
- };
110
- // Can't validate via reducer, so check with zod directly
111
- expect(() => z.BuilderProfileStateSchema().parse({
112
- ...document.state,
113
- ...input
114
- })).toThrow();
115
- });
116
- });
@@ -1,3 +0,0 @@
1
- import type { EditorModule } from "document-model";
2
- export declare const module: EditorModule;
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/builder-profile/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,eAAO,MAAM,MAAM,EAAE,YASpB,CAAC"}
@@ -1,11 +0,0 @@
1
- import Editor from "./editor.js";
2
- export const module = {
3
- Component: Editor,
4
- documentTypes: ["powerhouse/builder-profile"],
5
- config: {
6
- id: "builder-profile-editor",
7
- disableExternalControls: true,
8
- documentToolbarEnabled: true,
9
- showSwitchboardLink: true,
10
- },
11
- };
@@ -1,4 +0,0 @@
1
- import type { BuilderProfileDocument } from "../../document-models/builder-profile/index.js";
2
- export declare function useBuilderProfileDocument(documentId: string | null | undefined): never[] | [BuilderProfileDocument, import("@powerhousedao/reactor-browser").DocumentDispatch<import("../../document-models/builder-profile/gen/actions.js").UpdateProfileAction>];
3
- export declare function useSelectedBuilderProfileDocument(): never[] | [BuilderProfileDocument, import("@powerhousedao/reactor-browser").DocumentDispatch<import("../../document-models/builder-profile/gen/actions.js").UpdateProfileAction>];
4
- //# sourceMappingURL=useBuilderProfileDocument.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useBuilderProfileDocument.d.ts","sourceRoot":"","sources":["../../../editors/hooks/useBuilderProfileDocument.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,sBAAsB,EACvB,MAAM,gDAAgD,CAAC;AAExD,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,qLAMtC;AAED,wBAAgB,iCAAiC,sLAGhD"}
@@ -1,8 +0,0 @@
1
- import { useDocumentOfType, useSelectedDocumentId, } from "@powerhousedao/reactor-browser";
2
- export function useBuilderProfileDocument(documentId) {
3
- return useDocumentOfType(documentId, "powerhouse/builder-profile");
4
- }
5
- export function useSelectedBuilderProfileDocument() {
6
- const selectedDocumentId = useSelectedDocumentId();
7
- return useBuilderProfileDocument(selectedDocumentId);
8
- }