@powerhousedao/switchboard 6.2.3-dev.8 → 6.2.3-dev.80
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/.tsbuild/test/attachments/byte-grants.test.d.ts +2 -0
- package/.tsbuild/test/attachments/byte-grants.test.d.ts.map +1 -0
- package/.tsbuild/test/attachments/byte-routes-read-gate.integration.test.d.ts +2 -0
- package/.tsbuild/test/attachments/byte-routes-read-gate.integration.test.d.ts.map +1 -0
- package/.tsbuild/test/attachments/reserve-metadata-parity.test.d.ts +2 -0
- package/.tsbuild/test/attachments/reserve-metadata-parity.test.d.ts.map +1 -0
- package/.tsbuild/test/attachments/url-signer.test.d.ts +2 -0
- package/.tsbuild/test/attachments/url-signer.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-auth-config.test.d.ts +2 -0
- package/.tsbuild/test/boot-auth-config.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-create-signature-policy.test.d.ts +2 -0
- package/.tsbuild/test/boot-create-signature-policy.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-env-isolation.test.d.ts +2 -0
- package/.tsbuild/test/boot-env-isolation.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-helpers.d.ts +5 -0
- package/.tsbuild/test/boot-helpers.d.ts.map +1 -0
- package/.tsbuild/test/boot-inspection-enabled.test.d.ts +2 -0
- package/.tsbuild/test/boot-inspection-enabled.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-mcp-auth.test.d.ts +2 -0
- package/.tsbuild/test/boot-mcp-auth.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-mcp-enabled.test.d.ts +2 -0
- package/.tsbuild/test/boot-mcp-enabled.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-port-zero.test.d.ts +2 -0
- package/.tsbuild/test/boot-port-zero.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-preconditions.test.d.ts +2 -0
- package/.tsbuild/test/boot-preconditions.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-privacy.test.d.ts +2 -0
- package/.tsbuild/test/boot-privacy.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-unsupported-stored-documents.test.d.ts +2 -0
- package/.tsbuild/test/boot-unsupported-stored-documents.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-without-renown.test.d.ts +2 -0
- package/.tsbuild/test/boot-without-renown.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-without-require-signatures.test.d.ts +2 -0
- package/.tsbuild/test/boot-without-require-signatures.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-worker-trust-policy.test.d.ts +2 -0
- package/.tsbuild/test/boot-worker-trust-policy.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-workflow-singleton-conflict.test.d.ts +2 -0
- package/.tsbuild/test/boot-workflow-singleton-conflict.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-workflow-singleton-retry.test.d.ts +2 -0
- package/.tsbuild/test/boot-workflow-singleton-retry.test.d.ts.map +1 -0
- package/.tsbuild/test/builder-defaults.test.d.ts +2 -0
- package/.tsbuild/test/builder-defaults.test.d.ts.map +1 -0
- package/.tsbuild/test/config-from-env.test.d.ts +2 -0
- package/.tsbuild/test/config-from-env.test.d.ts.map +1 -0
- package/.tsbuild/test/config-merge.test.d.ts +2 -0
- package/.tsbuild/test/config-merge.test.d.ts.map +1 -0
- package/.tsbuild/test/config-schema.test.d.ts +2 -0
- package/.tsbuild/test/config-schema.test.d.ts.map +1 -0
- package/.tsbuild/test/create-signature-policy.test.d.ts +2 -0
- package/.tsbuild/test/create-signature-policy.test.d.ts.map +1 -0
- package/.tsbuild/test/default-drive-protocol-versions.test.d.ts +2 -0
- package/.tsbuild/test/default-drive-protocol-versions.test.d.ts.map +1 -0
- package/.tsbuild/test/default-drive-slug.test.d.ts +2 -0
- package/.tsbuild/test/default-drive-slug.test.d.ts.map +1 -0
- package/.tsbuild/test/durable-node-fs-pg16.test.d.ts +2 -0
- package/.tsbuild/test/durable-node-fs-pg16.test.d.ts.map +1 -0
- package/.tsbuild/test/fatal-shutdown.test.d.ts +2 -0
- package/.tsbuild/test/fatal-shutdown.test.d.ts.map +1 -0
- package/.tsbuild/test/inspection-throttle.test.d.ts +2 -0
- package/.tsbuild/test/inspection-throttle.test.d.ts.map +1 -0
- package/.tsbuild/test/observability-signals.test.d.ts +2 -0
- package/.tsbuild/test/observability-signals.test.d.ts.map +1 -0
- package/.tsbuild/test/permissions-backfill.test.d.ts +2 -0
- package/.tsbuild/test/permissions-backfill.test.d.ts.map +1 -0
- package/.tsbuild/test/pglite-preflight.test.d.ts +2 -0
- package/.tsbuild/test/pglite-preflight.test.d.ts.map +1 -0
- package/.tsbuild/test/pglite-storage-dirs.test.d.ts +2 -0
- package/.tsbuild/test/pglite-storage-dirs.test.d.ts.map +1 -0
- package/.tsbuild/test/pglite-store.test.d.ts +2 -0
- package/.tsbuild/test/pglite-store.test.d.ts.map +1 -0
- package/.tsbuild/test/plugin-config-schemas.test.d.ts +2 -0
- package/.tsbuild/test/plugin-config-schemas.test.d.ts.map +1 -0
- package/.tsbuild/test/plugin-presence.test.d.ts +2 -0
- package/.tsbuild/test/plugin-presence.test.d.ts.map +1 -0
- package/.tsbuild/test/port-probe.test.d.ts +2 -0
- package/.tsbuild/test/port-probe.test.d.ts.map +1 -0
- package/.tsbuild/test/renown-storage-path.test.d.ts +2 -0
- package/.tsbuild/test/renown-storage-path.test.d.ts.map +1 -0
- package/.tsbuild/test/renown-trust-policy.test.d.ts +2 -0
- package/.tsbuild/test/renown-trust-policy.test.d.ts.map +1 -0
- package/.tsbuild/test/served-schemas.test.d.ts +2 -0
- package/.tsbuild/test/served-schemas.test.d.ts.map +1 -0
- package/.tsbuild/test/shutdown.test.d.ts +2 -0
- package/.tsbuild/test/shutdown.test.d.ts.map +1 -0
- package/.tsbuild/test/snapshot-writer.d.ts +18 -0
- package/.tsbuild/test/snapshot-writer.d.ts.map +1 -0
- package/.tsbuild/test/store-lock.test.d.ts +2 -0
- package/.tsbuild/test/store-lock.test.d.ts.map +1 -0
- package/.tsbuild/test/two-switchboards.test.d.ts +2 -0
- package/.tsbuild/test/two-switchboards.test.d.ts.map +1 -0
- package/.tsbuild/test/unsupported-stored-documents.test.d.ts +2 -0
- package/.tsbuild/test/unsupported-stored-documents.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow/harness.d.ts +56 -0
- package/.tsbuild/test/workflow/harness.d.ts.map +1 -0
- package/.tsbuild/test/workflow/oauth.test.d.ts +2 -0
- package/.tsbuild/test/workflow/oauth.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow/resolvers.test.d.ts +2 -0
- package/.tsbuild/test/workflow/resolvers.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow/runtime-host.test.d.ts +2 -0
- package/.tsbuild/test/workflow/runtime-host.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow/webhook-dedupe.test.d.ts +2 -0
- package/.tsbuild/test/workflow/webhook-dedupe.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow/webhook-signed.test.d.ts +2 -0
- package/.tsbuild/test/workflow/webhook-signed.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow/webhook-trigger-test.test.d.ts +2 -0
- package/.tsbuild/test/workflow/webhook-trigger-test.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow/webhook-unsigned.test.d.ts +2 -0
- package/.tsbuild/test/workflow/webhook-unsigned.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow-reactor-access.test.d.ts +2 -0
- package/.tsbuild/test/workflow-reactor-access.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow-reactor-enforcement.test.d.ts +2 -0
- package/.tsbuild/test/workflow-reactor-enforcement.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow-read-gate.test.d.ts +2 -0
- package/.tsbuild/test/workflow-read-gate.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow-runtime.test.d.ts +2 -0
- package/.tsbuild/test/workflow-runtime.test.d.ts.map +1 -0
- package/.tsbuild/test/workflows-plugin-config.test.d.ts +2 -0
- package/.tsbuild/test/workflows-plugin-config.test.d.ts.map +1 -0
- package/.tsbuild/tsconfig.tsbuildinfo +1 -1
- package/.tsbuild/tsdown.config.d.ts.map +1 -1
- package/.tsbuild/vitest.config.d.ts.map +1 -1
- package/Auth.md +144 -2
- package/CHANGELOG.md +1057 -0
- package/README.md +55 -14
- package/dist/boot.d.mts +46 -0
- package/dist/boot.d.mts.map +1 -0
- package/dist/boot.mjs +67 -0
- package/dist/boot.mjs.map +1 -0
- package/dist/config/from-env.d.mts +15 -0
- package/dist/config/from-env.d.mts.map +1 -0
- package/dist/config/from-env.mjs +4 -0
- package/dist/config/schema.d.mts +3 -0
- package/dist/config/schema.mjs +4 -0
- package/dist/from-env-BO0n9R02.mjs +401 -0
- package/dist/from-env-BO0n9R02.mjs.map +1 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +76 -79
- package/dist/index.mjs.map +1 -1
- package/dist/install-packages.d.mts +2 -1
- package/dist/install-packages.mjs +2 -2
- package/dist/install-packages.mjs.map +1 -1
- package/dist/mcp-SsBK14Jm.mjs +32 -0
- package/dist/mcp-SsBK14Jm.mjs.map +1 -0
- package/dist/migrate.d.mts +2 -1
- package/dist/migrate.mjs +7 -5
- package/dist/migrate.mjs.map +1 -1
- package/dist/plugin-host-C1sYEm8g.d.mts +46 -0
- package/dist/plugin-host-C1sYEm8g.d.mts.map +1 -0
- package/dist/plugins/attachments.d.mts +33 -0
- package/dist/plugins/attachments.d.mts.map +1 -0
- package/dist/plugins/attachments.mjs +4 -0
- package/dist/plugins/mcp.d.mts +31 -0
- package/dist/plugins/mcp.d.mts.map +1 -0
- package/dist/plugins/mcp.mjs +4 -0
- package/dist/plugins/privacy.d.mts +22 -0
- package/dist/plugins/privacy.d.mts.map +1 -0
- package/dist/plugins/privacy.mjs +4 -0
- package/dist/plugins/workflows.d.mts +79 -0
- package/dist/plugins/workflows.d.mts.map +1 -0
- package/dist/plugins/workflows.mjs +4 -0
- package/dist/postgres-url-DTDhBjXX.mjs +11 -0
- package/dist/postgres-url-DTDhBjXX.mjs.map +1 -0
- package/dist/privacy-BO8Q25xI.mjs +44 -0
- package/dist/privacy-BO8Q25xI.mjs.map +1 -0
- package/dist/privacy-DxIJGH4P.mjs +91 -0
- package/dist/privacy-DxIJGH4P.mjs.map +1 -0
- package/dist/renown-layers-COZsrGQT.mjs +40 -0
- package/dist/renown-layers-COZsrGQT.mjs.map +1 -0
- package/dist/schema-0g_QdOWn.mjs +267 -0
- package/dist/schema-0g_QdOWn.mjs.map +1 -0
- package/dist/schema-ivUWPQOn.d.mts +202 -0
- package/dist/schema-ivUWPQOn.d.mts.map +1 -0
- package/dist/server-eNNf230W.mjs +2518 -0
- package/dist/server-eNNf230W.mjs.map +1 -0
- package/dist/server.d.mts +270 -48
- package/dist/server.d.mts.map +1 -1
- package/dist/server.mjs +5 -5
- package/dist/utils-BbV_nodR.mjs +119 -0
- package/dist/utils-BbV_nodR.mjs.map +1 -0
- package/dist/utils.d.mts +12 -5
- package/dist/utils.d.mts.map +1 -1
- package/dist/utils.mjs +4 -3
- package/dist/worker-pool-BWHBLBJd.mjs +304 -0
- package/dist/worker-pool-BWHBLBJd.mjs.map +1 -0
- package/dist/workflow-runtime-7GaJ13c9.d.mts +30 -0
- package/dist/workflow-runtime-7GaJ13c9.d.mts.map +1 -0
- package/dist/workflows-5Chwj98o.mjs +1440 -0
- package/dist/workflows-5Chwj98o.mjs.map +1 -0
- package/package.json +68 -23
- package/scripts/install-packages.sh +0 -0
- package/test/attachment-reference-read-model.test.ts +28 -20
- package/test/attachments/auth.test.ts +85 -0
- package/test/attachments/byte-grants.test.ts +290 -0
- package/test/attachments/byte-routes-read-gate.integration.test.ts +314 -0
- package/test/attachments/download-target.test.ts +211 -32
- package/test/attachments/index.test.ts +47 -4
- package/test/attachments/reserve-metadata-parity.test.ts +96 -0
- package/test/attachments/routes-integration.test.ts +60 -4
- package/test/attachments/routes.test.ts +297 -35
- package/test/attachments/service-config.test.ts +41 -19
- package/test/attachments/url-signer.test.ts +105 -0
- package/test/boot-auth-config.test.ts +109 -0
- package/test/boot-create-signature-policy.test.ts +110 -0
- package/test/boot-env-isolation.test.ts +26 -0
- package/test/boot-helpers.ts +19 -0
- package/test/boot-inspection-enabled.test.ts +140 -0
- package/test/boot-mcp-auth.test.ts +449 -0
- package/test/boot-mcp-enabled.test.ts +119 -0
- package/test/boot-port-zero.test.ts +101 -0
- package/test/boot-preconditions.test.ts +200 -0
- package/test/boot-privacy.test.ts +232 -0
- package/test/boot-unsupported-stored-documents.test.ts +214 -0
- package/test/boot-without-renown.test.ts +83 -0
- package/test/boot-without-require-signatures.test.ts +76 -0
- package/test/boot-worker-trust-policy.test.ts +91 -0
- package/test/boot-workflow-singleton-conflict.test.ts +109 -0
- package/test/boot-workflow-singleton-retry.test.ts +122 -0
- package/test/builder-defaults.test.ts +80 -0
- package/test/config-from-env.test.ts +758 -0
- package/test/config-merge.test.ts +215 -0
- package/test/config-schema.test.ts +128 -0
- package/test/create-signature-policy.test.ts +69 -0
- package/test/default-drive-protocol-versions.test.ts +78 -0
- package/test/default-drive-slug.test.ts +97 -0
- package/test/durable-node-fs-pg16.test.ts +80 -0
- package/test/fatal-shutdown.test.ts +165 -0
- package/test/goldens/packages.graphql +797 -0
- package/test/goldens/privacy.graphql +853 -0
- package/test/goldens/reactor-drive-nodes.graphql +827 -0
- package/test/goldens/resolvers.json +321 -0
- package/test/goldens/supergraph.graphql +5636 -0
- package/test/goldens/workflow-runtime.graphql +1403 -0
- package/test/inspection-throttle.test.ts +23 -0
- package/test/observability-signals.test.ts +131 -0
- package/test/permissions-backfill.test.ts +486 -0
- package/test/pglite-dialect.test.ts +237 -2
- package/test/pglite-preflight.test.ts +313 -0
- package/test/pglite-storage-dirs.test.ts +113 -0
- package/test/pglite-store.test.ts +264 -0
- package/test/pglite-version.test.ts +9 -1
- package/test/plugin-config-schemas.test.ts +83 -0
- package/test/plugin-presence.test.ts +262 -0
- package/test/port-probe.test.ts +45 -0
- package/test/renown-storage-path.test.ts +40 -0
- package/test/renown-trust-policy.test.ts +313 -0
- package/test/served-schemas.test.ts +134 -0
- package/test/shutdown.test.ts +278 -0
- package/test/snapshot-writer.ts +94 -0
- package/test/store-lock.test.ts +65 -0
- package/test/two-switchboards.test.ts +146 -0
- package/test/unsupported-stored-documents.test.ts +72 -0
- package/test/worker-pool.test.ts +27 -1
- package/test/workflow/harness.ts +289 -0
- package/test/workflow/oauth.test.ts +214 -0
- package/test/workflow/resolvers.test.ts +357 -0
- package/test/workflow/runtime-host.test.ts +20 -0
- package/test/workflow/webhook-dedupe.test.ts +295 -0
- package/test/workflow/webhook-signed.test.ts +509 -0
- package/test/workflow/webhook-trigger-test.test.ts +82 -0
- package/test/workflow/webhook-unsigned.test.ts +345 -0
- package/test/workflow-reactor-access.test.ts +384 -0
- package/test/workflow-reactor-enforcement.test.ts +808 -0
- package/test/workflow-read-gate.test.ts +213 -0
- package/test/workflow-runtime.test.ts +1135 -0
- package/test/workflows-plugin-config.test.ts +77 -0
- package/tsconfig.json +11 -2
- package/tsdown.config.ts +12 -1
- package/vitest.config.ts +65 -0
- package/dist/server-CiKkVE6g.mjs +0 -1555
- package/dist/server-CiKkVE6g.mjs.map +0 -1
- package/dist/utils-Baw7rThP.mjs +0 -80
- package/dist/utils-Baw7rThP.mjs.map +0 -1
package/dist/server.d.mts
CHANGED
|
@@ -1,12 +1,45 @@
|
|
|
1
|
+
import { a as SwitchboardConfigInput } from "./schema-ivUWPQOn.mjs";
|
|
2
|
+
import { n as WorkflowTriggersCapability } from "./workflow-runtime-7GaJ13c9.mjs";
|
|
1
3
|
import { ILogger } from "document-model";
|
|
2
|
-
import { ChannelScheme, IDocumentModelLoader, IReactorClient, InProcessReactorClientModule, JwtHandler, ReactorBuilder, ReactorClientBuilder, ReactorFeatureFlags, SignerConfig } from "@powerhousedao/reactor";
|
|
4
|
+
import { ChannelScheme, Database, IDocumentModelLoader, IInspector, IReactorClient, InProcessReactorClientModule, JwtHandler, ModelManifestEntry, PoolInstrumentation, ReactorBuilder, ReactorClientBuilder, ReactorFeatureFlags, ReactorStorageFacts, SignerConfig, UnsupportedStoredDocuments, UnsupportedStoredProtocolError } from "@powerhousedao/reactor";
|
|
3
5
|
import { AttachmentReferenceProjectionCapability } from "@powerhousedao/reactor-api";
|
|
6
|
+
import { PgliteMaintenanceSettings, resolvePgliteMaintenance } from "@powerhousedao/reactor-api/pglite-node";
|
|
7
|
+
import { DocumentModelModule, ISigner, SignaturePolicy, UpgradeManifest } from "@powerhousedao/shared/document-model";
|
|
8
|
+
import { IErasureService } from "@powerhousedao/reactor-privacy";
|
|
4
9
|
import { IAttachmentService } from "@powerhousedao/reactor-attachments";
|
|
5
10
|
import { IRenown } from "@renown/sdk/node";
|
|
11
|
+
import { Kysely } from "kysely";
|
|
12
|
+
import { ResolvedPlugin } from "@powerhousedao/host-core";
|
|
6
13
|
import { DriveInput } from "@powerhousedao/shared/document-drive";
|
|
14
|
+
import "@electric-sql/pglite";
|
|
7
15
|
import { IRenown as IRenown$1 } from "@renown/sdk";
|
|
8
|
-
|
|
9
|
-
|
|
16
|
+
//#region src/pglite-version.d.ts
|
|
17
|
+
declare const SUPPORTED_PG_MAJORS: readonly [16, 17];
|
|
18
|
+
type SupportedPgMajor = (typeof SUPPORTED_PG_MAJORS)[number];
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/pglite-store.d.mts
|
|
21
|
+
/** How each PGlite store runs; unset fields take the defaults. */
|
|
22
|
+
interface PgliteStoreSettings {
|
|
23
|
+
fsync?: boolean;
|
|
24
|
+
maintenance?: PgliteMaintenanceSettings;
|
|
25
|
+
workerMemoryMb?: number;
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/privacy.d.mts
|
|
29
|
+
type PrivacyOptions = {
|
|
30
|
+
/** Wins over PH_PRIVACY_ENABLED. */
|
|
31
|
+
enabled?: boolean;
|
|
32
|
+
/** Wins over PH_PRIVACY_DEPLOYMENT_SECRET. */
|
|
33
|
+
deploymentSecret?: string;
|
|
34
|
+
/** The reactor's signer, for a caller-provided reactor. */
|
|
35
|
+
signer?: ISigner;
|
|
36
|
+
/** Each wins over its PH_PRIVACY_* env var. */
|
|
37
|
+
intervalMs?: number;
|
|
38
|
+
deadlineMs?: number;
|
|
39
|
+
markerGraceMs?: number;
|
|
40
|
+
purgeTimeoutMs?: number;
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
10
43
|
//#region src/types.d.ts
|
|
11
44
|
/**
|
|
12
45
|
* Drive container document type chosen for the boot-time default drive. The
|
|
@@ -14,27 +47,33 @@ import { DocumentModelModule, UpgradeManifest } from "@powerhousedao/shared/docu
|
|
|
14
47
|
* `powerhouse/reactor-drive` is wired through `addDefaultReactorDrive` and
|
|
15
48
|
* uses the relationship-based child graph.
|
|
16
49
|
*/
|
|
17
|
-
type SwitchboardDriveDocumentType = "powerhouse/document-drive" | "powerhouse/reactor-drive";
|
|
50
|
+
export type SwitchboardDriveDocumentType = "powerhouse/document-drive" | "powerhouse/reactor-drive";
|
|
18
51
|
/** A {@link DriveInput} extended with the optional drive-container type. */
|
|
19
|
-
type SwitchboardDriveInput = DriveInput & {
|
|
52
|
+
export type SwitchboardDriveInput = DriveInput & {
|
|
20
53
|
documentType?: SwitchboardDriveDocumentType;
|
|
21
54
|
};
|
|
22
|
-
type StorageOptions = {
|
|
55
|
+
export type StorageOptions = {
|
|
23
56
|
type: "filesystem" | "memory" | "postgres" | "browser";
|
|
24
57
|
filesystemPath?: string;
|
|
25
58
|
postgresUrl?: string;
|
|
26
59
|
};
|
|
27
|
-
type IdentityOptions = {
|
|
28
|
-
/** Path to the keypair file. Defaults to ~/.ph/keypair.json */
|
|
60
|
+
export type IdentityOptions = {
|
|
61
|
+
/** Path to the keypair file. Defaults to ~/.ph/keypair.json */
|
|
62
|
+
keypairPath?: string;
|
|
29
63
|
/**
|
|
30
64
|
* If true, won't start without an existing keypair.
|
|
31
65
|
* Use this to ensure the switchboard only runs with an authenticated identity.
|
|
32
66
|
*/
|
|
33
|
-
requireExisting?: boolean;
|
|
34
|
-
|
|
35
|
-
|
|
67
|
+
requireExisting?: boolean;
|
|
68
|
+
/** Base url of the Renown instance to use */
|
|
69
|
+
baseUrl?: string;
|
|
36
70
|
};
|
|
37
|
-
|
|
71
|
+
/**
|
|
72
|
+
* The options view of a switchboard's config and deps: what plugins'
|
|
73
|
+
* `transformServerOptions` hook receives. `startSwitchboard` takes the
|
|
74
|
+
* config (`@powerhousedao/switchboard/config`) and {@link SwitchboardDeps}.
|
|
75
|
+
*/
|
|
76
|
+
export type StartServerOptions = {
|
|
38
77
|
/**
|
|
39
78
|
* Pre-built ReactorClientModule (typically from
|
|
40
79
|
* `@powerhousedao/reactor#ReactorClientBuilder.buildModule`). When set, the
|
|
@@ -56,6 +95,21 @@ type StartServerOptions = {
|
|
|
56
95
|
* pieces as needed.
|
|
57
96
|
*/
|
|
58
97
|
reactor?: InProcessReactorClientModule;
|
|
98
|
+
/**
|
|
99
|
+
* Route uncaught exceptions, and unhandled rejections nothing else listens
|
|
100
|
+
* for, through the reactor's SIGTERM shutdown, so PGlite stores are flushed
|
|
101
|
+
* before the process exits with code 1. Installed once the switchboard's own reactor is built;
|
|
102
|
+
* ignored when `reactor` is passed. For process entry points only, since
|
|
103
|
+
* it adds process-wide listeners.
|
|
104
|
+
*/
|
|
105
|
+
fatalErrorShutdown?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Install the owned reactor's SIGINT/SIGTERM handlers (default true).
|
|
108
|
+
* False when a supervisor owns the process exit (a `ph run` compound
|
|
109
|
+
* member): the reactor then stops only through `shutdown()`. Ignored with
|
|
110
|
+
* a caller-provided `reactor`.
|
|
111
|
+
*/
|
|
112
|
+
signalHandlers?: boolean;
|
|
59
113
|
/**
|
|
60
114
|
* Registry URL for the HttpPackageLoader. Enables `PackagesSubgraph`
|
|
61
115
|
* (install/uninstall mutations) plus dynamic package resolution.
|
|
@@ -64,6 +118,12 @@ type StartServerOptions = {
|
|
|
64
118
|
*/
|
|
65
119
|
registryUrl?: string;
|
|
66
120
|
configFile?: string;
|
|
121
|
+
/**
|
|
122
|
+
* 0 binds a port the OS picks, reported on the result's `port`: the only
|
|
123
|
+
* race-free choice when several instances start at once. A taken non-zero
|
|
124
|
+
* port falls back to the next free one, which another process can still
|
|
125
|
+
* claim between the probe and the bind.
|
|
126
|
+
*/
|
|
67
127
|
port?: number;
|
|
68
128
|
/**
|
|
69
129
|
* If true, fail immediately when the requested port is in use instead of
|
|
@@ -85,9 +145,42 @@ type StartServerOptions = {
|
|
|
85
145
|
* When configured, the switchboard will load the keypair from `ph login`
|
|
86
146
|
* and can authenticate with remote services on behalf of the user.
|
|
87
147
|
*/
|
|
88
|
-
identity?: IdentityOptions;
|
|
148
|
+
identity?: IdentityOptions;
|
|
149
|
+
/** Base URL for the attachment service; defaults to `PH_SWITCHBOARD_PUBLIC_URL` then `http(s)://localhost:${port}`. */
|
|
89
150
|
attachmentServiceUrl?: string;
|
|
151
|
+
/** Mount the MCP server at `/mcp`. On by default; `false` wins over
|
|
152
|
+
* MCP_ENABLED, which can turn it off but never on. */
|
|
90
153
|
mcp?: boolean;
|
|
154
|
+
/** The plugin composition to boot with (FEATURE_PLUGIN_HOST_ENABLED): the
|
|
155
|
+
* resolved host.js runner.plugins entries, supplied by the uniform-runners
|
|
156
|
+
* switchboard runner (R2 step 2) or a test. Omitted = the built-in default
|
|
157
|
+
* composition. Resolved plugins, not specifiers — resolution happens at the
|
|
158
|
+
* runner against the PROJECT dependency tree. */
|
|
159
|
+
pluginComposition?: ResolvedPlugin[];
|
|
160
|
+
/** Mount the read-only inspection subgraph at `/graphql/inspection`. On by
|
|
161
|
+
* default; `false` wins over INSPECTION_ENABLED, which can turn it off. */
|
|
162
|
+
inspection?: boolean;
|
|
163
|
+
/** Open each PGlite store (reactor-storage, read-storage) in its own worker
|
|
164
|
+
* thread. Wins either way over PH_PGLITE_WORKERS; unset, the env var
|
|
165
|
+
* decides, then PGLITE_WORKERS_DEFAULT. */
|
|
166
|
+
pgliteWorkers?: boolean;
|
|
167
|
+
/** Powerhouse workflows: the runtime, its subgraph, its webhooks and its
|
|
168
|
+
* document models. Wins over PH_WORKFLOWS_ENABLED and the config file. */
|
|
169
|
+
workflows?: {
|
|
170
|
+
enabled?: boolean;
|
|
171
|
+
/** OAuth2 apps the publisher owns (`oauth_app` on a connection): per app,
|
|
172
|
+
* the provider's client files by kind. Wins over the config file's
|
|
173
|
+
* `workflows.oauthApps`; relative paths there are from the config file. */
|
|
174
|
+
oauthApps?: {
|
|
175
|
+
id: string;
|
|
176
|
+
clients: {
|
|
177
|
+
desktop?: string;
|
|
178
|
+
web?: string;
|
|
179
|
+
};
|
|
180
|
+
}[];
|
|
181
|
+
};
|
|
182
|
+
/** The GDPR add-on; off unless this or PH_PRIVACY_ENABLED turns it on. */
|
|
183
|
+
privacy?: PrivacyOptions;
|
|
91
184
|
processorConfig?: Map<string, unknown>;
|
|
92
185
|
disableLocalPackages?: boolean;
|
|
93
186
|
enableDocumentModelSubgraphs?: boolean;
|
|
@@ -144,68 +237,195 @@ type StartServerOptions = {
|
|
|
144
237
|
enabled?: boolean;
|
|
145
238
|
dbPoolSize?: number;
|
|
146
239
|
};
|
|
240
|
+
/**
|
|
241
|
+
* Stored documents at protocol versions this build does not run: "refuse"
|
|
242
|
+
* (the default) fails the boot with a StoredDocumentsRefusedError;
|
|
243
|
+
* "read-only" starts with a warning and keeps those documents read-only.
|
|
244
|
+
* Unset falls back to the REACTOR_UNSUPPORTED_STORED_DOCUMENTS env var.
|
|
245
|
+
* Ignored when `reactor` is passed.
|
|
246
|
+
*/
|
|
247
|
+
unsupportedStoredDocuments?: UnsupportedStoredDocuments;
|
|
248
|
+
};
|
|
249
|
+
/** What a switchboard is started with that is not a setting. */
|
|
250
|
+
export type SwitchboardDeps = {
|
|
251
|
+
logger?: ILogger;
|
|
252
|
+
/** See {@link StartServerOptions.reactor}. */
|
|
253
|
+
reactor?: InProcessReactorClientModule;
|
|
254
|
+
/** See {@link StartServerOptions.pluginComposition}. */
|
|
255
|
+
pluginComposition?: ResolvedPlugin[];
|
|
256
|
+
/** Receives failures in background work; Sentry by default. */
|
|
257
|
+
reportError?: (error: unknown) => void;
|
|
258
|
+
/** See {@link StartServerOptions.fatalErrorShutdown}. */
|
|
259
|
+
fatalErrorShutdown?: boolean;
|
|
260
|
+
/** See {@link StartServerOptions.signalHandlers}. */
|
|
261
|
+
signalHandlers?: boolean;
|
|
262
|
+
/** The privacy add-on's signer, for a caller-provided reactor. */
|
|
263
|
+
privacySigner?: ISigner;
|
|
147
264
|
};
|
|
148
|
-
type SwitchboardReactor = {
|
|
265
|
+
export type SwitchboardReactor = {
|
|
149
266
|
defaultDriveUrl: string | undefined;
|
|
150
|
-
reactor: IReactorClient;
|
|
151
|
-
|
|
152
|
-
|
|
267
|
+
reactor: IReactorClient;
|
|
268
|
+
/** Switchboard-backed remote attachment service over its own `/attachments/*` API, for downstream consumers.
|
|
269
|
+
* Undefined when the attachments plugin is absent from the composition
|
|
270
|
+
* (FEATURE_PLUGIN_HOST_ENABLED — presence is activation, rewire R2.3). */
|
|
271
|
+
attachmentService: IAttachmentService | undefined;
|
|
272
|
+
/** Whether the authoritative attachment-reference projection is active. */
|
|
273
|
+
attachmentReferenceProjection: AttachmentReferenceProjectionCapability;
|
|
274
|
+
/** Whether the workflow runtime's operation intake is indexing. Undefined
|
|
275
|
+
* when workflows are off; unavailable means no document trigger fires. */
|
|
276
|
+
workflowTriggers?: WorkflowTriggersCapability;
|
|
277
|
+
/** Whether workflows are on, after the option, PH_WORKFLOWS_ENABLED and the config file. */
|
|
278
|
+
workflowsEnabled: boolean;
|
|
279
|
+
/** The boot list of importable models workers and workflow pieces load; empty when none are resolved. */
|
|
280
|
+
modelManifest(): ModelManifestEntry[];
|
|
281
|
+
/** Present when the privacy add-on runs: its erasure service. */
|
|
282
|
+
privacy?: {
|
|
283
|
+
erasure: IErasureService;
|
|
284
|
+
};
|
|
285
|
+
/** Whether `/mcp` is mounted, after the option and MCP_ENABLED. */
|
|
286
|
+
mcpEnabled: boolean;
|
|
287
|
+
/** Whether `/graphql/inspection` is mounted, after the option and INSPECTION_ENABLED. */
|
|
288
|
+
inspectionEnabled: boolean;
|
|
289
|
+
/** The reactor's inspector, as the host reads it (processors, catch-up); undefined without inspection. */
|
|
290
|
+
inspector: IInspector | undefined;
|
|
291
|
+
/** The Renown instance if identity was initialized */
|
|
153
292
|
renown: IRenown$1 | null;
|
|
154
293
|
/**
|
|
155
|
-
* Port the HTTP server actually bound to
|
|
156
|
-
*
|
|
294
|
+
* Port the HTTP server actually bound to: the OS-picked one when 0 was
|
|
295
|
+
* requested, the next free one when the requested port was in use.
|
|
157
296
|
*/
|
|
158
297
|
port: number;
|
|
159
298
|
/**
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* caller-provided mode the caller owns the reactor lifecycle separately.
|
|
166
|
-
*
|
|
167
|
-
* Callers using a caller-provided reactor must invoke this from their own
|
|
168
|
-
* teardown / SIGINT path so api resources are released; killing the
|
|
169
|
-
* reactor alone won't release them.
|
|
299
|
+
* Idempotent. Owned reactor: runs the reactor module's memoized
|
|
300
|
+
* `shutdown()` (kill, shutdown hooks incl. the api drain, database).
|
|
301
|
+
* Caller-provided reactor: drains the api only (HTTP server, GraphQL
|
|
302
|
+
* manager, attachments, MCP, read-model DB); the caller owns the reactor
|
|
303
|
+
* and must call this from its own teardown.
|
|
170
304
|
*/
|
|
171
305
|
shutdown: () => Promise<void>;
|
|
172
306
|
};
|
|
173
307
|
//#endregion
|
|
174
308
|
//#region src/builder-defaults.d.mts
|
|
175
309
|
type SwitchboardReactorDefaultsOptions = {
|
|
176
|
-
documentModels?: DocumentModelModule[];
|
|
177
|
-
|
|
310
|
+
documentModels?: DocumentModelModule[];
|
|
311
|
+
/** Upgrade manifests for versioned models, one per document type. */
|
|
312
|
+
upgradeManifests?: UpgradeManifest<readonly number[]>[];
|
|
313
|
+
/** Default true. */
|
|
178
314
|
includeBaseModels?: boolean;
|
|
179
315
|
/**
|
|
180
316
|
* Channel scheme. Defaults to `ChannelScheme.SWITCHBOARD`, which populates
|
|
181
317
|
* `reactorModule.syncModule.syncManager` — required by reactor-api. Set
|
|
182
|
-
* to `false`
|
|
318
|
+
* to `false` if the caller configures sync itself (`withChannelScheme` or
|
|
319
|
+
* `withSync`); the builder refuses both together.
|
|
183
320
|
*/
|
|
184
|
-
channelScheme?: ChannelScheme | false;
|
|
185
|
-
|
|
321
|
+
channelScheme?: ChannelScheme | false;
|
|
322
|
+
/** Defaults to true. Set false when the caller owns SIGINT handling. */
|
|
323
|
+
signalHandlers?: boolean;
|
|
324
|
+
/** Executor tuning. Omit to use the reactor's own defaults. */
|
|
186
325
|
executorConfig?: {
|
|
187
326
|
maxSkipThreshold?: number;
|
|
188
327
|
featureFlags?: Partial<ReactorFeatureFlags>;
|
|
189
|
-
};
|
|
328
|
+
};
|
|
329
|
+
/** Wire dynamic document-model loading via HTTP. */
|
|
190
330
|
documentModelLoader?: IDocumentModelLoader;
|
|
191
331
|
logger?: ILogger;
|
|
192
332
|
/**
|
|
193
|
-
* Identity signer (typically from `getRenownSignerConfig`).
|
|
194
|
-
*
|
|
333
|
+
* Identity signer (typically from `getRenownSignerConfig`). Signs client
|
|
334
|
+
* writes and the operations the executor synthesizes, in pooled workers
|
|
335
|
+
* through `workerSigner`; omit for unsigned operation.
|
|
195
336
|
*/
|
|
196
337
|
signer?: SignerConfig;
|
|
338
|
+
/**
|
|
339
|
+
* Which keys may sign as which users (typically from
|
|
340
|
+
* `getRenownTrustPolicyConfig`); wins over one carried by `signer`.
|
|
341
|
+
*/
|
|
342
|
+
trustPolicy?: Pick<SignerConfig, "trustPolicy" | "workerTrustPolicy">;
|
|
343
|
+
/** What the client creates new documents as; see `resolveCreateSignaturePolicy`. */
|
|
344
|
+
createSignaturePolicy?: SignaturePolicy;
|
|
197
345
|
};
|
|
198
|
-
declare function applySwitchboardReactorDefaults(reactorBuilder: ReactorBuilder, clientBuilder: ReactorClientBuilder, options?: SwitchboardReactorDefaultsOptions): void;
|
|
346
|
+
export declare function applySwitchboardReactorDefaults(reactorBuilder: ReactorBuilder, clientBuilder: ReactorClientBuilder, options?: SwitchboardReactorDefaultsOptions): void;
|
|
347
|
+
//#endregion
|
|
348
|
+
//#region src/unsupported-stored-documents.d.mts
|
|
349
|
+
/** From REACTOR_UNSUPPORTED_STORED_DOCUMENTS; `input` wins when defined. */
|
|
350
|
+
export declare function resolveUnsupportedStoredDocuments(input: UnsupportedStoredDocuments | undefined, env: NodeJS.ProcessEnv): UnsupportedStoredDocuments;
|
|
351
|
+
/** The reactor refused to start over documents this build does not run. */
|
|
352
|
+
export declare class StoredDocumentsRefusedError extends Error {
|
|
353
|
+
readonly versions: readonly {
|
|
354
|
+
protocol: string;
|
|
355
|
+
version: number;
|
|
356
|
+
}[];
|
|
357
|
+
readonly documents: number;
|
|
358
|
+
constructor(cause: UnsupportedStoredProtocolError);
|
|
359
|
+
static isError(error: unknown): error is StoredDocumentsRefusedError;
|
|
360
|
+
}
|
|
199
361
|
//#endregion
|
|
200
362
|
//#region src/server.d.mts
|
|
363
|
+
/** Process-wide settings an edge applies once, before its first `startSwitchboard`. */
|
|
364
|
+
export declare function initSwitchboardProcess(options?: Pick<SwitchboardConfigInput, "logLevel">): void;
|
|
201
365
|
/**
|
|
202
366
|
* Attempt to bind a throwaway TCP server to the given port. Resolves true if
|
|
203
367
|
* the port is free, false if the OS reports it in use. Any other error is
|
|
204
368
|
* surfaced so we don't silently mask real issues (permissions, bad host, …).
|
|
205
369
|
*/
|
|
206
|
-
declare function isPortAvailable(port: number): Promise<boolean>;
|
|
207
|
-
/**
|
|
208
|
-
|
|
370
|
+
export declare function isPortAvailable(port: number): Promise<boolean>;
|
|
371
|
+
/**
|
|
372
|
+
* The reactor's storage handle, plus the pool instrumentation when that
|
|
373
|
+
* storage is Postgres. The PGlite branch has no `pg.Pool` at all, so the
|
|
374
|
+
* instrumentation is absent rather than optional-by-convention.
|
|
375
|
+
*/
|
|
376
|
+
type ReactorStorage = {
|
|
377
|
+
kysely: Kysely<Database>;
|
|
378
|
+
poolInstrumentation: PoolInstrumentation | undefined;
|
|
379
|
+
storageFacts: ReactorStorageFacts;
|
|
380
|
+
};
|
|
381
|
+
export declare function createReactorKysely(opts: {
|
|
382
|
+
reactorDbUrl: string | undefined;
|
|
383
|
+
reactorPgliteDir: string | null;
|
|
384
|
+
reactorPgliteMajor: SupportedPgMajor | null;
|
|
385
|
+
inMemory: boolean;
|
|
386
|
+
/** Called only on the Postgres branch, the one with a host pool. */
|
|
387
|
+
hostPoolSize: () => number;
|
|
388
|
+
/** Open the PGlite store in its own worker thread. */
|
|
389
|
+
pgliteWorkers: boolean;
|
|
390
|
+
pgliteSettings?: PgliteStoreSettings;
|
|
391
|
+
logger: ILogger;
|
|
392
|
+
}): Promise<ReactorStorage>;
|
|
393
|
+
export interface PgliteStorageDirs {
|
|
394
|
+
/** Read-model store: a Postgres URL or a PGlite dir. */
|
|
395
|
+
readModelPath: string;
|
|
396
|
+
/** Reactor store: a Postgres URL or a PGlite dir. */
|
|
397
|
+
reactorPath: string;
|
|
398
|
+
/** PGlite dir for the reactor, null for Postgres or a caller-owned reactor. */
|
|
399
|
+
reactorPgliteDir: string | null;
|
|
400
|
+
/** PGlite dir for the read model, null for Postgres. */
|
|
401
|
+
readModelPgliteDir: string | null;
|
|
402
|
+
/** The PGlite dirs for the pre-flight, as before (not deduplicated). */
|
|
403
|
+
pgliteDirs: string[];
|
|
404
|
+
/** Set when BOTH stores are PGlite on one dir (see resolvePgliteStorageDirs). */
|
|
405
|
+
sharedPgliteDir: string | null;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Where the two stores live — the classic resolution, relocated verbatim.
|
|
409
|
+
* Classic layout: `./.ph/reactor-storage` for the reactor and
|
|
410
|
+
* `.ph/read-storage` for the read model (the same names inside
|
|
411
|
+
* `${userData}/.ph` under a shell's PH_USER_DATA_DIR). `dbPath` also names
|
|
412
|
+
* the reactor store unless PH_REACTOR_DATABASE_URL does: with `dbPath` alone
|
|
413
|
+
* both stores share one location. That is the long-standing contract of
|
|
414
|
+
* `--db-path` and fine for one Postgres database, but for PGlite it is two
|
|
415
|
+
* postmasters on one data dir — reported via `sharedPgliteDir` so the caller
|
|
416
|
+
* warns. Not refused: changing that contract is a separate decision.
|
|
417
|
+
*/
|
|
418
|
+
export declare function resolvePgliteStorageDirs(opts: {
|
|
419
|
+
dbPath: string | undefined;
|
|
420
|
+
reactorDbUrl: string | undefined;
|
|
421
|
+
/** The caller passed its own reactor — the reactor-side dir is unused. */
|
|
422
|
+
callerReactor: boolean;
|
|
423
|
+
/** The relocated `.ph` root (PH_USER_DATA_DIR at the edge). */
|
|
424
|
+
userDataDir?: string;
|
|
425
|
+
phDir?: string;
|
|
426
|
+
}): PgliteStorageDirs;
|
|
427
|
+
/** The remote attachment service config for switchboard's own `/attachments/*` API; `attachments.serviceUrl` carries PH_SWITCHBOARD_PUBLIC_URL. */
|
|
428
|
+
export declare function deriveAttachmentServiceConfig(options: Pick<StartServerOptions, "attachmentServiceUrl" | "https">, serverPort: number, renown: IRenown | null): {
|
|
209
429
|
remoteUrl: string;
|
|
210
430
|
jwtHandler: JwtHandler | undefined;
|
|
211
431
|
};
|
|
@@ -220,13 +440,15 @@ declare function deriveAttachmentServiceConfig(options: Pick<StartServerOptions,
|
|
|
220
440
|
* dangling until the process exits.
|
|
221
441
|
*
|
|
222
442
|
* When `options.reactor` is omitted, the switchboard builds and owns the
|
|
223
|
-
* reactor. `shutdown()` on the returned handle
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
443
|
+
* reactor. `shutdown()` on the returned handle then runs the reactor
|
|
444
|
+
* module's `shutdown()`: `kill()`, the `withShutdownHook` chain that drains
|
|
445
|
+
* the api (HTTP server, GraphQL, MCP, attachments, read-model db), then the
|
|
446
|
+
* reactor database. It does not exit the process. It is the same memoized
|
|
447
|
+
* teardown the SIGINT/SIGTERM handlers (`withSignalHandlers`) run, so calling
|
|
448
|
+
* it twice, or receiving a signal around it, tears down once.
|
|
228
449
|
*/
|
|
229
|
-
declare const startSwitchboard: (
|
|
450
|
+
export declare const startSwitchboard: (input?: SwitchboardConfigInput, deps?: SwitchboardDeps) => Promise<SwitchboardReactor>;
|
|
230
451
|
//#endregion
|
|
231
|
-
export {
|
|
452
|
+
export type { SwitchboardReactorDefaultsOptions, WorkflowTriggersCapability };
|
|
453
|
+
export {};
|
|
232
454
|
//# sourceMappingURL=server.d.mts.map
|
package/dist/server.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.mts","names":[],"sources":["../src/types.ts","../src/builder-defaults.mts","../src/server.mts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.d.mts","names":[],"sources":["../src/pglite-version.ts","../src/pglite-store.mts","../src/privacy.mts","../src/types.ts","../src/builder-defaults.mts","../src/unsupported-stored-documents.mts","../src/server.mts"],"mappings":";;;;;;;;;;;;;;;;cAYa;KACD,2BAA2B;;;;UCuHtB;EACf;EACA,cAAc;EACd;;;;KC9GU;;EAEV;;EAEA;;EAEA,SAAS;;EAET;EACA;EACA;EACA;;;;;;;;;;YCXU;;YAKA,wBAAwB;EAClC,eAAe;;YAGL;EACV;EACA;EACA;;YAGU;;EAEV;;;;;EAKA;;EAGA;;;;;;;YAQU;;;;;;;;;;;;;;;;;;;;;EAqBV,UAAU;;;;;;;;EAQV;;;;;;;EAOA;;;;;;;EAOA;EACA;;;;;;;EAOA;;;;;;EAMA;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA;IAEM;IACA;;;;;;;EASN,WAAW;;EAEX;;;EAGA;;;;;;EAMA,oBAAoB;;;EAGpB;;;;EAIA;;;EAGA;IACE;;;;IAIA;MAAc;MAAY;QAAW;QAAkB;;;;;EAGzD,UAAU;EACV,kBAAkB;EAClB;EACA;;;;;;EAMA;EACA,SAAS;;;;;;;;;;EAUT;;;;;;;;;;EAUA;;;;;;;;;EASA;IACE;IACA;IACA;;;;;;;;;;;EAWF;IACE;IACA;;;;;;;;;EASF,6BAA6B;;;YAInB;EACV,SAAS;;EAET,UAAU;;EAEV,oBAAoB;;EAEpB,eAAe;;EAEf;;EAEA;;EAEA,gBAAgB;;YAGN;EACV;EACA,SAAS;;;;EAIT,mBAAmB;;EAEnB,+BAA+B;;;EAG/B,mBAAmB;;EAEnB;;EAEA,iBAAiB;;EAEjB;IAAY,SAAS;;;EAErB;;EAEA;;EAEA,WAAW;;EAEX,QAAQ;;;;;EAKR;;;;;;;;EAQA,gBAAgB;;;;KCvQN;EAIV,iBAAiB;;EAEjB,mBAAmB;;EAEnB;;;;;;;EAOA,gBAAgB;;EAEhB;;EAEA;IACE;IACA,eAAe,QAAQ;;;EAGzB,sBAAsB;EACtB,SAAS;;;;;;EAMT,SAAS;;;;;EAKT,cAAc,KAAK;;EAEnB,wBAAwB;;wBAiBV,gCACd,gBAAgB,gBAChB,eAAe,sBACf,UAAS;;;;wBCvEK,kCACd,OAAO,wCACP,KAAK,OAAO,aACX;;qBAaU,oCAAoC;WACtC;IAAqB;IAAkB;;WACvC;EAET,YAAY,OAAO;SAcH,QACd,iBACC,SAAS;;;;;wBC4IE,uBACd,UAAS,KAAK;;;;;;wBAgCM,gBAAgB,eAAe;;;;;;KA0HhD;EACH,QAAQ,OAAO;EACf,qBAAqB;EACrB,cAAc;;wBAGM,oBAAoB;EACxC;EACA;EACA,oBAAoB;EACpB;;EAEA;;EAEA;EACA,iBAAiB;EACjB,QAAQ;IACN,QAAQ;iBA2DK;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;;;;;;;wBAcc,yBAAyB;EACvC;EACA;;EAEA;;EAEA;EACA;IACE;;wBAmCY,8BACd,SAAS,KAAK,uDACd,oBACA,QAAQ;EACL;EAAmB,YAAY;;;;;;;;;;;;;;;;;;;;qBAwuCvB,mBAAgB,QACpB,wBAAsB,OACvB,oBACL,QAAQ"}
|
package/dist/server.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import "./
|
|
4
|
-
export { applySwitchboardReactorDefaults, deriveAttachmentServiceConfig, isPortAvailable, startSwitchboard };
|
|
5
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
6
|
-
//# debugId=
|
|
2
|
+
import { n as StoredDocumentsRefusedError, r as resolveUnsupportedStoredDocuments } from "./from-env-BO0n9R02.mjs";
|
|
3
|
+
import { a as resolvePgliteStorageDirs, i as isPortAvailable, l as applySwitchboardReactorDefaults, n as deriveAttachmentServiceConfig, o as startSwitchboard, r as initSwitchboardProcess, t as createReactorKysely } from "./server-eNNf230W.mjs";
|
|
4
|
+
export { StoredDocumentsRefusedError, applySwitchboardReactorDefaults, createReactorKysely, deriveAttachmentServiceConfig, initSwitchboardProcess, isPortAvailable, resolvePgliteStorageDirs, resolveUnsupportedStoredDocuments, startSwitchboard };
|
|
5
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b4b12638-b9fe-5533-9746-7051ca8dcc59")}catch(e){}}();
|
|
6
|
+
//# debugId=b4b12638-b9fe-5533-9746-7051ca8dcc59
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="43c4397d-8c51-5a5f-a076-14afbdb56cac")}catch(e){}}();
|
|
3
|
+
import { REACTOR_DRIVE_DOCUMENT_TYPE, reactorDriveCreateState } from "@powerhousedao/reactor-drive";
|
|
4
|
+
import { driveCreateState, driveDocumentType } from "@powerhousedao/shared/document-drive";
|
|
5
|
+
//#region src/utils.mts
|
|
6
|
+
/**
|
|
7
|
+
* A configured id pins the drive, and only a legacy drive can take a chosen
|
|
8
|
+
* id; otherwise the client's creation default applies.
|
|
9
|
+
*/
|
|
10
|
+
function newDrive(client, documentType, initialState, id) {
|
|
11
|
+
return client.newDocument(documentType, {
|
|
12
|
+
initialState,
|
|
13
|
+
...id ? {
|
|
14
|
+
signaturePolicy: "legacy",
|
|
15
|
+
id
|
|
16
|
+
} : {}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/** The document that already holds `slug`; null when two do (an id and a slug). */
|
|
20
|
+
async function slugHolder(client, slug) {
|
|
21
|
+
let id;
|
|
22
|
+
try {
|
|
23
|
+
id = await client.resolveIdOrSlug(slug);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
return error instanceof Error && error.name === "DocumentNotFoundError" ? void 0 : null;
|
|
26
|
+
}
|
|
27
|
+
return client.get(id);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A default drive whose slug another document holds: a drive of the same type
|
|
31
|
+
* stands in for it (its URL); anything else keeps it uncreated (null), with an
|
|
32
|
+
* error logged so the server still starts. Undefined when the slug is free.
|
|
33
|
+
*/
|
|
34
|
+
async function slugTakenBy(client, drive, documentType, serverPort, logger) {
|
|
35
|
+
if (!drive.slug) return void 0;
|
|
36
|
+
const holder = await slugHolder(client, drive.slug);
|
|
37
|
+
if (holder === void 0) return void 0;
|
|
38
|
+
if (holder?.header.documentType === documentType) return `http://localhost:${serverPort}/d/${holder.header.id}`;
|
|
39
|
+
const owner = holder ? `${holder.header.documentType} document ${holder.header.id}` : "two documents";
|
|
40
|
+
logger.error(`The default drive "${drive.slug}" was not created: the slug belongs to ${owner}.`);
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
/** Creates a configured drive unless one with its id or slug exists; the
|
|
44
|
+
* URL it is served at, or undefined when another document holds the slug. */
|
|
45
|
+
async function addDefaultDrive(client, drive, serverPort, logger = console) {
|
|
46
|
+
let driveId = drive.id;
|
|
47
|
+
if (!driveId || driveId.length === 0) driveId = drive.slug;
|
|
48
|
+
if (!driveId || driveId.length === 0) throw new Error("Invalid Drive Id");
|
|
49
|
+
let existingDrive;
|
|
50
|
+
try {
|
|
51
|
+
existingDrive = await client.get(driveId);
|
|
52
|
+
} catch {}
|
|
53
|
+
if (existingDrive) return `http://localhost:${serverPort}/d/${driveId}`;
|
|
54
|
+
const { global } = driveCreateState();
|
|
55
|
+
const taken = await slugTakenBy(client, drive, driveDocumentType, serverPort, logger);
|
|
56
|
+
if (taken !== void 0) return taken ?? void 0;
|
|
57
|
+
const document = await newDrive(client, driveDocumentType, {
|
|
58
|
+
global: {
|
|
59
|
+
...global,
|
|
60
|
+
name: drive.global.name,
|
|
61
|
+
icon: drive.global.icon ?? global.icon
|
|
62
|
+
},
|
|
63
|
+
local: {
|
|
64
|
+
availableOffline: drive.local?.availableOffline ?? false,
|
|
65
|
+
sharingType: drive.local?.sharingType ?? "public",
|
|
66
|
+
listeners: drive.local?.listeners ?? [],
|
|
67
|
+
triggers: drive.local?.triggers ?? []
|
|
68
|
+
}
|
|
69
|
+
}, drive.id);
|
|
70
|
+
if (drive.slug && drive.slug.length > 0) document.header.slug = drive.slug;
|
|
71
|
+
if (drive.global.name) document.header.name = drive.global.name;
|
|
72
|
+
if (drive.preferredEditor) document.header.meta = { preferredEditor: drive.preferredEditor };
|
|
73
|
+
try {
|
|
74
|
+
await (await client.write.create(document)).readable;
|
|
75
|
+
} catch (e) {
|
|
76
|
+
if (!(e instanceof Error ? e.message : String(e)).includes("already exists")) throw e;
|
|
77
|
+
}
|
|
78
|
+
return `http://localhost:${serverPort}/d/${driveId}`;
|
|
79
|
+
}
|
|
80
|
+
/** addDefaultDrive for a reactor drive. */
|
|
81
|
+
async function addDefaultReactorDrive(client, drive, serverPort, logger = console) {
|
|
82
|
+
let driveId = drive.id;
|
|
83
|
+
if (!driveId || driveId.length === 0) driveId = drive.slug;
|
|
84
|
+
if (!driveId || driveId.length === 0) throw new Error("Invalid Drive Id");
|
|
85
|
+
let existingDrive;
|
|
86
|
+
try {
|
|
87
|
+
existingDrive = await client.get(driveId);
|
|
88
|
+
} catch {}
|
|
89
|
+
if (existingDrive) return `http://localhost:${serverPort}/d/${driveId}`;
|
|
90
|
+
const { global, local } = reactorDriveCreateState();
|
|
91
|
+
const taken = await slugTakenBy(client, drive, REACTOR_DRIVE_DOCUMENT_TYPE, serverPort, logger);
|
|
92
|
+
if (taken !== void 0) return taken ?? void 0;
|
|
93
|
+
const document = await newDrive(client, REACTOR_DRIVE_DOCUMENT_TYPE, {
|
|
94
|
+
global: {
|
|
95
|
+
...global,
|
|
96
|
+
name: drive.global.name,
|
|
97
|
+
icon: drive.global.icon ?? global.icon
|
|
98
|
+
},
|
|
99
|
+
local: {
|
|
100
|
+
...local,
|
|
101
|
+
availableOffline: drive.local?.availableOffline ?? local.availableOffline,
|
|
102
|
+
sharingType: drive.local?.sharingType ?? local.sharingType
|
|
103
|
+
}
|
|
104
|
+
}, drive.id);
|
|
105
|
+
if (drive.slug && drive.slug.length > 0) document.header.slug = drive.slug;
|
|
106
|
+
if (drive.global.name) document.header.name = drive.global.name;
|
|
107
|
+
if (drive.preferredEditor) document.header.meta = { preferredEditor: drive.preferredEditor };
|
|
108
|
+
try {
|
|
109
|
+
await (await client.write.create(document)).readable;
|
|
110
|
+
} catch (e) {
|
|
111
|
+
if (!(e instanceof Error ? e.message : String(e)).includes("already exists")) throw e;
|
|
112
|
+
}
|
|
113
|
+
return `http://localhost:${serverPort}/d/${driveId}`;
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
export { addDefaultReactorDrive as n, addDefaultDrive as t };
|
|
117
|
+
|
|
118
|
+
//# sourceMappingURL=utils-BbV_nodR.mjs.map
|
|
119
|
+
//# debugId=43c4397d-8c51-5a5f-a076-14afbdb56cac
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils-BbV_nodR.mjs","sources":["../src/utils.mts"],"sourcesContent":["import type { IReactorClient } from \"@powerhousedao/reactor\";\nimport {\n REACTOR_DRIVE_DOCUMENT_TYPE,\n reactorDriveCreateState,\n} from \"@powerhousedao/reactor-drive\";\nimport {\n driveCreateState,\n driveDocumentType,\n} from \"@powerhousedao/shared/document-drive\";\nimport type { DriveInput } from \"@powerhousedao/shared/document-drive\";\nimport type {\n PHBaseState,\n PHDocument,\n} from \"@powerhousedao/shared/document-model\";\n\n/**\n * A configured id pins the drive, and only a legacy drive can take a chosen\n * id; otherwise the client's creation default applies.\n */\nfunction newDrive<TDocument extends PHDocument>(\n client: IReactorClient,\n documentType: string,\n initialState: Partial<PHBaseState>,\n id: string | undefined,\n): Promise<TDocument> {\n return client.newDocument<TDocument>(documentType, {\n initialState,\n ...(id ? { signaturePolicy: \"legacy\" as const, id } : {}),\n });\n}\n\ntype DefaultDriveLogger = { error: (message: string) => void };\n\n/** The document that already holds `slug`; null when two do (an id and a slug). */\nasync function slugHolder(\n client: IReactorClient,\n slug: string,\n): Promise<PHDocument | null | undefined> {\n let id: string;\n try {\n id = await client.resolveIdOrSlug(slug);\n } catch (error) {\n const notFound =\n error instanceof Error && error.name === \"DocumentNotFoundError\";\n return notFound ? undefined : null;\n }\n return client.get(id);\n}\n\n/**\n * A default drive whose slug another document holds: a drive of the same type\n * stands in for it (its URL); anything else keeps it uncreated (null), with an\n * error logged so the server still starts. Undefined when the slug is free.\n */\nasync function slugTakenBy(\n client: IReactorClient,\n drive: DriveInput,\n documentType: string,\n serverPort: number,\n logger: DefaultDriveLogger,\n): Promise<string | null | undefined> {\n if (!drive.slug) return undefined;\n const holder = await slugHolder(client, drive.slug);\n if (holder === undefined) return undefined;\n if (holder?.header.documentType === documentType) {\n return `http://localhost:${serverPort}/d/${holder.header.id}`;\n }\n const owner = holder\n ? `${holder.header.documentType} document ${holder.header.id}`\n : \"two documents\";\n logger.error(\n `The default drive \"${drive.slug}\" was not created: the slug belongs to ${owner}.`,\n );\n return null;\n}\n\n/** Creates a configured drive unless one with its id or slug exists; the\n * URL it is served at, or undefined when another document holds the slug. */\nexport async function addDefaultDrive(\n client: IReactorClient,\n drive: DriveInput,\n serverPort: number,\n logger: DefaultDriveLogger = console,\n): Promise<string | undefined> {\n let driveId = drive.id;\n if (!driveId || driveId.length === 0) {\n driveId = drive.slug;\n }\n\n if (!driveId || driveId.length === 0) {\n throw new Error(\"Invalid Drive Id\");\n }\n\n // check if the drive already exists\n let existingDrive;\n try {\n existingDrive = await client.get(driveId);\n } catch {\n //\n }\n\n // already exists, return the existing drive url\n if (existingDrive) {\n return `http://localhost:${serverPort}/d/${driveId}`;\n }\n\n const { global } = driveCreateState();\n const taken = await slugTakenBy(\n client,\n drive,\n driveDocumentType,\n serverPort,\n logger,\n );\n if (taken !== undefined) return taken ?? undefined;\n\n const document = await newDrive(\n client,\n driveDocumentType,\n {\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 } as Partial<PHBaseState>,\n 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 if (drive.preferredEditor) {\n document.header.meta = { preferredEditor: drive.preferredEditor };\n }\n\n try {\n await (\n await client.write.create(document)\n ).readable;\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 return `http://localhost:${serverPort}/d/${driveId}`;\n}\n\n/** addDefaultDrive for a reactor drive. */\nexport async function addDefaultReactorDrive(\n client: IReactorClient,\n drive: DriveInput,\n serverPort: number,\n logger: DefaultDriveLogger = console,\n): Promise<string | undefined> {\n let driveId = drive.id;\n if (!driveId || driveId.length === 0) {\n driveId = drive.slug;\n }\n\n if (!driveId || driveId.length === 0) {\n throw new Error(\"Invalid Drive Id\");\n }\n\n let existingDrive;\n try {\n existingDrive = await client.get(driveId);\n } catch {\n //\n }\n\n if (existingDrive) {\n return `http://localhost:${serverPort}/d/${driveId}`;\n }\n\n const { global, local } = reactorDriveCreateState();\n const taken = await slugTakenBy(\n client,\n drive,\n REACTOR_DRIVE_DOCUMENT_TYPE,\n serverPort,\n logger,\n );\n if (taken !== undefined) return taken ?? undefined;\n\n const document = await newDrive(\n client,\n REACTOR_DRIVE_DOCUMENT_TYPE,\n {\n global: {\n ...global,\n name: drive.global.name,\n icon: drive.global.icon ?? global.icon,\n },\n local: {\n ...local,\n availableOffline:\n drive.local?.availableOffline ?? local.availableOffline,\n sharingType: drive.local?.sharingType ?? local.sharingType,\n },\n } as Partial<PHBaseState>,\n 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 if (drive.preferredEditor) {\n document.header.meta = { preferredEditor: drive.preferredEditor };\n }\n\n try {\n await (\n await client.write.create(document)\n ).readable;\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 return `http://localhost:${serverPort}/d/${driveId}`;\n}\n\nexport { isPostgresUrl } from \"./postgres-url.mjs\";\n"],"names":[],"mappings":";;;;;;;;;AAmBA,SAAS,SACP,QACA,cACA,cACA,IACoB;CACpB,OAAO,OAAO,YAAuB,cAAc;EACjD;EACA,GAAI,KAAK;GAAE,iBAAiB;GAAmB;EAAG,IAAI,CAAC;CACzD,CAAC;AACH;;AAKA,eAAe,WACb,QACA,MACwC;CACxC,IAAI;CACJ,IAAI;EACF,KAAK,MAAM,OAAO,gBAAgB,IAAI;CACxC,SAAS,OAAO;EAGd,OADE,iBAAiB,SAAS,MAAM,SAAS,0BACzB,KAAA,IAAY;CAChC;CACA,OAAO,OAAO,IAAI,EAAE;AACtB;;;;;;AAOA,eAAe,YACb,QACA,OACA,cACA,YACA,QACoC;CACpC,IAAI,CAAC,MAAM,MAAM,OAAO,KAAA;CACxB,MAAM,SAAS,MAAM,WAAW,QAAQ,MAAM,IAAI;CAClD,IAAI,WAAW,KAAA,GAAW,OAAO,KAAA;CACjC,IAAI,QAAQ,OAAO,iBAAiB,cAClC,OAAO,oBAAoB,WAAW,KAAK,OAAO,OAAO;CAE3D,MAAM,QAAQ,SACV,GAAG,OAAO,OAAO,aAAa,YAAY,OAAO,OAAO,OACxD;CACJ,OAAO,MACL,sBAAsB,MAAM,KAAK,yCAAyC,MAAM,EAClF;CACA,OAAO;AACT;;;AAIA,eAAsB,gBACpB,QACA,OACA,YACA,SAA6B,SACA;CAC7B,IAAI,UAAU,MAAM;CACpB,IAAI,CAAC,WAAW,QAAQ,WAAW,GACjC,UAAU,MAAM;CAGlB,IAAI,CAAC,WAAW,QAAQ,WAAW,GACjC,MAAM,IAAI,MAAM,kBAAkB;CAIpC,IAAI;CACJ,IAAI;EACF,gBAAgB,MAAM,OAAO,IAAI,OAAO;CAC1C,QAAQ,CAER;CAGA,IAAI,eACF,OAAO,oBAAoB,WAAW,KAAK;CAG7C,MAAM,EAAE,WAAW,iBAAiB;CACpC,MAAM,QAAQ,MAAM,YAClB,QACA,OACA,mBACA,YACA,MACF;CACA,IAAI,UAAU,KAAA,GAAW,OAAO,SAAS,KAAA;CAEzC,MAAM,WAAW,MAAM,SACrB,QACA,mBACA;EACE,QAAQ;GACN,GAAG;GACH,MAAM,MAAM,OAAO;GACnB,MAAM,MAAM,OAAO,QAAQ,OAAO;EACpC;EACA,OAAO;GACL,kBAAkB,MAAM,OAAO,oBAAoB;GACnD,aAAa,MAAM,OAAO,eAAe;GACzC,WAAW,MAAM,OAAO,aAAa,CAAC;GACtC,UAAU,MAAM,OAAO,YAAY,CAAC;EACtC;CACF,GACA,MAAM,EACR;CACA,IAAI,MAAM,QAAQ,MAAM,KAAK,SAAS,GACpC,SAAS,OAAO,OAAO,MAAM;CAE/B,IAAI,MAAM,OAAO,MACf,SAAS,OAAO,OAAO,MAAM,OAAO;CAEtC,IAAI,MAAM,iBACR,SAAS,OAAO,OAAO,EAAE,iBAAiB,MAAM,gBAAgB;CAGlE,IAAI;EACF,OACE,MAAM,OAAO,MAAM,OAAO,QAAQ,EAAA,CAClC;CACJ,SAAS,GAAG;EAEV,IAAI,EADiB,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,EAAA,CAC5C,SAAS,gBAAgB,GACzC,MAAM;CAEV;CAEA,OAAO,oBAAoB,WAAW,KAAK;AAC7C;;AAGA,eAAsB,uBACpB,QACA,OACA,YACA,SAA6B,SACA;CAC7B,IAAI,UAAU,MAAM;CACpB,IAAI,CAAC,WAAW,QAAQ,WAAW,GACjC,UAAU,MAAM;CAGlB,IAAI,CAAC,WAAW,QAAQ,WAAW,GACjC,MAAM,IAAI,MAAM,kBAAkB;CAGpC,IAAI;CACJ,IAAI;EACF,gBAAgB,MAAM,OAAO,IAAI,OAAO;CAC1C,QAAQ,CAER;CAEA,IAAI,eACF,OAAO,oBAAoB,WAAW,KAAK;CAG7C,MAAM,EAAE,QAAQ,UAAU,wBAAwB;CAClD,MAAM,QAAQ,MAAM,YAClB,QACA,OACA,6BACA,YACA,MACF;CACA,IAAI,UAAU,KAAA,GAAW,OAAO,SAAS,KAAA;CAEzC,MAAM,WAAW,MAAM,SACrB,QACA,6BACA;EACE,QAAQ;GACN,GAAG;GACH,MAAM,MAAM,OAAO;GACnB,MAAM,MAAM,OAAO,QAAQ,OAAO;EACpC;EACA,OAAO;GACL,GAAG;GACH,kBACE,MAAM,OAAO,oBAAoB,MAAM;GACzC,aAAa,MAAM,OAAO,eAAe,MAAM;EACjD;CACF,GACA,MAAM,EACR;CACA,IAAI,MAAM,QAAQ,MAAM,KAAK,SAAS,GACpC,SAAS,OAAO,OAAO,MAAM;CAE/B,IAAI,MAAM,OAAO,MACf,SAAS,OAAO,OAAO,MAAM,OAAO;CAEtC,IAAI,MAAM,iBACR,SAAS,OAAO,OAAO,EAAE,iBAAiB,MAAM,gBAAgB;CAGlE,IAAI;EACF,OACE,MAAM,OAAO,MAAM,OAAO,QAAQ,EAAA,CAClC;CACJ,SAAS,GAAG;EAEV,IAAI,EADiB,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,EAAA,CAC5C,SAAS,gBAAgB,GACzC,MAAM;CAEV;CAEA,OAAO,oBAAoB,WAAW,KAAK;AAC7C","debug_id":"43c4397d-8c51-5a5f-a076-14afbdb56cac"}
|
package/dist/utils.d.mts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { IReactorClient } from "@powerhousedao/reactor";
|
|
2
2
|
import { DriveInput } from "@powerhousedao/shared/document-drive";
|
|
3
|
-
|
|
3
|
+
//#region src/postgres-url.d.mts
|
|
4
|
+
export declare function isPostgresUrl(url: string): boolean;
|
|
5
|
+
//#endregion
|
|
4
6
|
//#region src/utils.d.mts
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
type DefaultDriveLogger = {
|
|
8
|
+
error: (message: string) => void;
|
|
9
|
+
};
|
|
10
|
+
/** Creates a configured drive unless one with its id or slug exists; the
|
|
11
|
+
* URL it is served at, or undefined when another document holds the slug. */
|
|
12
|
+
export declare function addDefaultDrive(client: IReactorClient, drive: DriveInput, serverPort: number, logger?: DefaultDriveLogger): Promise<string | undefined>;
|
|
13
|
+
/** addDefaultDrive for a reactor drive. */
|
|
14
|
+
export declare function addDefaultReactorDrive(client: IReactorClient, drive: DriveInput, serverPort: number, logger?: DefaultDriveLogger): Promise<string | undefined>;
|
|
8
15
|
//#endregion
|
|
9
|
-
export {
|
|
16
|
+
export {};
|
|
10
17
|
//# sourceMappingURL=utils.d.mts.map
|
package/dist/utils.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.mts","names":[],"sources":["../src/utils.mts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.mts","names":[],"sources":["../src/postgres-url.mts","../src/utils.mts"],"mappings":";;;wBAAgB,cAAc;;;KC+BzB;EAAuB,QAAQ;;;;wBA+Cd,gBACpB,QAAQ,gBACR,OAAO,YACP,oBACA,SAAQ,qBACP;;wBA4EmB,uBACpB,QAAQ,gBACR,OAAO,YACP,oBACA,SAAQ,qBACP"}
|
package/dist/utils.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as isPostgresUrl } from "./postgres-url-DTDhBjXX.mjs";
|
|
2
|
+
import { n as addDefaultReactorDrive, t as addDefaultDrive } from "./utils-BbV_nodR.mjs";
|
|
2
3
|
export { addDefaultDrive, addDefaultReactorDrive, isPostgresUrl };
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
4
|
-
//# debugId=
|
|
4
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="135bae10-d500-567c-9048-68df0a6da261")}catch(e){}}();
|
|
5
|
+
//# debugId=135bae10-d500-567c-9048-68df0a6da261
|