@powerhousedao/switchboard 6.2.3-dev.9 → 6.2.3-dev.90
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/ai-gateway.test.d.ts +2 -0
- package/.tsbuild/test/ai-gateway.test.d.ts.map +1 -0
- 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-desktop-auth.test.d.ts +2 -0
- package/.tsbuild/test/boot-desktop-auth.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-ready-drives.test.d.ts +2 -0
- package/.tsbuild/test/boot-ready-drives.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/delegated-publish.test.d.ts +2 -0
- package/.tsbuild/test/delegated-publish.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/keyframe-reclaim-store.test.d.ts +2 -0
- package/.tsbuild/test/keyframe-reclaim-store.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/processor-timing-log.test.d.ts +2 -0
- package/.tsbuild/test/processor-timing-log.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-apps-config.test.d.ts +2 -0
- package/.tsbuild/test/workflow/oauth-apps-config.test.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/waitpoint-routes.test.d.ts +2 -0
- package/.tsbuild/test/workflow/waitpoint-routes.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow/waitpoint-runtime.test.d.ts +2 -0
- package/.tsbuild/test/workflow/waitpoint-runtime.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 +1206 -0
- package/README.md +88 -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-DJ4iQ3QZ.mjs +473 -0
- package/dist/from-env-DJ4iQ3QZ.mjs.map +1 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +84 -84
- 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-BHEUSn9G.d.mts +46 -0
- package/dist/plugin-host-BHEUSn9G.d.mts.map +1 -0
- package/dist/plugins/ai.d.mts +37 -0
- package/dist/plugins/ai.d.mts.map +1 -0
- package/dist/plugins/ai.mjs +400 -0
- package/dist/plugins/ai.mjs.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-1yj85yQD.mjs +326 -0
- package/dist/schema-1yj85yQD.mjs.map +1 -0
- package/dist/schema-ugrJupVH.d.mts +246 -0
- package/dist/schema-ugrJupVH.d.mts.map +1 -0
- package/dist/server-CgDvrUqE.mjs +2729 -0
- package/dist/server-CgDvrUqE.mjs.map +1 -0
- package/dist/server.d.mts +129 -189
- package/dist/server.d.mts.map +1 -1
- package/dist/server.mjs +5 -5
- package/dist/types-DzO3_320.d.mts +308 -0
- package/dist/types-DzO3_320.d.mts.map +1 -0
- package/dist/utils-Cm0TE6dP.mjs +148 -0
- package/dist/utils-Cm0TE6dP.mjs.map +1 -0
- package/dist/utils.d.mts +30 -5
- package/dist/utils.d.mts.map +1 -1
- package/dist/utils.mjs +5 -4
- package/dist/worker-pool-gyxJnCxA.mjs +304 -0
- package/dist/worker-pool-gyxJnCxA.mjs.map +1 -0
- package/dist/workflow-runtime-CF5pc8mt.d.mts +33 -0
- package/dist/workflow-runtime-CF5pc8mt.d.mts.map +1 -0
- package/dist/workflows-C9BQlyT0.mjs +1943 -0
- package/dist/workflows-C9BQlyT0.mjs.map +1 -0
- package/package.json +85 -24
- package/scripts/install-packages.sh +0 -0
- package/test/ai-gateway.test.ts +612 -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-desktop-auth.test.ts +278 -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 +213 -0
- package/test/boot-privacy.test.ts +232 -0
- package/test/boot-ready-drives.test.ts +141 -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 +942 -0
- package/test/config-merge.test.ts +226 -0
- package/test/config-schema.test.ts +156 -0
- package/test/create-signature-policy.test.ts +69 -0
- package/test/default-drive-protocol-versions.test.ts +79 -0
- package/test/default-drive-slug.test.ts +265 -0
- package/test/delegated-publish.test.ts +435 -0
- package/test/durable-node-fs-pg16.test.ts +80 -0
- package/test/fatal-shutdown.test.ts +205 -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 +327 -0
- package/test/goldens/supergraph.graphql +5918 -0
- package/test/goldens/workflow-runtime.graphql +1548 -0
- package/test/inspection-throttle.test.ts +23 -0
- package/test/keyframe-reclaim-store.test.ts +156 -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 +441 -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/processor-timing-log.test.ts +109 -0
- package/test/redact-webhook-path.test.ts +9 -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-apps-config.test.ts +66 -0
- package/test/workflow/oauth.test.ts +286 -0
- package/test/workflow/resolvers.test.ts +488 -0
- package/test/workflow/runtime-host.test.ts +19 -0
- package/test/workflow/waitpoint-routes.test.ts +306 -0
- package/test/workflow/waitpoint-runtime.test.ts +204 -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 +1254 -0
- package/test/workflows-plugin-config.test.ts +77 -0
- package/tsconfig.json +11 -2
- package/tsdown.config.ts +13 -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,488 @@
|
|
|
1
|
+
// What the workflow subgraph does with the caller behind a request: every
|
|
2
|
+
// workflow-scoped field, secrets included, hands it to the runtime, which
|
|
3
|
+
// gates secrets on their owner document and creator rather than on admin.
|
|
4
|
+
import type { Context } from "@powerhousedao/reactor-api";
|
|
5
|
+
import {
|
|
6
|
+
WORKFLOW_SYNCING_MESSAGE,
|
|
7
|
+
WorkflowSyncingError,
|
|
8
|
+
type WorkflowRuntimeService,
|
|
9
|
+
} from "@powerhousedao/reactor-workflow";
|
|
10
|
+
import { parse, type FieldNode, type OperationDefinitionNode } from "graphql";
|
|
11
|
+
import { describe, expect, it, vi } from "vitest";
|
|
12
|
+
import { getResolvers } from "../../src/workflow/resolvers.js";
|
|
13
|
+
|
|
14
|
+
const CTX = {
|
|
15
|
+
headers: {},
|
|
16
|
+
db: {},
|
|
17
|
+
user: { address: "0xadmin" },
|
|
18
|
+
} as unknown as Context;
|
|
19
|
+
|
|
20
|
+
type Resolver = (
|
|
21
|
+
parent: unknown,
|
|
22
|
+
args: unknown,
|
|
23
|
+
ctx: Context,
|
|
24
|
+
info?: unknown,
|
|
25
|
+
) => Promise<unknown>;
|
|
26
|
+
|
|
27
|
+
// The resolve info for the first runtime field of a real query document.
|
|
28
|
+
function runsInfo(query: string) {
|
|
29
|
+
const operation = parse(query).definitions[0] as OperationDefinitionNode;
|
|
30
|
+
const root = operation.selectionSet.selections[0] as FieldNode;
|
|
31
|
+
return { fieldNodes: [root.selectionSet!.selections[0] as FieldNode] };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const emptyPage = (): Promise<unknown> =>
|
|
35
|
+
Promise.resolve({ records: [], hasNextPage: false, cursor: null });
|
|
36
|
+
|
|
37
|
+
function waitpointRow(id: string, runId: string) {
|
|
38
|
+
return {
|
|
39
|
+
id,
|
|
40
|
+
run_id: runId,
|
|
41
|
+
workflow_id: "wf-1",
|
|
42
|
+
step_id: "step-1",
|
|
43
|
+
step_key: "step_1",
|
|
44
|
+
step_path: "step-1",
|
|
45
|
+
piece_name: "@powerhousedao/piece-approval",
|
|
46
|
+
block_name: "approval",
|
|
47
|
+
type: "WEBHOOK",
|
|
48
|
+
kind: "approval",
|
|
49
|
+
status: "PENDING",
|
|
50
|
+
created_at: "2026-10-28T00:00:00.000Z",
|
|
51
|
+
resume_at: null,
|
|
52
|
+
expires_at: null,
|
|
53
|
+
resolved_at: null,
|
|
54
|
+
decided_by: null,
|
|
55
|
+
approval: '{"title":"Pay?"}',
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// The run journal's waitpoint read: one pending approval per run.
|
|
60
|
+
function waitpointStore() {
|
|
61
|
+
return {
|
|
62
|
+
listWaitpointsForRuns: vi.fn((runIds: string[]) =>
|
|
63
|
+
Promise.resolve(
|
|
64
|
+
new Map(
|
|
65
|
+
runIds.map((runId) => [runId, [waitpointRow(`wp-${runId}`, runId)]]),
|
|
66
|
+
),
|
|
67
|
+
),
|
|
68
|
+
),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function fakeRuntime() {
|
|
73
|
+
return {
|
|
74
|
+
webhookEndpoint: vi.fn(() => Promise.resolve(null)),
|
|
75
|
+
triggerStates: vi.fn(() => Promise.resolve([])),
|
|
76
|
+
runs: vi.fn(() => Promise.resolve([])),
|
|
77
|
+
runsPage: vi.fn(emptyPage),
|
|
78
|
+
run: vi.fn(() => Promise.resolve(null)),
|
|
79
|
+
fire: vi.fn(() => Promise.resolve({})),
|
|
80
|
+
rerun: vi.fn(() => Promise.resolve({})),
|
|
81
|
+
waitingRuns: vi.fn((): Promise<unknown[]> => Promise.resolve([])),
|
|
82
|
+
waitpointsForRun: vi.fn(() => Promise.resolve([{ id: "wp-2" }])),
|
|
83
|
+
store: vi.fn(() => Promise.resolve(waitpointStore())),
|
|
84
|
+
testStep: vi.fn(() => Promise.resolve({})),
|
|
85
|
+
stepOutputTree: vi.fn(() => Promise.resolve({})),
|
|
86
|
+
blockResolutions: vi.fn(() => Promise.resolve([])),
|
|
87
|
+
searchPieces: vi.fn(() =>
|
|
88
|
+
Promise.resolve({ status: "ready", pieces: [], indexedPieces: 0 }),
|
|
89
|
+
),
|
|
90
|
+
reactorAccessDenial: vi.fn((): string | undefined => undefined),
|
|
91
|
+
testTrigger: vi.fn(() => Promise.resolve(null)),
|
|
92
|
+
cancelTriggerTestFor: vi.fn(() => Promise.resolve(true)),
|
|
93
|
+
createSecret: vi.fn(() => Promise.resolve({ ref: "secret://v1:00" })),
|
|
94
|
+
rotateSecret: vi.fn(() => Promise.resolve({ ref: "secret://v1:00" })),
|
|
95
|
+
deleteSecret: vi.fn(() => Promise.resolve()),
|
|
96
|
+
secretStat: vi.fn(() => Promise.resolve(null)),
|
|
97
|
+
listSecrets: vi.fn(() => Promise.resolve([])),
|
|
98
|
+
canManageSecret: vi.fn(() => Promise.resolve(false)),
|
|
99
|
+
secrets: vi.fn(),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function build() {
|
|
104
|
+
const runtime = fakeRuntime();
|
|
105
|
+
const resolvers = getResolvers(
|
|
106
|
+
runtime as unknown as WorkflowRuntimeService,
|
|
107
|
+
undefined,
|
|
108
|
+
undefined,
|
|
109
|
+
(documentId) =>
|
|
110
|
+
documentId === "wf-hidden"
|
|
111
|
+
? Promise.reject(new Error("You may not read this workflow"))
|
|
112
|
+
: Promise.resolve(),
|
|
113
|
+
) as Record<string, Record<string, Resolver>>;
|
|
114
|
+
return {
|
|
115
|
+
runtime,
|
|
116
|
+
queries: resolvers.WorkflowRuntimeQueries,
|
|
117
|
+
mutations: resolvers.WorkflowRuntimeMutations,
|
|
118
|
+
secretRecord: resolvers.SecretRecord,
|
|
119
|
+
runRecord: resolvers.WorkflowRunRecord,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
describe("the workflow resolvers and the caller", () => {
|
|
124
|
+
it("hands the caller to every workflow-scoped field", async () => {
|
|
125
|
+
const { runtime, queries, mutations } = build();
|
|
126
|
+
|
|
127
|
+
await queries.webhookEndpoint({}, { workflowId: "wf-1" }, CTX);
|
|
128
|
+
await queries.triggerStates({}, {}, CTX);
|
|
129
|
+
await queries.runs({}, { driveId: "drive-1" }, CTX);
|
|
130
|
+
await queries.run({}, { id: "run-1" }, CTX);
|
|
131
|
+
await mutations.fire({}, { workflowId: "wf-1", payload: { a: 1 } }, CTX);
|
|
132
|
+
await mutations.rerun({}, { runId: "run-1" }, CTX);
|
|
133
|
+
await mutations.testStep({}, { workflowId: "wf-1", stepId: "s1" }, CTX);
|
|
134
|
+
await queries.stepOutputTree({}, { workflowId: "wf-1", stepId: "s1" }, CTX);
|
|
135
|
+
await queries.blockResolutions({}, { workflowId: "wf-1" }, CTX);
|
|
136
|
+
await mutations.testTrigger(
|
|
137
|
+
{},
|
|
138
|
+
{ workflowId: "wf-1", payload: { a: 1 }, timeoutSeconds: 30 },
|
|
139
|
+
CTX,
|
|
140
|
+
);
|
|
141
|
+
await mutations.cancelTriggerTest({}, { workflowId: "wf-1" }, CTX);
|
|
142
|
+
|
|
143
|
+
expect(runtime.webhookEndpoint).toHaveBeenCalledWith("wf-1", CTX, {});
|
|
144
|
+
expect(runtime.triggerStates).toHaveBeenCalledWith(CTX);
|
|
145
|
+
expect(runtime.runs).toHaveBeenCalledWith(
|
|
146
|
+
{ driveId: "drive-1", withStepData: true },
|
|
147
|
+
CTX,
|
|
148
|
+
);
|
|
149
|
+
expect(runtime.run).toHaveBeenCalledWith("run-1", CTX);
|
|
150
|
+
expect(runtime.fire).toHaveBeenCalledWith(
|
|
151
|
+
"wf-1",
|
|
152
|
+
{ a: 1 },
|
|
153
|
+
"manual",
|
|
154
|
+
undefined,
|
|
155
|
+
CTX,
|
|
156
|
+
);
|
|
157
|
+
expect(runtime.rerun).toHaveBeenCalledWith("run-1", CTX);
|
|
158
|
+
expect(runtime.testStep).toHaveBeenCalledWith("wf-1", "s1", CTX, {});
|
|
159
|
+
expect(runtime.stepOutputTree).toHaveBeenCalledWith("wf-1", "s1", CTX);
|
|
160
|
+
expect(runtime.blockResolutions).toHaveBeenCalledWith("wf-1", CTX);
|
|
161
|
+
expect(runtime.testTrigger).toHaveBeenCalledWith("wf-1", CTX, {
|
|
162
|
+
payload: { a: 1 },
|
|
163
|
+
timeoutMs: 30_000,
|
|
164
|
+
});
|
|
165
|
+
expect(runtime.cancelTriggerTestFor).toHaveBeenCalledWith("wf-1", CTX);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it("passes the caller's drive, and tags a still-syncing workflow", async () => {
|
|
169
|
+
const { runtime, queries, mutations } = build();
|
|
170
|
+
const drive = { driveId: "drive-1" };
|
|
171
|
+
|
|
172
|
+
await queries.webhookEndpoint({}, { workflowId: "wf-1", ...drive }, CTX);
|
|
173
|
+
await mutations.testTrigger({}, { workflowId: "wf-1", ...drive }, CTX);
|
|
174
|
+
runtime.testStep.mockRejectedValueOnce(new WorkflowSyncingError());
|
|
175
|
+
const syncing = mutations.testStep(
|
|
176
|
+
{},
|
|
177
|
+
{ workflowId: "wf-1", stepId: "s1", ...drive },
|
|
178
|
+
CTX,
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
expect(runtime.webhookEndpoint).toHaveBeenCalledWith("wf-1", CTX, drive);
|
|
182
|
+
expect(runtime.testTrigger).toHaveBeenCalledWith("wf-1", CTX, drive);
|
|
183
|
+
await expect(syncing).rejects.toMatchObject({
|
|
184
|
+
message: WORKFLOW_SYNCING_MESSAGE,
|
|
185
|
+
extensions: { code: "WORKFLOW_SYNCING", retryable: true },
|
|
186
|
+
});
|
|
187
|
+
expect(runtime.testStep).toHaveBeenCalledWith("wf-1", "s1", CTX, drive);
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
it("hands every secret field to the runtime with the caller, never the store", async () => {
|
|
191
|
+
const { runtime, queries, mutations, secretRecord } = build();
|
|
192
|
+
const stat = { ref: "secret://v1:00", ownerId: "conn-1" };
|
|
193
|
+
|
|
194
|
+
await mutations.createSecret(
|
|
195
|
+
{},
|
|
196
|
+
{ value: "s3cret", documentId: "conn-1" },
|
|
197
|
+
CTX,
|
|
198
|
+
);
|
|
199
|
+
await mutations.rotateSecret({}, { ref: stat.ref, value: "s" }, CTX);
|
|
200
|
+
await expect(
|
|
201
|
+
mutations.deleteSecret({}, { ref: stat.ref }, CTX),
|
|
202
|
+
).resolves.toBe(true);
|
|
203
|
+
await queries.secret({}, { ref: stat.ref }, CTX);
|
|
204
|
+
await queries.secrets({}, {}, CTX);
|
|
205
|
+
await secretRecord.manageable(stat, {}, CTX);
|
|
206
|
+
|
|
207
|
+
expect(runtime.createSecret).toHaveBeenCalledWith(
|
|
208
|
+
{ value: "s3cret", label: undefined, ownerId: "conn-1" },
|
|
209
|
+
CTX,
|
|
210
|
+
);
|
|
211
|
+
expect(runtime.rotateSecret).toHaveBeenCalledWith(stat.ref, "s", CTX);
|
|
212
|
+
expect(runtime.deleteSecret).toHaveBeenCalledWith(stat.ref, CTX);
|
|
213
|
+
expect(runtime.secretStat).toHaveBeenCalledWith(stat.ref, CTX);
|
|
214
|
+
expect(runtime.listSecrets).toHaveBeenCalledWith(CTX);
|
|
215
|
+
expect(runtime.canManageSecret).toHaveBeenCalledWith(stat, CTX);
|
|
216
|
+
// Nothing reaches the raw store, whose get returns values.
|
|
217
|
+
expect(runtime.secrets).not.toHaveBeenCalled();
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
it("tags a secret minted for a document still syncing", async () => {
|
|
221
|
+
const { runtime, mutations } = build();
|
|
222
|
+
runtime.createSecret.mockRejectedValueOnce(new WorkflowSyncingError());
|
|
223
|
+
|
|
224
|
+
await expect(
|
|
225
|
+
mutations.createSecret({}, { value: "s", documentId: "c1" }, CTX),
|
|
226
|
+
).rejects.toMatchObject({
|
|
227
|
+
extensions: { code: "WORKFLOW_SYNCING", retryable: true },
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
it("serves why a workflow got no reactor access, naming the publisher", async () => {
|
|
232
|
+
const { runtime, queries } = build();
|
|
233
|
+
runtime.reactorAccessDenial.mockReturnValueOnce(
|
|
234
|
+
'The publisher 0xabc cannot read reactor connection "conn-1"',
|
|
235
|
+
);
|
|
236
|
+
|
|
237
|
+
await expect(
|
|
238
|
+
queries.reactorAccessDenial({}, { workflowId: "wf-1" }, CTX),
|
|
239
|
+
).resolves.toBe(
|
|
240
|
+
'The publisher 0xabc cannot read reactor connection "conn-1"',
|
|
241
|
+
);
|
|
242
|
+
await expect(
|
|
243
|
+
queries.reactorAccessDenial({}, { workflowId: "wf-1" }, CTX),
|
|
244
|
+
).resolves.toBeNull();
|
|
245
|
+
await expect(
|
|
246
|
+
queries.reactorAccessDenial({}, { workflowId: "wf-hidden" }, CTX),
|
|
247
|
+
).rejects.toThrow("You may not read this workflow");
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
it("serves the piece version a run's steps ran", async () => {
|
|
251
|
+
const { runtime, queries } = build();
|
|
252
|
+
runtime.run.mockResolvedValueOnce({
|
|
253
|
+
row: { id: "run-1", warnings: 1, trigger_payload: null },
|
|
254
|
+
steps: [
|
|
255
|
+
{
|
|
256
|
+
step_id: "s1",
|
|
257
|
+
input: null,
|
|
258
|
+
output: null,
|
|
259
|
+
piece_version: "2.1.0",
|
|
260
|
+
piece_source: "registry",
|
|
261
|
+
version_match: "fallback",
|
|
262
|
+
version_note:
|
|
263
|
+
"Pinned 3.0.0 is not available; runs 2.1.0 from registry",
|
|
264
|
+
},
|
|
265
|
+
],
|
|
266
|
+
} as never);
|
|
267
|
+
|
|
268
|
+
const run = (await queries.run({}, { id: "run-1" }, CTX)) as {
|
|
269
|
+
warnings: number;
|
|
270
|
+
steps: Record<string, unknown>[];
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
expect(run.warnings).toBe(1);
|
|
274
|
+
expect(run.steps[0]).toMatchObject({
|
|
275
|
+
pieceVersion: "2.1.0",
|
|
276
|
+
pieceSource: "registry",
|
|
277
|
+
versionMatch: "fallback",
|
|
278
|
+
versionNote: "Pinned 3.0.0 is not available; runs 2.1.0 from registry",
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
it("serves how many iterations a capped run detail holds back", async () => {
|
|
283
|
+
const { runtime, queries } = build();
|
|
284
|
+
runtime.run.mockResolvedValueOnce({
|
|
285
|
+
row: { id: "run-1", warnings: 0, trigger_payload: null },
|
|
286
|
+
steps: [],
|
|
287
|
+
iterationsTotal: 1200,
|
|
288
|
+
} as never);
|
|
289
|
+
const run = (await queries.run({}, { id: "run-1" }, CTX)) as {
|
|
290
|
+
iterationsTotal: number | null;
|
|
291
|
+
};
|
|
292
|
+
expect(run.iterationsTotal).toBe(1200);
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
describe("the runs listing and step data", () => {
|
|
297
|
+
it("reads step blobs only when the query selects them", async () => {
|
|
298
|
+
const { runtime, queries } = build();
|
|
299
|
+
const withData = (query: string) =>
|
|
300
|
+
queries.runs({}, {}, CTX, runsInfo(query)).then(
|
|
301
|
+
() =>
|
|
302
|
+
(runtime.runs.mock.calls.at(-1) as unknown[])[0] as {
|
|
303
|
+
withStepData: boolean;
|
|
304
|
+
},
|
|
305
|
+
);
|
|
306
|
+
|
|
307
|
+
expect(
|
|
308
|
+
(await withData("{ workflowRuntime { runs { id status } } }"))
|
|
309
|
+
.withStepData,
|
|
310
|
+
).toBe(false);
|
|
311
|
+
expect(
|
|
312
|
+
(
|
|
313
|
+
await withData(
|
|
314
|
+
"{ workflowRuntime { runs { id steps { stepId status } } } }",
|
|
315
|
+
)
|
|
316
|
+
).withStepData,
|
|
317
|
+
).toBe(false);
|
|
318
|
+
expect(
|
|
319
|
+
(
|
|
320
|
+
await withData(
|
|
321
|
+
"{ workflowRuntime { runs { id steps { stepId output } } } }",
|
|
322
|
+
)
|
|
323
|
+
).withStepData,
|
|
324
|
+
).toBe(true);
|
|
325
|
+
// A fragment can select anything, so it reads as asking for the blobs.
|
|
326
|
+
expect(
|
|
327
|
+
(
|
|
328
|
+
await withData(
|
|
329
|
+
"{ workflowRuntime { runs { id steps { ...S } } } } fragment S on WorkflowStepRunRecord { input }",
|
|
330
|
+
)
|
|
331
|
+
).withStepData,
|
|
332
|
+
).toBe(true);
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
describe("the runs page", () => {
|
|
337
|
+
it("passes paging through and serves the page", async () => {
|
|
338
|
+
const { runtime, queries } = build();
|
|
339
|
+
runtime.runsPage.mockResolvedValueOnce({
|
|
340
|
+
records: [],
|
|
341
|
+
hasNextPage: true,
|
|
342
|
+
cursor: "next",
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
const page = await queries.runsPage(
|
|
346
|
+
{},
|
|
347
|
+
{
|
|
348
|
+
driveId: "drive-1",
|
|
349
|
+
excludeTriggerKinds: ["test"],
|
|
350
|
+
paging: { limit: 10, cursor: "prev" },
|
|
351
|
+
},
|
|
352
|
+
CTX,
|
|
353
|
+
runsInfo(
|
|
354
|
+
"{ workflowRuntime { runsPage { items { id steps { status } } cursor } } }",
|
|
355
|
+
),
|
|
356
|
+
);
|
|
357
|
+
|
|
358
|
+
expect(runtime.runsPage).toHaveBeenCalledWith(
|
|
359
|
+
{
|
|
360
|
+
driveId: "drive-1",
|
|
361
|
+
excludeTriggerKinds: ["test"],
|
|
362
|
+
limit: 10,
|
|
363
|
+
cursor: "prev",
|
|
364
|
+
withStepData: false,
|
|
365
|
+
},
|
|
366
|
+
CTX,
|
|
367
|
+
);
|
|
368
|
+
expect(page).toEqual({
|
|
369
|
+
items: [],
|
|
370
|
+
hasNextPage: true,
|
|
371
|
+
hasPreviousPage: true,
|
|
372
|
+
cursor: "next",
|
|
373
|
+
});
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
it("reports a cursor it did not issue as bad input", async () => {
|
|
377
|
+
const { runtime, queries } = build();
|
|
378
|
+
const invalid = new Error("Invalid runs cursor");
|
|
379
|
+
invalid.name = "InvalidRunCursorError";
|
|
380
|
+
runtime.runsPage.mockRejectedValueOnce(invalid);
|
|
381
|
+
|
|
382
|
+
const error = (await queries
|
|
383
|
+
.runsPage({}, { paging: { cursor: "junk" } }, CTX)
|
|
384
|
+
.catch((thrown: unknown) => thrown)) as {
|
|
385
|
+
extensions?: { code?: string };
|
|
386
|
+
};
|
|
387
|
+
expect(error.extensions?.code).toBe("BAD_USER_INPUT");
|
|
388
|
+
});
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
describe("piece search", () => {
|
|
392
|
+
it("passes a valid filter through", async () => {
|
|
393
|
+
const { runtime, queries } = build();
|
|
394
|
+
await queries.searchPieces(
|
|
395
|
+
{},
|
|
396
|
+
{ query: "send", kind: "trigger", sources: ["registry", "local"] },
|
|
397
|
+
CTX,
|
|
398
|
+
);
|
|
399
|
+
expect(runtime.searchPieces).toHaveBeenCalledWith("send", {
|
|
400
|
+
kind: "trigger",
|
|
401
|
+
sources: ["registry", "local"],
|
|
402
|
+
categories: undefined,
|
|
403
|
+
limit: undefined,
|
|
404
|
+
});
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
it("refuses a kind or source it does not know, rather than widen", () => {
|
|
408
|
+
const { runtime, queries } = build();
|
|
409
|
+
expect(() =>
|
|
410
|
+
queries.searchPieces({}, { query: "send", kind: "triggers" }, CTX),
|
|
411
|
+
).toThrow(/kind is "action" or "trigger"/);
|
|
412
|
+
expect(() =>
|
|
413
|
+
queries.searchPieces(
|
|
414
|
+
{},
|
|
415
|
+
{ query: "send", kind: "action", sources: ["Registry"] },
|
|
416
|
+
CTX,
|
|
417
|
+
),
|
|
418
|
+
).toThrow(/got Registry/);
|
|
419
|
+
expect(runtime.searchPieces).not.toHaveBeenCalled();
|
|
420
|
+
});
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
describe("waitpoints", () => {
|
|
424
|
+
it("serves waiting runs with the waitpoints the runtime listed", async () => {
|
|
425
|
+
const { runtime, queries, runRecord } = build();
|
|
426
|
+
runtime.waitingRuns.mockResolvedValueOnce([
|
|
427
|
+
{
|
|
428
|
+
run: {
|
|
429
|
+
row: { id: "run-1", status: "WAITING", trigger_payload: null },
|
|
430
|
+
steps: [],
|
|
431
|
+
},
|
|
432
|
+
waitpoints: [{ id: "wp-1" }],
|
|
433
|
+
},
|
|
434
|
+
]);
|
|
435
|
+
|
|
436
|
+
const runs = (await queries.waitingRuns(
|
|
437
|
+
{},
|
|
438
|
+
{ driveId: "drive-1", first: 10 },
|
|
439
|
+
CTX,
|
|
440
|
+
)) as { id: string }[];
|
|
441
|
+
|
|
442
|
+
expect(runtime.waitingRuns).toHaveBeenCalledWith(
|
|
443
|
+
{ driveId: "drive-1", workflowId: undefined, first: 10 },
|
|
444
|
+
CTX,
|
|
445
|
+
);
|
|
446
|
+
expect(await runRecord.waitpoints(runs[0], {}, CTX)).toEqual([
|
|
447
|
+
{ id: "wp-1" },
|
|
448
|
+
]);
|
|
449
|
+
expect(runtime.waitpointsForRun).not.toHaveBeenCalled();
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
it("reads the waitpoints of every run in a request with one store call", async () => {
|
|
453
|
+
const { runtime, runRecord } = build();
|
|
454
|
+
const store = waitpointStore();
|
|
455
|
+
runtime.store.mockResolvedValueOnce(store);
|
|
456
|
+
const ctx = { ...CTX } as Context;
|
|
457
|
+
const [first, second, again] = (await Promise.all([
|
|
458
|
+
runRecord.waitpoints({ id: "run-1" }, {}, ctx),
|
|
459
|
+
runRecord.waitpoints({ id: "run-2" }, {}, ctx),
|
|
460
|
+
runRecord.waitpoints({ id: "run-1" }, {}, ctx),
|
|
461
|
+
])) as Array<Array<{ id: string }>>;
|
|
462
|
+
|
|
463
|
+
expect(first).toEqual([
|
|
464
|
+
expect.objectContaining({
|
|
465
|
+
id: "wp-run-1",
|
|
466
|
+
runId: "run-1",
|
|
467
|
+
kind: "approval",
|
|
468
|
+
approval: { title: "Pay?" },
|
|
469
|
+
}),
|
|
470
|
+
]);
|
|
471
|
+
expect(second!.map((waitpoint) => waitpoint.id)).toEqual(["wp-run-2"]);
|
|
472
|
+
expect(again).toBe(first);
|
|
473
|
+
expect(runtime.store).toHaveBeenCalledTimes(1);
|
|
474
|
+
expect(store.listWaitpointsForRuns).toHaveBeenCalledWith([
|
|
475
|
+
"run-1",
|
|
476
|
+
"run-2",
|
|
477
|
+
]);
|
|
478
|
+
// The parent resolver served the run; no second run read.
|
|
479
|
+
expect(runtime.waitpointsForRun).not.toHaveBeenCalled();
|
|
480
|
+
expect(runtime.run).not.toHaveBeenCalled();
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
it("serves no waitpoints when the run journal is unavailable", async () => {
|
|
484
|
+
const { runtime, runRecord } = build();
|
|
485
|
+
runtime.store.mockResolvedValueOnce(undefined as never);
|
|
486
|
+
expect(await runRecord.waitpoints({ id: "run-9" }, {}, CTX)).toEqual([]);
|
|
487
|
+
});
|
|
488
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { WorkflowRuntimeService } from "@powerhousedao/reactor-workflow";
|
|
2
|
+
import { hostname } from "node:os";
|
|
3
|
+
import { describe, expect, it } from "vitest";
|
|
4
|
+
import { getResolvers } from "../../src/workflow/resolvers.js";
|
|
5
|
+
|
|
6
|
+
type Resolver = (...args: unknown[]) => unknown;
|
|
7
|
+
|
|
8
|
+
describe("the runtime's host", () => {
|
|
9
|
+
it("is the switchboard on this machine, the id apps record as runner", () => {
|
|
10
|
+
const resolvers = getResolvers({} as WorkflowRuntimeService) as Record<
|
|
11
|
+
string,
|
|
12
|
+
Record<string, Resolver>
|
|
13
|
+
>;
|
|
14
|
+
expect(resolvers.WorkflowRuntimeQueries.host()).toEqual({
|
|
15
|
+
id: `switchboard@${hostname()}`,
|
|
16
|
+
label: hostname(),
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
});
|