@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
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import createWorkflowsPlugin, {
|
|
3
|
+
workflowsDriveDeclaration,
|
|
4
|
+
workflowsPlugin,
|
|
5
|
+
} from "../src/plugins/workflows.mjs";
|
|
6
|
+
|
|
7
|
+
// The workflows plugin DECLARES the drive it serves (workflow-plugins plan):
|
|
8
|
+
// a drive contribution the switchboard runner merges into the host's plan.
|
|
9
|
+
describe("workflows plugin — drive contribution from entry config", () => {
|
|
10
|
+
it("contributes the classic Workflows drive by default (project-hashed id, Workflow Studio)", () => {
|
|
11
|
+
expect(workflowsPlugin.contributions?.drives).toEqual([
|
|
12
|
+
{
|
|
13
|
+
slug: "workflows",
|
|
14
|
+
name: "Workflows",
|
|
15
|
+
preferredEditor: "workflow-studio",
|
|
16
|
+
projectHash: "id",
|
|
17
|
+
},
|
|
18
|
+
]);
|
|
19
|
+
// the default export is the factory resolveHostPlugins calls with the
|
|
20
|
+
// entry config; no config = the built-in instance's declaration
|
|
21
|
+
expect(createWorkflowsPlugin({}).contributions).toEqual(
|
|
22
|
+
workflowsPlugin.contributions,
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("names the drive from the entry: slug, name, icon; a fixed id drops the hash", () => {
|
|
27
|
+
const plugin = createWorkflowsPlugin({
|
|
28
|
+
drive: { slug: "automations", name: "Automations", id: "automations" },
|
|
29
|
+
});
|
|
30
|
+
expect(plugin.contributions?.drives).toEqual([
|
|
31
|
+
{
|
|
32
|
+
slug: "automations",
|
|
33
|
+
name: "Automations",
|
|
34
|
+
id: "automations",
|
|
35
|
+
preferredEditor: "workflow-studio",
|
|
36
|
+
},
|
|
37
|
+
]);
|
|
38
|
+
expect(
|
|
39
|
+
workflowsDriveDeclaration({ drive: { icon: "./icons/flows.png" } }),
|
|
40
|
+
).toEqual({
|
|
41
|
+
slug: "workflows",
|
|
42
|
+
name: "Workflows",
|
|
43
|
+
preferredEditor: "workflow-studio",
|
|
44
|
+
projectHash: "id",
|
|
45
|
+
icon: "./icons/flows.png",
|
|
46
|
+
});
|
|
47
|
+
// the vetra-style hashed slug stays available on request
|
|
48
|
+
expect(
|
|
49
|
+
workflowsDriveDeclaration({ drive: { projectHash: true } }),
|
|
50
|
+
).toMatchObject({ projectHash: true });
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("drive: false serves the runtime without seeding a drive", () => {
|
|
54
|
+
expect(
|
|
55
|
+
createWorkflowsPlugin({ drive: false }).contributions?.drives,
|
|
56
|
+
).toEqual([]);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("rejects config it does not know (the entry's typo fails boot, not silently)", () => {
|
|
60
|
+
expect(() => createWorkflowsPlugin({ drives: {} })).toThrow();
|
|
61
|
+
expect(() => createWorkflowsPlugin({ drive: { slugg: "x" } })).toThrow();
|
|
62
|
+
expect(
|
|
63
|
+
workflowsPlugin.configSchema?.safeParse({ drive: { slug: "" } }).success,
|
|
64
|
+
).toBe(false);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("keeps the transformServerOptions behaviour: presence forces workflows on unless explicitly off", () => {
|
|
68
|
+
const hooks = createWorkflowsPlugin({ drive: false }).hooks!;
|
|
69
|
+
const transform = hooks.transformServerOptions!;
|
|
70
|
+
expect(transform({}, {} as never)).toEqual({
|
|
71
|
+
workflows: { enabled: true },
|
|
72
|
+
});
|
|
73
|
+
expect(transform({ workflows: { enabled: false } }, {} as never)).toEqual({
|
|
74
|
+
workflows: { enabled: false },
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
});
|
package/tsconfig.json
CHANGED
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"path": "../../packages/document-model"
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
|
-
"path": "../../packages/
|
|
16
|
+
"path": "../../packages/host-core"
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
|
-
"path": "../../packages/
|
|
19
|
+
"path": "../../packages/opentelemetry-instrumentation-reactor"
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
"path": "../../packages/reactor"
|
|
@@ -33,6 +33,12 @@
|
|
|
33
33
|
{
|
|
34
34
|
"path": "../../packages/reactor-group"
|
|
35
35
|
},
|
|
36
|
+
{
|
|
37
|
+
"path": "../../packages/reactor-privacy"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"path": "../../packages/reactor-workflow"
|
|
41
|
+
},
|
|
36
42
|
{
|
|
37
43
|
"path": "../../packages/renown"
|
|
38
44
|
},
|
|
@@ -41,6 +47,9 @@
|
|
|
41
47
|
},
|
|
42
48
|
{
|
|
43
49
|
"path": "../../packages/vetra"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"path": "../../packages/workflow"
|
|
44
53
|
}
|
|
45
54
|
]
|
|
46
55
|
}
|
package/tsdown.config.ts
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
import { defineConfig } from "tsdown";
|
|
2
|
+
import { dtsExportList } from "../../tsdown.dts.mjs";
|
|
2
3
|
|
|
3
4
|
export default defineConfig({
|
|
4
5
|
entry: [
|
|
5
6
|
"src/index.mts",
|
|
6
7
|
"src/server.mts",
|
|
7
8
|
"src/utils.mts",
|
|
9
|
+
"src/boot.mts",
|
|
10
|
+
"src/config/schema.ts",
|
|
11
|
+
"src/config/from-env.ts",
|
|
8
12
|
"src/install-packages.mts",
|
|
9
13
|
"src/migrate.mts",
|
|
14
|
+
// R2: the built-in plugins, published as subpaths so host.js runner.plugins
|
|
15
|
+
// specifiers resolve from a project's dependency tree.
|
|
16
|
+
"src/plugins/mcp.mts",
|
|
17
|
+
"src/plugins/attachments.mts",
|
|
18
|
+
"src/plugins/privacy.mts",
|
|
19
|
+
"src/plugins/workflows.mts",
|
|
10
20
|
],
|
|
11
21
|
platform: "node",
|
|
12
22
|
outDir: "dist",
|
|
13
23
|
clean: true,
|
|
14
|
-
dts:
|
|
24
|
+
dts: { generator: "tsgo" },
|
|
25
|
+
plugins: [dtsExportList()],
|
|
15
26
|
sourcemap: true,
|
|
16
27
|
});
|
package/vitest.config.ts
CHANGED
|
@@ -1,11 +1,76 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { dirname, resolve } from "node:path";
|
|
1
4
|
import { defineConfig } from "vitest/config";
|
|
2
5
|
|
|
6
|
+
const packages = resolve(import.meta.dirname, "../../packages");
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The reactor, reactor-api and reactor-drive are read from source, so a test
|
|
10
|
+
* never runs the switchboard's wiring against a stale dist of the packages it
|
|
11
|
+
* wires (the client halves live in their source first). Only these: the
|
|
12
|
+
* "source" condition for every package breaks those whose source leans on
|
|
13
|
+
* their own build.
|
|
14
|
+
*/
|
|
15
|
+
const SOURCE_ALIASES: Record<string, string> = {
|
|
16
|
+
"@powerhousedao/reactor": "reactor/index.ts",
|
|
17
|
+
"@powerhousedao/reactor/rpc": "reactor/src/rpc/index.ts",
|
|
18
|
+
"@powerhousedao/reactor-api": "reactor-api/index.mts",
|
|
19
|
+
"@powerhousedao/reactor-api/vite": "reactor-api/src/packages/vite-loader.mts",
|
|
20
|
+
"@powerhousedao/reactor-api/https-hooks":
|
|
21
|
+
"reactor-api/src/packages/https-hooks.mts",
|
|
22
|
+
"@powerhousedao/reactor-api/pglite-node":
|
|
23
|
+
"reactor-api/src/pglite/pglite-node.ts",
|
|
24
|
+
"@powerhousedao/reactor-api/subgraph-types":
|
|
25
|
+
"reactor-api/src/graphql/subgraph-types.ts",
|
|
26
|
+
"@powerhousedao/reactor-drive": "reactor-drive/index.ts",
|
|
27
|
+
"@powerhousedao/reactor-drive/subgraph":
|
|
28
|
+
"reactor-drive/src/subgraph/index.ts",
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const escape = (text: string) => text.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&");
|
|
32
|
+
|
|
3
33
|
export default defineConfig({
|
|
34
|
+
resolve: {
|
|
35
|
+
alias: [
|
|
36
|
+
...Object.entries(SOURCE_ALIASES).map(([name, path]) => ({
|
|
37
|
+
find: new RegExp(`^${escape(name)}$`),
|
|
38
|
+
replacement: resolve(packages, path),
|
|
39
|
+
})),
|
|
40
|
+
// Node resolves `graphql` to its CommonJS entry, the copy
|
|
41
|
+
// @apollo/subgraph requires. Vite would pick the ESM entry, a second
|
|
42
|
+
// copy, so tests would see errors production never sends.
|
|
43
|
+
{
|
|
44
|
+
find: /^graphql$/,
|
|
45
|
+
replacement: createRequire(import.meta.url).resolve("graphql"),
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
plugins: [
|
|
50
|
+
{
|
|
51
|
+
// reactor-api's source imports its GraphQL schema files as strings.
|
|
52
|
+
name: "graphql-source-loader",
|
|
53
|
+
resolveId(source, importer) {
|
|
54
|
+
if (source.endsWith(".graphql")) {
|
|
55
|
+
return resolve(dirname(importer || ""), source);
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
},
|
|
59
|
+
load(id) {
|
|
60
|
+
if (id.endsWith(".graphql")) {
|
|
61
|
+
return `export default ${JSON.stringify(readFileSync(id, "utf-8"))}`;
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
],
|
|
4
67
|
test: {
|
|
5
68
|
pool: "forks",
|
|
6
69
|
environment: "node",
|
|
7
70
|
isolate: true,
|
|
8
71
|
maxWorkers: 1,
|
|
72
|
+
// Node 24's V8 double-frees tiered wasm wrappers after a PGlite worker exits (nodejs/node#66366).
|
|
73
|
+
execArgv: ["--wasm-wrapper-tiering-budget=1000000000"],
|
|
9
74
|
include: ["test/**/*.test.ts"],
|
|
10
75
|
},
|
|
11
76
|
});
|