@powerhousedao/builder-profile 0.0.1

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 (107) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +179 -0
  3. package/dist/document-models/builder-profile/gen/actions.d.ts +4 -0
  4. package/dist/document-models/builder-profile/gen/actions.d.ts.map +1 -0
  5. package/dist/document-models/builder-profile/gen/actions.js +1 -0
  6. package/dist/document-models/builder-profile/gen/builder/actions.d.ts +8 -0
  7. package/dist/document-models/builder-profile/gen/builder/actions.d.ts.map +1 -0
  8. package/dist/document-models/builder-profile/gen/builder/actions.js +1 -0
  9. package/dist/document-models/builder-profile/gen/builder/creators.d.ts +4 -0
  10. package/dist/document-models/builder-profile/gen/builder/creators.d.ts.map +1 -0
  11. package/dist/document-models/builder-profile/gen/builder/creators.js +3 -0
  12. package/dist/document-models/builder-profile/gen/builder/error.d.ts +2 -0
  13. package/dist/document-models/builder-profile/gen/builder/error.d.ts.map +1 -0
  14. package/dist/document-models/builder-profile/gen/builder/error.js +1 -0
  15. package/dist/document-models/builder-profile/gen/builder/object.d.ts +7 -0
  16. package/dist/document-models/builder-profile/gen/builder/object.d.ts.map +1 -0
  17. package/dist/document-models/builder-profile/gen/builder/object.js +7 -0
  18. package/dist/document-models/builder-profile/gen/builder/operations.d.ts +7 -0
  19. package/dist/document-models/builder-profile/gen/builder/operations.d.ts.map +1 -0
  20. package/dist/document-models/builder-profile/gen/builder/operations.js +1 -0
  21. package/dist/document-models/builder-profile/gen/creators.d.ts +2 -0
  22. package/dist/document-models/builder-profile/gen/creators.d.ts.map +1 -0
  23. package/dist/document-models/builder-profile/gen/creators.js +1 -0
  24. package/dist/document-models/builder-profile/gen/document-model.d.ts +3 -0
  25. package/dist/document-models/builder-profile/gen/document-model.d.ts.map +1 -0
  26. package/dist/document-models/builder-profile/gen/document-model.js +48 -0
  27. package/dist/document-models/builder-profile/gen/index.d.ts +8 -0
  28. package/dist/document-models/builder-profile/gen/index.d.ts.map +1 -0
  29. package/dist/document-models/builder-profile/gen/index.js +6 -0
  30. package/dist/document-models/builder-profile/gen/object.d.ts +15 -0
  31. package/dist/document-models/builder-profile/gen/object.d.ts.map +1 -0
  32. package/dist/document-models/builder-profile/gen/object.js +25 -0
  33. package/dist/document-models/builder-profile/gen/ph-factories.d.ts +27 -0
  34. package/dist/document-models/builder-profile/gen/ph-factories.d.ts.map +1 -0
  35. package/dist/document-models/builder-profile/gen/ph-factories.js +54 -0
  36. package/dist/document-models/builder-profile/gen/reducer.d.ts +5 -0
  37. package/dist/document-models/builder-profile/gen/reducer.d.ts.map +1 -0
  38. package/dist/document-models/builder-profile/gen/reducer.js +20 -0
  39. package/dist/document-models/builder-profile/gen/schema/index.d.ts +3 -0
  40. package/dist/document-models/builder-profile/gen/schema/index.d.ts.map +1 -0
  41. package/dist/document-models/builder-profile/gen/schema/index.js +2 -0
  42. package/dist/document-models/builder-profile/gen/schema/types.d.ts +151 -0
  43. package/dist/document-models/builder-profile/gen/schema/types.d.ts.map +1 -0
  44. package/dist/document-models/builder-profile/gen/schema/types.js +1 -0
  45. package/dist/document-models/builder-profile/gen/schema/zod.d.ts +12 -0
  46. package/dist/document-models/builder-profile/gen/schema/zod.d.ts.map +1 -0
  47. package/dist/document-models/builder-profile/gen/schema/zod.js +24 -0
  48. package/dist/document-models/builder-profile/gen/types.d.ts +10 -0
  49. package/dist/document-models/builder-profile/gen/types.d.ts.map +1 -0
  50. package/dist/document-models/builder-profile/gen/types.js +1 -0
  51. package/dist/document-models/builder-profile/gen/utils.d.ts +22 -0
  52. package/dist/document-models/builder-profile/gen/utils.d.ts.map +1 -0
  53. package/dist/document-models/builder-profile/gen/utils.js +46 -0
  54. package/dist/document-models/builder-profile/index.d.ts +25 -0
  55. package/dist/document-models/builder-profile/index.d.ts.map +1 -0
  56. package/dist/document-models/builder-profile/index.js +21 -0
  57. package/dist/document-models/builder-profile/src/reducers/builder.d.ts +3 -0
  58. package/dist/document-models/builder-profile/src/reducers/builder.d.ts.map +1 -0
  59. package/dist/document-models/builder-profile/src/reducers/builder.js +9 -0
  60. package/dist/document-models/builder-profile/src/tests/builder.test.d.ts +2 -0
  61. package/dist/document-models/builder-profile/src/tests/builder.test.d.ts.map +1 -0
  62. package/dist/document-models/builder-profile/src/tests/builder.test.js +116 -0
  63. package/dist/document-models/builder-profile/src/tests/document-model.test.d.ts +6 -0
  64. package/dist/document-models/builder-profile/src/tests/document-model.test.d.ts.map +1 -0
  65. package/dist/document-models/builder-profile/src/tests/document-model.test.js +18 -0
  66. package/dist/document-models/builder-profile/src/utils.d.ts +2 -0
  67. package/dist/document-models/builder-profile/src/utils.d.ts.map +1 -0
  68. package/dist/document-models/builder-profile/src/utils.js +1 -0
  69. package/dist/document-models/index.d.ts +3 -0
  70. package/dist/document-models/index.d.ts.map +1 -0
  71. package/dist/document-models/index.js +1 -0
  72. package/dist/editors/builder-profile/editor.d.ts +4 -0
  73. package/dist/editors/builder-profile/editor.d.ts.map +1 -0
  74. package/dist/editors/builder-profile/editor.js +131 -0
  75. package/dist/editors/builder-profile/index.d.ts +3 -0
  76. package/dist/editors/builder-profile/index.d.ts.map +1 -0
  77. package/dist/editors/builder-profile/index.js +11 -0
  78. package/dist/editors/hooks/useBuilderProfileDocument.d.ts +4 -0
  79. package/dist/editors/hooks/useBuilderProfileDocument.d.ts.map +1 -0
  80. package/dist/editors/hooks/useBuilderProfileDocument.js +8 -0
  81. package/dist/editors/index.d.ts +3 -0
  82. package/dist/editors/index.d.ts.map +1 -0
  83. package/dist/editors/index.js +1 -0
  84. package/dist/index.d.ts +5 -0
  85. package/dist/index.d.ts.map +1 -0
  86. package/dist/index.js +6 -0
  87. package/dist/powerhouse.manifest.json +27 -0
  88. package/dist/processors/index.d.ts +2 -0
  89. package/dist/processors/index.d.ts.map +1 -0
  90. package/dist/processors/index.js +1 -0
  91. package/dist/style.css +5604 -0
  92. package/dist/subgraphs/builder-profile/index.d.ts +11 -0
  93. package/dist/subgraphs/builder-profile/index.d.ts.map +1 -0
  94. package/dist/subgraphs/builder-profile/index.js +11 -0
  95. package/dist/subgraphs/builder-profile/resolvers.d.ts +3 -0
  96. package/dist/subgraphs/builder-profile/resolvers.d.ts.map +1 -0
  97. package/dist/subgraphs/builder-profile/resolvers.js +84 -0
  98. package/dist/subgraphs/builder-profile/schema.d.ts +3 -0
  99. package/dist/subgraphs/builder-profile/schema.d.ts.map +1 -0
  100. package/dist/subgraphs/builder-profile/schema.js +49 -0
  101. package/dist/subgraphs/index.d.ts +3 -0
  102. package/dist/subgraphs/index.d.ts.map +1 -0
  103. package/dist/subgraphs/index.js +1 -0
  104. package/dist/vitest.config.d.ts +3 -0
  105. package/dist/vitest.config.d.ts.map +1 -0
  106. package/dist/vitest.config.js +8 -0
  107. package/package.json +102 -0
@@ -0,0 +1,11 @@
1
+ import { Subgraph } from "@powerhousedao/reactor-api";
2
+ import type { DocumentNode } from "graphql";
3
+ export declare class BuilderProfileSubgraph extends Subgraph {
4
+ name: string;
5
+ typeDefs: DocumentNode;
6
+ resolvers: Record<string, unknown>;
7
+ additionalContextFields: {};
8
+ onSetup(): Promise<void>;
9
+ onDisconnect(): Promise<void>;
10
+ }
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../subgraphs/builder-profile/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAI5C,qBAAa,sBAAuB,SAAQ,QAAQ;IAClD,IAAI,SAAqB;IACzB,QAAQ,EAAE,YAAY,CAAU;IAChC,SAAS,0BAAsB;IAC/B,uBAAuB,KAAM;IACvB,OAAO;IACP,YAAY;CACnB"}
@@ -0,0 +1,11 @@
1
+ import { Subgraph } from "@powerhousedao/reactor-api";
2
+ import { schema } from "./schema.js";
3
+ import { getResolvers } from "./resolvers.js";
4
+ export class BuilderProfileSubgraph extends Subgraph {
5
+ name = "builder-profile";
6
+ typeDefs = schema;
7
+ resolvers = getResolvers(this);
8
+ additionalContextFields = {};
9
+ async onSetup() { }
10
+ async onDisconnect() { }
11
+ }
@@ -0,0 +1,3 @@
1
+ import { type Subgraph } from "@powerhousedao/reactor-api";
2
+ export declare const getResolvers: (subgraph: Subgraph) => Record<string, unknown>;
3
+ //# sourceMappingURL=resolvers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/builder-profile/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAS3D,eAAO,MAAM,YAAY,GAAI,UAAU,QAAQ,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAkHvE,CAAC"}
@@ -0,0 +1,84 @@
1
+ import { addFile } from "document-drive";
2
+ import { actions, } from "../../document-models/builder-profile/index.js";
3
+ import { setName } from "document-model";
4
+ export const getResolvers = (subgraph) => {
5
+ const reactor = subgraph.reactor;
6
+ return {
7
+ Query: {
8
+ BuilderProfile: async () => {
9
+ return {
10
+ getDocument: async (args) => {
11
+ const { docId, driveId } = args;
12
+ if (!docId) {
13
+ throw new Error("Document id is required");
14
+ }
15
+ if (driveId) {
16
+ const docIds = await reactor.getDocuments(driveId);
17
+ if (!docIds.includes(docId)) {
18
+ throw new Error(`Document with id ${docId} is not part of ${driveId}`);
19
+ }
20
+ }
21
+ const doc = await reactor.getDocument(docId);
22
+ return {
23
+ driveId: driveId,
24
+ ...doc,
25
+ ...doc.header,
26
+ created: doc.header.createdAtUtcIso,
27
+ lastModified: doc.header.lastModifiedAtUtcIso,
28
+ state: doc.state.global,
29
+ stateJSON: doc.state.global,
30
+ revision: doc.header?.revision?.global ?? 0,
31
+ };
32
+ },
33
+ getDocuments: async (args) => {
34
+ const { driveId } = args;
35
+ const docsIds = await reactor.getDocuments(driveId);
36
+ const docs = await Promise.all(docsIds.map(async (docId) => {
37
+ const doc = await reactor.getDocument(docId);
38
+ return {
39
+ driveId: driveId,
40
+ ...doc,
41
+ ...doc.header,
42
+ created: doc.header.createdAtUtcIso,
43
+ lastModified: doc.header.lastModifiedAtUtcIso,
44
+ state: doc.state.global,
45
+ stateJSON: doc.state.global,
46
+ revision: doc.header?.revision?.global ?? 0,
47
+ };
48
+ }));
49
+ return docs.filter((doc) => doc.header.documentType === "powerhouse/builder-profile");
50
+ },
51
+ };
52
+ },
53
+ },
54
+ Mutation: {
55
+ BuilderProfile_createDocument: async (_, args) => {
56
+ const { driveId, name } = args;
57
+ const document = await reactor.addDocument("powerhouse/builder-profile");
58
+ if (driveId) {
59
+ await reactor.addAction(driveId, addFile({
60
+ name,
61
+ id: document.header.id,
62
+ documentType: "powerhouse/builder-profile",
63
+ }));
64
+ }
65
+ if (name) {
66
+ await reactor.addAction(document.header.id, setName(name));
67
+ }
68
+ return document.header.id;
69
+ },
70
+ BuilderProfile_updateProfile: async (_, args) => {
71
+ const { docId, input } = args;
72
+ const doc = await reactor.getDocument(docId);
73
+ if (!doc) {
74
+ throw new Error("Document not found");
75
+ }
76
+ const result = await reactor.addAction(docId, actions.updateProfile(input));
77
+ if (result.status !== "SUCCESS") {
78
+ throw new Error(result.error?.message ?? "Failed to updateProfile");
79
+ }
80
+ return true;
81
+ },
82
+ },
83
+ };
84
+ };
@@ -0,0 +1,3 @@
1
+ import type { DocumentNode } from "graphql";
2
+ export declare const schema: DocumentNode;
3
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../subgraphs/builder-profile/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,YA+CpB,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { gql } from "graphql-tag";
2
+ export const schema = gql `
3
+ """
4
+ Subgraph definition for BuilderProfile (powerhouse/builder-profile)
5
+ """
6
+ type BuilderProfileState {
7
+ id: PHID
8
+ slug: String
9
+ name: String
10
+ icon: URL
11
+ description: String
12
+ }
13
+
14
+ """
15
+ Queries: BuilderProfile
16
+ """
17
+ type BuilderProfileQueries {
18
+ getDocument(docId: PHID!, driveId: PHID): BuilderProfile
19
+ getDocuments(driveId: String!): [BuilderProfile!]
20
+ }
21
+
22
+ type Query {
23
+ BuilderProfile: BuilderProfileQueries
24
+ }
25
+
26
+ """
27
+ Mutations: BuilderProfile
28
+ """
29
+ type Mutation {
30
+ BuilderProfile_createDocument(name: String!, driveId: String): String
31
+
32
+ BuilderProfile_updateProfile(
33
+ driveId: String
34
+ docId: PHID
35
+ input: BuilderProfile_UpdateProfileInput
36
+ ): Int
37
+ }
38
+
39
+ """
40
+ Module: Builder
41
+ """
42
+ input BuilderProfile_UpdateProfileInput {
43
+ id: PHID
44
+ slug: String
45
+ name: String
46
+ icon: URL
47
+ description: String
48
+ }
49
+ `;
@@ -0,0 +1,3 @@
1
+ export {};
2
+ export * as BuilderProfileSubgraph from "./builder-profile/index.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../subgraphs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AACV,OAAO,KAAK,sBAAsB,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1 @@
1
+ export * as BuilderProfileSubgraph from "./builder-profile/index.js";
@@ -0,0 +1,3 @@
1
+ declare const _default: import("vite").UserConfig;
2
+ export default _default;
3
+ //# sourceMappingURL=vitest.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["../vitest.config.ts"],"names":[],"mappings":";AAGA,wBAKG"}
@@ -0,0 +1,8 @@
1
+ import { defineConfig } from "vitest/config";
2
+ import react from "@vitejs/plugin-react";
3
+ export default defineConfig({
4
+ test: {
5
+ globals: true,
6
+ },
7
+ plugins: [react()],
8
+ });
package/package.json ADDED
@@ -0,0 +1,102 @@
1
+ {
2
+ "name": "@powerhousedao/builder-profile",
3
+ "description": "Builder profile document model",
4
+ "version": "0.0.1",
5
+ "license": "AGPL-3.0-only",
6
+ "type": "module",
7
+ "files": [
8
+ "/dist"
9
+ ],
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.js"
17
+ },
18
+ "./document-models": {
19
+ "types": "./dist/document-models/index.d.ts",
20
+ "default": "./dist/document-models/index.js"
21
+ },
22
+ "./editors": {
23
+ "types": "./dist/editors/index.d.ts",
24
+ "default": "./dist/editors/index.js"
25
+ },
26
+ "./subgraphs": {
27
+ "types": "./dist/subgraphs/index.d.ts",
28
+ "default": "./dist/subgraphs/index.js"
29
+ },
30
+ "./processors": {
31
+ "types": "./dist/processors/index.d.ts",
32
+ "default": "./dist/processors/index.js"
33
+ },
34
+ "./manifest": {
35
+ "types": "./dist/manifest.d.ts",
36
+ "default": "./dist/manifest.js"
37
+ },
38
+ "./style.css": "./dist/style.css"
39
+ },
40
+ "scripts": {
41
+ "lint": "eslint .",
42
+ "build:tsc": "tsc",
43
+ "build:tsc:watch": "tsc --watch",
44
+ "build:css": "npx @tailwindcss/cli -i ./style.css -o ./dist/style.css",
45
+ "build:css:watch": "npx @tailwindcss/cli -i ./style.css -o ./dist/style.css --watch",
46
+ "build": "npm run build:tsc && npm run build:css",
47
+ "test": "vitest run",
48
+ "test:watch": "vitest",
49
+ "prepublishOnly": "npm run build",
50
+ "generate": "ph-cli generate",
51
+ "connect": "ph-cli connect",
52
+ "reactor": "ph-cli reactor",
53
+ "service": "ph-cli service",
54
+ "service-startup": "bash ./node_modules/@powerhousedao/ph-cli/dist/scripts/service-startup.sh",
55
+ "service-unstartup": "bash ./node_modules/@powerhousedao/ph-cli/dist/scripts/service-unstartup.sh"
56
+ },
57
+ "dependencies": {
58
+ "@powerhousedao/builder-tools": "^5.0.0-staging.25",
59
+ "@powerhousedao/common": "^5.0.0-staging.25",
60
+ "@powerhousedao/design-system": "^5.0.0-staging.25",
61
+ "document-model": "^5.0.0-staging.25",
62
+ "error": "^10.4.0",
63
+ "graphql": "^16.10.0",
64
+ "graphql-tag": "^2.12.6",
65
+ "zod": "^3.24.2"
66
+ },
67
+ "devDependencies": {
68
+ "@electric-sql/pglite": "^0.2.12",
69
+ "@eslint/js": "^9.25.0",
70
+ "@powerhousedao/analytics-engine-core": "^0.5.0",
71
+ "@powerhousedao/codegen": "^5.0.0-staging.25",
72
+ "@powerhousedao/ph-cli": "^5.0.0-staging.25",
73
+ "@powerhousedao/reactor-api": "^5.0.0-staging.25",
74
+ "@powerhousedao/reactor-browser": "^5.0.0-staging.25",
75
+ "@powerhousedao/reactor-local": "^5.0.0-staging.25",
76
+ "@powerhousedao/scalars": "latest",
77
+ "@powerhousedao/switchboard": "^5.0.0-staging.25",
78
+ "@tailwindcss/cli": "^4.1.4",
79
+ "@testing-library/react": "^16.3.0",
80
+ "@types/node": "^22.14.1",
81
+ "@types/react": "^18.3.20",
82
+ "@vitejs/plugin-react": "^4.4.1",
83
+ "document-drive": "^5.0.0-staging.25",
84
+ "eslint": "^9.25.0",
85
+ "eslint-plugin-react": "^7.37.5",
86
+ "eslint-plugin-react-hooks": "^5.2.0",
87
+ "globals": "^16.0.0",
88
+ "package-manager-detector": "^0.2.8",
89
+ "pm2": "^5.4.3",
90
+ "react": "^18.3.1",
91
+ "react-dom": "^18.3.1",
92
+ "tailwindcss": "^4.1.4",
93
+ "typescript": "^5.8.3",
94
+ "typescript-eslint": "^8.30.1",
95
+ "vite": "^6.2.3",
96
+ "vitest": "^3.0.9"
97
+ },
98
+ "peerDependencies": {
99
+ "react": "^18.3.1",
100
+ "react-dom": "^18.3.1"
101
+ }
102
+ }