@keystrokehq/cli 0.0.32 → 0.0.37
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/README.md +25 -4
- package/dist/{accept.handler-DNfIXPSP.mjs → accept.handler-DCsud1s5.mjs} +4 -4
- package/dist/{admin-CJp8XksD.mjs → admin-BaOtHeZ2.mjs} +10 -10
- package/dist/{agent-manifest-De5TCxZq.mjs → agent-manifest-DfWD5tvv.mjs} +17 -27
- package/dist/{agents-G37PM35Z.mjs → agents-BVAVfMR_.mjs} +9 -9
- package/dist/{api-keys-4igNHJ_W.mjs → api-keys-BhEEsHUh.mjs} +6 -6
- package/dist/{api-BK3EhPvs.mjs → api-sWkB_Wta.mjs} +1 -1
- package/dist/{auth-CIOmmV4x.mjs → auth-BnsitjzT.mjs} +6 -6
- package/dist/{auth.handler-CznN_vfz.mjs → auth.handler-W_xk14TL.mjs} +3 -3
- package/dist/authored-workflow-ref-fkHEEVnd.mjs +113 -0
- package/dist/{build-agents-DseUtzd4-CSGpNXur.mjs → build-agents-CUzBnlAG-3ePFZiJ6.mjs} +12 -11
- package/dist/{build-progress-DLM1Bt4T.mjs → build-progress-CM-b6Bby.mjs} +2 -2
- package/dist/{build-tasks-C09SdfjC-BmAVLTtQ.mjs → build-tasks-5eOvI19S-tbN6CRx9.mjs} +4 -4
- package/dist/{build-workflows-BZ_m97Pr-BiyptCrn.mjs → build-workflows-C-gQM3l5-_zcBHE3M.mjs} +14 -9
- package/dist/{build.handler-zHimoO7c.mjs → build.handler-CpAsAsBc.mjs} +12 -9
- package/dist/{clear-cache.handler-BP0K1-uN.mjs → clear-cache.handler-gJpwslkK.mjs} +2 -2
- package/dist/{clear.handler-T27GpgSu.mjs → clear.handler-CDyG6-dk.mjs} +1 -1
- package/dist/{clear.handler-PsA5QKHx.mjs → clear.handler-_sR33Hp8.mjs} +2 -2
- package/dist/{commander-BlrSdFcu.mjs → commander-C6SSTQJ2.mjs} +22 -3
- package/dist/{connect-BbLJhlIA.mjs → connect-27EgnljZ.mjs} +3 -3
- package/dist/{connect.handler-BthE-7Wg.mjs → connect.handler-COM1LnNg.mjs} +5 -5
- package/dist/{context-sgKhRc5v.mjs → context-ebZssGCY.mjs} +4 -4
- package/dist/{create.handler-BovbO_g0.mjs → create.handler-CAWJAGzQ.mjs} +3 -3
- package/dist/{credential-env-map-CRs0llf0.mjs → credential-env-map-5a41jLwM.mjs} +1 -1
- package/dist/{credential-requirements-D0mavK8j-CFMf0Xwu.mjs → credential-requirements-B5Alhu1v-DanlSKnT.mjs} +3 -3
- package/dist/{credential-schema-mismatch-ClQgEVtO.mjs → credential-schema-mismatch-c17ktoNU.mjs} +1 -1
- package/dist/{credentials-CsncZ52a.mjs → credentials-C0ssbMlp.mjs} +10 -10
- package/dist/{credentials-DKrSaaLw.mjs → credentials-DtwLbee6.mjs} +1 -1
- package/dist/current-deployment-workflow-C6x65imE.mjs +20 -0
- package/dist/current.handler-DP1L_hm3.mjs +19 -0
- package/dist/{delete.handler-DkAK396w.mjs → delete.handler-C-5XFkgN.mjs} +2 -2
- package/dist/{deploy-DvPfR9fC.mjs → deploy-BcVQJza8.mjs} +2 -2
- package/dist/{deploy-progress-BsUH7fGE.mjs → deploy-progress-Bt86Yc1r.mjs} +2 -2
- package/dist/{deploy.handler-BW3f2N2G.mjs → deploy.handler-GPS9lxGk.mjs} +16 -16
- package/dist/{diff-utils-Bs--xmoV.mjs → diff-utils-YEUYtSRs.mjs} +1 -1
- package/dist/{diff.handler-BwhsoAg0.mjs → diff.handler-DkM5dhaN.mjs} +15 -9
- package/dist/{dist-Dw7gCE7y.mjs → dist-B5jy238v.mjs} +37 -11
- package/dist/{dist-CTEtWDW4.mjs → dist-BmbFJq8U.mjs} +8 -27
- package/dist/{env.handler-Dks6ZQh-.mjs → env.handler-V_isbSi2.mjs} +52 -29
- package/dist/{error-boundary-0veZ_RDS.mjs → error-boundary-BRxUsPi7.mjs} +3 -3
- package/dist/{iam-command-utils-CSZj4XlH.mjs → iam-command-utils-DNDN0wT6.mjs} +3 -13
- package/dist/{import-module-y0glInUe-DV_3dsU0.mjs → import-module-y0glInUe-EuAWaw9g.mjs} +506 -128
- package/dist/{init-BOCDwqKR.mjs → init-D1OmmclX.mjs} +3 -3
- package/dist/{init.handler-B3T4J6u_.mjs → init.handler-CUbYlUgP.mjs} +5 -5
- package/dist/{inspect.handler-v9snxDLi.mjs → inspect.handler-BE6coOuW.mjs} +24 -13
- package/dist/{integration-catalog-CiZ62hb_.mjs → integration-catalog-pSmWHFLQ.mjs} +3 -3
- package/dist/{integrations-m7_tb3GV.mjs → integrations-DZD5t8n2.mjs} +7 -7
- package/dist/{invites-BuatfJmN.mjs → invites-BuR1H-tA.mjs} +5 -5
- package/dist/{invites.list.handler-CK6mL10z.mjs → invites.list.handler-Dj4a6XOg.mjs} +6 -5
- package/dist/{invites.resend.handler-CKZouK1Z.mjs → invites.resend.handler-DEGF4vlB.mjs} +6 -5
- package/dist/{invites.revoke.handler-H0VI-3sp.mjs → invites.revoke.handler-Dg4ZvlFS.mjs} +6 -5
- package/dist/keystroke.mjs +122 -77
- package/dist/{list-enrichment-DP1wEyBZ.mjs → list-enrichment-dqbkXJzy.mjs} +2 -2
- package/dist/{list.handler-LxZInip2.mjs → list.handler-2g1CZAvB.mjs} +4 -4
- package/dist/{list.handler-DbYUk6ko.mjs → list.handler-7MkJfkak.mjs} +5 -5
- package/dist/list.handler-BTYVIn6z.mjs +39 -0
- package/dist/{list.handler-BiY5NFWd.mjs → list.handler-Bchcr3-e.mjs} +3 -3
- package/dist/list.handler-Choc4SZz.mjs +64 -0
- package/dist/{list.handler-CMRQKH4b.mjs → list.handler-D47C1z3m.mjs} +4 -4
- package/dist/{list.handler-DVnFrlis.mjs → list.handler-DYE48apa.mjs} +7 -7
- package/dist/{list.handler-DIMWZx78.mjs → list.handler-KcCaG3PZ.mjs} +4 -4
- package/dist/list2.handler-BIaIyrQf.mjs +99 -0
- package/dist/{listen-C_7Rgwkb.mjs → listen-CVY-_F29.mjs} +3 -3
- package/dist/{listen.handler-dJgorIzr.mjs → listen.handler-D_nEvXRn.mjs} +4 -4
- package/dist/{logs-B9YMhUGt.mjs → logs-CZ2qnsSH.mjs} +3 -3
- package/dist/{logs.handler-BfjCsAyq.mjs → logs.handler-BRUzZC9Z.mjs} +26 -29
- package/dist/{logs.handler-DGGVPMOX.mjs → logs.handler-Wk6mYyAZ.mjs} +1 -1
- package/dist/{members.add.handler-DSRCRxsI.mjs → members.add.handler-BJ0wr6rP.mjs} +6 -5
- package/dist/{members.invite.handler-BNpHn1dY.mjs → members.invite.handler-DyveDMuq.mjs} +6 -5
- package/dist/{members.list.handler-Bn9LJEPG.mjs → members.list.handler-CyQxH_zS.mjs} +6 -5
- package/dist/{members.remove.handler-Dkr2t_tX.mjs → members.remove.handler-Dtv9PooY.mjs} +6 -5
- package/dist/{members.update.handler-DBtUYuAY.mjs → members.update.handler-CeK-tCjT.mjs} +6 -5
- package/dist/{operations-CF2nUiBs.mjs → operations-CxQlt0S0.mjs} +5 -5
- package/dist/{org-DOH7YHk2.mjs → org-B8MPHJJu.mjs} +35 -28
- package/dist/org-context-BI9OSpbb.mjs +112 -0
- package/dist/org-output-DffU7DKn.mjs +64 -0
- package/dist/{orgs.create.handler-BO70zIdp.mjs → orgs.create.handler-BKvSmkU3.mjs} +4 -4
- package/dist/{orgs.get.handler-BuGg5bc9.mjs → orgs.get.handler-BA-CexIY.mjs} +4 -4
- package/dist/{orgs.list.handler--5HutMkl.mjs → orgs.list.handler-eCEg5kC1.mjs} +4 -4
- package/dist/{output-BWcVRt-T.mjs → output-DnIFEmi5.mjs} +1 -1
- package/dist/{package-manager-CvY4IW7X.mjs → package-manager-BP3-q8hh.mjs} +27 -2
- package/dist/{paused.handler-DHvxz-cC.mjs → paused.handler-4wKMTKZ-.mjs} +20 -33
- package/dist/{projects-C5GZ5Jrf.mjs → projects-Wu_2fB_x.mjs} +11 -9
- package/dist/{register.handler-CKMZ2WmD.mjs → register.handler-BvAkXCwE.mjs} +2 -2
- package/dist/{render-credential-Bn15FEUC.mjs → render-credential-D-H1ECDt.mjs} +1 -1
- package/dist/{render-operation-DWbMwhfc.mjs → render-operation-VdEPhoII.mjs} +2 -2
- package/dist/{requirements.handler-B5rqCjMu.mjs → requirements.handler-Bab4kBtw.mjs} +7 -7
- package/dist/{resolve-cli-credentials-CAOSVMJP.mjs → resolve-cli-credentials-GVOOedoQ.mjs} +1 -1
- package/dist/{resolve-project-E9mrh_el.mjs → resolve-project-DLKlAy0z.mjs} +24 -8
- package/dist/{run-polling-DawiBus-.mjs → run-polling-C5fI7xTp.mjs} +97 -14
- package/dist/{run.handler-BG7xitEK.mjs → run.handler-BKD5Xu0A.mjs} +42 -30
- package/dist/{runs-swYYBT6C.mjs → runs-CT31dczt.mjs} +4 -4
- package/dist/{schema-display-FvI8QjOQ.mjs → schema-display-sZ6ConJd.mjs} +33 -26
- package/dist/schemas-ClAIoIrX.mjs +281 -0
- package/dist/{search-CA0J5NOY.mjs → search-BeQW_pf4.mjs} +3 -3
- package/dist/{search.handler-BVDsYZlJ.mjs → search.handler-BJ-ZlDL4.mjs} +6 -6
- package/dist/{show.handler-nkK6Erbb.mjs → show.handler-BrIHUH28.mjs} +4 -4
- package/dist/{show.handler-CsidInW8.mjs → show.handler-Cqe_hCqU.mjs} +5 -5
- package/dist/{show.handler-CwwnCmbp.mjs → show.handler-DB8xl5FU.mjs} +6 -6
- package/dist/{skill-installer-DG8kTaQR.mjs → skill-installer-DuMhavmM.mjs} +3 -1
- package/dist/{skills-sync.handler-yRmi3OgP.mjs → skills-sync.handler-BGs-_YD9.mjs} +13 -7
- package/dist/{skills.command-COYd3k4Z.mjs → skills.command-DUWn6FbL.mjs} +5 -5
- package/dist/skills.handler-DqLXJepA.mjs +9 -0
- package/dist/{spinner-progress-lrKDs4YF.mjs → spinner-progress-BYxlr3lY.mjs} +1 -1
- package/dist/status.handler-DAId4bVU.mjs +72 -0
- package/dist/{switch.handler-BwYndsP-.mjs → switch.handler-Cd4Yg2n8.mjs} +17 -4
- package/dist/{sync-6fZkIUtn.mjs → sync-DgC4lcxh.mjs} +2 -2
- package/dist/{sync.handler-Ctr-cN9X.mjs → sync.handler-Cm_WtGmH.mjs} +8 -8
- package/dist/{task-BWuIKWh4.mjs → task-DTvLzUkA.mjs} +2 -88
- package/dist/{task-target-build-QllcCfoN.mjs → task-target-build-CtvRyVjH.mjs} +5 -5
- package/dist/task-target-deploy-runner.mjs +6 -6
- package/dist/{test-C8VIZe9V.mjs → test-4V7nh67i.mjs} +5 -5
- package/dist/{test.handler-BCW0YBPd.mjs → test.handler-BdCYcwR4.mjs} +2 -2
- package/dist/{test.handler-DLaxrJ9V.mjs → test.handler-Bo4YTs2Z.mjs} +19 -16
- package/dist/{tool.handler-8qNmgdRe.mjs → tool.handler-CPCrSDq2.mjs} +12 -12
- package/dist/{trigger-artifacts-BcRScRSp-BiD2h6do.mjs → trigger-artifacts-BcRScRSp-BRpU-He5.mjs} +2 -2
- package/dist/{trigger-manifest-C07EM-b2.mjs → trigger-manifest-BVqjDhxU.mjs} +1 -1
- package/dist/{upgrade-DgOcc8IT.mjs → upgrade-2qUOcjxb.mjs} +4 -8
- package/dist/upgrade.handler-PqlKSuUE.mjs +99 -0
- package/dist/{upload.handler-B7xle1oX.mjs → upload.handler-CS-vLpzC.mjs} +9 -9
- package/dist/{users.get.handler-C4t1vXwi.mjs → users.get.handler-CH1c6Lnj.mjs} +4 -4
- package/dist/{users.list.handler-Dvl90grq.mjs → users.list.handler-CxbZFgjO.mjs} +4 -4
- package/dist/{users.set-role.handler-Djw1_VGf.mjs → users.set-role.handler-CBRE-Ws6.mjs} +4 -4
- package/dist/{validate.handler-Drf_lssw.mjs → validate.handler-1d-UmtXB.mjs} +171 -26
- package/dist/{workflow-build-Begvjfq8.mjs → workflow-build-Bm8JoVv4.mjs} +234 -32
- package/dist/{workflow-build-manifest-1sC52TIG.mjs → workflow-build-manifest-CV6bBmDO.mjs} +1 -1
- package/dist/{workflow-bundler-BzHk73PM-muPv1yGG.mjs → workflow-bundler-Bs3zQNQv-Dy7lXxy3.mjs} +15 -4
- package/dist/{workflows-DjMlxuBX.mjs → workflows-ny7rOdeH.mjs} +34 -37
- package/dist/{writer-byNNUjRm-B-on1n6c.mjs → writer-BLg0RuZa-Y6ExdYH9.mjs} +6 -4
- package/package.json +10 -10
- package/dist/current-deployment-workflow-B1VQCYC-.mjs +0 -94
- package/dist/current.handler-BaGaCLzB.mjs +0 -21
- package/dist/list.handler-BEMj3FyH.mjs +0 -76
- package/dist/list.handler-Cq_oQY5B.mjs +0 -52
- package/dist/list.handler-htR9TeiS.mjs +0 -24
- package/dist/schemas-D2zfmyC-.mjs +0 -671
- package/dist/skills.handler-DYIQK0Vu.mjs +0 -9
- package/dist/status.handler-Ch_DtyBp.mjs +0 -109
- package/dist/upgrade.handler-DSZuw7-9.mjs +0 -80
- /package/dist/{build-metadata-BB_L45ZS-DSJL7dTy.mjs → build-metadata-BB_L45ZS-DRQsV6JK.mjs} +0 -0
- /package/dist/{deploy-DhCbYFc7.mjs → deploy-BiKBH25R.mjs} +0 -0
- /package/dist/{detect-env-access-CwkOYeYM-COq4U-4Y.mjs → detect-env-access-CwkOYeYM-r4aynBU0.mjs} +0 -0
- /package/dist/{read-credential-keys-77a91T8M-DGK5XTQp.mjs → read-credential-keys-77a91T8M-I07NYwfH.mjs} +0 -0
- /package/dist/{run-polling-fBouPjJ2.mjs → run-polling-1c0ckC1A.mjs} +0 -0
- /package/dist/{schemas-4Mq_bxob.mjs → schemas-8nhXlXWh.mjs} +0 -0
- /package/dist/{task-target-deploy-B_3HPSo2.mjs → task-target-deploy-m9LfE488.mjs} +0 -0
- /package/dist/{types-AlA-ifK9.mjs → types-Cb0eWmUU.mjs} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { n as findProjectRoot } from "./project-config-DudGRFPO.mjs";
|
|
4
|
-
import { _ as descriptionString, b as trimmedNonEmptyString, g as createStructuralSchema, h as anyZodSchemaSchema, l as TriggerTypeSchema, m as CredentialSetManifestSchema, n as DeclaredCredentialRequirementSchema, r as ExecutionIdentityPolicySchema, v as jsonSchemaObject, y as jsonValueSchema } from "./credential-requirements-
|
|
5
|
-
import { a as FlowGraphSchema, i as WorkflowCoreManifestSchema, n as WORKFLOW_MANIFEST_SCHEMA_VERSION } from "./workflow-build-manifest-
|
|
6
|
-
import { c as optionalDescriptionString,
|
|
4
|
+
import { _ as descriptionString, b as trimmedNonEmptyString, g as createStructuralSchema, h as anyZodSchemaSchema, l as TriggerTypeSchema, m as CredentialSetManifestSchema, n as DeclaredCredentialRequirementSchema, r as ExecutionIdentityPolicySchema, v as jsonSchemaObject, y as jsonValueSchema } from "./credential-requirements-B5Alhu1v-DanlSKnT.mjs";
|
|
5
|
+
import { a as FlowGraphSchema, i as WorkflowCoreManifestSchema, n as WORKFLOW_MANIFEST_SCHEMA_VERSION } from "./workflow-build-manifest-CV6bBmDO.mjs";
|
|
6
|
+
import { c as optionalDescriptionString, i as createStructuralSchema$1, l as optionalTrimmedNonEmptyString, o as idNoSpacesString, r as anyZodSchemaSchema$1, s as jsonSchemaObject$1, t as CredentialSetManifestSchema$1, u as trimmedNonEmptyString$1 } from "./schemas-ClAIoIrX.mjs";
|
|
7
7
|
import { t as runWithConcurrency } from "./concurrency-gXn9Rw8x-CnBnF2cg.mjs";
|
|
8
8
|
import { createRequire } from "node:module";
|
|
9
9
|
import * as path$1 from "node:path";
|
|
@@ -14,7 +14,7 @@ import { execFile } from "node:child_process";
|
|
|
14
14
|
import { randomUUID } from "node:crypto";
|
|
15
15
|
import { promisify } from "node:util";
|
|
16
16
|
//#region ../../packages/core/src/mcp-server/schemas.ts
|
|
17
|
-
const credentialSetInstanceSchema$
|
|
17
|
+
const credentialSetInstanceSchema$3 = createStructuralSchema$1([
|
|
18
18
|
"id",
|
|
19
19
|
"auth",
|
|
20
20
|
"connections"
|
|
@@ -42,7 +42,7 @@ z.object({
|
|
|
42
42
|
name: optionalTrimmedNonEmptyString("MCP server name"),
|
|
43
43
|
description: optionalDescriptionString("MCP server description"),
|
|
44
44
|
transport: McpTransportSchema,
|
|
45
|
-
credentialSets: z.array(credentialSetInstanceSchema$
|
|
45
|
+
credentialSets: z.array(credentialSetInstanceSchema$3).optional(),
|
|
46
46
|
credentials: z.function().optional()
|
|
47
47
|
});
|
|
48
48
|
const McpServerManifestSchema = z.object({
|
|
@@ -66,7 +66,7 @@ const McpServerManifestSchema = z.object({
|
|
|
66
66
|
});
|
|
67
67
|
//#endregion
|
|
68
68
|
//#region ../../packages/core/src/messaging-gateway/schemas.ts
|
|
69
|
-
const credentialSetInstanceSchema$
|
|
69
|
+
const credentialSetInstanceSchema$2 = createStructuralSchema$1([
|
|
70
70
|
"id",
|
|
71
71
|
"auth",
|
|
72
72
|
"connections"
|
|
@@ -79,7 +79,7 @@ z.object({
|
|
|
79
79
|
description: optionalDescriptionString("MessagingGateway description"),
|
|
80
80
|
provider: z.string().min(1, "MessagingGateway provider is required"),
|
|
81
81
|
mode: MessagingGatewayModeSchema,
|
|
82
|
-
credentialSet: credentialSetInstanceSchema$
|
|
82
|
+
credentialSet: credentialSetInstanceSchema$2,
|
|
83
83
|
credentialScope: MessagingGatewayCredentialScopeSchema.optional(),
|
|
84
84
|
appRef: z.string().min(1).optional()
|
|
85
85
|
});
|
|
@@ -97,53 +97,35 @@ const MessagingGatewayManifestSchema = z.object({
|
|
|
97
97
|
});
|
|
98
98
|
//#endregion
|
|
99
99
|
//#region ../../packages/core/src/sandbox/schemas.ts
|
|
100
|
-
/**
|
|
101
|
-
* `workdir` must be `/workspace` or a subdirectory so it lands inside the
|
|
102
|
-
* persistent bind mount used by `bootSandbox`. Anything outside `/workspace`
|
|
103
|
-
* is ephemeral today (and not captured by future snapshots' instance state).
|
|
104
|
-
*/
|
|
105
100
|
const WorkdirSchema = z.string().trim().min(1).refine((value) => value === "/workspace" || value.startsWith("/workspace/"), { error: "workdir must be \"/workspace\" or a subdirectory of \"/workspace\"" });
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
* `setupCommands` (and after a snapshot warm-boot, where setupCommands are
|
|
110
|
-
* skipped). Use for `git pull`, `pnpm build`, or anything that should
|
|
111
|
-
* refresh on each invocation. Each command runs with `cwd = workdir`.
|
|
112
|
-
*/
|
|
113
|
-
runCommands: z.array(z.string().trim().min(1)).default([]),
|
|
114
|
-
env: z.record(z.string(), z.string()).default({}),
|
|
115
|
-
workdir: WorkdirSchema.optional()
|
|
116
|
-
});
|
|
117
|
-
const SandboxFileSourceSchema = z.discriminatedUnion("type", [z.object({
|
|
118
|
-
type: z.literal("git"),
|
|
119
|
-
/** Remote git URL to clone. */
|
|
120
|
-
url: trimmedNonEmptyString$1("Git URL"),
|
|
121
|
-
/** Branch to clone. Omit for default branch. */
|
|
122
|
-
branch: z.string().optional(),
|
|
123
|
-
/**
|
|
124
|
-
* Where to clone inside the VM. Relative paths resolve against the
|
|
125
|
-
* sandbox `workdir`; absolute paths must stay under `/workspace`. Omit
|
|
126
|
-
* to default to `<workdir>/<repo-basename>`.
|
|
127
|
-
*/
|
|
128
|
-
target: z.string().optional()
|
|
101
|
+
const ManifestValueSchema = z.discriminatedUnion("kind", [z.object({
|
|
102
|
+
kind: z.literal("literal"),
|
|
103
|
+
value: z.string()
|
|
129
104
|
}), z.object({
|
|
130
|
-
|
|
131
|
-
|
|
105
|
+
kind: z.literal("credential"),
|
|
106
|
+
credentialSetId: z.string().min(1),
|
|
107
|
+
key: z.string().min(1)
|
|
108
|
+
})]);
|
|
109
|
+
const SandboxFileSourceSchema = z.object({
|
|
132
110
|
path: trimmedNonEmptyString$1("Local path"),
|
|
133
|
-
/**
|
|
134
|
-
* Where the file/dir lands inside the VM. Relative paths resolve
|
|
135
|
-
* against the sandbox `workdir`; absolute paths must stay under
|
|
136
|
-
* `/workspace`. Omit to default to `<workdir>/<basename(path)>`.
|
|
137
|
-
*/
|
|
138
111
|
target: z.string().optional()
|
|
139
|
-
})
|
|
112
|
+
});
|
|
113
|
+
const credentialSetInstanceSchema$1 = createStructuralSchema$1([
|
|
114
|
+
"id",
|
|
115
|
+
"auth",
|
|
116
|
+
"connections"
|
|
117
|
+
], "a CredentialSet instance");
|
|
118
|
+
const sandboxEnvBuilderSchema = z.custom((value) => typeof value === "function", { message: "env must be a function." });
|
|
140
119
|
z.object({
|
|
141
120
|
id: optionalTrimmedNonEmptyString("Sandbox ID"),
|
|
142
121
|
name: optionalTrimmedNonEmptyString("Sandbox name"),
|
|
143
122
|
description: optionalDescriptionString("Sandbox description"),
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
setupCommands: z.array(z.string()).optional()
|
|
123
|
+
workdir: WorkdirSchema.optional(),
|
|
124
|
+
runCommands: z.array(z.string().trim().min(1)).optional(),
|
|
125
|
+
setupCommands: z.array(z.string()).optional(),
|
|
126
|
+
credentialSets: z.array(credentialSetInstanceSchema$1).optional(),
|
|
127
|
+
env: sandboxEnvBuilderSchema.optional(),
|
|
128
|
+
fileSources: z.array(SandboxFileSourceSchema).optional()
|
|
147
129
|
});
|
|
148
130
|
const SandboxManifestSchema = z.object({
|
|
149
131
|
manifestVersion: z.literal(1),
|
|
@@ -151,9 +133,12 @@ const SandboxManifestSchema = z.object({
|
|
|
151
133
|
id: z.string().min(1),
|
|
152
134
|
name: z.string().min(1),
|
|
153
135
|
description: z.string().optional(),
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
setupCommands: z.array(z.string())
|
|
136
|
+
workdir: WorkdirSchema.optional(),
|
|
137
|
+
runCommands: z.array(z.string()),
|
|
138
|
+
setupCommands: z.array(z.string()),
|
|
139
|
+
credentialSets: z.array(CredentialSetManifestSchema$1),
|
|
140
|
+
env: z.record(z.string(), ManifestValueSchema).optional(),
|
|
141
|
+
fileSources: z.array(SandboxFileSourceSchema)
|
|
157
142
|
});
|
|
158
143
|
//#endregion
|
|
159
144
|
//#region ../../packages/core/src/agent/types.ts
|
|
@@ -176,9 +161,9 @@ const mcpServerInstanceSchema = createStructuralSchema$1([
|
|
|
176
161
|
], "a McpServer instance");
|
|
177
162
|
const sandboxInstanceSchema = createStructuralSchema$1([
|
|
178
163
|
"id",
|
|
179
|
-
"
|
|
180
|
-
"
|
|
181
|
-
"
|
|
164
|
+
"workdir",
|
|
165
|
+
"setupCommands",
|
|
166
|
+
"toManifest"
|
|
182
167
|
], "a Sandbox instance");
|
|
183
168
|
const messagingGatewayInstanceSchema = createStructuralSchema$1([
|
|
184
169
|
"id",
|
|
@@ -252,13 +237,474 @@ const AgentManifestSchema = z.object({
|
|
|
252
237
|
sandbox: SandboxManifestSchema.optional(),
|
|
253
238
|
messaging: z.array(MessagingGatewayManifestSchema).optional()
|
|
254
239
|
});
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
240
|
+
//#endregion
|
|
241
|
+
//#region ../../packages/core/dist/chunks/duration-DfWE41wf.mjs
|
|
242
|
+
const DurationSchema = z.union([z.number().int().positive().finite(), z.string().regex(/^[1-9]\d*[smhdwy]$/)]);
|
|
243
|
+
//#endregion
|
|
244
|
+
//#region ../../packages/core/dist/chunks/schemas-DvEOweMj.mjs
|
|
245
|
+
const trimmedString = z.string().trim().min(1);
|
|
246
|
+
const payloadHashSchema = z.object({
|
|
247
|
+
from: z.literal("payload"),
|
|
248
|
+
strategy: z.literal("hash")
|
|
249
|
+
});
|
|
250
|
+
const payloadPathSchema = z.object({
|
|
251
|
+
from: z.literal("payload"),
|
|
252
|
+
path: trimmedString
|
|
253
|
+
});
|
|
254
|
+
const headerHashSchema = z.object({
|
|
255
|
+
from: z.literal("header"),
|
|
256
|
+
strategy: z.literal("hash")
|
|
257
|
+
});
|
|
258
|
+
const headerNameSchema = z.object({
|
|
259
|
+
from: z.literal("header"),
|
|
260
|
+
name: trimmedString
|
|
261
|
+
});
|
|
262
|
+
const idempotencyKeyConfigSchema = z.union([
|
|
263
|
+
payloadHashSchema,
|
|
264
|
+
payloadPathSchema,
|
|
265
|
+
headerHashSchema,
|
|
266
|
+
headerNameSchema
|
|
267
|
+
]);
|
|
268
|
+
const credentialSetInstanceSchema = createStructuralSchema([
|
|
269
|
+
"id",
|
|
270
|
+
"auth",
|
|
271
|
+
"connections"
|
|
272
|
+
], "a CredentialSet instance");
|
|
273
|
+
const TriggerModeDefaultSchema = z.enum(["managed", "subscribable"]);
|
|
274
|
+
const TriggerRuntimeDescriptorSchema = z.object({
|
|
275
|
+
/**
|
|
276
|
+
* True when this trigger bundles a `poll` export executed inside a
|
|
277
|
+
* microsandbox VM at trigger time. Polling-only — webhook/cron always
|
|
278
|
+
* leave this undefined. Replaces the legacy `callbacks: { poll, ... }`
|
|
279
|
+
* descriptor (the other callbacks are gone now that filter/idempotency/
|
|
280
|
+
* verify/transform are declarative or run in the workflow VM).
|
|
281
|
+
*/
|
|
282
|
+
poll: z.boolean().optional(),
|
|
283
|
+
filterSchema: jsonSchemaObject.optional(),
|
|
284
|
+
/** Webhook-only declarative idempotency-key resolver. */
|
|
285
|
+
idempotencyConfig: idempotencyKeyConfigSchema.optional()
|
|
286
|
+
});
|
|
287
|
+
z.object({
|
|
288
|
+
manifestVersion: z.literal(1),
|
|
289
|
+
type: z.literal("trigger"),
|
|
290
|
+
triggerType: TriggerTypeSchema,
|
|
291
|
+
id: trimmedNonEmptyString("Trigger id"),
|
|
292
|
+
description: descriptionString("Trigger description"),
|
|
293
|
+
enabled: z.boolean(),
|
|
294
|
+
modeDefault: TriggerModeDefaultSchema,
|
|
295
|
+
executionIdentityPolicy: ExecutionIdentityPolicySchema.optional(),
|
|
296
|
+
credentialSets: z.array(CredentialSetManifestSchema).optional(),
|
|
297
|
+
runtime: TriggerRuntimeDescriptorSchema
|
|
298
|
+
});
|
|
299
|
+
const triggerBaseConfigSchema = z.object({
|
|
300
|
+
credentialSets: z.array(credentialSetInstanceSchema).optional(),
|
|
301
|
+
description: descriptionString("Trigger description"),
|
|
302
|
+
enabled: z.boolean().default(true),
|
|
303
|
+
executionIdentityPolicy: ExecutionIdentityPolicySchema.optional(),
|
|
304
|
+
modeDefault: TriggerModeDefaultSchema.default("managed"),
|
|
305
|
+
id: trimmedNonEmptyString("Trigger id")
|
|
306
|
+
});
|
|
307
|
+
//#endregion
|
|
308
|
+
//#region ../../node_modules/.pnpm/cron-schedule@6.0.0/node_modules/cron-schedule/dist/utils.js
|
|
309
|
+
function extractDateElements(date) {
|
|
310
|
+
return {
|
|
311
|
+
second: date.getSeconds(),
|
|
312
|
+
minute: date.getMinutes(),
|
|
313
|
+
hour: date.getHours(),
|
|
314
|
+
day: date.getDate(),
|
|
315
|
+
month: date.getMonth(),
|
|
316
|
+
weekday: date.getDay(),
|
|
317
|
+
year: date.getFullYear()
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
function getDaysInMonth(year, month) {
|
|
321
|
+
return new Date(year, month + 1, 0).getDate();
|
|
322
|
+
}
|
|
323
|
+
function getDaysBetweenWeekdays(weekday1, weekday2) {
|
|
324
|
+
if (weekday1 <= weekday2) return weekday2 - weekday1;
|
|
325
|
+
return 6 - weekday1 + weekday2 + 1;
|
|
326
|
+
}
|
|
327
|
+
//#endregion
|
|
328
|
+
//#region ../../node_modules/.pnpm/cron-schedule@6.0.0/node_modules/cron-schedule/dist/cron.js
|
|
329
|
+
var Cron = class {
|
|
330
|
+
constructor({ seconds, minutes, hours, days, months, weekdays }) {
|
|
331
|
+
if (!seconds || seconds.size === 0) throw new Error("There must be at least one allowed second.");
|
|
332
|
+
if (!minutes || minutes.size === 0) throw new Error("There must be at least one allowed minute.");
|
|
333
|
+
if (!hours || hours.size === 0) throw new Error("There must be at least one allowed hour.");
|
|
334
|
+
if (!months || months.size === 0) throw new Error("There must be at least one allowed month.");
|
|
335
|
+
if ((!weekdays || weekdays.size === 0) && (!days || days.size === 0)) throw new Error("There must be at least one allowed day or weekday.");
|
|
336
|
+
this.seconds = Array.from(seconds).sort((a, b) => a - b);
|
|
337
|
+
this.minutes = Array.from(minutes).sort((a, b) => a - b);
|
|
338
|
+
this.hours = Array.from(hours).sort((a, b) => a - b);
|
|
339
|
+
this.days = Array.from(days).sort((a, b) => a - b);
|
|
340
|
+
this.months = Array.from(months).sort((a, b) => a - b);
|
|
341
|
+
this.weekdays = Array.from(weekdays).sort((a, b) => a - b);
|
|
342
|
+
const validateData = (name, data, constraint) => {
|
|
343
|
+
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}`);
|
|
344
|
+
};
|
|
345
|
+
validateData("seconds", this.seconds, {
|
|
346
|
+
min: 0,
|
|
347
|
+
max: 59
|
|
348
|
+
});
|
|
349
|
+
validateData("minutes", this.minutes, {
|
|
350
|
+
min: 0,
|
|
351
|
+
max: 59
|
|
352
|
+
});
|
|
353
|
+
validateData("hours", this.hours, {
|
|
354
|
+
min: 0,
|
|
355
|
+
max: 23
|
|
356
|
+
});
|
|
357
|
+
validateData("days", this.days, {
|
|
358
|
+
min: 1,
|
|
359
|
+
max: 31
|
|
360
|
+
});
|
|
361
|
+
validateData("months", this.months, {
|
|
362
|
+
min: 0,
|
|
363
|
+
max: 11
|
|
364
|
+
});
|
|
365
|
+
validateData("weekdays", this.weekdays, {
|
|
366
|
+
min: 0,
|
|
367
|
+
max: 6
|
|
368
|
+
});
|
|
369
|
+
this.reversed = {
|
|
370
|
+
seconds: this.seconds.map((x) => x).reverse(),
|
|
371
|
+
minutes: this.minutes.map((x) => x).reverse(),
|
|
372
|
+
hours: this.hours.map((x) => x).reverse(),
|
|
373
|
+
days: this.days.map((x) => x).reverse(),
|
|
374
|
+
months: this.months.map((x) => x).reverse(),
|
|
375
|
+
weekdays: this.weekdays.map((x) => x).reverse()
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Find the next or previous hour, starting from the given start hour that matches the hour constraint.
|
|
380
|
+
* startHour itself might also be allowed.
|
|
381
|
+
*/
|
|
382
|
+
findAllowedHour(dir, startHour) {
|
|
383
|
+
return dir === "next" ? this.hours.find((x) => x >= startHour) : this.reversed.hours.find((x) => x <= startHour);
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Find the next or previous minute, starting from the given start minute that matches the minute constraint.
|
|
387
|
+
* startMinute itself might also be allowed.
|
|
388
|
+
*/
|
|
389
|
+
findAllowedMinute(dir, startMinute) {
|
|
390
|
+
return dir === "next" ? this.minutes.find((x) => x >= startMinute) : this.reversed.minutes.find((x) => x <= startMinute);
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Find the next or previous second, starting from the given start second that matches the second constraint.
|
|
394
|
+
* startSecond itself IS NOT allowed.
|
|
395
|
+
*/
|
|
396
|
+
findAllowedSecond(dir, startSecond) {
|
|
397
|
+
return dir === "next" ? this.seconds.find((x) => x > startSecond) : this.reversed.seconds.find((x) => x < startSecond);
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Find the next or previous time, starting from the given start time that matches the hour, minute
|
|
401
|
+
* and second constraints. startTime itself might also be allowed.
|
|
402
|
+
*/
|
|
403
|
+
findAllowedTime(dir, startTime) {
|
|
404
|
+
let hour = this.findAllowedHour(dir, startTime.hour);
|
|
405
|
+
if (hour !== void 0) if (hour === startTime.hour) {
|
|
406
|
+
let minute = this.findAllowedMinute(dir, startTime.minute);
|
|
407
|
+
if (minute !== void 0) if (minute === startTime.minute) {
|
|
408
|
+
const second = this.findAllowedSecond(dir, startTime.second);
|
|
409
|
+
if (second !== void 0) return {
|
|
410
|
+
hour,
|
|
411
|
+
minute,
|
|
412
|
+
second
|
|
413
|
+
};
|
|
414
|
+
minute = this.findAllowedMinute(dir, dir === "next" ? startTime.minute + 1 : startTime.minute - 1);
|
|
415
|
+
if (minute !== void 0) return {
|
|
416
|
+
hour,
|
|
417
|
+
minute,
|
|
418
|
+
second: dir === "next" ? this.seconds[0] : this.reversed.seconds[0]
|
|
419
|
+
};
|
|
420
|
+
} else return {
|
|
421
|
+
hour,
|
|
422
|
+
minute,
|
|
423
|
+
second: dir === "next" ? this.seconds[0] : this.reversed.seconds[0]
|
|
424
|
+
};
|
|
425
|
+
hour = this.findAllowedHour(dir, dir === "next" ? startTime.hour + 1 : startTime.hour - 1);
|
|
426
|
+
if (hour !== void 0) return {
|
|
427
|
+
hour,
|
|
428
|
+
minute: dir === "next" ? this.minutes[0] : this.reversed.minutes[0],
|
|
429
|
+
second: dir === "next" ? this.seconds[0] : this.reversed.seconds[0]
|
|
430
|
+
};
|
|
431
|
+
} else return {
|
|
432
|
+
hour,
|
|
433
|
+
minute: dir === "next" ? this.minutes[0] : this.reversed.minutes[0],
|
|
434
|
+
second: dir === "next" ? this.seconds[0] : this.reversed.seconds[0]
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Find the next or previous day in the given month, starting from the given startDay
|
|
439
|
+
* that matches either the day or the weekday constraint. startDay itself might also be allowed.
|
|
440
|
+
*/
|
|
441
|
+
findAllowedDayInMonth(dir, year, month, startDay) {
|
|
442
|
+
var _a, _b;
|
|
443
|
+
if (startDay < 1) throw new Error("startDay must not be smaller than 1.");
|
|
444
|
+
const daysInMonth = getDaysInMonth(year, month);
|
|
445
|
+
const daysRestricted = this.days.length !== 31;
|
|
446
|
+
const weekdaysRestricted = this.weekdays.length !== 7;
|
|
447
|
+
if (!daysRestricted && !weekdaysRestricted) {
|
|
448
|
+
if (startDay > daysInMonth) return dir === "next" ? void 0 : daysInMonth;
|
|
449
|
+
return startDay;
|
|
450
|
+
}
|
|
451
|
+
let allowedDayByDays;
|
|
452
|
+
if (daysRestricted) {
|
|
453
|
+
allowedDayByDays = dir === "next" ? this.days.find((x) => x >= startDay) : this.reversed.days.find((x) => x <= startDay);
|
|
454
|
+
if (allowedDayByDays !== void 0 && allowedDayByDays > daysInMonth) allowedDayByDays = void 0;
|
|
455
|
+
}
|
|
456
|
+
let allowedDayByWeekdays;
|
|
457
|
+
if (weekdaysRestricted) {
|
|
458
|
+
const startWeekday = new Date(year, month, startDay).getDay();
|
|
459
|
+
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];
|
|
460
|
+
if (nearestAllowedWeekday !== void 0) {
|
|
461
|
+
const daysBetweenWeekdays = dir === "next" ? getDaysBetweenWeekdays(startWeekday, nearestAllowedWeekday) : getDaysBetweenWeekdays(nearestAllowedWeekday, startWeekday);
|
|
462
|
+
allowedDayByWeekdays = dir === "next" ? startDay + daysBetweenWeekdays : startDay - daysBetweenWeekdays;
|
|
463
|
+
if (allowedDayByWeekdays > daysInMonth || allowedDayByWeekdays < 1) allowedDayByWeekdays = void 0;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
if (allowedDayByDays !== void 0 && allowedDayByWeekdays !== void 0) return dir === "next" ? Math.min(allowedDayByDays, allowedDayByWeekdays) : Math.max(allowedDayByDays, allowedDayByWeekdays);
|
|
467
|
+
if (allowedDayByDays !== void 0) return allowedDayByDays;
|
|
468
|
+
if (allowedDayByWeekdays !== void 0) return allowedDayByWeekdays;
|
|
469
|
+
}
|
|
470
|
+
/** Gets the next date starting from the given start date or now. */
|
|
471
|
+
getNextDate(startDate = /* @__PURE__ */ new Date()) {
|
|
472
|
+
const startDateElements = extractDateElements(startDate);
|
|
473
|
+
let minYear = startDateElements.year;
|
|
474
|
+
let startIndexMonth = this.months.findIndex((x) => x >= startDateElements.month);
|
|
475
|
+
if (startIndexMonth === -1) {
|
|
476
|
+
startIndexMonth = 0;
|
|
477
|
+
minYear++;
|
|
478
|
+
}
|
|
479
|
+
const maxIterations = this.months.length * 5;
|
|
480
|
+
for (let i = 0; i < maxIterations; i++) {
|
|
481
|
+
const year = minYear + Math.floor((startIndexMonth + i) / this.months.length);
|
|
482
|
+
const month = this.months[(startIndexMonth + i) % this.months.length];
|
|
483
|
+
const isStartMonth = year === startDateElements.year && month === startDateElements.month;
|
|
484
|
+
let day = this.findAllowedDayInMonth("next", year, month, isStartMonth ? startDateElements.day : 1);
|
|
485
|
+
let isStartDay = isStartMonth && day === startDateElements.day;
|
|
486
|
+
if (day !== void 0 && isStartDay) {
|
|
487
|
+
const nextTime = this.findAllowedTime("next", startDateElements);
|
|
488
|
+
if (nextTime !== void 0) return new Date(year, month, day, nextTime.hour, nextTime.minute, nextTime.second);
|
|
489
|
+
day = this.findAllowedDayInMonth("next", year, month, day + 1);
|
|
490
|
+
isStartDay = false;
|
|
491
|
+
}
|
|
492
|
+
if (day !== void 0 && !isStartDay) return new Date(year, month, day, this.hours[0], this.minutes[0], this.seconds[0]);
|
|
493
|
+
}
|
|
494
|
+
throw new Error("No valid next date was found.");
|
|
495
|
+
}
|
|
496
|
+
/** Gets the specified amount of future dates starting from the given start date or now. */
|
|
497
|
+
getNextDates(amount, startDate) {
|
|
498
|
+
const dates = [];
|
|
499
|
+
let nextDate;
|
|
500
|
+
for (let i = 0; i < amount; i++) {
|
|
501
|
+
nextDate = this.getNextDate(nextDate !== null && nextDate !== void 0 ? nextDate : startDate);
|
|
502
|
+
dates.push(nextDate);
|
|
503
|
+
}
|
|
504
|
+
return dates;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Get an ES6 compatible iterator which iterates over the next dates starting from startDate or now.
|
|
508
|
+
* The iterator runs until the optional endDate is reached or forever.
|
|
509
|
+
*/
|
|
510
|
+
*getNextDatesIterator(startDate, endDate) {
|
|
511
|
+
let nextDate;
|
|
512
|
+
while (true) {
|
|
513
|
+
nextDate = this.getNextDate(nextDate !== null && nextDate !== void 0 ? nextDate : startDate);
|
|
514
|
+
if (endDate && endDate.getTime() < nextDate.getTime()) return;
|
|
515
|
+
yield nextDate;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
/** Gets the previous date starting from the given start date or now. */
|
|
519
|
+
getPrevDate(startDate = /* @__PURE__ */ new Date()) {
|
|
520
|
+
const startDateElements = extractDateElements(startDate);
|
|
521
|
+
let maxYear = startDateElements.year;
|
|
522
|
+
let startIndexMonth = this.reversed.months.findIndex((x) => x <= startDateElements.month);
|
|
523
|
+
if (startIndexMonth === -1) {
|
|
524
|
+
startIndexMonth = 0;
|
|
525
|
+
maxYear--;
|
|
526
|
+
}
|
|
527
|
+
const maxIterations = this.reversed.months.length * 5;
|
|
528
|
+
for (let i = 0; i < maxIterations; i++) {
|
|
529
|
+
const year = maxYear - Math.floor((startIndexMonth + i) / this.reversed.months.length);
|
|
530
|
+
const month = this.reversed.months[(startIndexMonth + i) % this.reversed.months.length];
|
|
531
|
+
const isStartMonth = year === startDateElements.year && month === startDateElements.month;
|
|
532
|
+
let day = this.findAllowedDayInMonth("prev", year, month, isStartMonth ? startDateElements.day : getDaysInMonth(year, month));
|
|
533
|
+
let isStartDay = isStartMonth && day === startDateElements.day;
|
|
534
|
+
if (day !== void 0 && isStartDay) {
|
|
535
|
+
const prevTime = this.findAllowedTime("prev", startDateElements);
|
|
536
|
+
if (prevTime !== void 0) return new Date(year, month, day, prevTime.hour, prevTime.minute, prevTime.second);
|
|
537
|
+
if (day > 1) {
|
|
538
|
+
day = this.findAllowedDayInMonth("prev", year, month, day - 1);
|
|
539
|
+
isStartDay = false;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
if (day !== void 0 && !isStartDay) return new Date(year, month, day, this.reversed.hours[0], this.reversed.minutes[0], this.reversed.seconds[0]);
|
|
543
|
+
}
|
|
544
|
+
throw new Error("No valid previous date was found.");
|
|
545
|
+
}
|
|
546
|
+
/** Gets the specified amount of previous dates starting from the given start date or now. */
|
|
547
|
+
getPrevDates(amount, startDate) {
|
|
548
|
+
const dates = [];
|
|
549
|
+
let prevDate;
|
|
550
|
+
for (let i = 0; i < amount; i++) {
|
|
551
|
+
prevDate = this.getPrevDate(prevDate !== null && prevDate !== void 0 ? prevDate : startDate);
|
|
552
|
+
dates.push(prevDate);
|
|
553
|
+
}
|
|
554
|
+
return dates;
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Get an ES6 compatible iterator which iterates over the previous dates starting from startDate or now.
|
|
558
|
+
* The iterator runs until the optional endDate is reached or forever.
|
|
559
|
+
*/
|
|
560
|
+
*getPrevDatesIterator(startDate, endDate) {
|
|
561
|
+
let prevDate;
|
|
562
|
+
while (true) {
|
|
563
|
+
prevDate = this.getPrevDate(prevDate !== null && prevDate !== void 0 ? prevDate : startDate);
|
|
564
|
+
if (endDate && endDate.getTime() > prevDate.getTime()) return;
|
|
565
|
+
yield prevDate;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
/** Returns true when there is a cron date at the given date. */
|
|
569
|
+
matchDate(date) {
|
|
570
|
+
const { second, minute, hour, day, month, weekday } = extractDateElements(date);
|
|
571
|
+
if (this.seconds.indexOf(second) === -1 || this.minutes.indexOf(minute) === -1 || this.hours.indexOf(hour) === -1 || this.months.indexOf(month) === -1) return false;
|
|
572
|
+
if (this.days.length !== 31 && this.weekdays.length !== 7) return this.days.indexOf(day) !== -1 || this.weekdays.indexOf(weekday) !== -1;
|
|
573
|
+
return this.days.indexOf(day) !== -1 && this.weekdays.indexOf(weekday) !== -1;
|
|
574
|
+
}
|
|
575
|
+
};
|
|
576
|
+
//#endregion
|
|
577
|
+
//#region ../../node_modules/.pnpm/cron-schedule@6.0.0/node_modules/cron-schedule/dist/cron-parser.js
|
|
578
|
+
const secondConstraint = {
|
|
579
|
+
min: 0,
|
|
580
|
+
max: 59
|
|
581
|
+
};
|
|
582
|
+
const minuteConstraint = {
|
|
583
|
+
min: 0,
|
|
584
|
+
max: 59
|
|
585
|
+
};
|
|
586
|
+
const hourConstraint = {
|
|
587
|
+
min: 0,
|
|
588
|
+
max: 23
|
|
589
|
+
};
|
|
590
|
+
const dayConstraint = {
|
|
591
|
+
min: 1,
|
|
592
|
+
max: 31
|
|
593
|
+
};
|
|
594
|
+
const monthConstraint = {
|
|
595
|
+
min: 1,
|
|
596
|
+
max: 12,
|
|
597
|
+
aliases: {
|
|
598
|
+
jan: "1",
|
|
599
|
+
feb: "2",
|
|
600
|
+
mar: "3",
|
|
601
|
+
apr: "4",
|
|
602
|
+
may: "5",
|
|
603
|
+
jun: "6",
|
|
604
|
+
jul: "7",
|
|
605
|
+
aug: "8",
|
|
606
|
+
sep: "9",
|
|
607
|
+
oct: "10",
|
|
608
|
+
nov: "11",
|
|
609
|
+
dec: "12"
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
const weekdayConstraint = {
|
|
613
|
+
min: 0,
|
|
614
|
+
max: 7,
|
|
615
|
+
aliases: {
|
|
616
|
+
mon: "1",
|
|
617
|
+
tue: "2",
|
|
618
|
+
wed: "3",
|
|
619
|
+
thu: "4",
|
|
620
|
+
fri: "5",
|
|
621
|
+
sat: "6",
|
|
622
|
+
sun: "7"
|
|
623
|
+
}
|
|
624
|
+
};
|
|
625
|
+
const timeNicknames = {
|
|
626
|
+
"@yearly": "0 0 1 1 *",
|
|
627
|
+
"@annually": "0 0 1 1 *",
|
|
628
|
+
"@monthly": "0 0 1 * *",
|
|
629
|
+
"@weekly": "0 0 * * 0",
|
|
630
|
+
"@daily": "0 0 * * *",
|
|
631
|
+
"@hourly": "0 * * * *",
|
|
632
|
+
"@minutely": "* * * * *"
|
|
633
|
+
};
|
|
634
|
+
function parseElement(element, constraint) {
|
|
635
|
+
const result = /* @__PURE__ */ new Set();
|
|
636
|
+
if (element === "*") {
|
|
637
|
+
for (let i = constraint.min; i <= constraint.max; i = i + 1) result.add(i);
|
|
638
|
+
return result;
|
|
639
|
+
}
|
|
640
|
+
const listElements = element.split(",");
|
|
641
|
+
if (listElements.length > 1) {
|
|
642
|
+
for (const listElement of listElements) {
|
|
643
|
+
const parsedListElement = parseElement(listElement, constraint);
|
|
644
|
+
for (const x of parsedListElement) result.add(x);
|
|
645
|
+
}
|
|
646
|
+
return result;
|
|
647
|
+
}
|
|
648
|
+
const parseSingleElement = (singleElement) => {
|
|
649
|
+
var _a, _b;
|
|
650
|
+
singleElement = (_b = (_a = constraint.aliases) === null || _a === void 0 ? void 0 : _a[singleElement.toLowerCase()]) !== null && _b !== void 0 ? _b : singleElement;
|
|
651
|
+
const parsedElement = Number.parseInt(singleElement, 10);
|
|
652
|
+
if (Number.isNaN(parsedElement)) throw new Error(`Failed to parse ${element}: ${singleElement} is NaN.`);
|
|
653
|
+
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}.`);
|
|
654
|
+
return parsedElement;
|
|
655
|
+
};
|
|
656
|
+
const rangeSegments = /^(([0-9a-zA-Z]+)-([0-9a-zA-Z]+)|\*)(\/([0-9]+))?$/.exec(element);
|
|
657
|
+
if (rangeSegments === null) {
|
|
658
|
+
result.add(parseSingleElement(element));
|
|
659
|
+
return result;
|
|
660
|
+
}
|
|
661
|
+
let parsedStart = rangeSegments[1] === "*" ? constraint.min : parseSingleElement(rangeSegments[2]);
|
|
662
|
+
const parsedEnd = rangeSegments[1] === "*" ? constraint.max : parseSingleElement(rangeSegments[3]);
|
|
663
|
+
if (constraint === weekdayConstraint && parsedStart === 7 && parsedEnd !== 7) parsedStart = 0;
|
|
664
|
+
if (parsedStart > parsedEnd) throw new Error(`Failed to parse ${element}: Invalid range (start: ${parsedStart}, end: ${parsedEnd}).`);
|
|
665
|
+
const step = rangeSegments[5];
|
|
666
|
+
let parsedStep = 1;
|
|
667
|
+
if (step !== void 0) {
|
|
668
|
+
parsedStep = Number.parseInt(step, 10);
|
|
669
|
+
if (Number.isNaN(parsedStep)) throw new Error(`Failed to parse step: ${step} is NaN.`);
|
|
670
|
+
if (parsedStep < 1) throw new Error(`Failed to parse step: Expected ${step} to be greater than 0.`);
|
|
671
|
+
}
|
|
672
|
+
for (let i = parsedStart; i <= parsedEnd; i = i + parsedStep) result.add(i);
|
|
673
|
+
return result;
|
|
674
|
+
}
|
|
675
|
+
/** Parses a cron expression into a Cron instance. */
|
|
676
|
+
function parseCronExpression(cronExpression) {
|
|
677
|
+
var _a;
|
|
678
|
+
if (typeof cronExpression !== "string") throw new TypeError("Invalid cron expression: must be of type string.");
|
|
679
|
+
cronExpression = (_a = timeNicknames[cronExpression.toLowerCase()]) !== null && _a !== void 0 ? _a : cronExpression;
|
|
680
|
+
const elements = cronExpression.split(" ").filter((elem) => elem.length > 0);
|
|
681
|
+
if (elements.length < 5 || elements.length > 6) throw new Error("Invalid cron expression: expected 5 or 6 elements.");
|
|
682
|
+
const rawSeconds = elements.length === 6 ? elements[0] : "0";
|
|
683
|
+
const rawMinutes = elements.length === 6 ? elements[1] : elements[0];
|
|
684
|
+
const rawHours = elements.length === 6 ? elements[2] : elements[1];
|
|
685
|
+
const rawDays = elements.length === 6 ? elements[3] : elements[2];
|
|
686
|
+
const rawMonths = elements.length === 6 ? elements[4] : elements[3];
|
|
687
|
+
const rawWeekdays = elements.length === 6 ? elements[5] : elements[4];
|
|
688
|
+
return new Cron({
|
|
689
|
+
seconds: parseElement(rawSeconds, secondConstraint),
|
|
690
|
+
minutes: parseElement(rawMinutes, minuteConstraint),
|
|
691
|
+
hours: parseElement(rawHours, hourConstraint),
|
|
692
|
+
days: parseElement(rawDays, dayConstraint),
|
|
693
|
+
months: new Set(Array.from(parseElement(rawMonths, monthConstraint)).map((x) => x - 1)),
|
|
694
|
+
weekdays: new Set(Array.from(parseElement(rawWeekdays, weekdayConstraint)).map((x) => x % 7))
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
//#endregion
|
|
698
|
+
//#region ../../packages/core/dist/chunks/trigger-iJpKxlnn.mjs
|
|
699
|
+
/**
|
|
700
|
+
* shared/schedule.ts
|
|
701
|
+
*
|
|
702
|
+
* Unified schedule type that supports both simple intervals and cron expressions.
|
|
703
|
+
* Can be used in both cron and polling triggers for maximum flexibility.
|
|
704
|
+
*
|
|
705
|
+
* Template literal types provide compile-time type safety.
|
|
706
|
+
* Zod schemas with refinements provide runtime validation.
|
|
707
|
+
*/
|
|
262
708
|
const CronExpressionSchema = z.string().superRefine((val, ctx) => {
|
|
263
709
|
try {
|
|
264
710
|
parseCronExpression(val);
|
|
@@ -270,11 +716,7 @@ const CronExpressionSchema = z.string().superRefine((val, ctx) => {
|
|
|
270
716
|
});
|
|
271
717
|
}
|
|
272
718
|
});
|
|
273
|
-
const ScheduleSchema = z.union([
|
|
274
|
-
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" }),
|
|
275
|
-
DurationStringSchema,
|
|
276
|
-
CronExpressionSchema
|
|
277
|
-
]);
|
|
719
|
+
const ScheduleSchema = z.union([DurationSchema, CronExpressionSchema]);
|
|
278
720
|
const IANATimezoneSchema = z.enum([
|
|
279
721
|
"UTC",
|
|
280
722
|
"GMT",
|
|
@@ -330,70 +772,6 @@ const IANATimezoneSchema = z.enum([
|
|
|
330
772
|
"Asia/Jerusalem",
|
|
331
773
|
"Asia/Doha"
|
|
332
774
|
]);
|
|
333
|
-
//#endregion
|
|
334
|
-
//#region ../../packages/core/dist/chunks/schemas-CRXLuZkZ.mjs
|
|
335
|
-
const trimmedString = z.string().trim().min(1);
|
|
336
|
-
const payloadHashSchema = z.object({
|
|
337
|
-
from: z.literal("payload"),
|
|
338
|
-
strategy: z.literal("hash")
|
|
339
|
-
});
|
|
340
|
-
const payloadPathSchema = z.object({
|
|
341
|
-
from: z.literal("payload"),
|
|
342
|
-
path: trimmedString
|
|
343
|
-
});
|
|
344
|
-
const headerHashSchema = z.object({
|
|
345
|
-
from: z.literal("header"),
|
|
346
|
-
strategy: z.literal("hash")
|
|
347
|
-
});
|
|
348
|
-
const headerNameSchema = z.object({
|
|
349
|
-
from: z.literal("header"),
|
|
350
|
-
name: trimmedString
|
|
351
|
-
});
|
|
352
|
-
const idempotencyKeyConfigSchema = z.union([
|
|
353
|
-
payloadHashSchema,
|
|
354
|
-
payloadPathSchema,
|
|
355
|
-
headerHashSchema,
|
|
356
|
-
headerNameSchema
|
|
357
|
-
]);
|
|
358
|
-
const credentialSetInstanceSchema = createStructuralSchema([
|
|
359
|
-
"id",
|
|
360
|
-
"auth",
|
|
361
|
-
"connections"
|
|
362
|
-
], "a CredentialSet instance");
|
|
363
|
-
const TriggerModeDefaultSchema = z.enum(["managed", "subscribable"]);
|
|
364
|
-
const TriggerRuntimeDescriptorSchema = z.object({
|
|
365
|
-
/**
|
|
366
|
-
* True when this trigger bundles a `poll` export executed inside a
|
|
367
|
-
* microsandbox VM at trigger time. Polling-only — webhook/cron always
|
|
368
|
-
* leave this undefined. Replaces the legacy `callbacks: { poll, ... }`
|
|
369
|
-
* descriptor (the other callbacks are gone now that filter/idempotency/
|
|
370
|
-
* verify/transform are declarative or run in the workflow VM).
|
|
371
|
-
*/
|
|
372
|
-
poll: z.boolean().optional(),
|
|
373
|
-
filterSchema: jsonSchemaObject.optional(),
|
|
374
|
-
/** Webhook-only declarative idempotency-key resolver. */
|
|
375
|
-
idempotencyConfig: idempotencyKeyConfigSchema.optional()
|
|
376
|
-
});
|
|
377
|
-
z.object({
|
|
378
|
-
manifestVersion: z.literal(1),
|
|
379
|
-
type: z.literal("trigger"),
|
|
380
|
-
triggerType: TriggerTypeSchema,
|
|
381
|
-
id: trimmedNonEmptyString("Trigger id"),
|
|
382
|
-
description: descriptionString("Trigger description"),
|
|
383
|
-
enabled: z.boolean(),
|
|
384
|
-
modeDefault: TriggerModeDefaultSchema,
|
|
385
|
-
executionIdentityPolicy: ExecutionIdentityPolicySchema.optional(),
|
|
386
|
-
credentialSets: z.array(CredentialSetManifestSchema).optional(),
|
|
387
|
-
runtime: TriggerRuntimeDescriptorSchema
|
|
388
|
-
});
|
|
389
|
-
const triggerBaseConfigSchema = z.object({
|
|
390
|
-
credentialSets: z.array(credentialSetInstanceSchema).optional(),
|
|
391
|
-
description: descriptionString("Trigger description"),
|
|
392
|
-
enabled: z.boolean().default(true),
|
|
393
|
-
executionIdentityPolicy: ExecutionIdentityPolicySchema.optional(),
|
|
394
|
-
modeDefault: TriggerModeDefaultSchema.default("managed"),
|
|
395
|
-
id: trimmedNonEmptyString("Trigger id")
|
|
396
|
-
});
|
|
397
775
|
triggerBaseConfigSchema.extend({
|
|
398
776
|
input: anyZodSchemaSchema,
|
|
399
777
|
payload: z.custom((value) => {
|