@powerhousedao/reactor-api 6.0.0-dev.67 → 6.0.0-dev.68
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/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/src/graphql/base-subgraph.d.ts +1 -2
- package/dist/src/graphql/base-subgraph.d.ts.map +1 -1
- package/dist/src/graphql/base-subgraph.js +0 -2
- package/dist/src/graphql/base-subgraph.js.map +1 -1
- package/dist/src/graphql/document-model-subgraph.d.ts +0 -13
- package/dist/src/graphql/document-model-subgraph.d.ts.map +1 -1
- package/dist/src/graphql/document-model-subgraph.js +6 -150
- package/dist/src/graphql/document-model-subgraph.js.map +1 -1
- package/dist/src/graphql/graphql-manager.d.ts +9 -4
- package/dist/src/graphql/graphql-manager.d.ts.map +1 -1
- package/dist/src/graphql/graphql-manager.js +45 -27
- package/dist/src/graphql/graphql-manager.js.map +1 -1
- package/dist/src/graphql/index.d.ts +0 -1
- package/dist/src/graphql/index.d.ts.map +1 -1
- package/dist/src/graphql/index.js +0 -1
- package/dist/src/graphql/index.js.map +1 -1
- package/dist/src/graphql/reactor/resolvers.d.ts +1 -0
- package/dist/src/graphql/reactor/resolvers.d.ts.map +1 -1
- package/dist/src/graphql/reactor/resolvers.js +33 -4
- package/dist/src/graphql/reactor/resolvers.js.map +1 -1
- package/dist/src/graphql/types.d.ts +1 -4
- package/dist/src/graphql/types.d.ts.map +1 -1
- package/dist/src/graphql/utils.d.ts +1 -18
- package/dist/src/graphql/utils.d.ts.map +1 -1
- package/dist/src/graphql/utils.js +0 -32
- package/dist/src/graphql/utils.js.map +1 -1
- package/dist/src/server.d.ts +0 -5
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/server.js +5 -6
- package/dist/src/server.js.map +1 -1
- package/dist/src/utils/create-schema.d.ts +4 -5
- package/dist/src/utils/create-schema.d.ts.map +1 -1
- package/dist/src/utils/create-schema.js +5 -6
- package/dist/src/utils/create-schema.js.map +1 -1
- package/dist/test/document-model-subgraph-permissions.test.js +2 -12
- package/dist/test/document-model-subgraph-permissions.test.js.map +1 -1
- package/dist/test/index.d.ts +0 -1
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +0 -1
- package/dist/test/index.js.map +1 -1
- package/dist/test/permissions-integration.test.js +1 -1
- package/dist/test/permissions-integration.test.js.map +1 -1
- package/dist/test/reactor-subgraph-permissions.test.js +1 -1
- package/dist/test/reactor-subgraph-permissions.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -11
- package/dist/src/graphql/drive-subgraph.d.ts +0 -25
- package/dist/src/graphql/drive-subgraph.d.ts.map +0 -1
- package/dist/src/graphql/drive-subgraph.js +0 -499
- package/dist/src/graphql/drive-subgraph.js.map +0 -1
- package/dist/src/sync/types.d.ts +0 -10
- package/dist/src/sync/types.d.ts.map +0 -1
- package/dist/src/sync/types.js +0 -2
- package/dist/src/sync/types.js.map +0 -1
- package/dist/src/sync/utils.d.ts +0 -7
- package/dist/src/sync/utils.d.ts.map +0 -1
- package/dist/src/sync/utils.js +0 -78
- package/dist/src/sync/utils.js.map +0 -1
- package/dist/test/document-model-subgraph-legacy-permissions.test.d.ts +0 -2
- package/dist/test/document-model-subgraph-legacy-permissions.test.d.ts.map +0 -1
- package/dist/test/document-model-subgraph-legacy-permissions.test.js +0 -460
- package/dist/test/document-model-subgraph-legacy-permissions.test.js.map +0 -1
- package/dist/test/document-model-subgraph.test.d.ts +0 -2
- package/dist/test/document-model-subgraph.test.d.ts.map +0 -1
- package/dist/test/document-model-subgraph.test.js +0 -439
- package/dist/test/document-model-subgraph.test.js.map +0 -1
- package/dist/test/drive-handlers.d.ts +0 -4
- package/dist/test/drive-handlers.d.ts.map +0 -1
- package/dist/test/drive-handlers.js +0 -39
- package/dist/test/drive-handlers.js.map +0 -1
- package/dist/test/drive-subgraph-permissions.test.d.ts +0 -2
- package/dist/test/drive-subgraph-permissions.test.d.ts.map +0 -1
- package/dist/test/drive-subgraph-permissions.test.js +0 -166
- package/dist/test/drive-subgraph-permissions.test.js.map +0 -1
- package/dist/test/drive.test.d.ts +0 -2
- package/dist/test/drive.test.d.ts.map +0 -1
- package/dist/test/drive.test.js +0 -142
- package/dist/test/drive.test.js.map +0 -1
- package/dist/test/pull-responder-transmitter.test.d.ts +0 -2
- package/dist/test/pull-responder-transmitter.test.d.ts.map +0 -1
- package/dist/test/pull-responder-transmitter.test.js +0 -220
- package/dist/test/pull-responder-transmitter.test.js.map +0 -1
- package/dist/test/push-transmitter.test.d.ts +0 -2
- package/dist/test/push-transmitter.test.d.ts.map +0 -1
- package/dist/test/push-transmitter.test.js +0 -179
- package/dist/test/push-transmitter.test.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/reactor-api",
|
|
3
|
-
"version": "6.0.0-dev.
|
|
3
|
+
"version": "6.0.0-dev.68",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -68,16 +68,16 @@
|
|
|
68
68
|
"read-pkg": "10.1.0",
|
|
69
69
|
"ws": "^8.18.3",
|
|
70
70
|
"zod": "4.3.6",
|
|
71
|
-
"@powerhousedao/analytics-engine-core": "6.0.0-dev.
|
|
72
|
-
"@powerhousedao/
|
|
73
|
-
"@powerhousedao/analytics-engine-
|
|
74
|
-
"@powerhousedao/
|
|
75
|
-
"@powerhousedao/
|
|
76
|
-
"@powerhousedao/reactor-mcp": "6.0.0-dev.
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
71
|
+
"@powerhousedao/analytics-engine-core": "6.0.0-dev.68",
|
|
72
|
+
"@powerhousedao/analytics-engine-pg": "6.0.0-dev.68",
|
|
73
|
+
"@powerhousedao/analytics-engine-graphql": "6.0.0-dev.68",
|
|
74
|
+
"@powerhousedao/config": "6.0.0-dev.68",
|
|
75
|
+
"@powerhousedao/reactor": "6.0.0-dev.68",
|
|
76
|
+
"@powerhousedao/reactor-mcp": "6.0.0-dev.68",
|
|
77
|
+
"@renown/sdk": "6.0.0-dev.68",
|
|
78
|
+
"document-drive": "6.0.0-dev.68",
|
|
79
|
+
"document-model": "6.0.0-dev.68",
|
|
80
|
+
"@powerhousedao/shared": "6.0.0-dev.68"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@graphql-codegen/cli": "6.1.1",
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { GraphQLResolverMap } from "@apollo/subgraph/dist/schema-helper/resolverMap.js";
|
|
2
|
-
import type { Context, GqlOperation, SubgraphArgs } from "@powerhousedao/reactor-api";
|
|
3
|
-
import type { FileNode } from "document-drive";
|
|
4
|
-
import { BaseSubgraph } from "./base-subgraph.js";
|
|
5
|
-
export declare const DocumentDriveResolvers: {
|
|
6
|
-
DocumentDrive_Node: {
|
|
7
|
-
__resolveType: (obj: FileNode) => string;
|
|
8
|
-
};
|
|
9
|
-
DocumentDrive: {
|
|
10
|
-
operations: (obj: unknown, { skip, first }: {
|
|
11
|
-
skip?: number;
|
|
12
|
-
first?: number;
|
|
13
|
-
}, ctx: Context) => GqlOperation[];
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export declare class DriveSubgraph extends BaseSubgraph {
|
|
17
|
-
private logger;
|
|
18
|
-
constructor(args: SubgraphArgs);
|
|
19
|
-
name: string;
|
|
20
|
-
typeDefs: import("graphql").DocumentNode;
|
|
21
|
-
private getDriveIdBySlugOrId;
|
|
22
|
-
private getDriveBySlugOrId;
|
|
23
|
-
resolvers: GraphQLResolverMap<Context>;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=drive-subgraph.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"drive-subgraph.d.ts","sourceRoot":"","sources":["../../../src/graphql/drive-subgraph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAC7F,OAAO,KAAK,EACV,OAAO,EAEP,YAAY,EAEZ,YAAY,EACb,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAGV,QAAQ,EAMT,MAAM,gBAAgB,CAAC;AAgBxB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AASlD,eAAO,MAAM,sBAAsB;;6BAEV,QAAQ;;;;gBA+GjB,CAAC;iBACL,CAAC;;;CAvGZ,CAAC;AAEF,qBAAa,aAAc,SAAQ,YAAY;IAC7C,OAAO,CAAC,MAAM,CAGX;gBAES,IAAI,EAAE,YAAY;IAS9B,IAAI,SAAc;IAClB,QAAQ,iCAyKN;YAEY,oBAAoB;YASpB,kBAAkB;IAWhC,SAAS,EAAE,kBAAkB,CAAC,OAAO,CAAC,CA2XpC;CACH"}
|
|
@@ -1,499 +0,0 @@
|
|
|
1
|
-
import { pascalCase } from "change-case";
|
|
2
|
-
import { childLogger, PullResponderTransmitter, responseForDocument, responseForDrive, } from "document-drive";
|
|
3
|
-
import { generateId } from "document-model/core";
|
|
4
|
-
import { GraphQLError } from "graphql";
|
|
5
|
-
import { gql } from "graphql-tag";
|
|
6
|
-
import { processAcknowledge, processGetStrands, processPushUpdate, } from "../sync/utils.js";
|
|
7
|
-
import { BaseSubgraph } from "./base-subgraph.js";
|
|
8
|
-
import { buildGraphQlDriveDocument, IDocumentGraphql } from "./utils.js";
|
|
9
|
-
const driveKindTypeNames = {
|
|
10
|
-
file: "DocumentDrive_FileNode",
|
|
11
|
-
folder: "DocumentDrive_FolderNode",
|
|
12
|
-
};
|
|
13
|
-
export const DocumentDriveResolvers = {
|
|
14
|
-
DocumentDrive_Node: {
|
|
15
|
-
__resolveType: (obj) => {
|
|
16
|
-
return obj.documentType
|
|
17
|
-
? driveKindTypeNames.file
|
|
18
|
-
: driveKindTypeNames.folder;
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
DocumentDrive: {
|
|
22
|
-
operations: IDocumentGraphql.resolvers.IDocument.operations,
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
export class DriveSubgraph extends BaseSubgraph {
|
|
26
|
-
logger = childLogger([
|
|
27
|
-
"DriveSubgraph",
|
|
28
|
-
Math.floor(Math.random() * 999).toString(),
|
|
29
|
-
]);
|
|
30
|
-
constructor(args) {
|
|
31
|
-
super(args);
|
|
32
|
-
this.logger.verbose(`constructor()`);
|
|
33
|
-
}
|
|
34
|
-
// Note: This GQL declaration depends on the document drive subgraph already
|
|
35
|
-
// being registered. If the document drive subgraph is not registered, this
|
|
36
|
-
// will throw an error as it relies on those types.
|
|
37
|
-
name = "d/:drive";
|
|
38
|
-
typeDefs = gql `
|
|
39
|
-
type DriveMeta {
|
|
40
|
-
preferredEditor: String
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
extend type DocumentDrive_DocumentDriveState {
|
|
44
|
-
meta: DriveMeta
|
|
45
|
-
}
|
|
46
|
-
extend type DocumentDrive {
|
|
47
|
-
meta: DriveMeta
|
|
48
|
-
slug: String!
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
type Query {
|
|
52
|
-
system: System
|
|
53
|
-
drive: DriveInfo
|
|
54
|
-
driveDocument: DocumentDrive
|
|
55
|
-
document(id: String!): DriveDocument
|
|
56
|
-
documents: [String!]!
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
type Mutation {
|
|
60
|
-
registerPullResponderListener(
|
|
61
|
-
filter: InputListenerFilter!
|
|
62
|
-
listenerId: String
|
|
63
|
-
): DocumentDrive_Listener
|
|
64
|
-
pushUpdates(strands: [InputStrandUpdate!]): [ListenerRevision!]!
|
|
65
|
-
acknowledge(
|
|
66
|
-
listenerId: String!
|
|
67
|
-
revisions: [ListenerRevisionInput]
|
|
68
|
-
): Boolean
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
input InputOperationSignerUser {
|
|
72
|
-
address: String!
|
|
73
|
-
networkId: String!
|
|
74
|
-
chainId: Int!
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
type OperationSignerUser {
|
|
78
|
-
address: String!
|
|
79
|
-
networkId: String!
|
|
80
|
-
chainId: Int!
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
input InputOperationSignerApp {
|
|
84
|
-
name: String!
|
|
85
|
-
key: String!
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
type OperationSignerApp {
|
|
89
|
-
name: String!
|
|
90
|
-
key: String!
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
type OperationSigner {
|
|
94
|
-
app: OperationSignerApp
|
|
95
|
-
user: OperationSignerUser
|
|
96
|
-
signatures: [[String!]]!
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
input InputOperationSigner {
|
|
100
|
-
app: InputOperationSignerApp
|
|
101
|
-
user: InputOperationSignerUser
|
|
102
|
-
signatures: [[String!]]!
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
type OperationContext {
|
|
106
|
-
signer: OperationSigner
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
input InputOperationContext {
|
|
110
|
-
signer: InputOperationSigner
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
input InputOperationUpdate {
|
|
114
|
-
index: Int!
|
|
115
|
-
skip: Int
|
|
116
|
-
type: String!
|
|
117
|
-
id: String!
|
|
118
|
-
actionId: String!
|
|
119
|
-
input: String!
|
|
120
|
-
hash: String!
|
|
121
|
-
timestampUtcMs: String!
|
|
122
|
-
error: String
|
|
123
|
-
context: InputOperationContext
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
type OperationUpdate {
|
|
127
|
-
index: Int!
|
|
128
|
-
skip: Int
|
|
129
|
-
type: String!
|
|
130
|
-
id: String!
|
|
131
|
-
actionId: String!
|
|
132
|
-
input: String!
|
|
133
|
-
hash: String!
|
|
134
|
-
timestampUtcMs: String!
|
|
135
|
-
error: String
|
|
136
|
-
context: OperationContext
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
type StrandUpdate {
|
|
140
|
-
driveId: String!
|
|
141
|
-
documentId: String!
|
|
142
|
-
documentType: String!
|
|
143
|
-
scope: String!
|
|
144
|
-
branch: String!
|
|
145
|
-
operations: [OperationUpdate!]!
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
input InputStrandUpdate {
|
|
149
|
-
driveId: String!
|
|
150
|
-
documentId: String!
|
|
151
|
-
documentType: String!
|
|
152
|
-
scope: String!
|
|
153
|
-
branch: String!
|
|
154
|
-
operations: [InputOperationUpdate!]!
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
input InputListenerFilter {
|
|
158
|
-
documentType: [String!]
|
|
159
|
-
documentId: [String!]
|
|
160
|
-
scope: [String!]
|
|
161
|
-
branch: [String!]
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
enum UpdateStatus {
|
|
165
|
-
SUCCESS
|
|
166
|
-
MISSING
|
|
167
|
-
CONFLICT
|
|
168
|
-
ERROR
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
input ListenerRevisionInput {
|
|
172
|
-
driveId: String!
|
|
173
|
-
documentId: String!
|
|
174
|
-
documentType: String!
|
|
175
|
-
scope: String!
|
|
176
|
-
branch: String!
|
|
177
|
-
status: UpdateStatus!
|
|
178
|
-
revision: Int!
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
type ListenerRevision {
|
|
182
|
-
driveId: String!
|
|
183
|
-
documentId: String!
|
|
184
|
-
documentType: String!
|
|
185
|
-
scope: String!
|
|
186
|
-
branch: String!
|
|
187
|
-
status: UpdateStatus!
|
|
188
|
-
revision: Int!
|
|
189
|
-
error: String
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
type System {
|
|
193
|
-
sync: Sync
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
type Sync {
|
|
197
|
-
strands(listenerId: ID!, since: String): [StrandUpdate!]!
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
type DriveInfo {
|
|
201
|
-
id: String!
|
|
202
|
-
name: String!
|
|
203
|
-
slug: String!
|
|
204
|
-
meta: DriveMeta
|
|
205
|
-
icon: String
|
|
206
|
-
}
|
|
207
|
-
`;
|
|
208
|
-
async getDriveIdBySlugOrId(slugOrId) {
|
|
209
|
-
try {
|
|
210
|
-
return await this.reactor.getDriveIdBySlug(slugOrId);
|
|
211
|
-
}
|
|
212
|
-
catch {
|
|
213
|
-
const drive = await this.reactor.getDrive(slugOrId);
|
|
214
|
-
return drive.header.id;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
async getDriveBySlugOrId(slugOrId) {
|
|
218
|
-
try {
|
|
219
|
-
return await this.reactor.getDriveBySlug(slugOrId);
|
|
220
|
-
}
|
|
221
|
-
catch {
|
|
222
|
-
const drive = await this.reactor.getDrive(slugOrId);
|
|
223
|
-
return drive;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
resolvers = {
|
|
227
|
-
Asset: {
|
|
228
|
-
__resolveType: (obj) => {
|
|
229
|
-
return obj.type;
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
Node: {
|
|
233
|
-
__resolveType: (obj) => {
|
|
234
|
-
return obj.documentType
|
|
235
|
-
? driveKindTypeNames.file
|
|
236
|
-
: driveKindTypeNames.folder;
|
|
237
|
-
},
|
|
238
|
-
},
|
|
239
|
-
Operation: {
|
|
240
|
-
type: (operation) => "type" in operation ? operation.type : operation.action.type,
|
|
241
|
-
id: (operation) => operation.id,
|
|
242
|
-
},
|
|
243
|
-
DriveDocument: {
|
|
244
|
-
operations: IDocumentGraphql.resolvers.IDocument.operations,
|
|
245
|
-
},
|
|
246
|
-
...DocumentDriveResolvers,
|
|
247
|
-
Query: {
|
|
248
|
-
drive: async (_, args, ctx) => {
|
|
249
|
-
this.logger.verbose(`drive()`, JSON.stringify(args));
|
|
250
|
-
if (!ctx.driveId)
|
|
251
|
-
throw new Error("Drive ID is required");
|
|
252
|
-
const drive = await this.getDriveBySlugOrId(ctx.driveId);
|
|
253
|
-
return responseForDrive(drive);
|
|
254
|
-
},
|
|
255
|
-
driveDocument: async (_, args, ctx) => {
|
|
256
|
-
this.logger.verbose(`driveDocument()`, JSON.stringify(args));
|
|
257
|
-
if (!ctx.driveId)
|
|
258
|
-
throw new Error("Drive ID is required");
|
|
259
|
-
const drive = await this.getDriveBySlugOrId(ctx.driveId);
|
|
260
|
-
ctx.document = drive;
|
|
261
|
-
return buildGraphQlDriveDocument(drive);
|
|
262
|
-
},
|
|
263
|
-
documents: async (_, args, ctx) => {
|
|
264
|
-
this.logger.verbose(`documents(drive: ${ctx.driveId})`, args);
|
|
265
|
-
if (!ctx.driveId)
|
|
266
|
-
throw new Error("Drive ID is required");
|
|
267
|
-
const driveId = await this.getDriveIdBySlugOrId(ctx.driveId);
|
|
268
|
-
const documents = await this.reactor.getDocuments(driveId);
|
|
269
|
-
return documents;
|
|
270
|
-
},
|
|
271
|
-
document: async (_, { id }, ctx) => {
|
|
272
|
-
this.logger.verbose(`document(drive: ${ctx.driveId}, id: ${id})`);
|
|
273
|
-
if (!ctx.driveId)
|
|
274
|
-
throw new Error("Drive ID is required");
|
|
275
|
-
const driveId = await this.getDriveIdBySlugOrId(ctx.driveId);
|
|
276
|
-
if (id !== driveId) {
|
|
277
|
-
const driveDocuments = await this.reactor.getDocuments(driveId);
|
|
278
|
-
if (!driveDocuments.includes(id)) {
|
|
279
|
-
throw new GraphQLError("Document is not part of this drive");
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
const document = await this.reactor.getDocument(id);
|
|
283
|
-
const dms = this.reactor.getDocumentModelModules();
|
|
284
|
-
const dm = dms.find(({ documentModel }) => documentModel.global.id === document.header.documentType);
|
|
285
|
-
let node;
|
|
286
|
-
const driveDocument = await this.reactor.getDrive(driveId);
|
|
287
|
-
if (driveDocument?.state?.global?.nodes) {
|
|
288
|
-
node = driveDocument.state.global.nodes.find((node) => node.id === id);
|
|
289
|
-
}
|
|
290
|
-
// eslint-disable-next-line
|
|
291
|
-
const globalState = document.state.global;
|
|
292
|
-
if (!globalState)
|
|
293
|
-
throw new Error("Document was found with no global state");
|
|
294
|
-
const typeName = pascalCase((dm?.documentModel.global.name || "").replaceAll("/", " "));
|
|
295
|
-
ctx.document = document;
|
|
296
|
-
return responseForDocument(document, typeName, node?.name);
|
|
297
|
-
},
|
|
298
|
-
system: () => ({ sync: {} }),
|
|
299
|
-
},
|
|
300
|
-
Mutation: {
|
|
301
|
-
registerPullResponderListener: async (_, { filter, listenerId }, ctx) => {
|
|
302
|
-
this.logger.verbose(`registerPullResponderListener(drive: ${ctx.driveId})`, filter);
|
|
303
|
-
if (!ctx.driveId) {
|
|
304
|
-
throw new Error("Drive ID is required");
|
|
305
|
-
}
|
|
306
|
-
const reactorDriveId = await this.getDriveIdBySlugOrId(ctx.driveId);
|
|
307
|
-
// Check read permission
|
|
308
|
-
if (this.authorizationService) {
|
|
309
|
-
const canRead = await this.authorizationService.canRead(reactorDriveId, ctx.user?.address);
|
|
310
|
-
if (!canRead) {
|
|
311
|
-
this.logger.warn(`registerPullResponderListener rejected: user ${ctx.user?.address ?? "anonymous"} lacks read permission for drive ${reactorDriveId}`);
|
|
312
|
-
throw new GraphQLError("Forbidden: insufficient permissions to read from this drive");
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
else {
|
|
316
|
-
// Legacy fallback
|
|
317
|
-
const isGlobalAdmin = !!ctx.isAdmin?.(ctx.user?.address ?? "");
|
|
318
|
-
if (!isGlobalAdmin && this.documentPermissionService) {
|
|
319
|
-
const canRead = await this.documentPermissionService.canReadDocument(reactorDriveId, ctx.user?.address);
|
|
320
|
-
if (!canRead) {
|
|
321
|
-
throw new GraphQLError("Forbidden: insufficient permissions to read from this drive");
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
else if (!isGlobalAdmin) {
|
|
325
|
-
throw new GraphQLError("Forbidden");
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
const driveId = await this.getDriveIdBySlugOrId(ctx.driveId);
|
|
329
|
-
// Create the listener and transmitter
|
|
330
|
-
const uuid = listenerId ?? generateId();
|
|
331
|
-
const listener = {
|
|
332
|
-
driveId: driveId,
|
|
333
|
-
listenerId: uuid,
|
|
334
|
-
block: false,
|
|
335
|
-
filter,
|
|
336
|
-
system: false,
|
|
337
|
-
label: `Pullresponder #${uuid}`,
|
|
338
|
-
callInfo: {
|
|
339
|
-
data: "",
|
|
340
|
-
name: "PullResponder",
|
|
341
|
-
transmitterType: "PullResponder",
|
|
342
|
-
},
|
|
343
|
-
};
|
|
344
|
-
// TODO: circular reference
|
|
345
|
-
// TODO: once we have DI, remove this and pass around
|
|
346
|
-
const listenerManager = this.reactor.listeners;
|
|
347
|
-
listener.transmitter = new PullResponderTransmitter(listener, listenerManager);
|
|
348
|
-
// set the listener on the manager directly (bypassing operations)
|
|
349
|
-
try {
|
|
350
|
-
await listenerManager.setListener(driveId, listener);
|
|
351
|
-
}
|
|
352
|
-
catch (error) {
|
|
353
|
-
this.logger.error(`Failed to register ephemeral listener: ${error}`);
|
|
354
|
-
throw new Error(`Listener couldn't be registered: ${error}`);
|
|
355
|
-
}
|
|
356
|
-
// for backwards compatibility: return everything but the transmitter
|
|
357
|
-
return {
|
|
358
|
-
driveId: listener.driveId,
|
|
359
|
-
listenerId: listener.listenerId,
|
|
360
|
-
label: listener.label,
|
|
361
|
-
block: listener.block,
|
|
362
|
-
system: listener.system,
|
|
363
|
-
filter: listener.filter,
|
|
364
|
-
callInfo: listener.callInfo,
|
|
365
|
-
};
|
|
366
|
-
},
|
|
367
|
-
pushUpdates: async (_, { strands: strandsGql }, ctx) => {
|
|
368
|
-
if (!ctx.driveId)
|
|
369
|
-
throw new Error("Drive ID is required");
|
|
370
|
-
const driveId = await this.getDriveIdBySlugOrId(ctx.driveId);
|
|
371
|
-
this.logger.verbose(`pushUpdates(drive: slug:${ctx.driveId} id:${driveId})`, strandsGql);
|
|
372
|
-
// Check write permission
|
|
373
|
-
if (this.authorizationService) {
|
|
374
|
-
const canWrite = await this.authorizationService.canWrite(driveId, ctx.user?.address);
|
|
375
|
-
if (!canWrite) {
|
|
376
|
-
this.logger.warn(`pushUpdates rejected: user ${ctx.user?.address ?? "anonymous"} lacks write permission for drive ${driveId}`);
|
|
377
|
-
throw new GraphQLError("Forbidden: insufficient permissions to write to this drive");
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
else {
|
|
381
|
-
// Legacy fallback
|
|
382
|
-
const isGlobalAdmin = !!ctx.isAdmin?.(ctx.user?.address ?? "");
|
|
383
|
-
if (!isGlobalAdmin && this.documentPermissionService) {
|
|
384
|
-
const canWrite = await this.documentPermissionService.canWriteDocument(driveId, ctx.user?.address);
|
|
385
|
-
if (!canWrite) {
|
|
386
|
-
throw new GraphQLError("Forbidden: insufficient permissions to write to this drive");
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
else if (!isGlobalAdmin) {
|
|
390
|
-
throw new GraphQLError("Forbidden");
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
// translate data types
|
|
394
|
-
const strands = strandsGql.map((strandGql) => {
|
|
395
|
-
return {
|
|
396
|
-
operations: strandGql.operations.map((op) => ({
|
|
397
|
-
index: op.index,
|
|
398
|
-
skip: op.skip ?? 0,
|
|
399
|
-
timestampUtcMs: op.timestampUtcMs,
|
|
400
|
-
hash: op.hash,
|
|
401
|
-
id: op.id,
|
|
402
|
-
// Map GraphQL context to Action.context (only signer is defined in schema)
|
|
403
|
-
action: {
|
|
404
|
-
id: op.actionId,
|
|
405
|
-
type: op.type,
|
|
406
|
-
timestampUtcMs: op.timestampUtcMs,
|
|
407
|
-
scope: strandGql.scope,
|
|
408
|
-
input: JSON.parse(op.input),
|
|
409
|
-
context: op.context,
|
|
410
|
-
},
|
|
411
|
-
})),
|
|
412
|
-
documentId: strandGql.documentId,
|
|
413
|
-
documentType: strandGql.documentType,
|
|
414
|
-
driveId: strandGql.driveId,
|
|
415
|
-
scope: strandGql.scope,
|
|
416
|
-
branch: strandGql.branch,
|
|
417
|
-
};
|
|
418
|
-
});
|
|
419
|
-
// return a list of listener revisions
|
|
420
|
-
return await Promise.all(strands.map((strand) => processPushUpdate(this.reactor, strand)));
|
|
421
|
-
},
|
|
422
|
-
acknowledge: async (_, { listenerId, revisions, }, ctx) => {
|
|
423
|
-
if (!listenerId || !revisions)
|
|
424
|
-
return false;
|
|
425
|
-
if (!ctx.driveId)
|
|
426
|
-
throw new Error("Drive ID is required");
|
|
427
|
-
const driveId = await this.getDriveIdBySlugOrId(ctx.driveId);
|
|
428
|
-
this.logger.verbose(`acknowledge(drive: ${ctx.driveId}/${driveId}, listenerId: ${listenerId})`, revisions);
|
|
429
|
-
// translate data types
|
|
430
|
-
const validEntries = revisions
|
|
431
|
-
.filter((r) => r !== null)
|
|
432
|
-
.map((e) => ({
|
|
433
|
-
driveId: e.driveId,
|
|
434
|
-
documentId: e.documentId,
|
|
435
|
-
documentType: e.documentType,
|
|
436
|
-
scope: e.scope,
|
|
437
|
-
branch: e.branch,
|
|
438
|
-
revision: e.revision,
|
|
439
|
-
status: e.status,
|
|
440
|
-
}));
|
|
441
|
-
// return a boolean indicating if the acknowledge was successful
|
|
442
|
-
return await processAcknowledge(this.reactor, driveId, listenerId, validEntries);
|
|
443
|
-
},
|
|
444
|
-
},
|
|
445
|
-
System: {},
|
|
446
|
-
Sync: {
|
|
447
|
-
strands: async (_, { listenerId, since, }, ctx) => {
|
|
448
|
-
if (!ctx.driveId)
|
|
449
|
-
throw new Error("Drive ID is required");
|
|
450
|
-
const driveId = await this.getDriveIdBySlugOrId(ctx.driveId);
|
|
451
|
-
this.logger.verbose(`strands(drive: ${ctx.driveId}/${driveId}, listenerId: ${listenerId}, since:${since})`);
|
|
452
|
-
// Check read permission
|
|
453
|
-
if (this.authorizationService) {
|
|
454
|
-
const canRead = await this.authorizationService.canRead(driveId, ctx.user?.address);
|
|
455
|
-
if (!canRead) {
|
|
456
|
-
this.logger.warn(`strands filtered: user ${ctx.user?.address ?? "anonymous"} lacks read permission for drive ${driveId}`);
|
|
457
|
-
return [];
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
else {
|
|
461
|
-
// Legacy fallback
|
|
462
|
-
const isGlobalAdmin = !!ctx.isAdmin?.(ctx.user?.address ?? "");
|
|
463
|
-
if (!isGlobalAdmin && this.documentPermissionService) {
|
|
464
|
-
const canRead = await this.documentPermissionService.canReadDocument(driveId, ctx.user?.address);
|
|
465
|
-
if (!canRead) {
|
|
466
|
-
return [];
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
else if (!isGlobalAdmin) {
|
|
470
|
-
return [];
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
// get the requested strand updates
|
|
474
|
-
const strands = await processGetStrands(this.reactor, driveId, listenerId, since);
|
|
475
|
-
// translate data types
|
|
476
|
-
return strands.map((update) => ({
|
|
477
|
-
driveId: update.driveId,
|
|
478
|
-
documentId: update.documentId,
|
|
479
|
-
documentType: update.documentType,
|
|
480
|
-
scope: update.scope,
|
|
481
|
-
branch: update.branch,
|
|
482
|
-
operations: update.operations.map((op) => ({
|
|
483
|
-
index: op.index,
|
|
484
|
-
skip: op.skip,
|
|
485
|
-
// no extra name field; GraphQL schema exposes `type`
|
|
486
|
-
input: JSON.stringify(op.input),
|
|
487
|
-
hash: op.hash,
|
|
488
|
-
timestampUtcMs: op.timestampUtcMs,
|
|
489
|
-
type: op.type,
|
|
490
|
-
context: op.context,
|
|
491
|
-
id: op.id,
|
|
492
|
-
actionId: op.actionId,
|
|
493
|
-
})),
|
|
494
|
-
}));
|
|
495
|
-
},
|
|
496
|
-
},
|
|
497
|
-
};
|
|
498
|
-
}
|
|
499
|
-
//# sourceMappingURL=drive-subgraph.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"drive-subgraph.js","sourceRoot":"","sources":["../../../src/graphql/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gB,CAAC;AAEhD,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
|
package/dist/src/sync/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/sync/types.ts"],"names":[],"mappings":""}
|
package/dist/src/sync/utils.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { IDocumentDriveServer, ListenerRevision, StrandUpdate } from "document-drive";
|
|
2
|
-
import type { InternalStrandUpdate } from "@powerhousedao/reactor-api";
|
|
3
|
-
export declare const processPushUpdate: (reactor: IDocumentDriveServer, strand: InternalStrandUpdate) => Promise<ListenerRevision>;
|
|
4
|
-
export declare const processPushNewDocument: (reactor: IDocumentDriveServer, strand: InternalStrandUpdate) => Promise<ListenerRevision>;
|
|
5
|
-
export declare const processAcknowledge: (reactor: IDocumentDriveServer, driveId: string, listenerId: string, revisions: ListenerRevision[]) => Promise<boolean>;
|
|
6
|
-
export declare const processGetStrands: (reactor: IDocumentDriveServer, driveId: string, listenerId: string, since: string | undefined) => Promise<StrandUpdate[]>;
|
|
7
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/sync/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EAEhB,YAAY,EACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGvE,eAAO,MAAM,iBAAiB,GAC5B,SAAS,oBAAoB,EAC7B,QAAQ,oBAAoB,KAC3B,OAAO,CAAC,gBAAgB,CA4B1B,CAAC;AAEF,eAAO,MAAM,sBAAsB,GACjC,SAAS,oBAAoB,EAC7B,QAAQ,oBAAoB,KAC3B,OAAO,CAAC,gBAAgB,CAuC1B,CAAC;AAGF,eAAO,MAAM,kBAAkB,GAC7B,SAAS,oBAAoB,EAC7B,SAAS,MAAM,EACf,YAAY,MAAM,EAClB,WAAW,gBAAgB,EAAE,KAC5B,OAAO,CAAC,OAAO,CAKjB,CAAC;AAGF,eAAO,MAAM,iBAAiB,GAC5B,SAAS,oBAAoB,EAC7B,SAAS,MAAM,EACf,YAAY,MAAM,EAClB,OAAO,MAAM,GAAG,SAAS,KACxB,OAAO,CAAC,YAAY,EAAE,CAKxB,CAAC"}
|