@powerhousedao/reactor-api 1.2.1 → 1.2.2
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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/reactor-api",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -16,23 +16,24 @@
|
|
|
16
16
|
"@types/body-parser": "^1.19.5",
|
|
17
17
|
"@types/cors": "^2.8.17",
|
|
18
18
|
"@types/express": "^5.0.0",
|
|
19
|
-
"document-drive": "1.2.
|
|
20
|
-
"document-model": "2.4.
|
|
19
|
+
"document-drive": "^1.2.2",
|
|
20
|
+
"document-model": "^2.4.1",
|
|
21
21
|
"esbuild": "^0.24.0",
|
|
22
22
|
"graphql": "^16.9.0",
|
|
23
23
|
"graphql-tag": "^2.12.6",
|
|
24
24
|
"tsup": "^8.3.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"document-drive": "^1.0
|
|
28
|
-
"document-model": "^2.
|
|
27
|
+
"document-drive": "^1.2.0",
|
|
28
|
+
"document-model": "^2.3.1"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@apollo/server": "^4.11.0",
|
|
32
32
|
"@apollo/subgraph": "^2.9.2",
|
|
33
33
|
"body-parser": "^1.20.3",
|
|
34
34
|
"cors": "^2.8.5",
|
|
35
|
-
"document-model-libs": "1.
|
|
35
|
+
"document-model-libs": "^1.104.2",
|
|
36
|
+
"@powerhousedao/scalars": "latest",
|
|
36
37
|
"express": "^4.21.1"
|
|
37
38
|
},
|
|
38
39
|
"scripts": {
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
DocumentModelInput,
|
|
17
17
|
DocumentModelState,
|
|
18
18
|
} from "document-model/document-model";
|
|
19
|
-
import { Context } from "
|
|
19
|
+
import { Context } from "../types";
|
|
20
20
|
|
|
21
21
|
export const resolvers = {
|
|
22
22
|
Query: {
|
|
@@ -37,7 +37,7 @@ export const resolvers = {
|
|
|
37
37
|
const dms = ctx.driveServer.getDocumentModels();
|
|
38
38
|
const dm = dms.find(
|
|
39
39
|
({ documentModel }: { documentModel: DocumentModelState }) =>
|
|
40
|
-
documentModel.id === document.documentType
|
|
40
|
+
documentModel.id === document.documentType,
|
|
41
41
|
);
|
|
42
42
|
const globalState = document.state.global;
|
|
43
43
|
if (!globalState) throw new Error("Document not found");
|
|
@@ -63,7 +63,7 @@ export const resolvers = {
|
|
|
63
63
|
registerPullResponderListener: async (
|
|
64
64
|
_: unknown,
|
|
65
65
|
{ filter }: { filter: ListenerFilter },
|
|
66
|
-
ctx: Context
|
|
66
|
+
ctx: Context,
|
|
67
67
|
) => {
|
|
68
68
|
if (!ctx.driveId) throw new Error("Drive ID is required");
|
|
69
69
|
const uuid = generateUUID();
|
|
@@ -87,13 +87,13 @@ export const resolvers = {
|
|
|
87
87
|
|
|
88
88
|
const result = await ctx.driveServer.queueDriveAction(
|
|
89
89
|
ctx.driveId,
|
|
90
|
-
actions.addListener({ listener })
|
|
90
|
+
actions.addListener({ listener }),
|
|
91
91
|
);
|
|
92
92
|
|
|
93
93
|
console.log(result);
|
|
94
94
|
if (result.status !== "SUCCESS" && result.error) {
|
|
95
95
|
throw new Error(
|
|
96
|
-
`Listener couldn't be registered: ${result.error.message}
|
|
96
|
+
`Listener couldn't be registered: ${result.error.message}`,
|
|
97
97
|
);
|
|
98
98
|
}
|
|
99
99
|
|
|
@@ -102,7 +102,7 @@ export const resolvers = {
|
|
|
102
102
|
pushUpdates: async (
|
|
103
103
|
_: unknown,
|
|
104
104
|
{ strands }: { strands: StrandUpdateGraphQL[] },
|
|
105
|
-
ctx: Context
|
|
105
|
+
ctx: Context,
|
|
106
106
|
) => {
|
|
107
107
|
if (!ctx.driveId) throw new Error("Drive ID is required");
|
|
108
108
|
const listenerRevisions: ListenerRevision[] = await Promise.all(
|
|
@@ -120,11 +120,11 @@ export const resolvers = {
|
|
|
120
120
|
? ctx.driveServer.queueOperations(
|
|
121
121
|
s.driveId,
|
|
122
122
|
s.documentId,
|
|
123
|
-
operations
|
|
123
|
+
operations,
|
|
124
124
|
)
|
|
125
125
|
: ctx.driveServer.queueDriveOperations(
|
|
126
126
|
s.driveId,
|
|
127
|
-
operations as Operation<DocumentDriveAction | BaseAction>[]
|
|
127
|
+
operations as Operation<DocumentDriveAction | BaseAction>[],
|
|
128
128
|
));
|
|
129
129
|
|
|
130
130
|
const scopeOperations = result.document?.operations[s.scope] ?? [];
|
|
@@ -149,7 +149,7 @@ export const resolvers = {
|
|
|
149
149
|
status: result.status,
|
|
150
150
|
error: result.error?.message || undefined,
|
|
151
151
|
};
|
|
152
|
-
})
|
|
152
|
+
}),
|
|
153
153
|
);
|
|
154
154
|
|
|
155
155
|
return listenerRevisions;
|
|
@@ -160,7 +160,7 @@ export const resolvers = {
|
|
|
160
160
|
listenerId,
|
|
161
161
|
revisions,
|
|
162
162
|
}: { listenerId: string; revisions: ListenerRevision[] },
|
|
163
|
-
ctx: Context
|
|
163
|
+
ctx: Context,
|
|
164
164
|
) => {
|
|
165
165
|
if (!listenerId || !revisions) return false;
|
|
166
166
|
if (!ctx.driveId) throw new Error("Drive ID is required");
|
|
@@ -177,12 +177,12 @@ export const resolvers = {
|
|
|
177
177
|
|
|
178
178
|
const transmitter = (await ctx.driveServer.getTransmitter(
|
|
179
179
|
ctx.driveId,
|
|
180
|
-
listenerId
|
|
180
|
+
listenerId,
|
|
181
181
|
)) as PullResponderTransmitter;
|
|
182
182
|
const result = await transmitter.processAcknowledge(
|
|
183
183
|
ctx.driveId ?? "1",
|
|
184
184
|
listenerId,
|
|
185
|
-
validEntries
|
|
185
|
+
validEntries,
|
|
186
186
|
);
|
|
187
187
|
|
|
188
188
|
return result;
|
|
@@ -193,12 +193,12 @@ export const resolvers = {
|
|
|
193
193
|
strands: async (
|
|
194
194
|
_: unknown,
|
|
195
195
|
{ listenerId, since }: { listenerId: string; since: string | undefined },
|
|
196
|
-
ctx: Context
|
|
196
|
+
ctx: Context,
|
|
197
197
|
) => {
|
|
198
198
|
if (!ctx.driveId) throw new Error("Drive ID is required");
|
|
199
199
|
const listener = (await ctx.driveServer.getTransmitter(
|
|
200
200
|
ctx.driveId,
|
|
201
|
-
listenerId
|
|
201
|
+
listenerId,
|
|
202
202
|
)) as PullResponderTransmitter;
|
|
203
203
|
const strands = await listener.getStrands({ since });
|
|
204
204
|
return strands.map((e) => ({
|
package/src/subgraphs/index.ts
CHANGED