@powerhousedao/reactor-local 6.0.0-dev.152 → 6.0.0-dev.154
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.mts +75 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +136 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +16 -9
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -3
- package/dist/index.js.map +0 -1
- package/dist/src/cli.d.ts +0 -3
- package/dist/src/cli.d.ts.map +0 -1
- package/dist/src/cli.js +0 -12
- package/dist/src/cli.js.map +0 -1
- package/dist/src/feature-flags.d.ts +0 -2
- package/dist/src/feature-flags.d.ts.map +0 -1
- package/dist/src/feature-flags.js +0 -9
- package/dist/src/feature-flags.js.map +0 -1
- package/dist/src/server.d.ts +0 -4
- package/dist/src/server.d.ts.map +0 -1
- package/dist/src/server.js +0 -137
- package/dist/src/server.js.map +0 -1
- package/dist/src/types.d.ts +0 -57
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -25
- package/dist/src/types.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { DriveInput } from "@powerhousedao/shared/document-drive";
|
|
2
|
+
|
|
3
|
+
//#region ../config/dist/index.d.ts
|
|
4
|
+
//#region src/powerhouse.d.ts
|
|
5
|
+
declare const LogLevels: {
|
|
6
|
+
readonly verbose: 1;
|
|
7
|
+
readonly debug: 2;
|
|
8
|
+
readonly info: 3;
|
|
9
|
+
readonly warn: 4;
|
|
10
|
+
readonly error: 5;
|
|
11
|
+
readonly silent: 6;
|
|
12
|
+
};
|
|
13
|
+
type LogLevel = keyof typeof LogLevels;
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/types.d.ts
|
|
16
|
+
type RemoteDriveInput = {
|
|
17
|
+
url: string;
|
|
18
|
+
options?: Record<string, unknown>;
|
|
19
|
+
};
|
|
20
|
+
type RemoteDriveInputSimple = string | RemoteDriveInput;
|
|
21
|
+
type StorageOptions = {
|
|
22
|
+
type: "filesystem" | "memory" | "postgres" | "browser";
|
|
23
|
+
filesystemPath?: string;
|
|
24
|
+
postgresUrl?: string;
|
|
25
|
+
};
|
|
26
|
+
type StartServerOptions = {
|
|
27
|
+
configFile?: string;
|
|
28
|
+
dev?: boolean;
|
|
29
|
+
port?: string | number;
|
|
30
|
+
storage?: StorageOptions;
|
|
31
|
+
dbPath?: string;
|
|
32
|
+
drive?: DriveInput;
|
|
33
|
+
disableDefaultDrive?: boolean;
|
|
34
|
+
packages?: string[];
|
|
35
|
+
https?: {
|
|
36
|
+
keyPath: string;
|
|
37
|
+
certPath: string;
|
|
38
|
+
} | boolean | undefined;
|
|
39
|
+
logLevel?: LogLevel;
|
|
40
|
+
remoteDrives?: RemoteDriveInputSimple[];
|
|
41
|
+
mcp?: boolean;
|
|
42
|
+
};
|
|
43
|
+
declare const DefaultStartServerOptions: {
|
|
44
|
+
port: number;
|
|
45
|
+
storage: {
|
|
46
|
+
type: "filesystem";
|
|
47
|
+
filesystemPath: string;
|
|
48
|
+
};
|
|
49
|
+
dbPath: string;
|
|
50
|
+
drive: {
|
|
51
|
+
id: string;
|
|
52
|
+
slug: string;
|
|
53
|
+
global: {
|
|
54
|
+
name: string;
|
|
55
|
+
icon: string;
|
|
56
|
+
};
|
|
57
|
+
local: {
|
|
58
|
+
availableOffline: true;
|
|
59
|
+
listeners: never[];
|
|
60
|
+
sharingType: string;
|
|
61
|
+
triggers: never[];
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
mcp: true;
|
|
65
|
+
};
|
|
66
|
+
type LocalReactor = {
|
|
67
|
+
driveUrl: string | null;
|
|
68
|
+
getDocumentPath: (driveId: string, documentId: string) => string;
|
|
69
|
+
};
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/server.d.ts
|
|
72
|
+
declare const startServer: (options?: StartServerOptions) => Promise<LocalReactor>;
|
|
73
|
+
//#endregion
|
|
74
|
+
export { DefaultStartServerOptions, type LocalReactor, type RemoteDriveInputSimple, type StartServerOptions, startServer };
|
|
75
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["DEFAULT_CONFIG","DocumentModelModule","Manifest","PHPackageProvider","PowerhouseConfig","PowerhouseModule","PowerhousePackage","Publisher","LogLevels","verbose","debug","info","warn","error","silent","LogLevel","isLogLevel","value","DEFAULT_REGISTRY_URL","VetraProcessorConfigType","interactive","driveUrl","driveId","resolveRegistryConfig","Record","config","env","registryUrl","packageNames","VETRA_PROCESSOR_CONFIG_KEY","PH_PACKAGES"],"sources":["../../config/dist/index.d.ts","../src/types.ts","../src/server.ts"],"mappings":";;;;cAIcQ,SAAAA;EAAAA,SACHC,OAAAA;EAAAA,SACAC,KAAAA;EAAAA,SACAC,IAAAA;EAAAA,SACAC,IAAAA;EAAAA,SACAC,KAAAA;EAAAA,SACAC,MAAAA;AAAAA;AAAAA,KAENC,QAAAA,gBAAwBP,SAAAA;;;KCRjB,gBAAA;EACV,GAAA;EACA,OAAA,GAAU,MAAA;AAAA;AAAA,KAGA,sBAAA,YAAkC,gBAAA;AAAA,KAElC,cAAA;EACV,IAAA;EACA,cAAA;EACA,WAAA;AAAA;AAAA,KAGU,kBAAA;EACV,UAAA;EACA,GAAA;EACA,IAAA;EACA,OAAA,GAAU,cAAA;EACV,MAAA;EACA,KAAA,GAAQ,UAAA;EACR,mBAAA;EACA,QAAA;EACA,KAAA;IAEM,OAAA;IACA,QAAA;EAAA;EAIN,QAAA,GAAW,QAAA;EACX,YAAA,GAAe,sBAAA;EACf,GAAA;AAAA;AAAA,cAGW,yBAAA;;;;;;;;;;;;;;;;;;;;;;;KAwBD,YAAA;EACV,QAAA;EACA,eAAA,GAAkB,OAAA,UAAiB,UAAA;AAAA;;;cCzB/B,WAAA,GACJ,OAAA,GAAU,kBAAA,KACT,OAAA,CAAQ,YAAA"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import "@powerhousedao/shared/clis";
|
|
2
|
+
import { EventBus, ReactorBuilder, ReactorClientBuilder, driveCollectionId, parseDriveUrl } from "@powerhousedao/reactor";
|
|
3
|
+
import { initializeAndStartAPI } from "@powerhousedao/reactor-api";
|
|
4
|
+
import { VitePackageLoader, startViteServer } from "@powerhousedao/reactor-api/vite";
|
|
5
|
+
import { driveCreateDocument, driveCreateState } from "@powerhousedao/shared/document-drive";
|
|
6
|
+
import { logger } from "document-model";
|
|
7
|
+
import dotenv from "dotenv";
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
//#region ../config/dist/index.js
|
|
10
|
+
const LogLevels = {
|
|
11
|
+
verbose: 1,
|
|
12
|
+
debug: 2,
|
|
13
|
+
info: 3,
|
|
14
|
+
warn: 4,
|
|
15
|
+
error: 5,
|
|
16
|
+
silent: 6
|
|
17
|
+
};
|
|
18
|
+
function isLogLevel(value) {
|
|
19
|
+
return typeof value === "string" && value in LogLevels;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/types.ts
|
|
23
|
+
const DefaultStartServerOptions = {
|
|
24
|
+
port: 4001,
|
|
25
|
+
storage: {
|
|
26
|
+
type: "filesystem",
|
|
27
|
+
filesystemPath: path.join(process.cwd(), ".ph/file-storage")
|
|
28
|
+
},
|
|
29
|
+
dbPath: path.join(process.cwd(), ".ph/read-model.db"),
|
|
30
|
+
drive: {
|
|
31
|
+
id: "powerhouse",
|
|
32
|
+
slug: "powerhouse",
|
|
33
|
+
global: {
|
|
34
|
+
name: "Powerhouse",
|
|
35
|
+
icon: "https://ipfs.io/ipfs/QmcaTDBYn8X2psGaXe7iQ6qd8q6oqHLgxvMX9yXf7f9uP7"
|
|
36
|
+
},
|
|
37
|
+
local: {
|
|
38
|
+
availableOffline: true,
|
|
39
|
+
listeners: [],
|
|
40
|
+
sharingType: "public",
|
|
41
|
+
triggers: []
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
mcp: true
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/server.ts
|
|
48
|
+
function normalizeRemoteDriveInput(input) {
|
|
49
|
+
if (typeof input === "string") return { url: input };
|
|
50
|
+
return input;
|
|
51
|
+
}
|
|
52
|
+
dotenv.config();
|
|
53
|
+
const startServer = async (options) => {
|
|
54
|
+
process.setMaxListeners(0);
|
|
55
|
+
const { port, storage, dev, drive, dbPath, packages = [], configFile, logLevel, remoteDrives = [], mcp } = {
|
|
56
|
+
...DefaultStartServerOptions,
|
|
57
|
+
...options
|
|
58
|
+
};
|
|
59
|
+
process.env.LOG_LEVEL = process.env.LOG_LEVEL || (isLogLevel(logLevel) ? logLevel : "info");
|
|
60
|
+
logger.debug(`Setting log level to ${logLevel}.`);
|
|
61
|
+
const serverPort = Number(process.env.PORT ?? port);
|
|
62
|
+
const basePath = process.cwd();
|
|
63
|
+
const vite = dev ? await startViteServer(basePath) : void 0;
|
|
64
|
+
if (dev) packages.push(basePath);
|
|
65
|
+
const initializeClient = async (documentModels) => {
|
|
66
|
+
const eventBus = new EventBus();
|
|
67
|
+
const builder = new ReactorBuilder().withEventBus(eventBus).withDocumentModels(documentModels);
|
|
68
|
+
return new ReactorClientBuilder().withReactorBuilder(builder).buildModule();
|
|
69
|
+
};
|
|
70
|
+
const packageLoaders = vite ? [VitePackageLoader.build(vite)] : void 0;
|
|
71
|
+
const api = await initializeAndStartAPI(initializeClient, {
|
|
72
|
+
port: serverPort,
|
|
73
|
+
dbPath,
|
|
74
|
+
https: options?.https,
|
|
75
|
+
packageLoaders,
|
|
76
|
+
configFile,
|
|
77
|
+
packages,
|
|
78
|
+
mcp
|
|
79
|
+
}, "switchboard");
|
|
80
|
+
if (vite) api.httpAdapter.mountRawMiddleware(vite.middlewares);
|
|
81
|
+
let driveUrl = null;
|
|
82
|
+
if (!options?.disableDefaultDrive) {
|
|
83
|
+
let driveId = drive.id;
|
|
84
|
+
if (!driveId || driveId.length === 0) driveId = drive.slug;
|
|
85
|
+
if (!driveId || driveId.length === 0) throw new Error("Invalid Drive Id");
|
|
86
|
+
try {
|
|
87
|
+
const { global } = driveCreateState();
|
|
88
|
+
const document = driveCreateDocument({
|
|
89
|
+
global: {
|
|
90
|
+
...global,
|
|
91
|
+
name: drive.global.name,
|
|
92
|
+
icon: drive.global.icon ?? global.icon
|
|
93
|
+
},
|
|
94
|
+
local: {
|
|
95
|
+
availableOffline: drive.local?.availableOffline ?? false,
|
|
96
|
+
sharingType: drive.local?.sharingType ?? "public",
|
|
97
|
+
listeners: drive.local?.listeners ?? [],
|
|
98
|
+
triggers: drive.local?.triggers ?? []
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
if (drive.id && drive.id.length > 0) document.header.id = drive.id;
|
|
102
|
+
if (drive.slug && drive.slug.length > 0) document.header.slug = drive.slug;
|
|
103
|
+
if (drive.global.name) document.header.name = drive.global.name;
|
|
104
|
+
await api.client.create(document);
|
|
105
|
+
} catch (e) {
|
|
106
|
+
if (!(e instanceof Error ? e.message : String(e)).includes("already exists")) throw e;
|
|
107
|
+
}
|
|
108
|
+
driveUrl = `http://localhost:${serverPort}/d/${driveId}`;
|
|
109
|
+
}
|
|
110
|
+
if (remoteDrives.length > 0) {
|
|
111
|
+
const processedRemoteDrives = remoteDrives.map(normalizeRemoteDriveInput);
|
|
112
|
+
for (const remoteDrive of processedRemoteDrives) try {
|
|
113
|
+
const parsed = parseDriveUrl(remoteDrive.url);
|
|
114
|
+
const remoteName = `remote-drive-${parsed.driveId}-${crypto.randomUUID()}`;
|
|
115
|
+
await api.syncManager.add(remoteName, driveCollectionId("main", parsed.driveId), {
|
|
116
|
+
type: "gql",
|
|
117
|
+
parameters: { url: parsed.graphqlEndpoint }
|
|
118
|
+
});
|
|
119
|
+
} catch (error) {
|
|
120
|
+
logger.error(` ➜ Failed to connect to remote drive ${remoteDrive.url}:`, error);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (driveUrl) logger.info(` ➜ Reactor: ${driveUrl}`);
|
|
124
|
+
else logger.info(` ➜ Reactor: http://localhost:${serverPort}/graphql (no default drive)`);
|
|
125
|
+
return {
|
|
126
|
+
driveUrl,
|
|
127
|
+
getDocumentPath: (driveId, documentId) => {
|
|
128
|
+
if (!storage.filesystemPath) throw new Error(`"getDocumentPath" is only available with the Filesystem storage adapter.`);
|
|
129
|
+
return path.join(storage.filesystemPath, driveId, `${documentId}.json`);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
//#endregion
|
|
134
|
+
export { DefaultStartServerOptions, startServer };
|
|
135
|
+
|
|
136
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../config/dist/index.js","../src/types.ts","../src/server.ts"],"sourcesContent":["import { DEFAULT_CONFIG } from \"@powerhousedao/shared/clis\";\n//#region src/packages.ts\nconst PH_PACKAGES = [{\n\tpackageName: \"@sky-ph/atlas\",\n\tversion: \"latest\",\n\tprovider: \"npm\",\n\turl: \"https://www.npmjs.com/package/@sky-ph/atlas\"\n}];\n//#endregion\n//#region src/powerhouse.ts\nconst LogLevels = {\n\tverbose: 1,\n\tdebug: 2,\n\tinfo: 3,\n\twarn: 4,\n\terror: 5,\n\tsilent: 6\n};\nfunction isLogLevel(value) {\n\treturn typeof value === \"string\" && value in LogLevels;\n}\nconst DEFAULT_REGISTRY_URL = \"https://registry.prod.vetra.io\";\nfunction resolveRegistryConfig(config, env = {}) {\n\tlet registryUrl = config.packageRegistryUrl;\n\tlet packageNames = config.packages?.filter((p) => p.provider === \"registry\").map((p) => p.packageName) ?? [];\n\tif (env.PH_REGISTRY_URL) registryUrl = env.PH_REGISTRY_URL;\n\tif (env.PH_REGISTRY_PACKAGES) packageNames = env.PH_REGISTRY_PACKAGES.split(\",\").map((p) => p.trim());\n\treturn {\n\t\tregistryUrl,\n\t\tpackageNames\n\t};\n}\nconst VETRA_PROCESSOR_CONFIG_KEY = \"VetraConfig\";\n//#endregion\nexport { DEFAULT_CONFIG, DEFAULT_REGISTRY_URL, LogLevels, PH_PACKAGES, VETRA_PROCESSOR_CONFIG_KEY, isLogLevel, resolveRegistryConfig };\n\n//# sourceMappingURL=index.js.map","import type { LogLevel } from \"@powerhousedao/config\";\nimport type { DriveInput } from \"@powerhousedao/shared/document-drive\";\nimport path from \"node:path\";\n\nexport type RemoteDriveInput = {\n url: string;\n options?: Record<string, unknown>;\n};\n\nexport type RemoteDriveInputSimple = string | RemoteDriveInput;\n\nexport type StorageOptions = {\n type: \"filesystem\" | \"memory\" | \"postgres\" | \"browser\";\n filesystemPath?: string;\n postgresUrl?: string;\n};\n\nexport type StartServerOptions = {\n configFile?: string;\n dev?: boolean;\n port?: string | number;\n storage?: StorageOptions;\n dbPath?: string;\n drive?: DriveInput;\n disableDefaultDrive?: boolean;\n packages?: string[];\n https?:\n | {\n keyPath: string;\n certPath: string;\n }\n | boolean\n | undefined;\n logLevel?: LogLevel;\n remoteDrives?: RemoteDriveInputSimple[];\n mcp?: boolean;\n};\n\nexport const DefaultStartServerOptions = {\n port: 4001,\n storage: {\n type: \"filesystem\",\n filesystemPath: path.join(process.cwd(), \".ph/file-storage\"),\n },\n dbPath: path.join(process.cwd(), \".ph/read-model.db\"),\n drive: {\n id: \"powerhouse\",\n slug: \"powerhouse\",\n global: {\n name: \"Powerhouse\",\n icon: \"https://ipfs.io/ipfs/QmcaTDBYn8X2psGaXe7iQ6qd8q6oqHLgxvMX9yXf7f9uP7\",\n },\n local: {\n availableOffline: true,\n listeners: [],\n sharingType: \"public\",\n triggers: [],\n },\n },\n mcp: true,\n} satisfies StartServerOptions;\n\nexport type LocalReactor = {\n driveUrl: string | null;\n getDocumentPath: (driveId: string, documentId: string) => string;\n};\n","import { isLogLevel } from \"@powerhousedao/config\";\nimport {\n EventBus,\n ReactorBuilder,\n ReactorClientBuilder,\n driveCollectionId,\n parseDriveUrl,\n} from \"@powerhousedao/reactor\";\nimport { initializeAndStartAPI } from \"@powerhousedao/reactor-api\";\nimport {\n VitePackageLoader,\n startViteServer,\n} from \"@powerhousedao/reactor-api/vite\";\nimport {\n driveCreateDocument,\n driveCreateState,\n} from \"@powerhousedao/shared/document-drive\";\nimport { logger, type DocumentModelModule } from \"document-model\";\nimport dotenv from \"dotenv\";\nimport path from \"node:path\";\nimport type {\n LocalReactor,\n RemoteDriveInput,\n RemoteDriveInputSimple,\n StartServerOptions,\n} from \"./types.js\";\nimport { DefaultStartServerOptions } from \"./types.js\";\n\nfunction normalizeRemoteDriveInput(\n input: RemoteDriveInputSimple,\n): RemoteDriveInput {\n if (typeof input === \"string\") {\n return { url: input };\n }\n return input;\n}\n\ndotenv.config();\n\nconst startServer = async (\n options?: StartServerOptions,\n): Promise<LocalReactor> => {\n process.setMaxListeners(0);\n const {\n port,\n storage,\n dev,\n drive,\n dbPath,\n packages = [],\n configFile,\n logLevel,\n remoteDrives = [],\n mcp,\n } = {\n ...DefaultStartServerOptions,\n ...options,\n };\n\n process.env.LOG_LEVEL =\n process.env.LOG_LEVEL || (isLogLevel(logLevel) ? logLevel : \"info\");\n\n // be aware: this may not log anything if the log level is above debug\n logger.debug(`Setting log level to ${logLevel}.`);\n const serverPort = Number(process.env.PORT ?? port);\n\n // TODO get path from powerhouse config\n const basePath = process.cwd();\n // start vite server if dev\n const vite = dev ? await startViteServer(basePath) : undefined;\n\n // get paths to local document models\n if (dev) {\n packages.push(basePath);\n }\n\n const initializeClient = async (documentModels: DocumentModelModule[]) => {\n const eventBus = new EventBus();\n const builder = new ReactorBuilder()\n .withEventBus(eventBus)\n .withDocumentModels(documentModels);\n\n return new ReactorClientBuilder().withReactorBuilder(builder).buildModule();\n };\n\n // create loaders\n const packageLoaders = vite ? [VitePackageLoader.build(vite)] : undefined;\n\n // start api\n const api = await initializeAndStartAPI(\n initializeClient,\n {\n port: serverPort,\n dbPath,\n https: options?.https,\n packageLoaders,\n configFile,\n packages,\n mcp,\n },\n \"switchboard\",\n );\n\n // add vite middleware after express app is initialized if applicable\n if (vite) {\n api.httpAdapter.mountRawMiddleware(vite.middlewares);\n }\n\n // Conditionally add a default drive\n let driveUrl: string | null = null;\n if (!options?.disableDefaultDrive) {\n let driveId = drive.id;\n if (!driveId || driveId.length === 0) {\n driveId = drive.slug;\n }\n if (!driveId || driveId.length === 0) {\n throw new Error(\"Invalid Drive Id\");\n }\n\n try {\n const { global } = driveCreateState();\n const document = driveCreateDocument({\n global: {\n ...global,\n name: drive.global.name,\n icon: drive.global.icon ?? global.icon,\n },\n local: {\n availableOffline: drive.local?.availableOffline ?? false,\n sharingType: drive.local?.sharingType ?? \"public\",\n listeners: drive.local?.listeners ?? [],\n triggers: drive.local?.triggers ?? [],\n },\n });\n\n if (drive.id && drive.id.length > 0) {\n document.header.id = drive.id;\n }\n if (drive.slug && drive.slug.length > 0) {\n document.header.slug = drive.slug;\n }\n if (drive.global.name) {\n document.header.name = drive.global.name;\n }\n\n await api.client.create(document);\n } catch (e) {\n const errorMessage = e instanceof Error ? e.message : String(e);\n if (!errorMessage.includes(\"already exists\")) {\n throw e;\n }\n }\n\n driveUrl = `http://localhost:${serverPort}/d/${driveId}`;\n }\n\n // Add remote drives after full initialization (including PackageManager)\n if (remoteDrives.length > 0) {\n const processedRemoteDrives = remoteDrives.map(normalizeRemoteDriveInput);\n\n for (const remoteDrive of processedRemoteDrives) {\n try {\n const parsed = parseDriveUrl(remoteDrive.url);\n const remoteName = `remote-drive-${parsed.driveId}-${crypto.randomUUID()}`;\n await api.syncManager.add(\n remoteName,\n driveCollectionId(\"main\", parsed.driveId),\n {\n type: \"gql\",\n parameters: { url: parsed.graphqlEndpoint },\n },\n );\n } catch (error) {\n logger.error(\n ` ➜ Failed to connect to remote drive ${remoteDrive.url}:`,\n error,\n );\n }\n }\n }\n\n if (driveUrl) {\n logger.info(` ➜ Reactor: ${driveUrl}`);\n } else {\n logger.info(\n ` ➜ Reactor: http://localhost:${serverPort}/graphql (no default drive)`,\n );\n }\n\n return {\n driveUrl,\n getDocumentPath: (driveId: string, documentId: string): string => {\n if (!storage.filesystemPath) {\n throw new Error(\n `\"getDocumentPath\" is only available with the Filesystem storage adapter.`,\n );\n }\n return path.join(storage.filesystemPath, driveId, `${documentId}.json`);\n },\n };\n};\n\nexport { startServer };\n"],"mappings":";;;;;;;;;AAUA,MAAM,YAAY;CACjB,SAAS;CACT,OAAO;CACP,MAAM;CACN,MAAM;CACN,OAAO;CACP,QAAQ;CACR;AACD,SAAS,WAAW,OAAO;AAC1B,QAAO,OAAO,UAAU,YAAY,SAAS;;;;ACmB9C,MAAa,4BAA4B;CACvC,MAAM;CACN,SAAS;EACP,MAAM;EACN,gBAAgB,KAAK,KAAK,QAAQ,KAAK,EAAE,mBAAmB;EAC7D;CACD,QAAQ,KAAK,KAAK,QAAQ,KAAK,EAAE,oBAAoB;CACrD,OAAO;EACL,IAAI;EACJ,MAAM;EACN,QAAQ;GACN,MAAM;GACN,MAAM;GACP;EACD,OAAO;GACL,kBAAkB;GAClB,WAAW,EAAE;GACb,aAAa;GACb,UAAU,EAAE;GACb;EACF;CACD,KAAK;CACN;;;AChCD,SAAS,0BACP,OACkB;AAClB,KAAI,OAAO,UAAU,SACnB,QAAO,EAAE,KAAK,OAAO;AAEvB,QAAO;;AAGT,OAAO,QAAQ;AAEf,MAAM,cAAc,OAClB,YAC0B;AAC1B,SAAQ,gBAAgB,EAAE;CAC1B,MAAM,EACJ,MACA,SACA,KACA,OACA,QACA,WAAW,EAAE,EACb,YACA,UACA,eAAe,EAAE,EACjB,QACE;EACF,GAAG;EACH,GAAG;EACJ;AAED,SAAQ,IAAI,YACV,QAAQ,IAAI,cAAc,WAAW,SAAS,GAAG,WAAW;AAG9D,QAAO,MAAM,wBAAwB,SAAS,GAAG;CACjD,MAAM,aAAa,OAAO,QAAQ,IAAI,QAAQ,KAAK;CAG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AAI,MAAM,OAAO,KACf,UAAS,OAAO,OAAO,MAAM,OAAO;AAGtC,SAAM,IAAI,OAAO,OAAO,SAAS;WAC1B,GAAG;AAEV,OAAI,EADiB,aAAa,QAAQ,EAAE,UAAU,OAAO,EAAE,EAC7C,SAAS,iBAAiB,CAC1C,OAAM;;AAIV,aAAW,oBAAoB,WAAW,KAAK;;AAIjD,KAAI,aAAa,SAAS,GAAG;EAC3B,MAAM,wBAAwB,aAAa,IAAI,0BAA0B;AAEzE,OAAK,MAAM,eAAe,sBACxB,KAAI;GACF,MAAM,SAAS,cAAc,YAAY,IAAI;GAC7C,MAAM,aAAa,gBAAgB,OAAO,QAAQ,GAAG,OAAO,YAAY;AACxE,SAAM,IAAI,YAAY,IACpB,YACA,kBAAkB,QAAQ,OAAO,QAAQ,EACzC;IACE,MAAM;IACN,YAAY,EAAE,KAAK,OAAO,iBAAiB;IAC5C,CACF;WACM,OAAO;AACd,UAAO,MACL,0CAA0C,YAAY,IAAI,IAC1D,MACD;;;AAKP,KAAI,SACF,QAAO,KAAK,mBAAmB,WAAW;KAE1C,QAAO,KACL,oCAAoC,WAAW,6BAChD;AAGH,QAAO;EACL;EACA,kBAAkB,SAAiB,eAA+B;AAChE,OAAI,CAAC,QAAQ,eACX,OAAM,IAAI,MACR,2EACD;AAEH,UAAO,KAAK,KAAK,QAAQ,gBAAgB,SAAS,GAAG,WAAW,OAAO;;EAE1E"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/reactor-local",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "6.0.0-dev.
|
|
5
|
-
"main": "dist/
|
|
4
|
+
"version": "6.0.0-dev.154",
|
|
5
|
+
"main": "dist/index.mjs",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/powerhouse-inc/powerhouse"
|
|
@@ -10,8 +10,13 @@
|
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
13
|
-
"exports":
|
|
14
|
-
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.mts",
|
|
16
|
+
"import": "./dist/index.mjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"types": "./dist/index.d.mts",
|
|
15
20
|
"files": [
|
|
16
21
|
"./dist"
|
|
17
22
|
],
|
|
@@ -22,16 +27,18 @@
|
|
|
22
27
|
"dotenv": "^16.4.5",
|
|
23
28
|
"@openfeature/env-var-provider": "0.3.1",
|
|
24
29
|
"@openfeature/server-sdk": "1.19.0",
|
|
25
|
-
"@powerhousedao/shared": "6.0.0-dev.
|
|
26
|
-
"@powerhousedao/reactor": "6.0.0-dev.
|
|
27
|
-
"
|
|
28
|
-
"
|
|
30
|
+
"@powerhousedao/shared": "6.0.0-dev.154",
|
|
31
|
+
"@powerhousedao/reactor": "6.0.0-dev.154",
|
|
32
|
+
"document-model": "6.0.0-dev.154",
|
|
33
|
+
"@powerhousedao/reactor-api": "6.0.0-dev.154"
|
|
29
34
|
},
|
|
30
35
|
"devDependencies": {
|
|
31
36
|
"@types/node": "25.2.3",
|
|
32
|
-
"
|
|
37
|
+
"tsdown": "0.21.0",
|
|
38
|
+
"@powerhousedao/config": "6.0.0-dev.154"
|
|
33
39
|
},
|
|
34
40
|
"scripts": {
|
|
41
|
+
"build": "tsdown",
|
|
35
42
|
"tsc": "tsc",
|
|
36
43
|
"lint": "eslint",
|
|
37
44
|
"start": "vite-node src/index.ts"
|
package/dist/index.d.ts
DELETED
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EACL,yBAAyB,EACzB,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,GACxB,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
DELETED
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EACL,yBAAyB,GAI1B,MAAM,gBAAgB,CAAC"}
|
package/dist/src/cli.d.ts
DELETED
package/dist/src/cli.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/src/cli.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { getConfig } from "@powerhousedao/config/node";
|
|
3
|
-
import path from "path";
|
|
4
|
-
import { startServer } from "./server.js";
|
|
5
|
-
const config = getConfig(path.join(process.cwd(), "./powerhouse.config.json"));
|
|
6
|
-
startServer({
|
|
7
|
-
configFile: path.join(process.cwd(), "./powerhouse.config.json"),
|
|
8
|
-
dev: true,
|
|
9
|
-
...config.reactor,
|
|
10
|
-
logLevel: "info",
|
|
11
|
-
}).catch(console.error);
|
|
12
|
-
//# sourceMappingURL=cli.js.map
|
package/dist/src/cli.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,0BAA0B,CAAC,CAAC,CAAC;AAE/E,WAAW,CAAC;IACV,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,0BAA0B,CAAC;IAChE,GAAG,EAAE,IAAI;IACT,GAAG,MAAM,CAAC,OAAO;IACjB,QAAQ,EAAE,MAAM;CACjB,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"feature-flags.d.ts","sourceRoot":"","sources":["../../src/feature-flags.ts"],"names":[],"mappings":"AAGA,wBAAsB,gBAAgB,sDAOrC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { EnvVarProvider } from "@openfeature/env-var-provider";
|
|
2
|
-
import { OpenFeature } from "@openfeature/server-sdk";
|
|
3
|
-
export async function initFeatureFlags() {
|
|
4
|
-
// for now, we're only using env vars for feature flags
|
|
5
|
-
const provider = new EnvVarProvider();
|
|
6
|
-
await OpenFeature.setProviderAndWait(provider);
|
|
7
|
-
return OpenFeature.getClient();
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=feature-flags.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"feature-flags.js","sourceRoot":"","sources":["../../src/feature-flags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,uDAAuD;IACvD,MAAM,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC;IAEtC,MAAM,WAAW,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAE/C,OAAO,WAAW,CAAC,SAAS,EAAE,CAAC;AACjC,CAAC"}
|
package/dist/src/server.d.ts
DELETED
package/dist/src/server.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,YAAY,EAGZ,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAcpB,QAAA,MAAM,WAAW,GACf,UAAU,kBAAkB,KAC3B,OAAO,CAAC,YAAY,CA+JtB,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
package/dist/src/server.js
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { isLogLevel } from "@powerhousedao/config";
|
|
2
|
-
import { EventBus, ReactorBuilder, ReactorClientBuilder, driveCollectionId, parseDriveUrl, } from "@powerhousedao/reactor";
|
|
3
|
-
import { initializeAndStartAPI } from "@powerhousedao/reactor-api";
|
|
4
|
-
import { VitePackageLoader, startViteServer, } from "@powerhousedao/reactor-api/vite";
|
|
5
|
-
import { driveCreateDocument, driveCreateState, } from "@powerhousedao/shared/document-drive";
|
|
6
|
-
import { logger } from "document-model";
|
|
7
|
-
import dotenv from "dotenv";
|
|
8
|
-
import path from "node:path";
|
|
9
|
-
import { DefaultStartServerOptions } from "./types.js";
|
|
10
|
-
function normalizeRemoteDriveInput(input) {
|
|
11
|
-
if (typeof input === "string") {
|
|
12
|
-
return { url: input };
|
|
13
|
-
}
|
|
14
|
-
return input;
|
|
15
|
-
}
|
|
16
|
-
dotenv.config();
|
|
17
|
-
const startServer = async (options) => {
|
|
18
|
-
process.setMaxListeners(0);
|
|
19
|
-
const { port, storage, dev, drive, dbPath, packages = [], configFile, logLevel, remoteDrives = [], mcp, } = {
|
|
20
|
-
...DefaultStartServerOptions,
|
|
21
|
-
...options,
|
|
22
|
-
};
|
|
23
|
-
process.env.LOG_LEVEL =
|
|
24
|
-
process.env.LOG_LEVEL || (isLogLevel(logLevel) ? logLevel : "info");
|
|
25
|
-
// be aware: this may not log anything if the log level is above debug
|
|
26
|
-
logger.debug(`Setting log level to ${logLevel}.`);
|
|
27
|
-
const serverPort = Number(process.env.PORT ?? port);
|
|
28
|
-
// TODO get path from powerhouse config
|
|
29
|
-
const basePath = process.cwd();
|
|
30
|
-
// start vite server if dev
|
|
31
|
-
const vite = dev ? await startViteServer(basePath) : undefined;
|
|
32
|
-
// get paths to local document models
|
|
33
|
-
if (dev) {
|
|
34
|
-
packages.push(basePath);
|
|
35
|
-
}
|
|
36
|
-
const initializeClient = async (documentModels) => {
|
|
37
|
-
const eventBus = new EventBus();
|
|
38
|
-
const builder = new ReactorBuilder()
|
|
39
|
-
.withEventBus(eventBus)
|
|
40
|
-
.withDocumentModels(documentModels);
|
|
41
|
-
return new ReactorClientBuilder().withReactorBuilder(builder).buildModule();
|
|
42
|
-
};
|
|
43
|
-
// create loaders
|
|
44
|
-
const packageLoaders = vite ? [VitePackageLoader.build(vite)] : undefined;
|
|
45
|
-
// start api
|
|
46
|
-
const api = await initializeAndStartAPI(initializeClient, {
|
|
47
|
-
port: serverPort,
|
|
48
|
-
dbPath,
|
|
49
|
-
https: options?.https,
|
|
50
|
-
packageLoaders,
|
|
51
|
-
configFile,
|
|
52
|
-
packages,
|
|
53
|
-
mcp,
|
|
54
|
-
}, "switchboard");
|
|
55
|
-
// add vite middleware after express app is initialized if applicable
|
|
56
|
-
if (vite) {
|
|
57
|
-
api.httpAdapter.mountRawMiddleware(vite.middlewares);
|
|
58
|
-
}
|
|
59
|
-
// Conditionally add a default drive
|
|
60
|
-
let driveUrl = null;
|
|
61
|
-
if (!options?.disableDefaultDrive) {
|
|
62
|
-
let driveId = drive.id;
|
|
63
|
-
if (!driveId || driveId.length === 0) {
|
|
64
|
-
driveId = drive.slug;
|
|
65
|
-
}
|
|
66
|
-
if (!driveId || driveId.length === 0) {
|
|
67
|
-
throw new Error("Invalid Drive Id");
|
|
68
|
-
}
|
|
69
|
-
try {
|
|
70
|
-
const { global } = driveCreateState();
|
|
71
|
-
const document = driveCreateDocument({
|
|
72
|
-
global: {
|
|
73
|
-
...global,
|
|
74
|
-
name: drive.global.name,
|
|
75
|
-
icon: drive.global.icon ?? global.icon,
|
|
76
|
-
},
|
|
77
|
-
local: {
|
|
78
|
-
availableOffline: drive.local?.availableOffline ?? false,
|
|
79
|
-
sharingType: drive.local?.sharingType ?? "public",
|
|
80
|
-
listeners: drive.local?.listeners ?? [],
|
|
81
|
-
triggers: drive.local?.triggers ?? [],
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
if (drive.id && drive.id.length > 0) {
|
|
85
|
-
document.header.id = drive.id;
|
|
86
|
-
}
|
|
87
|
-
if (drive.slug && drive.slug.length > 0) {
|
|
88
|
-
document.header.slug = drive.slug;
|
|
89
|
-
}
|
|
90
|
-
if (drive.global.name) {
|
|
91
|
-
document.header.name = drive.global.name;
|
|
92
|
-
}
|
|
93
|
-
await api.client.create(document);
|
|
94
|
-
}
|
|
95
|
-
catch (e) {
|
|
96
|
-
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
97
|
-
if (!errorMessage.includes("already exists")) {
|
|
98
|
-
throw e;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
driveUrl = `http://localhost:${serverPort}/d/${driveId}`;
|
|
102
|
-
}
|
|
103
|
-
// Add remote drives after full initialization (including PackageManager)
|
|
104
|
-
if (remoteDrives.length > 0) {
|
|
105
|
-
const processedRemoteDrives = remoteDrives.map(normalizeRemoteDriveInput);
|
|
106
|
-
for (const remoteDrive of processedRemoteDrives) {
|
|
107
|
-
try {
|
|
108
|
-
const parsed = parseDriveUrl(remoteDrive.url);
|
|
109
|
-
const remoteName = `remote-drive-${parsed.driveId}-${crypto.randomUUID()}`;
|
|
110
|
-
await api.syncManager.add(remoteName, driveCollectionId("main", parsed.driveId), {
|
|
111
|
-
type: "gql",
|
|
112
|
-
parameters: { url: parsed.graphqlEndpoint },
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
catch (error) {
|
|
116
|
-
logger.error(` ➜ Failed to connect to remote drive ${remoteDrive.url}:`, error);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
if (driveUrl) {
|
|
121
|
-
logger.info(` ➜ Reactor: ${driveUrl}`);
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
logger.info(` ➜ Reactor: http://localhost:${serverPort}/graphql (no default drive)`);
|
|
125
|
-
}
|
|
126
|
-
return {
|
|
127
|
-
driveUrl,
|
|
128
|
-
getDocumentPath: (driveId, documentId) => {
|
|
129
|
-
if (!storage.filesystemPath) {
|
|
130
|
-
throw new Error(`"getDocumentPath" is only available with the Filesystem storage adapter.`);
|
|
131
|
-
}
|
|
132
|
-
return path.join(storage.filesystemPath, driveId, `${documentId}.json`);
|
|
133
|
-
},
|
|
134
|
-
};
|
|
135
|
-
};
|
|
136
|
-
export { startServer };
|
|
137
|
-
//# sourceMappingURL=server.js.map
|
package/dist/src/server.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,GACd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EACL,iBAAiB,EACjB,eAAe,GAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,MAAM,EAA4B,MAAM,gBAAgB,CAAC;AAClE,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,IAAI,MAAM,WAAW,CAAC;AAO7B,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEvD,SAAS,yBAAyB,CAChC,KAA6B;IAE7B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;IACxB,CAAC;IACD,OAAO,K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O,EAAE,GAAG,UAAU,OAAO,CAAC,CAAC;QAC1E,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
package/dist/src/types.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { LogLevel } from "@powerhousedao/config";
|
|
2
|
-
import type { DriveInput } from "@powerhousedao/shared/document-drive";
|
|
3
|
-
export type RemoteDriveInput = {
|
|
4
|
-
url: string;
|
|
5
|
-
options?: Record<string, unknown>;
|
|
6
|
-
};
|
|
7
|
-
export type RemoteDriveInputSimple = string | RemoteDriveInput;
|
|
8
|
-
export type StorageOptions = {
|
|
9
|
-
type: "filesystem" | "memory" | "postgres" | "browser";
|
|
10
|
-
filesystemPath?: string;
|
|
11
|
-
postgresUrl?: string;
|
|
12
|
-
};
|
|
13
|
-
export type StartServerOptions = {
|
|
14
|
-
configFile?: string;
|
|
15
|
-
dev?: boolean;
|
|
16
|
-
port?: string | number;
|
|
17
|
-
storage?: StorageOptions;
|
|
18
|
-
dbPath?: string;
|
|
19
|
-
drive?: DriveInput;
|
|
20
|
-
disableDefaultDrive?: boolean;
|
|
21
|
-
packages?: string[];
|
|
22
|
-
https?: {
|
|
23
|
-
keyPath: string;
|
|
24
|
-
certPath: string;
|
|
25
|
-
} | boolean | undefined;
|
|
26
|
-
logLevel?: LogLevel;
|
|
27
|
-
remoteDrives?: RemoteDriveInputSimple[];
|
|
28
|
-
mcp?: boolean;
|
|
29
|
-
};
|
|
30
|
-
export declare const DefaultStartServerOptions: {
|
|
31
|
-
port: number;
|
|
32
|
-
storage: {
|
|
33
|
-
type: "filesystem";
|
|
34
|
-
filesystemPath: string;
|
|
35
|
-
};
|
|
36
|
-
dbPath: string;
|
|
37
|
-
drive: {
|
|
38
|
-
id: string;
|
|
39
|
-
slug: string;
|
|
40
|
-
global: {
|
|
41
|
-
name: string;
|
|
42
|
-
icon: string;
|
|
43
|
-
};
|
|
44
|
-
local: {
|
|
45
|
-
availableOffline: true;
|
|
46
|
-
listeners: never[];
|
|
47
|
-
sharingType: string;
|
|
48
|
-
triggers: never[];
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
mcp: true;
|
|
52
|
-
};
|
|
53
|
-
export type LocalReactor = {
|
|
54
|
-
driveUrl: string | null;
|
|
55
|
-
getDocumentPath: (driveId: string, documentId: string) => string;
|
|
56
|
-
};
|
|
57
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/src/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAGvE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,gBAAgB,CAAC;AAE/D,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,YAAY,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;IACvD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EACF;QACE,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;KAClB,GACD,OAAO,GACP,SAAS,CAAC;IACd,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,YAAY,CAAC,EAAE,sBAAsB,EAAE,CAAC;IACxC,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;CAsBR,CAAC;AAE/B,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;CAClE,CAAC"}
|
package/dist/src/types.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
export const DefaultStartServerOptions = {
|
|
3
|
-
port: 4001,
|
|
4
|
-
storage: {
|
|
5
|
-
type: "filesystem",
|
|
6
|
-
filesystemPath: path.join(process.cwd(), ".ph/file-storage"),
|
|
7
|
-
},
|
|
8
|
-
dbPath: path.join(process.cwd(), ".ph/read-model.db"),
|
|
9
|
-
drive: {
|
|
10
|
-
id: "powerhouse",
|
|
11
|
-
slug: "powerhouse",
|
|
12
|
-
global: {
|
|
13
|
-
name: "Powerhouse",
|
|
14
|
-
icon: "https://ipfs.io/ipfs/QmcaTDBYn8X2psGaXe7iQ6qd8q6oqHLgxvMX9yXf7f9uP7",
|
|
15
|
-
},
|
|
16
|
-
local: {
|
|
17
|
-
availableOffline: true,
|
|
18
|
-
listeners: [],
|
|
19
|
-
sharingType: "public",
|
|
20
|
-
triggers: [],
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
mcp: true,
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=types.js.map
|
package/dist/src/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAEA,OAAO,IAAI,MAAM,WAAW,CAAC;AAoC7B,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,IAAI,EAAE,IAAI;IACV,OAAO,EAAE;QACP,IAAI,EAAE,YAAY;QAClB,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,kBAAkB,CAAC;KAC7D;IACD,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,mBAAmB,CAAC;IACrD,KAAK,EAAE;QACL,EAAE,EAAE,YAAY;QAChB,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE;YACN,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,qEAAqE;SAC5E;QACD,KAAK,EAAE;YACL,gBAAgB,EAAE,IAAI;YACtB,SAAS,EAAE,EAAE;YACb,WAAW,EAAE,QAAQ;YACrB,QAAQ,EAAE,EAAE;SACb;KACF;IACD,GAAG,EAAE,IAAI;CACmB,CAAC"}
|