twenty 2.55.0 → 2.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/dist/app-template/yarn.lock +38 -38
  2. package/dist/app-worker.cjs +1 -1
  3. package/dist/chunks/api-key-stdin-hint.constant-BTPNgm3m.cjs +1 -0
  4. package/dist/chunks/application-T4xvzjbB.cjs +5 -0
  5. package/dist/chunks/{build-source-manifest-CS9qVNh-.cjs → build-source-manifest-tGYOCdor.cjs} +1 -1
  6. package/dist/chunks/{build-source-snapshot-CpGCu13I.cjs → build-source-snapshot-CzwiB8HK.cjs} +3 -3
  7. package/dist/chunks/{cli-version.constant-Cu5tVcCH.cjs → cli-version.constant-1uwk-lMz.cjs} +1 -1
  8. package/dist/chunks/{collect-translatable-strings-DCyYBNLJ.cjs → collect-translatable-strings-BB6KpZT2.cjs} +1 -1
  9. package/dist/chunks/compile-application-translations-S-xuODkF.cjs +870 -0
  10. package/dist/chunks/constants-Bw_pUpSi-BsJPlw-e.cjs +55 -0
  11. package/dist/chunks/{create-http-status-error-C0btwkS0.cjs → create-http-status-error-DBUhBnxP.cjs} +1 -1
  12. package/dist/chunks/create-metadata-client-wHecaKNL.cjs +6 -0
  13. package/dist/chunks/create-pull-base-write-BZnZwrLk.cjs +1 -0
  14. package/dist/chunks/{create-rest-client-YAG6kSAm.cjs → create-rest-client-B-kdRm7C.cjs} +1 -1
  15. package/dist/chunks/extract-manifest-from-file-CNGCZF6o.cjs +1 -0
  16. package/dist/chunks/{extract-source-translations-DhYrd7jw.cjs → extract-source-translations-BHWNS2e9.cjs} +1 -1
  17. package/dist/chunks/{fetch-metadata-inspection-DzssW2Dw.cjs → fetch-metadata-inspection-Dqn8jToW.cjs} +1 -1
  18. package/dist/chunks/{fetch-signed-in-identity-CId23qtn.cjs → fetch-signed-in-identity-DCqCwASL.cjs} +1 -1
  19. package/dist/chunks/fetch-workspace-or-throw-CBKYiJI0.cjs +1 -0
  20. package/dist/chunks/{format-data-value-pZjy4e4h.cjs → format-data-value-DuQjxLye.cjs} +1 -1
  21. package/dist/chunks/{format-metadata-fields-Dh6CmU5G.cjs → format-metadata-fields-DPClLlzD.cjs} +1 -1
  22. package/dist/chunks/{format-metadata-owner-CCxXpga0.cjs → format-metadata-owner-ffrpq9D6.cjs} +1 -1
  23. package/dist/chunks/{generate-application-client-pMdNJ3g0.cjs → generate-application-client-DjE_Tp0M.cjs} +1 -1
  24. package/dist/chunks/{get-client-generation-skip-reason-DruQtHYQ.cjs → get-client-generation-skip-reason-DZmeP0IC.cjs} +1 -1
  25. package/dist/chunks/{get-system-view-universal-identifier.util-BjGghzoH-Cg8Rg3uX.cjs → get-system-view-universal-identifier.util-DgYnPEO1-CKEQWit5.cjs} +1 -1
  26. package/dist/chunks/global-flags.constant-C8Yu1rWc.cjs +1 -0
  27. package/dist/chunks/{is-access-token-expiring-BcJiLtlE.cjs → is-access-token-expiring-Cin0OQ-E.cjs} +1 -1
  28. package/dist/chunks/{is-application-not-found-error-C8ifQUn8.cjs → is-application-not-found-error-BAsQDAoQ.cjs} +1 -1
  29. package/dist/chunks/is-exported-manifest-COVWXnDs.cjs +1 -0
  30. package/dist/chunks/{is-valid-package-name-YNq-0I2a.cjs → is-valid-package-name-CfHS8_Lr.cjs} +1 -1
  31. package/dist/chunks/{locale-catalog-format-CFYxqgvL.cjs → locale-catalog-format-Cg9YplKA.cjs} +2 -2
  32. package/dist/chunks/metadata-Db5EuDpT.cjs +1 -0
  33. package/dist/chunks/parse-app-export-Dnu8mFrS.cjs +1 -0
  34. package/dist/chunks/{parse-graphql-response-C_4SPebO.cjs → parse-graphql-response-BSRJqolm.cjs} +1 -1
  35. package/dist/chunks/{parse-json-input-B87VP1pj.cjs → parse-json-input-CN9Wyj73.cjs} +1 -1
  36. package/dist/chunks/print-typescript-value-BsjFUceV.cjs +3 -0
  37. package/dist/chunks/pull-minimum-sdk-version.constant-BxmmUfee.cjs +6 -0
  38. package/dist/chunks/pull-source-BPng2lln.cjs +1 -0
  39. package/dist/chunks/{read-app-identity-DK9znGhT.cjs → read-app-identity-yX9-Ylxj.cjs} +1 -1
  40. package/dist/chunks/{read-application-identifier-BXkar-mo.cjs → read-application-identifier-DuI_jnU7.cjs} +1 -1
  41. package/dist/chunks/read-application-identity-BFQ0oOna.cjs +1 -0
  42. package/dist/chunks/{read-config-DWLaxc3C.cjs → read-config-DdGLulo-.cjs} +1 -1
  43. package/dist/chunks/{read-infer-deletion-option-BrShRRHT.cjs → read-infer-deletion-option-uFunybak.cjs} +1 -1
  44. package/dist/chunks/read-json-object-DcNHNB8I.cjs +1 -0
  45. package/dist/chunks/{read-local-container-C_kAPeoE.cjs → read-local-container-CPiVE1-D.cjs} +1 -1
  46. package/dist/chunks/{read-source-identity-BXYVcnXR.cjs → read-source-identity-CaErC5Qk.cjs} +1 -1
  47. package/dist/chunks/{record-pull-base-CkpPTblT.cjs → record-pull-base-RQ2mlIWr.cjs} +1 -1
  48. package/dist/chunks/{record-typecheck-config-inputs-DKn7fk11.cjs → record-typecheck-config-inputs-BAruvIZV.cjs} +1 -1
  49. package/dist/chunks/{request-oauth-tokens-C59XNnQs.cjs → request-oauth-tokens-Bp2eRh4F.cjs} +1 -1
  50. package/dist/chunks/{resolve-app-project-Cu1DLASA.cjs → resolve-app-project-aqOLK3Gb.cjs} +1 -1
  51. package/dist/chunks/{resolve-command-target-DXXwJ9aE.cjs → resolve-command-target-D4gMeXgA.cjs} +1 -1
  52. package/dist/chunks/{resolve-project-typescript-Dozy60cc.cjs → resolve-project-typescript-DkwXiCmt.cjs} +1 -1
  53. package/dist/chunks/{resolve-source-sdk-CizL-ZLW.cjs → resolve-source-sdk-CggXRBVx.cjs} +1 -1
  54. package/dist/chunks/{run-api-graphql-command-D_Gxp4_P.cjs → run-api-graphql-command-C3sJMP8H.cjs} +1 -1
  55. package/dist/chunks/{run-api-rest-command-Bm9KC7bB.cjs → run-api-rest-command-DQOP-cn8.cjs} +1 -1
  56. package/dist/chunks/run-app-add-command-qkKHuv9-.cjs +174 -0
  57. package/dist/chunks/{run-app-apply-command-pqnuwLNJ.cjs → run-app-apply-command-XNJHctjU.cjs} +1 -1
  58. package/dist/chunks/{run-app-build-command-DRslTZoC.cjs → run-app-build-command-CaInzuD2.cjs} +1 -1
  59. package/dist/chunks/{run-app-dev-command-9CKFKDBQ.cjs → run-app-dev-command-D6zVdTId.cjs} +1 -1
  60. package/dist/chunks/{run-app-exec-command-Bu_SM816.cjs → run-app-exec-command-DMHS9gpq.cjs} +2 -2
  61. package/dist/chunks/{run-app-generate-client-command-BKfbtgIG.cjs → run-app-generate-client-command-Ddq9lT40.cjs} +1 -1
  62. package/dist/chunks/{run-app-init-command-BDu78coZ.cjs → run-app-init-command-DcS8RfBK.cjs} +1 -1
  63. package/dist/chunks/{run-app-install-command-BNpFqYXx.cjs → run-app-install-command-DUB3JTon.cjs} +1 -1
  64. package/dist/chunks/{run-app-logs-command-DzQj1tdd.cjs → run-app-logs-command-CQHxh_Dt.cjs} +3 -3
  65. package/dist/chunks/{run-app-operation-Bj0hut-D.cjs → run-app-operation-KdXiXPb6.cjs} +1 -1
  66. package/dist/chunks/{run-app-plan-command-CIFK-61b.cjs → run-app-plan-command-DcjgbzTy.cjs} +1 -1
  67. package/dist/chunks/{run-app-publish-command-CuLrcX3d.cjs → run-app-publish-command-DEV9zgL1.cjs} +1 -1
  68. package/dist/chunks/{run-app-pull-command-CKoe_QKd.cjs → run-app-pull-command-B-hxnqvY.cjs} +3 -3
  69. package/dist/chunks/{run-app-translations-extract-command-riW4Ozc-.cjs → run-app-translations-extract-command-C0OfqFii.cjs} +1 -1
  70. package/dist/chunks/{run-app-typecheck-command-CPDDSwEm.cjs → run-app-typecheck-command-D2Po43IB.cjs} +1 -1
  71. package/dist/chunks/{run-app-uninstall-command-DFOMGmKw.cjs → run-app-uninstall-command-DXyjeBwO.cjs} +1 -1
  72. package/dist/chunks/run-auth-login-command-CVLvoJ7G.cjs +1 -0
  73. package/dist/chunks/{run-auth-logout-command-DjUjq_ug.cjs → run-auth-logout-command-ChrdwI-r.cjs} +1 -1
  74. package/dist/chunks/{run-auth-status-command-OAibzgLu.cjs → run-auth-status-command-X0m6rzI-.cjs} +1 -1
  75. package/dist/chunks/{run-cli-BjMuvO_y.cjs → run-cli-BoGzN25b.cjs} +8 -8
  76. package/dist/chunks/{run-commands-command-BhPkYc2t.cjs → run-commands-command-hMdnwU8-.cjs} +1 -1
  77. package/dist/chunks/{run-data-get-command-tV2bf5h6.cjs → run-data-get-command-DFE4NM2R.cjs} +1 -1
  78. package/dist/chunks/{run-data-list-command-D16ADH_r.cjs → run-data-list-command-BMEzitv6.cjs} +1 -1
  79. package/dist/chunks/{run-doctor-command-CEFSxor5.cjs → run-doctor-command-Bj2UR9ai.cjs} +2 -2
  80. package/dist/chunks/{run-local-logs-command-CkDxKsj7.cjs → run-local-logs-command-mUwB2XdV.cjs} +1 -1
  81. package/dist/chunks/{run-local-reset-command-pPzlL7jd.cjs → run-local-reset-command-WooW50PQ.cjs} +1 -1
  82. package/dist/chunks/{run-local-start-command-B_vDDsVi.cjs → run-local-start-command-CiXP155w.cjs} +1 -1
  83. package/dist/chunks/{run-local-status-command-CKh4246H.cjs → run-local-status-command-ClvEgxcU.cjs} +1 -1
  84. package/dist/chunks/{run-local-stop-command-BWJbZxK2.cjs → run-local-stop-command-BuV_YdJ7.cjs} +1 -1
  85. package/dist/chunks/{run-local-upgrade-command-CFDAkOsj.cjs → run-local-upgrade-command--O_EiVZc.cjs} +1 -1
  86. package/dist/chunks/{run-metadata-field-describe-command-D7q8KpLp.cjs → run-metadata-field-describe-command-iEw4KqIg.cjs} +1 -1
  87. package/dist/chunks/{run-metadata-field-list-command-yLteJu7m.cjs → run-metadata-field-list-command-YCsoqOo1.cjs} +1 -1
  88. package/dist/chunks/{run-metadata-object-describe-command-CHKnSf0E.cjs → run-metadata-object-describe-command-DpTobKR3.cjs} +1 -1
  89. package/dist/chunks/{run-metadata-object-list-command-D8CLvav9.cjs → run-metadata-object-list-command-BnSIIMDP.cjs} +1 -1
  90. package/dist/chunks/{run-open-command-CyBcIK9P.cjs → run-open-command-DWLQ7z_P.cjs} +1 -1
  91. package/dist/chunks/{run-remote-list-command-WKiOwCbu.cjs → run-remote-list-command-0f2QIf8C.cjs} +1 -1
  92. package/dist/chunks/{run-remote-remove-command-DPKQXI17.cjs → run-remote-remove-command-ClFB0Ub7.cjs} +1 -1
  93. package/dist/chunks/{run-remote-rename-command-CwuCickV.cjs → run-remote-rename-command-BVUcpZxq.cjs} +1 -1
  94. package/dist/chunks/{run-remote-use-command-BlB3SFV7.cjs → run-remote-use-command-ByRTqnq5.cjs} +1 -1
  95. package/dist/chunks/{run-version-command-BuWJdr6h.cjs → run-version-command-_9OGraNf.cjs} +1 -1
  96. package/dist/chunks/{select-target-DiY6zT7M.cjs → select-target-BHGEOc55.cjs} +1 -1
  97. package/dist/chunks/{sign-in-to-remote-again-DalF_h0k.cjs → sign-in-to-remote-again-DF27JFsz.cjs} +1 -1
  98. package/dist/chunks/{sign-in-with-browser-B2nBTir7.cjs → sign-in-with-browser-BNG4oa7e.cjs} +1 -1
  99. package/dist/chunks/{to-worker-output-diagnostics-CUKNJ_L6.cjs → to-worker-output-diagnostics-WZlUWvcj.cjs} +1 -1
  100. package/dist/chunks/{typecheck-application-BcS7ldNI.cjs → typecheck-application-BYPGp8lW.cjs} +1 -1
  101. package/dist/chunks/{update-config-D63n0BNZ.cjs → update-config-ClCVH3C5.cjs} +1 -1
  102. package/dist/chunks/{utils-BJdjZ6I2-DgqSVlwy.cjs → utils-Ds_lD5Ag-DfSfzJJP.cjs} +2 -2
  103. package/dist/chunks/{wait-for-local-environment-j4IZq_Nn.cjs → wait-for-local-environment-CjCRJnhK.cjs} +1 -1
  104. package/dist/chunks/{write-config-atomically-CkC-GT16.cjs → write-config-atomically-CQdFdvWo.cjs} +1 -1
  105. package/dist/cli.cjs +1 -1
  106. package/docs/commands.md +1 -1
  107. package/package.json +2 -2
  108. package/src/app/add/README.md +6 -6
  109. package/src/app/pull/README.md +6 -2
  110. package/dist/chunks/application-ChMyraCB.cjs +0 -5
  111. package/dist/chunks/compile-application-translations-Bp686pj4.cjs +0 -870
  112. package/dist/chunks/constants-BF6GWIop-98tUMN2U.cjs +0 -55
  113. package/dist/chunks/create-metadata-client-FcJiT9Hx.cjs +0 -6
  114. package/dist/chunks/create-pull-base-write-anQPBDx-.cjs +0 -1
  115. package/dist/chunks/extract-manifest-from-file-DA5fSI0W.cjs +0 -1
  116. package/dist/chunks/fetch-workspace-or-throw-BroNuadP.cjs +0 -1
  117. package/dist/chunks/global-flags.constant-BU7HyPk3.cjs +0 -1
  118. package/dist/chunks/is-exported-manifest-mJcgLfg0.cjs +0 -1
  119. package/dist/chunks/metadata-Cu3_OTI1.cjs +0 -1
  120. package/dist/chunks/parse-app-export-DAfsN3RE.cjs +0 -1
  121. package/dist/chunks/print-typescript-value-ChOUZ7Mm.cjs +0 -3
  122. package/dist/chunks/pull-minimum-sdk-version.constant-Dm7g3dNP.cjs +0 -5
  123. package/dist/chunks/pull-source-DvVJhvaO.cjs +0 -1
  124. package/dist/chunks/read-application-identity-D7fnqlw6.cjs +0 -1
  125. package/dist/chunks/read-json-object-B5Q55dbM.cjs +0 -1
  126. package/dist/chunks/run-app-add-command-BcuwnGCB.cjs +0 -163
  127. package/dist/chunks/run-auth-login-command-DOILzUGB.cjs +0 -1
@@ -1 +1 @@
1
- const e=require("./rolldown-runtime-mLOUI7ql.cjs"),t=require("./build--4zYt4wd.cjs"),n=require("./valid-BPaM0XRk.cjs"),r=require("./isDefined-Dtu5EYqP-CJctgvfE.cjs"),i=require("./constants-BF6GWIop-98tUMN2U.cjs"),a=require("./list-ancestor-directories-BtB2hNt6.cjs"),o=require("./cli-error-CrUD8uMp.cjs"),s=require("./get-engine-version-range-DZGIWoR6.cjs"),c=require("./read-bounded-body-BHRu5J2Y.cjs"),l=require("./max-satisfying-BNYDQrne.cjs"),u=require("./read-local-container-C_kAPeoE.cjs"),d=require("./get-local-status-D52rgA2e.cjs");let f=require("node:timers/promises");var p=async({environment:e,image:t,port:n,containerPort:r=n,environmentVariables:i=e.environmentVariables,shouldStart:a=!0,signal:o})=>{let s=[`NODE_PORT=${r}`,...i];return i.some(e=>e.startsWith(`SERVER_URL=`))||s.push(`SERVER_URL=http://localhost:${n}`),u.s({args:[...a?[`run`,`--detach`]:[`create`],`--name`,e.name,`--publish`,`127.0.0.1:${n}:${r}`,...s.flatMap(e=>[`--env`,e]),...Object.entries(e.volumes).flatMap(([e,t])=>[`--volume`,`${t}:${e}`]),t],signal:o})},m=e.r(l.n()),h=t.t(),g=async({imageId:e,signal:t})=>{let n=JSON.parse(await u.s({args:[`image`,`inspect`,`--format`,`{{json .Config.Env}}`,e],signal:t}));if(!(0,h.isArray)(n)||!n.every(h.isString))throw new o.t({code:`INVALID_RESPONSE`,message:`Docker returned invalid image environment variables.`});return n},_=async({imageId:e,signal:t})=>{let n=(0,m.default)((await g({imageId:e,signal:t})).find(e=>e.startsWith(`APP_VERSION=`))?.slice(12));if(!r.t(n))throw new o.t({code:`INVALID_RESPONSE`,message:`Cannot determine the Twenty version of image ${e}.`,hint:`Upgrade requires images with a valid APP_VERSION to prevent database downgrades. The existing instance is unchanged.`});return n},v=e.r(n.t()),y=e.r(l.t()),b=()=>a.t(process.cwd()).map(s.t).find(r.t),x=e=>{let t=(0,m.default)(e)??(/^\d+\.\d+$/.test(e)?e:void 0),n=r.t(t)?`v${t}`:e;if(!/^[a-zA-Z0-9_][a-zA-Z0-9_.-]{0,127}$/.test(n))throw new o.t({code:`INVALID_INPUT`,message:`Use a server version such as 2.53.1 or a valid image tag such as latest.`});return`${u.i}:${n}`},S=async({version:e,signal:t})=>{if(r.t(e))return x(e);let n=b();if(!r.t(n))return x(`latest`);if(!(0,v.default)(n))throw new o.t({code:`INVALID_INPUT`,message:`The app engines.twenty range is invalid.`,hint:`Fix engines.twenty or pass a version explicitly.`});let a=[],s=AbortSignal.any([t,AbortSignal.timeout(15e3)]);try{for(let e=1;e<=20;e++){let t=await c.n(`https://hub.docker.com/v2/repositories/${u.i}/tags?page_size=100&page=${e}`,{signal:s});if(!t.ok)throw await t.body?.cancel(),Error(`Image registry request failed (HTTP ${t.status})`);let o=JSON.parse(Buffer.from(await c.t(t,2*1024*1024)).toString());if(!i.a(o)||!(0,h.isArray)(o.results))throw Error(`Invalid image registry response`);for(let e of o.results)i.a(e)&&(0,h.isString)(e.name)&&(0,m.default)(e.name)&&a.push(e.name);if(!r.t(o.next)){let e=(0,y.default)(a,n);if(r.t(e))return x(e);throw Error(`No published image matches engines.twenty`)}}throw Error(`Image registry listing exceeded 2000 tags`)}catch(e){throw t.throwIfAborted(),new o.t({code:`LOCAL_ENVIRONMENT_FAILED`,message:`Could not select a published Twenty image matching ${n}: ${e instanceof Error?e.message:String(e)}`,hint:`Check the range and your connection, or pass a version explicitly.`,cause:e})}},C=async({port:e,signal:t})=>{let n=Date.now()+3e5;for(;Date.now()<n;){if(await d.n({port:e,signal:t}))return;await(0,f.setTimeout)(1e3,void 0,{signal:t})}throw new o.t({code:`TIMEOUT`,message:`The local environment did not become healthy within five minutes.`,hint:`The container was left in place. Run twenty local logs (add --test for the test instance).`})},w=async({environment:e,signal:t})=>{await C({port:e.port,signal:t});let n=await d.t({environment:e,container:await u.n({environment:e,signal:t}),signal:t});if(n.status!==`healthy`)throw new o.t({code:`LOCAL_ENVIRONMENT_FAILED`,message:`The local environment stopped responding during startup.`,hint:`Check twenty local logs (add --test for the test instance). Data volumes are preserved.`});return n};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return w}});
1
+ const e=require("./rolldown-runtime-mLOUI7ql.cjs"),t=require("./build--4zYt4wd.cjs"),n=require("./valid-BPaM0XRk.cjs"),r=require("./isDefined-Dtu5EYqP-CJctgvfE.cjs"),i=require("./constants-Bw_pUpSi-BsJPlw-e.cjs"),a=require("./list-ancestor-directories-BtB2hNt6.cjs"),o=require("./cli-error-CrUD8uMp.cjs"),s=require("./get-engine-version-range-DZGIWoR6.cjs"),c=require("./read-bounded-body-BHRu5J2Y.cjs"),l=require("./max-satisfying-BNYDQrne.cjs"),u=require("./read-local-container-CPiVE1-D.cjs"),d=require("./get-local-status-D52rgA2e.cjs");let f=require("node:timers/promises");var p=async({environment:e,image:t,port:n,containerPort:r=n,environmentVariables:i=e.environmentVariables,shouldStart:a=!0,signal:o})=>{let s=[`NODE_PORT=${r}`,...i];return i.some(e=>e.startsWith(`SERVER_URL=`))||s.push(`SERVER_URL=http://localhost:${n}`),u.s({args:[...a?[`run`,`--detach`]:[`create`],`--name`,e.name,`--publish`,`127.0.0.1:${n}:${r}`,...s.flatMap(e=>[`--env`,e]),...Object.entries(e.volumes).flatMap(([e,t])=>[`--volume`,`${t}:${e}`]),t],signal:o})},m=e.r(l.n()),h=t.t(),g=async({imageId:e,signal:t})=>{let n=JSON.parse(await u.s({args:[`image`,`inspect`,`--format`,`{{json .Config.Env}}`,e],signal:t}));if(!(0,h.isArray)(n)||!n.every(h.isString))throw new o.t({code:`INVALID_RESPONSE`,message:`Docker returned invalid image environment variables.`});return n},_=async({imageId:e,signal:t})=>{let n=(0,m.default)((await g({imageId:e,signal:t})).find(e=>e.startsWith(`APP_VERSION=`))?.slice(12));if(!r.t(n))throw new o.t({code:`INVALID_RESPONSE`,message:`Cannot determine the Twenty version of image ${e}.`,hint:`Upgrade requires images with a valid APP_VERSION to prevent database downgrades. The existing instance is unchanged.`});return n},v=e.r(n.t()),y=e.r(l.t()),b=()=>a.t(process.cwd()).map(s.t).find(r.t),x=e=>{let t=(0,m.default)(e)??(/^\d+\.\d+$/.test(e)?e:void 0),n=r.t(t)?`v${t}`:e;if(!/^[a-zA-Z0-9_][a-zA-Z0-9_.-]{0,127}$/.test(n))throw new o.t({code:`INVALID_INPUT`,message:`Use a server version such as 2.53.1 or a valid image tag such as latest.`});return`${u.i}:${n}`},S=async({version:e,signal:t})=>{if(r.t(e))return x(e);let n=b();if(!r.t(n))return x(`latest`);if(!(0,v.default)(n))throw new o.t({code:`INVALID_INPUT`,message:`The app engines.twenty range is invalid.`,hint:`Fix engines.twenty or pass a version explicitly.`});let a=[],s=AbortSignal.any([t,AbortSignal.timeout(15e3)]);try{for(let e=1;e<=20;e++){let t=await c.n(`https://hub.docker.com/v2/repositories/${u.i}/tags?page_size=100&page=${e}`,{signal:s});if(!t.ok)throw await t.body?.cancel(),Error(`Image registry request failed (HTTP ${t.status})`);let o=JSON.parse(Buffer.from(await c.t(t,2*1024*1024)).toString());if(!i.i(o)||!(0,h.isArray)(o.results))throw Error(`Invalid image registry response`);for(let e of o.results)i.i(e)&&(0,h.isString)(e.name)&&(0,m.default)(e.name)&&a.push(e.name);if(!r.t(o.next)){let e=(0,y.default)(a,n);if(r.t(e))return x(e);throw Error(`No published image matches engines.twenty`)}}throw Error(`Image registry listing exceeded 2000 tags`)}catch(e){throw t.throwIfAborted(),new o.t({code:`LOCAL_ENVIRONMENT_FAILED`,message:`Could not select a published Twenty image matching ${n}: ${e instanceof Error?e.message:String(e)}`,hint:`Check the range and your connection, or pass a version explicitly.`,cause:e})}},C=async({port:e,signal:t})=>{let n=Date.now()+3e5;for(;Date.now()<n;){if(await d.n({port:e,signal:t}))return;await(0,f.setTimeout)(1e3,void 0,{signal:t})}throw new o.t({code:`TIMEOUT`,message:`The local environment did not become healthy within five minutes.`,hint:`The container was left in place. Run twenty local logs (add --test for the test instance).`})},w=async({environment:e,signal:t})=>{await C({port:e.port,signal:t});let n=await d.t({environment:e,container:await u.n({environment:e,signal:t}),signal:t});if(n.status!==`healthy`)throw new o.t({code:`LOCAL_ENVIRONMENT_FAILED`,message:`The local environment stopped responding during startup.`,hint:`Check twenty local logs (add --test for the test instance). Data volumes are preserved.`});return n};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return w}});
@@ -1 +1 @@
1
- const e=require("./build--4zYt4wd.cjs"),t=require("./isDefined-Dtu5EYqP-CJctgvfE.cjs"),n=require("./constants-BF6GWIop-98tUMN2U.cjs"),r=require("./has-error-code-DsJeqbZq.cjs"),i=require("./cli-error-CrUD8uMp.cjs"),a=require("./request-timeout-milliseconds.constant-BkZTOtpY.cjs"),o=require("./config-file-mode.constant-DLBzKKUl.cjs");let s=require("node:crypto"),c=require("node:fs/promises"),l=require("node:path"),u=require("node:timers/promises");var d=e.t(),f={TIMEOUT_MILLISECONDS:2*a.t+5e3,RETRY_MILLISECONDS:50},p=async e=>{try{let t=JSON.parse(await(0,c.readFile)(e,`utf8`));return n.a(t)&&(0,d.isNumber)(t.pid)&&(0,d.isString)(t.token)?{pid:t.pid,token:t.token}:void 0}catch{return}},m=e=>{try{return process.kill(e,0),!0}catch(e){return r.t(e,`EPERM`)}},h=async e=>{let n=await p(e),r=t.t(n)&&!m(n.pid),a=t.t(n)?` (pid ${n.pid})`:``;return new i.t({code:`CONFIG_LOCKED`,message:r?`A twenty command (pid ${n.pid}) stopped without releasing ${e}.`:`Another twenty command${a} is changing ${(0,l.dirname)(e)}.`,hint:r?`Delete ${e} and try again.`:`Try again when it finishes. If no twenty command is running, delete ${e}.`,details:{lockPath:e,ownerPid:n?.pid??null}})},g=async(e,t)=>{try{let n=await(0,c.open)(e,`wx`,o.t.PRIVATE_FILE);return await n.writeFile(JSON.stringify({pid:process.pid,token:t})),await n.close(),!0}catch(e){if(r.t(e,`EEXIST`))return!1;throw e}},_=async({lockPath:e,token:n,signal:r})=>{let i=Date.now()+f.TIMEOUT_MILLISECONDS,a=await g(e,n);for(;!a;){r.throwIfAborted();let o=await p(e);if(t.t(o)&&!m(o.pid)||Date.now()>i)throw await h(e);await(0,u.setTimeout)(f.RETRY_MILLISECONDS,void 0,{signal:r}),a=await g(e,n)}},v=async(e,t)=>{(await p(e))?.token===t&&await(0,c.rm)(e,{force:!0})},y=async({configPath:e,signal:t,operation:n})=>{let r=`${e}.lock`,i=(0,s.randomUUID)();await(0,c.mkdir)((0,l.dirname)(e),{recursive:!0,mode:o.t.PRIVATE_DIRECTORY}),await _({lockPath:r,token:i,signal:t});try{return await n()}finally{await v(r,i)}},b=async(e,t)=>{let n=`${e}.${process.pid}.${(0,s.randomUUID)()}.tmp`,r=await(0,c.open)(n,`wx`,o.t.PRIVATE_FILE);try{await r.writeFile(`${JSON.stringify(t,null,2)}\n`),await r.sync(),await r.close(),await(0,c.rename)(n,e)}catch(e){throw await r.close().catch(()=>void 0),await(0,c.rm)(n,{force:!0}),e}};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return b}});
1
+ const e=require("./build--4zYt4wd.cjs"),t=require("./isDefined-Dtu5EYqP-CJctgvfE.cjs"),n=require("./constants-Bw_pUpSi-BsJPlw-e.cjs"),r=require("./has-error-code-DsJeqbZq.cjs"),i=require("./cli-error-CrUD8uMp.cjs"),a=require("./request-timeout-milliseconds.constant-BkZTOtpY.cjs"),o=require("./config-file-mode.constant-DLBzKKUl.cjs");let s=require("node:crypto"),c=require("node:fs/promises"),l=require("node:path"),u=require("node:timers/promises");var d=e.t(),f={TIMEOUT_MILLISECONDS:2*a.t+5e3,RETRY_MILLISECONDS:50},p=async e=>{try{let t=JSON.parse(await(0,c.readFile)(e,`utf8`));return n.i(t)&&(0,d.isNumber)(t.pid)&&(0,d.isString)(t.token)?{pid:t.pid,token:t.token}:void 0}catch{return}},m=e=>{try{return process.kill(e,0),!0}catch(e){return r.t(e,`EPERM`)}},h=async e=>{let n=await p(e),r=t.t(n)&&!m(n.pid),a=t.t(n)?` (pid ${n.pid})`:``;return new i.t({code:`CONFIG_LOCKED`,message:r?`A twenty command (pid ${n.pid}) stopped without releasing ${e}.`:`Another twenty command${a} is changing ${(0,l.dirname)(e)}.`,hint:r?`Delete ${e} and try again.`:`Try again when it finishes. If no twenty command is running, delete ${e}.`,details:{lockPath:e,ownerPid:n?.pid??null}})},g=async(e,t)=>{try{let n=await(0,c.open)(e,`wx`,o.t.PRIVATE_FILE);return await n.writeFile(JSON.stringify({pid:process.pid,token:t})),await n.close(),!0}catch(e){if(r.t(e,`EEXIST`))return!1;throw e}},_=async({lockPath:e,token:n,signal:r})=>{let i=Date.now()+f.TIMEOUT_MILLISECONDS,a=await g(e,n);for(;!a;){r.throwIfAborted();let o=await p(e);if(t.t(o)&&!m(o.pid)||Date.now()>i)throw await h(e);await(0,u.setTimeout)(f.RETRY_MILLISECONDS,void 0,{signal:r}),a=await g(e,n)}},v=async(e,t)=>{(await p(e))?.token===t&&await(0,c.rm)(e,{force:!0})},y=async({configPath:e,signal:t,operation:n})=>{let r=`${e}.lock`,i=(0,s.randomUUID)();await(0,c.mkdir)((0,l.dirname)(e),{recursive:!0,mode:o.t.PRIVATE_DIRECTORY}),await _({lockPath:r,token:i,signal:t});try{return await n()}finally{await v(r,i)}},b=async(e,t)=>{let n=`${e}.${process.pid}.${(0,s.randomUUID)()}.tmp`,r=await(0,c.open)(n,`wx`,o.t.PRIVATE_FILE);try{await r.writeFile(`${JSON.stringify(t,null,2)}\n`),await r.sync(),await r.close(),await(0,c.rename)(n,e)}catch(e){throw await r.close().catch(()=>void 0),await(0,c.rm)(n,{force:!0}),e}};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return b}});
package/dist/cli.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const e=require("./chunks/check-node-requirement-CIDuA1s-.cjs"),t=require("./chunks/cli-node-version-range.constant-D3XrqV07.cjs");process.stdout.on(`error`,e=>{if(e.code!==`EPIPE`)throw e;process.exit()}),(async({args:n,nodeVersion:r,loadCli:i})=>{if(e.t({version:r,range:`>=24.5.0`})!==`satisfied`){process.stderr.write(`twenty requires Node.js ${t.t}; this is Node.js ${r}. Switch to a supported Node.js version, then try again.\n`),process.exitCode=1;return}await(await i()).runCli(n)})({args:process.argv.slice(2),nodeVersion:process.versions.node,loadCli:()=>Promise.resolve().then(()=>require("./chunks/run-cli-BjMuvO_y.cjs"))});
2
+ const e=require("./chunks/check-node-requirement-CIDuA1s-.cjs"),t=require("./chunks/cli-node-version-range.constant-D3XrqV07.cjs");process.stdout.on(`error`,e=>{if(e.code!==`EPIPE`)throw e;process.exit()}),(async({args:n,nodeVersion:r,loadCli:i})=>{if(e.t({version:r,range:`>=24.5.0`})!==`satisfied`){process.stderr.write(`twenty requires Node.js ${t.t}; this is Node.js ${r}. Switch to a supported Node.js version, then try again.\n`),process.exitCode=1;return}await(await i()).runCli(n)})({args:process.argv.slice(2),nodeVersion:process.versions.node,loadCli:()=>Promise.resolve().then(()=>require("./chunks/run-cli-BoGzN25b.cjs"))});
package/docs/commands.md CHANGED
@@ -502,7 +502,7 @@ failures restore the previous files and baseline.
502
502
 
503
503
  Failures in reconciliation report `error.details.outcome`: `unchanged` after an acknowledged refusal, cancellation before writing or successful rollback; `unknown` if a worker stops without acknowledging completion or rollback fails; `pulled` if writes and baseline completed but temporary-file cleanup failed. An interrupted worker can leave files partially written; inspect the changes and retained `.twenty/cli/pull-backup-*` files before retrying. A failed rollback also reports `backupDirectory`. Ctrl+C exits 130 unless the worker acknowledges a completed commit, in which case pull returns its result.
504
504
 
505
- The current export contains metadata, translations and stored dependency files. Public assets and application source files are not exported yet. Workflows are written as `defineWorkflow` files in `src/workflows`; a workflow changed in the workflow builder, or one using steps or references an application cannot declare, is reported as a coverage gap and its local file is kept. The workspace Custom application is published from the builder too, so its workflows are written from their active version, and apply publishes a changed definition as a new version. Skills and agents are written as `defineSkill` and `defineAgent` files in `src/skills` and `src/agents`; one the server cannot reproduce from a definition, such as an agent on more than one role, is reported as a coverage gap and its local file is kept. Logic-function/front-component code and unsupported metadata are not regenerated. Pull restores `package.json` and `yarn.lock` from the application’s `dependencies` folder. If the exported package omits `twenty-sdk`, as the workspace Custom application does, pull keeps your local SDK dependency. Other exported files are refused before writing. Dependency files unchanged on the workspace keep local edits; changed remote files replace them. Missing remote files leave local files untouched. The installed generated client is left alone; pull never installs dependencies. Run `yarn install` after pulling dependency changes. Each export response is limited to 16 MiB. See the [pull implementation](../src/app/pull/README.md) for reconciliation and compatibility details.
505
+ The current export contains metadata, translations, stored dependency files and front component entry source. Public assets and logic-function source are not exported yet. Workflows are written as `defineWorkflow` files in `src/workflows`; a workflow changed in the workflow builder, or one using steps or references an application cannot declare, is reported as a coverage gap and its local file is kept. The workspace Custom application is published from the builder too, so its workflows are written from their active version, and apply publishes a changed definition as a new version. Skills and agents are written as `defineSkill` and `defineAgent` files in `src/skills` and `src/agents`; one the server cannot reproduce from a definition, such as an agent on more than one role, is reported as a coverage gap and its local file is kept. Front components are restored as their original TSX, preserving identifiers and supported page-layout widget references. Components with missing source are reported as coverage gaps and kept locally. Imports are preserved, but imported local files are not pulled yet. Restore missing dependencies before building or applying. Logic-function code and unsupported metadata are not regenerated. Pull restores `package.json` and `yarn.lock` from the application’s `dependencies` folder. If the exported package omits `twenty-sdk`, as the workspace Custom application does, pull keeps your local SDK dependency. Only declared front component sources and the dependency pair are accepted; other exported files are refused before writing. Dependency files and front component sources unchanged on the workspace keep local edits; changed remote files replace them and report overwritten edits. Missing remote files leave local files untouched. The installed generated client is left alone; pull never installs dependencies. Run `yarn install` after pulling dependency changes. Each export response is limited to 16 MiB. See the [pull implementation](../src/app/pull/README.md) for reconciliation and compatibility details.
506
506
 
507
507
  ## Install a registered app
508
508
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "twenty",
3
- "version": "2.55.0",
3
+ "version": "2.57.0",
4
4
  "description": "The Twenty command line.",
5
5
  "homepage": "https://twenty.com",
6
6
  "repository": {
@@ -34,7 +34,7 @@
34
34
  "npm-pick-manifest": "^11.0.1",
35
35
  "semver": "7.6.3",
36
36
  "string-width": "^8.2.0",
37
- "twenty-client-sdk": "2.55.0",
37
+ "twenty-client-sdk": "2.57.0",
38
38
  "twenty-shared": "0.0.0",
39
39
  "undici": "^7.30.1",
40
40
  "uuid": "^13.0.2",
@@ -1,20 +1,20 @@
1
1
  # App definition scaffolding
2
2
 
3
- The templates create object, field, logic-function and front-component
4
- definitions. Filenames and logic-function/front-component names use kebab-case.
3
+ The templates create object, field, logic-function, front-component and
4
+ validation-rule definitions. Filenames and logic-function/front-component names use kebab-case.
5
5
  Object and field metadata names keep the entered spelling; display labels use
6
6
  the same helper as app init.
7
7
 
8
8
  ## Contract
9
9
 
10
- - `twenty app add [entity]` accepts `object`, `field`, `logic-function` and
11
- `front-component`. A human terminal can supply omitted values interactively.
10
+ - `twenty app add [entity]` accepts `object`, `field`, `logic-function`,
11
+ `front-component` and `validation-rule`. A human terminal can supply omitted values interactively.
12
12
  JSON, CI, redirected stdin and `--no-input` never prompt; missing required or
13
13
  inapplicable options exit 2. Labels default to the name; fields default to
14
14
  `TEXT`.
15
15
  - `--path` selects an app, like the other CLI app commands. Files go under the
16
- selected app's `src/objects`, `src/fields`, `src/logic-functions` or
17
- `src/front-components`. Custom output directories are not supported.
16
+ selected app's `src/objects`, `src/fields`, `src/logic-functions`,
17
+ `src/front-components` or `src/validation-rules`. Custom output directories are not supported.
18
18
  - Parent and relation endpoint identifiers must be valid universal UUIDs. No
19
19
  workspace lookup verifies ownership or existence. Relations require reviewing
20
20
  both endpoints; this generator creates only the requested standalone field.
@@ -26,10 +26,14 @@ See the [app tooling overview](../README.md) for package boundaries.
26
26
 
27
27
  Translation string extraction uses the CLI's TypeScript parser. Traversal, static-string rules, whitespace normalization and deduplication are checked against the SDK reference by parity tests. It does not depend on ts-morph or load parser tooling for help and command discovery.
28
28
 
29
- Workflows arrive in `manifest.workflows` and are written as `defineWorkflow` files. Their filter operands and form field types use SDK enums; filter group logical operators stay string literals, which every SDK with `defineWorkflow` accepts. A workflow the server cannot express as a definition is reported as `UNSUPPORTED` coverage, so its local file is kept.
29
+ Workflows arrive in `manifest.workflows` and are written as `defineWorkflow` files. Their filter operands and form field types use SDK enums; filter group logical operators stay string literals, which every SDK with `defineWorkflow` accepts. A workflow the server cannot express as a definition is reported as `UNSUPPORTED` coverage, so its local file is kept. Each `CODE` step's source is written verbatim to a `.code.ts` file in a folder beside the workflow, named after the workflow file without `.workflow.ts` or `.ts`. The file is named after the kebab-cased step name, capped at 80 characters, or the first 8 characters of the step identifier when the name has no usable characters. When that path is taken by another step or an unrelated local file, the name gets that identifier prefix, then a numeric suffix; only the step's own previous file is overwritten. The workflow reads it with `readFileSync(join(__dirname, ...))` because a text import would not type-check in the app. These files hold no definition, so pull deletes the ones a regenerated or deleted workflow no longer references, even when the step survives under a new name.
30
30
 
31
31
  Skills and agents arrive in `manifest.skills` and `manifest.agents` and are written as `defineSkill` and `defineAgent` files, with no enum bindings. The server exports one only when its definition reproduces the stored entity; otherwise it is reported as `UNSUPPORTED` coverage, so its local file is kept.
32
32
 
33
- Pull requests `exportApplication(shouldIncludeDependencies: true)`. Export defaults to metadata-only files (`files: []`) for existing clients and apply baselines. Pull restores `dependencies/package.json` and `dependencies/yarn.lock` to the project root, in the same transaction as metadata and the baseline. Exact folder and filename checks reject all other exported files, including record attachments, public assets and source. If the remote package omits `twenty-sdk`, pull retains the local SDK dependency so the workspace custom app remains usable with the CLI. The baseline stores remote `dependencyFingerprints` separately from written `sourceFingerprints` for this case. Other exported dependency contents are copied exactly. Dependency files unchanged on the server preserve local edits; remote changes replace local contents and use the usual overwrite report. Missing remote files leave local files untouched. Pull does not install dependencies, generate the typed client or write logic-function/front-component source. Export responses have a 16 MiB cap. Pull does not modify the workspace. Because pull is partial, `app apply` of the workspace custom application only deletes entities missing from source with `--prune`.
33
+ Pull requests `exportApplication(shouldIncludeDependencies: true, shouldIncludeSourceFiles: true)`. Existing clients that do not request source files continue to receive coverage gaps for frontend components and their widgets, without reading component source from storage. Apply baseline recording opts in to source export too, so a later pull compares the same supported components. Pull restores `dependencies/package.json` and `dependencies/yarn.lock` to the project root, in the same transaction as metadata and the baseline. Exact folder and filename checks accept only that dependency pair and source files explicitly referenced by exported front components. Record attachments, public assets and unrelated source files are refused. If the remote package omits `twenty-sdk`, pull retains the local SDK dependency so the workspace custom app remains usable with the CLI. The baseline stores remote `dependencyFingerprints` separately from written `sourceFingerprints` for this case. Other exported dependency contents are copied exactly. Dependency files unchanged on the server preserve local edits; remote changes replace local contents and use the usual overwrite report. Missing remote files leave local files untouched. Pull does not install dependencies, generate the typed client or write logic-function source. Export responses have a 16 MiB cap. Pull does not modify the workspace. Because pull is partial, `app apply` of the workspace custom application only deletes entities missing from source with `--prune`.
34
34
 
35
35
  Tests cover writers, planning and reconciliation. Command tests build the actual Vite worker, exercise an authoring-only SDK, local mock HTTP, credentials/output isolation, SDK export refusal and forced termination after the first destination write. The repository SDK tests cover canonical generated definitions, nested coverage, translation preservation, target mismatch, overwrite reporting and rollback.
36
+
37
+ Front component entry files are restored from their stored original TSX, at their original path or the existing local definition's path. No JSX is regenerated. Export reports missing source, computed identifiers, and unsupported widget availability as coverage gaps; widgets referencing those components remain unexported. Imports are preserved without checking whether they can be resolved. Imported local files are not pulled yet; missing dependencies must be restored before building or applying. Support for imported local files is tracked separately in [#29462](https://github.com/twentyhq/twenty/issues/29462). An explicit GraphQL rejection of the source-export argument retries once without it, preserving older servers' metadata pull.
38
+
39
+ Pull records remote source hashes separately from local fingerprints. Unchanged remote source preserves local edits, including after repeated pulls; changed source uses the existing overwrite report, even if only comments changed and the compiled checksum stayed the same. An occupied destination or a missing declared source aborts the entire pull before writes. Supported page-layout widgets keep their component identifiers. Run `yarn install` after dependency changes before building the pulled TSX.
@@ -1,5 +0,0 @@
1
- const e=require("./build--4zYt4wd.cjs"),t=require("./utils-BJdjZ6I2-DgqSVlwy.cjs"),n=require("./isDefined-Dtu5EYqP-CJctgvfE.cjs"),r=require("./constants-BF6GWIop-98tUMN2U.cjs"),i=require("./get-system-view-universal-identifier.util-BjGghzoH-Cg8Rg3uX.cjs");var a={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},o;o||={};function s(e){if(!i.p(e))throw TypeError(`Invalid UUID`);return parseInt(e.slice(14,15),16)}function c(e){return e instanceof Boolean||typeof e==`boolean`}function l(e){return e instanceof String||typeof e==`string`}function u(e){return e!=null&&(typeof e==`object`||typeof e==`function`)&&!Array.isArray(e)}function d(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function f(e,...t){if(!d(e))throw Error(`Uint8Array expected`);if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length `+t+`, got length=`+e.length)}function p(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function m(e,t){f(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least `+n)}function h(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function g(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function _(e,t){return e<<32-t|e>>>t}var ee=typeof Uint8Array.from([]).toHex==`function`&&typeof Uint8Array.fromHex==`function`,te=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function ne(e){if(f(e),ee)return e.toHex();let t=``;for(let n=0;n<e.length;n++)t+=te[e[n]];return t}function v(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}function y(e){return typeof e==`string`&&(e=v(e)),f(e),e}var re=class{};function b(e){let t=t=>e().update(y(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function ie(e,t,n,r){if(typeof e.setBigUint64==`function`)return e.setBigUint64(t,n,r);let i=BigInt(32),a=BigInt(4294967295),o=Number(n>>i&a),s=Number(n&a),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,s,r)}function ae(e,t,n){return e&t^~e&n}function oe(e,t,n){return e&t^e&n^t&n}var x=class extends re{constructor(e,t,n,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=g(this.buffer)}update(e){p(this),e=y(e),f(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let a=0;a<i;){let o=Math.min(r-this.pos,i-a);if(o===r){let t=g(e);for(;r<=i-a;a+=r)this.process(t,a);continue}n.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){p(this),m(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,h(this.buffer.subarray(a)),this.padOffset>r-a&&(this.process(n,0),a=0);for(let e=a;e<r;e++)t[e]=0;ie(n,r-8,BigInt(this.length*8),i),this.process(n,0);let o=g(e),s=this.outputLen;if(s%4)throw Error(`_sha2: outputLen should be aligned to 32bit`);let c=s/4,l=this.get();if(c>l.length)throw Error(`_sha2: outputLen bigger than state`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:a,pos:o}=this;return e.destroyed=a,e.finished=i,e.length=r,e.pos=o,r%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}},S=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),C=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),w=BigInt(2**32-1),se=BigInt(32);function ce(e,t=!1){return t?{h:Number(e&w),l:Number(e>>se&w)}:{h:Number(e>>se&w)|0,l:Number(e&w)|0}}function le(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a<n;a++){let{h:n,l:o}=ce(e[a],t);[r[a],i[a]]=[n,o]}return[r,i]}var ue=(e,t,n)=>e>>>n,de=(e,t,n)=>e<<32-n|t>>>n,T=(e,t,n)=>e>>>n|t<<32-n,E=(e,t,n)=>e<<32-n|t>>>n,D=(e,t,n)=>e<<64-n|t>>>n-32,O=(e,t,n)=>e>>>n-32|t<<64-n;function k(e,t,n,r){let i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:i|0}}var fe=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),pe=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,me=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),he=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,ge=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0),_e=(e,t,n,r,i,a)=>t+n+r+i+a+(e/2**32|0)|0,ve=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),A=new Uint32Array(64),ye=class extends x{constructor(e=32){super(64,e,8,!1),this.A=S[0]|0,this.B=S[1]|0,this.C=S[2]|0,this.D=S[3]|0,this.E=S[4]|0,this.F=S[5]|0,this.G=S[6]|0,this.H=S[7]|0}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}process(e,t){for(let n=0;n<16;n++,t+=4)A[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=A[e-15],n=A[e-2],r=_(t,7)^_(t,18)^t>>>3;A[e]=(_(n,17)^_(n,19)^n>>>10)+A[e-7]+r+A[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=_(o,6)^_(o,11)^_(o,25),u=l+t+ae(o,s,c)+ve[e]+A[e]|0,d=(_(n,2)^_(n,13)^_(n,22))+oe(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){h(A)}destroy(){this.set(0,0,0,0,0,0,0,0),h(this.buffer)}},be=le(`0x428a2f98d728ae22.0x7137449123ef65cd.0xb5c0fbcfec4d3b2f.0xe9b5dba58189dbbc.0x3956c25bf348b538.0x59f111f1b605d019.0x923f82a4af194f9b.0xab1c5ed5da6d8118.0xd807aa98a3030242.0x12835b0145706fbe.0x243185be4ee4b28c.0x550c7dc3d5ffb4e2.0x72be5d74f27b896f.0x80deb1fe3b1696b1.0x9bdc06a725c71235.0xc19bf174cf692694.0xe49b69c19ef14ad2.0xefbe4786384f25e3.0x0fc19dc68b8cd5b5.0x240ca1cc77ac9c65.0x2de92c6f592b0275.0x4a7484aa6ea6e483.0x5cb0a9dcbd41fbd4.0x76f988da831153b5.0x983e5152ee66dfab.0xa831c66d2db43210.0xb00327c898fb213f.0xbf597fc7beef0ee4.0xc6e00bf33da88fc2.0xd5a79147930aa725.0x06ca6351e003826f.0x142929670a0e6e70.0x27b70a8546d22ffc.0x2e1b21385c26c926.0x4d2c6dfc5ac42aed.0x53380d139d95b3df.0x650a73548baf63de.0x766a0abb3c77b2a8.0x81c2c92e47edaee6.0x92722c851482353b.0xa2bfe8a14cf10364.0xa81a664bbc423001.0xc24b8b70d0f89791.0xc76c51a30654be30.0xd192e819d6ef5218.0xd69906245565a910.0xf40e35855771202a.0x106aa07032bbd1b8.0x19a4c116b8d2d0c8.0x1e376c085141ab53.0x2748774cdf8eeb99.0x34b0bcb5e19b48a8.0x391c0cb3c5c95a63.0x4ed8aa4ae3418acb.0x5b9cca4f7763e373.0x682e6ff3d6b2b8a3.0x748f82ee5defb2fc.0x78a5636f43172f60.0x84c87814a1f0ab72.0x8cc702081a6439ec.0x90befffa23631e28.0xa4506cebde82bde9.0xbef9a3f7b2c67915.0xc67178f2e372532b.0xca273eceea26619c.0xd186b8c721c0c207.0xeada7dd6cde0eb1e.0xf57d4f7fee6ed178.0x06f067aa72176fba.0x0a637dc5a2c898a6.0x113f9804bef90dae.0x1b710b35131c471b.0x28db77f523047d84.0x32caab7b40c72493.0x3c9ebe0a15c9bebc.0x431d67c49c100d4c.0x4cc5d4becb3e42b6.0x597f299cfc657e2a.0x5fcb6fab3ad6faec.0x6c44198c4a475817`.split(`.`).map(e=>BigInt(e))),xe=be[0],Se=be[1],j=new Uint32Array(80),M=new Uint32Array(80),Ce=class extends x{constructor(e=64){super(128,e,16,!1),this.Ah=C[0]|0,this.Al=C[1]|0,this.Bh=C[2]|0,this.Bl=C[3]|0,this.Ch=C[4]|0,this.Cl=C[5]|0,this.Dh=C[6]|0,this.Dl=C[7]|0,this.Eh=C[8]|0,this.El=C[9]|0,this.Fh=C[10]|0,this.Fl=C[11]|0,this.Gh=C[12]|0,this.Gl=C[13]|0,this.Hh=C[14]|0,this.Hl=C[15]|0}get(){let{Ah:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:a,Dh:o,Dl:s,Eh:c,El:l,Fh:u,Fl:d,Gh:f,Gl:p,Hh:m,Hl:h}=this;return[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=r|0,this.Ch=i|0,this.Cl=a|0,this.Dh=o|0,this.Dl=s|0,this.Eh=c|0,this.El=l|0,this.Fh=u|0,this.Fl=d|0,this.Gh=f|0,this.Gl=p|0,this.Hh=m|0,this.Hl=h|0}process(e,t){for(let n=0;n<16;n++,t+=4)j[n]=e.getUint32(t),M[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=j[e-15]|0,n=M[e-15]|0,r=T(t,n,1)^T(t,n,8)^ue(t,n,7),i=E(t,n,1)^E(t,n,8)^de(t,n,7),a=j[e-2]|0,o=M[e-2]|0,s=T(a,o,19)^D(a,o,61)^ue(a,o,6),c=me(i,E(a,o,19)^O(a,o,61)^de(a,o,6),M[e-7],M[e-16]);j[e]=he(c,r,s,j[e-7],j[e-16])|0,M[e]=c|0}let{Ah:n,Al:r,Bh:i,Bl:a,Ch:o,Cl:s,Dh:c,Dl:l,Eh:u,El:d,Fh:f,Fl:p,Gh:m,Gl:h,Hh:g,Hl:_}=this;for(let e=0;e<80;e++){let t=T(u,d,14)^T(u,d,18)^D(u,d,41),ee=E(u,d,14)^E(u,d,18)^O(u,d,41),te=u&f^~u&m,ne=d&p^~d&h,v=ge(_,ee,ne,Se[e],M[e]),y=_e(v,g,t,te,xe[e],j[e]),re=v|0,b=T(n,r,28)^D(n,r,34)^D(n,r,39),ie=E(n,r,28)^O(n,r,34)^O(n,r,39),ae=n&i^n&o^i&o,oe=r&a^r&s^a&s;g=m|0,_=h|0,m=f|0,h=p|0,f=u|0,p=d|0,{h:u,l:d}=k(c|0,l|0,y|0,re|0),c=o|0,l=s|0,o=i|0,s=a|0,i=n|0,a=r|0;let x=fe(re,ie,oe);n=pe(x,y,b,ae),r=x|0}({h:n,l:r}=k(this.Ah|0,this.Al|0,n|0,r|0)),{h:i,l:a}=k(this.Bh|0,this.Bl|0,i|0,a|0),{h:o,l:s}=k(this.Ch|0,this.Cl|0,o|0,s|0),{h:c,l}=k(this.Dh|0,this.Dl|0,c|0,l|0),{h:u,l:d}=k(this.Eh|0,this.El|0,u|0,d|0),{h:f,l:p}=k(this.Fh|0,this.Fl|0,f|0,p|0),{h:m,l:h}=k(this.Gh|0,this.Gl|0,m|0,h|0),{h:g,l:_}=k(this.Hh|0,this.Hl|0,g|0,_|0),this.set(n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_)}roundClean(){h(j,M)}destroy(){h(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},we=b(()=>new ye),Te=b(()=>new Ce),Ee=[`choice`,`score`,`boolean`],De=/^[a-zA-Z0-9_.-]{1,64}$/,Oe=e=>De.test(e),N=e.t(),ke=`trigger`,Ae=e=>{let t=[],n=``,r=!1,i=0;for(;i<e.length;){let a=e[i];if(a===`[`&&!r){n.length>0&&(t.push(n),n=``),r=!0,i++;continue}if(a===`]`&&r){t.push(n),n=``,r=!1,i++,i<e.length&&e[i]===`.`&&i++;continue}if(a===`.`&&!r){n.length>0&&(t.push(n),n=``),i++;continue}n+=a,i++}return n.length>0&&t.push(n),t},je=/{{([^{}]+)}}/g;function*Me(e){if((0,N.isString)(e)){for(let[,t]of e.matchAll(je))n.t(t)&&(yield t);return}if((0,N.isObject)(e))for(let t of Object.values(e))yield*Me(t)}var Ne=e=>[...Me(e)],Pe=(e,t)=>{let n=e.length+1,r=t.length+1,i=Array.from({length:n},()=>Array(r).fill(0));for(let e=0;e<n;e++)i[e][0]=e;for(let e=0;e<r;e++)i[0][e]=e;for(let a=1;a<n;a++){let n=i[a-1],o=i[a];for(let i=1;i<r;i++){let r=e[a-1]===t[i-1]?0:1;o[i]=Math.min(n[i]+1,o[i-1]+1,n[i-1]+r)}}return i[e.length][t.length]},Fe=e=>{if(!n.t(e)||!u(e)||Array.isArray(e))return!1;let t=Object.values(e);return t.length!==0&&t.every(e=>n.t(e)&&u(e)&&c(e.isLeaf))},Ie=(e,t=[])=>{let n=[];if(!(0,N.isObject)(e))return n;for(let[r,i]of Object.entries(e)){if(!(0,N.isObject)(i))continue;let e=[...t,r];n.push(e.join(`.`)),!i.isLeaf&&(0,N.isObject)(i.value)&&n.push(...Ie(i.value,e))}return n},Le=({schema:e,propertyPath:t})=>{let r=e;for(let e=0;e<t.length;e++){let i=t[e];if(!n.t(i))return;if(!(0,N.isObject)(r))return{validPrefix:t.slice(0,e),failedSegment:i,availableKeys:[]};let a=r[i];if(!n.t(a))return{validPrefix:t.slice(0,e),failedSegment:i,availableKeys:Object.keys(r)};if(a.isLeaf){let r=t[e+1];return n.t(r)?{validPrefix:t.slice(0,e+1),failedSegment:r,availableKeys:[]}:void 0}r=a.value}},P={found:!1},F=e=>r.a(e)&&c(e.isLeaf),I=e=>r.a(e)&&e._outputSchemaType===`RECORD`&&r.a(e.fields),Re=e=>r.a(e)&&!(`_outputSchemaType`in e)&&F(e.first)&&e.first.isLeaf===!1&&I(e.first.value)&&F(e.totalCount),L=e=>({found:!0,type:l(e.type)?e.type:void 0,label:l(e.label)?e.label:void 0}),ze=(e,t)=>t.length===0?L(e):R(e.value,t),Be=(e,t)=>{for(let n=1;n<=t.length;n++){let r=e[t.slice(0,n).join(`.`)];if(F(r))return ze(r,t.slice(n))}return P},Ve=(e,t)=>{let[n,...r]=t;if(n===`first`)return r.length===0?L(e.first):R(e.first.value,r);if(n===`all`||n===`totalCount`){let t=e[n];return r.length===0&&F(t)?L(t):P}return P},He=(e,t)=>{let[i,...a]=t;if(!n.t(i))return P;let o=e[i];return F(o)?ze(o,a):n.t(o)?a.length===0?{found:!0}:r.a(o)?He(o,a):P:P},R=(e,t)=>t.length===0||!r.a(e)?P:I(e)?Be(e.fields,t):Re(e)?Ve(e,t):He(e,t),Ue=({schema:e,propertyPath:t})=>R(e,t),z=e=>{let t=[];for(let[i,a]of Object.entries(e))if(F(a)){if(t.push(i),a.isLeaf)continue;let e=a.value;if(I(e))for(let n of z(e.fields))t.push(`${i}.${n}`);else if(r.a(e))for(let n of z(e))t.push(`${i}.${n}`)}else if(n.t(a)&&(t.push(i),r.a(a)))for(let e of z(a))t.push(`${i}.${e}`);return t},B=e=>{if(!r.a(e))return[];if(I(e))return z(e.fields);if(Re(e)){let t=[];if(F(e.first)){t.push(`first`);for(let n of B(e.first.value))t.push(`first.${n}`)}return n.t(e.all)&&t.push(`all`),t.push(`totalCount`),t}return z(e)},We=3,Ge=e=>r.a(e)?e._outputSchemaType===`RECORD`||Object.values(e).some(e=>r.a(e)&&Ge(e.value)):!1,V=(e,t)=>t.map(t=>({candidate:t,distance:Pe(e,t)})).filter(({candidate:e,distance:t})=>t<=Math.ceil(e.length/2)).sort((e,t)=>e.distance-t.distance).slice(0,We).map(({candidate:e})=>e),Ke=({schema:e,propertyPath:t,referencedStepId:r})=>{if(!Fe(e)||Ge(e)){let n=B(e);return V(t.join(`.`),n).map(e=>[r,e].join(`.`))}let i=Le({schema:e,propertyPath:t});if(!n.t(i))return[];let a=V(i.failedSegment,i.availableKeys).map(e=>[r,...i.validPrefix,e].join(`.`));if((0,N.isNonEmptyArray)(a))return a;let o=Ie(e);return V(t.join(`.`),o).map(e=>[r,e].join(`.`))},qe=({workflow:e,graph:t,stepsById:r})=>{let i=[],a=new Set(e.steps?.map(e=>e.id)??[]);for(let o of e.steps??[]){let s=Ne(o.settings?.input),c=t.ancestorsByStepId.get(o.id)??new Set;for(let t of s){let s=Ae(t),l=s[0];if(!n.t(l)){i.push({severity:`error`,code:`VARIABLE_INVALID_PATH`,message:`Step "${o.name??o.id}" has a variable "{{${t}}}" with an invalid path. Variable references must start with a step ID, e.g. "{{stepId.property}}".`,stepId:o.id,path:t});continue}let u=l===ke;if(!u&&!a.has(l)){i.push({severity:`error`,code:`VARIABLE_UNKNOWN_STEP`,message:`Step "${o.name??o.id}" references variable "{{${t}}}" from an unknown step "${l}".`,stepId:o.id,path:t});continue}let d=l===o.id;if(!u&&!d&&!c.has(l)){let e=r.get(l)?.name??l;i.push({severity:`error`,code:`VARIABLE_NOT_UPSTREAM`,message:`Step "${o.name??o.id}" references variable "{{${t}}}" from step "${e}", which does not run before it. Ensure step "${e}" is an ancestor (connected via nextStepIds chain from the trigger, before this step).`,stepId:o.id,path:t});continue}i.push(...Je({step:o,variable:t,pathSegments:s,referencedStepId:l,isTriggerReference:u,trigger:e.trigger,stepsById:r}))}}return i},Je=({step:e,variable:t,pathSegments:r,referencedStepId:i,isTriggerReference:a,trigger:o,stepsById:s})=>{let c=r.slice(1);if(c.length===0)return[];let l=a?o?.settings?.outputSchema:s.get(i)?.settings?.outputSchema,u=n.t(l)&&(0,N.isObject)(l)&&!Array.isArray(l)&&Object.keys(l).length===0;if(!n.t(l)||u)return[];if(!Ue({schema:l,propertyPath:c}).found){let r=Ke({schema:l,propertyPath:c,referencedStepId:i}),a=Xe(l,i),o=(0,N.isNonEmptyArray)(r)?`Did you mean "{{${r[0]}}}"?${r.length>1?` Other options: ${r.slice(1).map(e=>`{{${e}}}`).join(`, `)}.`:``}`:(0,N.isNonEmptyArray)(a)?`Available paths: ${a.map(e=>`{{${e}}}`).join(`, `)}.`:void 0;return[{severity:`error`,code:`VARIABLE_PATH_NOT_FOUND`,message:`Step "${e.name??e.id}" references variable "{{${t}}}" but the path "${c.join(`.`)}" was not found in the output of step "${i}".`,stepId:e.id,path:t,...n.t(o)?{hint:o}:{},...(0,N.isNonEmptyArray)(r)?{suggestions:r}:{},...(0,N.isNonEmptyArray)(a)?{availablePaths:a}:{}}]}return[]},Ye=20,Xe=(e,t)=>B(e).slice(0,Ye).map(e=>`${t}.${e}`),Ze=[1e3,5e3,15e3],H=r.tt({input:r.Q({}).describe(`Input data for the workflow action. Structure depends on the action type.`),outputSchema:r.Q({}).describe(`Schema defining the output data structure. This data can be referenced in subsequent steps using {{stepId.fieldName}}.`),errorHandlingOptions:r.tt({retryOnFailure:r.tt({value:r.nt(e=>typeof e==`boolean`?Number(e):e,r.et().int().min(0).max(Ze.length).describe(`How many times to retry the action if it fails, between 0 and ${Ze.length}. 0 disables retries.`))}),continueOnFailure:r.tt({value:r.K().describe(`Whether to continue to the next step if this action fails.`)})})}),Qe={expectedOutputSchema:r.Q({}).optional().describe(`A sample output value declared by the user for steps whose output structure is only known at runtime.`)},$e=H.extend({input:r.tt({url:r.at(),method:r.H([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`]),headers:r.rt(r.at(),r.at()).optional(),body:r.rt(r.at(),r.st([r.at(),r.et(),r.K(),r.U(),r.G(r.st([r.at(),r.et(),r.K(),r.U()]))])).or(r.at()).optional()}),...Qe}),et=/^[a-zA-Z0-9_-]{1,64}$/,tt=r.tt({id:r.lt().describe(`Stable identifier for this criterion row.`),name:r.at().describe(`Option name for a choice question, or the label of one score level.`),description:r.at().optional().describe(`What the model should understand this option to mean.`)}),nt=r.tt({id:r.lt().describe(`Stable identifier for this question row.`),name:r.at().regex(et,`Answer name must be empty or contain 1 to 64 characters using only letters, digits, underscores and dashes`).or(r.Z(``)).describe(`Answer key for this question, made of letters, digits, underscores and dashes. Downstream steps read {{stepId.answers.<name>}}.`),type:r.H(Ee).describe(`choice picks one option, score grades an ordered rubric, boolean estimates the probability that a statement holds.`),instructions:r.at().describe(`What the model should decide about the shared state.`),criteria:r.G(tt).describe(`Options for a choice question, or ordered levels (lowest first) for a score question. Empty for boolean.`)}),rt=H.extend({input:r.tt({state:r.at().describe(`The shared state every question is asked about. Supports variables.`),questions:r.G(nt)})}),it=H.extend({input:r.tt({items:r.st([r.G(r.st([r.at(),r.et(),r.K(),r.U(),r.rt(r.at(),r.W()),r.W()])),r.at()]).optional(),initialLoopStepIds:r.G(r.at()).optional(),shouldContinueOnIterationFailure:r.K().optional()})}),at=H.extend({input:r.tt({delayType:r.H([`SCHEDULED_DATE`,`DURATION`]),scheduledDateTime:r.at().nullable().optional(),duration:r.tt({days:r.st([r.et().min(0),r.at()]).optional(),hours:r.st([r.et().min(0),r.at()]).optional(),minutes:r.st([r.et().min(0),r.at()]).optional(),seconds:r.st([r.et().min(0),r.at()]).optional()}).optional()})}),ot=H.extend({input:r.tt({eventName:r.at().describe(`Event to wait for, in format objectName.action (e.g., "company.updated", "task.created", "person.deleted").`),recordId:r.at().nullable().optional().describe(`Only resume for this record. Usually a variable such as {{trigger.properties.after.id}}. Leave empty to resume on any record.`),updatedFields:r.G(r.at()).nullable().optional().describe(`For update events, only resume when one of these fields changed.`),timeout:r.tt({days:r.st([r.et().min(0),r.at()]).optional(),hours:r.st([r.et().min(0),r.at()]).optional(),minutes:r.st([r.et().min(0),r.at()]).optional()}).nullable().optional().describe(`Stop waiting after this duration. The step then succeeds with hasTimedOut set to true.`)})}),st=H.extend({input:r.tt({})}),U=r.rt(r.at(),r.W()).describe(`Record data object. Use nested objects for relationships (e.g., "company": {"id": "{{reference}}"}). Common patterns:
2
- - Person: {"name": {"firstName": "John", "lastName": "Doe"}, "emails": {"primaryEmail": "john@example.com"}, "company": {"id": "{{trigger.properties.after.id}}"}}
3
- - Company: {"name": "Acme Corp", "domainName": {"primaryLinkUrl": "https://acme.com"}}
4
- - Task: {"title": "Follow up", "status": "TODO", "assignee": {"id": "{{user.id}}"}}`),ct=H.extend({input:r.tt({objectName:r.at().describe(`The name of the object to create a record in. Must be lowercase (e.g., "person", "company", "task").`),objectRecord:U.describe(`The record data to create.`)})}),lt=H.extend({input:r.tt({objectName:r.at(),objectRecord:U,objectRecordId:r.at(),fieldsToUpdate:r.G(r.at())})}),ut=H.extend({input:r.tt({objectName:r.at(),objectRecord:U})}),dt=H.extend({input:r.tt({objectName:r.at(),objectRecordId:r.at()})}),ft=r.tt({id:r.at(),logicalOperator:r.H(r.L),parentRecordFilterGroupId:r.at().nullable().optional(),positionInRecordFilterGroup:r.et().nullable().optional()}),pt=r.tt({id:r.at().optional(),fieldMetadataId:r.at(),operand:r.H(r.g),value:r.at().nullable().optional(),recordFilterGroupId:r.at().nullable().optional(),positionInRecordFilterGroup:r.et().nullable().optional(),subFieldName:r.at().nullable().optional(),relationTargetFieldMetadataId:r.at().nullable().optional()}),W=r.at().regex(/^{{[^{}]+}}$/,`Expected a workflow variable reference like {{stepId.path}}`),mt=H.extend({input:r.tt({objectName:r.at(),limit:r.st([r.et(),W]).optional(),offset:r.st([r.et().int().nonnegative(),W]).optional(),filter:r.tt({recordFilterGroups:r.G(ft).optional(),recordFilters:r.G(pt).optional()}).optional(),orderBy:r.tt({recordSorts:r.G(r.W()).optional(),gqlOperationOrderBy:r.G(r.rt(r.at(),r.W())).optional()}).optional()})}),ht=r.tt({id:r.at(),name:r.at(),label:r.at(),type:r.st([r.Z(r.I.TEXT),r.Z(r.I.NUMBER),r.Z(r.I.DATE),r.Z(r.I.SELECT),r.Z(r.I.MULTI_SELECT),r.Z(`RECORD`)]),placeholder:r.at().optional(),settings:r.rt(r.at(),r.W()).optional(),value:r.W().optional()}),gt=H.extend({input:r.G(ht),instructions:r.at().optional()}),G=r.tt({id:r.at(),logicalOperator:r.H(r._),parentStepFilterGroupId:r.at().optional(),positionInStepFilterGroup:r.et().optional()}),K=r.tt({id:r.at(),type:r.at(),stepOutputKey:r.at(),operand:r.H(r.g).or(r.H(r.C)),value:r.at(),stepFilterGroupId:r.at(),positionInStepFilterGroup:r.et().optional(),fieldMetadataId:r.at().optional(),compositeFieldSubFieldName:r.at().optional(),isFullRecord:r.K().optional()}),_t=H.extend({input:r.tt({stepFilterGroups:r.G(G),stepFilters:r.G(K)})}),vt=r.tt({id:r.at(),nextStepIds:r.G(r.at()),filterGroupId:r.at().optional()}),yt=H.extend({input:r.tt({stepFilterGroups:r.G(G),stepFilters:r.G(K),branches:r.G(vt)})}),bt=r.tt({id:r.at().refine(e=>t.u(e)),name:r.at(),size:r.et(),type:r.at(),createdAt:r.at()}),xt=r.G(r.st([bt,W.describe(`A workflow variable reference resolving to files`)])),St=H.extend({input:r.tt({connectedAccountId:r.at(),fromHandle:r.at().trim().optional(),recipients:r.tt({to:r.at().optional(),cc:r.at().optional(),bcc:r.at().optional()}),subject:r.at().optional(),body:r.at().optional().describe(`The email body as a serialized email document: JSON.stringify of {"type":"doc","attrs":{"schemaVersion":1},"content":[...]} with paragraph, heading, bulletList, orderedList, image, button, divider and html blocks. Use {{stepId.field}} for variables. To send a complete HTML email verbatim, including HTML produced by an earlier step such as {{stepId.html}}, make the body a single htmlDocument block ({"type":"htmlDocument","attrs":{"html":"..."}}): it is sent without the email layout and its variables are inserted as raw HTML, while an html block is embedded in the layout with escaped variables. HTML or plain text strings are rejected.`),files:xt.optional(),inReplyTo:r.at().trim().optional()})}),Ct=H.extend({input:r.tt({connectedAccountId:r.at(),title:r.at(),description:r.at().optional(),location:r.at().optional(),startsAt:r.at(),endsAt:r.at(),isFullDay:r.K(),timeZone:r.at().optional(),attendees:r.at().optional(),sendInvitations:r.K(),addConferencing:r.K()})}),wt=r.tt({type:r.Z(`object`),properties:r.rt(r.at(),r.tt({type:r.H([`string`,`number`,`boolean`]),description:r.at().optional()})).refine(e=>Object.keys(e).every(Oe),{message:`Output field names can only contain letters, numbers, underscores, dots or hyphens (max 64 characters)`}),required:r.G(r.at()).optional(),additionalProperties:r.Z(!1).optional()}),Tt=r.q(`type`,[r.tt({type:r.Z(`text`)}),r.tt({type:r.Z(`json`),schema:wt})]),Et=r.H([`RUN`,`STEP`,`KEY`]),Dt=r.tt({scope:Et,key:r.at().optional()}),Ot=H.extend({input:r.tt({agentId:r.at(),prompt:r.at().optional(),responseFormat:Tt.optional(),humanInputInstructions:r.at().optional(),workspaceMemberId:r.at().optional(),conversation:Dt.optional()})}),kt=H.extend({input:r.tt({workspaceMemberId:r.at(),title:r.at(),text:r.at(),toolCall:r.tt({toolName:r.at(),arguments:r.rt(r.at(),r.W())}).optional(),conversation:Dt.optional()})}),At=r.H([`RANDOM`,`ROUND_ROBIN`,`LOAD_BALANCED`]);H.extend({input:r.tt({objectName:r.at(),strategy:At,recordIds:r.G(r.at()),loadBalance:r.tt({objectNameSingular:r.at(),fieldName:r.at()}).optional()}).superRefine((e,t)=>{e.strategy===`LOAD_BALANCED`&&!n.t(e.loadBalance)&&t.addIssue({code:a.custom,path:[`loadBalance`],message:`loadBalance is required when strategy is LOAD_BALANCED`})})});var jt=r.tt({name:r.at().optional().describe(`Human-readable name for the trigger. Optional but recommended for clarity.`),type:r.H([`DATABASE_EVENT`,`MANUAL`,`CRON`,`WEBHOOK`]).describe(`Type of trigger. DATABASE_EVENT for record changes, MANUAL for user-initiated, CRON for scheduled, WEBHOOK for external calls.`),position:r.tt({x:r.et(),y:r.et()}).optional().nullable().describe(`Position coordinates for the trigger in the workflow diagram. Use (0, 0) for the trigger step.`),nextStepIds:r.G(r.at()).optional().nullable().describe(`Array of step IDs that the trigger connects to. These are the first steps in the workflow.`)}),Mt=jt.extend({type:r.Z(`CRON`),settings:r.q(`type`,[r.tt({type:r.Z(`DAYS`),schedule:r.tt({day:r.et().min(1),hour:r.et().min(0).max(23),minute:r.et().min(0).max(59)}),outputSchema:r.Q({})}),r.tt({type:r.Z(`HOURS`),schedule:r.tt({hour:r.et().min(1),minute:r.et().min(0).max(59)}),outputSchema:r.Q({})}),r.tt({type:r.Z(`MINUTES`),schedule:r.tt({minute:r.et().min(1).max(60)}),outputSchema:r.Q({})}),r.tt({type:r.Z(`CUSTOM`),pattern:r.at(),outputSchema:r.Q({})})])}),Nt=jt.extend({type:r.Z(`WEBHOOK`),settings:r.q(`httpMethod`,[r.tt({outputSchema:r.Q({}),httpMethod:r.Z(`GET`),authentication:r.Z(`API_KEY`).nullable()}),r.tt({outputSchema:r.Q({}),expectedOutputSchema:r.Q({}).optional(),httpMethod:r.Z(`POST`),expectedBody:r.Q({}),authentication:r.Z(`API_KEY`).nullable()})])}),q=function(e){return e.CODE=`CODE`,e.LOGIC_FUNCTION=`LOGIC_FUNCTION`,e.SEND_EMAIL=`SEND_EMAIL`,e.SEND_CHAT_MESSAGE=`SEND_CHAT_MESSAGE`,e.DRAFT_EMAIL=`DRAFT_EMAIL`,e.CREATE_CALENDAR_EVENT=`CREATE_CALENDAR_EVENT`,e.CREATE_RECORD=`CREATE_RECORD`,e.UPDATE_RECORD=`UPDATE_RECORD`,e.DELETE_RECORD=`DELETE_RECORD`,e.UPSERT_RECORD=`UPSERT_RECORD`,e.FIND_RECORDS=`FIND_RECORDS`,e.PICK_RECORD=`PICK_RECORD`,e.FORM=`FORM`,e.FILTER=`FILTER`,e.IF_ELSE=`IF_ELSE`,e.HTTP_REQUEST=`HTTP_REQUEST`,e.AI_AGENT=`AI_AGENT`,e.CLASSIFY=`CLASSIFY`,e.ITERATOR=`ITERATOR`,e.EMPTY=`EMPTY`,e.DELAY=`DELAY`,e.WAIT_FOR_EVENT=`WAIT_FOR_EVENT`,e}({}),Pt=e=>{let t=e.settings?.input;return e.type===q.IF_ELSE&&(0,N.isObject)(t)&&`branches`in t&&Array.isArray(t.branches)},Ft=e=>{let t=e.settings?.input;return e.type===q.ITERATOR&&(0,N.isObject)(t)&&`initialLoopStepIds`in t&&(0,N.isNonEmptyArray)(t.initialLoopStepIds)},It=e=>{let t=e.settings?.input;if(n.t(t)&&(0,N.isObject)(t))return t},Lt=e=>{let t=new Set(e.nextStepIds??[]);if(Pt(e))for(let n of e.settings.input.branches??[])for(let e of n?.nextStepIds??[])t.add(e);if(Ft(e))for(let n of e.settings.input.initialLoopStepIds??[])t.add(n);return[...t]},Rt=({trigger:e,steps:t})=>{let r=new Map,i=n.t(e?.nextStepIds)?e.nextStepIds.filter(n.t):[];r.set(ke,i);for(let e of t??[])r.set(e.id,Lt(e));let a=new Set,o=[ke];for(;o.length>0;){let e=o.shift();if(!(!n.t(e)||a.has(e))){a.add(e);for(let t of r.get(e)??[])a.has(t)||o.push(t)}}return{childrenByStepId:r,reachableFromTrigger:a,ancestorsByStepId:zt(r)}},zt=e=>{let t=new Map;for(let[n,r]of e.entries())for(let e of r){let r=t.get(e)??new Set;r.add(n),t.set(e,r)}let n=new Map;for(let r of e.keys()){if(n.has(r))continue;let e=new Set,i=[...t.get(r)??[]];for(;i.length>0;){let n=i.shift();if(!e.has(n)){e.add(n);for(let r of t.get(n)??[])e.has(r)||i.push(r)}}n.set(r,e)}return n},Bt=({workflow:e,graph:t})=>{let r=[],i=new Set,a=new Set,o=new Map((e.steps??[]).map(e=>[e.id,e])),s=(e,c=[],l)=>{let u=c[c.length-1];if(i.has(e)){if(e!==l&&u===e)return;r.push({severity:`error`,code:`WORKFLOW_CYCLE`,stepId:e,message:`Workflow contains a cycle at step ${e}`});return}let d=o.get(e),f=`${e}:${c.join(`,`)}`;if(!n.t(d)||a.has(f))return;i.add(e),Ft(d)&&(d.settings.input.initialLoopStepIds??[]).forEach(t=>s(t,[...c,e],e));let p=d.type===q.ITERATOR?d.nextStepIds??[]:t.childrenByStepId.get(e)??[];n.t(u)&&p.length===0&&r.push({severity:`error`,code:`ITERATOR_MISSING_RETURN`,stepId:e,message:`Loop body step ${e} must return to iterator ${u}`}),p.forEach(t=>s(t,c,e)),i.delete(e),a.add(f)};return e.trigger?.nextStepIds?.forEach(e=>s(e)),r},Vt=({workflow:e,graph:r})=>{let i=[],a=e.steps??[],o=new Set(a.map(e=>e.id)),s=new Set;for(let e of a)s.has(e.id)&&i.push({severity:`error`,code:`DUPLICATE_STEP_ID`,message:`Duplicate step id "${e.id}". Every step id must be unique within the workflow.`,stepId:e.id}),s.add(e.id);let c=(e.trigger?.nextStepIds??[]).filter(n.t);t.n(a)&&c.length===0&&i.push({severity:`error`,code:`TRIGGER_HAS_NO_NEXT_STEP`,message:`The trigger is not connected to any step. The trigger must have a "nextStepIds" array pointing to the first step (e.g. nextStepIds: ["${a[0].id}"]). If you used edges, also set trigger.nextStepIds.`});for(let e of c)o.has(e)||i.push({severity:`error`,code:`DANGLING_REFERENCE`,message:`The trigger references a non-existent step "${e}".`});for(let e of a){for(let t of r.childrenByStepId.get(e.id)??[])o.has(t)||i.push({severity:`error`,code:`DANGLING_REFERENCE`,message:`Step "${e.name??e.id}" references a non-existent step "${t}".`,stepId:e.id});i.push(...Ht(e))}for(let e of a)r.reachableFromTrigger.has(e.id)||i.push({severity:`error`,code:`UNREACHABLE_STEP`,message:`Step "${e.name??e.id}" is not reachable from the trigger. Ensure a chain of nextStepIds connects the trigger to this step. Check that the preceding step includes this step's id ("${e.id}") in its nextStepIds array.`,stepId:e.id});return i},Ht=e=>{let t=[],r=It(e);if(e.type===q.IF_ELSE){let i=r?.branches,a=Array.isArray(i)?i:[];a.length<2&&t.push({severity:`warning`,code:`IF_ELSE_INSUFFICIENT_BRANCHES`,message:`If/Else step "${e.name??e.id}" should have at least two branches (a condition branch and an else branch).`,stepId:e.id});let o=r?.stepFilterGroups,s=new Set((Array.isArray(o)?o:[]).filter(n.t).map(e=>e.id));for(let r of a){let i=r?.nextStepIds;(!Array.isArray(i)||i.length===0)&&t.push({severity:`error`,code:`IF_ELSE_BRANCH_HAS_NO_NEXT_STEP`,message:`A branch of If/Else step "${e.name??e.id}" is not connected to any step.`,stepId:e.id}),n.t(r?.filterGroupId)&&!s.has(r.filterGroupId)&&t.push({severity:`error`,code:`INVALID_STEP_PARAMS`,message:`A branch of If/Else step "${e.name??e.id}" references filter group "${r.filterGroupId}", which does not exist.`,stepId:e.id})}}if(e.type===q.ITERATOR){let n=r,i=n?.items,a=typeof i==`string`&&i.length>0||Array.isArray(i)&&i.length>0,o=n?.initialLoopStepIds,s=Array.isArray(o)&&o.length>0;a&&!s&&t.push({severity:`error`,code:`ITERATOR_MISSING_LOOP_BODY`,message:`Iterator step "${e.name??e.id}" has items to iterate over but no steps inside the loop.`,stepId:e.id})}return t};r.c;var J=function(e){return e.OK=`OK`,e.SUCCESS=`SUCCESS`,e.INFO=`INFO`,e.WARNING=`WARNING`,e.ERROR=`ERROR`,e.NEUTRAL=`NEUTRAL`,e.UNKNOWN=`UNKNOWN`,e}({});Object.values(J).filter(e=>e!==J.OK&&e!==J.UNKNOWN),r.I.TEXT,r.I.ARRAY,r.I.BOOLEAN,r.I.DATE,r.I.DATE_TIME,r.I.NUMBER,r.I.NUMERIC,r.I.RAW_JSON,r.I.RICH_TEXT,r.I.SELECT,r.I.MULTI_SELECT;var Ut=`dependencies/yarn.lock`,Wt=`public`,Gt=`front-component-shared-dependencies.mjs`;r.D.RECORD_PAGE,r.D.DASHBOARD;var Y={CALL_RECORDER:`8da4b8b5-5edf-4880-b51f-ab6e679ec617`,EXA:`2b7f4a2e-9c4b-4a11-b63c-2e5e7d3f5a9a`,FATHOM:`c5fb24b3-15b0-48fb-a9b5-f182ba231e6c`,GRANOLA:`ffcc3979-0ee6-4d7d-912b-c12997d9f0f4`,LAST_CONTACT:`66a504cc-0a75-410e-a43f-cdeae1db1522`,PEOPLE_DATA_LABS:`4a1178c1-3535-4a47-b592-231d3216b36f`,SLACK:`a8c47f21-3b9e-4d2a-8f61-9c0e7d4a2b51`,TEAMS:`5955f8fe-6724-4749-b770-b849d63d5330`};Y.SLACK,Y.TEAMS,Y.FATHOM;var Kt={js:`import { createRequire as __createRequire } from 'module';
5
- const require = __createRequire(import.meta.url);`},qt=`.twenty/output`,Jt=({applicationUniversalIdentifier:e,roleUniversalIdentifier:t,fieldUniversalIdentifier:n})=>i.u({entityNamespace:`fieldPermission`,value:`${t}:${n}`,applicationUniversalIdentifier:e}),Yt=({applicationUniversalIdentifier:e,roleUniversalIdentifier:t,objectUniversalIdentifier:n})=>i.u({entityNamespace:`objectPermission`,value:`${t}:${n}`,applicationUniversalIdentifier:e}),Xt=({objectMetadataApplicationUniversalIdentifier:e,objectUniversalIdentifier:t})=>i.t({applicationUniversalIdentifier:e,objectUniversalIdentifier:t,name:r.D.RECORD_FORM}),Zt=({pageLayoutTabManifest:e,pageLayoutType:i})=>{let a=e.layoutMode??(i===r.D.STANDALONE_PAGE?r.R.VERTICAL_LIST:r.R.GRID),o=e.widgets??[],s=[];if(!Object.values(r.R).some(e=>e===a))return{status:`fail`,errors:[`Page layout tab "${e.title}" defines unsupported layoutMode "${a}". Expected GRID, VERTICAL_LIST or CANVAS.`]};for(let t of o){let i=[t.heightBehavior,r.a(t.position)&&`heightBehavior`in t.position?t.position.heightBehavior:void 0].filter(n.t);i.length>0&&a!==r.R.VERTICAL_LIST&&s.push(`Page layout widget "${t.title}" defines heightBehavior, but its parent tab "${e.title}" uses ${a}. heightBehavior is only supported for VERTICAL_LIST tabs.`);for(let e of i)Object.values(r.x).some(t=>t===e)||s.push(`Page layout widget "${t.title}" defines unsupported heightBehavior "${e}". Expected FIT_CONTENT or TAB_VIEWPORT.`)}if(s.length>0)return{status:`fail`,errors:s};let c={...e,layoutMode:a,widgets:o.map(({heightBehavior:e,position:i,gridPosition:o,...s},c)=>{if(n.t(i))return{...s,position:i.layoutMode===r.R.VERTICAL_LIST&&n.t(e)?{...i,heightBehavior:e}:i};if(n.t(o))return{...s,position:{layoutMode:r.R.GRID,...o}};switch(a){case r.R.GRID:return{...s,position:{layoutMode:a,row:0,column:0,rowSpan:r.l.default.h,columnSpan:r.l.default.w}};case r.R.VERTICAL_LIST:return{...s,position:{layoutMode:a,index:c,...n.t(e)?{heightBehavior:e}:{}}};case r.R.CANVAS:return{...s,position:{layoutMode:a}};default:return t.t(a)}})};for(let e of c.widgets)e.position.layoutMode!==a&&s.push(`Page layout widget "${e.title}" uses a ${e.position.layoutMode} position, but its parent tab "${c.title}" uses ${a}.`);if(a===r.R.VERTICAL_LIST){let e=c.widgets.filter(({type:e,position:n})=>n.layoutMode===r.R.VERTICAL_LIST&&t.i({widgetType:e,heightBehavior:n.heightBehavior})===r.x.TAB_VIEWPORT);e.length>1&&s.push(`Page layout tab "${c.title}" can contain only one TAB_VIEWPORT widget.`);let i=e.length===1?e[0]:void 0;n.t(i)&&c.widgets.some(e=>e!==i&&e.position.layoutMode===r.R.VERTICAL_LIST&&i.position.layoutMode===r.R.VERTICAL_LIST&&e.position.index>=i.position.index)&&s.push(`Page layout tab "${c.title}" must place its TAB_VIEWPORT widget last.`)}return s.length>0?{status:`fail`,errors:s}:{status:`success`,pageLayoutTab:c}},Qt=[`canReadObjectRecords`,`canUpdateObjectRecords`,`canSoftDeleteObjectRecords`,`canDestroyObjectRecords`],$t=e=>ne(Te(v(e))).slice(0,32),en=e=>$t(JSON.stringify(JSON.parse(e))),X={canReadObjectRecords:`canReadAllObjectRecords`,canUpdateObjectRecords:`canUpdateAllObjectRecords`,canSoftDeleteObjectRecords:`canSoftDeleteAllObjectRecords`,canDestroyObjectRecords:`canDestroyAllObjectRecords`},tn=({role:e,objectUniversalIdentifier:t})=>{let n=e.objectPermissions?.find(e=>e.objectUniversalIdentifier===t);return{canReadObjectRecords:n?.canReadObjectRecords??e[X.canReadObjectRecords]??!1,canUpdateObjectRecords:n?.canUpdateObjectRecords??e[X.canUpdateObjectRecords]??!1,canSoftDeleteObjectRecords:n?.canSoftDeleteObjectRecords??e[X.canSoftDeleteObjectRecords]??!1,canDestroyObjectRecords:n?.canDestroyObjectRecords??e[X.canDestroyObjectRecords]??!1}},nn=e=>JSON.stringify(e,(e,t)=>r.a(t)?Object.fromEntries(Object.entries(t).sort(([e],[t])=>e.localeCompare(t))):t),rn=({groupsByUniversalIdentifier:e,predicateGroupUniversalIdentifier:t})=>{let r=[],i=new Set,a=t;for(;n.t(a)&&!i.has(a);){i.add(a);let t=e.get(a);if(!n.t(t))break;r.push(t.logicalOperator),a=t.parentPredicateGroupUniversalIdentifier}return r},an=({role:e,objectUniversalIdentifier:t})=>{let n=new Map((e.rowLevelPermissionPredicateGroups??[]).map(e=>[e.universalIdentifier,e]));return(e.rowLevelPermissionPredicates??[]).filter(e=>e.objectUniversalIdentifier===t).map(e=>nn({fieldUniversalIdentifier:e.fieldUniversalIdentifier,subFieldName:e.subFieldName??null,operand:e.operand,value:e.value??null,workspaceMemberFieldUniversalIdentifier:e.workspaceMemberFieldUniversalIdentifier??null,workspaceMemberSubFieldName:e.workspaceMemberSubFieldName??null,groupOperatorPath:rn({groupsByUniversalIdentifier:n,predicateGroupUniversalIdentifier:e.predicateGroupUniversalIdentifier})})).sort()},on=r.n.map(e=>r.i[e]),sn=({roleSignature:e,supersetSignature:t})=>e.length===t.length&&e.every((e,n)=>e===t[n]),cn=({role:e,superset:t})=>[...Qt.filter(n=>{let r=X[n];return e[r]&&!t[r]}).map(e=>({type:`ALL_OBJECT_RECORDS`,action:e})),...e.canUpdateAllSettings&&!t.canUpdateAllSettings?[{type:`ALL_SETTINGS`}]:[],...e.canAccessAllTools&&!t.canAccessAllTools?[{type:`ALL_TOOLS`}]:[]],ln=({role:e,superset:t,toolPermissionFlagUniversalIdentifiers:n})=>{let r=new Set([...on,...n]),i=new Set(t.permissionFlagUniversalIdentifiers??[]);return[...new Set(e.permissionFlagUniversalIdentifiers??[])].filter(e=>!(r.has(e)?t.canAccessAllTools:t.canUpdateAllSettings)&&!i.has(e)).map(e=>({type:`PERMISSION_FLAG`,permissionFlagUniversalIdentifier:e}))},un=({role:e,superset:t})=>[...new Set([...[...e.objectPermissions??[],...t.objectPermissions??[]].map(e=>e.objectUniversalIdentifier),...(t.rowLevelPermissionPredicates??[]).map(e=>e.objectUniversalIdentifier)])].flatMap(n=>{let r=tn({role:e,objectUniversalIdentifier:n}),i=tn({role:t,objectUniversalIdentifier:n}),a=Qt.filter(e=>r[e]&&!i[e]).map(e=>({type:`OBJECT_RECORDS`,objectUniversalIdentifier:n,action:e})),o=Qt.some(e=>r[e]),s=an({role:t,objectUniversalIdentifier:n}),c=an({role:e,objectUniversalIdentifier:n});return o&&s.length>0&&!sn({roleSignature:c,supersetSignature:s})?[...a,{type:`ROW_LEVEL_RESTRICTION`,objectUniversalIdentifier:n}]:a}),dn=({role:e,superset:t})=>(t.fieldPermissions??[]).flatMap(t=>{let{objectUniversalIdentifier:n,fieldUniversalIdentifier:r}=t,i=tn({role:e,objectUniversalIdentifier:n}),a=e.fieldPermissions?.find(e=>e.objectUniversalIdentifier===n&&e.fieldUniversalIdentifier===r),o=t.canReadFieldValue===!1&&i.canReadObjectRecords&&a?.canReadFieldValue!==!1,s=t.canUpdateFieldValue===!1&&i.canUpdateObjectRecords&&a?.canUpdateFieldValue!==!1;return[...o?[{type:`FIELD_VALUE`,objectUniversalIdentifier:n,fieldUniversalIdentifier:r,action:`canReadFieldValue`}]:[],...s?[{type:`FIELD_VALUE`,objectUniversalIdentifier:n,fieldUniversalIdentifier:r,action:`canUpdateFieldValue`}]:[]]}),fn=({role:e,superset:t,toolPermissionFlagUniversalIdentifiers:n})=>[...cn({role:e,superset:t}),...ln({role:e,superset:t,toolPermissionFlagUniversalIdentifiers:n}),...un({role:e,superset:t}),...dn({role:e,superset:t})],pn=e=>i.p(e)&&s(e)>=4,mn=r.tt({x:r.et(),y:r.et()}),hn={universalIdentifier:r.lt(),name:r.at().min(1),nextStepIds:r.G(r.lt()),position:mn.nullable().optional(),outputSchema:r.rt(r.at(),r.ct()).optional(),expectedOutputSchema:r.rt(r.at(),r.ct()).optional(),errorHandlingOptions:H.shape.errorHandlingOptions.optional()},Z=(e,t)=>r.it({...hn,type:r.Z(e),input:t}),gn=r.Q({fieldMetadataUniversalIdentifier:r.lt(),fieldMetadataId:r.$().optional()}),_n=K.omit({fieldMetadataId:!0}).extend({fieldMetadataUniversalIdentifier:r.lt().optional()}).strict(),vn=pt.omit({fieldMetadataId:!0,relationTargetFieldMetadataId:!0}).extend({fieldMetadataUniversalIdentifier:r.lt()}).strict(),Q={objectUniversalIdentifier:r.lt()},yn={connectedAccountId:r.at().optional(),connectedAccountHandle:r.at().trim().min(1).optional()},bn=(e,t)=>{n.t(e.connectedAccountId)===n.t(e.connectedAccountHandle)&&t.addIssue({code:`custom`,path:[`connectedAccountHandle`],message:`Set exactly one of connectedAccountId and connectedAccountHandle`})},xn=St.shape.input.extend(yn).superRefine(bn),Sn=[r.it({...hn,type:r.Z(`LOGIC_FUNCTION`),logicFunctionUniversalIdentifier:r.lt(),input:r.rt(r.at(),r.ct())}),Z(`HTTP_REQUEST`,$e.shape.input),Z(`CLASSIFY`,rt.shape.input),Z(`ITERATOR`,it.shape.input),Z(`DELAY`,at.shape.input),Z(`WAIT_FOR_EVENT`,ot.shape.input),Z(`EMPTY`,st.shape.input),Z(`CREATE_RECORD`,ct.shape.input.omit({objectName:!0}).extend(Q).strict()),Z(`UPDATE_RECORD`,lt.shape.input.omit({objectName:!0}).extend(Q).strict()),Z(`UPSERT_RECORD`,ut.shape.input.omit({objectName:!0}).extend(Q).strict()),Z(`DELETE_RECORD`,dt.shape.input.omit({objectName:!0}).extend(Q).strict()),Z(`FIND_RECORDS`,mt.shape.input.omit({objectName:!0,filter:!0,orderBy:!0}).extend({...Q,filter:r.it({recordFilterGroups:r.G(ft).optional(),recordFilters:r.G(vn).optional()}).optional(),orderBy:r.it({recordSorts:r.G(gn.extend({direction:r.H([`ASC`,`DESC`]),subFieldName:r.at().nullable().optional()})).optional()}).optional()}).strict()),Z(`PICK_RECORD`,r.it({...Q,strategy:At,recordIds:r.G(r.at()),loadBalance:r.it({objectUniversalIdentifier:r.lt(),fieldUniversalIdentifier:r.lt()}).optional()}).superRefine((e,t)=>{e.strategy===`LOAD_BALANCED`&&!n.t(e.loadBalance)&&t.addIssue({code:`custom`,path:[`loadBalance`],message:`loadBalance is required when strategy is LOAD_BALANCED`})})),Z(`FILTER`,_t.shape.input.extend({stepFilters:r.G(_n)})),Z(`IF_ELSE`,yt.shape.input.extend({stepFilters:r.G(_n)})),Z(`FORM`,r.G(gt.shape.input.element.extend({settings:r.rt(r.at(),r.ct()).optional()}).superRefine((e,t)=>{e.type===`RECORD`&&!r.lt().safeParse(e.settings?.objectUniversalIdentifier).success&&t.addIssue({code:`custom`,path:[`settings`,`objectUniversalIdentifier`],message:`Record picker fields require an object universal identifier`}),(e.type===`SELECT`||e.type===`MULTI_SELECT`)&&!r.lt().safeParse(e.settings?.selectedFieldUniversalIdentifier).success&&t.addIssue({code:`custom`,path:[`settings`,`selectedFieldUniversalIdentifier`],message:`Select fields require the universal identifier of the field whose options they offer`})}))),Z(`SEND_EMAIL`,xn),Z(`DRAFT_EMAIL`,xn),Z(`CREATE_CALENDAR_EVENT`,Ct.shape.input.extend(yn).superRefine(bn)),Z(`SEND_CHAT_MESSAGE`,kt.shape.input),Z(`AI_AGENT`,Ot.shape.input.omit({agentId:!0}).extend({agentUniversalIdentifier:r.lt()}).strict())],Cn=Sn.map(e=>e.shape.type.value),wn=r.q(`type`,Sn,{error:e=>e.code===`invalid_union`?`Unsupported step type. Application workflows support: ${Cn.join(`, `)}`:void 0}),Tn=[`updated`,`upserted`],En=r.q(`type`,[r.it({type:r.Z(`GLOBAL`)}),r.it({type:r.Z(`SINGLE_RECORD`),objectUniversalIdentifier:r.lt()}),r.it({type:r.Z(`BULK_RECORDS`),objectUniversalIdentifier:r.lt()})]),[Dn,On,kn,An]=Mt.shape.settings.options,jn=r.q(`type`,[Dn.omit({outputSchema:!0}).extend({schedule:Dn.shape.schedule.strict()}).strict(),On.omit({outputSchema:!0}).extend({schedule:On.shape.schedule.strict()}).strict(),kn.omit({outputSchema:!0}).extend({schedule:kn.shape.schedule.strict()}).strict(),An.omit({outputSchema:!0}).strict()]),[Mn,Nn]=Nt.shape.settings.options,Pn=r.q(`httpMethod`,[Mn.omit({outputSchema:!0,authentication:!0}).strict(),Nn.omit({outputSchema:!0,expectedOutputSchema:!0,authentication:!0}).strict()]),$={universalIdentifier:r.lt().optional(),name:r.at().min(1).optional(),nextStepIds:r.G(r.lt()).min(1),position:mn.nullable().optional(),outputSchema:r.rt(r.at(),r.ct()).optional()},Fn=[r.it({...$,type:r.Z(`MANUAL`),settings:r.it({availability:En.optional(),icon:r.at().optional(),isPinned:r.K().optional()}).superRefine((e,t)=>{!n.t(e.availability)&&(n.t(e.icon)||n.t(e.isPinned))&&t.addIssue({code:`custom`,path:[`availability`],message:`Set an availability for the icon and pin to show in the command menu`})}).optional()}),r.it({...$,type:r.Z(`CRON`),settings:jn}),r.it({...$,type:r.Z(`DATABASE_EVENT`),settings:r.it({objectUniversalIdentifier:r.lt(),action:r.H([`created`,`updated`,`deleted`,`upserted`]),fieldUniversalIdentifiers:r.G(r.lt()).optional(),filter:r.it({stepFilterGroups:r.G(G),stepFilters:r.G(_n.extend({operand:r.H(r.g)}))}).optional()}).superRefine((e,r)=>{if(t.n(e.fieldUniversalIdentifiers)&&!Tn.includes(e.action)&&r.addIssue({code:`custom`,path:[`fieldUniversalIdentifiers`],message:`Watched fields only apply to ${Tn.join(` and `)} events`}),!n.t(e.filter))return;let i=new Map;e.filter.stepFilterGroups.forEach((e,t)=>{i.has(e.id)&&r.addIssue({code:`custom`,path:[`filter`,`stepFilterGroups`,t,`id`],message:`Filter group ${e.id} is declared more than once`}),i.set(e.id,e.parentStepFilterGroupId)}),e.filter.stepFilterGroups.forEach((e,t)=>{let a=e.parentStepFilterGroupId,o=[`filter`,`stepFilterGroups`,t,`parentStepFilterGroupId`];if(!n.t(a))return;if(!i.has(a)){r.addIssue({code:`custom`,path:o,message:`Filter group ${a} is not declared in stepFilterGroups`});return}let s=new Set([e.id]);for(let t=a;n.t(t);t=i.get(t)){if(s.has(t)){r.addIssue({code:`custom`,path:o,message:`Filter group ${e.id} is not reachable from a root group`});return}s.add(t)}}),e.filter.stepFilters.forEach((e,t)=>{i.has(e.stepFilterGroupId)||r.addIssue({code:`custom`,path:[`filter`,`stepFilters`,t,`stepFilterGroupId`],message:`Filter group ${e.stepFilterGroupId} is not declared in stepFilterGroups`})})})}),r.it({...$,type:r.Z(`WEBHOOK`),settings:Pn})],In=Fn.map(e=>e.shape.type.value),Ln=r.q(`type`,Fn,{error:e=>e.code===`invalid_union`?`Unsupported trigger type. Application workflows support: ${In.join(`, `)}`:void 0});r.it({universalIdentifier:r.lt(),name:r.at().min(1),isSystem:r.K().optional(),version:r.it({trigger:Ln,steps:r.G(wn).min(1)})}).superRefine((e,t)=>{let{steps:r,trigger:i}=e.version,a=[e.universalIdentifier,i.universalIdentifier,...r.map(e=>e.universalIdentifier)].filter(n.t);new Set(a).size!==a.length&&t.addIssue({code:`custom`,message:`Workflow, trigger and steps must have distinct universal identifiers`});let o={trigger:{type:i.type,nextStepIds:i.nextStepIds},steps:r.map(e=>({...e,id:e.universalIdentifier,settings:{input:e.input}}))},s=Rt(o);for(let e of[...Vt({workflow:o,graph:s}),...Bt({workflow:o,graph:s}),...qe({workflow:o,graph:s,stepsById:new Map(o.steps.map(e=>[e.id,e]))})])e.severity===`error`&&t.addIssue({code:`custom`,message:e.message})}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Xt}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return en}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return Wt}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return fn}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return $t}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return Ut}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return qt}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return Kt}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return pn}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return Zt}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Jt}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return Gt}});