twenty 2.46.0 → 2.49.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.
- package/CONTRIBUTING.md +25 -17
- package/dist/app-template/yarn.lock +165 -191
- package/dist/app-worker.cjs +1 -1
- package/dist/chunks/application-BE-X21OV.cjs +5 -0
- package/dist/chunks/build-pull-entities-caP3XupC.cjs +5 -0
- package/dist/chunks/{build-source-manifest-CLKH5vzc.cjs → build-source-manifest-DWRbCMVq.cjs} +1 -1
- package/dist/chunks/{build-source-snapshot-CbGsy1-v.cjs → build-source-snapshot-CtgBQfSx.cjs} +816 -157
- package/dist/chunks/{check-node-requirement-mqwNPktb.cjs → check-node-requirement-CGBKvEqH.cjs} +1 -1
- package/dist/chunks/cli-node-version-range.constant-D7fE8edk.cjs +1 -0
- package/dist/chunks/cli-version.constant-BBeYll5N.cjs +1 -0
- package/dist/chunks/collect-translatable-strings-GBVXMoaX.cjs +1 -0
- package/dist/chunks/{collect-watch-inputs-B9jWG4W0.cjs → collect-watch-inputs-CJVgCTo5.cjs} +1 -1
- package/dist/chunks/compile-application-translations-B4jILjGc.cjs +1 -0
- package/dist/chunks/{constants-CL6mrTMT-B748cNNG.cjs → constants-CemcuPi_-D7dbw2cv.cjs} +1 -1
- package/dist/chunks/{convert-to-label-BPBLtc_O.cjs → convert-to-label-DH4ArWop.cjs} +1 -1
- package/dist/chunks/create-app-not-installed-error-DY-iuPPx.cjs +1 -0
- package/dist/chunks/{create-http-status-error-D3gy3DzB.cjs → create-http-status-error-C6gJS0JS.cjs} +1 -1
- package/dist/chunks/create-metadata-client-BRD2ys8z.cjs +6 -0
- package/dist/chunks/create-pull-base-write-CX9yftCd.cjs +1 -0
- package/dist/chunks/create-rest-client-Cc5Cmakp.cjs +60 -0
- package/dist/chunks/create-tooling-failure-B2FmNwR2.cjs +1 -0
- package/dist/chunks/extract-manifest-from-file-mvb6OhWm.cjs +1 -0
- package/dist/chunks/extract-source-translations-Bd_030qL.cjs +1 -0
- package/dist/chunks/{fetch-metadata-inspection-Dp034TpK.cjs → fetch-metadata-inspection-CAmEp-xl.cjs} +1 -1
- package/dist/chunks/{fetch-signed-in-identity-BhvaL3zp.cjs → fetch-signed-in-identity-b_LbRuL-.cjs} +1 -1
- package/dist/chunks/{fetch-workspace-id-DJStmf_V.cjs → fetch-workspace-id-C9kY0s84.cjs} +1 -1
- package/dist/chunks/{format-body-VcKL4WXt.cjs → format-body-BIv-9Sd5.cjs} +1 -1
- package/dist/chunks/{format-data-value-B6rIbpJv.cjs → format-data-value-C7Njc7Sb.cjs} +1 -1
- package/dist/chunks/format-display-path-gEepVJDg.cjs +1 -0
- package/dist/chunks/{format-metadata-fields-DJnTg1R9.cjs → format-metadata-fields-BOG2kj2h.cjs} +1 -1
- package/dist/chunks/{format-metadata-owner-yUeocnwY.cjs → format-metadata-owner-CyEMvoQr.cjs} +1 -1
- package/dist/chunks/format-progress-line-DgxG_7p2.cjs +1 -0
- package/dist/chunks/generate-application-client-BOLnv8nr.cjs +1 -0
- package/dist/chunks/{get-app-plan-summary-B0uwHXbO.cjs → get-app-plan-summary-D1Dsd34P.cjs} +2 -2
- package/dist/chunks/get-client-generation-skip-reason-CUn0Y2Vu.cjs +1 -0
- package/dist/chunks/get-client-sdk-package-path-2U3kDCRq.cjs +1 -0
- package/dist/chunks/{get-function-input-schema-GNk3NRLJ-Bfph1o9z.cjs → get-function-input-schema-GNk3NRLJ-CWNFoyKh.cjs} +1 -1
- package/dist/chunks/global-flags.constant-0k222fHC.cjs +1 -0
- package/dist/chunks/{is-access-token-expiring-gICPXsbO.cjs → is-access-token-expiring-D-YfufId.cjs} +1 -1
- package/dist/chunks/{is-application-not-found-error-mNeGbxmT.cjs → is-application-not-found-error-4vnGlYbm.cjs} +1 -1
- package/dist/chunks/is-exported-manifest-dsiWCcjx.cjs +1 -0
- package/dist/chunks/is-inside-directory-DHVCQE5C.cjs +1 -0
- package/dist/chunks/{is-interaction-allowed-ycbAFMIj.cjs → is-interaction-allowed-CF-ko1KI.cjs} +1 -1
- package/dist/chunks/is-locale-catalog-CRn-mKHj.cjs +1 -0
- package/dist/chunks/is-supported-locale-BOZxTj7r.cjs +1 -0
- package/dist/chunks/{is-supported-locale-BAjnKnKj.cjs → locale-catalog-format-rg5FMb7l.cjs} +5 -5
- package/dist/chunks/metadata-Vepr2xeA.cjs +1 -0
- package/dist/chunks/{metadata-page.constant-BkG4ndrO.cjs → metadata-page.constant-thBSPIZT.cjs} +1 -1
- package/dist/chunks/{parse-api-url-BllxRdpE.cjs → parse-api-url-CEfjRyid.cjs} +1 -1
- package/dist/chunks/{parse-app-export-BkfflyUY.cjs → parse-app-export-DUZ2dQJ8.cjs} +1 -1
- package/dist/chunks/parse-extraction-locale-fg7K8vps.cjs +1 -0
- package/dist/chunks/{parse-graphql-response-CtP9KTS2.cjs → parse-graphql-response-DvoRiFPV.cjs} +1 -1
- package/dist/chunks/{parse-json-input-CvMTKAWw.cjs → parse-json-input-DE451WQG.cjs} +1 -1
- package/dist/chunks/{print-typescript-value-DhElcFzI.cjs → print-typescript-value-DaEFmMda.cjs} +1 -1
- package/dist/chunks/pull-source-D9QUEAsK.cjs +1 -0
- package/dist/chunks/read-app-identity-DtEnxiEF.cjs +1 -0
- package/dist/chunks/read-application-identifier-DyZcsUV4.cjs +1 -0
- package/dist/chunks/{read-application-identity-BFg_p84F.cjs → read-application-identity-CMJ-W5D8.cjs} +1 -1
- package/dist/chunks/{read-config-DUJ27809.cjs → read-config-DdtXhdPp.cjs} +1 -1
- package/dist/chunks/read-json-object-CgaXuNS0.cjs +1 -0
- package/dist/chunks/read-snapshot-file-dvWjVexO.cjs +1 -0
- package/dist/chunks/{read-source-identity-C8LG1v6U.cjs → read-source-identity-Ca7QkuwC.cjs} +1 -1
- package/dist/chunks/record-pull-base-Dfqth7Uy.cjs +1 -0
- package/dist/chunks/{record-typecheck-config-inputs-BDqkKCrj.cjs → record-typecheck-config-inputs-DZy2PhMY.cjs} +1 -1
- package/dist/chunks/{request-oauth-tokens-C4KKlTQT.cjs → request-oauth-tokens-BY5ew3aM.cjs} +1 -1
- package/dist/chunks/require-approval-D0FfoHhF.cjs +1 -0
- package/dist/chunks/resolve-app-project-dftvbB2P.cjs +1 -0
- package/dist/chunks/resolve-command-target-0k6iitOZ.cjs +1 -0
- package/dist/chunks/resolve-inside-sdk-6M8jy9bi.cjs +1 -0
- package/dist/chunks/{resolve-metadata-object-QoDi-Aik.cjs → resolve-metadata-object-DzDTQF_T.cjs} +1 -1
- package/dist/chunks/resolve-project-typescript-Cw2kvn6E.cjs +1 -0
- package/dist/chunks/{resolve-request-url-jC5kYwkn.cjs → resolve-request-url-Cnuxu_nj.cjs} +1 -1
- package/dist/chunks/resolve-source-sdk-B1Fxlsmt.cjs +1 -0
- package/dist/chunks/{run-api-graphql-command-Biy0WqXa.cjs → run-api-graphql-command-CzQ4IH4l.cjs} +1 -1
- package/dist/chunks/{run-api-rest-command-D9kdQceV.cjs → run-api-rest-command-BtXv11uz.cjs} +1 -1
- package/dist/chunks/{run-app-add-command-DcTQg7Si.cjs → run-app-add-command-DsgrCsEl.cjs} +5 -5
- package/dist/chunks/run-app-apply-command-X_XGAwRN.cjs +2 -0
- package/dist/chunks/{run-app-build-command-BRYb0one.cjs → run-app-build-command--t8qRNsn.cjs} +1 -1
- package/dist/chunks/run-app-dev-command-Cc-nhH2t.cjs +2 -0
- package/dist/chunks/run-app-exec-command-mdXCYmUn.cjs +3 -0
- package/dist/chunks/run-app-generate-client-command-3DMg-WyX.cjs +2 -0
- package/dist/chunks/run-app-init-command-BfS8IFmY.cjs +2 -0
- package/dist/chunks/run-app-install-command-DMbwFvtE.cjs +1 -0
- package/dist/chunks/run-app-logs-command-B7_iDOj1.cjs +9 -0
- package/dist/chunks/run-app-operation-DFCj0sG_.cjs +1 -0
- package/dist/chunks/run-app-plan-command-Dh_DFA7H.cjs +1 -0
- package/dist/chunks/run-app-publish-command-eJcYGb8S.cjs +3 -0
- package/dist/chunks/run-app-pull-command-BV2cMuLU.cjs +3 -0
- package/dist/chunks/run-app-translations-extract-command-CBBbk_vJ.cjs +2 -0
- package/dist/chunks/{run-app-typecheck-command-C8LqpOej.cjs → run-app-typecheck-command-pAHhuBGo.cjs} +1 -1
- package/dist/chunks/run-app-uninstall-command-C5um6udQ.cjs +2 -0
- package/dist/chunks/{run-auth-login-command-_zDgRcth.cjs → run-auth-login-command-C4VI44Xu.cjs} +1 -1
- package/dist/chunks/{run-auth-logout-command-BO6O7GVi.cjs → run-auth-logout-command-5Tvqclki.cjs} +1 -1
- package/dist/chunks/{run-auth-status-command-Cj-vqoHg.cjs → run-auth-status-command-CLH1bylR.cjs} +1 -1
- package/dist/chunks/{run-cli-c9TOR0zj.cjs → run-cli-BA0FsxzB.cjs} +8 -8
- package/dist/chunks/{run-commands-command-C6gvMpQ_.cjs → run-commands-command-CjzkTcrO.cjs} +1 -1
- package/dist/chunks/{run-data-get-command-jDEU4EG1.cjs → run-data-get-command-DoZIpf8O.cjs} +1 -1
- package/dist/chunks/{run-data-list-command-EnCdbuzc.cjs → run-data-list-command-DAoplyqj.cjs} +1 -1
- package/dist/chunks/{run-doctor-command-DnJ6io-m.cjs → run-doctor-command-D8cpt7FI.cjs} +2 -2
- package/dist/chunks/{run-metadata-field-describe-command-vJngpw2S.cjs → run-metadata-field-describe-command-BrZYIhjH.cjs} +1 -1
- package/dist/chunks/{run-metadata-field-list-command-CR4w7fI6.cjs → run-metadata-field-list-command-C9-pHXbx.cjs} +1 -1
- package/dist/chunks/{run-metadata-object-describe-command-CHP8K-W2.cjs → run-metadata-object-describe-command-WFdGu1Iq.cjs} +1 -1
- package/dist/chunks/{run-metadata-object-list-command-BqXMcAp6.cjs → run-metadata-object-list-command-8UKU3cMW.cjs} +1 -1
- package/dist/chunks/{run-open-command-DKl8acw0.cjs → run-open-command-B1pdHp36.cjs} +1 -1
- package/dist/chunks/{run-remote-list-command-DeAzr5Mn.cjs → run-remote-list-command-BRPcCOKx.cjs} +1 -1
- package/dist/chunks/{run-remote-remove-command-D0C5sWjP.cjs → run-remote-remove-command-CS6za2Pm.cjs} +1 -1
- package/dist/chunks/{run-remote-rename-command-Byq9WRHd.cjs → run-remote-rename-command-BOqWQUR4.cjs} +1 -1
- package/dist/chunks/{run-remote-use-command-B6VVDlMG.cjs → run-remote-use-command-BANiokD-.cjs} +1 -1
- package/dist/chunks/{run-version-command-BmSk8PUV.cjs → run-version-command-C0xgcPP6.cjs} +1 -1
- package/dist/chunks/{select-target-C1VZjf-A.cjs → select-target-CfuNLCQL.cjs} +1 -1
- package/dist/chunks/sign-in-to-remote-again-DYCWIDa9.cjs +1 -0
- package/dist/chunks/{sign-in-with-browser-C3kC6uP2.cjs → sign-in-with-browser-Ck4tOxtA.cjs} +1 -1
- package/dist/chunks/to-public-target-C0POrVoG.cjs +1 -0
- package/dist/chunks/{to-worker-output-diagnostics-lprh9b0l.cjs → to-worker-output-diagnostics-Bt_acI26.cjs} +1 -1
- package/dist/chunks/{typecheck-application-DGrovgX9.cjs → typecheck-application-DEO1SVdO.cjs} +2 -2
- package/dist/chunks/{update-config-BkKBEfAp.cjs → update-config-FzOzO3wZ.cjs} +1 -1
- package/dist/chunks/utils-ZOESAfF8-ub6jPiZ-.cjs +35 -0
- package/dist/chunks/with-phase-details-Dof8Ao9R.cjs +1 -0
- package/dist/chunks/{write-config-atomically-DRWTukU-.cjs → write-config-atomically-C-YMKq3P.cjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/docs/commands.md +93 -5
- package/package.json +6 -6
- package/src/app/source/README.md +1 -1
- package/dist/chunks/application-DuIJE2qG.cjs +0 -5
- package/dist/chunks/build-pull-entities-zwArrVMk.cjs +0 -5
- package/dist/chunks/cli-version.constant-aSp8WZDh.cjs +0 -1
- package/dist/chunks/compile-application-translations-B59jYVWc.cjs +0 -1
- package/dist/chunks/create-app-not-installed-error-Cc8YZqI7.cjs +0 -1
- package/dist/chunks/create-metadata-client-ChjDalSi.cjs +0 -6
- package/dist/chunks/create-pull-base-write-rxjcKtD-.cjs +0 -1
- package/dist/chunks/create-rest-client-eAfOFfDA.cjs +0 -58
- package/dist/chunks/create-tooling-failure-DLI5FlQP.cjs +0 -1
- package/dist/chunks/extract-manifest-from-file-j-Y9wNas.cjs +0 -1
- package/dist/chunks/generate-application-client-CCVLjxTj.cjs +0 -1
- package/dist/chunks/global-flags.constant-8GfW0sNU.cjs +0 -1
- package/dist/chunks/is-exported-manifest-CriNOWvx.cjs +0 -1
- package/dist/chunks/is-inside-directory-t3ixLQDr.cjs +0 -1
- package/dist/chunks/metadata-D9sQOTRK.cjs +0 -1
- package/dist/chunks/package-CdYv4LEx.cjs +0 -1
- package/dist/chunks/pull-source-eoiJwFb9.cjs +0 -1
- package/dist/chunks/read-app-identity-SeleQ_D6.cjs +0 -1
- package/dist/chunks/record-pull-base-BbxvlnU8.cjs +0 -1
- package/dist/chunks/require-approval-fhegB1ap.cjs +0 -1
- package/dist/chunks/resolve-app-project-D5ZXIpsG.cjs +0 -1
- package/dist/chunks/resolve-inside-sdk-p-16gKb4.cjs +0 -1
- package/dist/chunks/resolve-project-typescript-CDY8BbmP.cjs +0 -1
- package/dist/chunks/resolve-source-sdk-mK-f4q55.cjs +0 -1
- package/dist/chunks/run-app-apply-command-DwLPPJ-Y.cjs +0 -2
- package/dist/chunks/run-app-dev-command-CVeh9Gab.cjs +0 -2
- package/dist/chunks/run-app-exec-command-DKLNLbL5.cjs +0 -3
- package/dist/chunks/run-app-init-command-CJj8_spC.cjs +0 -2
- package/dist/chunks/run-app-logs-command-Dusb8K-W.cjs +0 -9
- package/dist/chunks/run-app-operation-BWrY9YZK.cjs +0 -1
- package/dist/chunks/run-app-plan-command-C0_3e332.cjs +0 -1
- package/dist/chunks/run-app-pull-command-DcZqs8gR.cjs +0 -3
- package/dist/chunks/run-app-uninstall-command-ncWS_k-p.cjs +0 -2
- package/dist/chunks/sign-in-to-remote-again-CW8HPSTP.cjs +0 -1
- package/dist/chunks/to-public-target-CIAwoOKL.cjs +0 -1
- package/dist/chunks/utils-B8EXJeaX-DK3gCslL.cjs +0 -33
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./cli-error-CSsayo0u.cjs");var t=({error:t,phase:n,outcome:r,completedPhases:i,hint:a})=>new e.t({cause:t,code:t.code,exitCode:t.exitCode,message:t.message,hint:t.hint??a,details:{...t.details,phase:n,outcome:r,completedPhases:[...i]}});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
|
package/dist/chunks/{write-config-atomically-DRWTukU-.cjs → write-config-atomically-C-YMKq3P.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-
|
|
1
|
+
const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-CemcuPi_-D7dbw2cv.cjs"),n=require("./cli-error-CSsayo0u.cjs"),r=require("./request-timeout-milliseconds.constant-DtyQHrll.cjs"),i=require("./config-file-mode.constant-DLBzKKUl.cjs");let a=require("node:crypto"),o=require("node:fs/promises"),s=require("node:path"),c=require("node:timers/promises");var l=e.t(),u={TIMEOUT_MILLISECONDS:2*r.t+5e3,RETRY_MILLISECONDS:50},d=async e=>{try{let n=JSON.parse(await(0,o.readFile)(e,`utf8`));return t.p(n)&&(0,l.isNumber)(n.pid)&&(0,l.isString)(n.token)?{pid:n.pid,token:n.token}:void 0}catch{return}},f=e=>{try{return process.kill(e,0),!0}catch(e){return n.r(e,`EPERM`)}},p=async e=>{let r=await d(e),i=t.Vt(r)&&!f(r.pid),a=t.Vt(r)?` (pid ${r.pid})`:``;return new n.t({code:`CONFIG_LOCKED`,message:i?`A twenty command (pid ${r.pid}) stopped without releasing ${e}.`:`Another twenty command${a} is changing ${(0,s.dirname)(e)}.`,hint:i?`Delete ${e} and try again.`:`Try again when it finishes. If no twenty command is running, delete ${e}.`,details:{lockPath:e,ownerPid:r?.pid??null}})},m=async(e,t)=>{try{let n=await(0,o.open)(e,`wx`,i.t.PRIVATE_FILE);return await n.writeFile(JSON.stringify({pid:process.pid,token:t})),await n.close(),!0}catch(e){if(n.r(e,`EEXIST`))return!1;throw e}},h=async({lockPath:e,token:n,signal:r})=>{let i=Date.now()+u.TIMEOUT_MILLISECONDS,a=await m(e,n);for(;!a;){r.throwIfAborted();let o=await d(e);if(t.Vt(o)&&!f(o.pid)||Date.now()>i)throw await p(e);await(0,c.setTimeout)(u.RETRY_MILLISECONDS,void 0,{signal:r}),a=await m(e,n)}},g=async(e,t)=>{(await d(e))?.token===t&&await(0,o.rm)(e,{force:!0})},_=async({configPath:e,signal:t,operation:n})=>{let r=`${e}.lock`,c=(0,a.randomUUID)();await(0,o.mkdir)((0,s.dirname)(e),{recursive:!0,mode:i.t.PRIVATE_DIRECTORY}),await h({lockPath:r,token:c,signal:t});try{return await n()}finally{await g(r,c)}},v=async(e,t)=>{let n=`${e}.${process.pid}.${(0,a.randomUUID)()}.tmp`,r=await(0,o.open)(n,`wx`,i.t.PRIVATE_FILE);try{await r.writeFile(`${JSON.stringify(t,null,2)}\n`),await r.sync(),await r.close(),await(0,o.rename)(n,e)}catch(e){throw await r.close().catch(()=>void 0),await(0,o.rm)(n,{force:!0}),e}};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return v}});
|
package/dist/cli.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const e=require("./chunks/
|
|
2
|
+
const e=require("./chunks/check-node-requirement-CGBKvEqH.cjs"),t=require("./chunks/cli-node-version-range.constant-D7fE8edk.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-BA0FsxzB.cjs"))});
|
package/docs/commands.md
CHANGED
|
@@ -270,8 +270,10 @@ The CLI owns manifest generation, bundling and typechecking. It uses the app's
|
|
|
270
270
|
installed `twenty-sdk` authoring exports (`define` and `front-component`, SDK
|
|
271
271
|
`>=1.23.0`). An app without an installed SDK fails with `SDK_NOT_INSTALLED`;
|
|
272
272
|
missing or unsupported authoring
|
|
273
|
-
exports fail with `SDK_SOURCE_UNSUPPORTED
|
|
274
|
-
fails with `NODE_VERSION_UNSUPPORTED
|
|
273
|
+
exports fail with `SDK_SOURCE_UNSUPPORTED`. A Node version below every version the SDK's
|
|
274
|
+
`engines.node` range accepts fails with `NODE_VERSION_UNSUPPORTED`; any other
|
|
275
|
+
Node version outside that range continues with a `NODE_VERSION_UNTESTED`
|
|
276
|
+
warning, which `doctor` also reports. The CLI never installs dependencies or
|
|
275
277
|
substitutes another SDK. Yarn Plug'n'Play is not supported; use
|
|
276
278
|
`nodeLinker: node-modules`.
|
|
277
279
|
|
|
@@ -332,7 +334,7 @@ twenty app apply --no-delete
|
|
|
332
334
|
- **Uploads.** File bytes go straight to the upload URLs the server returns, without the CLI's credentials. Each file is checked against the build's size and SHA-256 before anything is uploaded.
|
|
333
335
|
- **Pull baseline.** After an acknowledged sync, the CLI fetches the workspace ID and fresh application export, then atomically records `.twenty/cli/pull-base.json`. This baseline lets `app pull` distinguish workspace changes from local edits. It is bound to the normalized API URL, workspace UUID and app UUID. JSON reports `pullBase: "recorded"`, `"failed"` or `"unsupported"`; only a recorded base adds `pullBase` to `completedPhases`. Invalid exports or file-write errors preserve the prior base, warn with `PULL_BASE_NOT_RECORDED`, and allow client generation to continue. A server without the export API reports `"unsupported"` without a warning on every apply. The export is recorded as the server sent it; collections it lacks are read as empty by pull. Cancellation before the base is committed exits 130 with `outcome: "applied"` and `phase: "pullBase"`.
|
|
334
336
|
- **Typed client.** After the sync, the CLI fetches the app's GraphQL schema from the workspace and calls the app's own `twenty-client-sdk/generate` to regenerate the client in the app's own `node_modules/twenty-client-sdk` (`clientGeneration: "generated"`). It is skipped with a `CLIENT_NOT_GENERATED` warning when the app has no `node_modules/twenty-client-sdk` of its own, as in a hoisted workspace. A symlinked client package is followed and its target rewritten, so don't apply two apps that share one client package at the same time.
|
|
335
|
-
- **Failures.** A failed apply reports `details.phase`, `details.completedPhases` and `details.outcome`: `not-started` when the failing step changed nothing, `partial` when some files were uploaded, `unknown` when a request was sent but its effect is not known, such as a failed or interrupted sync, and `applied` when the sync succeeded but baseline recording was cancelled or client generation failed. Earlier steps, like a new registration, stay done. There is no rollback and no automatic retry: run `twenty app plan` to see where the workspace stands, then apply again.
|
|
337
|
+
- **Failures.** A failed apply reports `details.phase`, `details.completedPhases` and `details.outcome`: `not-started` when the failing step changed nothing, `partial` when some files were uploaded, `unknown` when a request was sent but its effect is not known, such as a failed or interrupted sync, and `applied` when the sync succeeded but baseline recording was cancelled or client generation failed. Earlier steps, like a new registration, stay done. There is no rollback and no automatic retry: run `twenty app plan` to see where the workspace stands, then apply again. When client generation failed, the workspace has the new version but the client files may be incomplete: fix the problem, then run `twenty app generate-client`, which regenerates the client without syncing again. Ctrl+C exits with 130 and reports the step it interrupted.
|
|
336
338
|
|
|
337
339
|
Remote changes made between the plan and the sync can change what the sync does. Remote changes between the acknowledged sync and the export can also enter the saved baseline without appearing in local source; this is not an atomic server snapshot of the sync. Planning, a failed sync, or a sync with an unknown outcome never advances the baseline.
|
|
338
340
|
|
|
@@ -379,7 +381,7 @@ Compilation pauses during generation, then explicitly rebuilds. Unchanged client
|
|
|
379
381
|
inputs and unchanged build output prevent a generation/sync loop. A schema fetch
|
|
380
382
|
failure keeps the old client and prints a warning. If generation starts writing
|
|
381
383
|
and fails, dev stops because the client files may be incomplete; fix the problem
|
|
382
|
-
and run `twenty app
|
|
384
|
+
and run `twenty app generate-client` before restarting dev.
|
|
383
385
|
|
|
384
386
|
Use human output or `--format ndjson`; `--json` is rejected before target lookup.
|
|
385
387
|
NDJSON uses ordered `progress` events with `data.kind`: `watch-ready`,
|
|
@@ -395,6 +397,17 @@ the cause and restart `twenty app dev`. A killed process can leave temporary
|
|
|
395
397
|
folders in `.twenty/cli/snapshots`. After stopping all dev/apply sessions for that
|
|
396
398
|
app, abandoned snapshot folders can be removed.
|
|
397
399
|
|
|
400
|
+
## Regenerate the typed client
|
|
401
|
+
|
|
402
|
+
```bash
|
|
403
|
+
twenty app generate-client --remote dev
|
|
404
|
+
twenty app generate-client --path ./apps/billing --json
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
`app generate-client` fetches the app's GraphQL schema from the workspace and regenerates the typed client in the app's own `node_modules/twenty-client-sdk`, the same step `app apply` and `app dev` run after a sync, without building, uploading or syncing. Use it after installing dependencies, after a failed client generation, or to pick up schema changes made in the workspace. It needs no server permission flag.
|
|
408
|
+
|
|
409
|
+
The app must already be installed in the workspace; otherwise the command fails with `APP_NOT_INSTALLED` (exit 4), and `twenty app apply` installs it and generates the client. An app without its own `node_modules/twenty-client-sdk`, as in a hoisted workspace, fails with `CLIENT_SDK_NOT_INSTALLED` instead of the warning `app apply` prints.
|
|
410
|
+
|
|
398
411
|
## Pull an app
|
|
399
412
|
|
|
400
413
|
```bash
|
|
@@ -421,6 +434,22 @@ Failures in reconciliation report `error.details.outcome`: `unchanged` after an
|
|
|
421
434
|
|
|
422
435
|
The current export contains metadata and translations, not application source assets or dependency files. Logic-function/front-component code and unsupported metadata are not regenerated. An export with nonempty `files` is refused before writing. Package files, dependency pins and the installed generated client are left alone; pull never installs dependencies. Each export response is limited to 16 MiB. See the [pull implementation](../src/app/pull/README.md) for reconciliation and compatibility details.
|
|
423
436
|
|
|
437
|
+
## Install a registered app
|
|
438
|
+
|
|
439
|
+
```bash
|
|
440
|
+
twenty app install --remote dev
|
|
441
|
+
twenty app install --path ./apps/billing --json
|
|
442
|
+
twenty app install --universal-identifier <id> --remote staging --json
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
`app install` installs a package already registered on the target server. It reads the local app definition to find its universal identifier, without building or typechecking the app; `--universal-identifier` works without a local project. Identifiers are sent in lowercase. It requires `APPLICATIONS` permission.
|
|
446
|
+
|
|
447
|
+
The server selects the registered package and version. Local source changes are not uploaded. For a private package, run `app publish --private` first; publishing to npm alone does not create a server registration. Installation can run app hooks and update an existing installation. Use `app apply` to sync local source instead.
|
|
448
|
+
|
|
449
|
+
The command waits up to ten minutes for its server installation job to complete, then verifies that the app is installed. While it waits, human output shows the job's progress as an updating percentage bar in an interactive terminal. Redirected output, CI and terminals with `TERM=dumb` print a plain progress line each time the percentage changes. JSON returns `application`, `installed: true` and `jobId`. Failed jobs return `INSTALL_FAILED`; missing or mismatched job status is an error, not a successful installation.
|
|
450
|
+
|
|
451
|
+
Identifier resolution and installation errors include `details.phase`, `details.completedPhases` and `details.outcome`, plus the universal identifier and job identifier when available. Identifier resolution failures report `phase: "identity"` and `outcome: "not-started"`. Ctrl+C or a timeout stops waiting but does not cancel the server job. Run the same command again to retry or resume waiting for an installation that is still running. The command requires the server's `triggerInstallApplication` and `findInstallApplicationJobStatus` APIs, including lookup by `jobId`.
|
|
452
|
+
|
|
424
453
|
## Uninstall an app
|
|
425
454
|
|
|
426
455
|
```bash
|
|
@@ -429,7 +458,7 @@ twenty app uninstall --yes --json
|
|
|
429
458
|
twenty app uninstall --universal-identifier <id> --yes
|
|
430
459
|
```
|
|
431
460
|
|
|
432
|
-
`app uninstall`
|
|
461
|
+
`app uninstall` reads the local app definition to find its universal identifier, without building or typechecking the app. It checks that the app is installed on the target and that the workspace allows uninstalling it, then uninstalls it. `--universal-identifier` works without a local project. It needs the server's `APPLICATIONS` permission.
|
|
433
462
|
|
|
434
463
|
Uninstalling runs the app's uninstall hook and deletes everything the app owns, including its objects, fields and their data. It always needs `--yes`, or a yes at the prompt in an interactive terminal; otherwise it stops with `CONFIRMATION_REQUIRED` (exit 2) before changing anything. An app that is not installed returns `APP_NOT_INSTALLED` (exit 4), and one the workspace does not allow to uninstall returns `APP_NOT_UNINSTALLABLE` (exit 6).
|
|
435
464
|
|
|
@@ -562,3 +591,62 @@ Exit codes:
|
|
|
562
591
|
| 5 | Partial failure |
|
|
563
592
|
| 6 | Conflict |
|
|
564
593
|
| 130 | Cancelled |
|
|
594
|
+
|
|
595
|
+
## Publish an app to npm
|
|
596
|
+
|
|
597
|
+
```sh
|
|
598
|
+
twenty app publish
|
|
599
|
+
twenty app publish --path ./apps/billing --tag beta --json
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
Builds and typechecks the app, packs that exact build, then publishes the package with public access. No Twenty remote or workspace authentication is required. Publishing to npm does not sync or install the app in a workspace.
|
|
603
|
+
|
|
604
|
+
Install npm and authenticate with the intended registry first. npm runs from the app directory, so its project/user configuration and environment credentials apply. `--tag` sets the npm dist-tag. GitHub Actions jobs with OIDC request provenance automatically; set `TWENTY_APP_PUBLISH_DISABLE_PROVENANCE=true` to opt out, for example when publishing from a private source repository.
|
|
605
|
+
|
|
606
|
+
Packing and publishing skip npm lifecycle scripts because the CLI already built the app. npm's package-file selection still applies. If `package.json` has a `files` field, it must include `manifest.json` and the generated app files; the command rejects an incomplete package before publication. npm excludes the root `yarn.lock` from packages. Temporary packages and build snapshots are removed after completion or failure.
|
|
607
|
+
|
|
608
|
+
Human mode displays npm output and supports interactive authentication when a terminal is available. JSON mode returns one CLI envelope and does not prompt; configure an automation token or npm’s `npm_config_otp` environment option before running it. Failed npm commands return `PUBLISH_FAILED` with the subprocess exit code and captured output. If publication is interrupted after sending the package, check the registry before retrying, since the version may already have been published.
|
|
609
|
+
|
|
610
|
+
### Publish to a private Twenty registry
|
|
611
|
+
|
|
612
|
+
```sh
|
|
613
|
+
twenty app publish --private --remote staging
|
|
614
|
+
twenty app publish --private --path ./apps/billing --json
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
`--private` publishes the same built package to the selected Twenty server registry instead of npm. It uses the normal saved remote or environment credentials, requests a tarball upload, sends the bytes directly to storage, then registers the uploaded app. npm is still needed for local packing, but npm registry credentials are not used and `--tag` is rejected. The server requires file-upload permission and `MARKETPLACE_APPS` permission on the target workspace.
|
|
618
|
+
|
|
619
|
+
Publishing registers a version; it does not install the app or directly sync the selected workspace. Publishing an update can trigger automatic upgrades in workspaces where the app is already installed with automatic upgrades enabled. The server enforces application ownership, version progression and engine compatibility. JSON results contain `target: "private"`, the selected server under `registry`, the registration and `installed: false`, indicating that this command did not request installation.
|
|
620
|
+
|
|
621
|
+
Failed uploads never trigger registration. If registration fails or is interrupted after sending the request, the app may already be registered. The error includes the phase, upload file ID and an `unknown` outcome; check the server registry before retrying. Temporary packages are cleaned up in either case.
|
|
622
|
+
|
|
623
|
+
## App translations
|
|
624
|
+
|
|
625
|
+
```sh
|
|
626
|
+
twenty app translations extract
|
|
627
|
+
twenty app translations extract --locale fr-FR
|
|
628
|
+
twenty app translations extract --path ./apps/billing --json
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
Use `--path` for an explicit app directory. Without `--path`, the CLI finds the
|
|
632
|
+
app containing the current directory.
|
|
633
|
+
|
|
634
|
+
Extraction runs locally, without a workspace connection. It reads app metadata
|
|
635
|
+
and static `t`, `msg`, and `Trans` strings in front-component source files. It
|
|
636
|
+
refreshes `locales/en.json` with source strings and updates existing target JSON
|
|
637
|
+
catalogs. `--locale` also creates a missing supported target catalog, for example
|
|
638
|
+
`locales/fr-FR.json`. The source locale `en` cannot be a target.
|
|
639
|
+
|
|
640
|
+
Translations for unchanged message/context pairs are preserved. New entries have
|
|
641
|
+
empty translations; obsolete entries are removed. Context groups remain separate.
|
|
642
|
+
Malformed target catalogs fail with `INVALID_INPUT` before writing any catalogs.
|
|
643
|
+
Unsafe catalog or staging paths report `APP_PATH_UNAVAILABLE`. Files under
|
|
644
|
+
`locales/compiled` are left untouched. Temporary files live under `.twenty/cli`.
|
|
645
|
+
Each catalog is replaced atomically; an
|
|
646
|
+
interrupted run may update only some catalogs, so rerun extraction to finish.
|
|
647
|
+
|
|
648
|
+
The command validates app definitions but does not bundle or upload them. Edit
|
|
649
|
+
the target catalogs, then run `twenty app apply` to deploy translations. Build
|
|
650
|
+
and apply already compile translations; no separate compile command is needed.
|
|
651
|
+
JSON output includes the app, source-string count, updated catalog paths and
|
|
652
|
+
diagnostics.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "twenty",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.49.0",
|
|
4
4
|
"description": "The Twenty command line.",
|
|
5
5
|
"homepage": "https://twenty.com",
|
|
6
6
|
"repository": {
|
|
@@ -21,10 +21,7 @@
|
|
|
21
21
|
],
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "npx rimraf dist && npx vite build",
|
|
24
|
-
"prepublish": "node scripts/
|
|
25
|
-
},
|
|
26
|
-
"engines": {
|
|
27
|
-
"node": "^24.5.0"
|
|
24
|
+
"prepublish": "node scripts/prepublish.mjs"
|
|
28
25
|
},
|
|
29
26
|
"devDependencies": {
|
|
30
27
|
"@sniptt/guards": "^0.2.0",
|
|
@@ -33,9 +30,12 @@
|
|
|
33
30
|
"@types/semver": "^7.5.8",
|
|
34
31
|
"cjs-module-lexer": "^2.2.0",
|
|
35
32
|
"commander": "^14.0.3",
|
|
33
|
+
"execa": "^5.1.1",
|
|
36
34
|
"lodash.startcase": "^4.4.0",
|
|
35
|
+
"npm-pick-manifest": "^11.0.1",
|
|
37
36
|
"semver": "7.6.3",
|
|
38
|
-
"
|
|
37
|
+
"string-width": "^8.2.0",
|
|
38
|
+
"twenty-client-sdk": "2.49.0",
|
|
39
39
|
"twenty-shared": "0.0.0",
|
|
40
40
|
"undici": "^7.29.0",
|
|
41
41
|
"uuid": "^13.0.2",
|
package/src/app/source/README.md
CHANGED
|
@@ -13,7 +13,7 @@ Package boundaries are documented in the
|
|
|
13
13
|
|
|
14
14
|
## Compatibility
|
|
15
15
|
|
|
16
|
-
- The app supplies its own `twenty-sdk`, version `>=1.23.0`, with resolvable `twenty-sdk/define` and `twenty-sdk/front-component` entry points. The installed SDK's Node requirement is checked.
|
|
16
|
+
- The app supplies its own `twenty-sdk`, version `>=1.23.0`, with resolvable `twenty-sdk/define` and `twenty-sdk/front-component` entry points. The installed SDK's Node requirement is checked: a Node below every version the range accepts fails, any other Node outside the range only warns.
|
|
17
17
|
- There is no upper SDK version cap. Every evaluated definition must return the public `ValidationResult` shape: boolean `success`, object `config`, string-array `errors`, and optional string-array `warnings`. An incompatible shape fails with `SDK_SOURCE_UNSUPPORTED`. This validates the loader contract, not every future SDK behavior.
|
|
18
18
|
- The CLI owns esbuild, its TypeScript parser and tinyglobby as runtime dependencies. These load only for source operations. The app does not need to install TypeScript for source loading. Build and typecheck use the project's compiler separately.
|
|
19
19
|
- The pull writer separately checks the authoring exports its generated files use; this loader floor does not establish that every SDK since 1.23 supports all current manifest collections.
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-CL6mrTMT-B748cNNG.cjs"),n=require("./utils-B8EXJeaX-DK3gCslL.cjs");function r(e){if(!t.ft(e))throw TypeError(`Invalid UUID`);let n;return Uint8Array.of((n=parseInt(e.slice(0,8),16))>>>24,n>>>16&255,n>>>8&255,n&255,(n=parseInt(e.slice(9,13),16))>>>8,n&255,(n=parseInt(e.slice(14,18),16))>>>8,n&255,(n=parseInt(e.slice(19,23),16))>>>8,n&255,(n=parseInt(e.slice(24,36),16))/1099511627776&255,n/4294967296&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255)}function i(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}var a=`6ba7b810-9dad-11d1-80b4-00c04fd430c8`,o=`6ba7b811-9dad-11d1-80b4-00c04fd430c8`;function s(e,n,a,o,s,c){let l=typeof a==`string`?i(a):a,u=typeof o==`string`?r(o):o;if(typeof o==`string`&&(o=r(o)),o?.length!==16)throw TypeError(`Namespace must be array-like (16 iterable integer values, 0-255)`);let d=new Uint8Array(16+l.length);if(d.set(u),d.set(l,u.length),d=n(d),d[6]=d[6]&15|e,d[8]=d[8]&63|128,s){if(c||=0,c<0||c+16>s.length)throw RangeError(`UUID byte range ${c}:${c+15} is out of buffer bounds`);for(let e=0;e<16;++e)s[c+e]=d[e];return s}return t.dt(d)}function c(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:return t^n^r;case 2:return t&n^t&r^n&r;case 3:return t^n^r}}function l(e,t){return e<<t|e>>>32-t}function u(e){let t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(e.length+1);r.set(e),r[e.length]=128,e=r;let i=e.length/4+2,a=Math.ceil(i/16),o=Array(a);for(let t=0;t<a;++t){let n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=e[t*64+r*4]<<24|e[t*64+r*4+1]<<16|e[t*64+r*4+2]<<8|e[t*64+r*4+3];o[t]=n}o[a-1][14]=(e.length-1)*8/2**32,o[a-1][14]=Math.floor(o[a-1][14]),o[a-1][15]=(e.length-1)*8&4294967295;for(let e=0;e<a;++e){let r=new Uint32Array(80);for(let t=0;t<16;++t)r[t]=o[e][t];for(let e=16;e<80;++e)r[e]=l(r[e-3]^r[e-8]^r[e-14]^r[e-16],1);let i=n[0],a=n[1],s=n[2],u=n[3],d=n[4];for(let e=0;e<80;++e){let n=Math.floor(e/20),o=l(i,5)+c(n,a,s,u)+d+t[n]+r[e]>>>0;d=u,u=s,s=l(a,30)>>>0,a=i,i=o}n[0]=n[0]+i>>>0,n[1]=n[1]+a>>>0,n[2]=n[2]+s>>>0,n[3]=n[3]+u>>>0,n[4]=n[4]+d>>>0}return Uint8Array.of(n[0]>>24,n[0]>>16,n[0]>>8,n[0],n[1]>>24,n[1]>>16,n[1]>>8,n[1],n[2]>>24,n[2]>>16,n[2]>>8,n[2],n[3]>>24,n[3]>>16,n[3]>>8,n[3],n[4]>>24,n[4]>>16,n[4]>>8,n[4])}function d(e,t,n,r){return s(80,u,e,t,n,r)}d.DNS=a,d.URL=o;function f(e){if(!t.ft(e))throw TypeError(`Invalid UUID`);return parseInt(e.slice(14,15),16)}function p(e){return e instanceof Boolean||typeof e==`boolean`}function m(e){return e instanceof String||typeof e==`string`}function h(e){return e!=null&&(typeof e==`object`||typeof e==`function`)&&!Array.isArray(e)}var ee=[`choice`,`score`,`boolean`],g=e.t(),_=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}({}),v=`trigger`,te=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},ne=/{{([^{}]+)}}/g;function*y(e){if((0,g.isString)(e)){for(let[,n]of e.matchAll(ne))t.zt(n)&&(yield n);return}if((0,g.isObject)(e))for(let t of Object.values(e))yield*y(t)}var re=e=>[...y(e)],ie=(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]},ae=e=>{if(!t.zt(e)||!h(e)||Array.isArray(e))return!1;let n=Object.values(e);return n.length===0?!1:n.every(e=>t.zt(e)&&h(e)&&p(e.isLeaf))},b=(e,t=[])=>{let n=[];if(!(0,g.isObject)(e))return n;for(let[r,i]of Object.entries(e)){if(!(0,g.isObject)(i))continue;let e=[...t,r];n.push(e.join(`.`)),!i.isLeaf&&(0,g.isObject)(i.value)&&n.push(...b(i.value,e))}return n},oe=({schema:e,propertyPath:n})=>{let r=e;for(let e=0;e<n.length;e++){let i=n[e];if(!t.zt(i))return;if(!(0,g.isObject)(r))return{validPrefix:n.slice(0,e),failedSegment:i,availableKeys:[]};let a=r[i];if(!t.zt(a))return{validPrefix:n.slice(0,e),failedSegment:i,availableKeys:Object.keys(r)};if(a.isLeaf){let r=n[e+1];return t.zt(r)?{validPrefix:n.slice(0,e+1),failedSegment:r,availableKeys:[]}:void 0}r=a.value}},x={found:!1},S=e=>t.d(e)&&p(e.isLeaf),C=e=>t.d(e)&&e._outputSchemaType===`RECORD`&&t.d(e.fields),w=e=>t.d(e)&&!(`_outputSchemaType`in e)&&S(e.first)&&e.first.isLeaf===!1&&C(e.first.value)&&S(e.totalCount),T=e=>({found:!0,type:m(e.type)?e.type:void 0,label:m(e.label)?e.label:void 0}),E=(e,t)=>t.length===0?T(e):O(e.value,t),se=(e,t)=>{for(let n=1;n<=t.length;n++){let r=e[t.slice(0,n).join(`.`)];if(S(r))return E(r,t.slice(n))}return x},ce=(e,t)=>{let[n,...r]=t;if(n===`first`)return r.length===0?T(e.first):O(e.first.value,r);if(n===`all`||n===`totalCount`){let t=e[n];return r.length===0&&S(t)?T(t):x}return x},D=(e,n)=>{let[r,...i]=n;if(!t.zt(r))return x;let a=e[r];return S(a)?E(a,i):t.zt(a)?i.length===0?{found:!0}:t.d(a)?D(a,i):x:x},O=(e,n)=>n.length===0||!t.d(e)?x:C(e)?se(e.fields,n):w(e)?ce(e,n):D(e,n),le=({schema:e,propertyPath:t})=>O(e,t),k=e=>{let n=[];for(let[r,i]of Object.entries(e))if(S(i)){if(n.push(r),i.isLeaf)continue;let e=i.value;if(C(e))for(let t of k(e.fields))n.push(`${r}.${t}`);else if(t.d(e))for(let t of k(e))n.push(`${r}.${t}`)}else if(t.zt(i)&&(n.push(r),t.d(i)))for(let e of k(i))n.push(`${r}.${e}`);return n},A=e=>{if(!t.d(e))return[];if(C(e))return k(e.fields);if(w(e)){let n=[];if(S(e.first)){n.push(`first`);for(let t of A(e.first.value))n.push(`first.${t}`)}return t.zt(e.all)&&n.push(`all`),n.push(`totalCount`),n}return k(e)},ue=3,j=e=>t.d(e)?e._outputSchemaType===`RECORD`?!0:Object.values(e).some(e=>t.d(e)&&j(e.value)):!1,M=(e,t)=>t.map(t=>({candidate:t,distance:ie(e,t)})).filter(({candidate:e,distance:t})=>t<=Math.ceil(e.length/2)).sort((e,t)=>e.distance-t.distance).slice(0,ue).map(({candidate:e})=>e),de=({schema:e,propertyPath:n,referencedStepId:r})=>{if(!ae(e)||j(e)){let t=A(e);return M(n.join(`.`),t).map(e=>[r,e].join(`.`))}let i=oe({schema:e,propertyPath:n});if(!t.zt(i))return[];let a=M(i.failedSegment,i.availableKeys).map(e=>[r,...i.validPrefix,e].join(`.`));if((0,g.isNonEmptyArray)(a))return a;let o=b(e);return M(n.join(`.`),o).map(e=>[r,e].join(`.`))},fe=({workflow:e,graph:n,stepsById:r})=>{let i=[],a=new Set(e.steps?.map(e=>e.id)??[]);for(let o of e.steps??[]){let s=re(o.settings?.input),c=n.ancestorsByStepId.get(o.id)??new Set;for(let n of s){let s=te(n),l=s[0];if(!t.zt(l)){i.push({severity:`error`,code:`VARIABLE_INVALID_PATH`,message:`Step "${o.name??o.id}" has a variable "{{${n}}}" with an invalid path. Variable references must start with a step ID, e.g. "{{stepId.property}}".`,stepId:o.id,path:n});continue}let u=l===v;if(!u&&!a.has(l)){i.push({severity:`error`,code:`VARIABLE_UNKNOWN_STEP`,message:`Step "${o.name??o.id}" references variable "{{${n}}}" from an unknown step "${l}".`,stepId:o.id,path:n});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 "{{${n}}}" 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:n});continue}i.push(...pe({step:o,variable:n,pathSegments:s,referencedStepId:l,isTriggerReference:u,trigger:e.trigger,stepsById:r}))}}return i},pe=({step:e,variable:n,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=t.zt(l)&&(0,g.isObject)(l)&&!Array.isArray(l)&&Object.keys(l).length===0;if(!t.zt(l)||u)return[];if(!le({schema:l,propertyPath:c}).found){let r=de({schema:l,propertyPath:c,referencedStepId:i}),a=he(l,i),o=(0,g.isNonEmptyArray)(r)?`Did you mean "{{${r[0]}}}"?${r.length>1?` Other options: ${r.slice(1).map(e=>`{{${e}}}`).join(`, `)}.`:``}`:(0,g.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 "{{${n}}}" but the path "${c.join(`.`)}" was not found in the output of step "${i}".`,stepId:e.id,path:n,...t.zt(o)?{hint:o}:{},...(0,g.isNonEmptyArray)(r)?{suggestions:r}:{},...(0,g.isNonEmptyArray)(a)?{availablePaths:a}:{}}]}return[]},me=20,he=(e,t)=>A(e).slice(0,me).map(e=>`${t}.${e}`),N=[1e3,5e3,15e3],P=t.kt({input:t.Et({}).describe(`Input data for the workflow action. Structure depends on the action type.`),outputSchema:t.Et({}).describe(`Schema defining the output data structure. This data can be referenced in subsequent steps using {{stepId.fieldName}}.`),errorHandlingOptions:t.kt({retryOnFailure:t.kt({value:t.At(e=>typeof e==`boolean`?Number(e):e,t.Ot().int().min(0).max(N.length).describe(`How many times to retry the action if it fails, between 0 and ${N.length}. 0 disables retries.`))}),continueOnFailure:t.kt({value:t.bt().describe(`Whether to continue to the next step if this action fails.`)})})}),ge={expectedOutputSchema:t.Et({}).optional().describe(`A sample output value declared by the user for steps whose output structure is only known at runtime.`)},_e=P.extend({input:t.kt({url:t.Nt(),method:t.gt([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`]),headers:t.jt(t.Nt(),t.Nt()).optional(),body:t.jt(t.Nt(),t.Pt([t.Nt(),t.Ot(),t.bt(),t._t(),t.yt(t.Pt([t.Nt(),t.Ot(),t.bt(),t._t()]))])).or(t.Nt()).optional()}),...ge}),ve=/^[a-zA-Z0-9_-]{1,64}$/,ye=t.kt({id:t.It().describe(`Stable identifier for this criterion row.`),name:t.Nt().describe(`Option name for a choice question, or the label of one score level.`),description:t.Nt().optional().describe(`What the model should understand this option to mean.`)}),be=t.kt({id:t.It().describe(`Stable identifier for this question row.`),name:t.Nt().regex(ve,`Answer name must be empty or contain 1 to 64 characters using only letters, digits, underscores and dashes`).or(t.Tt(``)).describe(`Answer key for this question, made of letters, digits, underscores and dashes. Downstream steps read {{stepId.answers.<name>}}.`),type:t.gt(ee).describe(`choice picks one option, score grades an ordered rubric, boolean estimates the probability that a statement holds.`),instructions:t.Nt().describe(`What the model should decide about the shared state.`),criteria:t.yt(ye).describe(`Options for a choice question, or ordered levels (lowest first) for a score question. Empty for boolean.`)}),xe=P.extend({input:t.kt({state:t.Nt().describe(`The shared state every question is asked about. Supports variables.`),questions:t.yt(be)})}),Se=P.extend({input:t.kt({items:t.Pt([t.yt(t.Pt([t.Nt(),t.Ot(),t.bt(),t._t(),t.jt(t.Nt(),t.vt()),t.vt()])),t.Nt()]).optional(),initialLoopStepIds:t.yt(t.Nt()).optional(),shouldContinueOnIterationFailure:t.bt().optional()})}),Ce=P.extend({input:t.kt({delayType:t.gt([`SCHEDULED_DATE`,`DURATION`]),scheduledDateTime:t.Nt().nullable().optional(),duration:t.kt({days:t.Pt([t.Ot().min(0),t.Nt()]).optional(),hours:t.Pt([t.Ot().min(0),t.Nt()]).optional(),minutes:t.Pt([t.Ot().min(0),t.Nt()]).optional(),seconds:t.Pt([t.Ot().min(0),t.Nt()]).optional()}).optional()})}),we=P.extend({input:t.kt({eventName:t.Nt().describe(`Event to wait for, in format objectName.action (e.g., "company.updated", "task.created", "person.deleted").`),recordId:t.Nt().nullable().optional().describe(`Only resume for this record. Usually a variable such as {{trigger.object.id}}. Leave empty to resume on any record.`),updatedFields:t.yt(t.Nt()).nullable().optional().describe(`For update events, only resume when one of these fields changed.`),timeout:t.kt({days:t.Pt([t.Ot().min(0),t.Nt()]).optional(),hours:t.Pt([t.Ot().min(0),t.Nt()]).optional(),minutes:t.Pt([t.Ot().min(0),t.Nt()]).optional()}).nullable().optional().describe(`Stop waiting after this duration. The step then succeeds with hasTimedOut set to true.`)})}),Te=P.extend({input:t.kt({})}),F=t.jt(t.Nt(),t.vt()).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.object.id}}"}}
|
|
3
|
-
- Company: {"name": "Acme Corp", "domainName": {"primaryLinkUrl": "https://acme.com"}}
|
|
4
|
-
- Task: {"title": "Follow up", "status": "TODO", "assignee": {"id": "{{user.id}}"}}`),Ee=P.extend({input:t.kt({objectName:t.Nt().describe(`The name of the object to create a record in. Must be lowercase (e.g., "person", "company", "task").`),objectRecord:F.describe(`The record data to create.`)})}),De=P.extend({input:t.kt({objectName:t.Nt(),objectRecord:F,objectRecordId:t.Nt(),fieldsToUpdate:t.yt(t.Nt())})}),Oe=P.extend({input:t.kt({objectName:t.Nt(),objectRecord:F})}),ke=P.extend({input:t.kt({objectName:t.Nt(),objectRecordId:t.Nt()})}),I=t.Nt().regex(/^{{[^{}]+}}$/,`Expected a workflow variable reference like {{stepId.path}}`),Ae=P.extend({input:t.kt({objectName:t.Nt(),limit:t.Pt([t.Ot(),I]).optional(),offset:t.Pt([t.Ot().int().nonnegative(),I]).optional(),filter:t.kt({recordFilterGroups:t.yt(t.vt()).optional(),recordFilters:t.yt(t.vt()).optional()}).optional(),orderBy:t.kt({recordSorts:t.yt(t.vt()).optional(),gqlOperationOrderBy:t.yt(t.jt(t.Nt(),t.vt())).optional()}).optional()})}),je=t.kt({id:t.Nt(),name:t.Nt(),label:t.Nt(),type:t.Pt([t.Tt(t.rt.TEXT),t.Tt(t.rt.NUMBER),t.Tt(t.rt.DATE),t.Tt(t.rt.SELECT),t.Tt(t.rt.MULTI_SELECT),t.Tt(`RECORD`)]),placeholder:t.Nt().optional(),settings:t.jt(t.Nt(),t.vt()).optional(),value:t.vt().optional()}),Me=P.extend({input:t.yt(je),instructions:t.Nt().optional()}),L=t.kt({id:t.Nt(),logicalOperator:t.gt(t.N),parentStepFilterGroupId:t.Nt().optional(),positionInStepFilterGroup:t.Ot().optional()}),R=t.kt({id:t.Nt(),type:t.Nt(),stepOutputKey:t.Nt(),operand:t.gt(t.G).or(t.gt(t.I)),value:t.Nt(),stepFilterGroupId:t.Nt(),positionInStepFilterGroup:t.Ot().optional(),fieldMetadataId:t.Nt().optional(),compositeFieldSubFieldName:t.Nt().optional()}),Ne=P.extend({input:t.kt({stepFilterGroups:t.yt(L),stepFilters:t.yt(R)})}),Pe=t.kt({id:t.Nt(),nextStepIds:t.yt(t.Nt()),filterGroupId:t.Nt().optional()}),Fe=P.extend({input:t.kt({stepFilterGroups:t.yt(L),stepFilters:t.yt(R),branches:t.yt(Pe)})}),z=t.gt([`RANDOM`,`ROUND_ROBIN`,`LOAD_BALANCED`]);P.extend({input:t.kt({objectName:t.Nt(),strategy:z,recordIds:t.yt(t.Nt()),loadBalance:t.kt({objectNameSingular:t.Nt(),fieldName:t.Nt()}).optional()}).superRefine((e,n)=>{e.strategy===`LOAD_BALANCED`&&!t.zt(e.loadBalance)&&n.addIssue({code:t.ht.custom,path:[`loadBalance`],message:`loadBalance is required when strategy is LOAD_BALANCED`})})});var Ie=e=>{let t=e.settings?.input;return e.type===_.IF_ELSE&&(0,g.isObject)(t)&&`branches`in t&&Array.isArray(t.branches)},B=e=>{let t=e.settings?.input;return e.type===_.ITERATOR&&(0,g.isObject)(t)&&`initialLoopStepIds`in t&&(0,g.isNonEmptyArray)(t.initialLoopStepIds)},Le=e=>{let n=e.settings?.input;if(t.zt(n)&&(0,g.isObject)(n))return n},Re=e=>{let t=new Set(e.nextStepIds??[]);if(Ie(e))for(let n of e.settings.input.branches??[])for(let e of n?.nextStepIds??[])t.add(e);if(B(e))for(let n of e.settings.input.initialLoopStepIds??[])t.add(n);return[...t]},ze=({trigger:e,steps:n})=>{let r=new Map,i=t.zt(e?.nextStepIds)?e.nextStepIds.filter(t.zt):[];r.set(v,i);for(let e of n??[])r.set(e.id,Re(e));let a=new Set,o=[v];for(;o.length>0;){let e=o.shift();if(!(!t.zt(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:Be(r)}},Be=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},Ve=({workflow:e,graph:n})=>{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(!t.zt(d)||a.has(f))return;i.add(e),B(d)&&(d.settings.input.initialLoopStepIds??[]).forEach(t=>s(t,[...c,e],e));let p=d.type===_.ITERATOR?d.nextStepIds??[]:n.childrenByStepId.get(e)??[];t.zt(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},He=({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(t.zt);n.r(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(...Ue(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},Ue=e=>{let n=[],r=Le(e);if(e.type===_.IF_ELSE){let i=r?.branches,a=Array.isArray(i)?i:[];a.length<2&&n.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(t.zt).map(e=>e.id));for(let r of a){let i=r?.nextStepIds;(!Array.isArray(i)||i.length===0)&&n.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}),t.zt(r?.filterGroupId)&&!s.has(r.filterGroupId)&&n.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===_.ITERATOR){let t=r,i=t?.items,a=typeof i==`string`&&i.length>0||Array.isArray(i)&&i.length>0,o=t?.initialLoopStepIds,s=Array.isArray(o)&&o.length>0;a&&!s&&n.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 n},We=`20202020-64aa-4b6f-b003-9c74b97cee20`,V=({entityNamespace:e,value:t,applicationUniversalIdentifier:n})=>d(`${e}:${t}`,n),Ge=({applicationUniversalIdentifier:e,objectUniversalIdentifier:t,name:n})=>V({entityNamespace:`fieldMetadata`,value:`${t}:${n}`,applicationUniversalIdentifier:e}),H=({applicationUniversalIdentifier:e,objectUniversalIdentifier:t,name:n})=>V({entityNamespace:`pageLayout`,value:t?`${t}:${n}`:n,applicationUniversalIdentifier:e}),Ke=({objectMetadataApplicationUniversalIdentifier:e,pageLayoutUniversalIdentifier:t,title:n})=>V({entityNamespace:`pageLayoutTab`,value:`${t}:${n}`,applicationUniversalIdentifier:e}),qe=({objectMetadataApplicationUniversalIdentifier:e,pageLayoutTabUniversalIdentifier:t,title:n})=>V({entityNamespace:`pageLayoutWidget`,value:`${t}:${n}`,applicationUniversalIdentifier:e}),Je=({objectMetadataApplicationUniversalIdentifier:e,objectUniversalIdentifier:n})=>H({applicationUniversalIdentifier:e,objectUniversalIdentifier:n,name:t.q.RECORD_PAGE}),Ye=({applicationUniversalIdentifier:e,objectUniversalIdentifier:t,relationTargetObjectUniversalIdentifier:n})=>V({entityNamespace:`fieldMetadata`,value:`${t}:systemRelation:${n}`,applicationUniversalIdentifier:e}),Xe=({objectMetadataApplicationUniversalIdentifier:e,viewUniversalIdentifier:t,name:n})=>V({entityNamespace:`viewFieldGroup`,value:`${t}:${n}`,applicationUniversalIdentifier:e}),Ze=({fieldMetadataApplicationUniversalIdentifier:e,viewUniversalIdentifier:t,fieldMetadataUniversalIdentifier:n})=>V({entityNamespace:`viewField`,value:`${t}:${n}`,applicationUniversalIdentifier:e}),Qe={INDEX:`INDEX`,FIELDS_WIDGET:`FIELDS_WIDGET`},$e=({objectMetadataApplicationUniversalIdentifier:e,objectUniversalIdentifier:t,viewKey:n})=>V({entityNamespace:`view`,value:`${t}:${n}`,applicationUniversalIdentifier:e}),U=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(U).filter(e=>e!==U.OK&&e!==U.UNKNOWN),t.rt.TEXT,t.rt.ARRAY,t.rt.BOOLEAN,t.rt.DATE,t.rt.DATE_TIME,t.rt.NUMBER,t.rt.NUMERIC,t.rt.RAW_JSON,t.rt.RICH_TEXT,t.rt.SELECT,t.rt.MULTI_SELECT,_.SEND_EMAIL,_.DRAFT_EMAIL,_.CREATE_CALENDAR_EVENT;var et=`public`,tt=`front-component-shared-dependencies.mjs`,nt=`twenty:front-component-shared-dependencies`,rt={js:`import { createRequire as __createRequire } from 'module';
|
|
5
|
-
const require = __createRequire(import.meta.url);`},it=`.twenty/output`,at=({applicationUniversalIdentifier:e,roleUniversalIdentifier:t,fieldUniversalIdentifier:n})=>V({entityNamespace:`fieldPermission`,value:`${t}:${n}`,applicationUniversalIdentifier:e}),ot=({applicationUniversalIdentifier:e,roleUniversalIdentifier:t,objectUniversalIdentifier:n})=>V({entityNamespace:`objectPermission`,value:`${t}:${n}`,applicationUniversalIdentifier:e}),st=({objectMetadataApplicationUniversalIdentifier:e,objectUniversalIdentifier:n})=>H({applicationUniversalIdentifier:e,objectUniversalIdentifier:n,name:t.q.RECORD_FORM}),ct=({pageLayoutTabManifest:e,pageLayoutType:r})=>{let i=e.layoutMode??(r===t.q.STANDALONE_PAGE?t.ct.VERTICAL_LIST:t.ct.GRID),a=e.widgets??[],o=[];if(!Object.values(t.ct).some(e=>e===i))return{status:`fail`,errors:[`Page layout tab "${e.title}" defines unsupported layoutMode "${i}". Expected GRID, VERTICAL_LIST or CANVAS.`]};for(let n of a){let r=[n.heightBehavior,t.d(n.position)&&`heightBehavior`in n.position?n.position.heightBehavior:void 0].filter(t.zt);r.length>0&&i!==t.ct.VERTICAL_LIST&&o.push(`Page layout widget "${n.title}" defines heightBehavior, but its parent tab "${e.title}" uses ${i}. heightBehavior is only supported for VERTICAL_LIST tabs.`);for(let e of r)Object.values(t.st).some(t=>t===e)||o.push(`Page layout widget "${n.title}" defines unsupported heightBehavior "${e}". Expected FIT_CONTENT or TAB_VIEWPORT.`)}if(o.length>0)return{status:`fail`,errors:o};let s={...e,layoutMode:i,widgets:a.map(({heightBehavior:e,position:r,gridPosition:a,...o},s)=>{if(t.zt(r))return{...o,position:r.layoutMode===t.ct.VERTICAL_LIST&&t.zt(e)?{...r,heightBehavior:e}:r};if(t.zt(a))return{...o,position:{layoutMode:t.ct.GRID,...a}};switch(i){case t.ct.GRID:return{...o,position:{layoutMode:i,row:0,column:0,rowSpan:t._.default.h,columnSpan:t._.default.w}};case t.ct.VERTICAL_LIST:return{...o,position:{layoutMode:i,index:s,...t.zt(e)?{heightBehavior:e}:{}}};case t.ct.CANVAS:return{...o,position:{layoutMode:i}};default:return n.s(i)}})};for(let e of s.widgets)e.position.layoutMode!==i&&o.push(`Page layout widget "${e.title}" uses a ${e.position.layoutMode} position, but its parent tab "${s.title}" uses ${i}.`);if(i===t.ct.VERTICAL_LIST){let e=s.widgets.filter(({type:e,position:r})=>r.layoutMode===t.ct.VERTICAL_LIST&&n.i({widgetType:e,heightBehavior:r.heightBehavior})===t.st.TAB_VIEWPORT);e.length>1&&o.push(`Page layout tab "${s.title}" can contain only one TAB_VIEWPORT widget.`);let r=e.length===1?e[0]:void 0;t.zt(r)&&s.widgets.some(e=>e!==r&&e.position.layoutMode===t.ct.VERTICAL_LIST&&r.position.layoutMode===t.ct.VERTICAL_LIST&&e.position.index>=r.position.index)&&o.push(`Page layout tab "${s.title}" must place its TAB_VIEWPORT widget last.`)}return o.length>0?{status:`fail`,errors:o}:{status:`success`,pageLayoutTab:s}},W=[`canReadObjectRecords`,`canUpdateObjectRecords`,`canSoftDeleteObjectRecords`,`canDestroyObjectRecords`],G={canReadObjectRecords:`canReadAllObjectRecords`,canUpdateObjectRecords:`canUpdateAllObjectRecords`,canSoftDeleteObjectRecords:`canSoftDeleteAllObjectRecords`,canDestroyObjectRecords:`canDestroyAllObjectRecords`},K=({role:e,objectUniversalIdentifier:t})=>{let n=e.objectPermissions?.find(e=>e.objectUniversalIdentifier===t);return{canReadObjectRecords:n?.canReadObjectRecords??e[G.canReadObjectRecords]??!1,canUpdateObjectRecords:n?.canUpdateObjectRecords??e[G.canUpdateObjectRecords]??!1,canSoftDeleteObjectRecords:n?.canSoftDeleteObjectRecords??e[G.canSoftDeleteObjectRecords]??!1,canDestroyObjectRecords:n?.canDestroyObjectRecords??e[G.canDestroyObjectRecords]??!1}},lt=e=>JSON.stringify(e,(e,n)=>t.d(n)?Object.fromEntries(Object.entries(n).sort(([e],[t])=>e.localeCompare(t))):n),ut=({groupsByUniversalIdentifier:e,predicateGroupUniversalIdentifier:n})=>{let r=[],i=new Set,a=n;for(;t.zt(a)&&!i.has(a);){i.add(a);let n=e.get(a);if(!t.zt(n))break;r.push(n.logicalOperator),a=n.parentPredicateGroupUniversalIdentifier}return r},q=({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=>lt({fieldUniversalIdentifier:e.fieldUniversalIdentifier,subFieldName:e.subFieldName??null,operand:e.operand,value:e.value??null,workspaceMemberFieldUniversalIdentifier:e.workspaceMemberFieldUniversalIdentifier??null,workspaceMemberSubFieldName:e.workspaceMemberSubFieldName??null,groupOperatorPath:ut({groupsByUniversalIdentifier:n,predicateGroupUniversalIdentifier:e.predicateGroupUniversalIdentifier})})).sort()},dt=t.n.map(e=>t.f[e]),ft=({roleSignature:e,supersetSignature:t})=>e.length===t.length&&e.every((e,n)=>e===t[n]),pt=({role:e,superset:t})=>[...W.filter(n=>{let r=G[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`}]:[]],mt=({role:e,superset:t,toolPermissionFlagUniversalIdentifiers:n})=>{let r=new Set([...dt,...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}))},ht=({role:e,superset:t})=>[...new Set([...[...e.objectPermissions??[],...t.objectPermissions??[]].map(e=>e.objectUniversalIdentifier),...(t.rowLevelPermissionPredicates??[]).map(e=>e.objectUniversalIdentifier)])].flatMap(n=>{let r=K({role:e,objectUniversalIdentifier:n}),i=K({role:t,objectUniversalIdentifier:n}),a=W.filter(e=>r[e]&&!i[e]).map(e=>({type:`OBJECT_RECORDS`,objectUniversalIdentifier:n,action:e})),o=W.some(e=>r[e]),s=q({role:t,objectUniversalIdentifier:n}),c=q({role:e,objectUniversalIdentifier:n});return o&&s.length>0&&!ft({roleSignature:c,supersetSignature:s})?[...a,{type:`ROW_LEVEL_RESTRICTION`,objectUniversalIdentifier:n}]:a}),gt=({role:e,superset:t})=>(t.fieldPermissions??[]).flatMap(t=>{let{objectUniversalIdentifier:n,fieldUniversalIdentifier:r}=t,i=K({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`}]:[]]}),_t=({role:e,superset:t,toolPermissionFlagUniversalIdentifiers:n})=>[...pt({role:e,superset:t}),...mt({role:e,superset:t,toolPermissionFlagUniversalIdentifiers:n}),...ht({role:e,superset:t}),...gt({role:e,superset:t})],vt=e=>t.ft(e)&&f(e)>=4,J={universalIdentifier:t.It(),name:t.Nt().min(1),nextStepIds:t.yt(t.It()),position:t.kt({x:t.Ot(),y:t.Ot()}).optional(),outputSchema:t.jt(t.Nt(),t.Ft()).optional(),expectedOutputSchema:t.jt(t.Nt(),t.Ft()).optional(),errorHandlingOptions:P.shape.errorHandlingOptions.optional()},Y=(e,n)=>t.Mt({...J,type:t.Tt(e),input:n}),X=t.Et({fieldMetadataUniversalIdentifier:t.It(),fieldMetadataId:t.Dt().optional()}),Z=R.omit({fieldMetadataId:!0}).extend({fieldMetadataUniversalIdentifier:t.It().optional()}).strict(),Q={objectUniversalIdentifier:t.It()},yt=t.xt(`type`,[t.Mt({...J,type:t.Tt(`LOGIC_FUNCTION`),logicFunctionUniversalIdentifier:t.It(),input:t.jt(t.Nt(),t.Ft())}),Y(`HTTP_REQUEST`,_e.shape.input),Y(`CLASSIFY`,xe.shape.input),Y(`ITERATOR`,Se.shape.input),Y(`DELAY`,Ce.shape.input),Y(`WAIT_FOR_EVENT`,we.shape.input),Y(`EMPTY`,Te.shape.input),Y(`CREATE_RECORD`,Ee.shape.input.omit({objectName:!0}).extend(Q).strict()),Y(`UPDATE_RECORD`,De.shape.input.omit({objectName:!0}).extend(Q).strict()),Y(`UPSERT_RECORD`,Oe.shape.input.omit({objectName:!0}).extend(Q).strict()),Y(`DELETE_RECORD`,ke.shape.input.omit({objectName:!0}).extend(Q).strict()),Y(`FIND_RECORDS`,Ae.shape.input.omit({objectName:!0,filter:!0,orderBy:!0}).extend({...Q,filter:t.Mt({recordFilterGroups:t.yt(t.jt(t.Nt(),t.Ft())).optional(),recordFilters:t.yt(X).optional()}).optional(),orderBy:t.Mt({recordSorts:t.yt(X.extend({direction:t.gt([`ASC`,`DESC`]),subFieldName:t.Nt().nullable().optional()})).optional()}).optional()}).strict()),Y(`PICK_RECORD`,t.Mt({...Q,strategy:z,recordIds:t.yt(t.Nt()),loadBalance:t.Mt({objectUniversalIdentifier:t.It(),fieldUniversalIdentifier:t.It()}).optional()}).superRefine((e,n)=>{e.strategy===`LOAD_BALANCED`&&!t.zt(e.loadBalance)&&n.addIssue({code:`custom`,path:[`loadBalance`],message:`loadBalance is required when strategy is LOAD_BALANCED`})})),Y(`FILTER`,Ne.shape.input.extend({stepFilters:t.yt(Z)})),Y(`IF_ELSE`,Fe.shape.input.extend({stepFilters:t.yt(Z)})),Y(`FORM`,t.yt(Me.shape.input.element.extend({settings:t.jt(t.Nt(),t.Ft()).optional()}).superRefine((e,n)=>{e.type===`RECORD`&&!t.It().safeParse(e.settings?.objectUniversalIdentifier).success&&n.addIssue({code:`custom`,path:[`settings`,`objectUniversalIdentifier`],message:`Record picker fields require an object universal identifier`})}))),Y(`AI_AGENT`,t.Mt({agentUniversalIdentifier:t.It().optional(),prompt:t.Nt()}))]),bt=t.xt(`type`,[t.Mt({type:t.Tt(`GLOBAL`)}),t.Mt({type:t.Tt(`SINGLE_RECORD`),objectUniversalIdentifier:t.It()}),t.Mt({type:t.Tt(`BULK_RECORDS`),objectUniversalIdentifier:t.It()})]),$=[t.Mt({universalIdentifier:t.It(),type:t.Tt(`MANUAL`),nextStepIds:t.yt(t.It()).min(1),settings:t.Mt({availability:bt.optional(),icon:t.Nt().optional(),isPinned:t.bt().optional()}).superRefine((e,n)=>{!t.zt(e.availability)&&(t.zt(e.icon)||t.zt(e.isPinned))&&n.addIssue({code:`custom`,path:[`availability`],message:`Set an availability for the icon and pin to show in the command menu`})}).optional()})],xt=$.map(e=>e.shape.type.value),St=t.xt(`type`,$,{error:e=>e.code===`invalid_union`?`Unsupported trigger type. Application workflows support: ${xt.join(`, `)}`:void 0});t.Mt({universalIdentifier:t.It(),name:t.Nt().min(1),version:t.Mt({trigger:St,steps:t.yt(yt).min(1)})}).superRefine((e,t)=>{let{steps:n,trigger:r}=e.version,i=[e.universalIdentifier,r.universalIdentifier,...n.map(e=>e.universalIdentifier)];new Set(i).size!==i.length&&t.addIssue({code:`custom`,message:`Workflow, trigger and steps must have distinct universal identifiers`});let a={trigger:{type:r.type,nextStepIds:r.nextStepIds},steps:n.map(e=>({...e,id:e.universalIdentifier,settings:{input:e.input}}))},o=ze(a);for(let e of[...He({workflow:a,graph:o}),...Ve({workflow:a,graph:o}),...fe({workflow:a,graph:o,stepsById:new Map(a.steps.map(e=>[e.id,e]))})])e.severity===`error`&&t.addIssue({code:`custom`,message:e.message})}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return We}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return st}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return Je}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return et}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return _t}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return it}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return vt}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return at}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return $e}});
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-CL6mrTMT-B748cNNG.cjs"),n=require("./application-DuIJE2qG.cjs"),r=require("./metadata-D9sQOTRK.cjs"),i=require("./print-typescript-value-DhElcFzI.cjs"),a=require("./kebab-case-D0usAzG-.cjs");var o=80,s=e=>[{path:[...e,`type`],symbol:`FieldType`,members:t.rt},{path:[...e,`writability`],symbol:`MetadataWritability`,members:t.J},{path:[...e,`universalSettings`,`relationType`],symbol:`RelationType`,members:t.B},{path:[...e,`universalSettings`,`onDelete`],symbol:`OnDeleteAction`,members:t.M},{path:[...e,`universalSettings`,`dataType`],symbol:`NumberDataType`,members:t.R},{path:[...e,`universalSettings`,`displayFormat`],symbol:`DateDisplayFormat`,members:t.V}],c=s([]),l=[{path:[`writability`],symbol:`MetadataWritability`,members:t.J},{path:[`openRecordIn`],symbol:`ObjectOpenRecordIn`,members:t.tt},...s([`fields`,`[]`])],u=[{path:[`indexType`],symbol:`IndexType`,members:t.P}],d=[{path:[`rowLevelPermissionPredicateGroups`,`[]`,`logicalOperator`],symbol:`RowLevelPermissionPredicateGroupLogicalOperator`,members:t.Q},{path:[`rowLevelPermissionPredicates`,`[]`,`operand`],symbol:`RowLevelPermissionPredicateOperand`,members:t.O},{path:[`permissionFlagUniversalIdentifiers`,`[]`],symbol:`SystemPermissionFlag`,members:t.f}],f=e=>({path:e,symbol:`AggregateOperations`,members:t.it}),p=[f([`aggregateOperation`])],m=[{path:[`type`],symbol:`ViewType`,members:t.L},{path:[`visibility`],symbol:`ViewVisibility`,members:t.nt},{path:[`openRecordIn`],symbol:`ViewOpenRecordIn`,members:t.K},f([`kanbanAggregateOperation`]),{path:[`calendarLayout`],symbol:`ViewCalendarLayout`,members:t.lt},f([`fields`,`[]`,`aggregateOperation`]),{path:[`filters`,`[]`,`operand`],symbol:`ViewFilterOperand`,members:t.G},{path:[`filterGroups`,`[]`,`logicalOperator`],symbol:`ViewFilterGroupLogicalOperator`,members:t.k},{path:[`sorts`,`[]`,`direction`],symbol:`ViewSortDirection`,members:t.F}],h=e=>[{path:[...e,`type`],symbol:`WidgetType`,members:t.H},{path:[...e,`position`,`layoutMode`],symbol:`PageLayoutTabLayoutMode`,members:t.ct},f([...e,`configuration`,`aggregateOperation`]),...[`dateGranularity`,`primaryAxisDateGranularity`,`secondaryAxisGroupByDateGranularity`].map(n=>({path:[...e,`configuration`,n],symbol:`ObjectRecordGroupByDateGranularity`,members:t.Z}))],g=e=>[{path:[...e,`layoutMode`],symbol:`PageLayoutTabLayoutMode`,members:t.ct},...h([...e,`widgets`,`[]`])],_=h([]),v=g([]),y=[{path:[`type`],symbol:`NavigationMenuItemType`,members:t.X}],b=[{path:[`type`],symbol:`PageLayoutType`,members:t.q},...g([`tabs`,`[]`])],x=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),S=({definer:e,config:n,enumBindings:r=[]})=>{let a=new Set,s=i.t({value:n,resolveEnumSymbol:({path:e,value:n})=>{let i=r.find(t=>x(t.path,e));if(!t.zt(i))return;let o=Object.keys(i.members).find(e=>i.members[e]===n);if(t.zt(o))return a.add(i.symbol),`${i.symbol}.${o}`}}),c=[e,...[...a].sort()],l=`import { ${c.join(`, `)} } from 'twenty-sdk/define';`;return{content:`${l.length<=o?l:`import {\n${c.map(e=>` ${e},`).join(`
|
|
2
|
-
`)}\n} from 'twenty-sdk/define';`}
|
|
3
|
-
|
|
4
|
-
export default ${e}(${s});
|
|
5
|
-
`,requiredSdkExports:c}},C=e.t(),w=80,T=new Map(Object.entries(r.i).flatMap(([e,t])=>Object.entries(t).map(([t,{universalIdentifier:n}])=>[n,{objectName:e,fieldName:t}]))),E=e=>(0,C.isNonEmptyString)(e)&&(0,C.isNonEmptyString)(a.t(e).replace(/-+/g,``)),D=e=>e.slice(0,w).replace(/-+$/g,``),O=({segments:e,universalIdentifier:n})=>{let r=D(e.filter(t.zt).map(a.t).join(`-`).replace(/-{2,}/g,`-`).replace(/^-+|-+$/g,``));return(0,C.isNonEmptyString)(r)?r:n.slice(0,8)},k=({indexManifest:e,objectName:t,fieldLocationByUniversalIdentifier:n})=>O({segments:[t,...e.fields.map(({fieldUniversalIdentifier:e})=>n.get(e)?.fieldName??null)],universalIdentifier:e.universalIdentifier}),A=({viewFieldManifest:e,fieldLocationByUniversalIdentifier:n})=>{let r=n.get(e.fieldMetadataUniversalIdentifier)??T.get(e.fieldMetadataUniversalIdentifier);return O({segments:t.zt(r)?[r.objectName,r.fieldName]:[],universalIdentifier:e.universalIdentifier})},j=`__typename`,M=e=>Array.isArray(e)?e.map(M):typeof e!=`object`||!e?e:Object.fromEntries(Object.entries(e).filter(([e])=>e!==j).map(([e,t])=>[e,M(t)])),N=new Set([`packageJsonChecksum`,`yarnLockChecksum`,`requiredServerVersionRange`,`aboutDescription`,`postInstallLogicFunction`,`preInstallLogicFunction`,`uninstallLogicFunction`,`healthCheckLogicFunction`,`settingsFrontComponent`,`settingsCustomTabFrontComponentUniversalIdentifier`,`frontComponentSharedDependencies`,`logoUrl`,`screenshots`]),P=`public/cover.generated.png`,F=e=>(e.roles??[]).some(({universalIdentifier:t})=>t===e.application.defaultRoleUniversalIdentifier),I=e=>{let t=Object.fromEntries(Object.entries(e.application).filter(([t])=>!N.has(t)&&!(t===`defaultRoleUniversalIdentifier`&&F(e)))),{galleryImages:n}=t;if(!Array.isArray(n)||n.length===0||n.every(e=>e===P)){let{galleryImages:e,...n}=t;return n}return t},L=({permissions:e,getDerivedUniversalIdentifier:t})=>e.map(({universalIdentifier:e,...n})=>e===t(n)?n:{universalIdentifier:e,...n}),R=({roleManifest:e,applicationUniversalIdentifier:r})=>{let{universalIdentifier:i,objectPermissions:a,fieldPermissions:o}=e;return{...e,...t.zt(a)?{objectPermissions:L({permissions:a,getDerivedUniversalIdentifier:({objectUniversalIdentifier:e})=>n.d({applicationUniversalIdentifier:r,roleUniversalIdentifier:i,objectUniversalIdentifier:e})})}:{},...t.zt(o)?{fieldPermissions:L({permissions:o,getDerivedUniversalIdentifier:({fieldUniversalIdentifier:e})=>n.u({applicationUniversalIdentifier:r,roleUniversalIdentifier:i,fieldUniversalIdentifier:e})})}:{}}},z=({objectName:e,fieldName:t,fieldUniversalIdentifier:n})=>O({segments:[e,t],universalIdentifier:n}),B=new Map(Object.entries(r.t).map(([e,t])=>[t,e])),V=({objectUniversalIdentifier:e,manifest:t})=>(t.objects??[]).find(t=>t.universalIdentifier===e)?.nameSingular??B.get(e)??null,H=new Map(Object.entries(r.r).map(([e,{universalIdentifier:t}])=>[t,e])),U=({pageLayoutUniversalIdentifier:e,manifest:r})=>{let i=r.pageLayouts?.find(t=>t.universalIdentifier===e);if(t.zt(i))return i.name;let a=H.get(e);if(t.zt(a))return a;let o=r.application.universalIdentifier;for(let t of r.objects??[]){let r={objectMetadataApplicationUniversalIdentifier:o,objectUniversalIdentifier:t.universalIdentifier};if(n.f(r)===e)return`${t.nameSingular}RecordPage`;if(n.a(r)===e)return`${t.nameSingular}RecordForm`}return null},W=({viewUniversalIdentifier:e,manifest:r})=>{let i=r.views?.find(t=>t.universalIdentifier===e);if(t.zt(i))return i.name;let a=r.application.universalIdentifier;for(let t of r.objects??[])if(n.y({objectMetadataApplicationUniversalIdentifier:a,objectUniversalIdentifier:t.universalIdentifier,viewKey:n.m.INDEX})===e)return`${t.nameSingular}IndexView`;return null},G=({navigationMenuItemManifest:e,manifest:n})=>{let{type:r,name:i,targetObjectUniversalIdentifier:a,viewUniversalIdentifier:o,pageLayoutUniversalIdentifier:s}=e;return E(i)?i:r===t.X.OBJECT&&t.zt(a)?V({objectUniversalIdentifier:a,manifest:n}):r===t.X.VIEW&&t.zt(o)?W({viewUniversalIdentifier:o,manifest:n}):r===t.X.PAGE_LAYOUT&&t.zt(s)?U({pageLayoutUniversalIdentifier:s,manifest:n}):null},K=({navigationMenuItemManifest:e,manifest:t})=>O({segments:[G({navigationMenuItemManifest:e,manifest:t})],universalIdentifier:e.universalIdentifier}),q=({folderUniversalIdentifier:e,manifest:t})=>{let n=t.navigationMenuItems?.find(t=>t.universalIdentifier===e)?.name;return E(n)?n:null},J=[`application`,`object`,`field`,`index`,`permissionFlag`,`role`,`view`,`viewField`,`pageLayout`,`pageLayoutTab`,`navigationMenuItem`,`pageLayoutWidget`],Y=(e,n=new Map)=>{let r=e.application.universalIdentifier,i=[],o=[];i.push({kind:`application`,universalIdentifier:r,definer:`defineApplication`,config:I(e),enumBindings:[],defaultFolder:`src`,fileSuffix:`.config.ts`,fileBaseName:`application`,parentName:null});let s=new Set,f=new Map,h=[...e.fields??[]];for(let t of e.objects??[]){let e=[];for(let r of t.fields??[])f.set(r.universalIdentifier,{objectName:t.nameSingular,fieldName:r.name}),n.get(r.universalIdentifier.toLowerCase())?.entityKey===`fields`?h.push({...r,objectUniversalIdentifier:t.universalIdentifier}):e.push(r);s.add(t.universalIdentifier),i.push({kind:`object`,universalIdentifier:t.universalIdentifier,definer:`defineObject`,config:{...t,fields:e},enumBindings:l,defaultFolder:`src/objects`,fileSuffix:`.object.ts`,fileBaseName:a.t(t.nameSingular),parentName:null})}for(let t of h){let n=V({objectUniversalIdentifier:t.objectUniversalIdentifier,manifest:e});f.set(t.universalIdentifier,{objectName:n,fieldName:t.name}),i.push({kind:`field`,universalIdentifier:t.universalIdentifier,definer:`defineField`,config:t,enumBindings:c,defaultFolder:`src/fields`,fileSuffix:`.field.ts`,fileBaseName:z({objectName:n,fieldName:t.name,fieldUniversalIdentifier:t.universalIdentifier}),parentName:n})}for(let t of e.indexes??[]){if(!s.has(t.objectUniversalIdentifier)){o.push({kind:`index`,universalIdentifier:t.universalIdentifier,reason:`its object is not part of the written source`});continue}let n=V({objectUniversalIdentifier:t.objectUniversalIdentifier,manifest:e});i.push({kind:`index`,universalIdentifier:t.universalIdentifier,definer:`defineIndex`,config:t,enumBindings:u,defaultFolder:`src/indexes`,fileSuffix:`.index.ts`,fileBaseName:k({indexManifest:t,objectName:n,fieldLocationByUniversalIdentifier:f}),parentName:n})}for(let t of e.permissionFlags??[])i.push({kind:`permissionFlag`,universalIdentifier:t.universalIdentifier,definer:`definePermissionFlag`,config:t,enumBindings:[],defaultFolder:`src/permission-flags`,fileSuffix:`.permission-flag.ts`,fileBaseName:O({segments:[t.key],universalIdentifier:t.universalIdentifier}),parentName:null});for(let t of e.roles??[])i.push({kind:`role`,universalIdentifier:t.universalIdentifier,definer:t.universalIdentifier===e.application.defaultRoleUniversalIdentifier?`defineApplicationRole`:`defineRole`,config:R({roleManifest:t,applicationUniversalIdentifier:r}),enumBindings:d,defaultFolder:`src/roles`,fileSuffix:`.role.ts`,fileBaseName:O({segments:[t.label],universalIdentifier:t.universalIdentifier}),parentName:null});for(let t of e.views??[])i.push({kind:`view`,universalIdentifier:t.universalIdentifier,definer:`defineView`,config:t,enumBindings:m,defaultFolder:`src/views`,fileSuffix:`.view.ts`,fileBaseName:O({segments:[t.name],universalIdentifier:t.universalIdentifier}),parentName:V({objectUniversalIdentifier:t.objectUniversalIdentifier,manifest:e})});for(let t of e.viewFields??[])i.push({kind:`viewField`,universalIdentifier:t.universalIdentifier,definer:`defineViewField`,config:t,enumBindings:p,defaultFolder:`src/view-fields`,fileSuffix:`.view-field.ts`,fileBaseName:A({viewFieldManifest:t,fieldLocationByUniversalIdentifier:f}),parentName:null});for(let n of e.pageLayouts??[])i.push({kind:`pageLayout`,universalIdentifier:n.universalIdentifier,definer:`definePageLayout`,config:M(n),enumBindings:b,defaultFolder:`src/page-layouts`,fileSuffix:`.page-layout.ts`,fileBaseName:O({segments:[n.name],universalIdentifier:n.universalIdentifier}),parentName:t.zt(n.objectUniversalIdentifier)?V({objectUniversalIdentifier:n.objectUniversalIdentifier,manifest:e}):null});for(let n of e.pageLayoutTabs??[]){let{pageLayoutUniversalIdentifier:r}=n;if(!t.zt(r)){o.push({kind:`pageLayoutTab`,universalIdentifier:n.universalIdentifier,reason:`it does not name the page layout it belongs to`});continue}i.push({kind:`pageLayoutTab`,universalIdentifier:n.universalIdentifier,definer:`definePageLayoutTab`,config:M(n),enumBindings:v,defaultFolder:`src/page-layout-tabs`,fileSuffix:`.page-layout-tab.ts`,fileBaseName:O({segments:[n.title],universalIdentifier:n.universalIdentifier}),parentName:U({pageLayoutUniversalIdentifier:r,manifest:e})})}for(let n of e.navigationMenuItems??[]){let{folderUniversalIdentifier:r}=n;i.push({kind:`navigationMenuItem`,universalIdentifier:n.universalIdentifier,definer:`defineNavigationMenuItem`,config:n,enumBindings:y,defaultFolder:`src/navigation-menu-items`,fileSuffix:`.navigation-menu-item.ts`,fileBaseName:K({navigationMenuItemManifest:n,manifest:e}),parentName:t.zt(r)?q({folderUniversalIdentifier:r,manifest:e}):null})}for(let n of e.pageLayoutWidgets??[]){let{objectUniversalIdentifier:r}=n;i.push({kind:`pageLayoutWidget`,universalIdentifier:n.universalIdentifier,definer:`definePageLayoutWidget`,config:M(n),enumBindings:_,defaultFolder:`src/page-layout-widgets`,fileSuffix:`.page-layout-widget.ts`,fileBaseName:O({segments:[n.title],universalIdentifier:n.universalIdentifier}),parentName:t.zt(r)?V({objectUniversalIdentifier:r,manifest:e}):null})}return{entities:i,skipped:o}};Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return J}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=require("./package-CdYv4LEx.cjs").n;Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return e}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-CL6mrTMT-B748cNNG.cjs"),n=require("./application-DuIJE2qG.cjs"),r=require("./utils-B8EXJeaX-DK3gCslL.cjs"),i=require("./fs-utils-Bl1fQcaJ.cjs"),a=require("./list-application-source-files-jEau5Rie.cjs"),o=require("./extract-manifest-from-file-j-Y9wNas.cjs"),s=require("./metadata-D9sQOTRK.cjs"),c=require("./is-supported-locale-BAjnKnKj.cjs"),l=require("./constants-Cf5-CwMu.cjs");let u=require("node:fs/promises"),d=require("node:path"),f=require("node:fs"),p=require("tinyglobby"),m=require("typescript");m=e.i(m);let h=require("path");h=e.i(h);var g=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function _(e){return typeof e==`string`&&g.test(e)}function v(e){if(!_(e))throw TypeError(`Invalid UUID`);let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}var y=[];for(let e=0;e<256;++e)y.push((e+256).toString(16).slice(1));function ee(e,t=0){return(y[e[t+0]]+y[e[t+1]]+y[e[t+2]]+y[e[t+3]]+`-`+y[e[t+4]]+y[e[t+5]]+`-`+y[e[t+6]]+y[e[t+7]]+`-`+y[e[t+8]]+y[e[t+9]]+`-`+y[e[t+10]]+y[e[t+11]]+y[e[t+12]]+y[e[t+13]]+y[e[t+14]]+y[e[t+15]]).toLowerCase()}function te(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}var ne=`6ba7b810-9dad-11d1-80b4-00c04fd430c8`,b=`6ba7b811-9dad-11d1-80b4-00c04fd430c8`;function x(e,t,n,r,i,a){let o=typeof n==`string`?te(n):n,s=typeof r==`string`?v(r):r;if(typeof r==`string`&&(r=v(r)),r?.length!==16)throw TypeError(`Namespace must be array-like (16 iterable integer values, 0-255)`);let c=new Uint8Array(16+o.length);if(c.set(s),c.set(o,s.length),c=t(c),c[6]=c[6]&15|e,c[8]=c[8]&63|128,i){if(a||=0,a<0||a+16>i.length)throw RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);for(let e=0;e<16;++e)i[a+e]=c[e];return i}return ee(c)}function re(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:return t^n^r;case 2:return t&n^t&r^n&r;case 3:return t^n^r}}function S(e,t){return e<<t|e>>>32-t}function ie(e){let t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(e.length+1);r.set(e),r[e.length]=128,e=r;let i=e.length/4+2,a=Math.ceil(i/16),o=Array(a);for(let t=0;t<a;++t){let n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=e[t*64+r*4]<<24|e[t*64+r*4+1]<<16|e[t*64+r*4+2]<<8|e[t*64+r*4+3];o[t]=n}o[a-1][14]=(e.length-1)*8/2**32,o[a-1][14]=Math.floor(o[a-1][14]),o[a-1][15]=(e.length-1)*8&4294967295;for(let e=0;e<a;++e){let r=new Uint32Array(80);for(let t=0;t<16;++t)r[t]=o[e][t];for(let e=16;e<80;++e)r[e]=S(r[e-3]^r[e-8]^r[e-14]^r[e-16],1);let i=n[0],a=n[1],s=n[2],c=n[3],l=n[4];for(let e=0;e<80;++e){let n=Math.floor(e/20),o=S(i,5)+re(n,a,s,c)+l+t[n]+r[e]>>>0;l=c,c=s,s=S(a,30)>>>0,a=i,i=o}n[0]=n[0]+i>>>0,n[1]=n[1]+a>>>0,n[2]=n[2]+s>>>0,n[3]=n[3]+c>>>0,n[4]=n[4]+l>>>0}return Uint8Array.of(n[0]>>24,n[0]>>16,n[0]>>8,n[0],n[1]>>24,n[1]>>16,n[1]>>8,n[1],n[2]>>24,n[2]>>16,n[2]>>8,n[2],n[3]>>24,n[3]>>16,n[3]>>8,n[3],n[4]>>24,n[4]>>16,n[4]>>8,n[4])}function C(e,t,n,r){return x(80,ie,e,t,n,r)}C.DNS=ne,C.URL=b;function w(e){if(!_(e))throw TypeError(`Invalid UUID`);return parseInt(e.slice(14,15),16)}var T=`a80ff791-b940-4c47-a522-2bb478515415`,ae=e=>e.type!==t.rt.SELECT&&e.type!==t.rt.MULTI_SELECT||e.options===void 0||e.options===null?e:{...e,options:e.options.map(t=>({...t,id:t.id??C(`${t.label}-${e.universalIdentifier}`,T)}))},E=({fields:e,labelIdentifierFieldMetadataUniversalIdentifier:n})=>t.zt(n)&&!e.some(e=>e.universalIdentifier===n),D=({objectConfig:e,applicationUniversalIdentifier:r})=>({name:`name`,label:`Name`,description:`Name`,icon:`IconAbc`,isNullable:!0,defaultValue:null,type:t.rt.TEXT,universalIdentifier:n.h({applicationUniversalIdentifier:r,objectUniversalIdentifier:e.universalIdentifier,name:`name`})}),O=({objectConfig:e,applicationUniversalIdentifier:t})=>{let n=(e.fields??[]).map(e=>e.name),r=[...e.fields??[]],i=D({objectConfig:e,applicationUniversalIdentifier:t}),a=E({fields:e.fields??[],labelIdentifierFieldMetadataUniversalIdentifier:e.labelIdentifierFieldMetadataUniversalIdentifier});return!n.includes(i.name)&&!a&&r.push(i),{objectFields:r}},oe=({objectConfig:e,applicationUniversalIdentifier:t})=>{let{objectFields:n}=O({objectConfig:e,applicationUniversalIdentifier:t}),r=e.labelIdentifierFieldMetadataUniversalIdentifier??n.find(e=>e.name===`name`)?.universalIdentifier;return r?{objectManifest:{...e,fields:n.map(ae),labelIdentifierFieldMetadataUniversalIdentifier:r},errors:[]}:{objectManifest:null,errors:[`No label identifier field found for object ${e.nameSingular}. Please add a field with name "name" to your object.`]}},k=e.t(),A=e=>(e?.type===`record`||e?.type===`object`)&&(0,k.isNonEmptyString)(e.objectUniversalIdentifier),j=(e,t)=>{let n=(0,k.isNonEmptyString)(e)?t?.(e):void 0;return`Id of the ${(0,k.isNonEmptyString)(n)?n:`linked`} record`},M=(e,n)=>{if(A(e))return{type:`string`,description:j(e.objectUniversalIdentifier,n)};if(e.type===`records`)return{type:`array`,items:{type:`string`,description:j(e.objectUniversalIdentifier,n)}};let{objectUniversalIdentifier:r,multiline:i,label:a,items:o,properties:s,additionalProperties:c,...l}=e,u={...l};return t.zt(o)&&(u.items=M(o,n)),t.zt(s)&&(u.properties=Object.fromEntries(Object.entries(s).map(([e,t])=>[e,M(t,n)]))),t.zt(c)&&(u.additionalProperties=(0,k.isObject)(c)?M(c,n):c),u},N={type:`object`,properties:{}},P=e=>{let t={type:`unknown`};switch(e.type){case`string`:t.type=`string`;break;case`number`:case`integer`:t.type=`number`;break;case`boolean`:t.type=`boolean`;break;case`array`:t.type=`array`,e.items&&(t.items=P(e.items));break;case`object`:t.type=`object`,e.properties&&(t.properties=Object.fromEntries(Object.entries(e.properties).map(([e,t])=>[e,P(t)])));break;case`record`:t.type=`record`;break;case`records`:t.type=`records`;break;default:t.type=`unknown`}return Array.isArray(e.enum)&&(t.enum=e.enum.filter(e=>typeof e==`string`)),e.multiline===!0&&(t.multiline=!0),(0,k.isNonEmptyString)(e.label)&&(t.label=e.label),(0,k.isNonEmptyString)(e.objectUniversalIdentifier)&&(t.objectUniversalIdentifier=e.objectUniversalIdentifier),t},F=e=>[P(e)];F({type:`object`,properties:{a:{type:`string`},b:{type:`number`}}});var I=async e=>{let{getFunctionInputSchema:n}=await Promise.resolve().then(()=>require("./get-function-input-schema-GNk3NRLJ-Bfph1o9z.cjs")),r=n(e)[0];return r?.type===`object`&&t.zt(r.properties)?{type:`object`,properties:r.properties}:N},L=e=>!t.zt(e)||e===null?`unknown`:typeof e==`string`?`string`:typeof e==`number`?`number`:typeof e==`boolean`?`boolean`:Array.isArray(e)?`array`:`unknown`,R=e=>e?Object.entries(e).reduce((e,[t,n])=>((0,k.isObject)(n)&&!Array.isArray(n)?e[t]={isLeaf:!1,type:`object`,label:t,value:R(n)}:e[t]={isLeaf:!0,value:n,type:L(n),label:t},e),{}):{},z=(e,t)=>e?`${e}.${t}`:t,B=(e,n,r=``)=>{let i=[];for(let[a,o]of Object.entries(n)){let n=z(r,a),s=e[a];if(!t.zt(s)){i.push(`Missing key "${n}" in declared output schema.`);continue}if(o.isLeaf!==s.isLeaf){i.push(`Type mismatch at "${n}": expected ${o.isLeaf?o.type:`object`} but declared ${s.isLeaf?s.type:`object`}.`);continue}if(!o.isLeaf&&!s.isLeaf){i.push(...B(s.value,o.value,n));continue}o.isLeaf&&s.isLeaf&&o.type!==`unknown`&&s.type!==`unknown`&&o.type!==s.type&&i.push(`Type mismatch at "${n}": expected ${o.type} but declared ${s.type}.`)}return i},V=[`string`,`number`,`boolean`,`array`,`unknown`],H=e=>V.includes(e),U=(e,t)=>{let n=t.label??e;return t.type===`record`?{isLeaf:!0,type:`string`,label:n,value:null}:t.type===`records`?{isLeaf:!0,type:`array`,label:n,value:null}:t.type===`object`?{isLeaf:!1,type:`object`,label:n,value:(0,k.isObject)(t.properties)?W(t.properties):{}}:{isLeaf:!0,type:H(t.type)?t.type:`unknown`,label:n,value:null}},W=e=>Object.entries(e).reduce((e,[t,n])=>(e[t]=U(t,n),e),{}),se=async({logicFunctionConfig:e,sourceCode:t,sourcePath:n})=>{let{handler:r,...i}=e,a=i.toolTriggerSettings&&!i.toolTriggerSettings.inputSchema||i.workflowActionTriggerSettings&&!i.workflowActionTriggerSettings.inputSchema?await I(t):null,o=i.toolTriggerSettings?{...i.toolTriggerSettings,inputSchema:i.toolTriggerSettings.inputSchema??a??void 0}:void 0,s=i.workflowActionTriggerSettings?{...i.workflowActionTriggerSettings,inputSchema:i.workflowActionTriggerSettings.inputSchema??(a?F(a):void 0)}:void 0;return{...i,...o?{toolTriggerSettings:o}:{},...s?{workflowActionTriggerSettings:s}:{},handlerName:`default.config.handler`,sourceHandlerPath:n,builtHandlerPath:n.replace(/\.tsx?$/,`.mjs`),builtHandlerChecksum:`[default-checksum]`}},ce=({frontComponentConfig:e,sourcePath:t})=>{let{component:n,...r}=e;return{...r,componentName:n.name,sourceComponentPath:t,builtComponentPath:t.replace(/\.tsx?$/,`.mjs`),builtComponentChecksum:``,isHeadless:r.isHeadless??!1}},le=({roleConfig:e,applicationUniversalIdentifier:t})=>({...e,objectPermissions:(e.objectPermissions??[]).map(r=>({...r,universalIdentifier:r.universalIdentifier??n.d({applicationUniversalIdentifier:t,roleUniversalIdentifier:e.universalIdentifier,objectUniversalIdentifier:r.objectUniversalIdentifier})})),fieldPermissions:(e.fieldPermissions??[]).map(r=>({...r,universalIdentifier:r.universalIdentifier??n.u({applicationUniversalIdentifier:t,roleUniversalIdentifier:e.universalIdentifier,fieldUniversalIdentifier:r.fieldUniversalIdentifier})})),rowLevelPermissionPredicateGroups:e.rowLevelPermissionPredicateGroups??[],rowLevelPermissionPredicates:e.rowLevelPermissionPredicates??[],permissionFlagUniversalIdentifiers:e.permissionFlagUniversalIdentifiers??[]}),G=e=>{let t=new Set(e);return t.has(`react`)&&t.add(`react/jsx-runtime`),[...t].sort()},K=[`twenty-client-sdk`,`twenty-sdk`],q=e=>{let t=[],n=new Set;for(let r of e){if(!(0,k.isNonEmptyString)(r)){t.push(`"frontComponentSharedDependencies" entries in package.json must be non-empty strings`);continue}if(r.startsWith(`.`)||h.default.posix.isAbsolute(r)||h.default.win32.isAbsolute(r)){t.push(`Shared dependency "${r}" must be a package specifier, not a relative or absolute path`);continue}if(r===`twenty:front-component-shared-dependencies`){t.push(`Shared dependency "${r}" is reserved and cannot be shared`);continue}if(K.some(e=>r===e||r.startsWith(`${e}/`))){t.push(`Shared dependency "${r}" is already served separately and cannot be shared`);continue}if(n.has(r)){t.push(`Shared dependency "${r}" is declared twice`);continue}n.add(r)}return t},ue=async e=>{let t=h.default.join(e,`package.json`);if(!await i.i(t))return{errors:[]};let r=(await i.o(t)).frontComponentSharedDependencies;if(r===void 0)return{errors:[]};if(!Array.isArray(r))return{errors:[`"frontComponentSharedDependencies" in package.json must be an array of package specifiers`]};if(!(0,k.isNonEmptyArray)(r))return{errors:[]};let a=q(r);return(0,k.isNonEmptyArray)(a)?{errors:a}:{sharedDependencies:{dependencies:G(r),builtPath:n.n,builtChecksum:null},errors:[]}},J=`pageType.isInSidePanel.isDashboardPageLayoutInEditMode.isLayoutCustomizationModeEnabled.favoriteRecordIds.isSelectAll.hasAnySoftDeleteFilterOnView.numberOfSelectedRecords.objectPermissions.selectedRecords.featureFlags.targetObjectReadPermissions.targetObjectWritePermissions.canImpersonate.canAccessFullAdminPanel.objectMetadataItem.objectMetadataLabel.isDefined.isNonEmptyString.includes.every.everyDefined.everyEquals.some.someDefined.someEquals.none.noneDefined.noneEquals.someNonEmptyString.includesEvery`.split(`.`),Y=`conditionalAvailabilityExpression`,de=[`twenty-sdk/define`,`twenty-sdk`],X=new Set(J),fe=(e,n)=>{let r=[];for(let i of e.statements){if(!m.default.isImportDeclaration(i)||!m.default.isStringLiteral(i.moduleSpecifier)||!de.includes(i.moduleSpecifier.text))continue;let a=i.importClause;if(!t.zt(a)||a.phaseModifier===m.default.SyntaxKind.TypeKeyword)continue;let o=a.namedBindings;if(t.zt(o)){if(m.default.isNamespaceImport(o)){let t=n.getSymbolAtLocation(o.name),i=e=>{m.default.isImportDeclaration(e)||m.default.isTypeNode(e)||(m.default.isPropertyAccessExpression(e)&&m.default.isIdentifier(e.expression)&&n.getSymbolAtLocation(e.expression)===t&&X.has(e.name.text)&&r.push({importedName:e.name.text,node:e}),m.default.forEachChild(e,i))};i(e);continue}if(m.default.isNamedImports(o))for(let i of o.elements){if(i.isTypeOnly)continue;let a=(i.propertyName??i.name).text;if(X.has(a)){let o=n.getSymbolAtLocation(i.name),s,c=e=>{if(!(t.zt(s)||m.default.isImportDeclaration(e)||m.default.isTypeNode(e))){if(m.default.isIdentifier(e)){let r=m.default.isShorthandPropertyAssignment(e.parent)?n.getShorthandAssignmentValueSymbol(e.parent):n.getSymbolAtLocation(e);t.zt(o)&&r===o&&(s=e)}m.default.forEachChild(e,c)}};c(e),t.zt(s)&&r.push({importedName:a,node:s})}}}}return r},pe=e=>{let t=!1,n=e=>{if(!t){if((m.default.isPropertyAssignment(e)||m.default.isShorthandPropertyAssignment(e))&&(m.default.isIdentifier(e.name)||m.default.isStringLiteral(e.name))&&e.name.text===Y){t=!0;return}m.default.forEachChild(e,n)}};return n(e),t},me=(e,t)=>{if(!J.some(t=>e.includes(t)))return[];let n=m.default.createSourceFile(t,e,m.default.ScriptTarget.Latest,!0,t.endsWith(`.tsx`)?m.default.ScriptKind.TSX:m.default.ScriptKind.TS);if(pe(n))return[];let r={noLib:!0,noResolve:!0},i=m.default.createCompilerHost(r);return i.getSourceFile=e=>e===n.fileName?n:void 0,fe(n,m.default.createProgram([n.fileName],r,i).getTypeChecker()).map(({importedName:e,node:r})=>{let{line:i,character:a}=n.getLineAndCharacterOfPosition(r.getStart(n));return`${t}:${i+1}:${a+1} - "${e}" is a conditional-availability expression variable from twenty-sdk but this file has no ${Y}. These variables can only be used inside a command's ${Y}, not at runtime.`})},Z={canReadObjectRecords:`read`,canUpdateObjectRecords:`update`,canSoftDeleteObjectRecords:`soft-delete`,canDestroyObjectRecords:`destroy`},he=Object.fromEntries(Object.entries(t.f).map(([e,t])=>[t,e])),ge=Object.fromEntries(Object.entries(s.n).map(([e,{universalIdentifier:t}])=>[t,e])),_e=({grant:e,objects:t,permissionFlags:n})=>{let r=e=>t.find(t=>t.universalIdentifier===e)?.nameSingular??ge[e]??e;switch(e.type){case`ALL_OBJECT_RECORDS`:return`${Z[e.action]} all object records`;case`ALL_SETTINGS`:return`update all settings`;case`ALL_TOOLS`:return`access all tools`;case`PERMISSION_FLAG`:return`permission flag ${n.find(t=>t.universalIdentifier===e.permissionFlagUniversalIdentifier)?.key??he[e.permissionFlagUniversalIdentifier]??e.permissionFlagUniversalIdentifier}`;case`OBJECT_RECORDS`:return`${Z[e.action]} ${r(e.objectUniversalIdentifier)} records`;case`FIELD_VALUE`:return`${e.action===`canReadFieldValue`?`read`:`update`} field ${e.fieldUniversalIdentifier} of ${r(e.objectUniversalIdentifier)}`;case`ROW_LEVEL_RESTRICTION`:return`${r(e.objectUniversalIdentifier)} records without the row-level restriction`}},Q=e=>e.map(e=>`"${e}"`).join(`, `),ve=({agents:e,defaultRoleUniversalIdentifier:n})=>{let r=new Map;for(let i of e)!t.zt(i.roleUniversalIdentifier)||i.roleUniversalIdentifier===n||r.set(i.roleUniversalIdentifier,[...r.get(i.roleUniversalIdentifier)??[],i.name]);return r},$=({applicationRole:e,defaultRoleUniversalIdentifier:n})=>t.zt(e)?[]:[`Application default role "${n}" is not defined by this application.`],ye=({agentNamesByRoleUniversalIdentifier:e,roles:t})=>[...e].filter(([e])=>!t.some(t=>t.universalIdentifier===e)).map(([e,t])=>`Agent ${Q(t)} references role "${e}", which is not defined by this application.`),be=({agentNamesByRoleUniversalIdentifier:e,applicationRole:r,roles:i,objects:a,permissionFlags:o})=>{let s=o.filter(e=>(e.permissionType??`tool`)===`tool`).map(e=>e.universalIdentifier);return[...e].flatMap(([e,c])=>{let l=i.find(t=>t.universalIdentifier===e);if(!t.zt(l))return[];let u=n.l({role:l,superset:r,toolPermissionFlagUniversalIdentifiers:s});if(u.length===0)return[];let d=u.map(e=>_e({grant:e,objects:a,permissionFlags:o})).join(`, `);return[`Role "${l.label}" used by agent ${Q(c)} grants more than the application role "${r.label}": ${d}. The application role must cover every permission an agent role grants.`]})},xe=({agents:e,roles:n,objects:r,permissionFlags:i,defaultRoleUniversalIdentifier:a})=>{let o=n.find(e=>e.universalIdentifier===a),s=ve({agents:e,defaultRoleUniversalIdentifier:a});return[...$({applicationRole:o,defaultRoleUniversalIdentifier:a}),...ye({agentNamesByRoleUniversalIdentifier:s,roles:n}),...t.zt(o)?be({agentNamesByRoleUniversalIdentifier:s,applicationRole:o,roles:n,objects:r,permissionFlags:i}):[]]},Se=({views:e,objects:n,fields:i})=>{let a=[],o=new Map;for(let e of i)o.set(e.universalIdentifier,e);for(let e of n)for(let t of e.fields)o.set(t.universalIdentifier,t);for(let n of e)for(let e of n.filters??[]){let n=o.get(e.fieldMetadataUniversalIdentifier);if(!t.zt(n))continue;let i=(n.type===t.rt.RELATION||n.type===t.rt.MORPH_RELATION)&&t.zt(e.relationTargetFieldMetadataUniversalIdentifier)?o.get(e.relationTargetFieldMetadataUniversalIdentifier)?.type??n.type:n.type;if(!(i in r.n))continue;let s=r.a({filterType:i,subFieldName:e.subFieldName});s.includes(e.operand)||a.push(`Operand "${e.operand}" is not supported on field "${n.name}" (type "${i}"). Supported operands: ${s.join(`, `)}.`)}return a},Ce=e=>{try{let t=JSON.parse((0,f.readFileSync)((0,d.join)(e,`package.json`),`utf-8`)).engines?.twenty;return typeof t==`string`&&t.trim()!==``?t.trim():null}catch{return null}},we=e=>a.t(e),Te=async e=>(await(0,p.glob)([`${n.i}/**/*`],{cwd:e,absolute:!0,onlyFiles:!0})).sort(),Ee=async e=>{try{let t=await(0,u.readFile)((0,h.join)(e,`README.md`),`utf-8`);return t.trim().length>0?t:void 0}catch{return}},De=async e=>{let n=await we(e),i=await Ee(e),a=[],s=[],c,l=[],d=[],f=[],p=[],m=[],g=[],_=[],v=[],y=[],ee=[],te=[],ne=[],b=[],x=[],re=[],S=[],ie=[],C=[],w=[],T=[],E=[],D=[],O=[],k=[],A=[],j=[],M=[],N=[],P=[],F=[],I=[],L=[],R=[],z=[],B=[],V=[],H=[],U=[],W=[],G=[],K=[],q=[],J=[],Y=[],de=[],X=[],fe=[],pe=[],Z=[];for(let i of n){let n=await(0,u.readFile)(i,`utf-8`),f=(0,h.relative)(e,i);a.push(...me(n,f));let _=o.r(n);if(!_)continue;let b=o.n[_];switch(b){case`application`:{let t=await o.t({appPath:e,filePath:i});c=t.config,a.push(...t.errors),s.push(...t.warnings??[]),P.push(f);break}case`objects`:{let t=await o.t({appPath:e,filePath:i});l.push(t.config),a.push(...t.errors),s.push(...t.warnings??[]),F.push(f);break}case`fields`:{let t=await o.t({appPath:e,filePath:i}),n=ae(t.config);p.push(n),a.push(...t.errors),s.push(...t.warnings??[]),I.push(f);break}case`permissionFlags`:{let t=await o.t({appPath:e,filePath:i});g.push(t.config),a.push(...t.errors),s.push(...t.warnings??[]),R.push(f);break}case`roles`:{let t=await o.t({appPath:e,filePath:i});d.push(t.config),a.push(...t.errors),s.push(...t.warnings??[]),z.push(f),_===`defineApplicationRole`&&N.push(t.config.universalIdentifier);break}case`skills`:{let t=await o.t({appPath:e,filePath:i});v.push(t.config),a.push(...t.errors),s.push(...t.warnings??[]),B.push(f);break}case`agents`:{let t=await o.t({appPath:e,filePath:i});y.push(t.config),a.push(...t.errors),s.push(...t.warnings??[]),V.push(f);break}case`connectionProviders`:{let t=await o.t({appPath:e,filePath:i});ee.push(t.config),a.push(...t.errors),s.push(...t.warnings??[]),H.push(f);break}case`logicFunctions`:{let r=await o.t({appPath:e,filePath:i});a.push(...r.errors),s.push(...r.warnings??[]),_===`definePreInstallLogicFunction`&&t.zt(r.config.serverRouteTriggerSettings)&&a.push(`${f}: pre-install logic functions cannot define serverRouteTriggerSettings.`);let c=await se({logicFunctionConfig:r.config,sourceCode:n,sourcePath:f});if(te.push(c),U.push(f),_===`definePostInstallLogicFunction`){let e=r.config;O.push({universalIdentifier:r.config.universalIdentifier,shouldRunOnVersionUpgrade:e.shouldRunOnVersionUpgrade??!1,shouldRunSynchronously:e.shouldRunSynchronously??!1})}if(_===`definePreInstallLogicFunction`){let e=r.config;k.push({universalIdentifier:r.config.universalIdentifier,shouldRunOnVersionUpgrade:e.shouldRunOnVersionUpgrade??!1})}_===`defineUninstallLogicFunction`&&A.push({universalIdentifier:r.config.universalIdentifier}),_===`defineHealthCheck`&&j.push({universalIdentifier:r.config.universalIdentifier});break}case`frontComponents`:{let t=await o.t({appPath:e,filePath:i});a.push(...t.errors),s.push(...t.warnings??[]);let n=ce({frontComponentConfig:t.config,sourcePath:f});ne.push(n),W.push(f),_===`defineSettingsFrontComponent`&&M.push(t.config.universalIdentifier);break}case`views`:{let t=await o.t({appPath:e,filePath:i}),n={...t.config};x.push(n),a.push(...t.errors),s.push(...t.warnings??[]),K.push(f);break}case`viewFields`:{let t=await o.t({appPath:e,filePath:i});re.push(t.config),a.push(...t.errors),s.push(...t.warnings??[]),q.push(f);break}case`navigationMenuItems`:{let t=await o.t({appPath:e,filePath:i});S.push(t.config),a.push(...t.errors),s.push(...t.warnings??[]),J.push(f);break}case`pageLayouts`:{let t=await o.t({appPath:e,filePath:i}),n={...t.config};ie.push(n),a.push(...t.errors),s.push(...t.warnings??[]),Y.push(f);break}case`indexes`:{let t=await o.t({appPath:e,filePath:i}),n={...t.config};m.push(n),a.push(...t.errors),s.push(...t.warnings??[]),L.push(f);break}case`pageLayoutTabs`:{let t=await o.t({appPath:e,filePath:i}),n={...t.config};C.push(n),a.push(...t.errors),s.push(...t.warnings??[]),de.push(f);break}case`pageLayoutWidgets`:{let t=await o.t({appPath:e,filePath:i});w.push(t.config),a.push(...t.errors),s.push(...t.warnings??[]),X.push(f);break}case`commandMenuItems`:{let t=await o.t({appPath:e,filePath:i});T.push(t.config),a.push(...t.errors),s.push(...t.warnings??[]),fe.push(f);break}case`timelineActivityTypes`:{let t=await o.t({appPath:e,filePath:i});E.push(t.config),a.push(...t.errors),s.push(...t.warnings??[]),pe.push(f);break}case`settingsMenuItems`:{let t=await o.t({appPath:e,filePath:i});D.push(t.config),a.push(...t.errors),s.push(...t.warnings??[]),Z.push(f);break}default:r.s(b)}}let he=await Te(e);for(let t of he){let n=(0,h.relative)(e,t);b.push({filePath:n,fileName:(0,h.basename)(t),fileType:(0,h.extname)(t).replace(/^\./,``),checksum:null}),G.push(n)}if(c||a.push(`Cannot build application, please export default defineApplication() to define an application`),c){for(let e of l){let{objectManifest:t,errors:n}=oe({objectConfig:e,applicationUniversalIdentifier:c.universalIdentifier});a.push(...n),t&&f.push(t)}for(let e of d)_.push(le({roleConfig:e,applicationUniversalIdentifier:c.universalIdentifier}))}O.length>1&&a.push(`Only one post install logic function is allowed per application`),k.length>1&&a.push(`Only one pre install logic function is allowed per application`),A.length>1&&a.push(`Only one uninstall logic function is allowed per application`),j.length>1&&a.push(`Only one health check is allowed per application`),M.length>1&&a.push(`Only one settings front component is allowed per application`),N.length>1&&a.push(`Only one defineApplicationRole is allowed per application`);let{sharedDependencies:ge,errors:_e}=await ue(e);a.push(..._e);let Q=c?.defaultRoleUniversalIdentifier??(N.length===1?N[0]:void 0);c&&!Q&&a.push("Application must declare a default role: either pass `defaultRoleUniversalIdentifier` to defineApplication() or mark a role file with defineApplicationRole()"),a.push(...Se({views:x,objects:f,fields:p})),t.zt(c)&&t.zt(Q)&&a.push(...xe({agents:y,roles:_,objects:f,permissionFlags:g,defaultRoleUniversalIdentifier:Q}));let ve=c&&Q?(()=>{let{logoUrl:n,screenshots:r,...a}=c;return{...a,logo:c.logo,galleryImages:c.galleryImages??[],defaultRoleUniversalIdentifier:Q,aboutDescription:i,yarnLockChecksum:null,packageJsonChecksum:null,requiredServerVersionRange:Ce(e),...O.length>=1?{postInstallLogicFunction:O[0]}:{},...k.length>=1?{preInstallLogicFunction:k[0]}:{},...A.length>=1?{uninstallLogicFunction:A[0]}:{},...j.length>=1?{healthCheckLogicFunction:j[0]}:{},...M.length>=1?{settingsFrontComponent:{universalIdentifier:M[0]}}:{},...t.zt(ge)?{frontComponentSharedDependencies:ge}:{}}})():void 0,$=(e,t)=>e.universalIdentifier.localeCompare(t.universalIdentifier);return{manifest:ve?{application:ve,objects:f.sort($),fields:p.sort($),indexes:m.sort($),permissionFlags:g.sort($),roles:_.sort($),skills:v.sort($),agents:y.sort($),connectionProviders:ee.sort($),logicFunctions:te.sort($),frontComponents:ne.sort($),publicAssets:b.sort((e,t)=>e.filePath.localeCompare(t.filePath)),views:x.sort($),viewFields:re.sort($),navigationMenuItems:S.sort($),pageLayouts:ie.sort($),pageLayoutTabs:C.sort($),pageLayoutWidgets:w.sort($),commandMenuItems:T.sort($),timelineActivityTypes:E.sort($),settingsMenuItems:D.sort($)}:null,filePaths:{application:P,objects:F,fields:I,indexes:L,permissionFlags:R,roles:z,skills:B,agents:V,connectionProviders:H,logicFunctions:U,frontComponents:W,publicAssets:G,views:K,viewFields:q,navigationMenuItems:J,pageLayouts:Y,pageLayoutTabs:de,pageLayoutWidgets:X,commandMenuItems:fe,timelineActivityTypes:pe,settingsMenuItems:Z},errors:a,warnings:s}},Oe=[t.rt.RELATION,t.rt.MORPH_RELATION],ke=e=>Oe.includes(e.type),Ae=e=>{let t=new Set,n=new Set;for(let r of e)t.has(r)?n.add(r):t.add(r);return Array.from(n)},je=e=>{let n=[],r=[...e.pageLayouts.flatMap(({tabs:e})=>e??[]),...e.pageLayoutTabs];for(let e of r){e.layoutMode===t.ct.CANVAS&&n.push(`Page layout tab "${e.title}" uses deprecated CANVAS. For a full-height widget, use VERTICAL_LIST and set the widget's heightBehavior to 'TAB_VIEWPORT'. Existing Canvas layouts remain supported and are not converted.`);for(let r of e.widgets??[])r.position?.layoutMode===t.ct.VERTICAL_LIST&&n.push(`Page layout widget "${r.title}" uses a deprecated vertical-list position. Order the widgets array by position.index, remove position, and move any position.heightBehavior to heightBehavior. Existing positions remain supported and keep their indices.`),`gridPosition`in r&&t.zt(r.gridPosition)&&n.push(`Page layout widget "${r.title}" uses deprecated gridPosition. If position is already set, it takes precedence; remove the ignored gridPosition. Use position with layoutMode: 'GRID' and the same row, column, rowSpan and columnSpan only when position is absent. Existing gridPosition remains supported as a fallback.`)}return n},Me=[`id`,`createdAt`,`createdBy`,`updatedAt`,`updatedBy`,`deletedAt`,`position`,`searchVector`],Ne=e=>e.objects.flatMap(r=>{let i=r.labelIdentifierFieldMetadataUniversalIdentifier?.toLowerCase();return t.zt(i)?[...(r.fields??[]).map(e=>e.universalIdentifier.toLowerCase()),...e.fields.filter(e=>e.objectUniversalIdentifier.toLowerCase()===r.universalIdentifier.toLowerCase()).map(e=>e.universalIdentifier.toLowerCase()),...Me.map(t=>n.h({applicationUniversalIdentifier:e.application.universalIdentifier,objectUniversalIdentifier:r.universalIdentifier,name:t}))].includes(i)?[]:[`Object "${r.nameSingular}" references label field ${i}, which is not declared in this app or a recognized generated field. Check the identifier; the server must resolve this reference before applying.`]:[]}),Pe=e=>{let i=[],a=Ae(e.timelineActivityTypes.map(e=>e.name)),o=new Set(e.frontComponents.map(e=>e.universalIdentifier));for(let e of a)i.push(`Timeline activity type name "${e}" is used more than once. Names must be unique within an application.`);for(let a of e.timelineActivityTypes){t.zt(a.frontComponentUniversalIdentifier)&&!o.has(a.frontComponentUniversalIdentifier)&&i.push(`Timeline activity type "${a.name}" references front component "${a.frontComponentUniversalIdentifier}", which is not defined by this application.`);let s=a.emit,c=a.replacesTimelineActivityTypeUniversalIdentifier;if(!t.zt(s)){t.zt(c)&&i.push(`Timeline activity type "${a.name}" declares replacesTimelineActivityTypeUniversalIdentifier without an automatic emit contract.`);continue}let l=s.through,u=l?.triggerFieldUniversalIdentifiers,d=n.s(s.objectUniversalIdentifier);d||i.push(`Timeline activity type "${a.name}" references an invalid object universal identifier "${s.objectUniversalIdentifier}".`),(s.on===`linked`||s.on===`unlinked`)&&!t.zt(l)&&i.push(`Timeline activity type "${a.name}" must declare emit.through for a ${s.on} event.`),t.zt(u)&&(s.on!==`updated`||!r.r(u)||new Set(u).size!==u.length)&&i.push(`Timeline activity type "${a.name}" trigger fields must be a non-empty list of unique fields on an updated through event.`);let f=d?e.objects.find(e=>e.universalIdentifier===s.objectUniversalIdentifier):void 0;if(!t.zt(f)){d&&!t.zt(c)&&i.push(`Timeline activity type "${a.name}" targets object "${s.objectUniversalIdentifier}", which is not defined by this application. Types targeting another application's object must declare replacesTimelineActivityTypeUniversalIdentifier.`),t.zt(c)&&!n.s(c)&&i.push(`Timeline activity type "${a.name}" references an invalid replacement universal identifier "${c}".`),t.zt(l)&&!n.s(l.relationFieldUniversalIdentifier)&&i.push(`Timeline activity type "${a.name}" references an invalid through relation field universal identifier "${l.relationFieldUniversalIdentifier}".`);let e=u?.filter(e=>!n.s(e))??[];e.length>0&&i.push(`Timeline activity type "${a.name}" references invalid trigger field universal identifiers: ${e.join(`, `)}.`);continue}t.zt(c)&&i.push(`Timeline activity type "${a.name}" targets an object defined by this application and must not replace another application's type.`);let p=[...f.fields,...e.fields.filter(e=>e.objectUniversalIdentifier===f.universalIdentifier)];if(!t.zt(l))continue;let m=p.find(e=>e.universalIdentifier===l.relationFieldUniversalIdentifier);if(t.zt(m)?ke(m)&&t.zt(m.universalSettings)&&(m.universalSettings.relationType===t.B.MANY_TO_ONE||m.universalSettings.relationType===t.B.ONE_TO_MANY&&(0,k.isNonEmptyString)(m.universalSettings.junctionTargetFieldUniversalIdentifier))||i.push(`Timeline activity type "${a.name}" must route through a MANY_TO_ONE relation or a junction-backed ONE_TO_MANY relation.`):i.push(`Timeline activity type "${a.name}" references relation field "${l.relationFieldUniversalIdentifier}", which is not defined on object "${f.nameSingular}".`),t.zt(u)){let e=new Set(p.map(e=>e.universalIdentifier)),t=u.filter(t=>!e.has(t));t.length>0&&i.push(`Timeline activity type "${a.name}" references trigger fields that are not defined on object "${f.nameSingular}": ${t.join(`, `)}.`)}}return i},Fe=[t.B.MANY_TO_ONE,t.B.ONE_TO_MANY],Ie=`aggregateFieldMetadataId`,Le=e=>t.zt(e)&&t.at.some(t=>t===e.configurationType),Re=e=>{let t=[];if(!e)return[];for(let[n,r]of Object.entries(e))n===`universalIdentifier`&&typeof r==`string`&&t.push(r),!(n===`postInstallLogicFunction`||n===`preInstallLogicFunction`||n===`uninstallLogicFunction`||n===`healthCheckLogicFunction`||n===`onConnectLogicFunction`||n===`onDisconnectLogicFunction`||n===`settingsFrontComponent`)&&typeof r==`object`&&t.push(...Re(r));return t},ze=e=>{let n=[];for(let r of e){if(!ke(r))continue;let e=r.universalSettings;if(!e?.relationType){n.push(`Relation field "${r.name}" is missing relationType. ${r.type} fields must declare a relationType (${Fe.join(` or `)}) in universalSettings.`);continue}if(!Fe.includes(e.relationType)){n.push(`Relation field "${r.name}" has invalid relationType "${e.relationType}". Expected ${Fe.join(` or `)}.`);continue}e.relationType===t.B.MANY_TO_ONE&&!e.joinColumnName&&n.push(`MANY_TO_ONE relation field "${r.name}" is missing joinColumnName. MANY_TO_ONE relations must declare a joinColumnName in universalSettings.`)}return n},Be=e=>{let t=e.pageLayouts.flatMap(e=>e.tabs?.flatMap(e=>e.widgets??[])??[]),n=e.pageLayoutTabs.flatMap(e=>e.widgets??[]);return[...t,...n,...e.pageLayoutWidgets??[]]},Ve=e=>{let t=[];for(let n of e){let e=n.configuration;if(Le(e)&&!(0,k.isNonEmptyString)(e.aggregateFieldMetadataUniversalIdentifier)){let r=Ie in e?` Reference the aggregate field with "aggregateFieldMetadataUniversalIdentifier" (not "${Ie}").`:``;t.push(`Graph widget "${n.title}" is missing aggregateFieldMetadataUniversalIdentifier.${r}`)}}return t},He=({pageLayoutTab:e,pageLayoutType:t})=>{let r=n.t({pageLayoutTabManifest:e,pageLayoutType:t});return r.status===`fail`?r.errors:[]},Ue=e=>{let n=new Map(e.pageLayouts.map(e=>[e.universalIdentifier,e.type])),r=e.pageLayouts.flatMap(e=>(e.tabs??[]).flatMap(t=>He({pageLayoutTab:t,pageLayoutType:e.type}))),i=e.pageLayoutTabs.flatMap(e=>He({pageLayoutTab:e,pageLayoutType:t.zt(e.pageLayoutUniversalIdentifier)?n.get(e.pageLayoutUniversalIdentifier):void 0}));return[...r,...i]},We=e=>{let t=[],r=new Set;for(let i of e){if(r.has(i))continue;if(r.add(i),!_(i)){t.push(`Universal identifier "${i}" is not a valid UUID.`);continue}let e=w(i);n.s(i)||t.push(`Universal identifier "${i}" is UUID version ${e}. Only UUID version 4 or higher is allowed.`)}return t},Ge=e=>{let n=[],r=[...je(e),...Ne(e)],i=Re(e),a=Ae(i.map(e=>e.toLowerCase()));a.length>0&&n.push(`Duplicate universal identifiers: ${a.join(`, `)}`);let o=We(i);o.length>0&&n.push(`Invalid universal identifiers: ${o.join(`, `)}`);let s=[...e.fields,...e.objects.flatMap(e=>e.fields)];for(let e of s)if((e.type===t.rt.SELECT||e.type===t.rt.MULTI_SELECT||e.type===t.rt.RATING)&&t.zt(e.options)){e.options.some(({id:e})=>t.zt(e)&&!(0,k.isNonEmptyString)(e))&&n.push(`Field "${e.name}" has empty option IDs. Set distinct non-empty IDs on these options.`);let r=Ae(e.options.map(e=>e.id).filter(t.zt).map(e=>e.toLowerCase()));r.length>0&&n.push(`Field "${e.name}" has duplicate option IDs: ${r.join(`, `)}. Set distinct explicit IDs on these options.`)}return n.push(...ze(s)),n.push(...Ue(e)),n.push(...Ve(Be(e))),n.push(...Pe(e)),{errors:n,warnings:r,isValid:n.length===0}},Ke={"twenty-sdk":`"twenty-sdk" is listed under "dependencies" in package.json. It is a build-time only tool and should be moved to "devDependencies".`,"twenty-client-sdk":`"twenty-client-sdk" is listed under "dependencies" in package.json. It is provided at runtime by Twenty's injected SDK and should be moved to "devDependencies".`},qe=async e=>{let n=h.default.join(e,`package.json`);if(!await i.i(n))return[];let r=await i.o(n);return[`dependencies`,`optionalDependencies`].flatMap(e=>Object.entries(Ke).filter(([n])=>t.zt(r[e]?.[n])).map(([,t])=>t.replace(`"dependencies"`,`"${e}"`)))},Je=async e=>await i.i(e)&&(await(0,u.stat)(e)).size===0?[`yarn.lock is empty. Run "yarn install" to regenerate it before building.`]:[],Ye=e=>Je(h.default.join(e,`yarn.lock`)),Xe=async e=>{let t=await De(e);if(t.errors.length>0||!t.manifest)return{success:!1,errors:t.errors.length>0?t.errors:[`Failed to build manifest.`]};let n=Ge(t.manifest);if(!n.isValid)return{success:!1,errors:n.errors};let r=await Ye(e);if(r.length>0)return{success:!1,errors:r};let i=await qe(e);return{success:!0,manifest:t.manifest,filePaths:t.filePaths,warnings:[...t.warnings,...n.warnings,...i]}},Ze=({catalog:e,onCollision:n})=>{let r={},i=new Map;for(let{message:a,context:o,translation:s}of c.r(e)){if(s.length===0)continue;let e=t.zt(o)?`${o} ${a}`:a,l=c.a(a,o),u=i.get(l);t.zt(u)&&u!==e&&n?.({messageId:l,keptKey:e,droppedKey:u}),i.set(l,e),r[l]=s}return r},Qe=async({filePath:e,onWarning:n})=>{let r;try{r=await i.o(e)}catch{return n(`Skipping translation file "${h.default.basename(e)}": it is not valid JSON.`),null}return!t.zt(r)||typeof r!=`object`||Array.isArray(r)?(n(`Skipping translation file "${h.default.basename(e)}": expected a JSON object.`),null):r},$e=async({appPath:e,onWarning:t})=>{let n=h.default.join(e,l.t);if(!await i.i(n))return{};let r={};for(let e of(await(0,u.readdir)(n)).filter(e=>e.endsWith(`.json`))){let i=h.default.basename(e,`.json`);if(i===`en`)continue;if(!c.t(i)){t(`Skipping compiled translation file "${e}": "${i}" is not a supported locale.`);continue}let a=await Qe({filePath:h.default.join(n,e),onWarning:t});if(a===null)continue;let o=Object.fromEntries(Object.entries(a).filter(e=>typeof e[1]==`string`&&e[1].length>0));Object.keys(o).length>0&&(r[i]=o)}return r},et=async({appPath:e,onWarning:t=e=>console.warn(e)})=>{let n=h.default.join(e,l.n);if(!await i.i(n))return;let r=(await(0,u.readdir)(n)).filter(e=>e.endsWith(`.json`)),a={};for(let e of r){let r=h.default.basename(e,`.json`);if(r===`en`)continue;if(!c.t(r)){t(`Skipping translation file "${e}": "${r}" is not a supported locale.`);continue}let i=await Qe({filePath:h.default.join(n,e),onWarning:t});if(i===null)continue;let o=Ze({catalog:i,onCollision:({messageId:n,keptKey:r,droppedKey:i})=>t(`Message id collision in "${e}": "${r}" and "${i}" share id "${n}". Keeping "${r}".`)});Object.keys(o).length>0&&(a[r]=o)}for(let[n,r]of Object.entries(await $e({appPath:e,onWarning:t})))a[n]={...r,...a[n]??{}};return a};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return et}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./cli-error-CSsayo0u.cjs");var t=({universalIdentifier:t,apiUrl:n})=>new e.t({code:`APP_NOT_INSTALLED`,exitCode:e.n.NOT_FOUND,message:`No app with universal identifier ${t} is installed on ${n}.`,details:{universalIdentifier:t}});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
|