@keystrokehq/cli 0.0.1 → 0.0.3

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.
Files changed (151) hide show
  1. package/AGENTS-blurb.md +1 -1
  2. package/LICENSE +0 -21
  3. package/README.md +14 -6
  4. package/dist/accept.handler-DFtM0IuO.mjs +22 -0
  5. package/dist/admin-D_7tenRC.mjs +208 -0
  6. package/dist/{agent-manifest-CDnbkR2f.mjs → agent-manifest-Bfa3DBgc.mjs} +4 -4
  7. package/dist/{agents-CZJGxVqV.mjs → agents-DMEo-6QB.mjs} +8 -8
  8. package/dist/api-keys-BThGvtdn.mjs +58 -0
  9. package/dist/{auth-DN2VusyU.mjs → auth-CY0Gg9sN.mjs} +7 -11
  10. package/dist/{auth.handler-CT1BQUvu.mjs → auth.handler-CbhiLOG1.mjs} +83 -8
  11. package/dist/{build-agents-BmM_AsSd-BGi9wtzt.mjs → build-agents-DfbiMZ_e-CRnzruSu.mjs} +7 -7
  12. package/dist/{build-metadata-BWS7uhd_-DR8gJjTX.mjs → build-metadata-zidV9Cai-RgG4ndIH.mjs} +11 -11
  13. package/dist/{build-progress-DgYKb4hB.mjs → build-progress-Cn2j1LqF.mjs} +1 -1
  14. package/dist/{build-tasks-CdihpudT-D5r5HUHe.mjs → build-tasks-O1jYtlv1-Y65uGWuz.mjs} +4 -5
  15. package/dist/{build-workflows-CfxBnIWh-CdYPv8w2.mjs → build-workflows-3fdvdHHf-DJ_lH1NH.mjs} +9 -9
  16. package/dist/{build.handler-4799CjWH.mjs → build.handler-Tb3IpABI.mjs} +5 -5
  17. package/dist/{clear-cache.handler-B9tqSoSM.mjs → clear-cache.handler-BEbPz5Ej.mjs} +1 -1
  18. package/dist/{clear.handler-BydlX-zE.mjs → clear.handler-CtOZ4aRn.mjs} +1 -1
  19. package/dist/{clear.handler-BTIXXPTJ.mjs → clear.handler-YS8gPriq.mjs} +2 -2
  20. package/dist/{commander-DfTVqQ-3.mjs → commander-DZ3F3CVq.mjs} +6 -5
  21. package/dist/common-BrVAdUyD.mjs +20 -0
  22. package/dist/{connect-BUXkeH0F.mjs → connect-DpQgYg8z.mjs} +3 -3
  23. package/dist/{connect.handler-CYel9cy6.mjs → connect.handler-DuRr_yyN.mjs} +5 -5
  24. package/dist/{context-T7HZuB97.mjs → context-Y1f1hGYy.mjs} +7 -7
  25. package/dist/create.handler-uNG3I4wS.mjs +24 -0
  26. package/dist/credential-requirements-DjDFthio.mjs +480 -0
  27. package/dist/{credential-schema-mismatch-BKo5PjcQ.mjs → credential-schema-mismatch-B-wwbCvw.mjs} +2 -2
  28. package/dist/{credentials-OfVHOtG3.mjs → credentials-DHlK_O4L.mjs} +823 -14
  29. package/dist/{credentials-CvmjU0lK.mjs → credentials-UpgEcaub.mjs} +7 -7
  30. package/dist/{current-deployment-workflow-poHt27i3.mjs → current-deployment-workflow-M8GEIHxv.mjs} +5 -5
  31. package/dist/{current.handler-B8zKzfPp.mjs → current.handler-BqPUKCvn.mjs} +1 -1
  32. package/dist/declared-credential-requirements-Bwlb-KZE.mjs +132 -0
  33. package/dist/default-urls-BS4twrsS.mjs +7 -0
  34. package/dist/{delete.handler-bAu1iXVQ.mjs → delete.handler-CJTHVZaz.mjs} +1 -1
  35. package/dist/{deploy-7Jjls436.mjs → deploy-CdnaZY3s.mjs} +1 -1
  36. package/dist/{deploy-BOPIpRWm.mjs → deploy-Gw0KPrkf.mjs} +2 -2
  37. package/dist/{deploy-progress-BmGUNFKg.mjs → deploy-progress-CZ2rPlOj.mjs} +1 -1
  38. package/dist/{deploy.handler-BAzgiNhd.mjs → deploy.handler-zzFAt7pp.mjs} +18 -18
  39. package/dist/{detect-env-access-CwkOYeYM-D_BCZqV6.mjs → detect-env-access-CwkOYeYM-h2W05D_Q.mjs} +1 -1
  40. package/dist/{diff.handler-Du7SY8K4.mjs → diff.handler--zdSkUnK.mjs} +5 -5
  41. package/dist/{dist-CUK7yBM0.mjs → dist-BF6r1hfv.mjs} +3 -3
  42. package/dist/{dist-BkJUoBiG.mjs → dist-C2Dq_nx3.mjs} +12 -12
  43. package/dist/{env-91KwMKov.mjs → env-YTZGKGIu.mjs} +9 -10
  44. package/dist/{env.handler-BAzBuMzQ.mjs → env.handler-d4sJ706C.mjs} +8 -8
  45. package/dist/{error-boundary-VL-JLfIa.mjs → error-boundary-B9PgBkv8.mjs} +2 -2
  46. package/dist/{file-metadata-D1vm-XY2.mjs → file-metadata-CdFXMMIw.mjs} +1 -1
  47. package/dist/hosted-action-dispatcher-registry-TOVzMhUR.mjs +126 -0
  48. package/dist/iam-command-utils-CNC8JfZ5.mjs +72 -0
  49. package/dist/{import-module-CV84H5fZ-B_CBCmb4.mjs → import-module-DDPnzlJ1-CYJD2n2b.mjs} +395 -10
  50. package/dist/{init-DpMCotSK.mjs → init-C0sps8R7.mjs} +2 -2
  51. package/dist/{init.handler-CPRnif52.mjs → init.handler-DSW6XFZn.mjs} +17 -17
  52. package/dist/{inspect.handler-DT_cD036.mjs → inspect.handler-DbN0ZVTh.mjs} +5 -5
  53. package/dist/{integration-catalog-Bt-L3GjF.mjs → integration-catalog-DFlytKJS.mjs} +2 -2
  54. package/dist/{integrations-DlatPK4W.mjs → integrations-Dcadds2b.mjs} +5 -5
  55. package/dist/invites-DvsxTRAb.mjs +44 -0
  56. package/dist/invites.list.handler-B5quln3m.mjs +43 -0
  57. package/dist/invites.resend.handler-CSpj7bQ5.mjs +23 -0
  58. package/dist/invites.revoke.handler-_hdEkBdO.mjs +28 -0
  59. package/dist/keystroke.mjs +31 -22
  60. package/dist/{list-enrichment-y-cwizLr.mjs → list-enrichment-CTqx0Rk_.mjs} +1 -1
  61. package/dist/{list.handler-CWF_Dj15.mjs → list.handler-08GY-wnx.mjs} +1 -1
  62. package/dist/{list.handler-DWaQkJaR.mjs → list.handler-20v4uRMk.mjs} +2 -2
  63. package/dist/{list.handler-BTWvCyjA.mjs → list.handler-BRq-nScx.mjs} +5 -5
  64. package/dist/{list.handler-lq3ZGAn4.mjs → list.handler-CWO6DExh.mjs} +3 -3
  65. package/dist/{list.handler-CZ6G2x_G.mjs → list.handler-DAiJtW20.mjs} +3 -3
  66. package/dist/list.handler-DLl8ca6F.mjs +42 -0
  67. package/dist/{list.handler-DqbFcBW7.mjs → list.handler-DSPr0OxS.mjs} +7 -7
  68. package/dist/{logs-BEg9L5l8.mjs → logs-D_48skmi.mjs} +3 -3
  69. package/dist/{logs.handler-BD_dXiL1.mjs → logs.handler-4ctMVYMj.mjs} +3 -3
  70. package/dist/{logs.handler-6hoMBzqw.mjs → logs.handler-C3QnSCaH.mjs} +1 -1
  71. package/dist/members.add.handler-Dq_giQ8g.mjs +31 -0
  72. package/dist/members.invite.handler-v404bUsq.mjs +32 -0
  73. package/dist/members.list.handler-D6TE0yp8.mjs +43 -0
  74. package/dist/members.remove.handler-BhQ3cyeR.mjs +28 -0
  75. package/dist/members.update.handler-BVy2cv1K.mjs +28 -0
  76. package/dist/{metadata-layout-GUYIUo0i-_aG2zjue.mjs → metadata-layout-C6ed-9dl-aBmqqvD5.mjs} +2 -2
  77. package/dist/{normalize-path-CojS-CgQ-DLCOvnD1.mjs → normalize-path-CojS-CgQ-BKRFUzWW.mjs} +1 -1
  78. package/dist/org-CkRr-f3S.mjs +234 -0
  79. package/dist/orgs.create.handler-swGnT2ce.mjs +26 -0
  80. package/dist/orgs.get.handler-ClAqYTH0.mjs +28 -0
  81. package/dist/orgs.list.handler-D-ptz8It.mjs +41 -0
  82. package/dist/{paused.handler-BMFm9Cff.mjs → paused.handler-B3aVqw-m.mjs} +2 -2
  83. package/dist/{project-config-D1qsQlO7.mjs → project-config-opj6DsPF.mjs} +2 -2
  84. package/dist/{projects-CHkRE9rS.mjs → projects-Bdl6-Z8l.mjs} +2 -2
  85. package/dist/{projects-Cjb7sovS.mjs → projects-yA9AAaDM.mjs} +5 -5
  86. package/dist/{register.handler-BPCdor1_.mjs → register.handler-WzpvVXHx.mjs} +1 -1
  87. package/dist/{requirements.handler-DPXdSks3.mjs → requirements.handler-coArDE8x.mjs} +7 -7
  88. package/dist/{resolve-project-DDJ29sCF.mjs → resolve-project-DgfftdPm.mjs} +2 -2
  89. package/dist/{runs-D9hNLb9A.mjs → runs-B8mW4PqP.mjs} +3 -3
  90. package/dist/schedule-BRN4hzQM.mjs +505 -0
  91. package/dist/schema-_FQrHcIS.mjs +17 -0
  92. package/dist/schema-kbMHVnhm.mjs +81 -0
  93. package/dist/schemas-DsvCZfF0.mjs +42 -0
  94. package/dist/{skills-sync.handler-DIy8GR16.mjs → skills-sync.handler-C2faeat-.mjs} +2 -2
  95. package/dist/{skills.command-CrjI2dN9.mjs → skills.command-DWxcc3Ui.mjs} +4 -4
  96. package/dist/source-analysis-BspLa3E5.mjs +75 -0
  97. package/dist/{source-analysis-Cj-ADyu--BJQcFPCG.mjs → source-analysis-DEEChuND-eixwPnPP.mjs} +5 -5
  98. package/dist/{src-eHwu-Gfw.mjs → src-J09NGJ6Z.mjs} +42 -6
  99. package/dist/{switch.handler-D_9213Vf.mjs → switch.handler-C4hgbhcH.mjs} +2 -2
  100. package/dist/{sync-BL_Mo5st.mjs → sync-CL6zXiiA.mjs} +2 -2
  101. package/dist/{sync.handler-BUFPdzWz.mjs → sync.handler-D1uF8E8I.mjs} +8 -8
  102. package/dist/{schemas-CDib1RhE.mjs → task-DsrXI6XH.mjs} +10 -39
  103. package/dist/{task-target-build-CBeCKbu2.mjs → task-target-build-DTzz4fpG.mjs} +4 -4
  104. package/dist/task-target-deploy-BPLlP__P.mjs +4 -0
  105. package/dist/{task-target-deploy-CA6elFpF-BEr4gkol.mjs → task-target-deploy-Bf5i3ox1-BU16VPsE.mjs} +2 -3
  106. package/dist/task-target-deploy-runner.mjs +15 -14
  107. package/dist/{test-BHTgR3UA.mjs → test-BsTLXIPB.mjs} +31 -31
  108. package/dist/{test.handler-BcPQ8b74.mjs → test.handler-D25kziPi.mjs} +1 -1
  109. package/dist/{trigger-artifacts-DQPbQNqC-B4yeeFBY.mjs → trigger-artifacts-B3OCTX9K-DG-FGGJT.mjs} +5 -5
  110. package/dist/{trigger-manifest-CY7brZeg.mjs → trigger-manifest-CXD9I7Rb.mjs} +1 -2
  111. package/dist/{try-deploy.handler-DqybNhXx.mjs → try-deploy.handler-2aX5TmLk.mjs} +11 -11
  112. package/dist/{upload.handler-DCtiznQp.mjs → upload.handler-CqProKVJ.mjs} +10 -10
  113. package/dist/users.get.handler-C_d2GWKX.mjs +24 -0
  114. package/dist/users.list.handler-DXAsO8Yk.mjs +36 -0
  115. package/dist/users.set-role.handler-Bn_yV4RI.mjs +27 -0
  116. package/dist/{utils-CywxCDM7.mjs → utils-DlYHjGg9.mjs} +2 -2
  117. package/dist/{validate.handler-DOcTaJL0.mjs → validate.handler-CGD6GttR.mjs} +5 -5
  118. package/dist/{workflow-build-DBQaBfnn.mjs → workflow-build-BcaIdRR6.mjs} +22 -45
  119. package/dist/{workflow-bundler-BPiqVscj-X1PFFAuP.mjs → workflow-bundler-BzHk73PM-Cde7cKiU.mjs} +4 -4
  120. package/dist/{_manifest-JSRE3H8k.mjs → workflow-manifest-CAW5FlX0.mjs} +7 -131
  121. package/dist/{workflows-g9z87AJJ.mjs → workflows-S-gbfw8f.mjs} +16 -15
  122. package/dist/{writer-BG8poUm3-BbXlU2kI.mjs → writer-CtvttJdP-DrJruQgR.mjs} +8 -8
  123. package/package.json +9 -11
  124. package/THIRD_PARTY_NOTICES.md +0 -16
  125. package/dist/api-keys-D2lgguuY.mjs +0 -40
  126. package/dist/org-xLzBtt2_.mjs +0 -41
  127. package/dist/schedule-BXx3uXwr.mjs +0 -1142
  128. package/dist/src-C0X6u_Mw.mjs +0 -1340
  129. package/dist/task-B2sZMaZu.mjs +0 -8
  130. package/dist/task-target-deploy-C5X-USeR.mjs +0 -4
  131. /package/dist/{agent-bundle-package-DWV6B_5q-BtV7Xycc.mjs → agent-bundle-package-DWV6B_5q-FPT0bJaA.mjs} +0 -0
  132. /package/dist/{browser-qwFrUH82.mjs → browser-gddMccBQ.mjs} +0 -0
  133. /package/dist/{concurrency-gXn9Rw8x-DNl2YtrS.mjs → concurrency-gXn9Rw8x-BTlfau8D.mjs} +0 -0
  134. /package/dist/{constants-CPpPdSNg.mjs → constants-DHdiT5hc.mjs} +0 -0
  135. /package/dist/{credential-env-map-CI8yWHVy.mjs → credential-env-map-C8P7uTD-.mjs} +0 -0
  136. /package/dist/{diff-utils-NEfcjqxt.mjs → diff-utils-DWNcRA8g.mjs} +0 -0
  137. /package/dist/{get-intrinsic-zLxwtrLK.mjs → get-intrinsic-ZMBBjBEr.mjs} +0 -0
  138. /package/dist/{layout-CbMtQ2tm.mjs → layout-B95Tku8F.mjs} +0 -0
  139. /package/dist/{options-CeaTcFxP.mjs → options-Dn9t3K4a.mjs} +0 -0
  140. /package/dist/{output-DM4b7KgY.mjs → output-q4KljAhu.mjs} +0 -0
  141. /package/dist/{oxc-B3KI3rf_-n9d1hKNq.mjs → oxc-B3KI3rf_-BeimiQ2U.mjs} +0 -0
  142. /package/dist/{read-credential-keys-77a91T8M-KA0Iw0Z1.mjs → read-credential-keys-77a91T8M-CAJLnMRi.mjs} +0 -0
  143. /package/dist/{rolldown-runtime-twds-ZHy-BWWzu8VG.mjs → rolldown-runtime-twds-ZHy-8uqgIurC.mjs} +0 -0
  144. /package/dist/{run-polling-CAgFRdK3.mjs → run-polling-CTzhTgyN.mjs} +0 -0
  145. /package/dist/{schema-17qMfNyI.mjs → schema-Di90TXoX.mjs} +0 -0
  146. /package/dist/{schema-display-CgmeKigW.mjs → schema-display-D4A1gQEM.mjs} +0 -0
  147. /package/dist/{skills.handler-Bz8bJKql.mjs → skills.handler-8KCSF7wp.mjs} +0 -0
  148. /package/dist/{spinner-progress-DMVwgqO9.mjs → spinner-progress-bvKd1jXc.mjs} +0 -0
  149. /package/dist/{status.handler-BO4nwvWn.mjs → status.handler-D9GBEmao.mjs} +0 -0
  150. /package/dist/{sync-keystroke-agent-skills-Kx_H7UTd.mjs → sync-keystroke-agent-skills-CY9h25_5.mjs} +0 -0
  151. /package/dist/{upload-CkU--iDC.mjs → upload-B8fiWveA.mjs} +0 -0
@@ -1,1142 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { z } from "zod";
4
- const SHA256HashSchema = z.string().length(64, "Must be 64 characters").regex(/^[a-f0-9]{64}$/i, "Must be hexadecimal").transform((value) => value);
5
- const JsonSchemaSchema = z.record(z.string(), z.unknown());
6
- const RetryConfigSchema = z.object({
7
- constant: z.object({
8
- attempts: z.number().int().min(1).max(10),
9
- seconds: z.number().positive()
10
- }).optional(),
11
- exponential: z.object({
12
- attempts: z.number().int().min(1).max(10),
13
- base: z.number().min(1).optional(),
14
- multiplier: z.number().positive().optional()
15
- }).optional()
16
- }).refine((data) => {
17
- return data.constant !== void 0 !== (data.exponential !== void 0);
18
- }, { error: "Retry config must specify exactly one of constant or exponential strategy" });
19
- //#endregion
20
- //#region ../../packages/workflow-core/src/shared/schema.ts
21
- const MAX_JSON_DEPTH = 20;
22
- function buildJsonValueSchema(depth) {
23
- const primitives = z.union([
24
- z.string(),
25
- z.number(),
26
- z.boolean(),
27
- z.null()
28
- ]);
29
- if (depth <= 0) return primitives;
30
- const nested = buildJsonValueSchema(depth - 1);
31
- return z.union([
32
- primitives,
33
- z.array(nested),
34
- z.record(z.string(), nested)
35
- ]);
36
- }
37
- const jsonValueSchema = buildJsonValueSchema(MAX_JSON_DEPTH);
38
- const jsonSchemaObject = z.record(z.string(), jsonValueSchema);
39
- const anyZodSchemaSchema = z.custom((value) => value instanceof z.ZodType, "Expected a Zod schema");
40
- const zodObjectSchema = z.custom((value) => value instanceof z.ZodObject, "Expected a Zod object schema");
41
- /**
42
- * Creates a Zod schema that validates an object structurally by checking
43
- * for required properties. This avoids `instanceof` checks which fail
44
- * when class definitions are duplicated across bundle boundaries.
45
- */
46
- function createStructuralSchema(requiredKeys, label) {
47
- return z.custom((value) => value != null && (typeof value === "object" || typeof value === "function") && requiredKeys.every((key) => key in value), `Expected ${label}`);
48
- }
49
- function trimmedNonEmptyString(fieldName) {
50
- return z.string().trim().min(1, { error: `${fieldName} cannot be empty` }).max(255, { error: `${fieldName} cannot exceed 255 characters` });
51
- }
52
- /** Trimmed string with at least one character; no upper length limit. */
53
- function trimmedNonEmptyStringUnbounded(fieldName) {
54
- return z.string().trim().min(1, { error: `${fieldName} cannot be empty` });
55
- }
56
- /**
57
- * Non-empty trimmed string restricted to URL-safe characters.
58
- * Use for IDs (workflow, step, etc.) that must be safe in URLs, env vars, and as object keys.
59
- */
60
- function idNoSpacesString(fieldName) {
61
- return z.string().trim().min(1, { error: `${fieldName} cannot be empty` }).max(255, { error: `${fieldName} cannot exceed 255 characters` }).refine((s) => /^[a-zA-Z0-9_-]+$/.test(s), { error: `${fieldName} must only contain letters, numbers, hyphens, and underscores` });
62
- }
63
- /**
64
- * Non-empty trimmed string for RAW credential set IDs and namespace values.
65
- * Only allows letters, numbers, hyphens, and underscores.
66
- * Dots and colons are NOT allowed — colons are reserved for the namespace separator
67
- * in resolved credential set IDs (e.g., `keystroke:slack`).
68
- */
69
- function credentialSetIdString(fieldName) {
70
- return z.string().trim().min(1, { error: `${fieldName} cannot be empty` }).max(255, { error: `${fieldName} cannot exceed 255 characters` }).refine((s) => /^[a-zA-Z0-9_-]+$/.test(s), { error: `${fieldName} must only contain letters, numbers, hyphens, and underscores` });
71
- }
72
- /**
73
- * Non-empty trimmed string for RESOLVED credential set IDs.
74
- * Allows the optional `namespace:id` colon-separated format (e.g., `keystroke:slack`)
75
- * as well as plain IDs without a namespace (e.g., `internal-crm`).
76
- * Used in manifest schemas, DB query params, and API response schemas.
77
- */
78
- function resolvedCredentialSetIdString(fieldName) {
79
- return z.string().trim().min(1, { error: `${fieldName} cannot be empty` }).max(255, { error: `${fieldName} cannot exceed 255 characters` }).refine((s) => /^[a-zA-Z0-9_-]+(:[a-zA-Z0-9_-]+)?$/.test(s), { error: `${fieldName} must be a valid credential set ID, optionally namespaced (e.g., "slack" or "keystroke:slack")` });
80
- }
81
- function optionalTrimmedNonEmptyString(fieldName) {
82
- return trimmedNonEmptyString(fieldName).optional();
83
- }
84
- function descriptionString(fieldName) {
85
- return z.string().trim().min(1, { error: `${fieldName} cannot be empty` }).max(1024, { error: `${fieldName} cannot exceed 1024 characters` });
86
- }
87
- function optionalDescriptionString(fieldName) {
88
- return descriptionString(fieldName).optional();
89
- }
90
- function validateConfig(schema, config) {
91
- return schema.parse(config);
92
- }
93
- function schemaToJsonSchema(schema) {
94
- return jsonSchemaObject.parse({ ...z.toJSONSchema(schema, { unrepresentable: "any" }) });
95
- }
96
- //#endregion
97
- //#region ../../packages/workflow-core/src/credential-set/constants.ts
98
- /**
99
- * Kinds describe what a credential set represents at the platform level.
100
- */
101
- const CREDENTIAL_KINDS = {
102
- "user-connection": "user-connection",
103
- "provider-app": "provider-app"
104
- };
105
- /**
106
- * Visibility determines whether credential values may be injected into user code.
107
- */
108
- const CREDENTIAL_VISIBILITIES = {
109
- "user-visible": "user-visible",
110
- internal: "internal"
111
- };
112
- //#endregion
113
- //#region ../../packages/workflow-core/src/credential-set/schemas.ts
114
- const credentialPlatformMetadataSchema = z.object({
115
- kind: z.enum([CREDENTIAL_KINDS["user-connection"], CREDENTIAL_KINDS["provider-app"]]),
116
- visibility: z.enum([CREDENTIAL_VISIBILITIES["user-visible"], CREDENTIAL_VISIBILITIES.internal])
117
- });
118
- const credentialPlatformMetadataJsonSchema = z.object({
119
- kind: z.enum([CREDENTIAL_KINDS["user-connection"], CREDENTIAL_KINDS["provider-app"]]),
120
- visibility: z.enum([CREDENTIAL_VISIBILITIES["user-visible"], CREDENTIAL_VISIBILITIES.internal])
121
- });
122
- const credentialSetProxyInjectionSchema = z.object({
123
- /** Substitute placeholder in HTTP headers (default: true). */
124
- headers: z.boolean().optional(),
125
- /** Substitute placeholder in the HTTP Basic Auth credential (default: true). */
126
- basicAuth: z.boolean().optional(),
127
- /** Substitute placeholder in URL query params (default: false).
128
- * Use for APIs that authenticate via `?api_key=...` (Google Maps, OWM, etc.). */
129
- queryParams: z.boolean().optional(),
130
- /** Substitute placeholder in the HTTP request body (default: false).
131
- * Use for form-encoded auth payloads (Stripe, AWS SigV4 query, etc.). */
132
- body: z.boolean().optional()
133
- });
134
- const credentialSetProxyConfigSchema = z.object({
135
- /** Exact-match host allowlist (forwarded to SecretBuilder.allowHost). */
136
- hosts: z.array(z.string().min(1)).optional(),
137
- /** Wildcard host allowlist (forwarded to SecretBuilder.allowHostPattern).
138
- * Example: `["*.browserbase.com"]` covers any subdomain. */
139
- hostPatterns: z.array(z.string().min(1)).optional(),
140
- /** Per-scope substitution toggles. Omit to use SDK defaults. */
141
- injection: credentialSetProxyInjectionSchema.optional()
142
- });
143
- const onCredentialRevokedSchema = z.enum(["fail", "retry-once"]);
144
- const manualConnectionConfigSchema = z.object({
145
- kind: z.literal("manual"),
146
- instructions: z.string().min(1).optional(),
147
- validate: z.function().optional()
148
- });
149
- const manualConnectionConfigManifestSchema = z.object({
150
- kind: z.literal("manual"),
151
- instructions: z.string().min(1).optional()
152
- });
153
- /** Declarative form of `Vault` — strings typed against the credential set's
154
- * stored/auth schema keys at the {@link CredentialSetConfig} boundary; the Zod
155
- * schema here enforces non-empty strings only. `CredentialSet` itself performs
156
- * the schema-key membership check at construction time. */
157
- const vaultMappingSchema = z.object({
158
- accessToken: z.string().min(1),
159
- instanceUrl: z.string().min(1).optional(),
160
- raw: z.record(z.string().min(1), z.string().min(1)).optional()
161
- });
162
- /** Function form of `Vault` — an object pairing the access-token vault key
163
- * (`accessTokenKey`) with the `build` function that computes the full vault
164
- * write map. The explicit key keeps the disconnect path's revocation read
165
- * reliable even when `build` transforms the access token. */
166
- const vaultMappingFnSchema = z.object({
167
- accessTokenKey: z.string().min(1),
168
- build: z.custom((val) => typeof val === "function", { message: "vault.build must be a function." })
169
- });
170
- /** Runtime shape of `Vault`. Accepts either the declarative mapping or the
171
- * function-form object `{ accessTokenKey, build }`. */
172
- const vaultConfigSchema = z.union([vaultMappingSchema, vaultMappingFnSchema], { error: "vault must be a declarative mapping object or a `{ accessTokenKey, build }` object." });
173
- /** Manifest projection of `Vault` — declarative mappings serialize verbatim;
174
- * function-form mappings serialize as `{ kind: 'function', accessTokenKey }`
175
- * since closures are not manifest-safe but the access-token key is. */
176
- const vaultManifestSchema = z.discriminatedUnion("kind", [z.object({
177
- kind: z.literal("declarative"),
178
- accessToken: z.string().min(1),
179
- instanceUrl: z.string().min(1).optional(),
180
- raw: z.record(z.string().min(1), z.string().min(1)).optional()
181
- }), z.object({
182
- kind: z.literal("function"),
183
- accessTokenKey: z.string().min(1)
184
- })]);
185
- /** Structural check: any object exposing the core {@link AnyCredentialSet}
186
- * shape (id, resolvedCredentialSetId, credentialKeys, platformMetadata).
187
- * The runtime validator inside `CredentialSet.ts` does the deeper
188
- * visibility / key-coverage check.
189
- *
190
- * Intentionally `z.custom` rather than a structural subschema — Zod cannot
191
- * express `z.ZodObject<any>` on the `auth` field, and we only need enough
192
- * structure for the runtime validator to walk the value. */
193
- const oauthClientSourceCredentialSetRef = z.custom((val) => val !== null && typeof val === "object" && "id" in val && "credentialKeys" in val, { message: "oauthClientSource.credentialSet must be a CredentialSet instance." });
194
- const oauthClientSourceSchema = z.discriminatedUnion("kind", [z.object({ kind: z.literal("keystroke-platform") }), z.object({
195
- kind: z.literal("workspace-provider-app"),
196
- credentialSet: oauthClientSourceCredentialSetRef,
197
- keyMap: z.object({
198
- clientId: z.string().min(1).optional(),
199
- clientSecret: z.string().min(1).optional()
200
- }).optional()
201
- })]);
202
- const oauthClientSourceManifestSchema = z.discriminatedUnion("kind", [z.object({ kind: z.literal("keystroke-platform") }), z.object({
203
- kind: z.literal("workspace-provider-app"),
204
- credentialSetId: z.string().min(1),
205
- keyMap: z.object({
206
- clientId: z.string().min(1).optional(),
207
- clientSecret: z.string().min(1).optional()
208
- }).optional()
209
- })]);
210
- const oauthConnectionConfigBaseSchema = z.object({
211
- kind: z.literal("oauth"),
212
- authUrl: z.string().url(),
213
- tokenUrl: z.string().url(),
214
- scopes: z.array(z.string()).readonly(),
215
- revokeUrl: z.string().url().nullable().optional(),
216
- tokenType: z.enum(["long-lived", "refreshable"]),
217
- pkce: z.boolean().optional(),
218
- /** Fallback token lifetime when the provider omits `expires_in`. Positive
219
- * integer seconds. Shared between config + manifest schemas (both extend
220
- * this base). */
221
- defaultExpiresInSeconds: z.number().int().positive().optional()
222
- });
223
- const oauthConnectionConfigSchema = oauthConnectionConfigBaseSchema.extend({
224
- vault: vaultConfigSchema,
225
- buildAuthUrl: z.function().optional(),
226
- exchangeCode: z.function().optional(),
227
- refreshToken: z.function().optional(),
228
- extractInstallationInfo: z.function().optional(),
229
- validate: z.function().optional(),
230
- oauthClientSource: oauthClientSourceSchema.optional()
231
- });
232
- const oauthConnectionConfigManifestSchema = oauthConnectionConfigBaseSchema.extend({
233
- vault: vaultManifestSchema,
234
- oauthClientSource: oauthClientSourceManifestSchema.optional()
235
- });
236
- const credentialsExchangeConnectionConfigSchema = z.object({
237
- kind: z.literal("credentials-exchange"),
238
- instructions: z.string().min(1).optional(),
239
- input: zodObjectSchema
240
- }).extend({
241
- exchange: z.function(),
242
- rotate: z.function().optional(),
243
- validate: z.function().optional()
244
- });
245
- /** Manifest projection of `CredentialsExchangeConnectionConfig` — only the
246
- * declarative `input` schema (rendered as JSON Schema) and `instructions`
247
- * copy survive serialization. The three hooks (`exchange`, `rotate`,
248
- * `validate`) are runtime closures and are stripped. */
249
- const credentialsExchangeConnectionConfigManifestSchema = z.object({
250
- kind: z.literal("credentials-exchange"),
251
- instructions: z.string().min(1).optional(),
252
- input: jsonSchemaObject
253
- });
254
- const connectionConfigSchema = z.discriminatedUnion("kind", [
255
- manualConnectionConfigSchema,
256
- oauthConnectionConfigSchema,
257
- credentialsExchangeConnectionConfigSchema
258
- ]);
259
- /** Manifest projection of `ConnectionConfig` — declarative metadata only. */
260
- const connectionConfigManifestSchema = z.discriminatedUnion("kind", [
261
- manualConnectionConfigManifestSchema,
262
- oauthConnectionConfigManifestSchema,
263
- credentialsExchangeConnectionConfigManifestSchema
264
- ]);
265
- const CredentialSetManifestSchema = z.object({
266
- manifestVersion: z.literal(1),
267
- type: z.literal("credentialSet"),
268
- id: credentialSetIdString("Credential set id"),
269
- namespace: credentialSetIdString("Credential set namespace").optional(),
270
- resolvedCredentialSetId: resolvedCredentialSetIdString("Resolved credential set id"),
271
- name: trimmedNonEmptyString("Credential set name"),
272
- description: optionalDescriptionString("Credential set description"),
273
- auth: jsonSchemaObject,
274
- stored: jsonSchemaObject.optional(),
275
- needsResolve: z.boolean().optional(),
276
- /** Run-scoped cache TTL in milliseconds for the credential set's `resolve`
277
- * hook. `0` or absence means no cache hint. Populated from top-level
278
- * `resolveCacheMs` in the authored config. */
279
- resolveCacheMs: z.number().int().nonnegative().optional(),
280
- /** Where the `stored`→`auth` transform runs (cluster 15). `'sandbox'`
281
- * for `resolve`, `'platform'` for `resolveAtPlatform`, `'none'` when
282
- * the credential set has no transform. Omitted in the manifest when
283
- * `'none'` to keep serialized output compact. */
284
- resolveLocation: z.enum(["sandbox", "platform"]).optional(),
285
- /** Platform-side env allowlist (cluster 15). Only meaningful when
286
- * `resolveLocation === 'platform'`. */
287
- platformEnvAllowlist: z.array(z.string().min(1)).optional(),
288
- platformMetadata: credentialPlatformMetadataJsonSchema.optional(),
289
- proxy: credentialSetProxyConfigSchema.optional(),
290
- /** When true, resolved values are passed into execution as raw secrets (no ref-token proxy). */
291
- needsRawSecret: z.boolean().optional(),
292
- /** Policy when a step throws `CredentialRevokedError` against this credential set. */
293
- onCredentialRevoked: onCredentialRevokedSchema.optional(),
294
- connection: connectionConfigManifestSchema.optional()
295
- });
296
- const credentialSetConfigSchema = z.object({
297
- id: credentialSetIdString("Credential set id"),
298
- namespace: credentialSetIdString("Credential set namespace").optional(),
299
- name: optionalTrimmedNonEmptyString("Credential set name"),
300
- description: optionalDescriptionString("Credential set description"),
301
- auth: zodObjectSchema,
302
- stored: zodObjectSchema.optional(),
303
- resolve: z.function().optional(),
304
- /** Run-scoped cache TTL in milliseconds for `resolve` output. Requires `resolve`. */
305
- resolveCacheMs: z.number().int().nonnegative().optional(),
306
- /** Platform-side `stored`→`auth` transform (cluster 15). Runs on the
307
- * trusted host with a scoped fetch + allowlisted env. Mutually
308
- * exclusive with `resolve`. */
309
- resolveAtPlatform: z.function().optional(),
310
- platformEnvAllowlist: z.array(z.string().min(1)).optional(),
311
- platformMetadata: credentialPlatformMetadataSchema.optional(),
312
- proxy: credentialSetProxyConfigSchema.optional(),
313
- /** When true, resolved values are passed into execution as raw secrets (no ref-token proxy). */
314
- needsRawSecret: z.boolean().optional(),
315
- onCredentialRevoked: onCredentialRevokedSchema.optional(),
316
- connection: connectionConfigSchema.optional()
317
- }).refine((c) => !(c.resolve === void 0 && c.resolveCacheMs !== void 0), { message: "`resolveCacheMs` requires `resolve`." }).refine((config) => !(config.namespace === "keystroke" && config.platformMetadata === void 0), { message: "platformMetadata is required when namespace is 'keystroke'" }).refine((config) => !(config.namespace !== "keystroke" && config.connection?.kind === "oauth" && config.connection.oauthClientSource === void 0), { message: "OAuth connections on user-authored (non-keystroke-namespaced) credential sets require `oauthClientSource` to point at a workspace-provider-app credential set. Example: `oauthClientSource: { kind: \"workspace-provider-app\", credentialSet: myClientApp }`." }).refine((config) => {
318
- if (config.connection?.kind !== "oauth") return true;
319
- const source = config.connection.oauthClientSource;
320
- if (!source || source.kind !== "workspace-provider-app") return true;
321
- return source.credentialSet.platformMetadata?.visibility === "internal";
322
- }, { message: "oauthClientSource.credentialSet must be marked `platformMetadata: { visibility: 'internal' }`. This prevents the sandbox from injecting clientSecret into user step code." }).refine((c) => !(c.resolve !== void 0 && c.resolveAtPlatform !== void 0), { message: "`resolve` and `resolveAtPlatform` are mutually exclusive. Pick one: `resolve` for sandbox-side shape transforms, `resolveAtPlatform` for host-side external-secrets calls." }).refine((c) => !(c.platformEnvAllowlist !== void 0 && c.resolveAtPlatform === void 0), { message: "`platformEnvAllowlist` requires `resolveAtPlatform`." });
323
- //#endregion
324
- //#region ../../packages/workflow-core/src/artifacts/source-analysis.ts
325
- const SourceLocationSchema = z.object({
326
- filePath: z.string().min(1),
327
- absoluteFilePath: z.string().min(1).optional(),
328
- line: z.number().int().positive(),
329
- column: z.number().int().positive(),
330
- position: z.number().int().nonnegative().optional(),
331
- endLine: z.number().int().positive(),
332
- endColumn: z.number().int().positive(),
333
- endPosition: z.number().int().nonnegative().optional(),
334
- synthetic: z.boolean().optional()
335
- });
336
- const CallsiteFingerprintSchema = z.string().min(1);
337
- const ImportSourceSchema = z.object({
338
- kind: z.enum([
339
- "local",
340
- "module-import",
341
- "namespace-import",
342
- "dynamic"
343
- ]),
344
- moduleSpecifier: z.string().min(1).optional(),
345
- importName: z.string().min(1).optional(),
346
- localName: z.string().min(1).optional(),
347
- resolvedPath: z.string().min(1).optional()
348
- });
349
- const CallKindSchema = z.enum([
350
- "workflow-step",
351
- "agent",
352
- "tool",
353
- "hook",
354
- "child-workflow",
355
- "function-call",
356
- "method-call",
357
- "dynamic-call",
358
- "parallel-call",
359
- "process-exit",
360
- "iife",
361
- "expression"
362
- ]);
363
- const CapturedVariableSourceKindSchema = z.enum([
364
- "local-const",
365
- "relative-import",
366
- "package-import"
367
- ]);
368
- const CapturedVariableValueTypeSchema = z.enum([
369
- "string",
370
- "number",
371
- "boolean",
372
- "object",
373
- "array",
374
- "function",
375
- "unknown"
376
- ]);
377
- const CapturedVariableSchema = z.object({
378
- name: z.string().min(1),
379
- value: z.union([
380
- z.string(),
381
- z.number(),
382
- z.boolean()
383
- ]).optional(),
384
- sourceText: z.string().optional(),
385
- valueType: CapturedVariableValueTypeSchema,
386
- resolvable: z.boolean(),
387
- source: CapturedVariableSourceKindSchema,
388
- importPath: z.string().optional(),
389
- declaration: z.object({
390
- filePath: z.string().min(1),
391
- line: z.number().int().positive()
392
- })
393
- });
394
- const IntegrationScopeSchema = z.enum([
395
- "organization",
396
- "project",
397
- "user_provided_credential"
398
- ]);
399
- const IntegrationCredentialRefSchema = z.discriminatedUnion("type", [z.object({
400
- type: z.literal("id"),
401
- id: z.string().startsWith("cset_")
402
- }), z.object({
403
- type: z.literal("name"),
404
- name: z.string().trim().min(1)
405
- })]);
406
- function hasProjectOrOrganizationScope(scope) {
407
- return scope === "organization" || scope === "project";
408
- }
409
- const CredentialRefTokenKeyNameSchema = z.string().regex(/^[A-Za-z0-9_]+$/, "Credential key must contain only letters, digits, and underscores (required for ref-token proxying)");
410
- /** Shared enum for top-level credential-set `onCredentialRevoked` policy. */
411
- const OnCredentialRevokedSchema = z.enum(["fail", "retry-once"]);
412
- /** A credential set after resolution in a built manifest. Contains resolved ID, scope, alias, and credential keys.*/
413
- const ResolvedCredentialSetSchema = z.object({
414
- resolvedId: z.string(),
415
- scope: IntegrationScopeSchema.optional(),
416
- alias: z.string().optional(),
417
- credentialRef: IntegrationCredentialRefSchema.optional(),
418
- /** Auth-shape keys expected post-resolve. */
419
- credentialKeys: z.array(CredentialRefTokenKeyNameSchema),
420
- /** Subset of `credentialKeys` that are optional in the auth shape. */
421
- optionalCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
422
- /** Stored-shape keys required for vault reads and upload flows. */
423
- storedCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
424
- /** Subset of `storedCredentialKeys` that may be absent from the vault without
425
- * failing resolution. Derived from the credential set's `stored` schema:
426
- * a Zod field wrapped in `.optional()` / `.default()` or a JSON Schema
427
- * property not listed in `required` is considered optional. */
428
- optionalStoredCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
429
- proxy: credentialSetProxyConfigSchema.optional(),
430
- /** When true, resolved values are passed raw (no ref-token proxy) for this set. */
431
- needsRawSecret: z.boolean().optional(),
432
- /** When true, the credential set has a user `resolve` callback that runs in
433
- * the sandbox before each step. Routes credentials to env (not Secret.env). */
434
- needsResolve: z.boolean().optional(),
435
- /** Run-scoped cache TTL in milliseconds for the credential set's `resolve`
436
- * hook output. `0` or absence means no cache hint. */
437
- resolveCacheMs: z.number().int().nonnegative().optional(),
438
- /** Policy when a step throws `CredentialRevokedError` against this credential set. */
439
- onCredentialRevoked: OnCredentialRevokedSchema.optional(),
440
- /** Persistence-layer schema fingerprint stamped at build time. The
441
- * resolver's phase 2 compares this against the vault row's stored
442
- * fingerprint and raises `CredentialSchemaMismatchError` on drift.
443
- * Optional here so pre-fingerprint artifacts still parse; the
444
- * workflow builder populates it for every authored credential set
445
- * that has a resolvable fingerprint. */
446
- schemaFingerprint: z.string().optional()
447
- }).superRefine((value, ctx) => {
448
- if (value.credentialRef && !hasProjectOrOrganizationScope(value.scope)) ctx.addIssue({
449
- code: z.ZodIssueCode.custom,
450
- path: ["credentialRef"],
451
- message: "credentialRef requires scope to be \"project\" or \"organization\""
452
- });
453
- });
454
- const DeclaredCredentialRequirementSchema = z.object({
455
- credentialSetId: z.string(),
456
- namespace: z.string().optional(),
457
- resolvedCredentialSetId: z.string(),
458
- /** Auth-shape keys expected post-resolve. */
459
- credentialKeys: z.array(CredentialRefTokenKeyNameSchema),
460
- /** Optional subset of the auth-shape keys. */
461
- optionalCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
462
- /** Stored-shape keys required for vault reads. */
463
- storedCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
464
- /** Optional subset of the stored-shape keys. */
465
- optionalStoredCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
466
- schemaFingerprint: z.string().optional(),
467
- needsResolve: z.boolean().optional(),
468
- /** Run-scoped cache TTL in milliseconds for the credential set's `resolve`
469
- * hook output. `0` or absence means no cache hint. */
470
- resolveCacheMs: z.number().int().nonnegative().optional(),
471
- /** Policy when a step throws `CredentialRevokedError` against this credential set. */
472
- onCredentialRevoked: OnCredentialRevokedSchema.optional(),
473
- proxy: credentialSetProxyConfigSchema.optional(),
474
- needsRawSecret: z.boolean().optional(),
475
- requiredOAuthScopes: z.array(z.string()).optional()
476
- });
477
- const CredentialRequirementEntrySchema = z.object({
478
- credentialSetId: z.string(),
479
- scope: IntegrationScopeSchema.optional(),
480
- alias: z.string().optional(),
481
- credentialRef: IntegrationCredentialRefSchema.optional(),
482
- /** Auth-shape keys expected post-resolve. */
483
- credentialKeys: z.array(CredentialRefTokenKeyNameSchema),
484
- /** Optional subset of the auth-shape keys. */
485
- optionalCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
486
- /** Stored-shape keys required for vault reads. */
487
- storedCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
488
- /** Optional subset of the stored-shape keys. */
489
- optionalStoredCredentialKeys: z.array(CredentialRefTokenKeyNameSchema).optional(),
490
- schemaFingerprint: z.string().optional(),
491
- proxy: credentialSetProxyConfigSchema.optional(),
492
- needsRawSecret: z.boolean().optional(),
493
- /** When true, the credential set has a user `resolve` callback. Routes
494
- * credentials to env (not Secret.env) so the callback can transform them. */
495
- needsResolve: z.boolean().optional(),
496
- /** Run-scoped cache TTL in milliseconds for the credential set's `resolve`
497
- * hook output. `0` or absence means no cache hint. */
498
- resolveCacheMs: z.number().int().nonnegative().optional(),
499
- /** Policy when a step throws `CredentialRevokedError` against this credential set. */
500
- onCredentialRevoked: OnCredentialRevokedSchema.optional(),
501
- requiredOAuthScopes: z.array(z.string()).optional()
502
- }).superRefine((value, ctx) => {
503
- if (value.credentialRef && !hasProjectOrOrganizationScope(value.scope)) ctx.addIssue({
504
- code: z.ZodIssueCode.custom,
505
- path: ["credentialRef"],
506
- message: "credentialRef requires scope to be \"project\" or \"organization\""
507
- });
508
- });
509
- const CredentialRequirementsSchema = z.object({
510
- required: z.array(z.string()),
511
- byStep: z.record(z.string(), z.array(CredentialRequirementEntrySchema))
512
- });
513
- const TriggerCallbackNameSchema = z.enum([
514
- "filter",
515
- "idempotencyKey",
516
- "verify",
517
- "callback"
518
- ]);
519
- const TriggerCredentialRequirementEntrySchema = CredentialRequirementEntrySchema;
520
- const TriggerCredentialRequirementsSchema = z.object({
521
- required: z.array(z.string()),
522
- byCallback: z.partialRecord(TriggerCallbackNameSchema, z.array(TriggerCredentialRequirementEntrySchema))
523
- });
524
- function buildCredentialRequirementEntryKey(entry) {
525
- const credentialRefKey = entry.credentialRef ? entry.credentialRef.type === "id" ? `id:${entry.credentialRef.id}` : `name:${entry.credentialRef.name}` : "";
526
- return [
527
- entry.credentialSetId,
528
- entry.scope ?? "",
529
- entry.alias ?? "",
530
- credentialRefKey,
531
- entry.schemaFingerprint ?? "",
532
- [...entry.credentialKeys].sort().join(","),
533
- [...entry.optionalCredentialKeys ?? []].sort().join(","),
534
- [...entry.storedCredentialKeys ?? []].sort().join(","),
535
- [...entry.optionalStoredCredentialKeys ?? []].sort().join(","),
536
- entry.needsRawSecret === true ? "1" : "0",
537
- entry.needsResolve === true ? "1" : "0",
538
- typeof entry.resolveCacheMs === "number" ? String(entry.resolveCacheMs) : "",
539
- entry.onCredentialRevoked ?? "",
540
- entry.proxy ? JSON.stringify(entry.proxy) : ""
541
- ].join("|");
542
- }
543
- function deduplicateCredentialRequirementEntries(entries) {
544
- const deduped = /* @__PURE__ */ new Map();
545
- for (const entry of entries) {
546
- const key = buildCredentialRequirementEntryKey(entry);
547
- const existing = deduped.get(key);
548
- if (!existing) deduped.set(key, {
549
- ...entry,
550
- credentialKeys: [...entry.credentialKeys].sort(),
551
- ...entry.optionalCredentialKeys ? { optionalCredentialKeys: [...entry.optionalCredentialKeys].sort() } : {},
552
- ...entry.storedCredentialKeys ? { storedCredentialKeys: [...entry.storedCredentialKeys].sort() } : {},
553
- ...entry.optionalStoredCredentialKeys ? { optionalStoredCredentialKeys: [...entry.optionalStoredCredentialKeys].sort() } : {}
554
- });
555
- else if (entry.requiredOAuthScopes?.length) {
556
- const merged = new Set([...existing.requiredOAuthScopes ?? [], ...entry.requiredOAuthScopes]);
557
- deduped.set(key, {
558
- ...existing,
559
- requiredOAuthScopes: [...merged].sort()
560
- });
561
- }
562
- }
563
- return [...deduped.values()];
564
- }
565
- function collectCredentialRequirementEntries(credentialRequirements) {
566
- if (!credentialRequirements) return [];
567
- return deduplicateCredentialRequirementEntries(Object.values(credentialRequirements.byStep ?? {}).flat());
568
- }
569
- const ExecutionIdentityPolicySchema = z.object({ subjectMode: z.enum(["never", "requiredWhenUserProvidedCredential"]) });
570
- /** A step's entry within a WorkflowManifest. Describes how a step is used in a workflow, not what the step itself is. */
571
- const WorkflowStepEntrySchema = z.object({
572
- nodeId: z.string().min(1),
573
- stepName: z.string().min(1),
574
- label: z.string().min(1),
575
- callKind: CallKindSchema,
576
- stepId: z.string().min(1).optional(),
577
- source: SourceLocationSchema.optional(),
578
- astKind: z.string().min(1).optional(),
579
- importSource: ImportSourceSchema.optional(),
580
- outputBinding: z.string().min(1).optional(),
581
- scopeOverride: IntegrationScopeSchema.optional(),
582
- description: z.string().optional(),
583
- sourceCode: z.string().optional(),
584
- exportName: z.string().optional(),
585
- inputSchema: JsonSchemaSchema.optional(),
586
- outputSchema: JsonSchemaSchema.optional(),
587
- credentialSets: z.array(ResolvedCredentialSetSchema).optional()
588
- });
589
- const TriggerTypeSchema = z.enum([
590
- "webhook",
591
- "cron",
592
- "polling"
593
- ]);
594
- /**
595
- * Persisted on `deployment_triggers.trigger_source`. Mirrors the
596
- * `webhookTrigger({ source: { type } })` discriminator so the server
597
- * can index-filter app-source rows during provider-webhook fanout.
598
- */
599
- const TriggerSourceSchema = z.enum(["custom", "app"]);
600
- const WebhookMethodSchema = z.enum([
601
- "GET",
602
- "POST",
603
- "PUT",
604
- "PATCH"
605
- ]);
606
- const TriggerCallbackBundleUploadSchema = z.object({
607
- code: z.string(),
608
- hash: z.string(),
609
- size: z.number()
610
- });
611
- const TriggerCallbackExportsSchema = z.object({
612
- verify: z.string().min(1).optional(),
613
- filter: z.string().min(1).optional(),
614
- idempotencyKey: z.string().min(1).optional(),
615
- callback: z.string().min(1).optional()
616
- });
617
- const TransformCallbackExportsSchema = z.object({ transform: z.string().min(1).optional() });
618
- const TriggerUploadDataSchema = z.object({
619
- id: z.string(),
620
- type: TriggerTypeSchema,
621
- /**
622
- * Source-of-truth discriminator for webhook triggers. `'custom'` means
623
- * the trigger owns its own HTTP path; `'app'` means it is fanned out by
624
- * a Keystroke-managed provider app. Undefined for non-webhook triggers.
625
- */
626
- triggerSource: TriggerSourceSchema.optional(),
627
- enabled: z.boolean(),
628
- path: z.string().optional(),
629
- method: WebhookMethodSchema.optional(),
630
- schedule: z.string().optional(),
631
- timezone: z.string().optional(),
632
- config: z.record(z.string(), z.unknown()).optional(),
633
- requiredCredentials: TriggerCredentialRequirementsSchema.optional(),
634
- storagePath: z.string().min(1).optional(),
635
- callbackBundle: TriggerCallbackBundleUploadSchema.optional(),
636
- callbackExports: TriggerCallbackExportsSchema.optional(),
637
- transformCallbackBundle: TriggerCallbackBundleUploadSchema.optional(),
638
- transformCallbackExports: TransformCallbackExportsSchema.optional()
639
- });
640
- //#endregion
641
- //#region ../../node_modules/.pnpm/cron-schedule@6.0.0/node_modules/cron-schedule/dist/utils.js
642
- function extractDateElements(date) {
643
- return {
644
- second: date.getSeconds(),
645
- minute: date.getMinutes(),
646
- hour: date.getHours(),
647
- day: date.getDate(),
648
- month: date.getMonth(),
649
- weekday: date.getDay(),
650
- year: date.getFullYear()
651
- };
652
- }
653
- function getDaysInMonth(year, month) {
654
- return new Date(year, month + 1, 0).getDate();
655
- }
656
- function getDaysBetweenWeekdays(weekday1, weekday2) {
657
- if (weekday1 <= weekday2) return weekday2 - weekday1;
658
- return 6 - weekday1 + weekday2 + 1;
659
- }
660
- //#endregion
661
- //#region ../../node_modules/.pnpm/cron-schedule@6.0.0/node_modules/cron-schedule/dist/cron.js
662
- var Cron = class {
663
- constructor({ seconds, minutes, hours, days, months, weekdays }) {
664
- if (!seconds || seconds.size === 0) throw new Error("There must be at least one allowed second.");
665
- if (!minutes || minutes.size === 0) throw new Error("There must be at least one allowed minute.");
666
- if (!hours || hours.size === 0) throw new Error("There must be at least one allowed hour.");
667
- if (!months || months.size === 0) throw new Error("There must be at least one allowed month.");
668
- if ((!weekdays || weekdays.size === 0) && (!days || days.size === 0)) throw new Error("There must be at least one allowed day or weekday.");
669
- this.seconds = Array.from(seconds).sort((a, b) => a - b);
670
- this.minutes = Array.from(minutes).sort((a, b) => a - b);
671
- this.hours = Array.from(hours).sort((a, b) => a - b);
672
- this.days = Array.from(days).sort((a, b) => a - b);
673
- this.months = Array.from(months).sort((a, b) => a - b);
674
- this.weekdays = Array.from(weekdays).sort((a, b) => a - b);
675
- const validateData = (name, data, constraint) => {
676
- if (data.some((x) => typeof x !== "number" || x % 1 !== 0 || x < constraint.min || x > constraint.max)) throw new Error(`${name} must only consist of integers which are within the range of ${constraint.min} and ${constraint.max}`);
677
- };
678
- validateData("seconds", this.seconds, {
679
- min: 0,
680
- max: 59
681
- });
682
- validateData("minutes", this.minutes, {
683
- min: 0,
684
- max: 59
685
- });
686
- validateData("hours", this.hours, {
687
- min: 0,
688
- max: 23
689
- });
690
- validateData("days", this.days, {
691
- min: 1,
692
- max: 31
693
- });
694
- validateData("months", this.months, {
695
- min: 0,
696
- max: 11
697
- });
698
- validateData("weekdays", this.weekdays, {
699
- min: 0,
700
- max: 6
701
- });
702
- this.reversed = {
703
- seconds: this.seconds.map((x) => x).reverse(),
704
- minutes: this.minutes.map((x) => x).reverse(),
705
- hours: this.hours.map((x) => x).reverse(),
706
- days: this.days.map((x) => x).reverse(),
707
- months: this.months.map((x) => x).reverse(),
708
- weekdays: this.weekdays.map((x) => x).reverse()
709
- };
710
- }
711
- /**
712
- * Find the next or previous hour, starting from the given start hour that matches the hour constraint.
713
- * startHour itself might also be allowed.
714
- */
715
- findAllowedHour(dir, startHour) {
716
- return dir === "next" ? this.hours.find((x) => x >= startHour) : this.reversed.hours.find((x) => x <= startHour);
717
- }
718
- /**
719
- * Find the next or previous minute, starting from the given start minute that matches the minute constraint.
720
- * startMinute itself might also be allowed.
721
- */
722
- findAllowedMinute(dir, startMinute) {
723
- return dir === "next" ? this.minutes.find((x) => x >= startMinute) : this.reversed.minutes.find((x) => x <= startMinute);
724
- }
725
- /**
726
- * Find the next or previous second, starting from the given start second that matches the second constraint.
727
- * startSecond itself IS NOT allowed.
728
- */
729
- findAllowedSecond(dir, startSecond) {
730
- return dir === "next" ? this.seconds.find((x) => x > startSecond) : this.reversed.seconds.find((x) => x < startSecond);
731
- }
732
- /**
733
- * Find the next or previous time, starting from the given start time that matches the hour, minute
734
- * and second constraints. startTime itself might also be allowed.
735
- */
736
- findAllowedTime(dir, startTime) {
737
- let hour = this.findAllowedHour(dir, startTime.hour);
738
- if (hour !== void 0) if (hour === startTime.hour) {
739
- let minute = this.findAllowedMinute(dir, startTime.minute);
740
- if (minute !== void 0) if (minute === startTime.minute) {
741
- const second = this.findAllowedSecond(dir, startTime.second);
742
- if (second !== void 0) return {
743
- hour,
744
- minute,
745
- second
746
- };
747
- minute = this.findAllowedMinute(dir, dir === "next" ? startTime.minute + 1 : startTime.minute - 1);
748
- if (minute !== void 0) return {
749
- hour,
750
- minute,
751
- second: dir === "next" ? this.seconds[0] : this.reversed.seconds[0]
752
- };
753
- } else return {
754
- hour,
755
- minute,
756
- second: dir === "next" ? this.seconds[0] : this.reversed.seconds[0]
757
- };
758
- hour = this.findAllowedHour(dir, dir === "next" ? startTime.hour + 1 : startTime.hour - 1);
759
- if (hour !== void 0) return {
760
- hour,
761
- minute: dir === "next" ? this.minutes[0] : this.reversed.minutes[0],
762
- second: dir === "next" ? this.seconds[0] : this.reversed.seconds[0]
763
- };
764
- } else return {
765
- hour,
766
- minute: dir === "next" ? this.minutes[0] : this.reversed.minutes[0],
767
- second: dir === "next" ? this.seconds[0] : this.reversed.seconds[0]
768
- };
769
- }
770
- /**
771
- * Find the next or previous day in the given month, starting from the given startDay
772
- * that matches either the day or the weekday constraint. startDay itself might also be allowed.
773
- */
774
- findAllowedDayInMonth(dir, year, month, startDay) {
775
- var _a, _b;
776
- if (startDay < 1) throw new Error("startDay must not be smaller than 1.");
777
- const daysInMonth = getDaysInMonth(year, month);
778
- const daysRestricted = this.days.length !== 31;
779
- const weekdaysRestricted = this.weekdays.length !== 7;
780
- if (!daysRestricted && !weekdaysRestricted) {
781
- if (startDay > daysInMonth) return dir === "next" ? void 0 : daysInMonth;
782
- return startDay;
783
- }
784
- let allowedDayByDays;
785
- if (daysRestricted) {
786
- allowedDayByDays = dir === "next" ? this.days.find((x) => x >= startDay) : this.reversed.days.find((x) => x <= startDay);
787
- if (allowedDayByDays !== void 0 && allowedDayByDays > daysInMonth) allowedDayByDays = void 0;
788
- }
789
- let allowedDayByWeekdays;
790
- if (weekdaysRestricted) {
791
- const startWeekday = new Date(year, month, startDay).getDay();
792
- const nearestAllowedWeekday = dir === "next" ? (_a = this.weekdays.find((x) => x >= startWeekday)) !== null && _a !== void 0 ? _a : this.weekdays[0] : (_b = this.reversed.weekdays.find((x) => x <= startWeekday)) !== null && _b !== void 0 ? _b : this.reversed.weekdays[0];
793
- if (nearestAllowedWeekday !== void 0) {
794
- const daysBetweenWeekdays = dir === "next" ? getDaysBetweenWeekdays(startWeekday, nearestAllowedWeekday) : getDaysBetweenWeekdays(nearestAllowedWeekday, startWeekday);
795
- allowedDayByWeekdays = dir === "next" ? startDay + daysBetweenWeekdays : startDay - daysBetweenWeekdays;
796
- if (allowedDayByWeekdays > daysInMonth || allowedDayByWeekdays < 1) allowedDayByWeekdays = void 0;
797
- }
798
- }
799
- if (allowedDayByDays !== void 0 && allowedDayByWeekdays !== void 0) return dir === "next" ? Math.min(allowedDayByDays, allowedDayByWeekdays) : Math.max(allowedDayByDays, allowedDayByWeekdays);
800
- if (allowedDayByDays !== void 0) return allowedDayByDays;
801
- if (allowedDayByWeekdays !== void 0) return allowedDayByWeekdays;
802
- }
803
- /** Gets the next date starting from the given start date or now. */
804
- getNextDate(startDate = /* @__PURE__ */ new Date()) {
805
- const startDateElements = extractDateElements(startDate);
806
- let minYear = startDateElements.year;
807
- let startIndexMonth = this.months.findIndex((x) => x >= startDateElements.month);
808
- if (startIndexMonth === -1) {
809
- startIndexMonth = 0;
810
- minYear++;
811
- }
812
- const maxIterations = this.months.length * 5;
813
- for (let i = 0; i < maxIterations; i++) {
814
- const year = minYear + Math.floor((startIndexMonth + i) / this.months.length);
815
- const month = this.months[(startIndexMonth + i) % this.months.length];
816
- const isStartMonth = year === startDateElements.year && month === startDateElements.month;
817
- let day = this.findAllowedDayInMonth("next", year, month, isStartMonth ? startDateElements.day : 1);
818
- let isStartDay = isStartMonth && day === startDateElements.day;
819
- if (day !== void 0 && isStartDay) {
820
- const nextTime = this.findAllowedTime("next", startDateElements);
821
- if (nextTime !== void 0) return new Date(year, month, day, nextTime.hour, nextTime.minute, nextTime.second);
822
- day = this.findAllowedDayInMonth("next", year, month, day + 1);
823
- isStartDay = false;
824
- }
825
- if (day !== void 0 && !isStartDay) return new Date(year, month, day, this.hours[0], this.minutes[0], this.seconds[0]);
826
- }
827
- throw new Error("No valid next date was found.");
828
- }
829
- /** Gets the specified amount of future dates starting from the given start date or now. */
830
- getNextDates(amount, startDate) {
831
- const dates = [];
832
- let nextDate;
833
- for (let i = 0; i < amount; i++) {
834
- nextDate = this.getNextDate(nextDate !== null && nextDate !== void 0 ? nextDate : startDate);
835
- dates.push(nextDate);
836
- }
837
- return dates;
838
- }
839
- /**
840
- * Get an ES6 compatible iterator which iterates over the next dates starting from startDate or now.
841
- * The iterator runs until the optional endDate is reached or forever.
842
- */
843
- *getNextDatesIterator(startDate, endDate) {
844
- let nextDate;
845
- while (true) {
846
- nextDate = this.getNextDate(nextDate !== null && nextDate !== void 0 ? nextDate : startDate);
847
- if (endDate && endDate.getTime() < nextDate.getTime()) return;
848
- yield nextDate;
849
- }
850
- }
851
- /** Gets the previous date starting from the given start date or now. */
852
- getPrevDate(startDate = /* @__PURE__ */ new Date()) {
853
- const startDateElements = extractDateElements(startDate);
854
- let maxYear = startDateElements.year;
855
- let startIndexMonth = this.reversed.months.findIndex((x) => x <= startDateElements.month);
856
- if (startIndexMonth === -1) {
857
- startIndexMonth = 0;
858
- maxYear--;
859
- }
860
- const maxIterations = this.reversed.months.length * 5;
861
- for (let i = 0; i < maxIterations; i++) {
862
- const year = maxYear - Math.floor((startIndexMonth + i) / this.reversed.months.length);
863
- const month = this.reversed.months[(startIndexMonth + i) % this.reversed.months.length];
864
- const isStartMonth = year === startDateElements.year && month === startDateElements.month;
865
- let day = this.findAllowedDayInMonth("prev", year, month, isStartMonth ? startDateElements.day : getDaysInMonth(year, month));
866
- let isStartDay = isStartMonth && day === startDateElements.day;
867
- if (day !== void 0 && isStartDay) {
868
- const prevTime = this.findAllowedTime("prev", startDateElements);
869
- if (prevTime !== void 0) return new Date(year, month, day, prevTime.hour, prevTime.minute, prevTime.second);
870
- if (day > 1) {
871
- day = this.findAllowedDayInMonth("prev", year, month, day - 1);
872
- isStartDay = false;
873
- }
874
- }
875
- if (day !== void 0 && !isStartDay) return new Date(year, month, day, this.reversed.hours[0], this.reversed.minutes[0], this.reversed.seconds[0]);
876
- }
877
- throw new Error("No valid previous date was found.");
878
- }
879
- /** Gets the specified amount of previous dates starting from the given start date or now. */
880
- getPrevDates(amount, startDate) {
881
- const dates = [];
882
- let prevDate;
883
- for (let i = 0; i < amount; i++) {
884
- prevDate = this.getPrevDate(prevDate !== null && prevDate !== void 0 ? prevDate : startDate);
885
- dates.push(prevDate);
886
- }
887
- return dates;
888
- }
889
- /**
890
- * Get an ES6 compatible iterator which iterates over the previous dates starting from startDate or now.
891
- * The iterator runs until the optional endDate is reached or forever.
892
- */
893
- *getPrevDatesIterator(startDate, endDate) {
894
- let prevDate;
895
- while (true) {
896
- prevDate = this.getPrevDate(prevDate !== null && prevDate !== void 0 ? prevDate : startDate);
897
- if (endDate && endDate.getTime() > prevDate.getTime()) return;
898
- yield prevDate;
899
- }
900
- }
901
- /** Returns true when there is a cron date at the given date. */
902
- matchDate(date) {
903
- const { second, minute, hour, day, month, weekday } = extractDateElements(date);
904
- if (this.seconds.indexOf(second) === -1 || this.minutes.indexOf(minute) === -1 || this.hours.indexOf(hour) === -1 || this.months.indexOf(month) === -1) return false;
905
- if (this.days.length !== 31 && this.weekdays.length !== 7) return this.days.indexOf(day) !== -1 || this.weekdays.indexOf(weekday) !== -1;
906
- return this.days.indexOf(day) !== -1 && this.weekdays.indexOf(weekday) !== -1;
907
- }
908
- };
909
- //#endregion
910
- //#region ../../node_modules/.pnpm/cron-schedule@6.0.0/node_modules/cron-schedule/dist/cron-parser.js
911
- const secondConstraint = {
912
- min: 0,
913
- max: 59
914
- };
915
- const minuteConstraint = {
916
- min: 0,
917
- max: 59
918
- };
919
- const hourConstraint = {
920
- min: 0,
921
- max: 23
922
- };
923
- const dayConstraint = {
924
- min: 1,
925
- max: 31
926
- };
927
- const monthConstraint = {
928
- min: 1,
929
- max: 12,
930
- aliases: {
931
- jan: "1",
932
- feb: "2",
933
- mar: "3",
934
- apr: "4",
935
- may: "5",
936
- jun: "6",
937
- jul: "7",
938
- aug: "8",
939
- sep: "9",
940
- oct: "10",
941
- nov: "11",
942
- dec: "12"
943
- }
944
- };
945
- const weekdayConstraint = {
946
- min: 0,
947
- max: 7,
948
- aliases: {
949
- mon: "1",
950
- tue: "2",
951
- wed: "3",
952
- thu: "4",
953
- fri: "5",
954
- sat: "6",
955
- sun: "7"
956
- }
957
- };
958
- const timeNicknames = {
959
- "@yearly": "0 0 1 1 *",
960
- "@annually": "0 0 1 1 *",
961
- "@monthly": "0 0 1 * *",
962
- "@weekly": "0 0 * * 0",
963
- "@daily": "0 0 * * *",
964
- "@hourly": "0 * * * *",
965
- "@minutely": "* * * * *"
966
- };
967
- function parseElement(element, constraint) {
968
- const result = /* @__PURE__ */ new Set();
969
- if (element === "*") {
970
- for (let i = constraint.min; i <= constraint.max; i = i + 1) result.add(i);
971
- return result;
972
- }
973
- const listElements = element.split(",");
974
- if (listElements.length > 1) {
975
- for (const listElement of listElements) {
976
- const parsedListElement = parseElement(listElement, constraint);
977
- for (const x of parsedListElement) result.add(x);
978
- }
979
- return result;
980
- }
981
- const parseSingleElement = (singleElement) => {
982
- var _a, _b;
983
- singleElement = (_b = (_a = constraint.aliases) === null || _a === void 0 ? void 0 : _a[singleElement.toLowerCase()]) !== null && _b !== void 0 ? _b : singleElement;
984
- const parsedElement = Number.parseInt(singleElement, 10);
985
- if (Number.isNaN(parsedElement)) throw new Error(`Failed to parse ${element}: ${singleElement} is NaN.`);
986
- if (parsedElement < constraint.min || parsedElement > constraint.max) throw new Error(`Failed to parse ${element}: ${singleElement} is outside of constraint range of ${constraint.min} - ${constraint.max}.`);
987
- return parsedElement;
988
- };
989
- const rangeSegments = /^(([0-9a-zA-Z]+)-([0-9a-zA-Z]+)|\*)(\/([0-9]+))?$/.exec(element);
990
- if (rangeSegments === null) {
991
- result.add(parseSingleElement(element));
992
- return result;
993
- }
994
- let parsedStart = rangeSegments[1] === "*" ? constraint.min : parseSingleElement(rangeSegments[2]);
995
- const parsedEnd = rangeSegments[1] === "*" ? constraint.max : parseSingleElement(rangeSegments[3]);
996
- if (constraint === weekdayConstraint && parsedStart === 7 && parsedEnd !== 7) parsedStart = 0;
997
- if (parsedStart > parsedEnd) throw new Error(`Failed to parse ${element}: Invalid range (start: ${parsedStart}, end: ${parsedEnd}).`);
998
- const step = rangeSegments[5];
999
- let parsedStep = 1;
1000
- if (step !== void 0) {
1001
- parsedStep = Number.parseInt(step, 10);
1002
- if (Number.isNaN(parsedStep)) throw new Error(`Failed to parse step: ${step} is NaN.`);
1003
- if (parsedStep < 1) throw new Error(`Failed to parse step: Expected ${step} to be greater than 0.`);
1004
- }
1005
- for (let i = parsedStart; i <= parsedEnd; i = i + parsedStep) result.add(i);
1006
- return result;
1007
- }
1008
- /** Parses a cron expression into a Cron instance. */
1009
- function parseCronExpression(cronExpression) {
1010
- var _a;
1011
- if (typeof cronExpression !== "string") throw new TypeError("Invalid cron expression: must be of type string.");
1012
- cronExpression = (_a = timeNicknames[cronExpression.toLowerCase()]) !== null && _a !== void 0 ? _a : cronExpression;
1013
- const elements = cronExpression.split(" ").filter((elem) => elem.length > 0);
1014
- if (elements.length < 5 || elements.length > 6) throw new Error("Invalid cron expression: expected 5 or 6 elements.");
1015
- const rawSeconds = elements.length === 6 ? elements[0] : "0";
1016
- const rawMinutes = elements.length === 6 ? elements[1] : elements[0];
1017
- const rawHours = elements.length === 6 ? elements[2] : elements[1];
1018
- const rawDays = elements.length === 6 ? elements[3] : elements[2];
1019
- const rawMonths = elements.length === 6 ? elements[4] : elements[3];
1020
- const rawWeekdays = elements.length === 6 ? elements[5] : elements[4];
1021
- return new Cron({
1022
- seconds: parseElement(rawSeconds, secondConstraint),
1023
- minutes: parseElement(rawMinutes, minuteConstraint),
1024
- hours: parseElement(rawHours, hourConstraint),
1025
- days: parseElement(rawDays, dayConstraint),
1026
- months: new Set(Array.from(parseElement(rawMonths, monthConstraint)).map((x) => x - 1)),
1027
- weekdays: new Set(Array.from(parseElement(rawWeekdays, weekdayConstraint)).map((x) => x % 7))
1028
- });
1029
- }
1030
- //#endregion
1031
- //#region ../../packages/workflow-core/src/shared/duration.ts
1032
- const MULTIPLIERS = {
1033
- s: 1e3,
1034
- m: 6e4,
1035
- h: 36e5,
1036
- d: 864e5,
1037
- w: 6048e5,
1038
- y: 31536e6
1039
- };
1040
- /**
1041
- * Convert a {@link Duration} value into milliseconds.
1042
- *
1043
- * Accepts the full Duration union: a positive integer (treated as ms)
1044
- * or a string like "5s", "2m", "1h", "1d", "1w", "1y".
1045
- */
1046
- function parseDurationToMs(duration) {
1047
- if (typeof duration === "number") return duration;
1048
- const match = duration.match(/^(\d+)([smhdwy])$/);
1049
- if (!match?.[1] || !match[2]) throw new Error(`Invalid duration format: "${duration}". Expected a positive integer or a string like "5s", "2m", "1h", "1d", "1w", "1y".`);
1050
- return Number.parseInt(match[1], 10) * MULTIPLIERS[match[2]];
1051
- }
1052
- //#endregion
1053
- //#region ../../packages/workflow-core/src/shared/schedule.ts
1054
- /**
1055
- * shared/schedule.ts
1056
- *
1057
- * Unified schedule type that supports both simple intervals and cron expressions.
1058
- * Can be used in both cron and polling triggers for maximum flexibility.
1059
- *
1060
- * Template literal types provide compile-time type safety.
1061
- * Zod schemas with refinements provide runtime validation.
1062
- */
1063
- const DurationSchema = z.union([z.number().int().positive().finite(), z.string().regex(/^[1-9]\d*[smhdwy]$/)]);
1064
- const DurationStringSchema = z.string().refine((val) => /^\d+[smhdwy]$/.test(val), { message: "Invalid duration format. Must be a positive integer followed by s, m, h, d, w, or y (e.g., \"5m\", \"1h\")" }).refine((val) => {
1065
- const match = val.match(/^(\d+)[smhdwy]$/);
1066
- if (!match?.[1]) return false;
1067
- const num = Number.parseInt(match[1], 10);
1068
- return num > 0 && Number.isFinite(num);
1069
- }, { message: "Duration value must be a positive integer greater than 0" });
1070
- const CronExpressionSchema = z.string().superRefine((val, ctx) => {
1071
- try {
1072
- parseCronExpression(val);
1073
- } catch (error) {
1074
- const errorMessage = error instanceof Error ? error.message : "Invalid cron expression format";
1075
- ctx.addIssue({
1076
- code: "custom",
1077
- message: `Invalid cron expression: ${errorMessage}. Must be a valid 5-field cron: minute hour day month weekday (e.g., "0 9 * * *", "*/15 * * * *")`
1078
- });
1079
- }
1080
- });
1081
- const ScheduleSchema = z.union([
1082
- z.number().refine((val) => val > 0, { message: "Duration in milliseconds must be positive" }).refine(Number.isFinite, { message: "Duration in milliseconds must be finite" }).refine(Number.isInteger, { message: "Duration in milliseconds must be an integer" }),
1083
- DurationStringSchema,
1084
- CronExpressionSchema
1085
- ]);
1086
- const IANATimezoneSchema = z.enum([
1087
- "UTC",
1088
- "GMT",
1089
- "Etc/UTC",
1090
- "Etc/GMT",
1091
- "America/New_York",
1092
- "America/Chicago",
1093
- "America/Denver",
1094
- "America/Los_Angeles",
1095
- "America/Phoenix",
1096
- "America/Anchorage",
1097
- "America/Toronto",
1098
- "America/Vancouver",
1099
- "America/Mexico_City",
1100
- "America/Sao_Paulo",
1101
- "America/Buenos_Aires",
1102
- "Europe/London",
1103
- "Europe/Paris",
1104
- "Europe/Berlin",
1105
- "Europe/Rome",
1106
- "Europe/Madrid",
1107
- "Europe/Amsterdam",
1108
- "Europe/Stockholm",
1109
- "Europe/Vienna",
1110
- "Europe/Zurich",
1111
- "Europe/Moscow",
1112
- "Europe/Athens",
1113
- "Europe/Dublin",
1114
- "Asia/Tokyo",
1115
- "Asia/Shanghai",
1116
- "Asia/Hong_Kong",
1117
- "Asia/Singapore",
1118
- "Asia/Seoul",
1119
- "Asia/Dubai",
1120
- "Asia/Kolkata",
1121
- "Asia/Bangkok",
1122
- "Asia/Jakarta",
1123
- "Asia/Manila",
1124
- "Asia/Taipei",
1125
- "Australia/Sydney",
1126
- "Australia/Melbourne",
1127
- "Australia/Brisbane",
1128
- "Australia/Perth",
1129
- "Australia/Adelaide",
1130
- "Pacific/Auckland",
1131
- "Pacific/Honolulu",
1132
- "Africa/Cairo",
1133
- "Africa/Johannesburg",
1134
- "Africa/Lagos",
1135
- "Africa/Nairobi",
1136
- "Asia/Riyadh",
1137
- "Asia/Tehran",
1138
- "Asia/Jerusalem",
1139
- "Asia/Doha"
1140
- ]);
1141
- //#endregion
1142
- export { idNoSpacesString as A, RetryConfigSchema as B, CredentialSetManifestSchema as C, anyZodSchemaSchema as D, CREDENTIAL_VISIBILITIES as E, schemaToJsonSchema as F, trimmedNonEmptyString as I, trimmedNonEmptyStringUnbounded as L, jsonValueSchema as M, optionalDescriptionString as N, createStructuralSchema as O, optionalTrimmedNonEmptyString as P, validateConfig as R, SourceLocationSchema as S, CREDENTIAL_KINDS as T, SHA256HashSchema as V, deduplicateCredentialRequirementEntries as _, CredentialRequirementsSchema as a, CapturedVariableSchema as b, IntegrationScopeSchema as c, TriggerSourceSchema as d, TriggerTypeSchema as f, collectCredentialRequirementEntries as g, WorkflowStepEntrySchema as h, parseDurationToMs as i, jsonSchemaObject as j, descriptionString as k, ResolvedCredentialSetSchema as l, WebhookMethodSchema as m, IANATimezoneSchema as n, DeclaredCredentialRequirementSchema as o, TriggerUploadDataSchema as p, ScheduleSchema as r, ExecutionIdentityPolicySchema as s, DurationSchema as t, TriggerCredentialRequirementsSchema as u, CallKindSchema as v, credentialSetConfigSchema as w, ImportSourceSchema as x, CallsiteFingerprintSchema as y, JsonSchemaSchema as z };