@powerhousedao/switchboard 6.0.0-dev.23 → 6.0.0-dev.231
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/Auth.md +45 -27
- package/CHANGELOG.md +1786 -5
- package/README.md +13 -12
- package/dist/esm-aE6sDAbA.mjs +6481 -0
- package/dist/esm-aE6sDAbA.mjs.map +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +134 -0
- package/dist/index.mjs.map +1 -0
- package/dist/install-packages.d.mts +1 -0
- package/dist/install-packages.mjs +31 -0
- package/dist/install-packages.mjs.map +1 -0
- package/dist/migrate.d.mts +1 -0
- package/dist/migrate.mjs +55 -0
- package/dist/migrate.mjs.map +1 -0
- package/dist/server-UGYERfMo.mjs +762 -0
- package/dist/server-UGYERfMo.mjs.map +1 -0
- package/dist/server.d.mts +113 -0
- package/dist/server.d.mts.map +1 -0
- package/dist/server.mjs +4 -0
- package/dist/utils-DFl0ezBT.mjs +44 -0
- package/dist/utils-DFl0ezBT.mjs.map +1 -0
- package/dist/utils.d.mts +9 -0
- package/dist/utils.d.mts.map +1 -0
- package/dist/utils.mjs +2 -0
- package/package.json +58 -40
- package/test/attachments/auth.test.ts +219 -0
- package/test/attachments/index.test.ts +119 -0
- package/test/attachments/routes-integration.test.ts +103 -0
- package/test/attachments/routes.test.ts +864 -0
- package/test/metrics.test.ts +202 -0
- package/test/pglite-dialect.test.ts +40 -0
- package/test/pglite-version.test.ts +37 -0
- package/tsconfig.json +12 -3
- package/tsdown.config.ts +16 -0
- package/vitest.config.ts +11 -0
- package/Dockerfile +0 -86
- package/dist/src/clients/redis.d.ts +0 -5
- package/dist/src/clients/redis.d.ts.map +0 -1
- package/dist/src/clients/redis.js +0 -48
- package/dist/src/clients/redis.js.map +0 -1
- package/dist/src/config.d.ts +0 -12
- package/dist/src/config.d.ts.map +0 -1
- package/dist/src/config.js +0 -33
- package/dist/src/config.js.map +0 -1
- package/dist/src/connect-crypto.d.ts +0 -41
- package/dist/src/connect-crypto.d.ts.map +0 -1
- package/dist/src/connect-crypto.js +0 -127
- package/dist/src/connect-crypto.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/index.d.ts +0 -3
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -21
- package/dist/src/index.js.map +0 -1
- package/dist/src/install-packages.d.ts +0 -2
- package/dist/src/install-packages.d.ts.map +0 -1
- package/dist/src/install-packages.js +0 -36
- package/dist/src/install-packages.js.map +0 -1
- package/dist/src/migrate.d.ts +0 -3
- package/dist/src/migrate.d.ts.map +0 -1
- package/dist/src/migrate.js +0 -65
- package/dist/src/migrate.js.map +0 -1
- package/dist/src/profiler.d.ts +0 -4
- package/dist/src/profiler.d.ts.map +0 -1
- package/dist/src/profiler.js +0 -17
- package/dist/src/profiler.js.map +0 -1
- package/dist/src/server.d.ts +0 -6
- package/dist/src/server.d.ts.map +0 -1
- package/dist/src/server.js +0 -304
- package/dist/src/server.js.map +0 -1
- package/dist/src/types.d.ts +0 -64
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -2
- package/dist/src/types.js.map +0 -1
- package/dist/src/utils.d.ts +0 -6
- package/dist/src/utils.d.ts.map +0 -1
- package/dist/src/utils.js +0 -92
- package/dist/src/utils.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/entrypoint.sh +0 -17
package/dist/src/server.js
DELETED
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { PGlite } from "@electric-sql/pglite";
|
|
3
|
-
import { CompositeChannelFactory, ConsoleLogger, driveCollectionId, EventBus, parseDriveUrl, ReactorBuilder, ReactorClientBuilder, SyncBuilder, } from "@powerhousedao/reactor";
|
|
4
|
-
import { VitePackageLoader, getUniqueDocumentModels, initializeAndStartAPI, startViteServer, } from "@powerhousedao/reactor-api";
|
|
5
|
-
import { ConnectCryptoSigner } from "@renown/sdk";
|
|
6
|
-
import * as Sentry from "@sentry/node";
|
|
7
|
-
import { DocumentAlreadyExistsError, InMemoryCache, ReactorBuilder as LegacyReactorBuilder, childLogger, driveDocumentModelModule, } from "document-drive";
|
|
8
|
-
import { RedisCache } from "document-drive/cache/redis";
|
|
9
|
-
import { FilesystemStorage } from "document-drive/storage/filesystem";
|
|
10
|
-
import { PrismaStorageFactory } from "document-drive/storage/prisma";
|
|
11
|
-
import { documentModelDocumentModelModule } from "document-model";
|
|
12
|
-
import dotenv from "dotenv";
|
|
13
|
-
import express from "express";
|
|
14
|
-
import { Kysely, PostgresDialect } from "kysely";
|
|
15
|
-
import { PGliteDialect } from "kysely-pglite-dialect";
|
|
16
|
-
import path from "path";
|
|
17
|
-
import { Pool } from "pg";
|
|
18
|
-
import { initRedis } from "./clients/redis.js";
|
|
19
|
-
import { initConnectCrypto } from "./connect-crypto.js";
|
|
20
|
-
import { initFeatureFlags } from "./feature-flags.js";
|
|
21
|
-
import { initProfilerFromEnv } from "./profiler.js";
|
|
22
|
-
import { addDefaultDrive, addRemoteDrive, isPostgresUrl } from "./utils.js";
|
|
23
|
-
const logger = childLogger(["switchboard"]);
|
|
24
|
-
dotenv.config();
|
|
25
|
-
// Feature flag constants
|
|
26
|
-
const DOCUMENT_MODEL_SUBGRAPHS_ENABLED = "DOCUMENT_MODEL_SUBGRAPHS_ENABLED";
|
|
27
|
-
const DOCUMENT_MODEL_SUBGRAPHS_ENABLED_DEFAULT = true;
|
|
28
|
-
const REACTOR_STORAGE_V2 = "REACTOR_STORAGE_V2";
|
|
29
|
-
const REACTOR_STORAGE_V2_DEFAULT = true;
|
|
30
|
-
const ENABLE_DUAL_ACTION_CREATE = "ENABLE_DUAL_ACTION_CREATE";
|
|
31
|
-
const ENABLE_DUAL_ACTION_CREATE_DEFAULT = true;
|
|
32
|
-
// Create a monolith express app for all subgraphs
|
|
33
|
-
const app = express();
|
|
34
|
-
if (process.env.SENTRY_DSN) {
|
|
35
|
-
logger.info("Initialized Sentry with env:", process.env.SENTRY_ENV);
|
|
36
|
-
Sentry.init({
|
|
37
|
-
dsn: process.env.SENTRY_DSN,
|
|
38
|
-
environment: process.env.SENTRY_ENV,
|
|
39
|
-
});
|
|
40
|
-
Sentry.setupExpressErrorHandler(app);
|
|
41
|
-
}
|
|
42
|
-
const DEFAULT_PORT = process.env.PORT ? Number(process.env.PORT) : 4001;
|
|
43
|
-
async function initPrismaStorage(connectionString, cache) {
|
|
44
|
-
try {
|
|
45
|
-
const prismaFactory = new PrismaStorageFactory(connectionString, cache);
|
|
46
|
-
await prismaFactory.checkConnection();
|
|
47
|
-
return prismaFactory.build();
|
|
48
|
-
}
|
|
49
|
-
catch (e) {
|
|
50
|
-
const prismaConnectError = "Can't reach database server at";
|
|
51
|
-
if (e instanceof Error && e.message.includes(prismaConnectError)) {
|
|
52
|
-
const dbUrl = connectionString;
|
|
53
|
-
const safeUrl = `${dbUrl.slice(0, dbUrl.indexOf(":") + 1)}{...}${dbUrl.slice(dbUrl.indexOf("@"), dbUrl.lastIndexOf("?"))}`;
|
|
54
|
-
logger.warn(`Can't reach database server at '${safeUrl}'`);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
logger.error(e);
|
|
58
|
-
}
|
|
59
|
-
throw e;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
async function initReactorStorage(cache, dbPath = "./.ph/drive-storage") {
|
|
63
|
-
const isPostgres = isPostgresUrl(dbPath);
|
|
64
|
-
try {
|
|
65
|
-
if (isPostgres) {
|
|
66
|
-
const connectionString = dbPath.includes("amazonaws") && !dbPath.includes("sslmode=no-verify")
|
|
67
|
-
? dbPath + "?sslmode=no-verify"
|
|
68
|
-
: dbPath;
|
|
69
|
-
const storage = await initPrismaStorage(connectionString, cache);
|
|
70
|
-
return { storage, storagePath: dbPath };
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
catch {
|
|
74
|
-
logger.warn("Falling back to filesystem storage");
|
|
75
|
-
}
|
|
76
|
-
// if url was postgres and connection failed, fallback to filesystem on default path
|
|
77
|
-
const filesystemPath = isPostgres ? "./.ph/drive-storage" : dbPath;
|
|
78
|
-
return {
|
|
79
|
-
storage: new FilesystemStorage(path.join(process.cwd(), filesystemPath)),
|
|
80
|
-
storagePath: filesystemPath,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
async function initServer(serverPort, options, connectCrypto) {
|
|
84
|
-
const { dev, packages = [], remoteDrives = [] } = options;
|
|
85
|
-
const dbPath = options.dbPath ?? process.env.DATABASE_URL;
|
|
86
|
-
// start redis if configured
|
|
87
|
-
const redisUrl = process.env.REDIS_TLS_URL ?? process.env.REDIS_URL;
|
|
88
|
-
let redis;
|
|
89
|
-
if (redisUrl) {
|
|
90
|
-
try {
|
|
91
|
-
redis = await initRedis(redisUrl);
|
|
92
|
-
}
|
|
93
|
-
catch (e) {
|
|
94
|
-
logger.error(e);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
const cache = redis ? new RedisCache(redis) : new InMemoryCache();
|
|
98
|
-
const { storage, storagePath } = await initReactorStorage(cache, dbPath);
|
|
99
|
-
// if dbPath is not configured, or it was a postgres url but the connection failed,
|
|
100
|
-
// use default path for read model storage
|
|
101
|
-
const readModelPath = !dbPath || (isPostgresUrl(dbPath) && dbPath !== storagePath)
|
|
102
|
-
? ".ph/read-storage"
|
|
103
|
-
: dbPath;
|
|
104
|
-
const initializeDriveServer = async (documentModels) => {
|
|
105
|
-
const driveServer = new LegacyReactorBuilder(getUniqueDocumentModels([
|
|
106
|
-
documentModelDocumentModelModule,
|
|
107
|
-
driveDocumentModelModule,
|
|
108
|
-
...documentModels,
|
|
109
|
-
]))
|
|
110
|
-
.withStorage(storage)
|
|
111
|
-
.withCache(cache)
|
|
112
|
-
.withOptions({
|
|
113
|
-
featureFlags: {
|
|
114
|
-
enableDualActionCreate: options.reactorOptions?.enableDualActionCreate ?? false,
|
|
115
|
-
},
|
|
116
|
-
})
|
|
117
|
-
.build();
|
|
118
|
-
// init drive server
|
|
119
|
-
await driveServer.initialize();
|
|
120
|
-
return driveServer;
|
|
121
|
-
};
|
|
122
|
-
const initializeClient = async (driveServer, documentModels) => {
|
|
123
|
-
const eventBus = new EventBus();
|
|
124
|
-
const builder = new ReactorBuilder()
|
|
125
|
-
.withEventBus(eventBus)
|
|
126
|
-
.withDocumentModels(getUniqueDocumentModels([
|
|
127
|
-
documentModelDocumentModelModule,
|
|
128
|
-
driveDocumentModelModule,
|
|
129
|
-
...documentModels,
|
|
130
|
-
]))
|
|
131
|
-
.withLegacyStorage(storage)
|
|
132
|
-
.withSync(new SyncBuilder().withChannelFactory(new CompositeChannelFactory(new ConsoleLogger(["switchboard"]))))
|
|
133
|
-
.withFeatures({
|
|
134
|
-
legacyStorageEnabled: !options.reactorOptions?.storageV2,
|
|
135
|
-
});
|
|
136
|
-
const reactorDbUrl = process.env.PH_REACTOR_DATABASE_URL;
|
|
137
|
-
if (reactorDbUrl && isPostgresUrl(reactorDbUrl)) {
|
|
138
|
-
const connectionString = reactorDbUrl.includes("?")
|
|
139
|
-
? reactorDbUrl
|
|
140
|
-
: `${reactorDbUrl}?sslmode=disable`;
|
|
141
|
-
const pool = new Pool({ connectionString });
|
|
142
|
-
const kysely = new Kysely({
|
|
143
|
-
dialect: new PostgresDialect({ pool }),
|
|
144
|
-
});
|
|
145
|
-
builder.withKysely(kysely);
|
|
146
|
-
logger.info("Using PostgreSQL for reactor storage");
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
const pglitePath = "./.ph/reactor-storage";
|
|
150
|
-
const pglite = new PGlite(pglitePath);
|
|
151
|
-
const kysely = new Kysely({
|
|
152
|
-
dialect: new PGliteDialect(pglite),
|
|
153
|
-
});
|
|
154
|
-
builder.withKysely(kysely);
|
|
155
|
-
logger.info("Using PGlite for reactor storage");
|
|
156
|
-
}
|
|
157
|
-
const clientBuilder = new ReactorClientBuilder().withReactorBuilder(builder);
|
|
158
|
-
if (connectCrypto) {
|
|
159
|
-
clientBuilder.withSigner(new ConnectCryptoSigner(connectCrypto));
|
|
160
|
-
}
|
|
161
|
-
const module = await clientBuilder.buildModule();
|
|
162
|
-
// Return the full ReactorClientModule
|
|
163
|
-
return module;
|
|
164
|
-
};
|
|
165
|
-
let defaultDriveUrl = undefined;
|
|
166
|
-
// TODO get path from powerhouse config
|
|
167
|
-
// start vite server if dev mode is enabled
|
|
168
|
-
const basePath = process.cwd();
|
|
169
|
-
const vite = dev ? await startViteServer(process.cwd()) : undefined;
|
|
170
|
-
// get paths to local document models
|
|
171
|
-
if (!options.disableLocalPackages) {
|
|
172
|
-
packages.push(basePath);
|
|
173
|
-
}
|
|
174
|
-
// storageV2=true means use new reactor (NOT legacy)
|
|
175
|
-
const legacyReactor = !options.reactorOptions?.storageV2;
|
|
176
|
-
// create loader with legacyReactor option
|
|
177
|
-
const packageLoader = vite
|
|
178
|
-
? VitePackageLoader.build(vite, { legacyReactor })
|
|
179
|
-
: undefined;
|
|
180
|
-
const api = await initializeAndStartAPI(initializeDriveServer, initializeClient, {
|
|
181
|
-
express: app,
|
|
182
|
-
port: serverPort,
|
|
183
|
-
dbPath: readModelPath,
|
|
184
|
-
https: options.https,
|
|
185
|
-
packageLoader,
|
|
186
|
-
packages: packages,
|
|
187
|
-
processorConfig: options.processorConfig,
|
|
188
|
-
configFile: options.configFile ??
|
|
189
|
-
path.join(process.cwd(), "powerhouse.config.json"),
|
|
190
|
-
mcp: options.mcp ?? true,
|
|
191
|
-
enableDocumentModelSubgraphs: options.enableDocumentModelSubgraphs,
|
|
192
|
-
legacyReactor,
|
|
193
|
-
});
|
|
194
|
-
const { client, driveServer } = api;
|
|
195
|
-
// Create default drive if provided
|
|
196
|
-
if (options.drive) {
|
|
197
|
-
if (!connectCrypto) {
|
|
198
|
-
throw new Error("Cannot create default drive without ConnectCrypto identity");
|
|
199
|
-
}
|
|
200
|
-
defaultDriveUrl = await addDefaultDrive(driveServer, client, options.drive, serverPort);
|
|
201
|
-
}
|
|
202
|
-
// add vite middleware after express app is initialized if applicable
|
|
203
|
-
if (vite) {
|
|
204
|
-
api.app.use(vite.middlewares);
|
|
205
|
-
}
|
|
206
|
-
// Connect to remote drives AFTER packages are loaded
|
|
207
|
-
if (remoteDrives.length > 0) {
|
|
208
|
-
for (const remoteDriveUrl of remoteDrives) {
|
|
209
|
-
let driveId;
|
|
210
|
-
try {
|
|
211
|
-
if (legacyReactor) {
|
|
212
|
-
// Use legacy reactor's addRemoteDrive
|
|
213
|
-
const remoteDrive = await addRemoteDrive(driveServer, remoteDriveUrl);
|
|
214
|
-
driveId = remoteDrive.header.id;
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
// Use new reactor's sync manager
|
|
218
|
-
const { syncManager } = api;
|
|
219
|
-
const parsed = parseDriveUrl(remoteDriveUrl);
|
|
220
|
-
driveId = parsed.driveId;
|
|
221
|
-
const remoteName = `remote-drive-${driveId}-${crypto.randomUUID()}`;
|
|
222
|
-
await syncManager.add(remoteName, driveCollectionId("main", driveId), {
|
|
223
|
-
type: "gql",
|
|
224
|
-
parameters: { url: parsed.graphqlEndpoint },
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
logger.debug(`Remote drive ${remoteDriveUrl} synced`);
|
|
228
|
-
}
|
|
229
|
-
catch (error) {
|
|
230
|
-
if (error instanceof DocumentAlreadyExistsError) {
|
|
231
|
-
logger.debug(`Remote drive already added: ${remoteDriveUrl}`);
|
|
232
|
-
driveId = remoteDriveUrl.split("/").pop();
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
logger.error(`Failed to connect to remote drive ${remoteDriveUrl}:`, error);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
finally {
|
|
239
|
-
// Construct local URL once in finally block
|
|
240
|
-
if (!defaultDriveUrl && driveId) {
|
|
241
|
-
const protocol = options.https ? "https" : "http";
|
|
242
|
-
defaultDriveUrl = `${protocol}://localhost:${serverPort}/d/${driveId}`;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
return {
|
|
248
|
-
defaultDriveUrl,
|
|
249
|
-
api,
|
|
250
|
-
reactor: driveServer,
|
|
251
|
-
connectCrypto,
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
export const startSwitchboard = async (options = {}) => {
|
|
255
|
-
const serverPort = options.port ?? DEFAULT_PORT;
|
|
256
|
-
// Initialize feature flags
|
|
257
|
-
const featureFlags = await initFeatureFlags();
|
|
258
|
-
const enableDocumentModelSubgraphs = await featureFlags.getBooleanValue(DOCUMENT_MODEL_SUBGRAPHS_ENABLED, options.enableDocumentModelSubgraphs ??
|
|
259
|
-
DOCUMENT_MODEL_SUBGRAPHS_ENABLED_DEFAULT);
|
|
260
|
-
options.enableDocumentModelSubgraphs = enableDocumentModelSubgraphs;
|
|
261
|
-
const storageV2 = await featureFlags.getBooleanValue(REACTOR_STORAGE_V2, options.reactorOptions?.storageV2 ?? REACTOR_STORAGE_V2_DEFAULT);
|
|
262
|
-
const enableDualActionCreate = await featureFlags.getBooleanValue(ENABLE_DUAL_ACTION_CREATE, options.reactorOptions?.enableDualActionCreate ??
|
|
263
|
-
ENABLE_DUAL_ACTION_CREATE_DEFAULT);
|
|
264
|
-
options.reactorOptions = {
|
|
265
|
-
enableDualActionCreate,
|
|
266
|
-
storageV2,
|
|
267
|
-
};
|
|
268
|
-
logger.info("Feature flags:", {
|
|
269
|
-
DOCUMENT_MODEL_SUBGRAPHS_ENABLED: enableDocumentModelSubgraphs,
|
|
270
|
-
REACTOR_STORAGE_V2: storageV2,
|
|
271
|
-
ENABLE_DUAL_ACTION_CREATE: enableDualActionCreate,
|
|
272
|
-
});
|
|
273
|
-
if (process.env.PYROSCOPE_SERVER_ADDRESS) {
|
|
274
|
-
try {
|
|
275
|
-
await initProfilerFromEnv(process.env);
|
|
276
|
-
}
|
|
277
|
-
catch (e) {
|
|
278
|
-
Sentry.captureException(e);
|
|
279
|
-
logger.error("Error starting profiler", e);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
// Initialize ConnectCrypto if identity options are provided or keypair exists
|
|
283
|
-
let connectCrypto = null;
|
|
284
|
-
try {
|
|
285
|
-
connectCrypto = await initConnectCrypto(options.identity);
|
|
286
|
-
}
|
|
287
|
-
catch (e) {
|
|
288
|
-
logger.warn("Failed to initialize ConnectCrypto:", e);
|
|
289
|
-
if (options.identity?.requireExisting) {
|
|
290
|
-
throw new Error('Identity required but failed to initialize. Run "ph login" first.');
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
try {
|
|
294
|
-
return await initServer(serverPort, options, connectCrypto);
|
|
295
|
-
}
|
|
296
|
-
catch (e) {
|
|
297
|
-
Sentry.captureException(e);
|
|
298
|
-
logger.error("App crashed", e);
|
|
299
|
-
throw e;
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
export { getBearerToken, getConnectCrypto, getConnectDid, } from "./connect-crypto.js";
|
|
303
|
-
export * from "./types.js";
|
|
304
|
-
//# 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":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EAEjB,QAAQ,EACR,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,GAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAuB,MAAM,aAAa,CAAC;AACvE,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AAEvC,OAAO,EACL,0B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QAC7C,CAAC;IACH,CAAC;IAED,8EAA8E;IAC9E,IAAI,aAAa,GAA0B,IAAI,CAAC;IAChD,IAAI,CAAC;QACH,aAAa,GAAG,MAAM,iBAAiB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC5D,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,CAAC,IAAI,CAAC,qCAAqC,EAAE,CAAC,CAAC,CAAC;QACtD,IAAI,OAAO,CAAC,QAAQ,EAAE,eAAe,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CACb,mEAAmE,CACpE,CAAC;QACJ,CAAC;IACH,CAAC;IAED,IAAI,CAAC;QACH,OAAO,MAAM,UAAU,CAAC,UAAU,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;IAC9D,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;QAC3B,MAAM,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC,CAAC;AAEF,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,aAAa,GACd,MAAM,qBAAqB,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
package/dist/src/types.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import type { IConnectCrypto } from "@renown/sdk";
|
|
2
|
-
import type { DriveInput, IDocumentDriveServer } from "document-drive";
|
|
3
|
-
export type StorageOptions = {
|
|
4
|
-
type: "filesystem" | "memory" | "postgres" | "browser";
|
|
5
|
-
filesystemPath?: string;
|
|
6
|
-
postgresUrl?: string;
|
|
7
|
-
};
|
|
8
|
-
export type IdentityOptions = {
|
|
9
|
-
/** Path to the keypair file. Defaults to ~/.ph/keypair.json */
|
|
10
|
-
keypairPath?: string;
|
|
11
|
-
/**
|
|
12
|
-
* If true, won't start without an existing keypair.
|
|
13
|
-
* Use this to ensure the switchboard only runs with an authenticated identity.
|
|
14
|
-
*/
|
|
15
|
-
requireExisting?: boolean;
|
|
16
|
-
};
|
|
17
|
-
export type StartServerOptions = {
|
|
18
|
-
configFile?: string;
|
|
19
|
-
port?: number;
|
|
20
|
-
dev?: boolean;
|
|
21
|
-
dbPath?: string;
|
|
22
|
-
drive?: DriveInput;
|
|
23
|
-
packages?: string[];
|
|
24
|
-
remoteDrives?: string[];
|
|
25
|
-
https?: {
|
|
26
|
-
keyPath: string;
|
|
27
|
-
certPath: string;
|
|
28
|
-
} | boolean | undefined;
|
|
29
|
-
auth?: {
|
|
30
|
-
enabled: boolean;
|
|
31
|
-
guests: string[];
|
|
32
|
-
users: string[];
|
|
33
|
-
admins: string[];
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Identity options for ConnectCrypto.
|
|
37
|
-
* When configured, the switchboard will load the keypair from `ph login`
|
|
38
|
-
* and can authenticate with remote services on behalf of the user.
|
|
39
|
-
*/
|
|
40
|
-
identity?: IdentityOptions;
|
|
41
|
-
mcp?: boolean;
|
|
42
|
-
processorConfig?: Map<string, unknown>;
|
|
43
|
-
disableLocalPackages?: boolean;
|
|
44
|
-
reactorOptions?: {
|
|
45
|
-
/**
|
|
46
|
-
* When true, both legacy and new reactors will use CREATE/UPDATE operation
|
|
47
|
-
* flow for new documents.
|
|
48
|
-
*/
|
|
49
|
-
enableDualActionCreate?: boolean;
|
|
50
|
-
/**
|
|
51
|
-
* When true, the new Reactor uses only the new Kysely-based storage
|
|
52
|
-
* instead of the legacy document-drive storage.
|
|
53
|
-
*/
|
|
54
|
-
storageV2?: boolean;
|
|
55
|
-
};
|
|
56
|
-
enableDocumentModelSubgraphs?: boolean;
|
|
57
|
-
};
|
|
58
|
-
export type SwitchboardReactor = {
|
|
59
|
-
defaultDriveUrl: string | undefined;
|
|
60
|
-
reactor: IDocumentDriveServer;
|
|
61
|
-
/** The ConnectCrypto instance if identity was initialized */
|
|
62
|
-
connectCrypto: IConnectCrypto | null;
|
|
63
|
-
};
|
|
64
|
-
//# 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,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEvE,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,eAAe,GAAG;IAC5B,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,KAAK,CAAC,EACF;QACE,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;KAClB,GACD,OAAO,GACP,SAAS,CAAC;IACd,IAAI,CAAC,EAAE;QACL,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,MAAM,EAAE,MAAM,EAAE,CAAC;KAClB,CAAC;IACF;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,cAAc,CAAC,EAAE;QACf;;;WAGG;QACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;QAEjC;;;WAGG;QACH,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,CAAC;IACF,4BAA4B,CAAC,EAAE,OAAO,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,OAAO,EAAE,oBAAoB,CAAC;IAC9B,6DAA6D;IAC7D,aAAa,EAAE,cAAc,GAAG,IAAI,CAAC;CACtC,CAAC"}
|
package/dist/src/types.js
DELETED
package/dist/src/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
package/dist/src/utils.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { IReactorClient } from "@powerhousedao/reactor";
|
|
2
|
-
import type { DocumentDriveDocument, DriveInput, IDocumentDriveServer } from "document-drive";
|
|
3
|
-
export declare function addDefaultDrive(driveServer: IDocumentDriveServer, client: IReactorClient, drive: DriveInput, serverPort: number): Promise<string>;
|
|
4
|
-
export declare function isPostgresUrl(url: string): boolean;
|
|
5
|
-
export declare function addRemoteDrive(driveServer: IDocumentDriveServer, remoteDriveUrl: string): Promise<DocumentDriveDocument>;
|
|
6
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/dist/src/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAEV,qBAAqB,EACrB,UAAU,EACV,oBAAoB,EACrB,MAAM,gBAAgB,CAAC;AAIxB,wBAAsB,eAAe,CACnC,WAAW,EAAE,oBAAoB,EACjC,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,UAAU,EACjB,UAAU,EAAE,MAAM,mBAqEnB;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,WAExC;AAED,wBAAsB,cAAc,CAClC,WAAW,EAAE,oBAAoB,EACjC,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,qBAAqB,CAAC,CAyBhC"}
|
package/dist/src/utils.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { driveCreateDocument, driveCreateState } from "document-drive";
|
|
2
|
-
import { generateId } from "document-model/core";
|
|
3
|
-
export async function addDefaultDrive(driveServer, client, drive, serverPort) {
|
|
4
|
-
let driveId = drive.id;
|
|
5
|
-
if (!driveId || driveId.length === 0) {
|
|
6
|
-
driveId = drive.slug;
|
|
7
|
-
}
|
|
8
|
-
if (!driveId || driveId.length === 0) {
|
|
9
|
-
throw new Error("Invalid Drive Id");
|
|
10
|
-
}
|
|
11
|
-
// check if the drive already exists
|
|
12
|
-
let existingDrive;
|
|
13
|
-
try {
|
|
14
|
-
existingDrive = await client.get(driveId);
|
|
15
|
-
}
|
|
16
|
-
catch {
|
|
17
|
-
//
|
|
18
|
-
}
|
|
19
|
-
// already exists, return the existing drive url
|
|
20
|
-
if (existingDrive) {
|
|
21
|
-
return `http://localhost:${serverPort}/d/${driveId}`;
|
|
22
|
-
}
|
|
23
|
-
const { global } = driveCreateState();
|
|
24
|
-
const document = driveCreateDocument({
|
|
25
|
-
global: {
|
|
26
|
-
...global,
|
|
27
|
-
name: drive.global.name,
|
|
28
|
-
icon: drive.global.icon ?? global.icon,
|
|
29
|
-
},
|
|
30
|
-
local: {
|
|
31
|
-
availableOffline: drive.local?.availableOffline ?? false,
|
|
32
|
-
sharingType: drive.local?.sharingType ?? "public",
|
|
33
|
-
listeners: drive.local?.listeners ?? [],
|
|
34
|
-
triggers: drive.local?.triggers ?? [],
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
if (drive.id && drive.id.length > 0) {
|
|
38
|
-
document.header.id = drive.id;
|
|
39
|
-
}
|
|
40
|
-
if (drive.slug && drive.slug.length > 0) {
|
|
41
|
-
document.header.slug = drive.slug;
|
|
42
|
-
}
|
|
43
|
-
if (drive.global.name) {
|
|
44
|
-
document.header.name = drive.global.name;
|
|
45
|
-
}
|
|
46
|
-
if (drive.preferredEditor) {
|
|
47
|
-
document.header.meta = { preferredEditor: drive.preferredEditor };
|
|
48
|
-
}
|
|
49
|
-
try {
|
|
50
|
-
await client.create(document);
|
|
51
|
-
}
|
|
52
|
-
catch (e) {
|
|
53
|
-
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
54
|
-
if (!errorMessage.includes("already exists")) {
|
|
55
|
-
throw e;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
// YIKES: this is a backward compatibility hack to emit a drive added event
|
|
59
|
-
// This should be removed once we are not supporting legacy write operations.
|
|
60
|
-
driveServer.eventEmitter.emit("driveAdded", document);
|
|
61
|
-
return `http://localhost:${serverPort}/d/${driveId}`;
|
|
62
|
-
}
|
|
63
|
-
export function isPostgresUrl(url) {
|
|
64
|
-
return url.startsWith("postgresql") || url.startsWith("postgres");
|
|
65
|
-
}
|
|
66
|
-
export async function addRemoteDrive(driveServer, remoteDriveUrl) {
|
|
67
|
-
return await driveServer.addRemoteDrive(remoteDriveUrl, {
|
|
68
|
-
availableOffline: true,
|
|
69
|
-
sharingType: "public",
|
|
70
|
-
listeners: [
|
|
71
|
-
{
|
|
72
|
-
block: true,
|
|
73
|
-
callInfo: {
|
|
74
|
-
data: remoteDriveUrl,
|
|
75
|
-
name: "switchboard-push",
|
|
76
|
-
transmitterType: "SwitchboardPush",
|
|
77
|
-
},
|
|
78
|
-
filter: {
|
|
79
|
-
branch: ["main"],
|
|
80
|
-
documentId: ["*"],
|
|
81
|
-
documentType: ["*"],
|
|
82
|
-
scope: ["global"],
|
|
83
|
-
},
|
|
84
|
-
label: "Switchboard Sync",
|
|
85
|
-
listenerId: generateId(),
|
|
86
|
-
system: true,
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
triggers: [],
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/src/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,WAAiC,EACjC,MAAsB,EACtB,KAAiB,EACjB,UAAkB;IAElB,IAAI,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC;IACvB,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrC,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAED,oCAAoC;IACpC,IAAI,aAAa,CAAC;IAClB,IAAI,CAAC;QACH,aAAa,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,EAAE;IACJ,CAAC;IAED,gDAAgD;IAChD,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,oBAAoB,UAAU,MAAM,OAAO,EAAE,CAAC;IACvD,CAAC;IAED,MAAM,EAAE,MAAM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