@powerhousedao/network-admin 0.0.25 → 0.0.26

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 (90) hide show
  1. package/dist/document-models/builder-profile/gen/actions.d.ts +4 -0
  2. package/dist/document-models/builder-profile/gen/actions.d.ts.map +1 -0
  3. package/dist/document-models/builder-profile/gen/actions.js +1 -0
  4. package/dist/document-models/builder-profile/gen/builder/actions.d.ts +8 -0
  5. package/dist/document-models/builder-profile/gen/builder/actions.d.ts.map +1 -0
  6. package/dist/document-models/builder-profile/gen/builder/actions.js +1 -0
  7. package/dist/document-models/builder-profile/gen/builder/creators.d.ts +4 -0
  8. package/dist/document-models/builder-profile/gen/builder/creators.d.ts.map +1 -0
  9. package/dist/document-models/builder-profile/gen/builder/creators.js +3 -0
  10. package/dist/document-models/builder-profile/gen/builder/error.d.ts +2 -0
  11. package/dist/document-models/builder-profile/gen/builder/error.d.ts.map +1 -0
  12. package/dist/document-models/builder-profile/gen/builder/error.js +1 -0
  13. package/dist/document-models/builder-profile/gen/builder/object.d.ts +7 -0
  14. package/dist/document-models/builder-profile/gen/builder/object.d.ts.map +1 -0
  15. package/dist/document-models/builder-profile/gen/builder/object.js +7 -0
  16. package/dist/document-models/builder-profile/gen/builder/operations.d.ts +7 -0
  17. package/dist/document-models/builder-profile/gen/builder/operations.d.ts.map +1 -0
  18. package/dist/document-models/builder-profile/gen/builder/operations.js +1 -0
  19. package/dist/document-models/builder-profile/gen/creators.d.ts +2 -0
  20. package/dist/document-models/builder-profile/gen/creators.d.ts.map +1 -0
  21. package/dist/document-models/builder-profile/gen/creators.js +1 -0
  22. package/dist/document-models/builder-profile/gen/document-model.d.ts +3 -0
  23. package/dist/document-models/builder-profile/gen/document-model.d.ts.map +1 -0
  24. package/dist/document-models/builder-profile/gen/document-model.js +48 -0
  25. package/dist/document-models/builder-profile/gen/index.d.ts +8 -0
  26. package/dist/document-models/builder-profile/gen/index.d.ts.map +1 -0
  27. package/dist/document-models/builder-profile/gen/index.js +6 -0
  28. package/dist/document-models/builder-profile/gen/object.d.ts +15 -0
  29. package/dist/document-models/builder-profile/gen/object.d.ts.map +1 -0
  30. package/dist/document-models/builder-profile/gen/object.js +25 -0
  31. package/dist/document-models/builder-profile/gen/ph-factories.d.ts +27 -0
  32. package/dist/document-models/builder-profile/gen/ph-factories.d.ts.map +1 -0
  33. package/dist/document-models/builder-profile/gen/ph-factories.js +54 -0
  34. package/dist/document-models/builder-profile/gen/reducer.d.ts +5 -0
  35. package/dist/document-models/builder-profile/gen/reducer.d.ts.map +1 -0
  36. package/dist/document-models/builder-profile/gen/reducer.js +20 -0
  37. package/dist/document-models/builder-profile/gen/schema/index.d.ts +3 -0
  38. package/dist/document-models/builder-profile/gen/schema/index.d.ts.map +1 -0
  39. package/dist/document-models/builder-profile/gen/schema/index.js +2 -0
  40. package/dist/document-models/builder-profile/gen/schema/types.d.ts +151 -0
  41. package/dist/document-models/builder-profile/gen/schema/types.d.ts.map +1 -0
  42. package/dist/document-models/builder-profile/gen/schema/types.js +1 -0
  43. package/dist/document-models/builder-profile/gen/schema/zod.d.ts +12 -0
  44. package/dist/document-models/builder-profile/gen/schema/zod.d.ts.map +1 -0
  45. package/dist/document-models/builder-profile/gen/schema/zod.js +24 -0
  46. package/dist/document-models/builder-profile/gen/types.d.ts +10 -0
  47. package/dist/document-models/builder-profile/gen/types.d.ts.map +1 -0
  48. package/dist/document-models/builder-profile/gen/types.js +1 -0
  49. package/dist/document-models/builder-profile/gen/utils.d.ts +22 -0
  50. package/dist/document-models/builder-profile/gen/utils.d.ts.map +1 -0
  51. package/dist/document-models/builder-profile/gen/utils.js +46 -0
  52. package/dist/document-models/builder-profile/index.d.ts +25 -0
  53. package/dist/document-models/builder-profile/index.d.ts.map +1 -0
  54. package/dist/document-models/builder-profile/index.js +21 -0
  55. package/dist/document-models/builder-profile/src/reducers/builder.d.ts +3 -0
  56. package/dist/document-models/builder-profile/src/reducers/builder.d.ts.map +1 -0
  57. package/dist/document-models/builder-profile/src/reducers/builder.js +9 -0
  58. package/dist/document-models/builder-profile/src/tests/builder.test.d.ts +2 -0
  59. package/dist/document-models/builder-profile/src/tests/builder.test.d.ts.map +1 -0
  60. package/dist/document-models/builder-profile/src/tests/builder.test.js +116 -0
  61. package/dist/document-models/builder-profile/src/tests/document-model.test.d.ts +6 -0
  62. package/dist/document-models/builder-profile/src/tests/document-model.test.d.ts.map +1 -0
  63. package/dist/document-models/builder-profile/src/tests/document-model.test.js +18 -0
  64. package/dist/document-models/builder-profile/src/utils.d.ts +2 -0
  65. package/dist/document-models/builder-profile/src/utils.d.ts.map +1 -0
  66. package/dist/document-models/builder-profile/src/utils.js +1 -0
  67. package/dist/document-models/index.d.ts.map +1 -1
  68. package/dist/editors/builder-profile/editor.d.ts +4 -0
  69. package/dist/editors/builder-profile/editor.d.ts.map +1 -0
  70. package/dist/editors/builder-profile/editor.js +101 -0
  71. package/dist/editors/builder-profile/index.d.ts +3 -0
  72. package/dist/editors/builder-profile/index.d.ts.map +1 -0
  73. package/dist/editors/builder-profile/index.js +11 -0
  74. package/dist/editors/hooks/useBuilderProfileDocument.d.ts +3 -0
  75. package/dist/editors/hooks/useBuilderProfileDocument.d.ts.map +1 -0
  76. package/dist/editors/hooks/useBuilderProfileDocument.js +8 -0
  77. package/dist/editors/index.d.ts.map +1 -1
  78. package/dist/powerhouse.manifest.json +7 -3
  79. package/dist/style.css +5371 -0
  80. package/dist/subgraphs/builder-profile/index.d.ts +11 -0
  81. package/dist/subgraphs/builder-profile/index.d.ts.map +1 -0
  82. package/dist/subgraphs/builder-profile/index.js +11 -0
  83. package/dist/subgraphs/builder-profile/resolvers.d.ts +3 -0
  84. package/dist/subgraphs/builder-profile/resolvers.d.ts.map +1 -0
  85. package/dist/subgraphs/builder-profile/resolvers.js +84 -0
  86. package/dist/subgraphs/builder-profile/schema.d.ts +3 -0
  87. package/dist/subgraphs/builder-profile/schema.d.ts.map +1 -0
  88. package/dist/subgraphs/builder-profile/schema.js +49 -0
  89. package/dist/subgraphs/index.d.ts.map +1 -1
  90. package/package.json +2 -1
@@ -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
+ `;
@@ -1 +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;AACrE,OAAO,KAAK,oBAAoB,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,2BAA2B,MAAM,kCAAkC,CAAC;AAChF,OAAO,KAAK,kBAAkB,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../subgraphs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAG,CAAC;AACX,OAAO,KAAK,sBAAsB,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,oBAAoB,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,2BAA2B,MAAM,kCAAkC,CAAC;AAChF,OAAO,KAAK,kBAAkB,MAAM,uBAAuB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@powerhousedao/network-admin",
3
3
  "description": "Network Admin package for Powerhouse",
4
- "version": "0.0.25",
4
+ "version": "0.0.26",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
7
7
  "files": [
@@ -55,6 +55,7 @@
55
55
  "service-unstartup": "bash ./node_modules/@powerhousedao/ph-cli/dist/scripts/service-unstartup.sh"
56
56
  },
57
57
  "dependencies": {
58
+ "@powerhousedao/builder-profile": "^0.0.1",
58
59
  "@powerhousedao/builder-tools": "^5.0.0-staging.22",
59
60
  "@powerhousedao/common": "^5.0.0-staging.22",
60
61
  "@powerhousedao/design-system": "^5.0.0-staging.22",