@powerhousedao/reactor-api 1.21.0 → 1.21.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.
- package/CHANGELOG.md +17 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +36 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/subgraphs/drive/index.ts +53 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## 1.21.1 (2025-02-18)
|
|
2
|
+
|
|
3
|
+
### 🩹 Fixes
|
|
4
|
+
|
|
5
|
+
- **reactor-api:** inject missing node __typenames in drive subgraph ([8571ba3f](https://github.com/powerhouse-inc/powerhouse/commit/8571ba3f))
|
|
6
|
+
- **reactor-api:** inject missing node __typenames in drive subgraph ([083f711a](https://github.com/powerhouse-inc/powerhouse/commit/083f711a))
|
|
7
|
+
- **reactor-api:** sanitize document model name before using it as __typename ([07c3be7d](https://github.com/powerhouse-inc/powerhouse/commit/07c3be7d))
|
|
8
|
+
|
|
9
|
+
### 🧱 Updated Dependencies
|
|
10
|
+
|
|
11
|
+
- Updated document-model-libs to 1.132.1
|
|
12
|
+
- Updated document-drive to 1.19.0
|
|
13
|
+
|
|
14
|
+
### ❤️ Thank You
|
|
15
|
+
|
|
16
|
+
- Wouter Kampmann
|
|
17
|
+
|
|
1
18
|
## 1.2.0 (2024-10-29)
|
|
2
19
|
|
|
3
20
|
### 🚀 Features
|
package/dist/index.d.ts
CHANGED
|
@@ -347,6 +347,9 @@ declare namespace index$3 {
|
|
|
347
347
|
}
|
|
348
348
|
|
|
349
349
|
declare class DriveSubgraph extends Subgraph {
|
|
350
|
+
private debugID;
|
|
351
|
+
constructor(args: SubgraphArgs);
|
|
352
|
+
private debugLog;
|
|
350
353
|
name: string;
|
|
351
354
|
typeDefs: graphql.DocumentNode;
|
|
352
355
|
resolvers: GraphQLResolverMap$1<Context>;
|
package/dist/index.js
CHANGED
|
@@ -25973,9 +25973,21 @@ var processGetStrands = async (reactor, driveId, listenerId, since) => {
|
|
|
25973
25973
|
);
|
|
25974
25974
|
return transmitter.getStrands({ since });
|
|
25975
25975
|
};
|
|
25976
|
-
|
|
25977
|
-
|
|
25976
|
+
var driveKindTypeNames = {
|
|
25977
|
+
file: "DocumentDrive_FileNode",
|
|
25978
|
+
folder: "DocumentDrive_FolderNode"
|
|
25979
|
+
};
|
|
25978
25980
|
var DriveSubgraph = class extends Subgraph {
|
|
25981
|
+
debugID = `[DSG #${Math.floor(Math.random() * 999)}]`;
|
|
25982
|
+
constructor(args) {
|
|
25983
|
+
super(args);
|
|
25984
|
+
this.debugLog(`constructor()`);
|
|
25985
|
+
}
|
|
25986
|
+
debugLog(...data) {
|
|
25987
|
+
{
|
|
25988
|
+
return;
|
|
25989
|
+
}
|
|
25990
|
+
}
|
|
25979
25991
|
name = "d/:drive";
|
|
25980
25992
|
typeDefs = gql`
|
|
25981
25993
|
type Query {
|
|
@@ -26139,16 +26151,25 @@ var DriveSubgraph = class extends Subgraph {
|
|
|
26139
26151
|
},
|
|
26140
26152
|
Query: {
|
|
26141
26153
|
drive: async (_, args, ctx) => {
|
|
26154
|
+
this.debugLog(`drive()`, args);
|
|
26142
26155
|
if (!ctx.driveId) throw new Error("Drive ID is required");
|
|
26143
26156
|
const drive = await this.reactor.getDrive(ctx.driveId);
|
|
26144
|
-
return
|
|
26157
|
+
return {
|
|
26158
|
+
...drive.state.global,
|
|
26159
|
+
nodes: drive.state.global.nodes.map((n2) => ({
|
|
26160
|
+
...n2,
|
|
26161
|
+
__typename: driveKindTypeNames[n2.kind] || "UnkownDriveNode"
|
|
26162
|
+
}))
|
|
26163
|
+
};
|
|
26145
26164
|
},
|
|
26146
26165
|
documents: async (_, args, ctx) => {
|
|
26166
|
+
this.debugLog(`documents(drive: ${ctx.driveId})`, args);
|
|
26147
26167
|
if (!ctx.driveId) throw new Error("Drive ID is required");
|
|
26148
26168
|
const documents = await this.reactor.getDocuments(ctx.driveId);
|
|
26149
26169
|
return documents;
|
|
26150
26170
|
},
|
|
26151
26171
|
document: async (_, { id }, ctx) => {
|
|
26172
|
+
this.debugLog(`document(drive: ${ctx.driveId}, id: ${id})`);
|
|
26152
26173
|
if (!ctx.driveId) throw new Error("Drive ID is required");
|
|
26153
26174
|
const document = await this.reactor.getDocument(ctx.driveId, id);
|
|
26154
26175
|
const dms = this.reactor.getDocumentModels();
|
|
@@ -26178,6 +26199,10 @@ var DriveSubgraph = class extends Subgraph {
|
|
|
26178
26199
|
},
|
|
26179
26200
|
Mutation: {
|
|
26180
26201
|
registerPullResponderListener: async (_, { filter }, ctx) => {
|
|
26202
|
+
this.debugLog(
|
|
26203
|
+
`registerPullResponderListener(drive: ${ctx.driveId})`,
|
|
26204
|
+
filter
|
|
26205
|
+
);
|
|
26181
26206
|
if (!ctx.driveId) throw new Error("Drive ID is required");
|
|
26182
26207
|
const uuid = generateUUID2();
|
|
26183
26208
|
const listener = {
|
|
@@ -26210,6 +26235,7 @@ var DriveSubgraph = class extends Subgraph {
|
|
|
26210
26235
|
},
|
|
26211
26236
|
pushUpdates: async (_, { strands: strandsGql }, ctx) => {
|
|
26212
26237
|
if (!ctx.driveId) throw new Error("Drive ID is required");
|
|
26238
|
+
this.debugLog(`pushUpdates(drive: ${ctx.driveId})`, strandsGql);
|
|
26213
26239
|
const strands = strandsGql.map((strandGql) => {
|
|
26214
26240
|
return {
|
|
26215
26241
|
operations: strandGql.operations.map((op) => ({
|
|
@@ -26233,6 +26259,10 @@ var DriveSubgraph = class extends Subgraph {
|
|
|
26233
26259
|
listenerId,
|
|
26234
26260
|
revisions
|
|
26235
26261
|
}, ctx) => {
|
|
26262
|
+
this.debugLog(
|
|
26263
|
+
`acknowledge(drive: ${ctx.driveId}, listenerId: ${listenerId})`,
|
|
26264
|
+
revisions
|
|
26265
|
+
);
|
|
26236
26266
|
if (!listenerId || !revisions) return false;
|
|
26237
26267
|
if (!ctx.driveId) throw new Error("Drive ID is required");
|
|
26238
26268
|
const validEntries = revisions.filter((r) => r !== null).map((e) => ({
|
|
@@ -26257,6 +26287,9 @@ var DriveSubgraph = class extends Subgraph {
|
|
|
26257
26287
|
listenerId,
|
|
26258
26288
|
since
|
|
26259
26289
|
}, ctx) => {
|
|
26290
|
+
this.debugLog(
|
|
26291
|
+
`strands(drive: ${ctx.driveId}, listenerId: ${listenerId}, since:${since})`
|
|
26292
|
+
);
|
|
26260
26293
|
if (!ctx.driveId) throw new Error("Drive ID is required");
|
|
26261
26294
|
const strands = await processGetStrands(
|
|
26262
26295
|
this.reactor,
|