@powerhousedao/switchboard 6.2.3-dev.11 → 6.2.3-dev.13
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/workflow/harness.d.ts +45 -0
- package/.tsbuild/test/workflow/harness.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/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-unsigned.test.d.ts +2 -0
- package/.tsbuild/test/workflow/webhook-unsigned.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/tsconfig.tsbuildinfo +1 -1
- package/CHANGELOG.md +17 -0
- package/dist/index.mjs +1 -1
- package/dist/{server-CiKkVE6g.mjs → server-DndPNlPT.mjs} +548 -8
- package/dist/server-DndPNlPT.mjs.map +1 -0
- package/dist/server.d.mts +21 -3
- package/dist/server.d.mts.map +1 -1
- package/dist/server.mjs +3 -3
- package/package.json +17 -13
- package/test/workflow/harness.ts +237 -0
- package/test/workflow/resolvers.test.ts +105 -0
- package/test/workflow/webhook-dedupe.test.ts +295 -0
- package/test/workflow/webhook-signed.test.ts +509 -0
- package/test/workflow/webhook-unsigned.test.ts +332 -0
- package/test/workflow-runtime.test.ts +412 -0
- package/tsconfig.json +6 -0
- package/dist/server-CiKkVE6g.mjs.map +0 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type WorkflowRuntimeService } from "@powerhousedao/reactor-workflow";
|
|
2
|
+
import type { OperationWithContext } from "document-model";
|
|
3
|
+
export declare const WORKFLOW_TYPE = "powerhouse/workflow";
|
|
4
|
+
export declare const PACKAGE_NAME = "@powerhousedao/workflow";
|
|
5
|
+
/** A ref the harness's secret store resolves; anything else rejects. */
|
|
6
|
+
export declare const SECRET_REF = "secret://v1:00112233445566778899aabbccddeeff";
|
|
7
|
+
export declare const SECRET = "s3cret";
|
|
8
|
+
export interface FiredRun {
|
|
9
|
+
workflowId: string;
|
|
10
|
+
payload: unknown;
|
|
11
|
+
kind: string;
|
|
12
|
+
}
|
|
13
|
+
export interface WebhookHost {
|
|
14
|
+
/** Origin the endpoint is served from, e.g. `http://127.0.0.1:53124`. */
|
|
15
|
+
readonly url: string;
|
|
16
|
+
/** Runs the trigger started, in order. Cleared by `arm`. */
|
|
17
|
+
readonly fired: FiredRun[];
|
|
18
|
+
readonly service: WorkflowRuntimeService;
|
|
19
|
+
/** Publishes an ENABLED workflow with `config`; returns its endpoint. */
|
|
20
|
+
arm(config: Record<string, unknown>, options?: {
|
|
21
|
+
blockType?: string;
|
|
22
|
+
workflowId?: string;
|
|
23
|
+
}): Promise<{
|
|
24
|
+
token: string;
|
|
25
|
+
url: string;
|
|
26
|
+
}>;
|
|
27
|
+
/** Publishes the same workflow as DISABLED, keeping its endpoint row. */
|
|
28
|
+
disarm(workflowId?: string): Promise<void>;
|
|
29
|
+
/** The policy the service hands the reactor for one endpoint. */
|
|
30
|
+
policyFor(workflowId?: string): Promise<unknown>;
|
|
31
|
+
deliver(token: string, init?: {
|
|
32
|
+
method?: string;
|
|
33
|
+
headers?: Record<string, string>;
|
|
34
|
+
body?: string;
|
|
35
|
+
query?: Record<string, string>;
|
|
36
|
+
}): Promise<Response>;
|
|
37
|
+
stop(): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
export declare const DEFAULT_WORKFLOW = "wf-integration";
|
|
40
|
+
export declare function workflowOperation(state: Record<string, unknown>, workflowId?: string): OperationWithContext;
|
|
41
|
+
export declare function startWebhookHost(options?: {
|
|
42
|
+
fire?: (run: FiredRun) => unknown;
|
|
43
|
+
}): Promise<WebhookHost>;
|
|
44
|
+
export declare function waitForRuns(host: WebhookHost, count: number, timeoutMs?: number): Promise<FiredRun[]>;
|
|
45
|
+
//# sourceMappingURL=harness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harness.d.ts","sourceRoot":"","sources":["../../../test/workflow/harness.ts"],"names":[],"mappings":"AASA,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,iCAAiC,CAAC;AAKzC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAI3D,eAAO,MAAM,aAAa,wBAAwB,CAAC;AACnD,eAAO,MAAM,YAAY,4BAA4B,CAAC;AACtD,wEAAwE;AACxE,eAAO,MAAM,UAAU,iDAAiD,CAAC;AACzE,eAAO,MAAM,MAAM,WAAW,CAAC;AAI/B,MAAM,WAAW,QAAQ;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,yEAAyE;IACzE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC,yEAAyE;IACzE,GAAG,CACD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GACpD,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3C,yEAAyE;IACzE,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,iEAAiE;IACjE,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,OAAO,CACL,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE;QACL,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAChC,GACA,OAAO,CAAC,QAAQ,CAAC,CAAC;IACrB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED,eAAO,MAAM,gBAAgB,mBAAmB,CAAC;AAMjD,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,UAAU,SAAmB,GAC5B,oBAAoB,CAiBtB;AAID,wBAAsB,gBAAgB,CACpC,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,OAAO,CAAA;CAAO,GAClD,OAAO,CAAC,WAAW,CAAC,CA2HtB;AAID,wBAAsB,WAAW,CAC/B,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,MAAM,EACb,SAAS,SAAO,GACf,OAAO,CAAC,QAAQ,EAAE,CAAC,CAWrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolvers.test.d.ts","sourceRoot":"","sources":["../../../test/workflow/resolvers.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-dedupe.test.d.ts","sourceRoot":"","sources":["../../../test/workflow/webhook-dedupe.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-signed.test.d.ts","sourceRoot":"","sources":["../../../test/workflow/webhook-signed.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-unsigned.test.d.ts","sourceRoot":"","sources":["../../../test/workflow/webhook-unsigned.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-runtime.test.d.ts","sourceRoot":"","sources":["../../test/workflow-runtime.test.ts"],"names":[],"mappings":""}
|