@powerhousedao/reactor-api 1.18.0 → 1.19.0
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 -11
- package/dist/index.d.ts +4 -0
- package/dist/index.js +86 -74
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/server.ts +24 -5
- package/src/subgraphs/manager.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
## 1.
|
|
1
|
+
## 1.19.0 (2025-01-29)
|
|
2
2
|
|
|
3
3
|
### 🚀 Features
|
|
4
4
|
|
|
5
|
-
- **
|
|
6
|
-
- **
|
|
7
|
-
- **
|
|
8
|
-
- **ph-cli:**
|
|
5
|
+
- **monorepo:** move ph-cmd to clis directory ([8182595c](https://github.com/powerhouse-inc/powerhouse/commit/8182595c))
|
|
6
|
+
- **monorepo:** move ph cli to clis directory ([5b677ebd](https://github.com/powerhouse-inc/powerhouse/commit/5b677ebd))
|
|
7
|
+
- **reactor-api:** added https support ([8a7b8b7a](https://github.com/powerhouse-inc/powerhouse/commit/8a7b8b7a))
|
|
8
|
+
- **ph-cli:** rename reactor to switchboard ([#947](https://github.com/powerhouse-inc/powerhouse/pull/947))
|
|
9
9
|
|
|
10
10
|
### 🩹 Fixes
|
|
11
11
|
|
|
12
|
-
- **ph-cmd:**
|
|
13
|
-
- **ph-cli:** update connect dep ([#919](https://github.com/powerhouse-inc/powerhouse/pull/919))
|
|
12
|
+
- **ph-cmd:** inject ph-cmd version in build time ([#934](https://github.com/powerhouse-inc/powerhouse/pull/934))
|
|
14
13
|
|
|
15
14
|
### 🧱 Updated Dependencies
|
|
16
15
|
|
|
17
|
-
- Updated document-model-libs to 1.
|
|
18
|
-
- Updated document-drive to 1.16.
|
|
19
|
-
- Updated @powerhousedao/scalars to 1.21.0
|
|
16
|
+
- Updated document-model-libs to 1.130.0
|
|
17
|
+
- Updated document-drive to 1.16.2
|
|
20
18
|
|
|
21
19
|
### ❤️ Thank You
|
|
22
20
|
|
|
23
|
-
- acaldas @acaldas
|
|
24
21
|
- Frank @froid1911
|
|
25
22
|
- Guillermo Puente Sandoval @gpuente
|
|
26
23
|
- ryanwolhuter @ryanwolhuter
|
package/dist/index.d.ts
CHANGED
|
@@ -484,6 +484,10 @@ type Options = {
|
|
|
484
484
|
port?: number;
|
|
485
485
|
dbPath: string | undefined;
|
|
486
486
|
client?: PGlite | typeof Pool | undefined;
|
|
487
|
+
https?: {
|
|
488
|
+
keyPath: string;
|
|
489
|
+
certPath: string;
|
|
490
|
+
};
|
|
487
491
|
};
|
|
488
492
|
declare function startAPI(reactor: IDocumentDriveServer, options: Options): Promise<API>;
|
|
489
493
|
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { KnexAnalyticsStore, KnexQueryExecutor } from '@powerhousedao/analytics-engine-knex';
|
|
1
2
|
import express2, { Router } from 'express';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import https from 'node:https';
|
|
2
5
|
import * as analytics_engine_core_star from '@powerhousedao/analytics-engine-core';
|
|
3
6
|
import { AnalyticsQueryEngine, AnalyticsPath, AnalyticsGranularity } from '@powerhousedao/analytics-engine-core';
|
|
4
7
|
export * from '@powerhousedao/analytics-engine-core';
|
|
@@ -12,9 +15,7 @@ import { GraphQLError as GraphQLError$1, parse } from 'graphql';
|
|
|
12
15
|
import { actions } from 'document-model-libs/document-drive';
|
|
13
16
|
import z3, { z as z$1, ZodError as ZodError$1 } from 'zod';
|
|
14
17
|
import crypto from 'node:crypto';
|
|
15
|
-
import
|
|
16
|
-
import https from 'node:https';
|
|
17
|
-
import { join } from 'node:path';
|
|
18
|
+
import path, { join } from 'node:path';
|
|
18
19
|
import 'graphql-request';
|
|
19
20
|
import 'nanoevents';
|
|
20
21
|
import dotenv from 'dotenv';
|
|
@@ -26,7 +27,6 @@ import wildcard from 'wildcard-match';
|
|
|
26
27
|
import { PGlite } from '@electric-sql/pglite';
|
|
27
28
|
import knex from 'knex';
|
|
28
29
|
import ClientPgLite from 'knex-pglite';
|
|
29
|
-
import { KnexAnalyticsStore, KnexQueryExecutor } from '@powerhousedao/analytics-engine-knex';
|
|
30
30
|
|
|
31
31
|
var __create = Object.create;
|
|
32
32
|
var __defProp = Object.defineProperty;
|
|
@@ -2916,8 +2916,8 @@ var require_utils = __commonJS({
|
|
|
2916
2916
|
var result = transform[inputType][outputType](input);
|
|
2917
2917
|
return result;
|
|
2918
2918
|
};
|
|
2919
|
-
exports.resolve = function(
|
|
2920
|
-
var parts =
|
|
2919
|
+
exports.resolve = function(path2) {
|
|
2920
|
+
var parts = path2.split("/");
|
|
2921
2921
|
var result = [];
|
|
2922
2922
|
for (var index2 = 0; index2 < parts.length; index2++) {
|
|
2923
2923
|
var part = parts[index2];
|
|
@@ -8732,18 +8732,18 @@ var require_object = __commonJS({
|
|
|
8732
8732
|
var object = new ZipObject(name, zipObjectContent, o);
|
|
8733
8733
|
this.files[name] = object;
|
|
8734
8734
|
};
|
|
8735
|
-
var parentFolder = function(
|
|
8736
|
-
if (
|
|
8737
|
-
|
|
8735
|
+
var parentFolder = function(path2) {
|
|
8736
|
+
if (path2.slice(-1) === "/") {
|
|
8737
|
+
path2 = path2.substring(0, path2.length - 1);
|
|
8738
8738
|
}
|
|
8739
|
-
var lastSlash =
|
|
8740
|
-
return lastSlash > 0 ?
|
|
8739
|
+
var lastSlash = path2.lastIndexOf("/");
|
|
8740
|
+
return lastSlash > 0 ? path2.substring(0, lastSlash) : "";
|
|
8741
8741
|
};
|
|
8742
|
-
var forceTrailingSlash = function(
|
|
8743
|
-
if (
|
|
8744
|
-
|
|
8742
|
+
var forceTrailingSlash = function(path2) {
|
|
8743
|
+
if (path2.slice(-1) !== "/") {
|
|
8744
|
+
path2 += "/";
|
|
8745
8745
|
}
|
|
8746
|
-
return
|
|
8746
|
+
return path2;
|
|
8747
8747
|
};
|
|
8748
8748
|
var folderAdd = function(name, createFolders) {
|
|
8749
8749
|
createFolders = typeof createFolders !== "undefined" ? createFolders : defaults.createFolders;
|
|
@@ -10131,10 +10131,10 @@ var GraphQLError = class _GraphQLError extends Error {
|
|
|
10131
10131
|
*/
|
|
10132
10132
|
constructor(message, ...rawArgs) {
|
|
10133
10133
|
var _this$nodes, _nodeLocations$, _ref;
|
|
10134
|
-
const { nodes, source, positions, path, originalError, extensions } = toNormalizedOptions(rawArgs);
|
|
10134
|
+
const { nodes, source, positions, path: path2, originalError, extensions } = toNormalizedOptions(rawArgs);
|
|
10135
10135
|
super(message);
|
|
10136
10136
|
this.name = "GraphQLError";
|
|
10137
|
-
this.path =
|
|
10137
|
+
this.path = path2 !== null && path2 !== void 0 ? path2 : void 0;
|
|
10138
10138
|
this.originalError = originalError !== null && originalError !== void 0 ? originalError : void 0;
|
|
10139
10139
|
this.nodes = undefinedIfEmpty(
|
|
10140
10140
|
Array.isArray(nodes) ? nodes : nodes ? [nodes] : void 0
|
|
@@ -10835,8 +10835,8 @@ function getErrorMap() {
|
|
|
10835
10835
|
return overrideErrorMap;
|
|
10836
10836
|
}
|
|
10837
10837
|
var makeIssue = (params) => {
|
|
10838
|
-
const { data, path, errorMaps, issueData } = params;
|
|
10839
|
-
const fullPath = [...
|
|
10838
|
+
const { data, path: path2, errorMaps, issueData } = params;
|
|
10839
|
+
const fullPath = [...path2, ...issueData.path || []];
|
|
10840
10840
|
const fullIssue = {
|
|
10841
10841
|
...issueData,
|
|
10842
10842
|
path: fullPath
|
|
@@ -10958,11 +10958,11 @@ var errorUtil;
|
|
|
10958
10958
|
var _ZodEnum_cache;
|
|
10959
10959
|
var _ZodNativeEnum_cache;
|
|
10960
10960
|
var ParseInputLazyPath = class {
|
|
10961
|
-
constructor(parent, value,
|
|
10961
|
+
constructor(parent, value, path2, key) {
|
|
10962
10962
|
this._cachedPath = [];
|
|
10963
10963
|
this.parent = parent;
|
|
10964
10964
|
this.data = value;
|
|
10965
|
-
this._path =
|
|
10965
|
+
this._path = path2;
|
|
10966
10966
|
this._key = key;
|
|
10967
10967
|
}
|
|
10968
10968
|
get path() {
|
|
@@ -21932,7 +21932,7 @@ function isDraftable(value, options) {
|
|
|
21932
21932
|
let markResult;
|
|
21933
21933
|
return Object.getPrototypeOf(value) === Object.prototype || Array.isArray(value) || value instanceof Map || value instanceof Set || !!(options === null || options === void 0 ? void 0 : options.mark) && ((markResult = options.mark(value, dataTypes)) === dataTypes.immutable || typeof markResult === "function");
|
|
21934
21934
|
}
|
|
21935
|
-
function getPath(target,
|
|
21935
|
+
function getPath(target, path2 = []) {
|
|
21936
21936
|
if (Object.hasOwnProperty.call(target, "key")) {
|
|
21937
21937
|
const parentCopy = target.parent.copy;
|
|
21938
21938
|
const proxyDraft = getProxyDraft(get(parentCopy, target.key));
|
|
@@ -21943,18 +21943,18 @@ function getPath(target, path = []) {
|
|
|
21943
21943
|
const key = isSet ? Array.from(target.parent.setMap.keys()).indexOf(target.key) : target.key;
|
|
21944
21944
|
if (!(isSet && parentCopy.size > key || has(parentCopy, key)))
|
|
21945
21945
|
return null;
|
|
21946
|
-
|
|
21946
|
+
path2.push(key);
|
|
21947
21947
|
}
|
|
21948
21948
|
if (target.parent) {
|
|
21949
|
-
return getPath(target.parent,
|
|
21949
|
+
return getPath(target.parent, path2);
|
|
21950
21950
|
}
|
|
21951
|
-
|
|
21951
|
+
path2.reverse();
|
|
21952
21952
|
try {
|
|
21953
|
-
resolvePath(target.copy,
|
|
21953
|
+
resolvePath(target.copy, path2);
|
|
21954
21954
|
} catch (e) {
|
|
21955
21955
|
return null;
|
|
21956
21956
|
}
|
|
21957
|
-
return
|
|
21957
|
+
return path2;
|
|
21958
21958
|
}
|
|
21959
21959
|
function getType(target) {
|
|
21960
21960
|
if (Array.isArray(target))
|
|
@@ -21996,20 +21996,20 @@ function revokeProxy(proxyDraft) {
|
|
|
21996
21996
|
revoke();
|
|
21997
21997
|
}
|
|
21998
21998
|
}
|
|
21999
|
-
function escapePath(
|
|
22000
|
-
return pathAsArray ?
|
|
21999
|
+
function escapePath(path2, pathAsArray) {
|
|
22000
|
+
return pathAsArray ? path2 : [""].concat(path2).map((_item) => {
|
|
22001
22001
|
const item = `${_item}`;
|
|
22002
22002
|
if (item.indexOf("/") === -1 && item.indexOf("~") === -1)
|
|
22003
22003
|
return item;
|
|
22004
22004
|
return item.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
22005
22005
|
}).join("/");
|
|
22006
22006
|
}
|
|
22007
|
-
function resolvePath(base,
|
|
22008
|
-
for (let index2 = 0; index2 <
|
|
22009
|
-
const key =
|
|
22007
|
+
function resolvePath(base, path2) {
|
|
22008
|
+
for (let index2 = 0; index2 < path2.length - 1; index2 += 1) {
|
|
22009
|
+
const key = path2[index2];
|
|
22010
22010
|
base = get(getType(base) === 3 ? Array.from(base) : base, key);
|
|
22011
22011
|
if (typeof base !== "object") {
|
|
22012
|
-
throw new Error(`Cannot resolve patch at '${
|
|
22012
|
+
throw new Error(`Cannot resolve patch at '${path2.join("/")}'.`);
|
|
22013
22013
|
}
|
|
22014
22014
|
}
|
|
22015
22015
|
return base;
|
|
@@ -22314,16 +22314,16 @@ function generateArrayPatches(proxyState, basePath, patches, inversePatches, pat
|
|
|
22314
22314
|
for (let index2 = 0; index2 < original.length; index2 += 1) {
|
|
22315
22315
|
if (assignedMap.get(index2.toString()) && copy[index2] !== original[index2]) {
|
|
22316
22316
|
const _path = basePath.concat([index2]);
|
|
22317
|
-
const
|
|
22317
|
+
const path2 = escapePath(_path, pathAsArray);
|
|
22318
22318
|
patches.push({
|
|
22319
22319
|
op: Operation.Replace,
|
|
22320
|
-
path,
|
|
22320
|
+
path: path2,
|
|
22321
22321
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
22322
22322
|
value: cloneIfNeeded(copy[index2])
|
|
22323
22323
|
});
|
|
22324
22324
|
inversePatches.push({
|
|
22325
22325
|
op: Operation.Replace,
|
|
22326
|
-
path,
|
|
22326
|
+
path: path2,
|
|
22327
22327
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
22328
22328
|
value: cloneIfNeeded(original[index2])
|
|
22329
22329
|
});
|
|
@@ -22331,10 +22331,10 @@ function generateArrayPatches(proxyState, basePath, patches, inversePatches, pat
|
|
|
22331
22331
|
}
|
|
22332
22332
|
for (let index2 = original.length; index2 < copy.length; index2 += 1) {
|
|
22333
22333
|
const _path = basePath.concat([index2]);
|
|
22334
|
-
const
|
|
22334
|
+
const path2 = escapePath(_path, pathAsArray);
|
|
22335
22335
|
patches.push({
|
|
22336
22336
|
op: Operation.Add,
|
|
22337
|
-
path,
|
|
22337
|
+
path: path2,
|
|
22338
22338
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
22339
22339
|
value: cloneIfNeeded(copy[index2])
|
|
22340
22340
|
});
|
|
@@ -22343,19 +22343,19 @@ function generateArrayPatches(proxyState, basePath, patches, inversePatches, pat
|
|
|
22343
22343
|
const { arrayLengthAssignment = true } = options.enablePatches;
|
|
22344
22344
|
if (arrayLengthAssignment) {
|
|
22345
22345
|
const _path = basePath.concat(["length"]);
|
|
22346
|
-
const
|
|
22346
|
+
const path2 = escapePath(_path, pathAsArray);
|
|
22347
22347
|
inversePatches.push({
|
|
22348
22348
|
op: Operation.Replace,
|
|
22349
|
-
path,
|
|
22349
|
+
path: path2,
|
|
22350
22350
|
value: original.length
|
|
22351
22351
|
});
|
|
22352
22352
|
} else {
|
|
22353
22353
|
for (let index2 = copy.length; original.length < index2; index2 -= 1) {
|
|
22354
22354
|
const _path = basePath.concat([index2 - 1]);
|
|
22355
|
-
const
|
|
22355
|
+
const path2 = escapePath(_path, pathAsArray);
|
|
22356
22356
|
inversePatches.push({
|
|
22357
22357
|
op: Operation.Remove,
|
|
22358
|
-
path
|
|
22358
|
+
path: path2
|
|
22359
22359
|
});
|
|
22360
22360
|
}
|
|
22361
22361
|
}
|
|
@@ -22369,9 +22369,9 @@ function generatePatchesFromAssigned({ original, copy, assignedMap }, basePath,
|
|
|
22369
22369
|
if (isEqual(originalValue, value) && op === Operation.Replace)
|
|
22370
22370
|
return;
|
|
22371
22371
|
const _path = basePath.concat(key);
|
|
22372
|
-
const
|
|
22373
|
-
patches.push(op === Operation.Remove ? { op, path } : { op, path, value });
|
|
22374
|
-
inversePatches.push(op === Operation.Add ? { op: Operation.Remove, path } : op === Operation.Remove ? { op: Operation.Add, path, value: originalValue } : { op: Operation.Replace, path, value: originalValue });
|
|
22372
|
+
const path2 = escapePath(_path, pathAsArray);
|
|
22373
|
+
patches.push(op === Operation.Remove ? { op, path: path2 } : { op, path: path2, value });
|
|
22374
|
+
inversePatches.push(op === Operation.Add ? { op: Operation.Remove, path: path2 } : op === Operation.Remove ? { op: Operation.Add, path: path2, value: originalValue } : { op: Operation.Replace, path: path2, value: originalValue });
|
|
22375
22375
|
});
|
|
22376
22376
|
}
|
|
22377
22377
|
function generateSetPatches({ original, copy }, basePath, patches, inversePatches, pathAsArray) {
|
|
@@ -22379,15 +22379,15 @@ function generateSetPatches({ original, copy }, basePath, patches, inversePatche
|
|
|
22379
22379
|
original.forEach((value) => {
|
|
22380
22380
|
if (!copy.has(value)) {
|
|
22381
22381
|
const _path = basePath.concat([index2]);
|
|
22382
|
-
const
|
|
22382
|
+
const path2 = escapePath(_path, pathAsArray);
|
|
22383
22383
|
patches.push({
|
|
22384
22384
|
op: Operation.Remove,
|
|
22385
|
-
path,
|
|
22385
|
+
path: path2,
|
|
22386
22386
|
value
|
|
22387
22387
|
});
|
|
22388
22388
|
inversePatches.unshift({
|
|
22389
22389
|
op: Operation.Add,
|
|
22390
|
-
path,
|
|
22390
|
+
path: path2,
|
|
22391
22391
|
value
|
|
22392
22392
|
});
|
|
22393
22393
|
}
|
|
@@ -22397,15 +22397,15 @@ function generateSetPatches({ original, copy }, basePath, patches, inversePatche
|
|
|
22397
22397
|
copy.forEach((value) => {
|
|
22398
22398
|
if (!original.has(value)) {
|
|
22399
22399
|
const _path = basePath.concat([index2]);
|
|
22400
|
-
const
|
|
22400
|
+
const path2 = escapePath(_path, pathAsArray);
|
|
22401
22401
|
patches.push({
|
|
22402
22402
|
op: Operation.Add,
|
|
22403
|
-
path,
|
|
22403
|
+
path: path2,
|
|
22404
22404
|
value
|
|
22405
22405
|
});
|
|
22406
22406
|
inversePatches.unshift({
|
|
22407
22407
|
op: Operation.Remove,
|
|
22408
|
-
path,
|
|
22408
|
+
path: path2,
|
|
22409
22409
|
value
|
|
22410
22410
|
});
|
|
22411
22411
|
}
|
|
@@ -23834,9 +23834,9 @@ cjsModule.configure;
|
|
|
23834
23834
|
function generateUUID(options) {
|
|
23835
23835
|
return crypto.randomUUID(options);
|
|
23836
23836
|
}
|
|
23837
|
-
function writeFile(
|
|
23838
|
-
const filePath = join(
|
|
23839
|
-
fs.mkdirSync(
|
|
23837
|
+
function writeFile(path2, name, data) {
|
|
23838
|
+
const filePath = join(path2, name);
|
|
23839
|
+
fs.mkdirSync(path2, { recursive: true });
|
|
23840
23840
|
return new Promise((resolve, reject) => {
|
|
23841
23841
|
try {
|
|
23842
23842
|
fs.writeFile(filePath, data, {}, (err) => {
|
|
@@ -23851,8 +23851,8 @@ function writeFile(path, name, data) {
|
|
|
23851
23851
|
}
|
|
23852
23852
|
});
|
|
23853
23853
|
}
|
|
23854
|
-
function readFile(
|
|
23855
|
-
return fs.readFileSync(
|
|
23854
|
+
function readFile(path2) {
|
|
23855
|
+
return fs.readFileSync(path2);
|
|
23856
23856
|
}
|
|
23857
23857
|
function fetchFile(url) {
|
|
23858
23858
|
return new Promise((resolve, reject) => {
|
|
@@ -24384,12 +24384,12 @@ var Mime = class {
|
|
|
24384
24384
|
}
|
|
24385
24385
|
return this;
|
|
24386
24386
|
}
|
|
24387
|
-
getType(
|
|
24388
|
-
if (typeof
|
|
24387
|
+
getType(path2) {
|
|
24388
|
+
if (typeof path2 !== "string")
|
|
24389
24389
|
return null;
|
|
24390
|
-
const last =
|
|
24390
|
+
const last = path2.replace(/^.*[/\\]/, "").toLowerCase();
|
|
24391
24391
|
const ext = last.replace(/^.*\./, "").toLowerCase();
|
|
24392
|
-
const hasPath = last.length <
|
|
24392
|
+
const hasPath = last.length < path2.length;
|
|
24393
24393
|
const hasDot = ext.length < last.length - 1;
|
|
24394
24394
|
if (!hasDot && hasPath)
|
|
24395
24395
|
return null;
|
|
@@ -24841,7 +24841,7 @@ var createZip = async (document) => {
|
|
|
24841
24841
|
}
|
|
24842
24842
|
return zip;
|
|
24843
24843
|
};
|
|
24844
|
-
var saveToFile = async (document,
|
|
24844
|
+
var saveToFile = async (document, path2, extension, name) => {
|
|
24845
24845
|
const zip = await createZip(document);
|
|
24846
24846
|
const file = await zip.generateAsync({
|
|
24847
24847
|
type: "uint8array",
|
|
@@ -24850,7 +24850,7 @@ var saveToFile = async (document, path, extension, name) => {
|
|
|
24850
24850
|
const fileName = name ?? document.name;
|
|
24851
24851
|
const fileExtension = `.${extension}.zip`;
|
|
24852
24852
|
return writeFile(
|
|
24853
|
-
|
|
24853
|
+
path2,
|
|
24854
24854
|
fileName.endsWith(fileExtension) ? fileName : `${fileName}${fileExtension}`,
|
|
24855
24855
|
file
|
|
24856
24856
|
);
|
|
@@ -24862,8 +24862,8 @@ var saveToFileHandle = async (document, input) => {
|
|
|
24862
24862
|
await writable.write(blob);
|
|
24863
24863
|
await writable.close();
|
|
24864
24864
|
};
|
|
24865
|
-
var loadFromFile = async (
|
|
24866
|
-
const file = readFile(
|
|
24865
|
+
var loadFromFile = async (path2, reducer, options) => {
|
|
24866
|
+
const file = readFile(path2);
|
|
24867
24867
|
return loadFromInput(file, reducer, options);
|
|
24868
24868
|
};
|
|
24869
24869
|
var loadFromInput = async (input, reducer, options) => {
|
|
@@ -24929,10 +24929,10 @@ async function getRemoteFile(url) {
|
|
|
24929
24929
|
...attributes
|
|
24930
24930
|
};
|
|
24931
24931
|
}
|
|
24932
|
-
async function getLocalFile(
|
|
24933
|
-
const buffer = await getFile(
|
|
24934
|
-
const mimeType = mime.getType(
|
|
24935
|
-
const attributes = getFileAttributes(
|
|
24932
|
+
async function getLocalFile(path2) {
|
|
24933
|
+
const buffer = await getFile(path2);
|
|
24934
|
+
const mimeType = mime.getType(path2) || "application/octet-stream";
|
|
24935
|
+
const attributes = getFileAttributes(path2);
|
|
24936
24936
|
const data = buffer.toString("base64");
|
|
24937
24937
|
return { data, hash: hash(data), mimeType, ...attributes };
|
|
24938
24938
|
}
|
|
@@ -26732,8 +26732,8 @@ var AuthSubgraph = class extends Subgraph {
|
|
|
26732
26732
|
|
|
26733
26733
|
// src/subgraphs/manager.ts
|
|
26734
26734
|
var SubgraphManager = class {
|
|
26735
|
-
constructor(
|
|
26736
|
-
this.path =
|
|
26735
|
+
constructor(path2, app, reactor, operationalStore, analyticsStore) {
|
|
26736
|
+
this.path = path2;
|
|
26737
26737
|
this.app = app;
|
|
26738
26738
|
this.reactor = reactor;
|
|
26739
26739
|
this.operationalStore = operationalStore;
|
|
@@ -26747,7 +26747,7 @@ var SubgraphManager = class {
|
|
|
26747
26747
|
contextFields = {};
|
|
26748
26748
|
subgraphs = [];
|
|
26749
26749
|
async init() {
|
|
26750
|
-
console.log(`Initializing
|
|
26750
|
+
console.log(`Initializing Subgraph Manager...`);
|
|
26751
26751
|
const models = this.reactor.getDocumentModels();
|
|
26752
26752
|
const driveModel = models.find(
|
|
26753
26753
|
(it) => it.documentModel.name === "DocumentDrive"
|
|
@@ -26782,9 +26782,9 @@ var SubgraphManager = class {
|
|
|
26782
26782
|
plugins: [ApolloServerPluginInlineTraceDisabled()]
|
|
26783
26783
|
});
|
|
26784
26784
|
await server.start();
|
|
26785
|
-
const
|
|
26785
|
+
const path2 = `/${subgraphConfig.name}`;
|
|
26786
26786
|
newRouter.use(
|
|
26787
|
-
|
|
26787
|
+
path2,
|
|
26788
26788
|
// @ts-ignore
|
|
26789
26789
|
expressMiddleware(server, {
|
|
26790
26790
|
context: ({ req }) => ({
|
|
@@ -26856,7 +26856,19 @@ async function startAPI(reactor, options) {
|
|
|
26856
26856
|
);
|
|
26857
26857
|
await subgraphManager.init();
|
|
26858
26858
|
const processorManager = new ProcessorManager(reactor, db, analyticsStore);
|
|
26859
|
-
|
|
26859
|
+
if (options.https) {
|
|
26860
|
+
const currentDir = process.cwd();
|
|
26861
|
+
const server = https.createServer(
|
|
26862
|
+
{
|
|
26863
|
+
key: fs.readFileSync(path.join(currentDir, options.https.keyPath)),
|
|
26864
|
+
cert: fs.readFileSync(path.join(currentDir, options.https.certPath))
|
|
26865
|
+
},
|
|
26866
|
+
app
|
|
26867
|
+
);
|
|
26868
|
+
server.listen(port);
|
|
26869
|
+
} else {
|
|
26870
|
+
app.listen(port);
|
|
26871
|
+
}
|
|
26860
26872
|
return { app, subgraphManager, processorManager };
|
|
26861
26873
|
}
|
|
26862
26874
|
|