@powerhousedao/reactor-api 1.10.4 → 1.10.5
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 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/server.ts +2 -2
- package/src/utils/get-knex-client.ts +5 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/reactor-api",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"@types/pg": "^8.11.10",
|
|
21
21
|
"esbuild": "^0.24.0",
|
|
22
22
|
"graphql-tag": "^2.12.6",
|
|
23
|
-
"@powerhousedao/scalars": "1.13.0",
|
|
24
23
|
"document-drive": "1.11.1",
|
|
25
|
-
"document-model": "2.13.0"
|
|
24
|
+
"document-model": "2.13.0",
|
|
25
|
+
"@powerhousedao/scalars": "1.13.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@apollo/server": "^4.11.0",
|
package/src/server.ts
CHANGED
|
@@ -17,7 +17,7 @@ import { initialize } from "./subgraphs/analytics";
|
|
|
17
17
|
type Options = {
|
|
18
18
|
express?: Express;
|
|
19
19
|
port?: number;
|
|
20
|
-
|
|
20
|
+
dbPath: string | undefined;
|
|
21
21
|
client?: PGlite | typeof Pool | undefined;
|
|
22
22
|
};
|
|
23
23
|
|
|
@@ -30,7 +30,7 @@ export async function startAPI(
|
|
|
30
30
|
const port = options.port ?? DEFAULT_PORT;
|
|
31
31
|
const app = options.express ?? express();
|
|
32
32
|
|
|
33
|
-
const knex = getKnexClient(options.
|
|
33
|
+
const knex = getKnexClient(options.dbPath);
|
|
34
34
|
await initialize(knex);
|
|
35
35
|
|
|
36
36
|
const analyticsStore = new KnexAnalyticsStore({
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PGlite } from "@electric-sql/pglite";
|
|
1
2
|
import pkg from "knex";
|
|
2
3
|
import ClientPgLite from "knex-pglite";
|
|
3
4
|
const knex = pkg;
|
|
@@ -9,15 +10,13 @@ function isPG(connectionString: string) {
|
|
|
9
10
|
return false;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
export function getKnexClient(connectionString: string) {
|
|
13
|
-
const isPg = isPG(connectionString);
|
|
13
|
+
export function getKnexClient(connectionString: string | undefined) {
|
|
14
|
+
const isPg = connectionString && isPG(connectionString);
|
|
14
15
|
const client = isPg ? "pg" : (ClientPgLite as typeof knex.Client);
|
|
15
|
-
const connection = connectionString;
|
|
16
16
|
|
|
17
17
|
return knex({
|
|
18
18
|
client,
|
|
19
|
-
|
|
19
|
+
// @ts-expect-error
|
|
20
|
+
connection: { pglite: new PGlite(connectionString) },
|
|
20
21
|
});
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
export function getDrizzleClient(connectionString: string) {}
|