@keystrokehq/cli 0.0.20 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{accept.handler-CiqqUxKN.mjs → accept.handler-C6KBLKmW.mjs} +1 -1
- package/dist/{admin-B0U2Aghv.mjs → admin-D2CQoZAN.mjs} +9 -9
- package/dist/{agent-bundle-package-DWV6B_5q-BsbCEeMw.mjs → agent-bundle-package-DWV6B_5q-B-qzc3zC.mjs} +1 -1
- package/dist/{agents-DBebUEwk.mjs → agents-Bn0g5o0o.mjs} +7 -7
- package/dist/{api-BjBpWWlm.mjs → api-O5tdGdzc.mjs} +30 -4
- package/dist/{api-keys-BHAgmC4E.mjs → api-keys-BixCnZJW.mjs} +5 -5
- package/dist/{auth-D-PZAjdd.mjs → auth-yCNMT8sJ.mjs} +14 -7
- package/dist/{auth.handler-CxTDSO6O.mjs → auth.handler-BedGpKh1.mjs} +7 -12
- package/dist/{build-agents-DseUtzd4-BNtZrqoY.mjs → build-agents-DseUtzd4-DFh2e5Cn.mjs} +5 -5
- package/dist/{build-metadata-BB_L45ZS-d5-QLDZ5.mjs → build-metadata-BB_L45ZS-BtGGjHIV.mjs} +7 -7
- package/dist/{build-progress-BVwDg6lC.mjs → build-progress-nYa14iBP.mjs} +1 -1
- package/dist/{build-tasks-C09SdfjC-DxKcmENc.mjs → build-tasks-C09SdfjC-B0F7BZZG.mjs} +3 -3
- package/dist/{build-workflows-BZ_m97Pr-DwcnRlyh.mjs → build-workflows-BZ_m97Pr-DKANy85L.mjs} +9 -8
- package/dist/{build.handler-CTX80S1K.mjs → build.handler-CyDc8jiZ.mjs} +5 -5
- package/dist/{chunk-DYxdGL9S.mjs → chunk-CH6r78ws.mjs} +1 -2
- package/dist/{clear-cache.handler-8RFmjHoo.mjs → clear-cache.handler-FmJPHdWG.mjs} +1 -1
- package/dist/{clear.handler-Bksm2HI4.mjs → clear.handler-Cvb9chs4.mjs} +27 -13
- package/dist/{commander-DQLrBSIW.mjs → commander-9Kro0Dl3.mjs} +4 -7
- package/dist/common-AK0q0Oz0.mjs +20 -0
- package/dist/{connect-DV_EztVs.mjs → connect-_l7Lkfxi.mjs} +26 -2
- package/dist/{connect.handler-DbuGt3Xb.mjs → connect.handler-tqk-DOv8.mjs} +39 -4
- package/dist/{context-BUzxM3QI.mjs → context-B2cQ-Nt3.mjs} +30 -4
- package/dist/{create.handler-CQCRk-Na.mjs → create.handler-v9B0Z9Yf.mjs} +1 -1
- package/dist/{credential-env-map-qLCR_QbO.mjs → credential-env-map-Dvp00a4M.mjs} +1 -1
- package/dist/credential-requirements-D0mavK8j-CFMf0Xwu.mjs +619 -0
- package/dist/{credentials-xPtLFTjW.mjs → credentials-DQW8xxof.mjs} +2 -2
- package/dist/{credentials-m18a1_hw.mjs → credentials-Dr5lD7Hm.mjs} +6 -6
- package/dist/{current-deployment-workflow-pyBoobIm.mjs → current-deployment-workflow-qMfOrRIu.mjs} +4 -4
- package/dist/{current.handler-BJGJgdGP.mjs → current.handler-Cm_-JLyZ.mjs} +1 -1
- package/dist/declared-credential-requirements-B6h4WRv4.mjs +103 -0
- package/dist/{delete.handler-DNoehdOH.mjs → delete.handler-DtP_zUaq.mjs} +1 -1
- package/dist/{deploy-BKjcO_sm.mjs → deploy-BURTx92e.mjs} +1 -1
- package/dist/{deploy-3tHCBGky.mjs → deploy-CB6pfCuB.mjs} +2 -2
- package/dist/{deploy-progress-CyolzjRB.mjs → deploy-progress-Dlp9aBDW.mjs} +1 -1
- package/dist/{deploy.handler-TnPNBYXZ.mjs → deploy.handler-Bg0dpSTj.mjs} +16 -16
- package/dist/{detect-env-access-CwkOYeYM-D8-hxij0.mjs → detect-env-access-CwkOYeYM-D4aTZv4R.mjs} +2 -2
- package/dist/{diff.handler-DO2WzdGB.mjs → diff.handler-CJPrszL1.mjs} +4 -4
- package/dist/{dist-BGrWr5fp.mjs → dist-Br4m3sFZ.mjs} +14 -12
- package/dist/{dist-CIInPRGh.mjs → dist-DuJjDZIf.mjs} +25 -2
- package/dist/{env.handler-C5GNyiJt.mjs → env.handler-6TrLd3fo.mjs} +7 -7
- package/dist/{error-boundary-GtRvP2oP.mjs → error-boundary-DVZipk-A.mjs} +1 -1
- package/dist/{file-metadata-B8c7Y5yg.mjs → file-metadata-DQVDjr7M.mjs} +1 -1
- package/dist/{import-module-y0glInUe-CfNsQNia.mjs → import-module-y0glInUe-DxX0-BRO.mjs} +274 -28
- package/dist/{init-D9RIT2CY.mjs → init-DBMtY3eO.mjs} +3 -3
- package/dist/{init.handler-0TJY1YNy.mjs → init.handler-BoYbE-6H.mjs} +3 -3
- package/dist/{inspect.handler-BrYFfN4H.mjs → inspect.handler-Juu2vGbB.mjs} +4 -4
- package/dist/{integration-catalog-BrJsBkfx.mjs → integration-catalog-cYlTmOSb.mjs} +1 -1
- package/dist/{integrations-vSyAQ6HA.mjs → integrations-Cdq7iSLj.mjs} +5 -5
- package/dist/{invites-BASM4PJr.mjs → invites-DHyHZOY_.mjs} +4 -4
- package/dist/{invites.list.handler-c-aw6g5o.mjs → invites.list.handler-C-QpsG2J.mjs} +1 -1
- package/dist/{invites.resend.handler-MnMEjP_Z.mjs → invites.resend.handler-KFKbSPzR.mjs} +1 -1
- package/dist/{invites.revoke.handler-CHX6Z8kj.mjs → invites.revoke.handler-Cuz7jrGC.mjs} +1 -1
- package/dist/keystroke.mjs +21 -21
- package/dist/{list-enrichment-DcplcioC.mjs → list-enrichment-CCRHYslm.mjs} +1 -1
- package/dist/{list.handler-DJNtXw7C.mjs → list.handler-6x3GVumu.mjs} +1 -1
- package/dist/{list2.handler-BdE1k2kl.mjs → list.handler-BWsl4iYw.mjs} +4 -4
- package/dist/{list.handler-BsgCd1oF.mjs → list.handler-CLGQDuo5.mjs} +5 -5
- package/dist/{list.handler-CynN-ezD.mjs → list.handler-Cc-V1TNz.mjs} +1 -1
- package/dist/{list.handler-DXwKdfIv.mjs → list.handler-DRe38pAj.mjs} +2 -2
- package/dist/{list.handler-CDtjm-6d.mjs → list.handler-Do2tVOnu.mjs} +1 -1
- package/dist/{list.handler-BBzB1_1l.mjs → list.handler-RtHhrTZ3.mjs} +1 -1
- package/dist/{listen-Ca9KdiB2.mjs → listen-DZdSevsB.mjs} +2 -2
- package/dist/{listen.handler-KWPN03S8.mjs → listen.handler-BccHe1jh.mjs} +2 -2
- package/dist/{logs-BEDf7hZ0.mjs → logs-Bh_PBnu6.mjs} +3 -3
- package/dist/{logs.handler-mk1lcZbU.mjs → logs.handler-DItDS1zw.mjs} +2 -2
- package/dist/{members.add.handler-CTvlxBZU.mjs → members.add.handler-D3nQ_Ln6.mjs} +1 -1
- package/dist/{members.invite.handler-wFO0r7Pi.mjs → members.invite.handler-rKhg5n_C.mjs} +1 -1
- package/dist/{members.list.handler-PPdqs4nI.mjs → members.list.handler-C9Yh469k.mjs} +1 -1
- package/dist/{members.remove.handler-a5WI6zE4.mjs → members.remove.handler-Dnrck-E6.mjs} +1 -1
- package/dist/{members.update.handler-3xblTzmz.mjs → members.update.handler-qo5r6arJ.mjs} +1 -1
- package/dist/{metadata-layout-Bv-B0nHj-DtMWZ7Cc.mjs → metadata-layout-Bv-B0nHj-CO8mjjSl.mjs} +1 -1
- package/dist/{normalize-path-CojS-CgQ-CRqBc6D6.mjs → normalize-path-CojS-CgQ-aOM0agxS.mjs} +1 -1
- package/dist/{org-CzLw3neZ.mjs → org-DnES84sS.mjs} +15 -15
- package/dist/{orgs.create.handler-CcPpDweZ.mjs → orgs.create.handler-DF4eEL-2.mjs} +1 -1
- package/dist/{orgs.get.handler-BACPg7vR.mjs → orgs.get.handler-BmJnseQa.mjs} +1 -1
- package/dist/{orgs.list.handler-DEF8OyvM.mjs → orgs.list.handler-DDVvSbsT.mjs} +1 -1
- package/dist/{paused.handler-D4j8_Za4.mjs → paused.handler-BLUchSMD.mjs} +1 -1
- package/dist/{projects-CJCKxG2u.mjs → projects-Cv14bBGy.mjs} +4 -4
- package/dist/{projects-s5ehKLil.mjs → projects-ZNcKwds2.mjs} +2 -2
- package/dist/{requirements.handler-Bk-sAE9C.mjs → requirements.handler-BKFocUof.mjs} +5 -5
- package/dist/{resolve-cli-credentials-DytxgMwn.mjs → resolve-cli-credentials-DaMDaamj.mjs} +1 -1
- package/dist/{resolve-project-CWP2fji3.mjs → resolve-project-Cj3MFnU0.mjs} +1 -1
- package/dist/{run-polling-DKclfet-.mjs → run-polling-3XOGl4hh.mjs} +3 -3
- package/dist/{run.handler-x0B-CjNF.mjs → run.handler-DZuUx0fi.mjs} +5 -5
- package/dist/{runs-DoMVOCNj.mjs → runs-BOo3j297.mjs} +2 -2
- package/dist/schemas-D2zfmyC-.mjs +671 -0
- package/dist/{skills-sync.handler-CYkCeuQn.mjs → skills-sync.handler-09mDbx5q.mjs} +1 -1
- package/dist/{skills.command-DeAgMGGw.mjs → skills.command-B-MhRN3J.mjs} +4 -4
- package/dist/{source-analysis-BBg2E_6G-BJTRqWrQ.mjs → source-analysis-BBg2E_6G-wPP9mjQx.mjs} +3 -3
- package/dist/{source-analysis-BMMPIHN9.mjs → source-analysis-z2RSZw6X.mjs} +1 -1
- package/dist/{src-BYQwp8Ig.mjs → src-DNhUmpSl.mjs} +1 -1
- package/dist/{switch.handler-CV4ZBXAu.mjs → switch.handler-BFGvj5c6.mjs} +2 -2
- package/dist/{sync-KCVM02IY.mjs → sync-CZ3iUPTA.mjs} +2 -2
- package/dist/{sync.handler-Cuw89341.mjs → sync.handler-B1L8I9lF.mjs} +7 -7
- package/dist/{task-BSCN9cU4.mjs → task-BWuIKWh4.mjs} +2 -392
- package/dist/{task-target-build-B0HF2_At.mjs → task-target-build-CTgl4L42.mjs} +5 -5
- package/dist/{task-target-deploy-ClbwKJ8K.mjs → task-target-deploy-DeUyfi9H.mjs} +1 -1
- package/dist/{task-target-deploy-dQYnMO8n-CeTmRcDw.mjs → task-target-deploy-dQYnMO8n-d2vdeqXH.mjs} +1 -1
- package/dist/task-target-deploy-runner.mjs +6 -6
- package/dist/{test-Rm3thni3.mjs → test-Byq4hG3C.mjs} +2 -2
- package/dist/{test.handler-CTd-heRS.mjs → test.handler-BsrMMj5O.mjs} +9 -9
- package/dist/{test.handler-DhhcsvHN.mjs → test.handler-CAsVgOpT.mjs} +1 -1
- package/dist/{tool.handler-C3LNyQbc.mjs → tool.handler-BHS5Z4J_.mjs} +63 -9
- package/dist/{trigger-artifacts-BcRScRSp-DqFgzl_B.mjs → trigger-artifacts-BcRScRSp-C-JBJ6y8.mjs} +4 -4
- package/dist/{trigger-manifest-DTni4NaZ.mjs → trigger-manifest-C07EM-b2.mjs} +6 -5
- package/dist/{upgrade-Cf7y38xR.mjs → upgrade-bZVjVXnu.mjs} +2 -2
- package/dist/{upload-CJWApEgz.mjs → upload-CE4H5R1h.mjs} +1 -1
- package/dist/{upload.handler-BHIWYPph.mjs → upload.handler-DXVx2u3A.mjs} +7 -7
- package/dist/{users.get.handler-spWaHG8h.mjs → users.get.handler-DqD2ELK2.mjs} +1 -1
- package/dist/{users.list.handler-DLuU7cd_.mjs → users.list.handler-DZSPvpGF.mjs} +1 -1
- package/dist/{users.set-role.handler-CojFmpcD.mjs → users.set-role.handler-73smNUVF.mjs} +1 -1
- package/dist/{utils-Ddltm1sR.mjs → utils-BaxDlCsW.mjs} +1 -1
- package/dist/{validate.handler-DIJBuX1P.mjs → validate.handler-CmfcMX0t.mjs} +4 -4
- package/dist/{workflow-build-IGYhEC8Y.mjs → workflow-build-Bi1Aacc5.mjs} +20 -20
- package/dist/workflow-build-manifest-1sC52TIG.mjs +259 -0
- package/dist/{workflow-bundler-BzHk73PM-Cs-4Ml-p.mjs → workflow-bundler-BzHk73PM-xQwAF08W.mjs} +2 -2
- package/dist/{workflows-MANdvLft.mjs → workflows-C_C13Zr0.mjs} +16 -14
- package/dist/{writer-byNNUjRm-w5O7-VT_.mjs → writer-byNNUjRm-B-on1n6c.mjs} +6 -6
- package/package.json +6 -6
- package/dist/schemas-U2OzP9gP.mjs +0 -281
- package/dist/src-BHTjsZ9V.mjs +0 -456
- /package/dist/{agent-manifest-CZ7BeUSG.mjs → agent-manifest-Pg0aURo7.mjs} +0 -0
- /package/dist/{browser-Cu4k-wT_.mjs → browser-Dvv5OQrt.mjs} +0 -0
- /package/dist/{clear.handler-mfNmIUYP.mjs → clear.handler-BdR56Cok.mjs} +0 -0
- /package/dist/{concurrency-gXn9Rw8x-BSBbRfVp.mjs → concurrency-gXn9Rw8x-CnBnF2cg.mjs} +0 -0
- /package/dist/{credential-schema-mismatch-BHI_B-U-.mjs → credential-schema-mismatch-kfGeiSB1.mjs} +0 -0
- /package/dist/{diff-utils-x5pi8SrL.mjs → diff-utils-CXKNQUXO.mjs} +0 -0
- /package/dist/{layout-DRf9qUf8.mjs → layout-B95Tku8F.mjs} +0 -0
- /package/dist/{logs.handler-CcA1UzJm.mjs → logs.handler-Bs1DVMaO.mjs} +0 -0
- /package/dist/{oxc-B3KI3rf_-Cnk0L10M.mjs → oxc-B3KI3rf_-B9omBIuN.mjs} +0 -0
- /package/dist/{read-credential-keys-77a91T8M-CzXPGxdU.mjs → read-credential-keys-77a91T8M-aLuQvlIq.mjs} +0 -0
- /package/dist/{register.handler-CSvlOMF6.mjs → register.handler-C_NqMLir.mjs} +0 -0
- /package/dist/{rolldown-runtime-twds-ZHy-BoF7MLzP.mjs → rolldown-runtime-twds-ZHy-RuJszab7.mjs} +0 -0
- /package/dist/{run-polling-CzyVv7Ba.mjs → run-polling-DKWPGLyF.mjs} +0 -0
- /package/dist/{schema-CvSZqa3t.mjs → schema-DFJiNWyd.mjs} +0 -0
- /package/dist/{schema-display-DxLA3j5H.mjs → schema-display-XrRCdFL0.mjs} +0 -0
- /package/dist/{skill-installer-CYFshTBy.mjs → skill-installer-Cm9hF6OB.mjs} +0 -0
- /package/dist/{skills.handler-Bma-MJX-.mjs → skills.handler-KEUkV5NH.mjs} +0 -0
- /package/dist/{spinner-progress-DV28G4tP.mjs → spinner-progress-BtEIJRX4.mjs} +0 -0
- /package/dist/{status.handler-BOV0eX3J.mjs → status.handler-CW-EFhy3.mjs} +0 -0
- /package/dist/{types-DamInJD6.mjs → types-D1cVpE7_.mjs} +0 -0
- /package/dist/{upgrade.handler-Bz_oQcAw.mjs → upgrade.handler-C7KvNL0x.mjs} +0 -0
|
@@ -0,0 +1,671 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region ../../node_modules/.pnpm/cron-schedule@6.0.0/node_modules/cron-schedule/dist/utils.js
|
|
5
|
+
function extractDateElements(date) {
|
|
6
|
+
return {
|
|
7
|
+
second: date.getSeconds(),
|
|
8
|
+
minute: date.getMinutes(),
|
|
9
|
+
hour: date.getHours(),
|
|
10
|
+
day: date.getDate(),
|
|
11
|
+
month: date.getMonth(),
|
|
12
|
+
weekday: date.getDay(),
|
|
13
|
+
year: date.getFullYear()
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function getDaysInMonth(year, month) {
|
|
17
|
+
return new Date(year, month + 1, 0).getDate();
|
|
18
|
+
}
|
|
19
|
+
function getDaysBetweenWeekdays(weekday1, weekday2) {
|
|
20
|
+
if (weekday1 <= weekday2) return weekday2 - weekday1;
|
|
21
|
+
return 6 - weekday1 + weekday2 + 1;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region ../../node_modules/.pnpm/cron-schedule@6.0.0/node_modules/cron-schedule/dist/cron.js
|
|
25
|
+
var Cron = class {
|
|
26
|
+
constructor({ seconds, minutes, hours, days, months, weekdays }) {
|
|
27
|
+
if (!seconds || seconds.size === 0) throw new Error("There must be at least one allowed second.");
|
|
28
|
+
if (!minutes || minutes.size === 0) throw new Error("There must be at least one allowed minute.");
|
|
29
|
+
if (!hours || hours.size === 0) throw new Error("There must be at least one allowed hour.");
|
|
30
|
+
if (!months || months.size === 0) throw new Error("There must be at least one allowed month.");
|
|
31
|
+
if ((!weekdays || weekdays.size === 0) && (!days || days.size === 0)) throw new Error("There must be at least one allowed day or weekday.");
|
|
32
|
+
this.seconds = Array.from(seconds).sort((a, b) => a - b);
|
|
33
|
+
this.minutes = Array.from(minutes).sort((a, b) => a - b);
|
|
34
|
+
this.hours = Array.from(hours).sort((a, b) => a - b);
|
|
35
|
+
this.days = Array.from(days).sort((a, b) => a - b);
|
|
36
|
+
this.months = Array.from(months).sort((a, b) => a - b);
|
|
37
|
+
this.weekdays = Array.from(weekdays).sort((a, b) => a - b);
|
|
38
|
+
const validateData = (name, data, constraint) => {
|
|
39
|
+
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}`);
|
|
40
|
+
};
|
|
41
|
+
validateData("seconds", this.seconds, {
|
|
42
|
+
min: 0,
|
|
43
|
+
max: 59
|
|
44
|
+
});
|
|
45
|
+
validateData("minutes", this.minutes, {
|
|
46
|
+
min: 0,
|
|
47
|
+
max: 59
|
|
48
|
+
});
|
|
49
|
+
validateData("hours", this.hours, {
|
|
50
|
+
min: 0,
|
|
51
|
+
max: 23
|
|
52
|
+
});
|
|
53
|
+
validateData("days", this.days, {
|
|
54
|
+
min: 1,
|
|
55
|
+
max: 31
|
|
56
|
+
});
|
|
57
|
+
validateData("months", this.months, {
|
|
58
|
+
min: 0,
|
|
59
|
+
max: 11
|
|
60
|
+
});
|
|
61
|
+
validateData("weekdays", this.weekdays, {
|
|
62
|
+
min: 0,
|
|
63
|
+
max: 6
|
|
64
|
+
});
|
|
65
|
+
this.reversed = {
|
|
66
|
+
seconds: this.seconds.map((x) => x).reverse(),
|
|
67
|
+
minutes: this.minutes.map((x) => x).reverse(),
|
|
68
|
+
hours: this.hours.map((x) => x).reverse(),
|
|
69
|
+
days: this.days.map((x) => x).reverse(),
|
|
70
|
+
months: this.months.map((x) => x).reverse(),
|
|
71
|
+
weekdays: this.weekdays.map((x) => x).reverse()
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Find the next or previous hour, starting from the given start hour that matches the hour constraint.
|
|
76
|
+
* startHour itself might also be allowed.
|
|
77
|
+
*/
|
|
78
|
+
findAllowedHour(dir, startHour) {
|
|
79
|
+
return dir === "next" ? this.hours.find((x) => x >= startHour) : this.reversed.hours.find((x) => x <= startHour);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Find the next or previous minute, starting from the given start minute that matches the minute constraint.
|
|
83
|
+
* startMinute itself might also be allowed.
|
|
84
|
+
*/
|
|
85
|
+
findAllowedMinute(dir, startMinute) {
|
|
86
|
+
return dir === "next" ? this.minutes.find((x) => x >= startMinute) : this.reversed.minutes.find((x) => x <= startMinute);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Find the next or previous second, starting from the given start second that matches the second constraint.
|
|
90
|
+
* startSecond itself IS NOT allowed.
|
|
91
|
+
*/
|
|
92
|
+
findAllowedSecond(dir, startSecond) {
|
|
93
|
+
return dir === "next" ? this.seconds.find((x) => x > startSecond) : this.reversed.seconds.find((x) => x < startSecond);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Find the next or previous time, starting from the given start time that matches the hour, minute
|
|
97
|
+
* and second constraints. startTime itself might also be allowed.
|
|
98
|
+
*/
|
|
99
|
+
findAllowedTime(dir, startTime) {
|
|
100
|
+
let hour = this.findAllowedHour(dir, startTime.hour);
|
|
101
|
+
if (hour !== void 0) if (hour === startTime.hour) {
|
|
102
|
+
let minute = this.findAllowedMinute(dir, startTime.minute);
|
|
103
|
+
if (minute !== void 0) if (minute === startTime.minute) {
|
|
104
|
+
const second = this.findAllowedSecond(dir, startTime.second);
|
|
105
|
+
if (second !== void 0) return {
|
|
106
|
+
hour,
|
|
107
|
+
minute,
|
|
108
|
+
second
|
|
109
|
+
};
|
|
110
|
+
minute = this.findAllowedMinute(dir, dir === "next" ? startTime.minute + 1 : startTime.minute - 1);
|
|
111
|
+
if (minute !== void 0) return {
|
|
112
|
+
hour,
|
|
113
|
+
minute,
|
|
114
|
+
second: dir === "next" ? this.seconds[0] : this.reversed.seconds[0]
|
|
115
|
+
};
|
|
116
|
+
} else return {
|
|
117
|
+
hour,
|
|
118
|
+
minute,
|
|
119
|
+
second: dir === "next" ? this.seconds[0] : this.reversed.seconds[0]
|
|
120
|
+
};
|
|
121
|
+
hour = this.findAllowedHour(dir, dir === "next" ? startTime.hour + 1 : startTime.hour - 1);
|
|
122
|
+
if (hour !== void 0) return {
|
|
123
|
+
hour,
|
|
124
|
+
minute: dir === "next" ? this.minutes[0] : this.reversed.minutes[0],
|
|
125
|
+
second: dir === "next" ? this.seconds[0] : this.reversed.seconds[0]
|
|
126
|
+
};
|
|
127
|
+
} else return {
|
|
128
|
+
hour,
|
|
129
|
+
minute: dir === "next" ? this.minutes[0] : this.reversed.minutes[0],
|
|
130
|
+
second: dir === "next" ? this.seconds[0] : this.reversed.seconds[0]
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Find the next or previous day in the given month, starting from the given startDay
|
|
135
|
+
* that matches either the day or the weekday constraint. startDay itself might also be allowed.
|
|
136
|
+
*/
|
|
137
|
+
findAllowedDayInMonth(dir, year, month, startDay) {
|
|
138
|
+
var _a, _b;
|
|
139
|
+
if (startDay < 1) throw new Error("startDay must not be smaller than 1.");
|
|
140
|
+
const daysInMonth = getDaysInMonth(year, month);
|
|
141
|
+
const daysRestricted = this.days.length !== 31;
|
|
142
|
+
const weekdaysRestricted = this.weekdays.length !== 7;
|
|
143
|
+
if (!daysRestricted && !weekdaysRestricted) {
|
|
144
|
+
if (startDay > daysInMonth) return dir === "next" ? void 0 : daysInMonth;
|
|
145
|
+
return startDay;
|
|
146
|
+
}
|
|
147
|
+
let allowedDayByDays;
|
|
148
|
+
if (daysRestricted) {
|
|
149
|
+
allowedDayByDays = dir === "next" ? this.days.find((x) => x >= startDay) : this.reversed.days.find((x) => x <= startDay);
|
|
150
|
+
if (allowedDayByDays !== void 0 && allowedDayByDays > daysInMonth) allowedDayByDays = void 0;
|
|
151
|
+
}
|
|
152
|
+
let allowedDayByWeekdays;
|
|
153
|
+
if (weekdaysRestricted) {
|
|
154
|
+
const startWeekday = new Date(year, month, startDay).getDay();
|
|
155
|
+
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];
|
|
156
|
+
if (nearestAllowedWeekday !== void 0) {
|
|
157
|
+
const daysBetweenWeekdays = dir === "next" ? getDaysBetweenWeekdays(startWeekday, nearestAllowedWeekday) : getDaysBetweenWeekdays(nearestAllowedWeekday, startWeekday);
|
|
158
|
+
allowedDayByWeekdays = dir === "next" ? startDay + daysBetweenWeekdays : startDay - daysBetweenWeekdays;
|
|
159
|
+
if (allowedDayByWeekdays > daysInMonth || allowedDayByWeekdays < 1) allowedDayByWeekdays = void 0;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (allowedDayByDays !== void 0 && allowedDayByWeekdays !== void 0) return dir === "next" ? Math.min(allowedDayByDays, allowedDayByWeekdays) : Math.max(allowedDayByDays, allowedDayByWeekdays);
|
|
163
|
+
if (allowedDayByDays !== void 0) return allowedDayByDays;
|
|
164
|
+
if (allowedDayByWeekdays !== void 0) return allowedDayByWeekdays;
|
|
165
|
+
}
|
|
166
|
+
/** Gets the next date starting from the given start date or now. */
|
|
167
|
+
getNextDate(startDate = /* @__PURE__ */ new Date()) {
|
|
168
|
+
const startDateElements = extractDateElements(startDate);
|
|
169
|
+
let minYear = startDateElements.year;
|
|
170
|
+
let startIndexMonth = this.months.findIndex((x) => x >= startDateElements.month);
|
|
171
|
+
if (startIndexMonth === -1) {
|
|
172
|
+
startIndexMonth = 0;
|
|
173
|
+
minYear++;
|
|
174
|
+
}
|
|
175
|
+
const maxIterations = this.months.length * 5;
|
|
176
|
+
for (let i = 0; i < maxIterations; i++) {
|
|
177
|
+
const year = minYear + Math.floor((startIndexMonth + i) / this.months.length);
|
|
178
|
+
const month = this.months[(startIndexMonth + i) % this.months.length];
|
|
179
|
+
const isStartMonth = year === startDateElements.year && month === startDateElements.month;
|
|
180
|
+
let day = this.findAllowedDayInMonth("next", year, month, isStartMonth ? startDateElements.day : 1);
|
|
181
|
+
let isStartDay = isStartMonth && day === startDateElements.day;
|
|
182
|
+
if (day !== void 0 && isStartDay) {
|
|
183
|
+
const nextTime = this.findAllowedTime("next", startDateElements);
|
|
184
|
+
if (nextTime !== void 0) return new Date(year, month, day, nextTime.hour, nextTime.minute, nextTime.second);
|
|
185
|
+
day = this.findAllowedDayInMonth("next", year, month, day + 1);
|
|
186
|
+
isStartDay = false;
|
|
187
|
+
}
|
|
188
|
+
if (day !== void 0 && !isStartDay) return new Date(year, month, day, this.hours[0], this.minutes[0], this.seconds[0]);
|
|
189
|
+
}
|
|
190
|
+
throw new Error("No valid next date was found.");
|
|
191
|
+
}
|
|
192
|
+
/** Gets the specified amount of future dates starting from the given start date or now. */
|
|
193
|
+
getNextDates(amount, startDate) {
|
|
194
|
+
const dates = [];
|
|
195
|
+
let nextDate;
|
|
196
|
+
for (let i = 0; i < amount; i++) {
|
|
197
|
+
nextDate = this.getNextDate(nextDate !== null && nextDate !== void 0 ? nextDate : startDate);
|
|
198
|
+
dates.push(nextDate);
|
|
199
|
+
}
|
|
200
|
+
return dates;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Get an ES6 compatible iterator which iterates over the next dates starting from startDate or now.
|
|
204
|
+
* The iterator runs until the optional endDate is reached or forever.
|
|
205
|
+
*/
|
|
206
|
+
*getNextDatesIterator(startDate, endDate) {
|
|
207
|
+
let nextDate;
|
|
208
|
+
while (true) {
|
|
209
|
+
nextDate = this.getNextDate(nextDate !== null && nextDate !== void 0 ? nextDate : startDate);
|
|
210
|
+
if (endDate && endDate.getTime() < nextDate.getTime()) return;
|
|
211
|
+
yield nextDate;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
/** Gets the previous date starting from the given start date or now. */
|
|
215
|
+
getPrevDate(startDate = /* @__PURE__ */ new Date()) {
|
|
216
|
+
const startDateElements = extractDateElements(startDate);
|
|
217
|
+
let maxYear = startDateElements.year;
|
|
218
|
+
let startIndexMonth = this.reversed.months.findIndex((x) => x <= startDateElements.month);
|
|
219
|
+
if (startIndexMonth === -1) {
|
|
220
|
+
startIndexMonth = 0;
|
|
221
|
+
maxYear--;
|
|
222
|
+
}
|
|
223
|
+
const maxIterations = this.reversed.months.length * 5;
|
|
224
|
+
for (let i = 0; i < maxIterations; i++) {
|
|
225
|
+
const year = maxYear - Math.floor((startIndexMonth + i) / this.reversed.months.length);
|
|
226
|
+
const month = this.reversed.months[(startIndexMonth + i) % this.reversed.months.length];
|
|
227
|
+
const isStartMonth = year === startDateElements.year && month === startDateElements.month;
|
|
228
|
+
let day = this.findAllowedDayInMonth("prev", year, month, isStartMonth ? startDateElements.day : getDaysInMonth(year, month));
|
|
229
|
+
let isStartDay = isStartMonth && day === startDateElements.day;
|
|
230
|
+
if (day !== void 0 && isStartDay) {
|
|
231
|
+
const prevTime = this.findAllowedTime("prev", startDateElements);
|
|
232
|
+
if (prevTime !== void 0) return new Date(year, month, day, prevTime.hour, prevTime.minute, prevTime.second);
|
|
233
|
+
if (day > 1) {
|
|
234
|
+
day = this.findAllowedDayInMonth("prev", year, month, day - 1);
|
|
235
|
+
isStartDay = false;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
if (day !== void 0 && !isStartDay) return new Date(year, month, day, this.reversed.hours[0], this.reversed.minutes[0], this.reversed.seconds[0]);
|
|
239
|
+
}
|
|
240
|
+
throw new Error("No valid previous date was found.");
|
|
241
|
+
}
|
|
242
|
+
/** Gets the specified amount of previous dates starting from the given start date or now. */
|
|
243
|
+
getPrevDates(amount, startDate) {
|
|
244
|
+
const dates = [];
|
|
245
|
+
let prevDate;
|
|
246
|
+
for (let i = 0; i < amount; i++) {
|
|
247
|
+
prevDate = this.getPrevDate(prevDate !== null && prevDate !== void 0 ? prevDate : startDate);
|
|
248
|
+
dates.push(prevDate);
|
|
249
|
+
}
|
|
250
|
+
return dates;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Get an ES6 compatible iterator which iterates over the previous dates starting from startDate or now.
|
|
254
|
+
* The iterator runs until the optional endDate is reached or forever.
|
|
255
|
+
*/
|
|
256
|
+
*getPrevDatesIterator(startDate, endDate) {
|
|
257
|
+
let prevDate;
|
|
258
|
+
while (true) {
|
|
259
|
+
prevDate = this.getPrevDate(prevDate !== null && prevDate !== void 0 ? prevDate : startDate);
|
|
260
|
+
if (endDate && endDate.getTime() > prevDate.getTime()) return;
|
|
261
|
+
yield prevDate;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
/** Returns true when there is a cron date at the given date. */
|
|
265
|
+
matchDate(date) {
|
|
266
|
+
const { second, minute, hour, day, month, weekday } = extractDateElements(date);
|
|
267
|
+
if (this.seconds.indexOf(second) === -1 || this.minutes.indexOf(minute) === -1 || this.hours.indexOf(hour) === -1 || this.months.indexOf(month) === -1) return false;
|
|
268
|
+
if (this.days.length !== 31 && this.weekdays.length !== 7) return this.days.indexOf(day) !== -1 || this.weekdays.indexOf(weekday) !== -1;
|
|
269
|
+
return this.days.indexOf(day) !== -1 && this.weekdays.indexOf(weekday) !== -1;
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
//#endregion
|
|
273
|
+
//#region ../../node_modules/.pnpm/cron-schedule@6.0.0/node_modules/cron-schedule/dist/cron-parser.js
|
|
274
|
+
const secondConstraint = {
|
|
275
|
+
min: 0,
|
|
276
|
+
max: 59
|
|
277
|
+
};
|
|
278
|
+
const minuteConstraint = {
|
|
279
|
+
min: 0,
|
|
280
|
+
max: 59
|
|
281
|
+
};
|
|
282
|
+
const hourConstraint = {
|
|
283
|
+
min: 0,
|
|
284
|
+
max: 23
|
|
285
|
+
};
|
|
286
|
+
const dayConstraint = {
|
|
287
|
+
min: 1,
|
|
288
|
+
max: 31
|
|
289
|
+
};
|
|
290
|
+
const monthConstraint = {
|
|
291
|
+
min: 1,
|
|
292
|
+
max: 12,
|
|
293
|
+
aliases: {
|
|
294
|
+
jan: "1",
|
|
295
|
+
feb: "2",
|
|
296
|
+
mar: "3",
|
|
297
|
+
apr: "4",
|
|
298
|
+
may: "5",
|
|
299
|
+
jun: "6",
|
|
300
|
+
jul: "7",
|
|
301
|
+
aug: "8",
|
|
302
|
+
sep: "9",
|
|
303
|
+
oct: "10",
|
|
304
|
+
nov: "11",
|
|
305
|
+
dec: "12"
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
const weekdayConstraint = {
|
|
309
|
+
min: 0,
|
|
310
|
+
max: 7,
|
|
311
|
+
aliases: {
|
|
312
|
+
mon: "1",
|
|
313
|
+
tue: "2",
|
|
314
|
+
wed: "3",
|
|
315
|
+
thu: "4",
|
|
316
|
+
fri: "5",
|
|
317
|
+
sat: "6",
|
|
318
|
+
sun: "7"
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
const timeNicknames = {
|
|
322
|
+
"@yearly": "0 0 1 1 *",
|
|
323
|
+
"@annually": "0 0 1 1 *",
|
|
324
|
+
"@monthly": "0 0 1 * *",
|
|
325
|
+
"@weekly": "0 0 * * 0",
|
|
326
|
+
"@daily": "0 0 * * *",
|
|
327
|
+
"@hourly": "0 * * * *",
|
|
328
|
+
"@minutely": "* * * * *"
|
|
329
|
+
};
|
|
330
|
+
function parseElement(element, constraint) {
|
|
331
|
+
const result = /* @__PURE__ */ new Set();
|
|
332
|
+
if (element === "*") {
|
|
333
|
+
for (let i = constraint.min; i <= constraint.max; i = i + 1) result.add(i);
|
|
334
|
+
return result;
|
|
335
|
+
}
|
|
336
|
+
const listElements = element.split(",");
|
|
337
|
+
if (listElements.length > 1) {
|
|
338
|
+
for (const listElement of listElements) {
|
|
339
|
+
const parsedListElement = parseElement(listElement, constraint);
|
|
340
|
+
for (const x of parsedListElement) result.add(x);
|
|
341
|
+
}
|
|
342
|
+
return result;
|
|
343
|
+
}
|
|
344
|
+
const parseSingleElement = (singleElement) => {
|
|
345
|
+
var _a, _b;
|
|
346
|
+
singleElement = (_b = (_a = constraint.aliases) === null || _a === void 0 ? void 0 : _a[singleElement.toLowerCase()]) !== null && _b !== void 0 ? _b : singleElement;
|
|
347
|
+
const parsedElement = Number.parseInt(singleElement, 10);
|
|
348
|
+
if (Number.isNaN(parsedElement)) throw new Error(`Failed to parse ${element}: ${singleElement} is NaN.`);
|
|
349
|
+
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}.`);
|
|
350
|
+
return parsedElement;
|
|
351
|
+
};
|
|
352
|
+
const rangeSegments = /^(([0-9a-zA-Z]+)-([0-9a-zA-Z]+)|\*)(\/([0-9]+))?$/.exec(element);
|
|
353
|
+
if (rangeSegments === null) {
|
|
354
|
+
result.add(parseSingleElement(element));
|
|
355
|
+
return result;
|
|
356
|
+
}
|
|
357
|
+
let parsedStart = rangeSegments[1] === "*" ? constraint.min : parseSingleElement(rangeSegments[2]);
|
|
358
|
+
const parsedEnd = rangeSegments[1] === "*" ? constraint.max : parseSingleElement(rangeSegments[3]);
|
|
359
|
+
if (constraint === weekdayConstraint && parsedStart === 7 && parsedEnd !== 7) parsedStart = 0;
|
|
360
|
+
if (parsedStart > parsedEnd) throw new Error(`Failed to parse ${element}: Invalid range (start: ${parsedStart}, end: ${parsedEnd}).`);
|
|
361
|
+
const step = rangeSegments[5];
|
|
362
|
+
let parsedStep = 1;
|
|
363
|
+
if (step !== void 0) {
|
|
364
|
+
parsedStep = Number.parseInt(step, 10);
|
|
365
|
+
if (Number.isNaN(parsedStep)) throw new Error(`Failed to parse step: ${step} is NaN.`);
|
|
366
|
+
if (parsedStep < 1) throw new Error(`Failed to parse step: Expected ${step} to be greater than 0.`);
|
|
367
|
+
}
|
|
368
|
+
for (let i = parsedStart; i <= parsedEnd; i = i + parsedStep) result.add(i);
|
|
369
|
+
return result;
|
|
370
|
+
}
|
|
371
|
+
/** Parses a cron expression into a Cron instance. */
|
|
372
|
+
function parseCronExpression(cronExpression) {
|
|
373
|
+
var _a;
|
|
374
|
+
if (typeof cronExpression !== "string") throw new TypeError("Invalid cron expression: must be of type string.");
|
|
375
|
+
cronExpression = (_a = timeNicknames[cronExpression.toLowerCase()]) !== null && _a !== void 0 ? _a : cronExpression;
|
|
376
|
+
const elements = cronExpression.split(" ").filter((elem) => elem.length > 0);
|
|
377
|
+
if (elements.length < 5 || elements.length > 6) throw new Error("Invalid cron expression: expected 5 or 6 elements.");
|
|
378
|
+
const rawSeconds = elements.length === 6 ? elements[0] : "0";
|
|
379
|
+
const rawMinutes = elements.length === 6 ? elements[1] : elements[0];
|
|
380
|
+
const rawHours = elements.length === 6 ? elements[2] : elements[1];
|
|
381
|
+
const rawDays = elements.length === 6 ? elements[3] : elements[2];
|
|
382
|
+
const rawMonths = elements.length === 6 ? elements[4] : elements[3];
|
|
383
|
+
const rawWeekdays = elements.length === 6 ? elements[5] : elements[4];
|
|
384
|
+
return new Cron({
|
|
385
|
+
seconds: parseElement(rawSeconds, secondConstraint),
|
|
386
|
+
minutes: parseElement(rawMinutes, minuteConstraint),
|
|
387
|
+
hours: parseElement(rawHours, hourConstraint),
|
|
388
|
+
days: parseElement(rawDays, dayConstraint),
|
|
389
|
+
months: new Set(Array.from(parseElement(rawMonths, monthConstraint)).map((x) => x - 1)),
|
|
390
|
+
weekdays: new Set(Array.from(parseElement(rawWeekdays, weekdayConstraint)).map((x) => x % 7))
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
//#endregion
|
|
394
|
+
//#region ../../packages/core/src/shared/schema.ts
|
|
395
|
+
const MAX_JSON_DEPTH = 20;
|
|
396
|
+
function buildJsonValueSchema(depth) {
|
|
397
|
+
const primitives = z.union([
|
|
398
|
+
z.string(),
|
|
399
|
+
z.number(),
|
|
400
|
+
z.boolean(),
|
|
401
|
+
z.null()
|
|
402
|
+
]);
|
|
403
|
+
if (depth <= 0) return primitives;
|
|
404
|
+
const nested = buildJsonValueSchema(depth - 1);
|
|
405
|
+
return z.union([
|
|
406
|
+
primitives,
|
|
407
|
+
z.array(nested),
|
|
408
|
+
z.record(z.string(), nested)
|
|
409
|
+
]);
|
|
410
|
+
}
|
|
411
|
+
const jsonValueSchema = buildJsonValueSchema(MAX_JSON_DEPTH);
|
|
412
|
+
const jsonSchemaObject = z.record(z.string(), jsonValueSchema);
|
|
413
|
+
const anyZodSchemaSchema = z.custom((value) => value instanceof z.ZodType, "Expected a Zod schema");
|
|
414
|
+
const zodObjectSchema = z.custom((value) => value instanceof z.ZodObject, "Expected a Zod object schema");
|
|
415
|
+
/**
|
|
416
|
+
* Creates a Zod schema that validates an object structurally by checking
|
|
417
|
+
* for required properties. This avoids `instanceof` checks which fail
|
|
418
|
+
* when class definitions are duplicated across bundle boundaries.
|
|
419
|
+
*/
|
|
420
|
+
function createStructuralSchema(requiredKeys, label) {
|
|
421
|
+
return z.custom((value) => value != null && (typeof value === "object" || typeof value === "function") && requiredKeys.every((key) => key in value), `Expected ${label}`);
|
|
422
|
+
}
|
|
423
|
+
function trimmedNonEmptyString(fieldName) {
|
|
424
|
+
return z.string().trim().min(1, { error: `${fieldName} cannot be empty` }).max(255, { error: `${fieldName} cannot exceed 255 characters` });
|
|
425
|
+
}
|
|
426
|
+
/** Trimmed string with at least one character; no upper length limit. */
|
|
427
|
+
function trimmedNonEmptyStringUnbounded(fieldName) {
|
|
428
|
+
return z.string().trim().min(1, { error: `${fieldName} cannot be empty` });
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Non-empty trimmed string restricted to URL-safe characters.
|
|
432
|
+
* Use for IDs (workflow, step, etc.) that must be safe in URLs, env vars, and as object keys.
|
|
433
|
+
*/
|
|
434
|
+
function idNoSpacesString(fieldName) {
|
|
435
|
+
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` });
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Non-empty trimmed string for credential definition ids.
|
|
439
|
+
* Allows namespaced ids such as `keystroke:slack` plus letters, numbers,
|
|
440
|
+
* hyphens, and underscores.
|
|
441
|
+
*/
|
|
442
|
+
function credentialSetIdString(fieldName) {
|
|
443
|
+
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, underscores, and colons` });
|
|
444
|
+
}
|
|
445
|
+
function optionalTrimmedNonEmptyString(fieldName) {
|
|
446
|
+
return trimmedNonEmptyString(fieldName).optional();
|
|
447
|
+
}
|
|
448
|
+
function descriptionString(fieldName) {
|
|
449
|
+
return z.string().trim().min(1, { error: `${fieldName} cannot be empty` }).max(1024, { error: `${fieldName} cannot exceed 1024 characters` });
|
|
450
|
+
}
|
|
451
|
+
function optionalDescriptionString(fieldName) {
|
|
452
|
+
return descriptionString(fieldName).optional();
|
|
453
|
+
}
|
|
454
|
+
//#endregion
|
|
455
|
+
//#region ../../packages/core/src/credential-set/constants.ts
|
|
456
|
+
/**
|
|
457
|
+
* Shared constants for the credential/connection system.
|
|
458
|
+
* Defined in core (bottom of dependency chain) so all packages can import them.
|
|
459
|
+
*/
|
|
460
|
+
const CREDENTIAL_EXPOSURES = {
|
|
461
|
+
"user-runtime": "user-runtime",
|
|
462
|
+
"platform-only": "platform-only"
|
|
463
|
+
};
|
|
464
|
+
//#endregion
|
|
465
|
+
//#region ../../packages/core/src/credential-set/schemas.ts
|
|
466
|
+
const credentialSetProxyInjectionSchema = z.object({
|
|
467
|
+
/** Substitute placeholder in HTTP headers (default: true). */
|
|
468
|
+
headers: z.boolean().optional(),
|
|
469
|
+
/** Substitute placeholder in the HTTP Basic Auth credential (default: true). */
|
|
470
|
+
basicAuth: z.boolean().optional(),
|
|
471
|
+
/** Substitute placeholder in URL query params (default: false).
|
|
472
|
+
* Use for APIs that authenticate via `?api_key=...` (Google Maps, OWM, etc.). */
|
|
473
|
+
queryParams: z.boolean().optional(),
|
|
474
|
+
/** Substitute placeholder in the HTTP request body (default: false).
|
|
475
|
+
* Use for form-encoded auth payloads (Stripe, AWS SigV4 query, etc.). */
|
|
476
|
+
body: z.boolean().optional()
|
|
477
|
+
});
|
|
478
|
+
const credentialSetProxyConfigSchema = z.object({
|
|
479
|
+
/** Exact-match host allowlist (forwarded to SecretBuilder.allowHost). */
|
|
480
|
+
hosts: z.array(z.string().min(1)).optional(),
|
|
481
|
+
/** Wildcard host allowlist (forwarded to SecretBuilder.allowHostPattern).
|
|
482
|
+
* Example: `["*.browserbase.com"]` covers any subdomain. */
|
|
483
|
+
hostPatterns: z.array(z.string().min(1)).optional(),
|
|
484
|
+
/** Per-scope substitution toggles. Omit to use SDK defaults. */
|
|
485
|
+
injection: credentialSetProxyInjectionSchema.optional()
|
|
486
|
+
});
|
|
487
|
+
const onCredentialRevokedSchema = z.enum(["fail", "retry-once"]);
|
|
488
|
+
const credentialExposureSchema = z.enum([CREDENTIAL_EXPOSURES["user-runtime"], CREDENTIAL_EXPOSURES["platform-only"]]);
|
|
489
|
+
const connectionMetadataConfigSchema = z.object({
|
|
490
|
+
id: credentialSetIdString("Credential connection id").optional(),
|
|
491
|
+
label: optionalTrimmedNonEmptyString("Credential connection label"),
|
|
492
|
+
description: optionalDescriptionString("Credential connection description"),
|
|
493
|
+
recommended: z.boolean().optional(),
|
|
494
|
+
advanced: z.boolean().optional(),
|
|
495
|
+
needsRawSecret: z.boolean().optional()
|
|
496
|
+
});
|
|
497
|
+
const connectionMetadataManifestSchema = connectionMetadataConfigSchema;
|
|
498
|
+
const registeredDescriptorSchema = z.object({
|
|
499
|
+
id: trimmedNonEmptyString("Registered descriptor id"),
|
|
500
|
+
config: z.record(z.string(), z.unknown()).optional()
|
|
501
|
+
});
|
|
502
|
+
const registeredResolverDescriptorSchema = registeredDescriptorSchema.extend({ cacheMs: z.number().int().nonnegative().optional() });
|
|
503
|
+
const manualConnectionConfigSchema = connectionMetadataConfigSchema.extend({
|
|
504
|
+
kind: z.literal("manual"),
|
|
505
|
+
input: zodObjectSchema.optional(),
|
|
506
|
+
instructions: z.string().min(1).optional(),
|
|
507
|
+
validate: z.function().optional()
|
|
508
|
+
});
|
|
509
|
+
const manualConnectionFieldManifestSchema = z.object({
|
|
510
|
+
key: z.string().min(1),
|
|
511
|
+
label: z.string().min(1),
|
|
512
|
+
description: z.string().min(1).optional(),
|
|
513
|
+
optional: z.boolean(),
|
|
514
|
+
secret: z.literal(true)
|
|
515
|
+
});
|
|
516
|
+
const manualConnectionConfigManifestSchema = connectionMetadataManifestSchema.extend({
|
|
517
|
+
kind: z.literal("manual"),
|
|
518
|
+
input: jsonSchemaObject.optional(),
|
|
519
|
+
fields: z.array(manualConnectionFieldManifestSchema).optional(),
|
|
520
|
+
generated: z.boolean().optional(),
|
|
521
|
+
instructions: z.string().min(1).optional()
|
|
522
|
+
});
|
|
523
|
+
/** Declarative form of `Vault` — strings typed against the credential set's
|
|
524
|
+
* stored/auth schema keys at the {@link CredentialSetConfig} boundary; the Zod
|
|
525
|
+
* schema here enforces non-empty strings only. `CredentialSet` itself performs
|
|
526
|
+
* the schema-key membership check at construction time. */
|
|
527
|
+
const vaultMappingSchema = z.object({
|
|
528
|
+
accessToken: z.string().min(1),
|
|
529
|
+
refreshToken: z.string().min(1).optional(),
|
|
530
|
+
instanceUrl: z.string().min(1).optional(),
|
|
531
|
+
raw: z.record(z.string().min(1), z.string().min(1)).optional()
|
|
532
|
+
});
|
|
533
|
+
/** Function form of `Vault` — an object pairing the access-token vault key
|
|
534
|
+
* (`accessTokenKey`) with the `build` function that computes the full vault
|
|
535
|
+
* write map. The explicit key keeps the disconnect path's revocation read
|
|
536
|
+
* reliable even when `build` transforms the access token. */
|
|
537
|
+
const vaultMappingFnSchema = z.object({
|
|
538
|
+
accessTokenKey: z.string().min(1),
|
|
539
|
+
build: z.custom((val) => typeof val === "function", { message: "vault.build must be a function." })
|
|
540
|
+
});
|
|
541
|
+
/** Runtime shape of `Vault`. Accepts either the declarative mapping or the
|
|
542
|
+
* function-form object `{ accessTokenKey, build }`. */
|
|
543
|
+
const vaultConfigSchema = z.union([vaultMappingSchema, vaultMappingFnSchema], { error: "vault must be a declarative mapping object or a `{ accessTokenKey, build }` object." });
|
|
544
|
+
/** Manifest projection of `Vault` — declarative mappings serialize verbatim;
|
|
545
|
+
* function-form mappings serialize as `{ kind: 'function', accessTokenKey }`
|
|
546
|
+
* since closures are not manifest-safe but the access-token key is. */
|
|
547
|
+
const vaultManifestSchema = z.discriminatedUnion("kind", [z.object({
|
|
548
|
+
kind: z.literal("declarative"),
|
|
549
|
+
accessToken: z.string().min(1),
|
|
550
|
+
refreshToken: z.string().min(1).optional(),
|
|
551
|
+
instanceUrl: z.string().min(1).optional(),
|
|
552
|
+
raw: z.record(z.string().min(1), z.string().min(1)).optional()
|
|
553
|
+
}), z.object({
|
|
554
|
+
kind: z.literal("function"),
|
|
555
|
+
accessTokenKey: z.string().min(1)
|
|
556
|
+
})]);
|
|
557
|
+
const oauthConnectionConfigBaseSchema = z.object({
|
|
558
|
+
kind: z.literal("oauth"),
|
|
559
|
+
authUrl: z.string().url(),
|
|
560
|
+
tokenUrl: z.string().url(),
|
|
561
|
+
scopes: z.array(z.string()).readonly(),
|
|
562
|
+
revokeUrl: z.string().url().nullable().optional(),
|
|
563
|
+
tokenType: z.enum(["long-lived", "refreshable"]),
|
|
564
|
+
pkce: z.boolean().optional(),
|
|
565
|
+
/** Fallback token lifetime when the provider omits `expires_in`. Positive
|
|
566
|
+
* integer seconds. Shared between config + manifest schemas (both extend
|
|
567
|
+
* this base). */
|
|
568
|
+
defaultExpiresInSeconds: z.number().int().positive().optional()
|
|
569
|
+
});
|
|
570
|
+
const oauthConnectionConfigSchema = oauthConnectionConfigBaseSchema.extend({
|
|
571
|
+
...connectionMetadataConfigSchema.shape,
|
|
572
|
+
vault: vaultConfigSchema,
|
|
573
|
+
oauth: registeredDescriptorSchema.optional(),
|
|
574
|
+
buildAuthUrl: z.function().optional(),
|
|
575
|
+
exchangeCode: z.function().optional(),
|
|
576
|
+
refreshToken: z.function().optional(),
|
|
577
|
+
extractInstallationInfo: z.function().optional(),
|
|
578
|
+
validate: z.function().optional()
|
|
579
|
+
});
|
|
580
|
+
const oauthConnectionConfigManifestSchema = oauthConnectionConfigBaseSchema.extend({
|
|
581
|
+
...connectionMetadataManifestSchema.shape,
|
|
582
|
+
vault: vaultManifestSchema,
|
|
583
|
+
oauth: registeredDescriptorSchema.optional()
|
|
584
|
+
});
|
|
585
|
+
const credentialsExchangeConnectionConfigSchema = connectionMetadataConfigSchema.extend({
|
|
586
|
+
kind: z.literal("credentials-exchange"),
|
|
587
|
+
instructions: z.string().min(1).optional(),
|
|
588
|
+
input: zodObjectSchema
|
|
589
|
+
}).extend({
|
|
590
|
+
exchange: z.function(),
|
|
591
|
+
rotate: z.function().optional(),
|
|
592
|
+
validate: z.function().optional()
|
|
593
|
+
});
|
|
594
|
+
/** Manifest projection of `CredentialsExchangeConnectionConfig` — only the
|
|
595
|
+
* declarative `input` schema (rendered as JSON Schema) and `instructions`
|
|
596
|
+
* copy survive serialization. The three hooks (`exchange`, `rotate`,
|
|
597
|
+
* `validate`) are runtime closures and are stripped. */
|
|
598
|
+
const credentialsExchangeConnectionConfigManifestSchema = z.object({
|
|
599
|
+
kind: z.literal("credentials-exchange"),
|
|
600
|
+
...connectionMetadataManifestSchema.shape,
|
|
601
|
+
instructions: z.string().min(1).optional(),
|
|
602
|
+
input: jsonSchemaObject
|
|
603
|
+
});
|
|
604
|
+
const exchangeCredentialConnectionConfigSchema = connectionMetadataConfigSchema.extend({
|
|
605
|
+
kind: z.literal("exchange"),
|
|
606
|
+
input: zodObjectSchema,
|
|
607
|
+
exchange: registeredDescriptorSchema
|
|
608
|
+
});
|
|
609
|
+
const exchangeCredentialConnectionManifestSchema = connectionMetadataManifestSchema.extend({
|
|
610
|
+
kind: z.literal("exchange"),
|
|
611
|
+
input: jsonSchemaObject,
|
|
612
|
+
exchange: registeredDescriptorSchema
|
|
613
|
+
});
|
|
614
|
+
const dynamicCredentialConnectionConfigSchema = connectionMetadataConfigSchema.extend({
|
|
615
|
+
kind: z.literal("dynamic"),
|
|
616
|
+
input: zodObjectSchema.optional(),
|
|
617
|
+
resolver: registeredResolverDescriptorSchema
|
|
618
|
+
});
|
|
619
|
+
const dynamicCredentialConnectionManifestSchema = connectionMetadataManifestSchema.extend({
|
|
620
|
+
kind: z.literal("dynamic"),
|
|
621
|
+
input: jsonSchemaObject.optional(),
|
|
622
|
+
resolver: registeredResolverDescriptorSchema
|
|
623
|
+
});
|
|
624
|
+
const platformCredentialConnectionConfigSchema = connectionMetadataConfigSchema.extend({ kind: z.literal("platform") });
|
|
625
|
+
const platformCredentialConnectionManifestSchema = connectionMetadataManifestSchema.extend({ kind: z.literal("platform") });
|
|
626
|
+
const connectionConfigSchema = z.discriminatedUnion("kind", [
|
|
627
|
+
manualConnectionConfigSchema,
|
|
628
|
+
oauthConnectionConfigSchema,
|
|
629
|
+
credentialsExchangeConnectionConfigSchema,
|
|
630
|
+
exchangeCredentialConnectionConfigSchema,
|
|
631
|
+
dynamicCredentialConnectionConfigSchema,
|
|
632
|
+
platformCredentialConnectionConfigSchema
|
|
633
|
+
]);
|
|
634
|
+
/** Manifest projection of `ConnectionConfig` — declarative metadata only. */
|
|
635
|
+
const connectionConfigManifestSchema = z.discriminatedUnion("kind", [
|
|
636
|
+
manualConnectionConfigManifestSchema,
|
|
637
|
+
oauthConnectionConfigManifestSchema,
|
|
638
|
+
credentialsExchangeConnectionConfigManifestSchema,
|
|
639
|
+
exchangeCredentialConnectionManifestSchema,
|
|
640
|
+
dynamicCredentialConnectionManifestSchema,
|
|
641
|
+
platformCredentialConnectionManifestSchema
|
|
642
|
+
]);
|
|
643
|
+
const CredentialSetManifestSchema = z.object({
|
|
644
|
+
manifestVersion: z.literal(1),
|
|
645
|
+
type: z.literal("credentialSet"),
|
|
646
|
+
id: credentialSetIdString("Credential set id"),
|
|
647
|
+
name: trimmedNonEmptyString("Credential set name"),
|
|
648
|
+
description: optionalDescriptionString("Credential set description"),
|
|
649
|
+
auth: jsonSchemaObject,
|
|
650
|
+
exposure: credentialExposureSchema.optional(),
|
|
651
|
+
proxy: credentialSetProxyConfigSchema.optional(),
|
|
652
|
+
/** When true, resolved values are passed into execution as raw secrets (no ref-token proxy). */
|
|
653
|
+
needsRawSecret: z.boolean().optional(),
|
|
654
|
+
/** Policy when a step throws `CredentialRevokedError` against this credential set. */
|
|
655
|
+
onCredentialRevoked: onCredentialRevokedSchema.optional(),
|
|
656
|
+
connections: z.array(connectionConfigManifestSchema).optional()
|
|
657
|
+
});
|
|
658
|
+
z.object({
|
|
659
|
+
id: credentialSetIdString("Credential set id"),
|
|
660
|
+
name: optionalTrimmedNonEmptyString("Credential set name"),
|
|
661
|
+
description: optionalDescriptionString("Credential set description"),
|
|
662
|
+
auth: zodObjectSchema,
|
|
663
|
+
exposure: credentialExposureSchema.optional(),
|
|
664
|
+
proxy: credentialSetProxyConfigSchema.optional(),
|
|
665
|
+
/** When true, resolved values are passed into execution as raw secrets (no ref-token proxy). */
|
|
666
|
+
needsRawSecret: z.boolean().optional(),
|
|
667
|
+
onCredentialRevoked: onCredentialRevokedSchema.optional(),
|
|
668
|
+
connections: z.array(connectionConfigSchema).readonly().optional()
|
|
669
|
+
});
|
|
670
|
+
//#endregion
|
|
671
|
+
export { descriptionString as a, optionalDescriptionString as c, trimmedNonEmptyStringUnbounded as d, parseCronExpression as f, createStructuralSchema as i, optionalTrimmedNonEmptyString as l, credentialSetProxyConfigSchema as n, idNoSpacesString as o, anyZodSchemaSchema as r, jsonSchemaObject as s, CredentialSetManifestSchema as t, trimmedNonEmptyString as u };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { D as CliExitError, a as ui } from "./keystroke.mjs";
|
|
4
4
|
import { i as writeJson, r as isJsonMode } from "./output-BWcVRt-T.mjs";
|
|
5
|
-
import { i as UnknownSkillAgentError, n as resolveSkillInstallChoices, r as installKeystrokeAgentSkills, t as summarizeSkillInstall } from "./skill-installer-
|
|
5
|
+
import { i as UnknownSkillAgentError, n as resolveSkillInstallChoices, r as installKeystrokeAgentSkills, t as summarizeSkillInstall } from "./skill-installer-Cm9hF6OB.mjs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
//#region src/commands/skills/skills-sync.handler.ts
|
|
8
8
|
async function handleSkillsSync(options, _ctx) {
|