@powerhousedao/reactor-api 1.18.0 → 1.19.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 +8 -17
- package/dist/index.d.ts +4 -0
- package/dist/index.js +86 -74
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/server.ts +24 -5
- package/src/subgraphs/manager.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/reactor-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"@types/pg": "^8.11.10",
|
|
24
24
|
"esbuild": "^0.24.0",
|
|
25
25
|
"graphql-tag": "^2.12.6",
|
|
26
|
-
"@powerhousedao/scalars": "1.21.
|
|
27
|
-
"document-
|
|
28
|
-
"document-
|
|
26
|
+
"@powerhousedao/scalars": "1.21.1",
|
|
27
|
+
"document-model": "2.18.0",
|
|
28
|
+
"document-drive": "1.16.3"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@apollo/server": "^4.11.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"uuid": "^9.0.1",
|
|
52
52
|
"wildcard-match": "^5.1.3",
|
|
53
53
|
"zod": "^3.24.1",
|
|
54
|
-
"document-model-libs": "1.
|
|
54
|
+
"document-model-libs": "1.130.1"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"build": "tsup",
|
package/src/server.ts
CHANGED
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
import { PGlite } from "@electric-sql/pglite";
|
|
2
|
+
import {
|
|
3
|
+
KnexAnalyticsStore,
|
|
4
|
+
KnexQueryExecutor,
|
|
5
|
+
} from "@powerhousedao/analytics-engine-knex";
|
|
2
6
|
import { IDocumentDriveServer } from "document-drive";
|
|
3
7
|
import express, { Express } from "express";
|
|
8
|
+
import fs from "node:fs";
|
|
9
|
+
import https from "node:https";
|
|
4
10
|
import { Pool } from "pg";
|
|
5
11
|
import { ProcessorManager } from "./processors";
|
|
6
12
|
import { SubgraphManager } from "./subgraphs/manager";
|
|
7
13
|
import { API } from "./types";
|
|
8
14
|
import { getDbClient } from "./utils/db";
|
|
9
|
-
import
|
|
10
|
-
KnexAnalyticsStore,
|
|
11
|
-
KnexQueryExecutor,
|
|
12
|
-
} from "@powerhousedao/analytics-engine-knex";
|
|
15
|
+
import path from "node:path";
|
|
13
16
|
|
|
14
17
|
type Options = {
|
|
15
18
|
express?: Express;
|
|
16
19
|
port?: number;
|
|
17
20
|
dbPath: string | undefined;
|
|
18
21
|
client?: PGlite | typeof Pool | undefined;
|
|
22
|
+
https?: {
|
|
23
|
+
keyPath: string;
|
|
24
|
+
certPath: string;
|
|
25
|
+
};
|
|
19
26
|
};
|
|
20
27
|
|
|
21
28
|
const DEFAULT_PORT = 4000;
|
|
@@ -41,6 +48,18 @@ export async function startAPI(
|
|
|
41
48
|
await subgraphManager.init();
|
|
42
49
|
const processorManager = new ProcessorManager(reactor, db, analyticsStore);
|
|
43
50
|
|
|
44
|
-
|
|
51
|
+
if (options.https) {
|
|
52
|
+
const currentDir = process.cwd();
|
|
53
|
+
const server = https.createServer(
|
|
54
|
+
{
|
|
55
|
+
key: fs.readFileSync(path.join(currentDir, options.https.keyPath)),
|
|
56
|
+
cert: fs.readFileSync(path.join(currentDir, options.https.certPath)),
|
|
57
|
+
},
|
|
58
|
+
app,
|
|
59
|
+
);
|
|
60
|
+
server.listen(port);
|
|
61
|
+
} else {
|
|
62
|
+
app.listen(port);
|
|
63
|
+
}
|
|
45
64
|
return { app, subgraphManager, processorManager };
|
|
46
65
|
}
|
package/src/subgraphs/manager.ts
CHANGED
|
@@ -35,7 +35,7 @@ export class SubgraphManager {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
async init() {
|
|
38
|
-
console.log(`Initializing
|
|
38
|
+
console.log(`Initializing Subgraph Manager...`);
|
|
39
39
|
const models = this.reactor.getDocumentModels();
|
|
40
40
|
const driveModel = models.find(
|
|
41
41
|
(it) => it.documentModel.name === "DocumentDrive",
|