@keystrokehq/cli 0.0.11 → 0.0.12
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/dist/{accept.handler-DWuxmMuY.mjs → accept.handler-BU6kg8ET.mjs} +1 -1
- package/dist/{admin-BK4bFTTd.mjs → admin-B4GNbCl5.mjs} +9 -9
- package/dist/{agent-manifest-sJFbH5H8.mjs → agent-manifest-CZdlCTFs.mjs} +5 -5
- package/dist/{agents-DYnw2VPX.mjs → agents-DDqXmmFV.mjs} +6 -6
- package/dist/api-DuKKdCpF.mjs +246 -0
- package/dist/{api-keys-Dizx3YqE.mjs → api-keys-BE_hLonn.mjs} +5 -5
- package/dist/{auth-BqsKd4IA.mjs → auth-DNK5MYm4.mjs} +5 -5
- package/dist/{auth.handler-BsoWeCFD.mjs → auth.handler-DrjDODhZ.mjs} +1 -1
- package/dist/{build-agents-DfbiMZ_e-CgnKa9A6.mjs → build-agents-DseUtzd4-DIDGsZWL.mjs} +12 -13
- package/dist/{build-metadata-zidV9Cai-Bq37kBOM.mjs → build-metadata-xqeWhaTS-WR8IooGe.mjs} +19 -35
- package/dist/{build-progress-DigAP-BN.mjs → build-progress-CITED2tv.mjs} +1 -1
- package/dist/{build-tasks-O1jYtlv1-Bkw0w1r3.mjs → build-tasks-GVuMLS0h-DnS9QWzf.mjs} +4 -4
- package/dist/{build-workflows-3fdvdHHf-BDTy9QgT.mjs → build-workflows-Dmzay1vP-DKVuBAjD.mjs} +17 -18
- package/dist/{build.handler-B2UDhh72.mjs → build.handler-DI146Cd3.mjs} +4 -4
- package/dist/{clear.handler-BR97yudD.mjs → clear.handler-B1c17nAi.mjs} +1 -1
- package/dist/{commander-DcftG6dX.mjs → commander-BwtBoukr.mjs} +2 -2
- package/dist/{common-B3bLe3Mk.mjs → common-BaGFkj3n.mjs} +2 -2
- package/dist/{connect-DQ4xIcyE.mjs → connect-IPcL37np.mjs} +12 -6
- package/dist/{connect.handler-CWSLgf87.mjs → connect.handler-ToY6qmMz.mjs} +74 -224
- package/dist/{context-1VgRbzr-.mjs → context-DQ4IA0yO.mjs} +1 -1
- package/dist/{create.handler-C2CkPWsy.mjs → create.handler-BAyG0PmG.mjs} +1 -1
- package/dist/credential-requirements-FtBk5JVB.mjs +250 -0
- package/dist/credentials-Bu1MBiCL.mjs +182 -0
- package/dist/{credentials-D8_AwH9o.mjs → credentials-CZiu-534.mjs} +12 -7
- package/dist/{current-deployment-workflow-B05z0EQa.mjs → current-deployment-workflow-B4IufKqe.mjs} +5 -5
- package/dist/{current.handler-CuAtMZmm.mjs → current.handler-DA4FGfUP.mjs} +1 -1
- package/dist/{declared-credential-requirements-BtlcsEVn.mjs → declared-credential-requirements-B6h4WRv4.mjs} +5 -34
- package/dist/{delete.handler-DDY3X1Zm.mjs → delete.handler-CJcyvnUF.mjs} +1 -1
- package/dist/{deploy-B8TYutOi.mjs → deploy-BvaFgVvf.mjs} +1 -1
- package/dist/{deploy-Cn6FFnOM.mjs → deploy-CqXOhecY.mjs} +2 -2
- package/dist/{deploy-progress-XAfautnA.mjs → deploy-progress-CLO-yidq.mjs} +1 -1
- package/dist/{deploy.handler-D1DcAe-h.mjs → deploy.handler-DQg_rXgs.mjs} +16 -16
- package/dist/{detect-env-access-CwkOYeYM-D4o8gRZs.mjs → detect-env-access-CwkOYeYM-EmkYvbfJ.mjs} +1 -1
- package/dist/{diff.handler-BU6IewNG.mjs → diff.handler-BXg47NIZ.mjs} +3 -3
- package/dist/{dist-DvO0q6Fo.mjs → dist-BMkNN03r.mjs} +16 -16
- package/dist/{env.handler-C6YAmHLi.mjs → env.handler-DFKzjIQT.mjs} +10 -7
- package/dist/{error-boundary-CpaVvFXk.mjs → error-boundary-B2ZKRkZI.mjs} +1 -1
- package/dist/{file-metadata-BvGM-B2v.mjs → file-metadata-Dwy9KKq_.mjs} +2 -2
- package/dist/{import-module-DDPnzlJ1-BIBSgOhK.mjs → import-module-DEI7R8Yh-Xz-KAPvB.mjs} +248 -246
- package/dist/{init-Da6_obl0.mjs → init-DhnABm3J.mjs} +2 -2
- package/dist/{init.handler-Cq2nk8DO.mjs → init.handler-QgehN8B4.mjs} +4 -4
- package/dist/{inspect.handler-D4YGryQB.mjs → inspect.handler-CerVdo23.mjs} +3 -3
- package/dist/{integration-catalog-DtNWaMvh.mjs → integration-catalog-BRrJIAVz.mjs} +5 -5
- package/dist/{integrations-CB_Ukq2g.mjs → integrations-7-U7nmkh.mjs} +7 -6
- package/dist/{invites-BOhuBtoq.mjs → invites-CmGmnUla.mjs} +4 -4
- package/dist/{invites.list.handler-C-Wv6E1g.mjs → invites.list.handler-CmkIf-uW.mjs} +1 -1
- package/dist/{invites.resend.handler-CI78XlQS.mjs → invites.resend.handler-FZl20yat.mjs} +1 -1
- package/dist/{invites.revoke.handler-DigAgNwB.mjs → invites.revoke.handler-D95mrfmB.mjs} +1 -1
- package/dist/keystroke.mjs +21 -21
- package/dist/{list-enrichment-Cxlq6BB9.mjs → list-enrichment-I4XQaMg0.mjs} +5 -1
- package/dist/{list.handler-OiLEylzS.mjs → list.handler-BrTW2viq.mjs} +1 -1
- package/dist/{list.handler-CsODcH6e.mjs → list.handler-Cp767f5l.mjs} +1 -1
- package/dist/{list.handler-BsyGhXns.mjs → list.handler-DRnHsEa0.mjs} +1 -1
- package/dist/{list.handler-B6IByHHB.mjs → list.handler-DXl8igi2.mjs} +13 -5
- package/dist/{list.handler-BpVNYShU.mjs → list.handler-DsYyTUhA.mjs} +1 -1
- package/dist/{list.handler--a1JEGSD.mjs → list.handler-H8aQSsFM.mjs} +3 -3
- package/dist/{list.handler-Dr9Ti-dt.mjs → list.handler-k8k7wVIV.mjs} +3 -3
- package/dist/{listen-DUPk6cZC.mjs → listen-DckJq0y0.mjs} +2 -2
- package/dist/{listen.handler-B5WimrfF.mjs → listen.handler-Bf5MXKPO.mjs} +2 -2
- package/dist/{logs-C5_4lh3p.mjs → logs-D_l5BIn2.mjs} +3 -3
- package/dist/{logs.handler-CBHPwDuC.mjs → logs.handler-kYO3Uv9t.mjs} +2 -2
- package/dist/{members.add.handler-LcQJYBsu.mjs → members.add.handler-C2cppd-9.mjs} +1 -1
- package/dist/{members.invite.handler-p279O2aC.mjs → members.invite.handler-DY6kS4LN.mjs} +1 -1
- package/dist/{members.list.handler-Cjukjuot.mjs → members.list.handler-CFBG3SBw.mjs} +1 -1
- package/dist/{members.remove.handler-CzxPiQFv.mjs → members.remove.handler-LQ61_qip.mjs} +1 -1
- package/dist/{members.update.handler-CX5q86e3.mjs → members.update.handler-CqISA1mf.mjs} +1 -1
- package/dist/{normalize-path-CojS-CgQ-D_WTiHKw.mjs → normalize-path-CojS-CgQ-D5D0AIHR.mjs} +1 -1
- package/dist/{org-CnlKW-Hl.mjs → org-KQ2nD0yN.mjs} +15 -15
- package/dist/{orgs.create.handler-DRILhxdn.mjs → orgs.create.handler-Mv5CTGcG.mjs} +1 -1
- package/dist/{orgs.get.handler-Cue6stoX.mjs → orgs.get.handler-DvvOhshX.mjs} +1 -1
- package/dist/{orgs.list.handler-fuDLNI5X.mjs → orgs.list.handler-wWAg6cKg.mjs} +1 -1
- package/dist/{paused.handler-CuOVH4DZ.mjs → paused.handler-CbMkPD9e.mjs} +1 -1
- package/dist/{project-config-D9eFU8Jk.mjs → project-config-CJGSh2RQ.mjs} +4 -7
- package/dist/{projects-DN7dX6nN.mjs → projects-CWLOF5x4.mjs} +656 -3
- package/dist/{projects-DdgHbUpR.mjs → projects-CYqeKQGT.mjs} +4 -4
- package/dist/{requirements.handler-CX13XiXT.mjs → requirements.handler-CnDTBcH5.mjs} +5 -5
- package/dist/{resolve-project-C6UAOfAG.mjs → resolve-project-bVPMcs-y.mjs} +1 -1
- package/dist/{run-polling-1CTIeDea.mjs → run-polling-49w3PYAv.mjs} +3 -3
- package/dist/{run.handler-BxLH75WW.mjs → run.handler-CX3YiJmj.mjs} +5 -5
- package/dist/{runs-lfE7r6i2.mjs → runs-HJejvQnQ.mjs} +2 -2
- package/dist/{schema-BgGlAs8a.mjs → schema-DFJiNWyd.mjs} +2 -1
- package/dist/schemas-DodkHgnS.mjs +280 -0
- package/dist/{skills-sync.handler-CntKndFm.mjs → skills-sync.handler-Cf74vKJA.mjs} +1 -1
- package/dist/{skills.command-X5zZwz2d.mjs → skills.command-KyAwBeST.mjs} +3 -3
- package/dist/{source-analysis-CHkWMC40.mjs → source-analysis-CJPymdaA.mjs} +1 -1
- package/dist/{source-analysis-DEEChuND-Csu0oOlw.mjs → source-analysis-DEEChuND-zifGW9QF.mjs} +3 -3
- package/dist/{src--fCtOxNX.mjs → src-D-dFmoAF.mjs} +1 -1
- package/dist/{switch.handler-RaeKZ3ZB.mjs → switch.handler-DfsKVtR6.mjs} +1 -1
- package/dist/{sync-C89mJp7Y.mjs → sync-Coh9YPjY.mjs} +2 -2
- package/dist/{sync.handler-BoAHHUQs.mjs → sync.handler-vvFIUut1.mjs} +6 -6
- package/dist/{schedule-BWAI6qLx.mjs → task-BBgEvdG1.mjs} +395 -25
- package/dist/{task-target-build-D5IrHqSl.mjs → task-target-build-atWwwnSF.mjs} +8 -8
- package/dist/task-target-deploy-CRsrQTOy.mjs +4 -0
- package/dist/{task-target-deploy-Bf5i3ox1-2K0hAwzk.mjs → task-target-deploy-CZBGNC0H-BwPSfaJQ.mjs} +2 -2
- package/dist/task-target-deploy-runner.mjs +5 -5
- package/dist/{test-gPQJRkqa.mjs → test-BzpSLhV8.mjs} +32 -144
- package/dist/{test.handler-B5GF5txS.mjs → test.handler-St9sBXyH.mjs} +1 -1
- package/dist/{trigger-artifacts-B3OCTX9K-ME6IVdUB.mjs → trigger-artifacts-RizI57RC-C-yCtEi-.mjs} +9 -9
- package/dist/{trigger-manifest-B3Gq1739.mjs → trigger-manifest-D5rnpPkA.mjs} +1 -1
- package/dist/{try-deploy.handler-dA_YGWRq.mjs → try-deploy.handler-32lU1tg4.mjs} +9 -9
- package/dist/{upgrade-xByIxaYu.mjs → upgrade-YavAf8AC.mjs} +2 -2
- package/dist/{upload.handler-BFDM6n_6.mjs → upload.handler-DemogvI1.mjs} +129 -18
- package/dist/{users.get.handler-CzaYM2bi.mjs → users.get.handler-B20PMSbl.mjs} +1 -1
- package/dist/{users.list.handler-CpOWwzBb.mjs → users.list.handler-BplFTjv3.mjs} +1 -1
- package/dist/{users.set-role.handler-BjiSNP2d.mjs → users.set-role.handler-wdmI6o3G.mjs} +1 -1
- package/dist/{utils-C_qCshBA.mjs → utils-DpEtybzI.mjs} +2 -2
- package/dist/{validate.handler-BtDSKAFY.mjs → validate.handler-BoRyygMl.mjs} +3 -3
- package/dist/{workflow-build-Z2_jkOsZ.mjs → workflow-build-CoJMwpPO.mjs} +32 -32
- package/dist/{workflow-manifest-BfL74mjp.mjs → workflow-build-manifest-OPFqFD6f.mjs} +26 -28
- package/dist/{workflow-bundler-BzHk73PM-tt09RbIA.mjs → workflow-bundler-BzHk73PM-UJQa7Ubk.mjs} +2 -2
- package/dist/{workflows-V09d2r2H.mjs → workflows-Cag9O9hx.mjs} +26 -27
- package/dist/{writer-CtvttJdP-DZJ0mZCm.mjs → writer-CtvttJdP-BfNsrheU.mjs} +5 -5
- package/package.json +10 -8
- package/dist/constants-BUgIAu2a.mjs +0 -8
- package/dist/credential-requirements-BCW8aQWS.mjs +0 -480
- package/dist/credentials-DAQfKqn0.mjs +0 -152025
- package/dist/get-intrinsic-BjqiGgLt.mjs +0 -658
- package/dist/hosted-action-dispatcher-registry-BWEtn13o.mjs +0 -126
- package/dist/schema-B-Wgo4rJ.mjs +0 -81
- package/dist/schemas-9FmGqrPT.mjs +0 -42
- package/dist/task-1qz1XNq7.mjs +0 -96
- package/dist/task-target-deploy-Bzfftyru.mjs +0 -4
- /package/dist/{agent-bundle-package-DWV6B_5q-B-qzc3zC.mjs → agent-bundle-package-DWV6B_5q-cB76j6UL.mjs} +0 -0
- /package/dist/{browser-CvuyMLhI.mjs → browser-B4K0VW8p.mjs} +0 -0
- /package/dist/{clear-cache.handler-D-wboLB6.mjs → clear-cache.handler-Dywqc7TG.mjs} +0 -0
- /package/dist/{clear.handler-BC6pz0x-.mjs → clear.handler-ui4e1CnJ.mjs} +0 -0
- /package/dist/{concurrency-gXn9Rw8x-CnBnF2cg.mjs → concurrency-gXn9Rw8x-CaI6Vtbu.mjs} +0 -0
- /package/dist/{credential-env-map-C23GV6LN.mjs → credential-env-map-D0zgoUl0.mjs} +0 -0
- /package/dist/{credential-schema-mismatch-DM9Y91jL.mjs → credential-schema-mismatch-8pqwvswO.mjs} +0 -0
- /package/dist/{diff-utils-AATn2n56.mjs → diff-utils-BoXI705D.mjs} +0 -0
- /package/dist/{layout-CXkZEsXI.mjs → layout-DRf9qUf8.mjs} +0 -0
- /package/dist/{logs.handler-ClIIOeQB.mjs → logs.handler-DxSKmDCq.mjs} +0 -0
- /package/dist/{metadata-layout-C6ed-9dl-C6Bylr_z.mjs → metadata-layout-C6ed-9dl-EF5pCtIH.mjs} +0 -0
- /package/dist/{options-CIVqkc8V.mjs → options-DFPs-tAB.mjs} +0 -0
- /package/dist/{oxc-B3KI3rf_-ghZc3xZ5.mjs → oxc-B3KI3rf_-CHDUXsus.mjs} +0 -0
- /package/dist/{read-credential-keys-77a91T8M-B0eiobOd.mjs → read-credential-keys-77a91T8M-CzXPGxdU.mjs} +0 -0
- /package/dist/{register.handler-CpP_KB2u.mjs → register.handler-D7ZZAnGP.mjs} +0 -0
- /package/dist/{rolldown-runtime-twds-ZHy-RuJszab7.mjs → rolldown-runtime-twds-ZHy-3DMm_Sby.mjs} +0 -0
- /package/dist/{run-polling-DDpkIvwy.mjs → run-polling-Cb4ssXIE.mjs} +0 -0
- /package/dist/{schema-display-DuWBmkwk.mjs → schema-display-CyCWSgfY.mjs} +0 -0
- /package/dist/{skills.handler-CofL4oKs.mjs → skills.handler-C_4VzVmc.mjs} +0 -0
- /package/dist/{spinner-progress-Bt8zXPOc.mjs → spinner-progress-CS1BEdNB.mjs} +0 -0
- /package/dist/{status.handler-6cuHa0R0.mjs → status.handler-Cm9aNUBn.mjs} +0 -0
- /package/dist/{sync-keystroke-agent-skills-D746f2W_.mjs → sync-keystroke-agent-skills-CX9fS5nQ.mjs} +0 -0
- /package/dist/{upgrade.handler-DhKeyCy5.mjs → upgrade.handler-C2eZ_tg3.mjs} +0 -0
- /package/dist/{upload-C1qFWMm0.mjs → upload-C0kaZu08.mjs} +0 -0
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { n as findProjectRoot } from "./project-config-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { a as FlowGraphSchema,
|
|
7
|
-
import {
|
|
8
|
-
import { n as TriggerRuntimeDescriptorSchema, r as triggerBaseConfigSchema } from "./schemas-9FmGqrPT.mjs";
|
|
9
|
-
import { t as runWithConcurrency } from "./concurrency-gXn9Rw8x-CnBnF2cg.mjs";
|
|
3
|
+
import { n as findProjectRoot } from "./project-config-CJGSh2RQ.mjs";
|
|
4
|
+
import { c as optionalDescriptionString, i as createStructuralSchema, l as optionalTrimmedNonEmptyString, o as idNoSpacesString, r as anyZodSchemaSchema, s as jsonSchemaObject, t as CredentialSetManifestSchema, u as trimmedNonEmptyString } from "./schemas-DodkHgnS.mjs";
|
|
5
|
+
import { n as DeclaredCredentialRequirementSchema } from "./credential-requirements-FtBk5JVB.mjs";
|
|
6
|
+
import { a as FlowGraphSchema, i as WorkflowCoreManifestSchema, n as WORKFLOW_MANIFEST_SCHEMA_VERSION } from "./workflow-build-manifest-OPFqFD6f.mjs";
|
|
7
|
+
import { t as runWithConcurrency } from "./concurrency-gXn9Rw8x-CaI6Vtbu.mjs";
|
|
10
8
|
import { createRequire } from "node:module";
|
|
11
9
|
import * as os from "node:os";
|
|
12
10
|
import * as path$1 from "node:path";
|
|
@@ -15,11 +13,12 @@ import { z } from "zod";
|
|
|
15
13
|
import { execFile } from "node:child_process";
|
|
16
14
|
import { randomUUID } from "node:crypto";
|
|
17
15
|
import { promisify } from "node:util";
|
|
16
|
+
import { cronTriggerManifestSchema, pollingTriggerManifestSchema, webhookTriggerManifestSchema } from "@keystrokehq/core/trigger";
|
|
18
17
|
//#region ../../packages/core/src/mcp-server/schemas.ts
|
|
19
|
-
const credentialSetInstanceSchema$
|
|
18
|
+
const credentialSetInstanceSchema$1 = createStructuralSchema([
|
|
20
19
|
"id",
|
|
21
20
|
"auth",
|
|
22
|
-
"
|
|
21
|
+
"connections"
|
|
23
22
|
], "a CredentialSet instance");
|
|
24
23
|
const McpTransportSchema = z.discriminatedUnion("type", [
|
|
25
24
|
z.object({
|
|
@@ -44,7 +43,7 @@ z.object({
|
|
|
44
43
|
name: optionalTrimmedNonEmptyString("MCP server name"),
|
|
45
44
|
description: optionalDescriptionString("MCP server description"),
|
|
46
45
|
transport: McpTransportSchema,
|
|
47
|
-
credentialSets: z.array(credentialSetInstanceSchema$
|
|
46
|
+
credentialSets: z.array(credentialSetInstanceSchema$1).optional(),
|
|
48
47
|
credentials: z.function().optional()
|
|
49
48
|
});
|
|
50
49
|
const McpServerManifestSchema = z.object({
|
|
@@ -68,10 +67,10 @@ const McpServerManifestSchema = z.object({
|
|
|
68
67
|
});
|
|
69
68
|
//#endregion
|
|
70
69
|
//#region ../../packages/core/src/messaging-gateway/schemas.ts
|
|
71
|
-
const credentialSetInstanceSchema
|
|
70
|
+
const credentialSetInstanceSchema = createStructuralSchema([
|
|
72
71
|
"id",
|
|
73
72
|
"auth",
|
|
74
|
-
"
|
|
73
|
+
"connections"
|
|
75
74
|
], "a CredentialSet instance");
|
|
76
75
|
const MessagingGatewayModeSchema = z.enum(["platform", "custom"]);
|
|
77
76
|
const MessagingGatewayCredentialScopeSchema = z.enum(["organization", "project"]);
|
|
@@ -81,7 +80,7 @@ z.object({
|
|
|
81
80
|
description: optionalDescriptionString("MessagingGateway description"),
|
|
82
81
|
provider: z.string().min(1, "MessagingGateway provider is required"),
|
|
83
82
|
mode: MessagingGatewayModeSchema,
|
|
84
|
-
credentialSet: credentialSetInstanceSchema
|
|
83
|
+
credentialSet: credentialSetInstanceSchema,
|
|
85
84
|
credentialScope: MessagingGatewayCredentialScopeSchema.optional(),
|
|
86
85
|
appRef: z.string().min(1).optional()
|
|
87
86
|
});
|
|
@@ -254,151 +253,8 @@ const AgentManifestSchema = z.object({
|
|
|
254
253
|
sandbox: SandboxManifestSchema.optional(),
|
|
255
254
|
messaging: z.array(MessagingGatewayManifestSchema).optional()
|
|
256
255
|
});
|
|
257
|
-
triggerBaseConfigSchema.extend({
|
|
258
|
-
input: anyZodSchemaSchema,
|
|
259
|
-
payload: z.custom((value) => {
|
|
260
|
-
return jsonValueSchema.safeParse(value).success;
|
|
261
|
-
}, "Expected a JSON-serializable payload"),
|
|
262
|
-
schedule: ScheduleSchema,
|
|
263
|
-
timezone: IANATimezoneSchema.optional()
|
|
264
|
-
});
|
|
265
|
-
const cronTriggerRuntimeSchema = TriggerRuntimeDescriptorSchema.extend({
|
|
266
|
-
input: jsonSchemaObject,
|
|
267
|
-
payloadMode: z.literal("static"),
|
|
268
|
-
schedule: z.string(),
|
|
269
|
-
timezone: z.string().optional()
|
|
270
|
-
});
|
|
271
|
-
const cronTriggerManifestSchema = z.object({
|
|
272
|
-
manifestVersion: z.literal(1),
|
|
273
|
-
type: z.literal("trigger"),
|
|
274
|
-
triggerType: z.literal("cron"),
|
|
275
|
-
name: trimmedNonEmptyString("Trigger name"),
|
|
276
|
-
description: descriptionString("Trigger description"),
|
|
277
|
-
enabled: z.boolean(),
|
|
278
|
-
modeDefault: z.enum(["managed", "subscribable"]),
|
|
279
|
-
executionIdentityPolicy: triggerBaseConfigSchema.shape.executionIdentityPolicy,
|
|
280
|
-
credentialSets: z.array(CredentialSetManifestSchema).optional(),
|
|
281
|
-
runtime: cronTriggerRuntimeSchema,
|
|
282
|
-
/** Static payload for cron triggers — the workflow input when this trigger fires */
|
|
283
|
-
payload: jsonValueSchema.optional()
|
|
284
|
-
});
|
|
285
|
-
z.object({
|
|
286
|
-
lastPolledAt: z.string().optional(),
|
|
287
|
-
lastResponse: z.unknown().optional()
|
|
288
|
-
});
|
|
289
|
-
triggerBaseConfigSchema.extend({
|
|
290
|
-
poll: z.function(),
|
|
291
|
-
filter: z.function().optional(),
|
|
292
|
-
idempotencyKey: z.function().optional(),
|
|
293
|
-
response: anyZodSchemaSchema,
|
|
294
|
-
schedule: ScheduleSchema
|
|
295
|
-
});
|
|
296
|
-
const pollingTriggerRuntimeSchema = TriggerRuntimeDescriptorSchema.extend({
|
|
297
|
-
response: jsonSchemaObject,
|
|
298
|
-
schedule: z.string(),
|
|
299
|
-
state: z.object({
|
|
300
|
-
lastPolledAt: z.literal(true),
|
|
301
|
-
lastResponse: z.literal(true)
|
|
302
|
-
})
|
|
303
|
-
});
|
|
304
|
-
const pollingTriggerManifestSchema = z.object({
|
|
305
|
-
manifestVersion: z.literal(1),
|
|
306
|
-
type: z.literal("trigger"),
|
|
307
|
-
triggerType: z.literal("polling"),
|
|
308
|
-
name: trimmedNonEmptyString("Trigger name"),
|
|
309
|
-
description: descriptionString("Trigger description"),
|
|
310
|
-
enabled: z.boolean(),
|
|
311
|
-
modeDefault: z.enum(["managed", "subscribable"]),
|
|
312
|
-
executionIdentityPolicy: triggerBaseConfigSchema.shape.executionIdentityPolicy,
|
|
313
|
-
credentialSets: z.array(CredentialSetManifestSchema).optional(),
|
|
314
|
-
runtime: pollingTriggerRuntimeSchema
|
|
315
|
-
});
|
|
316
|
-
//#endregion
|
|
317
|
-
//#region ../../packages/core/src/trigger/webhook/schemas.ts
|
|
318
|
-
const WebhookMethodSchema = z.enum([
|
|
319
|
-
"PATCH",
|
|
320
|
-
"POST",
|
|
321
|
-
"PUT"
|
|
322
|
-
]);
|
|
323
|
-
z.object({
|
|
324
|
-
method: z.string(),
|
|
325
|
-
path: z.string(),
|
|
326
|
-
query: z.record(z.string(), z.union([
|
|
327
|
-
z.string(),
|
|
328
|
-
z.array(z.string()),
|
|
329
|
-
z.undefined()
|
|
330
|
-
])),
|
|
331
|
-
headers: z.record(z.string(), z.string().optional()),
|
|
332
|
-
rawBody: z.string()
|
|
333
|
-
});
|
|
334
|
-
const WebhookResponseConfigSchema = z.object({
|
|
335
|
-
ignoredBody: jsonValueSchema.optional(),
|
|
336
|
-
ignoredStatus: z.number().int().positive().optional(),
|
|
337
|
-
successBody: jsonValueSchema.optional(),
|
|
338
|
-
successStatus: z.number().int().positive().optional()
|
|
339
|
-
});
|
|
340
|
-
/**
|
|
341
|
-
* Custom webhook trigger paths describe the suffix that a request URL has
|
|
342
|
-
* after the organization id. The router serves these triggers at
|
|
343
|
-
* `/api/v1/webhooks/{orgId}{path}` (e.g. `path: '/orders'` → request
|
|
344
|
-
* `/api/v1/webhooks/{orgId}/orders`). Authors must therefore supply only the
|
|
345
|
-
* trailing path segment, not the `/webhooks/` prefix that the route already
|
|
346
|
-
* provides.
|
|
347
|
-
*/
|
|
348
|
-
const webhookPathSchema = z.string().trim().min(1, { error: "Webhook path cannot be empty" }).max(50, { error: "Webhook path cannot exceed 50 characters" }).refine((s) => !/\s/.test(s), { error: "Webhook path cannot contain spaces or whitespace" }).refine((s) => s.startsWith("/"), { error: "Webhook path must start with /" }).refine((s) => s.length > 1, { error: "Webhook path must include a path segment after the leading \"/\"" }).refine((s) => !/^\/webhooks(\/|$)/i.test(s), { error: "Webhook path must not start with \"/webhooks\". Provide just the suffix that follows the organization id in the URL — e.g. use \"/orders\" for a webhook served at \"/api/v1/webhooks/{orgId}/orders\"." });
|
|
349
|
-
const credentialSetInstanceSchema = createStructuralSchema([
|
|
350
|
-
"id",
|
|
351
|
-
"auth",
|
|
352
|
-
"needsResolve"
|
|
353
|
-
], "a CredentialSet instance");
|
|
354
|
-
const webhookCustomSourceConfigSchema = z.object({
|
|
355
|
-
type: z.literal("custom"),
|
|
356
|
-
method: WebhookMethodSchema,
|
|
357
|
-
path: webhookPathSchema,
|
|
358
|
-
verify: z.function().optional(),
|
|
359
|
-
response: WebhookResponseConfigSchema.optional(),
|
|
360
|
-
credentialSets: z.array(credentialSetInstanceSchema).optional()
|
|
361
|
-
});
|
|
362
|
-
const webhookAppSourceConfigSchema = z.object({
|
|
363
|
-
type: z.literal("app"),
|
|
364
|
-
appRef: trimmedNonEmptyString("appRef")
|
|
365
|
-
});
|
|
366
|
-
const webhookSourceConfigSchema = z.discriminatedUnion("type", [webhookCustomSourceConfigSchema, webhookAppSourceConfigSchema]);
|
|
367
|
-
const webhookCustomSourceManifestSchema = z.object({
|
|
368
|
-
type: z.literal("custom"),
|
|
369
|
-
method: WebhookMethodSchema,
|
|
370
|
-
path: z.string().min(1).max(1024),
|
|
371
|
-
response: WebhookResponseConfigSchema.optional()
|
|
372
|
-
});
|
|
373
|
-
const webhookAppSourceManifestSchema = z.object({
|
|
374
|
-
type: z.literal("app"),
|
|
375
|
-
appRef: trimmedNonEmptyString("appRef")
|
|
376
|
-
});
|
|
377
|
-
const WebhookSourceManifestSchema = z.discriminatedUnion("type", [webhookCustomSourceManifestSchema, webhookAppSourceManifestSchema]);
|
|
378
|
-
triggerBaseConfigSchema.omit({ credentialSets: true }).extend({
|
|
379
|
-
source: webhookSourceConfigSchema,
|
|
380
|
-
payload: anyZodSchemaSchema.optional(),
|
|
381
|
-
filter: z.function().optional(),
|
|
382
|
-
idempotencyKey: z.function().optional()
|
|
383
|
-
});
|
|
384
|
-
const webhookTriggerRuntimeSchema = TriggerRuntimeDescriptorSchema.extend({
|
|
385
|
-
source: WebhookSourceManifestSchema,
|
|
386
|
-
payload: jsonSchemaObject
|
|
387
|
-
});
|
|
388
|
-
const webhookTriggerManifestSchema = z.object({
|
|
389
|
-
manifestVersion: z.literal(1),
|
|
390
|
-
type: z.literal("trigger"),
|
|
391
|
-
triggerType: z.literal("webhook"),
|
|
392
|
-
name: trimmedNonEmptyString("Trigger name"),
|
|
393
|
-
description: descriptionString("Trigger description"),
|
|
394
|
-
enabled: z.boolean(),
|
|
395
|
-
modeDefault: z.enum(["managed", "subscribable"]),
|
|
396
|
-
executionIdentityPolicy: triggerBaseConfigSchema.shape.executionIdentityPolicy,
|
|
397
|
-
credentialSets: z.array(CredentialSetManifestSchema).optional(),
|
|
398
|
-
runtime: webhookTriggerRuntimeSchema
|
|
399
|
-
});
|
|
400
256
|
//#endregion
|
|
401
|
-
//#region ../../packages/workflow-builder/dist/import-module-
|
|
257
|
+
//#region ../../packages/workflow-builder/dist/import-module-DEI7R8Yh.mjs
|
|
402
258
|
var DiscoveryError = class extends Error {
|
|
403
259
|
code;
|
|
404
260
|
filePath;
|
|
@@ -518,9 +374,8 @@ import {
|
|
|
518
374
|
webhookTrigger,
|
|
519
375
|
pollingTrigger,
|
|
520
376
|
} from '@keystrokehq/core';
|
|
521
|
-
import { getOfficialIntegrationMetadata } from '@keystrokehq/core/_runtime';
|
|
522
|
-
import { analyzeSuspensions, analyzeWorkflowCredentials, isTabularSchema } from '@keystrokehq/core/flow-graph-toolkit';
|
|
523
377
|
import { parseSync } from ${JSON.stringify(OXC_PARSER_IMPORT_URL)};
|
|
378
|
+
import { z } from 'zod';
|
|
524
379
|
|
|
525
380
|
Object.assign(globalThis, {
|
|
526
381
|
Workflow,
|
|
@@ -543,10 +398,98 @@ Object.assign(globalThis, {
|
|
|
543
398
|
const encodedInput = process.env.KEYSTROKE_WORKFLOW_LOADER_INPUT;
|
|
544
399
|
const staticFlowModuleCache = new Map();
|
|
545
400
|
const staticFlowResolutionCache = new Map();
|
|
401
|
+
const OFFICIAL_OPERATION_METADATA_REGISTRY_KEY = '__ks_official_integration_metadata_registry';
|
|
402
|
+
|
|
403
|
+
function getOfficialOperationMetadata(operation) {
|
|
404
|
+
const registry = globalThis[OFFICIAL_OPERATION_METADATA_REGISTRY_KEY];
|
|
405
|
+
return registry && typeof registry.get === 'function' ? registry.get(operation) : undefined;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
async function analyzeSuspensions(workflow) {
|
|
409
|
+
return analyzeSuspensionsFromGraph(await workflow.toFlowGraph());
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
function analyzeSuspensionsFromGraph(graph) {
|
|
413
|
+
const reasons = [];
|
|
414
|
+
for (const node of graph.nodes) {
|
|
415
|
+
if (node.type !== 'step' || node.data.kind !== 'call') continue;
|
|
416
|
+
const data = node.data;
|
|
417
|
+
if (data.callKind === 'hook') {
|
|
418
|
+
reasons.push({ kind: 'hook', location: data.source, detail: data.stepName, hookName: data.stepName });
|
|
419
|
+
}
|
|
420
|
+
if (data.callKind === 'agent') {
|
|
421
|
+
reasons.push({ kind: 'agent', location: data.source, detail: data.stepName });
|
|
422
|
+
}
|
|
423
|
+
if (data.callKind === 'child-workflow') {
|
|
424
|
+
reasons.push({
|
|
425
|
+
kind: 'child-workflow-suspending',
|
|
426
|
+
location: data.source,
|
|
427
|
+
detail: data.stepName,
|
|
428
|
+
authoredWorkflowId: data.stepId,
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
const classification = reasons.length === 0 ? 'A' : reasons.every((reason) => reason.kind === 'wait') ? 'B' : 'C';
|
|
433
|
+
return { hasSuspensions: reasons.length > 0, reasons, classification };
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
async function analyzeWorkflowCredentials(workflow) {
|
|
437
|
+
return analyzeWorkflowCredentialsFromGraph(await workflow.toFlowGraph(), {
|
|
438
|
+
runSource: typeof workflow.getRunFunctionSource === 'function' ? workflow.getRunFunctionSource() : undefined,
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
function analyzeWorkflowCredentialsFromGraph(graph, options = {}) {
|
|
443
|
+
const all = dedupeCredentialSets(
|
|
444
|
+
graph.nodes.flatMap((node) =>
|
|
445
|
+
node.type === 'step' && node.data.kind === 'call' ? (node.data.credentialSets ?? []) : []
|
|
446
|
+
)
|
|
447
|
+
);
|
|
448
|
+
const guardedCredentialIds = extractHasCredentialSetIds(options.runSource);
|
|
449
|
+
const conditional = dedupeCredentialSets(
|
|
450
|
+
all.filter((credentialSet) => isGuardedByHasCredentialSet(credentialSet, guardedCredentialIds))
|
|
451
|
+
);
|
|
452
|
+
const conditionalIds = new Set(conditional.map((credentialSet) => credentialSet.resolvedId));
|
|
453
|
+
const required = all.filter((credentialSet) => !conditionalIds.has(credentialSet.resolvedId));
|
|
454
|
+
return { required, conditional, all };
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
function isTabularSchema(schema) {
|
|
458
|
+
return schema instanceof z.ZodArray && schema.element instanceof z.ZodObject && Object.keys(schema.element.shape).length > 0;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
function dedupeCredentialSets(credentialSets) {
|
|
462
|
+
const byId = new Map();
|
|
463
|
+
for (const credentialSet of credentialSets) {
|
|
464
|
+
byId.set(credentialSet.resolvedId, credentialSet);
|
|
465
|
+
}
|
|
466
|
+
return [...byId.values()];
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function extractHasCredentialSetIds(source) {
|
|
470
|
+
const ids = new Set();
|
|
471
|
+
if (!source) return ids;
|
|
472
|
+
const pattern = new RegExp("\\\\.hasCredentialSet\\\\(\\\\s*['\\"\\\\x60]([^'\\"\\\\x60]+)['\\"\\\\x60]\\\\s*\\\\)", "g");
|
|
473
|
+
let match = pattern.exec(source);
|
|
474
|
+
while (match) {
|
|
475
|
+
const id = match[1];
|
|
476
|
+
if (id) ids.add(id);
|
|
477
|
+
match = pattern.exec(source);
|
|
478
|
+
}
|
|
479
|
+
return ids;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
function isGuardedByHasCredentialSet(credentialSet, guardedIds) {
|
|
483
|
+
if (guardedIds.size === 0) return false;
|
|
484
|
+
const shortId = credentialSet.resolvedId.includes(':')
|
|
485
|
+
? credentialSet.resolvedId.split(':').at(-1)
|
|
486
|
+
: credentialSet.resolvedId;
|
|
487
|
+
return guardedIds.has(credentialSet.resolvedId) || (shortId ? guardedIds.has(shortId) : false);
|
|
488
|
+
}
|
|
546
489
|
|
|
547
490
|
function serializeError(error) {
|
|
548
491
|
if (error instanceof Error && Array.isArray(error.issues)) {
|
|
549
|
-
const messages = error.issues.map(issue => issue.message).filter(Boolean);
|
|
492
|
+
const messages = error.issues.map((issue) => issue.message).filter(Boolean);
|
|
550
493
|
if (messages.length > 0) {
|
|
551
494
|
return messages.join('; ');
|
|
552
495
|
}
|
|
@@ -587,10 +530,8 @@ function getCredentialRequirements(value) {
|
|
|
587
530
|
|
|
588
531
|
function getAgentToolId(tool) {
|
|
589
532
|
if (tool instanceof Workflow) return tool.id;
|
|
590
|
-
const integrationMetadata =
|
|
591
|
-
return integrationMetadata
|
|
592
|
-
? integrationMetadata.integrationId + '_' + tool.id
|
|
593
|
-
: tool.id;
|
|
533
|
+
const integrationMetadata = getOfficialOperationMetadata(tool);
|
|
534
|
+
return integrationMetadata ? integrationMetadata.integrationId + '_' + tool.id : tool.id;
|
|
594
535
|
}
|
|
595
536
|
|
|
596
537
|
/**
|
|
@@ -631,13 +572,12 @@ async function computeAgentToolEnrichments(agent) {
|
|
|
631
572
|
}
|
|
632
573
|
|
|
633
574
|
if (tool instanceof Operation) {
|
|
634
|
-
const integrationMetadata =
|
|
575
|
+
const integrationMetadata = getOfficialOperationMetadata(tool);
|
|
635
576
|
const enrichment = {
|
|
636
577
|
dispatch: integrationMetadata?.hosted ? 'host' : 'sandbox',
|
|
637
578
|
outputSchemaIsTabular: isTabularSchema(tool.output),
|
|
638
579
|
};
|
|
639
580
|
enrichments[toolId] = enrichment;
|
|
640
|
-
continue;
|
|
641
581
|
}
|
|
642
582
|
}
|
|
643
583
|
|
|
@@ -771,7 +711,7 @@ function buildCredentialsByCallsiteFingerprint(params) {
|
|
|
771
711
|
.map(([bindingName, entries]) => ({
|
|
772
712
|
category: 'unmatched-callsite',
|
|
773
713
|
bindingName,
|
|
774
|
-
credentialSetIds: [...new Set(entries.map((entry) => entry.
|
|
714
|
+
credentialSetIds: [...new Set(entries.map((entry) => entry.credentialSetId))].sort(),
|
|
775
715
|
}));
|
|
776
716
|
|
|
777
717
|
return { credentialsByCallsiteFingerprint, warnings };
|
|
@@ -800,7 +740,9 @@ function deduplicateCredentialRequirementEntries(entries) {
|
|
|
800
740
|
sortedOptionalAuthKeys.join(','),
|
|
801
741
|
sortedStoredKeys.join(','),
|
|
802
742
|
sortedOptionalStoredKeys.join(','),
|
|
803
|
-
typeof entry.
|
|
743
|
+
typeof entry.dynamicResolutionCacheMs === 'number'
|
|
744
|
+
? String(entry.dynamicResolutionCacheMs)
|
|
745
|
+
: '',
|
|
804
746
|
entry.onCredentialRevoked ?? '',
|
|
805
747
|
].join('|');
|
|
806
748
|
if (!deduped.has(key)) {
|
|
@@ -936,15 +878,18 @@ async function createImportResolutions(options) {
|
|
|
936
878
|
if (!options.runCalleeNames.has(localName)) {
|
|
937
879
|
continue;
|
|
938
880
|
}
|
|
939
|
-
resolutions.set(
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
881
|
+
resolutions.set(
|
|
882
|
+
localName,
|
|
883
|
+
await enrichImportResolution({
|
|
884
|
+
exportName: 'default',
|
|
885
|
+
importSource: {
|
|
886
|
+
...importSourceBase,
|
|
887
|
+
importName: 'default',
|
|
888
|
+
localName,
|
|
889
|
+
},
|
|
890
|
+
resolvedPath,
|
|
891
|
+
})
|
|
892
|
+
);
|
|
948
893
|
continue;
|
|
949
894
|
}
|
|
950
895
|
|
|
@@ -957,15 +902,18 @@ async function createImportResolutions(options) {
|
|
|
957
902
|
if (!options.runCalleeNames.has(localName)) {
|
|
958
903
|
continue;
|
|
959
904
|
}
|
|
960
|
-
resolutions.set(
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
905
|
+
resolutions.set(
|
|
906
|
+
localName,
|
|
907
|
+
await enrichImportResolution({
|
|
908
|
+
exportName: importName,
|
|
909
|
+
importSource: {
|
|
910
|
+
...importSourceBase,
|
|
911
|
+
importName,
|
|
912
|
+
localName,
|
|
913
|
+
},
|
|
914
|
+
resolvedPath,
|
|
915
|
+
})
|
|
916
|
+
);
|
|
969
917
|
continue;
|
|
970
918
|
}
|
|
971
919
|
|
|
@@ -977,15 +925,18 @@ async function createImportResolutions(options) {
|
|
|
977
925
|
if (!options.runCalleeNames.has(localName)) {
|
|
978
926
|
continue;
|
|
979
927
|
}
|
|
980
|
-
resolutions.set(
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
928
|
+
resolutions.set(
|
|
929
|
+
localName,
|
|
930
|
+
await enrichImportResolution({
|
|
931
|
+
exportName: localName,
|
|
932
|
+
importSource: {
|
|
933
|
+
...importSourceBase,
|
|
934
|
+
kind: 'namespace-import',
|
|
935
|
+
localName,
|
|
936
|
+
},
|
|
937
|
+
resolvedPath,
|
|
938
|
+
})
|
|
939
|
+
);
|
|
989
940
|
}
|
|
990
941
|
}
|
|
991
942
|
|
|
@@ -1015,7 +966,10 @@ async function enrichImportResolution(resolution) {
|
|
|
1015
966
|
if (!instance || typeof instance.toManifest !== 'function') {
|
|
1016
967
|
if (isLocalTypedPrimitiveImport(resolution)) {
|
|
1017
968
|
throw new Error(
|
|
1018
|
-
'Could not resolve typed primitive export "' +
|
|
969
|
+
'Could not resolve typed primitive export "' +
|
|
970
|
+
importSource.importName +
|
|
971
|
+
'" from ' +
|
|
972
|
+
resolution.resolvedPath
|
|
1019
973
|
);
|
|
1020
974
|
}
|
|
1021
975
|
staticFlowResolutionCache.set(cacheKey, null);
|
|
@@ -1024,11 +978,15 @@ async function enrichImportResolution(resolution) {
|
|
|
1024
978
|
|
|
1025
979
|
const manifest = compactManifestForFlowGraph(instance.toManifest());
|
|
1026
980
|
const credentialRequirements =
|
|
1027
|
-
typeof instance.getCredentialRequirements === 'function'
|
|
981
|
+
typeof instance.getCredentialRequirements === 'function'
|
|
982
|
+
? instance.getCredentialRequirements()
|
|
983
|
+
: [];
|
|
1028
984
|
const inputSchema = getInputSchema(manifest);
|
|
1029
985
|
const outputSchema = getOutputSchema(manifest);
|
|
1030
986
|
const nestedRunSource =
|
|
1031
|
-
typeof instance.getRunFunctionSource === 'function'
|
|
987
|
+
typeof instance.getRunFunctionSource === 'function'
|
|
988
|
+
? instance.getRunFunctionSource()
|
|
989
|
+
: undefined;
|
|
1032
990
|
|
|
1033
991
|
const enriched = {
|
|
1034
992
|
...resolution,
|
|
@@ -1115,10 +1073,19 @@ function inferCallKindFromPath(filePath, manifest) {
|
|
|
1115
1073
|
return manifest?.type === 'agent' ? 'agent' : 'workflow-step';
|
|
1116
1074
|
}
|
|
1117
1075
|
const lower = filePath.toLowerCase();
|
|
1118
|
-
if (
|
|
1076
|
+
if (
|
|
1077
|
+
lower.endsWith('.agent.ts') ||
|
|
1078
|
+
lower.endsWith('.agent.tsx') ||
|
|
1079
|
+
lower.endsWith('.agent.mts') ||
|
|
1080
|
+
manifest?.type === 'agent'
|
|
1081
|
+
) {
|
|
1119
1082
|
return 'agent';
|
|
1120
1083
|
}
|
|
1121
|
-
if (
|
|
1084
|
+
if (
|
|
1085
|
+
lower.endsWith('.workflow.ts') ||
|
|
1086
|
+
lower.endsWith('.workflow.tsx') ||
|
|
1087
|
+
lower.endsWith('.workflow.mts')
|
|
1088
|
+
) {
|
|
1122
1089
|
return 'child-workflow';
|
|
1123
1090
|
}
|
|
1124
1091
|
return 'workflow-step';
|
|
@@ -1171,7 +1138,7 @@ function isLocalTypedPrimitiveImport(resolution) {
|
|
|
1171
1138
|
|
|
1172
1139
|
function credentialRequirementToFlowGraphEntry(entry) {
|
|
1173
1140
|
return {
|
|
1174
|
-
resolvedId: entry.
|
|
1141
|
+
resolvedId: entry.credentialSetId,
|
|
1175
1142
|
credentialKeys: [...(entry.credentialKeys ?? [])],
|
|
1176
1143
|
...(entry.scope ? { scope: entry.scope } : {}),
|
|
1177
1144
|
...(entry.alias ? { alias: entry.alias } : {}),
|
|
@@ -1182,14 +1149,15 @@ function credentialRequirementToFlowGraphEntry(entry) {
|
|
|
1182
1149
|
...(Array.isArray(entry.storedCredentialKeys) && entry.storedCredentialKeys.length > 0
|
|
1183
1150
|
? { storedCredentialKeys: [...entry.storedCredentialKeys] }
|
|
1184
1151
|
: {}),
|
|
1185
|
-
...(Array.isArray(entry.optionalStoredCredentialKeys) &&
|
|
1152
|
+
...(Array.isArray(entry.optionalStoredCredentialKeys) &&
|
|
1153
|
+
entry.optionalStoredCredentialKeys.length > 0
|
|
1186
1154
|
? { optionalStoredCredentialKeys: [...entry.optionalStoredCredentialKeys] }
|
|
1187
1155
|
: {}),
|
|
1188
1156
|
...(entry.proxy ? { proxy: entry.proxy } : {}),
|
|
1189
1157
|
...(entry.needsRawSecret === true ? { needsRawSecret: true } : {}),
|
|
1190
|
-
...(entry.
|
|
1191
|
-
...(typeof entry.
|
|
1192
|
-
? {
|
|
1158
|
+
...(entry.needsDynamicResolution === true ? { needsDynamicResolution: true } : {}),
|
|
1159
|
+
...(typeof entry.dynamicResolutionCacheMs === 'number' && entry.dynamicResolutionCacheMs > 0
|
|
1160
|
+
? { dynamicResolutionCacheMs: entry.dynamicResolutionCacheMs }
|
|
1193
1161
|
: {}),
|
|
1194
1162
|
...(entry.onCredentialRevoked ? { onCredentialRevoked: entry.onCredentialRevoked } : {}),
|
|
1195
1163
|
...(entry.schemaFingerprint ? { schemaFingerprint: entry.schemaFingerprint } : {}),
|
|
@@ -1198,7 +1166,7 @@ function credentialRequirementToFlowGraphEntry(entry) {
|
|
|
1198
1166
|
|
|
1199
1167
|
function manifestCredentialSetToFlowGraphEntry(entry) {
|
|
1200
1168
|
return {
|
|
1201
|
-
resolvedId: entry.
|
|
1169
|
+
resolvedId: entry.id,
|
|
1202
1170
|
credentialKeys: Array.isArray(entry.credentialKeys)
|
|
1203
1171
|
? [...entry.credentialKeys]
|
|
1204
1172
|
: Object.keys(entry.auth?.properties ?? {}),
|
|
@@ -1213,14 +1181,15 @@ function manifestCredentialSetToFlowGraphEntry(entry) {
|
|
|
1213
1181
|
: Object.keys(entry.stored?.properties ?? {}).length > 0
|
|
1214
1182
|
? { storedCredentialKeys: Object.keys(entry.stored?.properties ?? {}) }
|
|
1215
1183
|
: {}),
|
|
1216
|
-
...(Array.isArray(entry.optionalStoredCredentialKeys) &&
|
|
1184
|
+
...(Array.isArray(entry.optionalStoredCredentialKeys) &&
|
|
1185
|
+
entry.optionalStoredCredentialKeys.length > 0
|
|
1217
1186
|
? { optionalStoredCredentialKeys: [...entry.optionalStoredCredentialKeys] }
|
|
1218
1187
|
: {}),
|
|
1219
1188
|
...(entry.proxy ? { proxy: entry.proxy } : {}),
|
|
1220
1189
|
...(entry.needsRawSecret === true ? { needsRawSecret: true } : {}),
|
|
1221
|
-
...(entry.
|
|
1222
|
-
...(typeof entry.
|
|
1223
|
-
? {
|
|
1190
|
+
...(entry.needsDynamicResolution === true ? { needsDynamicResolution: true } : {}),
|
|
1191
|
+
...(typeof entry.dynamicResolutionCacheMs === 'number' && entry.dynamicResolutionCacheMs > 0
|
|
1192
|
+
? { dynamicResolutionCacheMs: entry.dynamicResolutionCacheMs }
|
|
1224
1193
|
: {}),
|
|
1225
1194
|
...(entry.onCredentialRevoked ? { onCredentialRevoked: entry.onCredentialRevoked } : {}),
|
|
1226
1195
|
...(entry.schemaFingerprint ? { schemaFingerprint: entry.schemaFingerprint } : {}),
|
|
@@ -1235,7 +1204,9 @@ function parseSourceFile(filePath, sourceText) {
|
|
|
1235
1204
|
preserveParens: true,
|
|
1236
1205
|
});
|
|
1237
1206
|
if (result.errors.length > 0) {
|
|
1238
|
-
throw new Error(
|
|
1207
|
+
throw new Error(
|
|
1208
|
+
'Failed to parse ' + filePath + ': ' + result.errors.map((error) => error.message).join('; ')
|
|
1209
|
+
);
|
|
1239
1210
|
}
|
|
1240
1211
|
return {
|
|
1241
1212
|
program: result.program,
|
|
@@ -1279,7 +1250,9 @@ function isExportedDeclaration(statement) {
|
|
|
1279
1250
|
return (
|
|
1280
1251
|
statement.type === 'ExportNamedDeclaration' &&
|
|
1281
1252
|
isNode(statement.declaration) &&
|
|
1282
|
-
['VariableDeclaration', 'FunctionDeclaration', 'ClassDeclaration'].includes(
|
|
1253
|
+
['VariableDeclaration', 'FunctionDeclaration', 'ClassDeclaration'].includes(
|
|
1254
|
+
statement.declaration.type
|
|
1255
|
+
)
|
|
1283
1256
|
);
|
|
1284
1257
|
}
|
|
1285
1258
|
|
|
@@ -1338,7 +1311,7 @@ async function resolveStepCredentialsFromImports(flowGraph) {
|
|
|
1338
1311
|
const reqs = instance.getCredentialRequirements();
|
|
1339
1312
|
if (Array.isArray(reqs) && reqs.length > 0) {
|
|
1340
1313
|
node.data.credentialSets = reqs.map((r) => ({
|
|
1341
|
-
resolvedId: r.
|
|
1314
|
+
resolvedId: r.credentialSetId,
|
|
1342
1315
|
credentialKeys: r.credentialKeys,
|
|
1343
1316
|
...(Array.isArray(r.optionalCredentialKeys) && r.optionalCredentialKeys.length > 0
|
|
1344
1317
|
? { optionalCredentialKeys: r.optionalCredentialKeys }
|
|
@@ -1352,9 +1325,9 @@ async function resolveStepCredentialsFromImports(flowGraph) {
|
|
|
1352
1325
|
: {}),
|
|
1353
1326
|
...(r.proxy ? { proxy: r.proxy } : {}),
|
|
1354
1327
|
...(r.needsRawSecret === true ? { needsRawSecret: true } : {}),
|
|
1355
|
-
...(r.
|
|
1356
|
-
...(typeof r.
|
|
1357
|
-
? {
|
|
1328
|
+
...(r.needsDynamicResolution === true ? { needsDynamicResolution: true } : {}),
|
|
1329
|
+
...(typeof r.dynamicResolutionCacheMs === 'number' && r.dynamicResolutionCacheMs > 0
|
|
1330
|
+
? { dynamicResolutionCacheMs: r.dynamicResolutionCacheMs }
|
|
1358
1331
|
: {}),
|
|
1359
1332
|
...(r.onCredentialRevoked ? { onCredentialRevoked: r.onCredentialRevoked } : {}),
|
|
1360
1333
|
...(r.schemaFingerprint ? { schemaFingerprint: r.schemaFingerprint } : {}),
|
|
@@ -1388,7 +1361,6 @@ function discoverCredentialsByBindingName(mod) {
|
|
|
1388
1361
|
result[value.name] = entries;
|
|
1389
1362
|
}
|
|
1390
1363
|
}
|
|
1391
|
-
continue;
|
|
1392
1364
|
}
|
|
1393
1365
|
}
|
|
1394
1366
|
return result;
|
|
@@ -1418,14 +1390,23 @@ async function loadSiblingTriggerModules(workflowFilePath) {
|
|
|
1418
1390
|
}
|
|
1419
1391
|
|
|
1420
1392
|
function isTriggerLike(value) {
|
|
1421
|
-
return
|
|
1422
|
-
|
|
1393
|
+
return (
|
|
1394
|
+
value != null &&
|
|
1395
|
+
(typeof value === 'object' || typeof value === 'function') &&
|
|
1396
|
+
typeof value.toManifest === 'function' &&
|
|
1397
|
+
typeof value.name === 'string'
|
|
1398
|
+
);
|
|
1423
1399
|
}
|
|
1424
1400
|
|
|
1425
1401
|
function isBoundTriggerLike(value) {
|
|
1426
|
-
return
|
|
1427
|
-
|
|
1428
|
-
|
|
1402
|
+
return (
|
|
1403
|
+
value != null &&
|
|
1404
|
+
(typeof value === 'object' || typeof value === 'function') &&
|
|
1405
|
+
value.isBoundTrigger === true &&
|
|
1406
|
+
value.trigger != null &&
|
|
1407
|
+
typeof value.trigger.toManifest === 'function' &&
|
|
1408
|
+
typeof value.trigger.name === 'string'
|
|
1409
|
+
);
|
|
1429
1410
|
}
|
|
1430
1411
|
|
|
1431
1412
|
function getTriggerCandidate(value) {
|
|
@@ -1438,7 +1419,6 @@ function getTriggerCandidate(value) {
|
|
|
1438
1419
|
return null;
|
|
1439
1420
|
}
|
|
1440
1421
|
|
|
1441
|
-
|
|
1442
1422
|
function describeTriggerEntry(entry) {
|
|
1443
1423
|
if (entry && typeof entry === 'object') {
|
|
1444
1424
|
if ('isBoundTrigger' in entry && entry.isBoundTrigger === true && entry.trigger) {
|
|
@@ -1465,7 +1445,12 @@ function findTriggerSource(entry, trigger, workflowMod, workflowFilePath, siblin
|
|
|
1465
1445
|
for (const { filePath, exports: triggerMod } of siblingModules) {
|
|
1466
1446
|
for (const [name, exp] of Object.entries(triggerMod)) {
|
|
1467
1447
|
const candidate = getTriggerCandidate(exp);
|
|
1468
|
-
if (
|
|
1448
|
+
if (
|
|
1449
|
+
exp === entry ||
|
|
1450
|
+
exp === trigger ||
|
|
1451
|
+
candidate === trigger ||
|
|
1452
|
+
candidate?.name === triggerName
|
|
1453
|
+
) {
|
|
1469
1454
|
siblingMatches.push({ triggerExportName: name, sourceFilePath: filePath });
|
|
1470
1455
|
continue;
|
|
1471
1456
|
}
|
|
@@ -1481,7 +1466,12 @@ function findTriggerSource(entry, trigger, workflowMod, workflowFilePath, siblin
|
|
|
1481
1466
|
.map((match) => String(match.triggerExportName) + ' (' + String(match.sourceFilePath) + ')')
|
|
1482
1467
|
.join(', ');
|
|
1483
1468
|
throw new Error(
|
|
1484
|
-
'Ambiguous trigger source for "' +
|
|
1469
|
+
'Ambiguous trigger source for "' +
|
|
1470
|
+
triggerName +
|
|
1471
|
+
'" in ' +
|
|
1472
|
+
workflowFilePath +
|
|
1473
|
+
'. Matching sibling exports: ' +
|
|
1474
|
+
matchList
|
|
1485
1475
|
);
|
|
1486
1476
|
}
|
|
1487
1477
|
|
|
@@ -1506,18 +1496,40 @@ async function discoverTriggers(workflow, mod, workflowFilePath) {
|
|
|
1506
1496
|
const trigger = isBound ? entry.trigger : entry;
|
|
1507
1497
|
const triggerManifest = trigger.toManifest();
|
|
1508
1498
|
const hasTransform = isBound && typeof entry.transform === 'function';
|
|
1509
|
-
const hasFilter = isBound
|
|
1510
|
-
|
|
1499
|
+
const hasFilter = isBound
|
|
1500
|
+
? typeof entry.filter === 'function'
|
|
1501
|
+
: typeof trigger.filter === 'function';
|
|
1502
|
+
const { triggerExportName, sourceFilePath } = findTriggerSource(
|
|
1503
|
+
entry,
|
|
1504
|
+
trigger,
|
|
1505
|
+
mod,
|
|
1506
|
+
workflowFilePath,
|
|
1507
|
+
siblingModules
|
|
1508
|
+
);
|
|
1511
1509
|
// For cron triggers, capture the static payload for runtime use
|
|
1512
|
-
const staticPayload =
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1510
|
+
const staticPayload =
|
|
1511
|
+
triggerManifest.triggerType === 'cron' && 'payload' in trigger
|
|
1512
|
+
? trigger.payload
|
|
1513
|
+
: undefined;
|
|
1514
|
+
triggers.push({
|
|
1515
|
+
triggerManifest,
|
|
1516
|
+
triggerExportName,
|
|
1517
|
+
sourceFilePath,
|
|
1518
|
+
hasTransform,
|
|
1519
|
+
hasFilter,
|
|
1520
|
+
staticPayload,
|
|
1521
|
+
triggerIndex,
|
|
1522
|
+
});
|
|
1516
1523
|
} catch (error) {
|
|
1517
1524
|
const triggerName = describeTriggerEntry(entry);
|
|
1518
1525
|
const message = serializeError(error);
|
|
1519
1526
|
throw new Error(
|
|
1520
|
-
'Failed to discover trigger "' +
|
|
1527
|
+
'Failed to discover trigger "' +
|
|
1528
|
+
triggerName +
|
|
1529
|
+
'" for workflow "' +
|
|
1530
|
+
workflow.name +
|
|
1531
|
+
'": ' +
|
|
1532
|
+
message
|
|
1521
1533
|
);
|
|
1522
1534
|
}
|
|
1523
1535
|
}
|
|
@@ -2027,7 +2039,7 @@ function parseBatchOutput(output, workflowsByKey) {
|
|
|
2027
2039
|
continue;
|
|
2028
2040
|
}
|
|
2029
2041
|
const workflowResult = parsedResult;
|
|
2030
|
-
const manifest =
|
|
2042
|
+
const manifest = normalizeWorkflowBuildManifest(workflowResult.manifest, workflow);
|
|
2031
2043
|
results.push({
|
|
2032
2044
|
ok: true,
|
|
2033
2045
|
bindingKey,
|
|
@@ -2095,7 +2107,7 @@ function parseLoaderOutput(output, discoveredWorkflow) {
|
|
|
2095
2107
|
if (parsedResult.status === "error") throw new WorkflowMetadataLoadError(parsedResult.phase, parsedResult.error);
|
|
2096
2108
|
const workflowResult = parsedResult;
|
|
2097
2109
|
return {
|
|
2098
|
-
manifest:
|
|
2110
|
+
manifest: normalizeWorkflowBuildManifest(workflowResult.manifest, discoveredWorkflow),
|
|
2099
2111
|
flowGraph: workflowResult.flowGraph,
|
|
2100
2112
|
triggers: workflowResult.triggers.map((t) => ({
|
|
2101
2113
|
...t,
|
|
@@ -2110,22 +2122,12 @@ function parseLoaderOutput(output, discoveredWorkflow) {
|
|
|
2110
2122
|
throw new WorkflowLoaderProtocolError("stdout", `Invalid workflow loader response: ${error instanceof Error ? error.message : String(error)}`, output);
|
|
2111
2123
|
}
|
|
2112
2124
|
}
|
|
2113
|
-
function
|
|
2125
|
+
function normalizeWorkflowBuildManifest(manifest, discoveredWorkflow) {
|
|
2114
2126
|
const parsedManifest = WorkflowCoreManifestSchema.parse(manifest);
|
|
2115
2127
|
return WorkflowCoreManifestSchema.parse({
|
|
2116
2128
|
...parsedManifest,
|
|
2117
2129
|
schemaVersion: WORKFLOW_MANIFEST_SCHEMA_VERSION,
|
|
2118
|
-
exportName: parsedManifest.exportName ?? discoveredWorkflow.exportName
|
|
2119
|
-
buildInfo: parsedManifest.buildInfo ?? {
|
|
2120
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2121
|
-
builderVersion: "workflow-builder",
|
|
2122
|
-
generatedBy: "local-build",
|
|
2123
|
-
nodeVersion: process.version,
|
|
2124
|
-
platform: process.platform,
|
|
2125
|
-
sourceChecksumAlgorithm: "sha256",
|
|
2126
|
-
sourceChecksum: "0".repeat(64),
|
|
2127
|
-
generatedFiles: []
|
|
2128
|
-
}
|
|
2130
|
+
exportName: parsedManifest.exportName ?? discoveredWorkflow.exportName
|
|
2129
2131
|
});
|
|
2130
2132
|
}
|
|
2131
2133
|
//#endregion
|