@powerhousedao/builder-profile 0.0.13 → 0.0.14

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.
@@ -1,2 +1,2 @@
1
- export * as BuilderProfileSubgraph from "./builder-profile/index.js";
1
+ export {};
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../subgraphs/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,sBAAsB,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../subgraphs/index.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- export * as BuilderProfileSubgraph from "./builder-profile/index.js";
1
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@powerhousedao/builder-profile",
3
3
  "description": "Builder profile document model",
4
- "version": "0.0.13",
4
+ "version": "0.0.14",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
7
7
  "files": [
@@ -1,11 +0,0 @@
1
- import { BaseSubgraph } from "@powerhousedao/reactor-api";
2
- import type { DocumentNode } from "graphql";
3
- export declare class BuilderProfileSubgraph extends BaseSubgraph {
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../subgraphs/builder-profile/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAI5C,qBAAa,sBAAuB,SAAQ,YAAY;IACtD,IAAI,SAAqB;IACzB,QAAQ,EAAE,YAAY,CAAU;IAChC,SAAS,0BAAsB;IAC/B,uBAAuB,KAAM;IACvB,OAAO;IACP,YAAY;CACnB"}
@@ -1,11 +0,0 @@
1
- import { BaseSubgraph } from "@powerhousedao/reactor-api";
2
- import { schema } from "./schema.js";
3
- import { getResolvers } from "./resolvers.js";
4
- export class BuilderProfileSubgraph extends BaseSubgraph {
5
- name = "builder-profile";
6
- typeDefs = schema;
7
- resolvers = getResolvers(this);
8
- additionalContextFields = {};
9
- async onSetup() { }
10
- async onDisconnect() { }
11
- }
@@ -1,3 +0,0 @@
1
- import type { BaseSubgraph } from "@powerhousedao/reactor-api";
2
- export declare const getResolvers: (subgraph: BaseSubgraph) => Record<string, unknown>;
3
- //# sourceMappingURL=resolvers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/builder-profile/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAuB/D,eAAO,MAAM,YAAY,GACvB,UAAU,YAAY,KACrB,MAAM,CAAC,MAAM,EAAE,OAAO,CAkUxB,CAAC"}
@@ -1,204 +0,0 @@
1
- import { addFile } from "document-drive";
2
- import { setName } from "document-model";
3
- import { actions, builderProfileDocumentType, } from "@powerhousedao/builder-profile/document-models/builder-profile";
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 === builderProfileDocumentType);
50
- },
51
- };
52
- },
53
- },
54
- Mutation: {
55
- BuilderProfile_createDocument: async (_, args) => {
56
- const { driveId, name } = args;
57
- const document = await reactor.addDocument(builderProfileDocumentType);
58
- if (driveId) {
59
- await reactor.addAction(driveId, addFile({
60
- name,
61
- id: document.header.id,
62
- documentType: builderProfileDocumentType,
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
- BuilderProfile_addSkill: async (_, args) => {
83
- const { docId, input } = args;
84
- const doc = await reactor.getDocument(docId);
85
- if (!doc) {
86
- throw new Error("Document not found");
87
- }
88
- const result = await reactor.addAction(docId, actions.addSkill(input));
89
- if (result.status !== "SUCCESS") {
90
- throw new Error(result.error?.message ?? "Failed to addSkill");
91
- }
92
- return true;
93
- },
94
- BuilderProfile_removeSkill: async (_, args) => {
95
- const { docId, input } = args;
96
- const doc = await reactor.getDocument(docId);
97
- if (!doc) {
98
- throw new Error("Document not found");
99
- }
100
- const result = await reactor.addAction(docId, actions.removeSkill(input));
101
- if (result.status !== "SUCCESS") {
102
- throw new Error(result.error?.message ?? "Failed to removeSkill");
103
- }
104
- return true;
105
- },
106
- BuilderProfile_addScope: async (_, args) => {
107
- const { docId, input } = args;
108
- const doc = await reactor.getDocument(docId);
109
- if (!doc) {
110
- throw new Error("Document not found");
111
- }
112
- const result = await reactor.addAction(docId, actions.addScope(input));
113
- if (result.status !== "SUCCESS") {
114
- throw new Error(result.error?.message ?? "Failed to addScope");
115
- }
116
- return true;
117
- },
118
- BuilderProfile_removeScope: async (_, args) => {
119
- const { docId, input } = args;
120
- const doc = await reactor.getDocument(docId);
121
- if (!doc) {
122
- throw new Error("Document not found");
123
- }
124
- const result = await reactor.addAction(docId, actions.removeScope(input));
125
- if (result.status !== "SUCCESS") {
126
- throw new Error(result.error?.message ?? "Failed to removeScope");
127
- }
128
- return true;
129
- },
130
- BuilderProfile_addLink: async (_, args) => {
131
- const { docId, input } = args;
132
- const doc = await reactor.getDocument(docId);
133
- if (!doc) {
134
- throw new Error("Document not found");
135
- }
136
- const result = await reactor.addAction(docId, actions.addLink(input));
137
- if (result.status !== "SUCCESS") {
138
- throw new Error(result.error?.message ?? "Failed to addLink");
139
- }
140
- return true;
141
- },
142
- BuilderProfile_editLink: async (_, args) => {
143
- const { docId, input } = args;
144
- const doc = await reactor.getDocument(docId);
145
- if (!doc) {
146
- throw new Error("Document not found");
147
- }
148
- const result = await reactor.addAction(docId, actions.editLink(input));
149
- if (result.status !== "SUCCESS") {
150
- throw new Error(result.error?.message ?? "Failed to editLink");
151
- }
152
- return true;
153
- },
154
- BuilderProfile_removeLink: async (_, args) => {
155
- const { docId, input } = args;
156
- const doc = await reactor.getDocument(docId);
157
- if (!doc) {
158
- throw new Error("Document not found");
159
- }
160
- const result = await reactor.addAction(docId, actions.removeLink(input));
161
- if (result.status !== "SUCCESS") {
162
- throw new Error(result.error?.message ?? "Failed to removeLink");
163
- }
164
- return true;
165
- },
166
- BuilderProfile_addContributor: async (_, args) => {
167
- const { docId, input } = args;
168
- const doc = await reactor.getDocument(docId);
169
- if (!doc) {
170
- throw new Error("Document not found");
171
- }
172
- const result = await reactor.addAction(docId, actions.addContributor(input));
173
- if (result.status !== "SUCCESS") {
174
- throw new Error(result.error?.message ?? "Failed to addContributor");
175
- }
176
- return true;
177
- },
178
- BuilderProfile_removeContributor: async (_, args) => {
179
- const { docId, input } = args;
180
- const doc = await reactor.getDocument(docId);
181
- if (!doc) {
182
- throw new Error("Document not found");
183
- }
184
- const result = await reactor.addAction(docId, actions.removeContributor(input));
185
- if (result.status !== "SUCCESS") {
186
- throw new Error(result.error?.message ?? "Failed to removeContributor");
187
- }
188
- return true;
189
- },
190
- BuilderProfile_setOperator: async (_, args) => {
191
- const { docId, input } = args;
192
- const doc = await reactor.getDocument(docId);
193
- if (!doc) {
194
- throw new Error("Document not found");
195
- }
196
- const result = await reactor.addAction(docId, actions.setOperator(input));
197
- if (result.status !== "SUCCESS") {
198
- throw new Error(result.error?.message ?? "Failed to setOperator");
199
- }
200
- return true;
201
- },
202
- },
203
- };
204
- };
@@ -1,3 +0,0 @@
1
- import type { DocumentNode } from "graphql";
2
- export declare const schema: DocumentNode;
3
- //# sourceMappingURL=schema.d.ts.map
@@ -1 +0,0 @@
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+HpB,CAAC"}
@@ -1,129 +0,0 @@
1
- import { gql } from "graphql-tag";
2
- export const schema = gql `
3
- """
4
- Queries: BuilderProfile Document
5
- """
6
- type BuilderProfileQueries {
7
- getDocument(docId: PHID!, driveId: PHID): BuilderProfile
8
- getDocuments(driveId: String!): [BuilderProfile!]
9
- }
10
-
11
- type Query {
12
- BuilderProfile: BuilderProfileQueries
13
- }
14
-
15
- """
16
- Mutations: BuilderProfile
17
- """
18
- type Mutation {
19
- BuilderProfile_createDocument(name: String!, driveId: String): String
20
-
21
- BuilderProfile_updateProfile(
22
- driveId: String
23
- docId: PHID
24
- input: BuilderProfile_UpdateProfileInput
25
- ): Int
26
- BuilderProfile_addSkill(
27
- driveId: String
28
- docId: PHID
29
- input: BuilderProfile_AddSkillInput
30
- ): Int
31
- BuilderProfile_removeSkill(
32
- driveId: String
33
- docId: PHID
34
- input: BuilderProfile_RemoveSkillInput
35
- ): Int
36
- BuilderProfile_addScope(
37
- driveId: String
38
- docId: PHID
39
- input: BuilderProfile_AddScopeInput
40
- ): Int
41
- BuilderProfile_removeScope(
42
- driveId: String
43
- docId: PHID
44
- input: BuilderProfile_RemoveScopeInput
45
- ): Int
46
- BuilderProfile_addLink(
47
- driveId: String
48
- docId: PHID
49
- input: BuilderProfile_AddLinkInput
50
- ): Int
51
- BuilderProfile_editLink(
52
- driveId: String
53
- docId: PHID
54
- input: BuilderProfile_EditLinkInput
55
- ): Int
56
- BuilderProfile_removeLink(
57
- driveId: String
58
- docId: PHID
59
- input: BuilderProfile_RemoveLinkInput
60
- ): Int
61
- BuilderProfile_addContributor(
62
- driveId: String
63
- docId: PHID
64
- input: BuilderProfile_AddContributorInput
65
- ): Int
66
- BuilderProfile_removeContributor(
67
- driveId: String
68
- docId: PHID
69
- input: BuilderProfile_RemoveContributorInput
70
- ): Int
71
- BuilderProfile_setOperator(
72
- driveId: String
73
- docId: PHID
74
- input: BuilderProfile_SetOperatorInput
75
- ): Int
76
- }
77
-
78
- """
79
- Module: Builders
80
- """
81
- input BuilderProfile_UpdateProfileInput {
82
- id: PHID
83
- code: String
84
- slug: String
85
- name: String
86
- icon: URL
87
- description: String
88
- about: String
89
- status: BuilderProfile_BuilderStatusInput
90
- }
91
-
92
- input BuilderProfile_AddSkillInput {
93
- skill: BuilderProfile_BuilderSkillInput
94
- }
95
-
96
- input BuilderProfile_RemoveSkillInput {
97
- skill: BuilderProfile_BuilderSkillInput
98
- }
99
-
100
- input BuilderProfile_AddScopeInput {
101
- scope: BuilderProfile_BuilderScopeInput
102
- }
103
-
104
- input BuilderProfile_RemoveScopeInput {
105
- scope: BuilderProfile_BuilderScopeInput
106
- }
107
- input BuilderProfile_AddLinkInput {
108
- id: OID!
109
- url: URL!
110
- label: String
111
- }
112
- input BuilderProfile_EditLinkInput {
113
- id: OID!
114
- url: URL!
115
- label: String
116
- }
117
- input BuilderProfile_RemoveLinkInput {
118
- id: OID!
119
- }
120
- input BuilderProfile_AddContributorInput {
121
- contributorPHID: PHID!
122
- }
123
- input BuilderProfile_RemoveContributorInput {
124
- contributorPHID: PHID!
125
- }
126
- input BuilderProfile_SetOperatorInput {
127
- isOperator: Boolean!
128
- }
129
- `;