twenty 2.49.0 → 2.51.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-template/AGENTS.md +16 -1
- package/dist/app-template/package.json +1 -1
- package/dist/app-template/src/front-components/main-page.tsx +1 -1
- package/dist/app-template/yarn.lock +143 -96
- package/dist/app-worker.cjs +1 -1
- package/dist/chunks/application-DOWikeQt.cjs +5 -0
- package/dist/chunks/{build-pull-entities-caP3XupC.cjs → build-pull-entities-ShVsLh_s.cjs} +2 -2
- package/dist/chunks/{build-source-manifest-DWRbCMVq.cjs → build-source-manifest-BmZlsY97.cjs} +1 -1
- package/dist/chunks/{build-source-snapshot-CtgBQfSx.cjs → build-source-snapshot-BWbLS2F3.cjs} +19 -19
- package/dist/chunks/cli-version.constant-DGQXQw_V.cjs +1 -0
- package/dist/chunks/{collect-translatable-strings-GBVXMoaX.cjs → collect-translatable-strings-DWRZN9zQ.cjs} +1 -1
- package/dist/chunks/{collect-watch-inputs-CJVgCTo5.cjs → collect-watch-inputs-CS4oNP1F.cjs} +1 -1
- package/dist/chunks/{compile-application-translations-B4jILjGc.cjs → compile-application-translations-DS6jGOV4.cjs} +1 -1
- package/dist/chunks/{constants-CemcuPi_-D7dbw2cv.cjs → constants-D-caeNc5-9rDzSg5B.cjs} +1 -1
- package/dist/chunks/{convert-to-label-DH4ArWop.cjs → convert-to-label-hx-g0Lvj.cjs} +1 -1
- package/dist/chunks/{create-http-status-error-C6gJS0JS.cjs → create-http-status-error-E0DUDIUP.cjs} +1 -1
- package/dist/chunks/create-metadata-client-9IF8ArjT.cjs +6 -0
- package/dist/chunks/{create-pull-base-write-CX9yftCd.cjs → create-pull-base-write-JW3ZTnaC.cjs} +1 -1
- package/dist/chunks/create-rest-client-PU2Uyfnb.cjs +1 -0
- package/dist/chunks/{extract-manifest-from-file-mvb6OhWm.cjs → extract-manifest-from-file-nrU-X7g7.cjs} +1 -1
- package/dist/chunks/{extract-source-translations-Bd_030qL.cjs → extract-source-translations-DeVUs6Xz.cjs} +1 -1
- package/dist/chunks/{fetch-metadata-inspection-CAmEp-xl.cjs → fetch-metadata-inspection-CeqzcB_x.cjs} +1 -1
- package/dist/chunks/{fetch-signed-in-identity-b_LbRuL-.cjs → fetch-signed-in-identity-B49Tf79K.cjs} +1 -1
- package/dist/chunks/{fetch-workspace-id-C9kY0s84.cjs → fetch-workspace-id-CsvJDu8b.cjs} +1 -1
- package/dist/chunks/format-body-CyNgSGIx.cjs +1 -0
- package/dist/chunks/{format-data-value-C7Njc7Sb.cjs → format-data-value-kug8Yjt2.cjs} +1 -1
- package/dist/chunks/{format-metadata-fields-BOG2kj2h.cjs → format-metadata-fields-BTukrGn9.cjs} +1 -1
- package/dist/chunks/{format-metadata-owner-CyEMvoQr.cjs → format-metadata-owner-CsQXOj_P.cjs} +1 -1
- package/dist/chunks/format-progress-line-DhMnjGkz.cjs +1 -0
- package/dist/chunks/{generate-application-client-BOLnv8nr.cjs → generate-application-client-B3Fen9_7.cjs} +1 -1
- package/dist/chunks/{get-app-plan-summary-D1Dsd34P.cjs → get-app-plan-summary-C-CQdNrh.cjs} +2 -2
- package/dist/chunks/{get-client-generation-skip-reason-CUn0Y2Vu.cjs → get-client-generation-skip-reason-BVkBgZWQ.cjs} +1 -1
- package/dist/chunks/{get-function-input-schema-GNk3NRLJ-CWNFoyKh.cjs → get-function-input-schema-GNk3NRLJ-DTFC8CbW.cjs} +1 -1
- package/dist/chunks/{global-flags.constant-0k222fHC.cjs → global-flags.constant-CRom3uiZ.cjs} +1 -1
- package/dist/chunks/is-access-token-expiring-DT6D8bMy.cjs +1 -0
- package/dist/chunks/{is-application-not-found-error-4vnGlYbm.cjs → is-application-not-found-error-Cja7iQrL.cjs} +1 -1
- package/dist/chunks/{is-exported-manifest-dsiWCcjx.cjs → is-exported-manifest-DnQNK9XY.cjs} +1 -1
- package/dist/chunks/is-locale-catalog-CUFLOiRx.cjs +1 -0
- package/dist/chunks/is-supported-locale-xFJcoWeE.cjs +1 -0
- package/dist/chunks/{locale-catalog-format-rg5FMb7l.cjs → locale-catalog-format-CgKjHqcW.cjs} +2 -2
- package/dist/chunks/metadata-DkXpEhJh.cjs +1 -0
- package/dist/chunks/{metadata-page.constant-thBSPIZT.cjs → metadata-page.constant-CxWuBtP5.cjs} +1 -1
- package/dist/chunks/{parse-api-url-CEfjRyid.cjs → parse-api-url-CFCz3xUA.cjs} +1 -1
- package/dist/chunks/{parse-app-export-DUZ2dQJ8.cjs → parse-app-export-DFV_KqHM.cjs} +1 -1
- package/dist/chunks/parse-extraction-locale-C7Gdd3Oa.cjs +1 -0
- package/dist/chunks/{parse-graphql-response-DvoRiFPV.cjs → parse-graphql-response-BcKxw_s9.cjs} +1 -1
- package/dist/chunks/{parse-json-input-DE451WQG.cjs → parse-json-input-CO-KP4XZ.cjs} +1 -1
- package/dist/chunks/{print-typescript-value-DaEFmMda.cjs → print-typescript-value-D5kLR9wo.cjs} +1 -1
- package/dist/chunks/{pull-source-D9QUEAsK.cjs → pull-source-BKm8k5WI.cjs} +1 -1
- package/dist/chunks/{read-app-identity-DtEnxiEF.cjs → read-app-identity-dWB3NG6p.cjs} +1 -1
- package/dist/chunks/{read-application-identifier-DyZcsUV4.cjs → read-application-identifier-BlkRhC8j.cjs} +1 -1
- package/dist/chunks/{read-application-identity-CMJ-W5D8.cjs → read-application-identity-DgEOK9zh.cjs} +1 -1
- package/dist/chunks/{read-config-DdtXhdPp.cjs → read-config-Qwl4pAO8.cjs} +1 -1
- package/dist/chunks/read-json-object-BXZs97qz.cjs +1 -0
- package/dist/chunks/{read-snapshot-file-dvWjVexO.cjs → read-snapshot-file-CxPJh0Bk.cjs} +1 -1
- package/dist/chunks/{read-source-identity-Ca7QkuwC.cjs → read-source-identity-BM-MsOjA.cjs} +1 -1
- package/dist/chunks/{record-pull-base-Dfqth7Uy.cjs → record-pull-base-DwoMDnXm.cjs} +1 -1
- package/dist/chunks/{record-typecheck-config-inputs-DZy2PhMY.cjs → record-typecheck-config-inputs-CmF0bbqm.cjs} +1 -1
- package/dist/chunks/{request-oauth-tokens-BY5ew3aM.cjs → request-oauth-tokens-QdDt7j8i.cjs} +1 -1
- package/dist/chunks/{resolve-app-project-dftvbB2P.cjs → resolve-app-project-B0KRR-xp.cjs} +1 -1
- package/dist/chunks/{resolve-command-target-0k6iitOZ.cjs → resolve-command-target-BWCnYRCn.cjs} +1 -1
- package/dist/chunks/{resolve-inside-sdk-6M8jy9bi.cjs → resolve-inside-sdk-DiEOTO12.cjs} +1 -1
- package/dist/chunks/{resolve-metadata-object-DzDTQF_T.cjs → resolve-metadata-object-BSDYVuzQ.cjs} +1 -1
- package/dist/chunks/{resolve-project-typescript-Cw2kvn6E.cjs → resolve-project-typescript-vMtmufcP.cjs} +1 -1
- package/dist/chunks/{resolve-request-url-Cnuxu_nj.cjs → resolve-request-url-BvOe0vYd.cjs} +1 -1
- package/dist/chunks/{resolve-source-sdk-B1Fxlsmt.cjs → resolve-source-sdk-CU1wk4bl.cjs} +1 -1
- package/dist/chunks/{run-api-graphql-command-CzQ4IH4l.cjs → run-api-graphql-command-Df2FAGpA.cjs} +1 -1
- package/dist/chunks/{run-api-rest-command-BtXv11uz.cjs → run-api-rest-command-2YvvMh8h.cjs} +1 -1
- package/dist/chunks/{run-app-add-command-DsgrCsEl.cjs → run-app-add-command-wpCH-Lp9.cjs} +5 -5
- package/dist/chunks/{run-app-apply-command-X_XGAwRN.cjs → run-app-apply-command-CPocg1Xz.cjs} +2 -2
- package/dist/chunks/{run-app-build-command--t8qRNsn.cjs → run-app-build-command-DSGpIZBT.cjs} +1 -1
- package/dist/chunks/{run-app-dev-command-Cc-nhH2t.cjs → run-app-dev-command-BOAYsAKr.cjs} +2 -2
- package/dist/chunks/{run-app-exec-command-mdXCYmUn.cjs → run-app-exec-command-Fwi80y3g.cjs} +2 -2
- package/dist/chunks/{run-app-generate-client-command-3DMg-WyX.cjs → run-app-generate-client-command-DidOpqNE.cjs} +1 -1
- package/dist/chunks/{run-app-init-command-BfS8IFmY.cjs → run-app-init-command-DRFYqMMh.cjs} +2 -2
- package/dist/chunks/{run-app-install-command-DMbwFvtE.cjs → run-app-install-command-DPt8PzUS.cjs} +1 -1
- package/dist/chunks/{run-app-logs-command-B7_iDOj1.cjs → run-app-logs-command-C-9ZyGau.cjs} +3 -3
- package/dist/chunks/{run-app-operation-DFCj0sG_.cjs → run-app-operation-Cw5M8v43.cjs} +1 -1
- package/dist/chunks/{run-app-plan-command-Dh_DFA7H.cjs → run-app-plan-command-CT1SlcdX.cjs} +1 -1
- package/dist/chunks/{run-app-publish-command-eJcYGb8S.cjs → run-app-publish-command-DiIlqdTg.cjs} +2 -2
- package/dist/chunks/{run-app-pull-command-BV2cMuLU.cjs → run-app-pull-command-r_NjC_Rk.cjs} +2 -2
- package/dist/chunks/{run-app-translations-extract-command-CBBbk_vJ.cjs → run-app-translations-extract-command-Ba66GX7e.cjs} +1 -1
- package/dist/chunks/{run-app-typecheck-command-pAHhuBGo.cjs → run-app-typecheck-command-MAxB7Yg3.cjs} +1 -1
- package/dist/chunks/{run-app-uninstall-command-C5um6udQ.cjs → run-app-uninstall-command-BzYSsL5a.cjs} +1 -1
- package/dist/chunks/{run-auth-login-command-C4VI44Xu.cjs → run-auth-login-command-Cb3bITQj.cjs} +1 -1
- package/dist/chunks/{run-auth-logout-command-5Tvqclki.cjs → run-auth-logout-command-iC22soKN.cjs} +1 -1
- package/dist/chunks/{run-auth-status-command-CLH1bylR.cjs → run-auth-status-command-C0rdb747.cjs} +1 -1
- package/dist/chunks/{run-cli-BA0FsxzB.cjs → run-cli-CuxXyb__.cjs} +7 -7
- package/dist/chunks/{run-commands-command-CjzkTcrO.cjs → run-commands-command-D0P3mHHz.cjs} +1 -1
- package/dist/chunks/{run-data-get-command-DoZIpf8O.cjs → run-data-get-command-D7czgisf.cjs} +1 -1
- package/dist/chunks/{run-data-list-command-DAoplyqj.cjs → run-data-list-command-CUp_FN_I.cjs} +1 -1
- package/dist/chunks/{run-doctor-command-D8cpt7FI.cjs → run-doctor-command-ClisEoI5.cjs} +2 -2
- package/dist/chunks/{run-metadata-field-describe-command-BrZYIhjH.cjs → run-metadata-field-describe-command-7xrRVRwr.cjs} +1 -1
- package/dist/chunks/{run-metadata-field-list-command-C9-pHXbx.cjs → run-metadata-field-list-command-CpIUXOmy.cjs} +1 -1
- package/dist/chunks/{run-metadata-object-describe-command-WFdGu1Iq.cjs → run-metadata-object-describe-command--cIPFkWW.cjs} +1 -1
- package/dist/chunks/run-metadata-object-list-command-CQ1jcSJc.cjs +2 -0
- package/dist/chunks/{run-open-command-B1pdHp36.cjs → run-open-command-DLe3PYqB.cjs} +1 -1
- package/dist/chunks/{run-remote-list-command-BRPcCOKx.cjs → run-remote-list-command-DV-Ruk98.cjs} +1 -1
- package/dist/chunks/{run-remote-remove-command-CS6za2Pm.cjs → run-remote-remove-command-C1JeH5mK.cjs} +1 -1
- package/dist/chunks/{run-remote-rename-command-BOqWQUR4.cjs → run-remote-rename-command-CCVu4hEw.cjs} +1 -1
- package/dist/chunks/{run-remote-use-command-BANiokD-.cjs → run-remote-use-command-BvqWgEsP.cjs} +1 -1
- package/dist/chunks/{run-version-command-C0xgcPP6.cjs → run-version-command-DdKb9JL0.cjs} +1 -1
- package/dist/chunks/{select-target-CfuNLCQL.cjs → select-target-DZlm8j62.cjs} +1 -1
- package/dist/chunks/{sign-in-to-remote-again-DYCWIDa9.cjs → sign-in-to-remote-again-WEIeFaAT.cjs} +1 -1
- package/dist/chunks/{sign-in-with-browser-Ck4tOxtA.cjs → sign-in-with-browser-BUvT_awm.cjs} +1 -1
- package/dist/chunks/to-public-target-bNT50le0.cjs +1 -0
- package/dist/chunks/{to-worker-output-diagnostics-Bt_acI26.cjs → to-worker-output-diagnostics-BzdY4Z2V.cjs} +1 -1
- package/dist/chunks/{typecheck-application-DEO1SVdO.cjs → typecheck-application-dVtzoMDg.cjs} +2 -2
- package/dist/chunks/{update-config-FzOzO3wZ.cjs → update-config-CnB7lDVC.cjs} +1 -1
- package/dist/chunks/{utils-ZOESAfF8-ub6jPiZ-.cjs → utils-CvvLHbc4-CKDJ1YgX.cjs} +20 -17
- package/dist/chunks/{write-config-atomically-C-YMKq3P.cjs → write-config-atomically-DkRUfbw0.cjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/package.json +2 -2
- package/dist/chunks/application-BE-X21OV.cjs +0 -5
- package/dist/chunks/cli-version.constant-BBeYll5N.cjs +0 -1
- package/dist/chunks/create-metadata-client-BRD2ys8z.cjs +0 -6
- package/dist/chunks/create-rest-client-Cc5Cmakp.cjs +0 -60
- package/dist/chunks/format-body-BIv-9Sd5.cjs +0 -1
- package/dist/chunks/format-progress-line-DgxG_7p2.cjs +0 -1
- package/dist/chunks/is-access-token-expiring-D-YfufId.cjs +0 -1
- package/dist/chunks/is-locale-catalog-CRn-mKHj.cjs +0 -1
- package/dist/chunks/is-supported-locale-BOZxTj7r.cjs +0 -1
- package/dist/chunks/metadata-Vepr2xeA.cjs +0 -1
- package/dist/chunks/parse-extraction-locale-fg7K8vps.cjs +0 -1
- package/dist/chunks/read-json-object-CgaXuNS0.cjs +0 -1
- package/dist/chunks/run-metadata-object-list-command-8UKU3cMW.cjs +0 -2
- package/dist/chunks/to-public-target-C0POrVoG.cjs +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-
|
|
2
|
-
`);process.stderr.write(`${e}\n`)||await(0,x.once)(process.stderr,`drain`,{signal:a})}});return n=s.catch(()=>void 0),s}}},F=async({signal:e,subscribe:n,build:r,apply:i,onSkipped:a,debounceMilliseconds:o=100})=>{let s=new AbortController,c,l=e=>{s.abort(e),f()},u=()=>l(e.reason),d=new Set,f=()=>{for(let e of d)e()},p=async e=>{for(;!e();)s.signal.throwIfAborted(),await new Promise(e=>{let t=()=>{d.delete(t),e()};d.add(t)});s.signal.throwIfAborted()},m=1,h=0,g,_=!1,v=!1,y=new AbortController,b,x=()=>{m+=1,y.abort(Error(`App changed while awaiting approval.`)),f()},S=async()=>{for(;!s.signal.aborted;){await p(()=>!v&&m!==h);let n=m;if(await(0,E.setTimeout)(o,void 0,{signal:s.signal}),n!==m||v)continue;h=n,_=!0;let i;try{t.
|
|
1
|
+
const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-D-caeNc5-9rDzSg5B.cjs"),n=require("./get-client-sdk-package-path-2U3kDCRq.cjs"),r=require("./is-inside-directory-DHVCQE5C.cjs"),i=require("./resolve-inside-sdk-DiEOTO12.cjs"),a=require("./read-watch-input-stamp-BxeOb0vI.cjs"),o=require("./cli-error-CSsayo0u.cjs"),s=require("./fs-utils-Bl1fQcaJ.cjs"),c=require("./resolve-source-sdk-CU1wk4bl.cjs"),l=require("./create-pull-base-write-JW3ZTnaC.cjs"),u=require("./read-command-values-uSJqBG_E.cjs"),d=require("./style-BR52fK4V.cjs"),f=require("./to-worker-output-diagnostics-BzdY4Z2V.cjs"),p=require("./resolve-app-project-B0KRR-xp.cjs"),m=require("./with-phase-details-Dof8Ao9R.cjs"),h=require("./to-cli-error-BBYf_wqo.cjs"),g=require("./record-pull-base-DwoMDnXm.cjs"),_=require("./read-snapshot-file-CxPJh0Bk.cjs"),v=require("./create-tooling-failure-B2FmNwR2.cjs"),y=require("./get-client-generation-skip-reason-BVkBgZWQ.cjs"),b=require("./format-progress-line-DhMnjGkz.cjs");let x=require("node:events"),S=require("node:crypto"),C=require("node:fs/promises"),w=require("node:path"),T=require("node:module"),E=require("node:timers/promises"),D=require("chokidar");var O=async({build:e,appPath:t,signal:n})=>{n.throwIfAborted();let r=_.a({build:e,appPath:t}),i=(0,w.join)(t,`.twenty`,`cli`,`snapshots`);await(0,C.mkdir)(i,{recursive:!0});let a=await(0,C.mkdtemp)((0,w.join)(i,`dev-`)),o=()=>(0,C.rm)(a,{recursive:!0,force:!0});try{for(let t of e.files){n.throwIfAborted();let e=await _.t({snapshotDirectory:r,artifact:t}),i=(0,w.join)(a,t.path);await(0,C.mkdir)((0,w.dirname)(i),{recursive:!0}),await(0,C.writeFile)(i,_.n(e),{flag:`wx`,signal:n})}return n.throwIfAborted(),{build:{...e,directory:a},release:o}}catch(e){throw await o(),e}},k=async({appPath:e,signal:n,updateWatchInputs:r,warn:i})=>{let a=await c.t({appPath:e,warn:i}),s=await g.n(e).catch(()=>void 0),l;try{let i=await f.n({request:{type:`bundleSnapshot`,appPath:e,holdSnapshot:!0,collectWatchInputs:!0},signal:n,useHeldSnapshot:async({result:t})=>{let r=f.o({value:t,parseData:f.i});r.success&&(l=await O({build:r.data,appPath:e,signal:n}))}});n.throwIfAborted();let c=f.o({value:i.result,parseData:f.i}),u=[...c.diagnostics,...f.t(i.output)];if(await r(i.watchInputs??[],c.success),!c.success)throw v.t({error:c.error,diagnostics:u,sdkVersion:a.version});if(!t.Ut(l))throw new o.t({code:`WORKER_FAILED`,message:`The build worker did not retain its dev snapshot.`});let d=i.release;if(!t.Ut(d)||!f.o({value:d,parseData:e=>e===null?{data:null}:void 0}).success)throw new o.t({code:`WORKER_FAILED`,message:`The build worker could not release its source snapshot. Stop and clean up .twenty/cli/snapshots before restarting dev.`});return{...l,contentHash:l.build.contentHash,tooling:a,diagnostics:u,sourceFingerprints:s}}catch(e){throw await l?.release(),e}},A=async e=>{let t=async e=>{try{return l.i(await(0,C.readFile)(e))}catch(e){if(o.r(e,`ENOENT`))return null;throw e}},n=[`dist/core.mjs`,`dist/core.cjs`],r=(0,w.join)(e,`dist/core/generated`);try{let t=await(0,C.readdir)(r,{recursive:!0,withFileTypes:!0});for(let r of t)(r.isFile()||r.isSymbolicLink())&&n.push((0,w.relative)(e,(0,w.join)(r.parentPath,r.name)))}catch(e){if(!o.r(e,`ENOENT`))throw e}return JSON.stringify(await Promise.all(n.sort().map(async n=>[n,await t((0,w.join)(e,n))])))},j=({appPath:e})=>{let r,a,o=()=>A(n.t({appPath:e}));return async({snapshot:s,applied:c,context:l,withBuildsPaused:u,invalidate:d})=>{let f=await y.t({appPath:e});if(t.Ut(f))return l.output.warn({code:`CLIENT_NOT_GENERATED`,message:f}),`skipped`;let p,_,v;try{p=await y.n({applicationUniversalIdentifier:c.acknowledgedUniversalIdentifier,context:l});let r=await(0,C.realpath)(n.t({appPath:e})),a=await(0,C.readFile)((0,w.join)(r,`package.json`)),s=i.t({resolveFromApp:(0,T.createRequire)((0,w.join)(r,`package.json`)).resolve,specifier:`twenty-client-sdk/generate`,sdkPath:r});if(!t.Ut(s))throw Error(`The installed twenty-client-sdk has no compatible generate entry point.`);_=(0,S.createHash)(`sha256`).update(p).update(r).update(a).update(await(0,C.readFile)(s)).digest(`hex`),v=await o()}catch(e){if(l.signal.aborted)throw m.t({error:h.t(e,l.signal),phase:`clientGeneration`,outcome:`applied`,completedPhases:c.completedPhases,hint:`The app was synced. Client generation had not started, so the previous typed API client was kept.`});return l.output.warn({code:`CLIENT_NOT_GENERATED`,message:`The app was synced, but its client inputs could not be fetched: ${h.t(e).message} The previous client was kept.`}),`skipped`}if(_===r&&v===a)return`unchanged`;let b=!1;try{await u(async()=>{l.signal.throwIfAborted(),b=!0,await y.i({appPath:e,schema:p,sdk:s.tooling,context:l}),r=_,a=await o(),c.completedPhases.push(`clientGeneration`),d()})}catch(e){throw b?g.r({error:e,phase:`clientGeneration`,applicationName:s.build.application.displayName,apiUrl:l.target.apiUrl,completedPhases:c.completedPhases,signal:l.signal}):m.t({error:h.t(e,l.signal),phase:`clientGeneration`,outcome:`applied`,completedPhases:c.completedPhases,hint:`The app was synced. Client generation had not started, so the previous typed API client was kept.`})}return`generated`}},M=e.t(),N=({message:e,code:t,percentage:n})=>(0,M.isNonEmptyString)(t)?d.s(e):b.t({message:e,percentage:n}),P=e=>{let t=[],n=Promise.resolve(),r=0;return{output:{...e.output,progress:e=>{t.length<32?t.push(e):r+=1},warn:e=>{t.length<32?t.push(e):r+=1}},emit:(i,a)=>{let o=t.splice(0);r>0&&(o.push({message:`${r} additional progress messages omitted.`}),r=0);let s=n.then(async()=>{if(a.throwIfAborted(),e.outputMode===`ndjson`)await e.output.event(`progress`,{...i,messages:o},a);else{let e=[...o.map(N),i.message].filter(e=>e.length>0).join(`
|
|
2
|
+
`);process.stderr.write(`${e}\n`)||await(0,x.once)(process.stderr,`drain`,{signal:a})}});return n=s.catch(()=>void 0),s}}},F=async({signal:e,subscribe:n,build:r,apply:i,onSkipped:a,debounceMilliseconds:o=100})=>{let s=new AbortController,c,l=e=>{s.abort(e),f()},u=()=>l(e.reason),d=new Set,f=()=>{for(let e of d)e()},p=async e=>{for(;!e();)s.signal.throwIfAborted(),await new Promise(e=>{let t=()=>{d.delete(t),e()};d.add(t)});s.signal.throwIfAborted()},m=1,h=0,g,_=!1,v=!1,y=new AbortController,b,x=()=>{m+=1,y.abort(Error(`App changed while awaiting approval.`)),f()},S=async()=>{for(;!s.signal.aborted;){await p(()=>!v&&m!==h);let n=m;if(await(0,E.setTimeout)(o,void 0,{signal:s.signal}),n!==m||v)continue;h=n,_=!0;let i;try{t.Ut(g)&&(await g.snapshot.release(),g=void 0),i=await r(n,AbortSignal.any([e,s.signal])),t.Ut(i)&&(n!==m||s.signal.aborted?(await i.release(),await a(n,`superseded`)):g={snapshot:i,revision:n})}finally{_=!1,f()}}},C=async()=>{for(;!s.signal.aborted;){await p(()=>t.Ut(g)&&g.revision===m);let n=g;if(t.Ut(n)){g=void 0,y=new AbortController;try{if(n.snapshot.contentHash===b){await a(n.revision,`unchanged`);continue}b=await i(n.snapshot,{revision:n.revision,signal:AbortSignal.any([e,s.signal]),revisionSignal:AbortSignal.any([e,s.signal,y.signal]),invalidate:x,withBuildsPaused:async e=>{v=!0;try{return await p(()=>!_),await e()}finally{v=!1,f()}}})?n.snapshot.contentHash:void 0}finally{await n.snapshot.release()}}}};e.addEventListener(`abort`,u,{once:!0});let w;try{e.throwIfAborted(),w=await n(x,l);let r=[S().catch(n=>{!e.aborted&&!t.Ut(c)&&(c=n),l(n)}),C().catch(e=>{c=e,l(e)})];if(await Promise.all(r),t.Ut(c))throw c;s.signal.throwIfAborted()}finally{l(e.reason),e.removeEventListener(`abort`,u);try{await w?.()}finally{await g?.snapshot.release()}}},I=(e,t)=>new Promise((n,r)=>{let i=()=>{e.off(`ready`,a),e.off(`error`,o),t.removeEventListener(`abort`,s)},a=()=>{i(),n()},o=e=>{i(),r(e)},s=()=>{i(),r(t.reason)};e.once(`ready`,a),e.once(`error`,o),t.addEventListener(`abort`,s,{once:!0}),t.aborted&&s()}),L=async({appPath:e,signal:t,onChange:n,onError:i})=>{e=await(0,C.realpath)(e);let o=(0,D.watch)(e,{ignoreInitial:!0,followSymlinks:!1,ignored:t=>(0,w.relative)(e,t).split(w.sep)[0]===`dist`||a.n((0,w.relative)(e,t)),atomic:!0}).on(`all`,n).on(`error`,i),c,l=[],u=async()=>{await Promise.all([o.close(),c?.close()])};try{await I(o,t)}catch(e){throw await u(),e}return{close:u,update:async(o,u)=>{u&&(l=o);let d=[...l,...o].filter(t=>t.path!==e&&!r.t({filePath:t.path,directory:e})),f=new Set(d.filter(e=>e.kind===`directory`).map(e=>e.path)),p=new Set(d.filter(e=>e.kind===`file`).map(e=>e.path)),m=new Set,h=new Set;for(let e of d){let t=(0,w.dirname)(e.path);for(;!s.a(t)&&(0,w.dirname)(t)!==t;)h.add(t),t=(0,w.dirname)(t);m.add(t)}let g=e=>[...f].some(t=>{let n=(0,w.relative)(t,e);return n.length>0&&n!==`..`&&!n.includes(w.sep)}),_=[...new Set([...d.map(e=>e.path),...m])].filter(s.a),v=c;if(_.length>0){let e=(0,D.watch)(_,{ignoreInitial:!0,followSymlinks:!1,depth:0,atomic:!0,ignored:e=>{let t=(0,w.resolve)(e);return a.n(e)||!(m.has(t)||f.has(t)||h.has(t)||p.has(t)||g(t))}}).on(`all`,(e,t)=>{let r=(0,w.resolve)(t);(p.has(r)||e!==`change`&&(g(r)||f.has(r)||h.has(r)))&&n()}).on(`error`,i);c=e;try{await I(e,t)}catch(e){throw await v?.close(),e}}else c=void 0;await v?.close(),o.some(e=>a.t(e)!==e.stamp)&&n()}}},R=async e=>{let n=await p.t({explicitPath:u.r(e.options,`path`),workingDirectory:process.cwd()}),{output:r,emit:i}=P(e),a=j({appPath:n.path}),s,c=!1;throw await F({signal:e.signal,subscribe:async(t,r)=>{s=await L({appPath:n.path,signal:e.signal,onChange:t,onError:r});try{await i({kind:`watch-ready`,message:`Watching ${n.path}. Syncing to ${e.target.apiUrl}. Press Ctrl+C to stop.`,appPath:n.path},e.signal)}catch(e){throw await s.close(),e}return s.close},build:async(t,a)=>{await i({kind:`build-start`,message:`Building app…`,revision:t},a);try{let e=await k({appPath:n.path,signal:a,updateWatchInputs:s.update,warn:e=>{c||(c=!0,r.warn(e))}});try{return await i({kind:`build-success`,message:`Built ${e.build.application.displayName}.`,revision:t,buildId:e.build.buildId,contentHash:e.contentHash,diagnostics:e.diagnostics},a),e}catch(t){throw await e.release(),t}}catch(n){a.throwIfAborted();let s=h.t(n);if(s.code===`WORKER_FAILED`)throw new o.t({code:s.code,message:s.message,details:s.details,hint:`Fix the worker failure, then restart twenty app dev. A worker killed while building may leave folders in .twenty/cli/snapshots; remove abandoned snapshots only after stopping all dev/apply sessions for this app.`});if(![`TYPECHECK_FAILED`,`BUILD_FAILED`,`SDK_NOT_INSTALLED`,`SDK_SOURCE_UNSUPPORTED`,`TYPESCRIPT_NOT_INSTALLED`].includes(s.code))throw n;let c=s.details?.diagnostics;if(e.outputMode===`human`&&Array.isArray(c))for(let e of c.filter(f.r))r.progress({message:f.s(e)});await i({kind:`build-failure`,message:`${s.message} Waiting for source changes.`,revision:t,error:{code:s.code,message:s.message,details:s.details}},a);return}},apply:async(o,s)=>{let{revision:c,signal:l}=s,d={...e,output:r,signal:l},f=!1;await i({kind:`sync-start`,message:`Planning changes…`,revision:c,buildId:o.build.buildId},l);let p;try{p=await g.i({build:o.build,appPath:n.path,context:d,inferDeletionFromMissingEntities:e.options.delete!==!1,isCreationApproved:u.t(e.options,`create`),isDeletionApproved:u.t(e.options,`yes`),approvalSignal:s.revisionSignal,flushProgress:()=>i({kind:`sync-progress`,message:``,revision:c},l),beforeWrite:()=>{f||s.revisionSignal.throwIfAborted(),f=!0}})}catch(e){if(l.aborted)throw e;let t=h.t(e);if(s.revisionSignal.aborted&&t.details?.phase===`confirmation`)return await i({kind:`sync-superseded`,message:`Source changed; a fresh plan is queued.`,revision:c,details:t.details},l),!1;if([`AUTH_REQUIRED`,`PERMISSION_DENIED`].includes(t.code))throw e;return await i({kind:`sync-failure`,message:`${t.message} A new source edit will request a fresh plan.`,revision:c,error:{code:t.code,message:t.message,hint:t.hint,details:t.details}},l),!1}try{await g.t({appPath:n.path,universalIdentifier:p.acknowledgedUniversalIdentifier,sourceFingerprints:o.sourceFingerprints,context:d})===`recorded`&&p.completedPhases.push(`pullBase`)}catch(t){throw g.r({error:t,phase:`pullBase`,applicationName:o.build.application.displayName,apiUrl:e.target.apiUrl,completedPhases:p.completedPhases,signal:l})}let m=await a({snapshot:o,applied:p,context:d,withBuildsPaused:s.withBuildsPaused,invalidate:s.invalidate});return t.Ut(p.appliedActions)||r.warn({code:`SYNC_REPORT_UNAVAILABLE`,message:`The sync succeeded, but the server did not return a readable list of changes.`}),await i({kind:`sync-success`,message:`Synced ${o.build.application.displayName}. Watching for changes…`,revision:c,buildId:o.build.buildId,contentHash:o.contentHash,completedPhases:p.completedPhases,clientGeneration:m,actions:p.appliedActions??null},l),!0},onSkipped:(t,n)=>i({kind:`build-skipped`,message:n===`unchanged`?`Build unchanged since the last acknowledged sync.`:`Source changed during the build; rebuilding…`,revision:t,reason:n},e.signal)}),new o.t({code:`INTERNAL_ERROR`,message:`The dev session stopped unexpectedly.`})};exports.runAppDevCommand=R;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-
|
|
1
|
+
const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-D-caeNc5-9rDzSg5B.cjs"),n=require("./application-DOWikeQt.cjs"),r=require("./cli-error-CSsayo0u.cjs"),i=require("./resolve-source-sdk-CU1wk4bl.cjs"),a=require("./is-same-universal-identifier-BCBib3RP.cjs"),o=require("./is-exported-manifest-DnQNK9XY.cjs"),s=require("./read-command-values-uSJqBG_E.cjs"),c=require("./read-input-value-Cxgh_r2g.cjs"),l=require("./parse-json-input-CO-KP4XZ.cjs"),u=require("./request-timeout-milliseconds.constant-DtyQHrll.cjs"),d=require("./style-BR52fK4V.cjs"),f=require("./to-worker-output-diagnostics-BzdY4Z2V.cjs"),p=require("./resolve-app-project-B0KRR-xp.cjs"),m=require("./to-cli-error-BBYf_wqo.cjs"),h=require("./is-application-not-found-error-Cja7iQrL.cjs"),g=require("./create-metadata-client-9IF8ArjT.cjs"),_=require("./format-data-value-kug8Yjt2.cjs"),v=require("./create-tooling-failure-B2FmNwR2.cjs"),y=require("./create-app-not-installed-error-DY-iuPPx.cjs"),b=require("./format-details-COEwKz_M.cjs");var x=e.t(),S=e=>t.u(e)&&(0,x.isString)(e.id)&&(0,x.isString)(e.name)&&((0,x.isString)(e.universalIdentifier)||e.universalIdentifier===null)&&((0,x.isString)(e.applicationId)||e.applicationId===null)&&(0,x.isNumber)(e.timeoutSeconds)&&Number.isFinite(e.timeoutSeconds)&&e.timeoutSeconds>=0&&Math.ceil(e.timeoutSeconds*1e3)+6e4<2**31,C=()=>new r.t({code:`INVALID_RESPONSE`,message:`The server returned an invalid logic-function response.`}),w=e=>{if([`AUTH_REQUIRED`,`PERMISSION_DENIED`].includes(e.code))return!0;let n=e.details?.errors;return e.code===`GRAPHQL_ERROR`&&(0,x.isArray)(n)&&n.length>0&&n.every(e=>t.u(e)&&(0,x.isString)(e.code)&&[`NOT_FOUND`,`BAD_USER_INPUT`,`GRAPHQL_VALIDATION_FAILED`].includes(e.code))},T=async({manifest:e,selector:n,payload:i,target:o,signal:s,onExecuting:c})=>{let l=g.t({target:o,signal:s}),{applicationUniversalIdentifier:d}=e,{findOneApplication:f,findManyLogicFunctions:p}=await l.query({findOneApplication:{__args:{universalIdentifier:d},id:!0,universalIdentifier:!0},findManyLogicFunctions:{id:!0,name:!0,universalIdentifier:!0,applicationId:!0,timeoutSeconds:!0}}).catch(e=>{throw h.t({error:e,field:`findOneApplication`})?y.t({universalIdentifier:d,apiUrl:o.apiUrl}):e});if(!t.u(f)||!(0,x.isString)(f.id)||!a.t({value:f.universalIdentifier,universalIdentifier:d})||!(0,x.isArray)(p)||!p.every(S))throw C();let _=p.filter(n=>n.applicationId===f.id&&t.Ut(n.universalIdentifier)&&e.universalIdentifiers.includes(n.universalIdentifier.toLowerCase())),v=n.kind===`hook`?e.hooks[n.value]:n.value,b=_.filter(e=>t.Ut(v)&&(n.kind===`name`?e.name===v:e.universalIdentifier?.toLowerCase()===v));if(b.length===0)throw new r.t({code:`NOT_FOUND`,exitCode:r.n.NOT_FOUND,message:`Function "${n.value}" was not found in the deployed app.`,hint:`Check the selected workspace and function. Run twenty app apply or twenty app dev to sync local changes first.`,details:{identifier:n.value,availableFunctions:_.map(({name:e,universalIdentifier:t})=>({name:e,universalIdentifier:t}))}});if(b.length>1)throw new r.t({code:`AMBIGUOUS_RESOURCE`,exitCode:r.n.CONFLICT,message:`More than one app function matches "${n.value}".`,hint:`Select a function with --universal-identifier.`});let T=b[0],E={applicationUniversalIdentifier:d,functionName:T.name,functionUniversalIdentifier:T.universalIdentifier};c(T.name),s.throwIfAborted();let D=g.t({target:o,signal:s,timeoutMilliseconds:Math.ceil(T.timeoutSeconds*1e3)+u.t});try{let{executeOneLogicFunction:e}=await D.mutation({executeOneLogicFunction:{__args:{input:{id:T.id,payload:i}},data:!0,logs:!0,duration:!0,status:!0,error:!0}});if(!t.u(e)||!(0,x.isString)(e.status)||!(0,x.isString)(e.logs)||!(0,x.isNumber)(e.duration)||!Number.isFinite(e.duration)||e.duration<0)throw C();return{...E,status:e.status,durationMilliseconds:e.duration,data:e.data??null,logs:e.logs,error:e.error??null}}catch(e){let t=m.t(e,s),n=w(t);throw new r.t({code:t.code,exitCode:t.exitCode,message:t.message,hint:n?t.hint:`Execution may have started and may still be running. Check its effects before retrying; this command does not retry or stop server-side execution.`,details:{...t.details,...E,outcome:n?`not-started`:`unknown`}})}},E=e=>JSON.stringify(e,null,2).replace(/[\x7f-\x9f]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`),D=(e,t=process.stdout)=>[b.t([[`Function`,_.r(e.functionName)],[`Status`,d.n(e.status===`SUCCESS`?`green`:`red`,_.r(e.status),t)],[`Duration`,d.i(`${e.durationMilliseconds}ms`,t)]],t),...e.data===null?[]:[``,d.t(`Data:`,t),E(e.data)],...e.error===null?[]:[``,d.t(`Error:`,t),E(e.error)],...e.logs.length>0?[``,d.t(`Logs:`,t),...e.logs.split(`
|
|
2
2
|
`).map(_.r)]:[]].join(`
|
|
3
|
-
`),O=async({options:e,output:n,outputMode:r,signal:a})=>{let c=await p.t({explicitPath:s.r(e,`path`),workingDirectory:process.cwd()}),l=await i.t({appPath:c.path,warn:n.warn});n.progress({message:`Reading app definitions in ${c.path}…`});let u=await f.n({request:{type:`buildManifest`,appPath:c.path},signal:a});a.throwIfAborted();let d=f.o({value:u.result,parseData:e=>{if(!t.
|
|
3
|
+
`),O=async({options:e,output:n,outputMode:r,signal:a})=>{let c=await p.t({explicitPath:s.r(e,`path`),workingDirectory:process.cwd()}),l=await i.t({appPath:c.path,warn:n.warn});n.progress({message:`Reading app definitions in ${c.path}…`});let u=await f.n({request:{type:`buildManifest`,appPath:c.path},signal:a});a.throwIfAborted();let d=f.o({value:u.result,parseData:e=>{if(!t.u(e)||!o.t(e.manifest))return;let{manifest:n}=e;if(!(0,x.isArray)(n.logicFunctions))return;let r=[];for(let e of n.logicFunctions){if(!t.u(e)||!(0,x.isString)(e.universalIdentifier))return;r.push(e.universalIdentifier.toLowerCase())}let i={};for(let e of[`postInstallLogicFunction`,`preInstallLogicFunction`,`uninstallLogicFunction`]){let r=n.application[e];if(t.Ut(r)){if(!t.u(r)||!(0,x.isString)(r.universalIdentifier))return;i[e]=r.universalIdentifier.toLowerCase()}}return{data:{applicationUniversalIdentifier:n.application.universalIdentifier.toLowerCase(),universalIdentifiers:r,hooks:i}}}}),m=[...d.diagnostics,...f.t(u.output)];if(r===`human`)for(let e of m)n.progress({message:f.s(e)});if(!d.success)throw v.t({error:d.error,diagnostics:m,sdkVersion:l.version});return{...d.data,diagnostics:m}},k=e=>{let i=[],a=s.r(e,`name`),o=s.r(e,`universalIdentifier`);if(t.Ut(a)&&i.push({kind:`name`,value:a}),t.Ut(o)&&i.push({kind:`universalIdentifier`,value:o.toLowerCase()}),s.t(e,`postInstall`)&&i.push({kind:`hook`,value:`postInstallLogicFunction`}),s.t(e,`preInstall`)&&i.push({kind:`hook`,value:`preInstallLogicFunction`}),s.t(e,`uninstallHook`)&&i.push({kind:`hook`,value:`uninstallLogicFunction`}),i.length!==1)throw new r.t({code:`INVALID_INPUT`,exitCode:r.n.USAGE,message:`Choose exactly one of --name, --universal-identifier, --post-install, --pre-install or --uninstall-hook.`});let c=i[0];if(c.value.trim().length===0||c.kind===`universalIdentifier`&&!n.a(c.value))throw new r.t({code:`INVALID_INPUT`,exitCode:r.n.USAGE,message:c.kind===`name`?`--name cannot be empty.`:`--universal-identifier must be a UUID of version 4 or later.`});return c},A=async e=>{let{options:t,target:n,signal:i,output:a,outputMode:o}=e,u=k(t);if(n.credentialKind!==`oauth`)throw new r.t({code:`AUTH_REQUIRED`,exitCode:r.n.AUTHENTICATION,message:`Running logic functions requires a signed-in user. API keys cannot execute them.`,hint:`Sign in with twenty auth login --url ${n.apiUrl} --name dev, then use --remote dev.`,details:{credentialKind:n.credentialKind}});let d=l.n({text:await c.t({value:s.r(t,`payload`)??`{}`,optionName:`--payload`,signal:i}),optionName:`--payload`}),f=await O(e);u.kind===`hook`&&a.progress({message:`Executing the hook only; this does not install or uninstall the app.`});let p=await T({manifest:f,selector:u,payload:d,target:n,signal:i,onExecuting:e=>a.progress({message:`Executing ${_.r(e)} on ${n.apiUrl}…`})}),m=D(p,p.status===`SUCCESS`?process.stdout:process.stderr);if(p.status!==`SUCCESS`)throw o===`human`&&a.progress({message:m}),new r.t({code:`EXECUTION_FAILED`,message:`Function ${_.r(p.functionName)} returned ${_.r(p.status)}.`,details:{...p,outcome:`completed`,diagnostics:f.diagnostics}});return{data:{...p,diagnostics:f.diagnostics},human:m}};exports.runAppExecCommand=A;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./constants-
|
|
1
|
+
const e=require("./constants-D-caeNc5-9rDzSg5B.cjs"),t=require("./get-client-sdk-package-path-2U3kDCRq.cjs"),n=require("./cli-error-CSsayo0u.cjs"),r=require("./resolve-source-sdk-CU1wk4bl.cjs"),i=require("./read-command-values-uSJqBG_E.cjs"),a=require("./style-BR52fK4V.cjs"),o=require("./to-worker-output-diagnostics-BzdY4Z2V.cjs"),s=require("./read-app-identity-dWB3NG6p.cjs"),c=require("./resolve-app-project-B0KRR-xp.cjs"),l=require("./is-application-not-found-error-Cja7iQrL.cjs"),u=require("./get-client-generation-skip-reason-BVkBgZWQ.cjs"),d=require("./create-app-not-installed-error-DY-iuPPx.cjs"),f=require("./format-display-path-gEepVJDg.cjs");var p=async p=>{let{options:m,output:h,outputMode:g,signal:_,target:v}=p,y=performance.now(),b=process.cwd(),x=await c.t({explicitPath:i.r(m,`path`),workingDirectory:b}),S=await u.t({appPath:x.path});if(e.Ut(S))throw new n.t({code:`CLIENT_SDK_NOT_INSTALLED`,message:`The typed API client cannot be generated: ${S}`,hint:`Install twenty-client-sdk in the app, for example with yarn add twenty-client-sdk, then try again.`,details:{appPath:x.path}});let C=await s.t({appPath:x.path,signal:_});if(!e.Ut(C.application))throw new n.t({code:`INVALID_INPUT`,exitCode:n.n.USAGE,message:`This project has no application definition.`});let w=C.application.universalIdentifier.toLowerCase();if(g===`human`)for(let e of C.diagnostics)h.progress({message:o.s(e)});let T=await r.t({appPath:x.path}),E=await u.r({appPath:x.path,applicationUniversalIdentifier:w,sdk:T,context:p}).catch(e=>{throw l.t({error:e,field:`applicationCoreGraphqlSchema`})?d.t({universalIdentifier:w,apiUrl:v.apiUrl,hint:`Install it with twenty app apply, which also generates the client.`}):e}),D=t.t({appPath:x.path}),O=f.t({workingDirectory:b,targetPath:D});return{data:{app:{path:x.path,name:x.name},sdk:{version:T.version},client:{path:D},application:C.application,diagnostics:[...C.diagnostics,...E],durationMilliseconds:Math.round(performance.now()-y)},human:[a.o(`Generated the typed API client for ${C.application.displayName??x.name} from ${v.apiUrl}`),` Saved in ${a.n(`cyan`,O)}`].join(`
|
|
2
2
|
`)}};exports.runAppGenerateClientCommand=p;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./build-CX6FBrbu.cjs"),t=require("./utils-
|
|
2
|
-
`)},A=/^[\w./-]+$/,j=e=>A.test(e)?e:process.platform===`win32`?`'${e.replace(/'/g,`''`)}'`:`'${e.replace(/'/g,`'\\''`)}'`,M=({displayPath:e,isTargetConfigured:t,remoteName:r})=>{let i=n.
|
|
1
|
+
const e=require("./build-CX6FBrbu.cjs"),t=require("./utils-CvvLHbc4-CKDJ1YgX.cjs"),n=require("./constants-D-caeNc5-9rDzSg5B.cjs"),r=require("./cli-error-CSsayo0u.cjs"),i=require("./print-typescript-value-D5kLR9wo.cjs"),a=require("./read-command-values-uSJqBG_E.cjs"),o=require("./convert-to-label-hx-g0Lvj.cjs"),s=require("./style-BR52fK4V.cjs"),c=require("./cli-version.constant-DGQXQw_V.cjs"),l=require("./format-display-path-gEepVJDg.cjs"),u=require("./select-target-DZlm8j62.cjs"),d=require("./get-config-path-C-D-QHuX.cjs"),f=require("./read-config-Qwl4pAO8.cjs");let p=require("node:crypto"),m=require("node:fs/promises"),h=require("node:path"),g=require("node:fs");var _=e.t(),v=`2.51.1`,y=[`twenty-client-sdk`,`twenty-sdk`,`twenty-ui`],b=()=>(0,h.join)((0,h.dirname)((0,g.realpathSync)(process.argv[1]??``)),`app-template`),x=async({appDirectory:e,appName:t,appDisplayName:n,appDescription:r})=>{await(0,m.cp)(b(),e,{recursive:!0}),await(0,m.writeFile)((0,h.join)(e,`yarn.lock`),``,{flag:`a`});for(let[t,n]of[[`gitignore`,`.gitignore`],[`github`,`.github`],[`yarnrc.yml`,`.yarnrc.yml`]])await(0,m.rename)((0,h.join)(e,t),(0,h.join)(e,n));await(0,m.cp)((0,h.join)(e,`AGENTS.md`),(0,h.join)(e,`CLAUDE.md`));let a=(0,h.join)(e,`.github`,`workflows`,`ci.yml`);await(0,m.writeFile)(a,(await(0,m.readFile)(a,`utf8`)).replace(`CLI-VERSION-TO-BE-GENERATED`,c.t));let o=(0,h.join)(e,`src/constants/universal-identifiers.ts`);await(0,m.writeFile)(o,(await(0,m.readFile)(o,`utf8`)).replace(/'DISPLAY-NAME-TO-BE-GENERATED'/g,()=>i.t({value:n})).replace(/'DESCRIPTION-TO-BE-GENERATED'/g,()=>i.t({value:r})).replace(/UUID-TO-BE-GENERATED/g,()=>(0,p.randomUUID)()));let s=(0,h.join)(e,`package.json`),l=JSON.parse(await(0,m.readFile)(s,`utf8`));l.name=t,l.engines.twenty=`>=${v}`;for(let e of y)l.devDependencies[e]=v;await(0,m.writeFile)(s,JSON.stringify(l,null,2))},S=`TO-BE-GENERATED`,C=`yarn.lock`,w=({appDirectory:e,reason:t})=>new r.t({code:`APP_PATH_UNAVAILABLE`,exitCode:r.n.CONFLICT,message:`${e} already exists and ${t}.`,hint:`Choose another app name, or pass --path with a new or empty directory.`,details:{path:e}}),T=async e=>{let i=await(0,m.stat)(e).catch(e=>{if(!r.r(e,`ENOENT`))throw e});if(!n.Ut(i))return`missing`;if(!i.isDirectory())throw w({appDirectory:e,reason:`is not a directory`});if(t.n(await(0,m.readdir)(e)))throw w({appDirectory:e,reason:`is not empty`});return`empty`},E=async e=>{let t=await(0,m.readdir)(e,{recursive:!0,withFileTypes:!0}),n=[];for(let r of t){let t=(0,h.join)(r.parentPath,r.name),i=(0,h.relative)(e,t);r.isFile()&&i!==C&&(await(0,m.readFile)(t,`utf8`)).includes(S)&&n.push(i)}return n},D=async({stagingDirectory:e,appDirectory:t})=>{let n=[];try{for(let r of await(0,m.readdir)(e,{recursive:!0,withFileTypes:!0})){let i=(0,h.join)(r.parentPath,r.name),a=(0,h.join)(t,(0,h.relative)(e,i));r.isDirectory()?await(0,m.mkdir)(a):await(0,m.copyFile)(i,a,g.constants.COPYFILE_EXCL),n.push({createdPath:a,isDirectory:r.isDirectory()})}}catch(e){for(let{createdPath:e,isDirectory:t}of n.reverse())await(t?(0,m.rmdir)(e):(0,m.unlink)(e)).catch(()=>void 0);throw e}await(0,m.rm)(e,{recursive:!0,force:!0})},O=async({appDirectory:e,appName:n,appDisplayName:i,appDescription:a,signal:o})=>{await T(e);let s=(0,h.dirname)(e);await(0,m.mkdir)(s,{recursive:!0});let c=await(0,m.mkdtemp)((0,h.join)(s,`.${(0,h.basename)(e)}-`));try{await x({appName:n,appDisplayName:i,appDescription:a,appDirectory:c}),o.throwIfAborted();let s=await E(c);if(t.n(s))throw new r.t({code:`APP_INIT_FAILED`,message:`The app template still has placeholders in ${s.join(`, `)}.`,hint:`This CLI ships an app template it cannot render. Upgrade the twenty CLI.`,details:{unrenderedFiles:s}});o.throwIfAborted(),await T(e)===`empty`?await D({stagingDirectory:c,appDirectory:e}):await(0,m.rename)(c,e)}catch(t){throw await(0,m.rm)(c,{recursive:!0,force:!0}),t instanceof r.t||o.aborted?t:new r.t({code:`APP_INIT_FAILED`,message:`Could not create ${e}: ${t instanceof Error?t.message:String(t)}`,hint:`Files this command had written there were removed. Fix the cause, then run the command again.`,details:{path:e}})}},k=({appName:e,location:t,packageNames:n,packageVersion:r,nextSteps:i})=>{let a=Math.max(...i.map(({command:e})=>e.length));return[s.o(`Created ${e} in ${t}`),s.i(` ${u.n(n)} pinned to ${r}. Nothing was installed.`),``,s.t(`Next steps`),...i.map(({command:e,description:t})=>` ${s.r(e.padEnd(a))} ${s.i(`# ${t}`)}`)].join(`
|
|
2
|
+
`)},A=/^[\w./-]+$/,j=e=>A.test(e)?e:process.platform===`win32`?`'${e.replace(/'/g,`''`)}'`:`'${e.replace(/'/g,`'\\''`)}'`,M=({displayPath:e,isTargetConfigured:t,remoteName:r})=>{let i=n.Ut(r)?` --remote ${j(r)}`:``;return[...e===`.`?[]:[{command:`cd ${j(e.startsWith(`-`)?`./${e}`:e)}`,description:`Enter the new app`}],{command:`yarn install`,description:`Install the pinned dependencies`},...t?[]:[{command:`twenty auth login --url <url>${n.Ut(r)?` --name ${j(r)}`:``}`,description:`Connect a workspace`}],{command:`twenty app apply --create${i}`,description:`Build the app and install it in your workspace`}].map(e=>({...e,description:process.platform===`win32`?`${e.description} (PowerShell)`:e.description}))},N=/^(?:@[a-z0-9~-][a-z0-9._~-]*\/)?[a-z0-9~-][a-z0-9._~-]*$/,P=214,F=e=>e.length<=P&&![`node_modules`,`favicon.ico`].includes(e)&&N.test(e),I=({environment:e,remoteFlag:t})=>u.t({environment:e,remoteFlag:t,loadConfig:()=>f.t(d.t()),warn:()=>void 0}).then(()=>!0,()=>!1),L=async({arguments:e,options:t,output:n,signal:i})=>{let s=a.n(e,0)?.trim()??``;if(!F(s))throw new r.t({code:`INVALID_APP_NAME`,exitCode:r.n.USAGE,message:`"${s}" is not a valid package name.`,hint:`Use lowercase letters, digits, hyphens, dots or underscores, for example my-app.`});let c=process.cwd(),u=(0,h.resolve)(c,a.r(t,`path`)??(0,h.basename)(s)),d=a.r(t,`displayName`)?.trim(),f=(0,_.isNonEmptyString)(d)?d:o.t(s),p=a.r(t,`description`)?.trim()??``,m=l.t({workingDirectory:c,targetPath:u}),g=m===`.`?`the current directory`:m;n.progress({message:`Creating ${s} in ${g}…`}),await O({appDirectory:u,appName:s,appDisplayName:f,appDescription:p,signal:i});let b=a.r(t,`remote`),x=M({displayPath:m,isTargetConfigured:await I({environment:process.env,remoteFlag:b}),remoteName:b}),S=[...y];return{data:{app:{name:s,displayName:f,description:p,path:u},packages:S.map(e=>({name:e,version:v})),nextSteps:x},human:k({appName:s,location:g,packageNames:S,packageVersion:v,nextSteps:x})}};exports.runAppInitCommand=L;
|
package/dist/chunks/{run-app-install-command-DMbwFvtE.cjs → run-app-install-command-DPt8PzUS.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-
|
|
1
|
+
const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-D-caeNc5-9rDzSg5B.cjs"),n=require("./cli-error-CSsayo0u.cjs"),r=require("./style-BR52fK4V.cjs"),i=require("./with-phase-details-Dof8Ao9R.cjs"),a=require("./to-cli-error-BBYf_wqo.cjs"),o=require("./create-metadata-client-9IF8ArjT.cjs"),s=require("./format-data-value-kug8Yjt2.cjs"),c=require("./read-application-identifier-BlkRhC8j.cjs");let l=require("node:timers/promises");var u=new Set([`AUTH_REQUIRED`,`PERMISSION_DENIED`,`NOT_FOUND`]),d=({phase:e,code:t})=>e===`identity`||e===`start`&&u.has(t)?`not-started`:t===`INSTALL_FAILED`?`failed`:`unknown`,f=({outcome:e,phase:t})=>t===`identity`?`Fix the app source or identifier, then retry. No installation was started.`:e===`not-started`?`Check the target workspace, registration and APPLICATIONS permission before retrying.`:`Run twenty app install again to retry or resume waiting for the current installation. Stopping the CLI does not cancel the server job.`,p=({error:e,phase:r,completedPhases:o,universalIdentifier:s,jobId:c,signal:l})=>{let u=a.t(e,l),p=d({phase:r,code:u.code});return i.t({error:new n.t({cause:u,code:u.code,exitCode:u.exitCode,message:u.message,hint:u.hint,details:{...u.details,...t.Ut(s)?{universalIdentifier:s}:{},...t.Ut(c)?{jobId:c}:{}}}),phase:r,outcome:p,completedPhases:o,hint:f({outcome:p,phase:r})})},m=e.t(),h={POLL_INTERVAL_MILLISECONDS:1e3,TIMEOUT_MILLISECONDS:6e5},g=e=>(0,m.isNumber)(e)&&Number.isInteger(e)&&e>=0&&e<=100,_=async({universalIdentifier:e,jobId:r,target:i,signal:a,onProgress:s})=>{let c=o.t({target:i,signal:a}),u=0;for(;;){a.throwIfAborted();let i=(await c.query({__name:`FindInstallApplicationJobStatus`,findInstallApplicationJobStatus:{__args:{universalIdentifier:e,jobId:r},jobId:!0,state:!0,failedReason:!0,progress:!0}}))?.findInstallApplicationJobStatus;if(!t.u(i)||i.jobId!==r||!Object.values(o.n.enumJobState).includes(i.state)||t.Ut(i.progress)&&!g(i.progress))throw new n.t({code:`INVALID_RESPONSE`,message:`The server did not return the status of the requested installation job.`});if(i.state===`FAILED`)throw new n.t({code:`INSTALL_FAILED`,message:(0,m.isNonEmptyString)(i.failedReason)?i.failedReason:`The app installation job failed.`});let d=i.state===`COMPLETED`?100:i.progress??u;if(d!==u&&(u=d,s(d)),i.state===`COMPLETED`)break;await(0,l.setTimeout)(h.POLL_INTERVAL_MILLISECONDS,void 0,{signal:a})}},v=async({universalIdentifier:e,completedPhases:r,target:i,signal:a,onProgress:s})=>{let l=AbortSignal.timeout(h.TIMEOUT_MILLISECONDS),u=AbortSignal.any([a,l]),d=o.t({target:i,signal:u}),f=(t,i,o)=>p({error:l.aborted&&!a.aborted?new n.t({code:`TIMEOUT`,message:`Timed out waiting for the app installation after ${h.TIMEOUT_MILLISECONDS/1e3}s.`}):t,phase:i,completedPhases:r,universalIdentifier:e,jobId:o,signal:a}),g=await d.mutation({__name:`TriggerInstallApplication`,triggerInstallApplication:{__args:{input:{universalIdentifier:e}},jobId:!0}}).then(e=>{let r=e?.triggerInstallApplication;if(!t.u(r)||!(0,m.isNonEmptyString)(r.jobId))throw new n.t({code:`INVALID_RESPONSE`,message:`The server did not return an installation job identifier.`});return r.jobId}).catch(e=>{throw f(e,`start`)});return r.push(`start`),await _({universalIdentifier:e,jobId:g,target:i,signal:u,onProgress:s}).catch(e=>{throw f(e,`wait`,g)}),r.push(`wait`),{application:{universalIdentifier:e,name:(await c.n({universalIdentifier:e,target:i,signal:u}).catch(e=>{throw f(e,`check`,g)})).name},installed:!0,jobId:g}},y=async e=>{let{target:t,signal:n,output:i}=e,a=[],o=await c.t({context:e,onIdentityRead:()=>a.push(`identity`)}).catch(e=>{throw p({error:e,phase:`identity`,completedPhases:a,signal:n})}),l=`Installing the registered app on ${t.apiUrl}…`;i.progress({message:l,percentage:0});let u=await v({universalIdentifier:o,completedPhases:a,target:t,signal:n,onProgress:e=>i.progress({message:l,percentage:e})});return{data:u,human:r.o(`Installed ${s.r(u.application.name)} on ${t.apiUrl}`)}};exports.runAppInstallCommand=y;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-
|
|
2
|
-
`)};c=``,l=[],u=0,(e.event.length>0||e.data.length>0)&&(yield e,t.throwIfAborted())}else{let e=s.indexOf(`:`),t=e===-1?s:s.slice(0,e),n=e===-1?``:s.slice(e+1).replace(/^ /,``);t===`event`?c=n:t===`data`&&l.push(n)}s=``}}f(e.value.length-n),s+=o.decode(e.value.subarray(n),{stream:!0})}t.throwIfAborted()}finally{t.removeEventListener(`abort`,p),await i.cancel().catch(()=>void 0),i.releaseLock()}}var b=async({response:e,target:n,signal:r})=>{if(t.
|
|
1
|
+
const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-D-caeNc5-9rDzSg5B.cjs"),n=require("./application-DOWikeQt.cjs"),r=require("./cli-error-CSsayo0u.cjs"),i=require("./read-command-values-uSJqBG_E.cjs"),a=require("./resolve-request-url-BvOe0vYd.cjs"),o=require("./request-timeout-milliseconds.constant-DtyQHrll.cjs"),s=require("./parse-graphql-response-BcKxw_s9.cjs"),c=require("./create-http-status-error-E0DUDIUP.cjs"),l=require("./style-BR52fK4V.cjs"),u=require("./to-worker-output-diagnostics-BzdY4Z2V.cjs"),d=require("./read-app-identity-dWB3NG6p.cjs"),f=require("./resolve-app-project-B0KRR-xp.cjs"),p=require("./to-cli-error-BBYf_wqo.cjs"),m=require("./format-data-value-kug8Yjt2.cjs"),h=require("./to-public-target-bNT50le0.cjs");let g=require("node:events");var _=e=>{let a=i.r(e,`name`),o=i.r(e,`universalIdentifier`);if(t.Ut(a)&&t.Ut(o)||t.Ut(a)&&a.trim().length===0||t.Ut(o)&&!n.a(o))throw new r.t({code:`INVALID_INPUT`,exitCode:r.n.USAGE,message:`Use either a nonempty --name or a UUID of version 4 or later for --universal-identifier, or neither to watch every function in the app.`});return{...t.Ut(a)?{name:a}:{},...t.Ut(o)?{universalIdentifier:o.toLowerCase()}:{}}},v=e.t();async function*y({body:e,signal:t,frameByteLimit:n=a.l}){let i=e.getReader(),o=new TextDecoder,s=``,c=``,l=[],u=0,d=!1,f=e=>{if(u+=e,u>n)throw new r.t({code:`RESPONSE_LIMIT_EXCEEDED`,message:`A log stream frame exceeds ${n} bytes.`,details:{byteLimit:n}})},p=()=>{i.cancel().catch(()=>void 0)};t.addEventListener(`abort`,p,{once:!0});try{t.throwIfAborted();for(let e=await i.read();!e.done;e=await i.read()){t.throwIfAborted();let n=0;for(let r=0;r<e.value.length;r+=1){let i=e.value[r];if(d&&(d=!1,i===10)){f(1),n=r+1;continue}if(!(i!==10&&i!==13)){if(f(r-n+1),s+=o.decode(e.value.subarray(n,r),{stream:!0}),s+=o.decode(),n=r+1,d=i===13,s.length===0){let e={event:c,data:l.join(`
|
|
2
|
+
`)};c=``,l=[],u=0,(e.event.length>0||e.data.length>0)&&(yield e,t.throwIfAborted())}else{let e=s.indexOf(`:`),t=e===-1?s:s.slice(0,e),n=e===-1?``:s.slice(e+1).replace(/^ /,``);t===`event`?c=n:t===`data`&&l.push(n)}s=``}}f(e.value.length-n),s+=o.decode(e.value.subarray(n),{stream:!0})}t.throwIfAborted()}finally{t.removeEventListener(`abort`,p),await i.cancel().catch(()=>void 0),i.releaseLock()}}var b=async({response:e,target:n,signal:r})=>{if(t.Ut(e.body))for await(let i of y({body:e.body,signal:r})){if(i.event!==`next`)break;let r;try{r=JSON.parse(i.data)}catch{break}if(t.u(r)&&(0,v.isNonEmptyArray)(r.errors))return s.n({errors:r.errors,data:r.data,status:e.status,headers:e.headers,target:n});break}return c.t({status:e.status,headers:e.headers,body:void 0,target:n})},x=e=>new r.t({code:`INVALID_RESPONSE`,message:e}),S=async({target:e,signal:n,query:i,variables:c,onConnected:l,onData:u})=>{let d=a.t({apiUrl:e.apiUrl,path:s.r.metadata}),f=new AbortController,p=AbortSignal.any([n,f.signal]),m=setTimeout(()=>f.abort(new DOMException(`Connection timed out`,`TimeoutError`)),o.t);try{let n=await a.c(d,{method:`POST`,headers:{Authorization:`Bearer ${e.bearerToken}`,"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify({query:i,variables:c}),redirect:`manual`,signal:p},o.t);if(n.status>=300&&n.status<400)throw await n.body?.cancel(),a.i(n,d);if(n.headers.get(`content-type`)?.split(`;`)[0].trim().toLowerCase()!==`text/event-stream`){let t=await a.s(n,a.l);throw await s.t({response:new Response([204,205].includes(n.status)?null:t,{status:n.status,headers:n.headers}),target:e}),x(`The server did not return a GraphQL event stream.`)}if(!n.ok)throw await b({response:n,target:e,signal:p});if(!t.Ut(n.body))throw x(`The server returned an empty log stream.`);clearTimeout(m),await l();for await(let r of y({body:n.body,signal:p})){if(r.event===`complete`)return;if(r.event!==`next`)throw x(`The server returned an unsupported GraphQL stream event.`);let i;try{i=JSON.parse(r.data)}catch{throw x(`The log stream contains invalid JSON.`)}if(!t.u(i))throw x(`The log stream contains an invalid GraphQL result.`);if((0,v.isArray)(i.errors)&&i.errors.length>0)throw s.n({errors:i.errors,data:i.data,status:n.status,headers:n.headers,target:e});if(!(`data`in i))throw x(`The log stream contains no GraphQL data.`);await u(i.data)}throw new r.t({code:`NETWORK_ERROR`,message:`The log stream ended without a completion event.`,hint:`Restart twenty app logs to resume watching. Logs produced while disconnected cannot be replayed.`})}catch(e){throw a.o({error:e,signal:n,url:d,timeoutMilliseconds:o.t})}finally{clearTimeout(m),f.abort()}},C=e=>{if(!(e instanceof r.t)||e.code!==`GRAPHQL_ERROR`)return!1;let n=e.details?.errors;return(0,v.isArray)(n)&&n.length>0&&n.every(e=>t.u(e)&&(!t.Ut(e.code)||e.code===`GRAPHQL_VALIDATION_FAILED`)&&(0,v.isString)(e.message)&&/Cannot query field "(?:name|universalIdentifier)" on type "LogicFunctionLogs"/.test(e.message))},w=async({applicationUniversalIdentifier:e,filter:n,target:i,signal:a,onConnected:o,onIdentityUnavailable:s,onRecord:c})=>{let l=0,u=s=>S({target:i,signal:a,query:`subscription SubscribeToLogs($input: LogicFunctionLogsInput!) {
|
|
3
3
|
logicFunctionLogs(input: $input) {
|
|
4
4
|
logs
|
|
5
5
|
${s?`name universalIdentifier`:``}
|
|
6
6
|
}
|
|
7
|
-
}`,variables:{input:{applicationUniversalIdentifier:e,...n}},onConnected:o,onData:async i=>{let a=t.
|
|
7
|
+
}`,variables:{input:{applicationUniversalIdentifier:e,...n}},onConnected:o,onData:async i=>{let a=t.u(i)?i.logicFunctionLogs:void 0;if(!t.u(a)||!(0,v.isString)(a.logs)||t.Ut(a.name)&&!(0,v.isString)(a.name)||t.Ut(a.universalIdentifier)&&!(0,v.isString)(a.universalIdentifier))throw new r.t({code:`INVALID_RESPONSE`,message:`The server returned an invalid application log record.`});l+=1,await c({applicationUniversalIdentifier:e,functionName:a.name??n.name??null,functionUniversalIdentifier:a.universalIdentifier??n.universalIdentifier??null,logs:a.logs})}});try{await u(!0)}catch(e){if(a.aborted||l>0||!C(e))throw e;await s(),await u(!1)}},T=async e=>{let{options:n,output:a,outputMode:o,signal:s,target:c}=e,v=e=>{o===`human`?a.progress({message:l.s(e.message)}):a.warn(e)},y=_(n),b=await d.t({appPath:(await f.t({explicitPath:i.r(n,`path`),workingDirectory:process.cwd()})).path,signal:s,warn:v});if(!t.Ut(b.application))throw new r.t({code:`INVALID_INPUT`,exitCode:r.n.USAGE,message:`This project has no application definition.`});let x=b.application.universalIdentifier.toLowerCase(),S=0;if(await a.event(`start`,{target:h.t(c),applicationUniversalIdentifier:x,filter:y,diagnostics:b.diagnostics},s),o===`human`){for(let e of b.diagnostics)a.progress({message:u.s(e)});a.progress({message:`Watching ${m.r(b.application.displayName??x)} logs on ${c.apiUrl}. New executions only. Press Ctrl+C to stop.`})}try{await w({applicationUniversalIdentifier:x,filter:y,target:c,signal:s,onConnected:()=>a.event(`progress`,{kind:`connected`},s),onIdentityUnavailable:async()=>v({code:`LOG_IDENTITY_UNAVAILABLE`,message:`This server returns log text without function identities. Mixed logs cannot be attributed to individual functions; use --universal-identifier to isolate one, or upgrade the server.`}),onRecord:async e=>{if(o===`ndjson`)await a.event(`record`,e,s);else{let n=[...t.Ut(e.functionName)?[l.n(`cyan`,m.r(e.functionName))]:[],...t.Ut(e.functionUniversalIdentifier)?[l.i(m.r(e.functionUniversalIdentifier))]:[]].join(` · `),r=[...n.length>0?[`[${n}]`]:[],...e.logs.replace(/\n$/,``).split(`
|
|
8
8
|
`).map(m.r)].join(`
|
|
9
9
|
`);s.throwIfAborted(),process.stdout.write(`${r}\n`)||await(0,g.once)(process.stdout,`drain`,{signal:s}),s.throwIfAborted()}S+=1}})}catch(e){let t=p.t(e,s);throw new r.t({code:t.code,exitCode:t.exitCode,message:t.message,hint:t.code===`NETWORK_ERROR`?`Restart twenty app logs to resume watching. Logs produced while disconnected cannot be replayed.`:t.hint,details:{...t.details,applicationUniversalIdentifier:x,filter:y,recordCount:S}})}return{data:{applicationUniversalIdentifier:x,filter:y,recordCount:S},human:`Log stream completed.`}};exports.runAppLogsCommand=T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./constants-
|
|
1
|
+
const e=require("./constants-D-caeNc5-9rDzSg5B.cjs"),t=require("./resolve-source-sdk-CU1wk4bl.cjs"),n=require("./read-command-values-uSJqBG_E.cjs"),r=require("./to-worker-output-diagnostics-BzdY4Z2V.cjs"),i=require("./resolve-app-project-B0KRR-xp.cjs"),a=require("./create-tooling-failure-B2FmNwR2.cjs"),o=require("./cli-version.constant-DGQXQw_V.cjs");var s={build:`Building`,typecheck:`Typechecking`},c=({release:t,isSnapshotHeld:n})=>n?!e.u(t)||t.success!==!0:e.u(t)&&t.success===!1,l=async({operation:l,parseData:u,context:{options:d,output:f,outputMode:p,signal:m},useHeldBuild:h})=>{let g=await i.t({explicitPath:n.r(d,`path`),workingDirectory:process.cwd()}),_=await t.t({appPath:g.path,warn:f.warn});f.progress({message:`${s[l]} ${g.name} with twenty ${o.t}…`});let v=performance.now(),y=({result:e,output:t})=>{let n=r.o({value:e,parseData:u}),i=[...n.diagnostics,...r.t(t)];if(p===`human`)for(let e of i)f.progress({message:r.s(e)});if(!n.success)throw a.t({error:n.error,diagnostics:i,sdkVersion:_.version});return{data:n.data,diagnostics:i}},b,x=await r.n({request:l===`build`?{type:`bundleSnapshot`,appPath:g.path,holdSnapshot:e.Ut(h)}:{type:`typecheckSource`,appPath:g.path},signal:m,...e.Ut(h)?{useHeldSnapshot:async e=>{b=y(e),await h({project:g,sdk:_,...b})}}:{}});e.Ut(b)||m.throwIfAborted();let{data:S,diagnostics:C}=b??y(x);return c(x)&&f.warn({code:`SNAPSHOT_RELEASE_FAILED`,message:`The temporary build snapshot could not be removed. You can delete .twenty/cli/snapshots once no build is running.`}),{project:g,sdk:_,data:S,diagnostics:C,durationMilliseconds:Math.round(performance.now()-v)}},u=({context:e,useHeldBuild:t})=>l({operation:`build`,parseData:r.i,context:e,useHeldBuild:t}),d=({context:e})=>l({operation:`typecheck`,parseData:r.a,context:e});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./get-app-plan-summary-
|
|
1
|
+
const e=require("./get-app-plan-summary-C-CQdNrh.cjs"),t=require("./run-app-operation-Cw5M8v43.cjs");var n=async n=>{let r=performance.now(),{project:i,sdk:a,data:o,diagnostics:s}=await t.t({context:n}),c=n.options.delete!==!1;n.output.progress({message:`Computing metadata plan (read-only, nothing will be applied)…`});let l=await e.i({build:o,inferDeletionFromMissingEntities:c,target:n.target,signal:n.signal}),u=e.t(l);return{data:{app:{path:i.path,name:i.name},sdk:{version:a.version},application:o.application,contentHash:o.contentHash,plan:!0,inferDeletionFromMissingEntities:c,actions:l,summary:u,diagnostics:s,durationMilliseconds:Math.round(performance.now()-r)},human:e.n({applicationName:o.application.displayName,apiUrl:n.target.apiUrl,actions:l,summary:u,inferDeletionFromMissingEntities:c})}};exports.runAppPlanCommand=n;
|
package/dist/chunks/{run-app-publish-command-eJcYGb8S.cjs → run-app-publish-command-DiIlqdTg.cjs}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-
|
|
1
|
+
const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-D-caeNc5-9rDzSg5B.cjs"),n=require("./cli-error-CSsayo0u.cjs"),r=require("./read-command-values-uSJqBG_E.cjs"),i=require("./create-cancelled-error-DgrNfOv2.cjs"),a=require("./is-interaction-allowed-CF-ko1KI.cjs"),o=require("./style-BR52fK4V.cjs"),s=require("./with-phase-details-Dof8Ao9R.cjs"),c=require("./to-cli-error-BBYf_wqo.cjs"),l=require("./create-metadata-client-9IF8ArjT.cjs"),u=require("./read-snapshot-file-CxPJh0Bk.cjs"),d=require("./run-app-operation-Cw5M8v43.cjs"),f=require("./to-public-target-bNT50le0.cjs"),p=require("./resolve-command-target-BWCnYRCn.cjs");let m=require("node:fs/promises"),h=require("node:path"),g=require("node:fs");var _=e.t(),v=async({packedApp:e,context:{target:r,signal:i,output:a}})=>{let o=`prepare-upload`,d=[],p;try{i.throwIfAborted();let{size:s}=await(0,m.stat)(e.path),c=l.t({target:r,signal:i}),v=(await c.mutation({__name:`CreateAppTarballUpload`,createFileUpload:{__args:{filename:(0,h.basename)(e.path),size:s,fileFolder:`AppTarball`},fileId:!0,uploadUrl:!0,contentType:!0}})).createFileUpload;if(!t.u(v)||!(0,_.isNonEmptyString)(v.fileId)||!(0,_.isNonEmptyString)(v.uploadUrl)||!(0,_.isNonEmptyString)(v.contentType))throw new n.t({code:`INVALID_RESPONSE`,message:`The server returned an invalid tarball upload target.`});p=v.fileId,d.push(o),o=`upload`,a.progress({message:`Uploading ${e.name}@${e.version} to ${r.apiUrl}…`});let y=await u.r({uploadUrl:v.uploadUrl,contentType:v.contentType,bytes:await(0,g.openAsBlob)(e.path),signal:i});if(y<200||y>=300)throw new n.t({code:`UPLOAD_FAILED`,message:`File storage answered ${y}.`});d.push(o),i.throwIfAborted(),a.progress({message:`Registering the uploaded app…`}),o=`register`;let b=(await c.mutation({__name:`CompleteAppTarballUpload`,completeAppTarballUpload:{__args:{fileId:p},id:!0,name:!0,universalIdentifier:!0}})).completeAppTarballUpload;if(!t.u(b)||!(0,_.isNonEmptyString)(b.id)||!(0,_.isNonEmptyString)(b.name)||!(0,_.isNonEmptyString)(b.universalIdentifier))throw new n.t({code:`INVALID_RESPONSE`,message:`The server did not return the published app registration.`});return d.push(o),{target:`private`,registry:f.t(r),name:e.name,version:e.version,registration:b,fileId:p,installed:!1}}catch(e){let a=s.t({error:c.t(e,i),phase:o,completedPhases:d,outcome:o===`register`?`unknown`:`not-published`,hint:o===`register`?`The app may already be registered. Check the server registry before retrying; publishing does not install the app.`:`Fix the problem, then run twenty app publish --private again to create a fresh upload.`});throw new n.t({cause:a,code:a.code,exitCode:a.exitCode,message:a.message,hint:a.hint,details:{...a.details,...t.Ut(p)?{fileId:p}:{},registry:f.t(r)}})}},y=e.n(((e,t)=>{t.exports=a,a.sync=o;var n=require("fs");function r(e,t){var n=t.pathExt===void 0?process.env.PATHEXT:t.pathExt;if(!n||(n=n.split(`;`),n.indexOf(``)!==-1))return!0;for(var r=0;r<n.length;r++){var i=n[r].toLowerCase();if(i&&e.substr(-i.length).toLowerCase()===i)return!0}return!1}function i(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:r(t,n)}function a(e,t,r){n.stat(e,function(n,a){r(n,n?!1:i(a,e,t))})}function o(e,t){return i(n.statSync(e),e,t)}})),b=e.n(((e,t)=>{t.exports=r,r.sync=i;var n=require("fs");function r(e,t,r){n.stat(e,function(e,n){r(e,e?!1:a(n,t))})}function i(e,t){return a(n.statSync(e),t)}function a(e,t){return e.isFile()&&o(e,t)}function o(e,t){var n=e.mode,r=e.uid,i=e.gid,a=t.uid===void 0?process.getuid&&process.getuid():t.uid,o=t.gid===void 0?process.getgid&&process.getgid():t.gid,s=64,c=8,l=1,u=s|c;return n&l||n&c&&i===o||n&s&&r===a||n&u&&a===0}})),x=e.n(((e,t)=>{require("fs");var n=process.platform===`win32`||global.TESTING_WINDOWS?y():b();t.exports=r,r.sync=i;function r(e,t,i){if(typeof t==`function`&&(i=t,t={}),!i){if(typeof Promise!=`function`)throw TypeError(`callback not provided`);return new Promise(function(n,i){r(e,t||{},function(e,t){e?i(e):n(t)})})}n(e,t||{},function(e,n){e&&(e.code===`EACCES`||t&&t.ignoreErrors)&&(e=null,n=!1),i(e,n)})}function i(e,t){try{return n.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||e.code===`EACCES`)return!1;throw e}}})),S=e.n(((e,t)=>{var n=process.platform===`win32`||process.env.OSTYPE===`cygwin`||process.env.OSTYPE===`msys`,r=require("path"),i=n?`;`:`:`,a=x(),o=e=>Object.assign(Error(`not found: ${e}`),{code:`ENOENT`}),s=(e,t)=>{let r=t.colon||i,a=e.match(/\//)||n&&e.match(/\\/)?[``]:[...n?[process.cwd()]:[],...(t.path||process.env.PATH||``).split(r)],o=n?t.pathExt||process.env.PATHEXT||`.EXE;.CMD;.BAT;.COM`:``,s=n?o.split(r):[``];return n&&e.indexOf(`.`)!==-1&&s[0]!==``&&s.unshift(``),{pathEnv:a,pathExt:s,pathExtExe:o}},c=(e,t,n)=>{typeof t==`function`&&(n=t,t={}),t||={};let{pathEnv:i,pathExt:c,pathExtExe:l}=s(e,t),u=[],d=n=>new Promise((a,s)=>{if(n===i.length)return t.all&&u.length?a(u):s(o(e));let c=i[n],l=/^".*"$/.test(c)?c.slice(1,-1):c,d=r.join(l,e);a(f(!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d,n,0))}),f=(e,n,r)=>new Promise((i,o)=>{if(r===c.length)return i(d(n+1));let s=c[r];a(e+s,{pathExt:l},(a,o)=>{if(!a&&o)if(t.all)u.push(e+s);else return i(e+s);return i(f(e,n,r+1))})});return n?d(0).then(e=>n(null,e),n):d(0)};t.exports=c,c.sync=(e,t)=>{t||={};let{pathEnv:n,pathExt:i,pathExtExe:c}=s(e,t),l=[];for(let o=0;o<n.length;o++){let s=n[o],u=/^".*"$/.test(s)?s.slice(1,-1):s,d=r.join(u,e),f=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let e=0;e<i.length;e++){let n=f+i[e];try{if(a.sync(n,{pathExt:c}))if(t.all)l.push(n);else return n}catch{}}}if(t.all&&l.length)return l;if(t.nothrow)return null;throw o(e)}})),C=e.n(((e,t)=>{var n=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)===`win32`?Object.keys(t).reverse().find(e=>e.toUpperCase()===`PATH`)||`Path`:`PATH`};t.exports=n,t.exports.default=n})),w=e.n(((e,t)=>{var n=require("path"),r=S(),i=C();function a(e,t){let a=e.options.env||process.env,o=process.cwd(),s=e.options.cwd!=null,c=s&&process.chdir!==void 0&&!process.chdir.disabled;if(c)try{process.chdir(e.options.cwd)}catch{}let l;try{l=r.sync(e.command,{path:a[i({env:a})],pathExt:t?n.delimiter:void 0})}catch{}finally{c&&process.chdir(o)}return l&&=n.resolve(s?e.options.cwd:``,l),l}function o(e){return a(e)||a(e,!0)}t.exports=o})),T=e.n(((e,t)=>{var n=/([()\][%!^"`<>&|;, *?])/g;function r(e){return e=e.replace(n,`^$1`),e}function i(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,`$1$1\\"`),e=e.replace(/(?=(\\+?)?)\1$/,`$1$1`),e=`"${e}"`,e=e.replace(n,`^$1`),t&&(e=e.replace(n,`^$1`)),e}t.exports.command=r,t.exports.argument=i})),E=e.n(((e,t)=>{t.exports=/^#!(.*)/})),D=e.n(((e,t)=>{var n=E();t.exports=(e=``)=>{let t=e.match(n);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,``).split(` `),a=r.split(`/`).pop();return a===`env`?i:i?`${a} ${i}`:a}})),O=e.n(((e,t)=>{var n=require("fs"),r=D();function i(e){let t=Buffer.alloc(150),i;try{i=n.openSync(e,`r`),n.readSync(i,t,0,150,0),n.closeSync(i)}catch{}return r(t.toString())}t.exports=i})),k=e.n(((e,t)=>{var n=require("path"),r=w(),i=T(),a=O(),o=process.platform===`win32`,s=/\.(?:com|exe)$/i,c=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function l(e){e.file=r(e);let t=e.file&&a(e.file);return t?(e.args.unshift(e.file),e.command=t,r(e)):e.file}function u(e){if(!o)return e;let t=l(e),r=!s.test(t);if(e.options.forceShell||r){let r=c.test(t);e.command=n.normalize(e.command),e.command=i.command(e.command),e.args=e.args.map(e=>i.argument(e,r)),e.args=[`/d`,`/s`,`/c`,`"${[e.command].concat(e.args).join(` `)}"`],e.command=process.env.comspec||`cmd.exe`,e.options.windowsVerbatimArguments=!0}return e}function d(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:u(r)}t.exports=d})),A=e.n(((e,t)=>{var n=process.platform===`win32`;function r(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:`ENOENT`,errno:`ENOENT`,syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function i(e,t){if(!n)return;let r=e.emit;e.emit=function(n,i){if(n===`exit`){let n=a(i,t);if(n)return r.call(e,`error`,n)}return r.apply(e,arguments)}}function a(e,t){return n&&e===1&&!t.file?r(t.original,`spawn`):null}function o(e,t){return n&&e===1&&!t.file?r(t.original,`spawnSync`):null}t.exports={hookChildProcess:i,verifyENOENT:a,verifyENOENTSync:o,notFoundError:r}})),j=e.n(((e,t)=>{var n=require("child_process"),r=k(),i=A();function a(e,t,a){let o=r(e,t,a),s=n.spawn(o.command,o.args,o.options);return i.hookChildProcess(s,o),s}function o(e,t,a){let o=r(e,t,a),s=n.spawnSync(o.command,o.args,o.options);return s.error=s.error||i.verifyENOENTSync(s.status,o),s}t.exports=a,t.exports.spawn=a,t.exports.sync=o,t.exports._parse=r,t.exports._enoent=i})),M=e.n(((e,t)=>{t.exports=e=>{let t=typeof e==`string`?`
|
|
2
2
|
`:10,n=typeof e==`string`?`\r`:13;return e[e.length-1]===t&&(e=e.slice(0,e.length-1)),e[e.length-1]===n&&(e=e.slice(0,e.length-1)),e}})),N=e.n(((e,t)=>{var n=require("path"),r=C(),i=e=>{e={cwd:process.cwd(),path:process.env[r()],execPath:process.execPath,...e};let t,i=n.resolve(e.cwd),a=[];for(;t!==i;)a.push(n.join(i,`node_modules/.bin`)),t=i,i=n.resolve(i,`..`);let o=n.resolve(e.cwd,e.execPath,`..`);return a.push(o),a.concat(e.path).join(n.delimiter)};t.exports=i,t.exports.default=i,t.exports.env=e=>{e={env:process.env,...e};let n={...e.env},i=r({env:n});return e.path=n[i],n[i]=t.exports(e),n}})),P=e.n(((e,t)=>{var n=(e,t)=>{for(let n of Reflect.ownKeys(t))Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n));return e};t.exports=n,t.exports.default=n})),F=e.n(((e,t)=>{var n=P(),r=new WeakMap,i=(e,t={})=>{if(typeof e!=`function`)throw TypeError(`Expected a function`);let i,a=0,o=e.displayName||e.name||`<anonymous>`,s=function(...n){if(r.set(s,++a),a===1)i=e.apply(this,n),e=null;else if(t.throw===!0)throw Error(`Function \`${o}\` can only be called once`);return i};return n(s,e),r.set(s,a),s};t.exports=i,t.exports.default=i,t.exports.callCount=e=>{if(!r.has(e))throw Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return r.get(e)}})),I=e.n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SIGNALS=void 0,e.SIGNALS=[{name:`SIGHUP`,number:1,action:`terminate`,description:`Terminal closed`,standard:`posix`},{name:`SIGINT`,number:2,action:`terminate`,description:`User interruption with CTRL-C`,standard:`ansi`},{name:`SIGQUIT`,number:3,action:`core`,description:`User interruption with CTRL-\\`,standard:`posix`},{name:`SIGILL`,number:4,action:`core`,description:`Invalid machine instruction`,standard:`ansi`},{name:`SIGTRAP`,number:5,action:`core`,description:`Debugger breakpoint`,standard:`posix`},{name:`SIGABRT`,number:6,action:`core`,description:`Aborted`,standard:`ansi`},{name:`SIGIOT`,number:6,action:`core`,description:`Aborted`,standard:`bsd`},{name:`SIGBUS`,number:7,action:`core`,description:`Bus error due to misaligned, non-existing address or paging error`,standard:`bsd`},{name:`SIGEMT`,number:7,action:`terminate`,description:`Command should be emulated but is not implemented`,standard:`other`},{name:`SIGFPE`,number:8,action:`core`,description:`Floating point arithmetic error`,standard:`ansi`},{name:`SIGKILL`,number:9,action:`terminate`,description:`Forced termination`,standard:`posix`,forced:!0},{name:`SIGUSR1`,number:10,action:`terminate`,description:`Application-specific signal`,standard:`posix`},{name:`SIGSEGV`,number:11,action:`core`,description:`Segmentation fault`,standard:`ansi`},{name:`SIGUSR2`,number:12,action:`terminate`,description:`Application-specific signal`,standard:`posix`},{name:`SIGPIPE`,number:13,action:`terminate`,description:`Broken pipe or socket`,standard:`posix`},{name:`SIGALRM`,number:14,action:`terminate`,description:`Timeout or timer`,standard:`posix`},{name:`SIGTERM`,number:15,action:`terminate`,description:`Termination`,standard:`ansi`},{name:`SIGSTKFLT`,number:16,action:`terminate`,description:`Stack is empty or overflowed`,standard:`other`},{name:`SIGCHLD`,number:17,action:`ignore`,description:`Child process terminated, paused or unpaused`,standard:`posix`},{name:`SIGCLD`,number:17,action:`ignore`,description:`Child process terminated, paused or unpaused`,standard:`other`},{name:`SIGCONT`,number:18,action:`unpause`,description:`Unpaused`,standard:`posix`,forced:!0},{name:`SIGSTOP`,number:19,action:`pause`,description:`Paused`,standard:`posix`,forced:!0},{name:`SIGTSTP`,number:20,action:`pause`,description:`Paused using CTRL-Z or "suspend"`,standard:`posix`},{name:`SIGTTIN`,number:21,action:`pause`,description:`Background process cannot read terminal input`,standard:`posix`},{name:`SIGBREAK`,number:21,action:`terminate`,description:`User interruption with CTRL-BREAK`,standard:`other`},{name:`SIGTTOU`,number:22,action:`pause`,description:`Background process cannot write to terminal output`,standard:`posix`},{name:`SIGURG`,number:23,action:`ignore`,description:`Socket received out-of-band data`,standard:`bsd`},{name:`SIGXCPU`,number:24,action:`core`,description:`Process timed out`,standard:`bsd`},{name:`SIGXFSZ`,number:25,action:`core`,description:`File too big`,standard:`bsd`},{name:`SIGVTALRM`,number:26,action:`terminate`,description:`Timeout or timer`,standard:`bsd`},{name:`SIGPROF`,number:27,action:`terminate`,description:`Timeout or timer`,standard:`bsd`},{name:`SIGWINCH`,number:28,action:`ignore`,description:`Terminal window size changed`,standard:`bsd`},{name:`SIGIO`,number:29,action:`terminate`,description:`I/O is available`,standard:`other`},{name:`SIGPOLL`,number:29,action:`terminate`,description:`Watched event`,standard:`other`},{name:`SIGINFO`,number:29,action:`ignore`,description:`Request for process information`,standard:`other`},{name:`SIGPWR`,number:30,action:`terminate`,description:`Device running out of power`,standard:`systemv`},{name:`SIGSYS`,number:31,action:`core`,description:`Invalid system call`,standard:`other`},{name:`SIGUNUSED`,number:31,action:`terminate`,description:`Invalid system call`,standard:`other`}]})),L=e.n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SIGRTMAX=e.getRealtimeSignals=void 0,e.getRealtimeSignals=function(){let e=r-n+1;return Array.from({length:e},t)};var t=function(e,t){return{name:`SIGRT${t+1}`,number:n+t,action:`terminate`,description:`Application-specific signal (realtime)`,standard:`posix`}},n=34,r=64;e.SIGRTMAX=r})),R=e.n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSignals=void 0;var t=require("os"),n=I(),r=L();e.getSignals=function(){let e=(0,r.getRealtimeSignals)();return[...n.SIGNALS,...e].map(i)};var i=function({name:e,number:n,description:r,action:i,forced:a=!1,standard:o}){let{signals:{[e]:s}}=t.constants,c=s!==void 0;return{name:e,number:c?s:n,description:r,supported:c,action:i,forced:a,standard:o}}})),z=e.n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.signalsByNumber=e.signalsByName=void 0;var t=require("os"),n=R(),r=L(),i=function(){return(0,n.getSignals)().reduce(a,{})},a=function(e,{name:t,number:n,description:r,supported:i,action:a,forced:o,standard:s}){return{...e,[t]:{name:t,number:n,description:r,supported:i,action:a,forced:o,standard:s}}};e.signalsByName=i();var o=function(){let e=(0,n.getSignals)(),t=r.SIGRTMAX+1,i=Array.from({length:t},(t,n)=>s(n,e));return Object.assign({},...i)},s=function(e,t){let n=c(e,t);if(n===void 0)return{};let{name:r,description:i,supported:a,action:o,forced:s,standard:l}=n;return{[e]:{name:r,number:e,description:i,supported:a,action:o,forced:s,standard:l}}},c=function(e,n){let r=n.find(({name:n})=>t.constants.signals[n]===e);return r===void 0?n.find(t=>t.number===e):r};e.signalsByNumber=o()})),B=e.n(((e,t)=>{var{signalsByName:n}=z(),r=({timedOut:e,timeout:t,errorCode:n,signal:r,signalDescription:i,exitCode:a,isCanceled:o})=>e?`timed out after ${t} milliseconds`:o?`was canceled`:n===void 0?r===void 0?a===void 0?`failed`:`failed with exit code ${a}`:`was killed with ${r} (${i})`:`failed with ${n}`;t.exports=({stdout:e,stderr:t,all:i,error:a,signal:o,exitCode:s,command:c,escapedCommand:l,timedOut:u,isCanceled:d,killed:f,parsed:{options:{timeout:p}}})=>{s=s===null?void 0:s,o=o===null?void 0:o;let m=o===void 0?void 0:n[o].description,h=`Command ${r({timedOut:u,timeout:p,errorCode:a&&a.code,signal:o,signalDescription:m,exitCode:s,isCanceled:d})}: ${c}`,g=Object.prototype.toString.call(a)===`[object Error]`,_=g?`${h}\n${a.message}`:h,v=[_,t,e].filter(Boolean).join(`
|
|
3
|
-
`);return g?(a.originalMessage=a.message,a.message=v):a=Error(v),a.shortMessage=_,a.command=c,a.escapedCommand=l,a.exitCode=s,a.signal=o,a.signalDescription=m,a.stdout=e,a.stderr=t,i!==void 0&&(a.all=i),`bufferedData`in a&&delete a.bufferedData,a.failed=!0,a.timedOut=!!u,a.isCanceled=d,a.killed=f&&!u,a}})),V=e.n(((e,t)=>{var n=[`stdin`,`stdout`,`stderr`],r=e=>n.some(t=>e[t]!==void 0),i=e=>{if(!e)return;let{stdio:t}=e;if(t===void 0)return n.map(t=>e[t]);if(r(e))throw Error(`It's not possible to provide \`stdio\` in combination with one of ${n.map(e=>`\`${e}\``).join(`, `)}`);if(typeof t==`string`)return t;if(!Array.isArray(t))throw TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let i=Math.max(t.length,n.length);return Array.from({length:i},(e,n)=>t[n])};t.exports=i,t.exports.node=e=>{let t=i(e);return t===`ipc`?`ipc`:t===void 0||typeof t==`string`?[t,t,t,`ipc`]:t.includes(`ipc`)?t:[...t,`ipc`]}})),H=e.n(((e,t)=>{t.exports=[`SIGABRT`,`SIGALRM`,`SIGHUP`,`SIGINT`,`SIGTERM`],process.platform!==`win32`&&t.exports.push(`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&t.exports.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`,`SIGUNUSED`)})),U=e.n(((e,t)=>{var n=global.process,r=function(e){return e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`};if(!r(n))t.exports=function(){return function(){}};else{var i=require("assert"),a=H(),o=/^win/i.test(n.platform),s=require("events");typeof s!=`function`&&(s=s.EventEmitter);var c;n.__signal_exit_emitter__?c=n.__signal_exit_emitter__:(c=n.__signal_exit_emitter__=new s,c.count=0,c.emitted={}),c.infinite||(c.setMaxListeners(1/0),c.infinite=!0),t.exports=function(e,t){if(!r(global.process))return function(){};i.equal(typeof e,`function`,`a callback must be provided for exit handler`),f===!1&&p();var n=`exit`;return t&&t.alwaysLast&&(n=`afterexit`),c.on(n,e),function(){c.removeListener(n,e),c.listeners(`exit`).length===0&&c.listeners(`afterexit`).length===0&&l()}};var l=function(){!f||!r(global.process)||(f=!1,a.forEach(function(e){try{n.removeListener(e,d[e])}catch{}}),n.emit=g,n.reallyExit=m,--c.count)};t.exports.unload=l;var u=function(e,t,n){c.emitted[e]||(c.emitted[e]=!0,c.emit(e,t,n))},d={};a.forEach(function(e){d[e]=function(){r(global.process)&&n.listeners(e).length===c.count&&(l(),u(`exit`,null,e),u(`afterexit`,null,e),o&&e===`SIGHUP`&&(e=`SIGINT`),n.kill(n.pid,e))}}),t.exports.signals=function(){return a};var f=!1,p=function(){f||!r(global.process)||(f=!0,c.count+=1,a=a.filter(function(e){try{return n.on(e,d[e]),!0}catch{return!1}}),n.emit=_,n.reallyExit=h)};t.exports.load=p;var m=n.reallyExit,h=function(e){r(global.process)&&(n.exitCode=e||0,u(`exit`,n.exitCode,null),u(`afterexit`,n.exitCode,null),m.call(n,n.exitCode))},g=n.emit,_=function(e,t){if(e===`exit`&&r(global.process)){t!==void 0&&(n.exitCode=t);var i=g.apply(this,arguments);return u(`exit`,n.exitCode,null),u(`afterexit`,n.exitCode,null),i}else return g.apply(this,arguments)}}})),W=e.n(((e,t)=>{var n=require("os"),r=U(),i=1e3*5,a=(e,t=`SIGTERM`,n={})=>{let r=e(t);return o(e,t,n,r),r},o=(e,t,n,r)=>{if(!s(t,n,r))return;let i=l(n),a=setTimeout(()=>{e(`SIGKILL`)},i);a.unref&&a.unref()},s=(e,{forceKillAfterTimeout:t},n)=>c(e)&&t!==!1&&n,c=e=>e===n.constants.signals.SIGTERM||typeof e==`string`&&e.toUpperCase()===`SIGTERM`,l=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return i;if(!Number.isFinite(e)||e<0)throw TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},u=(e,t)=>{e.kill()&&(t.isCanceled=!0)},d=(e,t,n)=>{e.kill(t),n(Object.assign(Error(`Timed out`),{timedOut:!0,signal:t}))};t.exports={spawnedKill:a,spawnedCancel:u,setupTimeout:(e,{timeout:t,killSignal:n=`SIGTERM`},r)=>{if(t===0||t===void 0)return r;let i,a=new Promise((r,a)=>{i=setTimeout(()=>{d(e,n,a)},t)}),o=r.finally(()=>{clearTimeout(i)});return Promise.race([a,o])},validateTimeout:({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},setExitHandler:async(e,{cleanup:t,detached:n},i)=>{if(!t||n)return i;let a=r(()=>{e.kill()});return i.finally(()=>{a()})}}})),G=e.n(((e,t)=>{var n=e=>typeof e==`object`&&!!e&&typeof e.pipe==`function`;n.writable=e=>n(e)&&e.writable!==!1&&typeof e._write==`function`&&typeof e._writableState==`object`,n.readable=e=>n(e)&&e.readable!==!1&&typeof e._read==`function`&&typeof e._readableState==`object`,n.duplex=e=>n.writable(e)&&n.readable(e),n.transform=e=>n.duplex(e)&&typeof e._transform==`function`,t.exports=n})),K=e.n(((e,t)=>{var{PassThrough:n}=require("stream");t.exports=e=>{e={...e};let{array:t}=e,{encoding:r}=e,i=r===`buffer`,a=!1;t?a=!(r||i):r||=`utf8`,i&&(r=null);let o=new n({objectMode:a});r&&o.setEncoding(r);let s=0,c=[];return o.on(`data`,e=>{c.push(e),a?s=c.length:s+=e.length}),o.getBufferedValue=()=>t?c:i?Buffer.concat(c,s):c.join(``),o.getBufferedLength=()=>s,o}})),q=e.n(((e,t)=>{var{constants:n}=require("buffer"),r=require("stream"),{promisify:i}=require("util"),a=K(),o=i(r.pipeline),s=class extends Error{constructor(){super(`maxBuffer exceeded`),this.name=`MaxBufferError`}};async function c(e,t){if(!e)throw Error(`Expected a stream`);t={maxBuffer:1/0,...t};let{maxBuffer:r}=t,i=a(t);return await new Promise((t,a)=>{let c=e=>{e&&i.getBufferedLength()<=n.MAX_LENGTH&&(e.bufferedData=i.getBufferedValue()),a(e)};(async()=>{try{await o(e,i),t()}catch(e){c(e)}})(),i.on(`data`,()=>{i.getBufferedLength()>r&&c(new s)})}),i.getBufferedValue()}t.exports=c,t.exports.buffer=(e,t)=>c(e,{...t,encoding:`buffer`}),t.exports.array=(e,t)=>c(e,{...t,array:!0}),t.exports.MaxBufferError=s})),J=e.n(((e,t)=>{var{PassThrough:n}=require("stream");t.exports=function(){var e=[],t=new n({objectMode:!0});return t.setMaxListeners(0),t.add=r,t.isEmpty=i,t.on(`unpipe`,a),Array.prototype.slice.call(arguments).forEach(r),t;function r(n){return Array.isArray(n)?(n.forEach(r),this):(e.push(n),n.once(`end`,a.bind(null,n)),n.once(`error`,t.emit.bind(t,`error`)),n.pipe(t,{end:!1}),this)}function i(){return e.length==0}function a(n){e=e.filter(function(e){return e!==n}),!e.length&&t.readable&&t.end()}}})),Y=e.n(((e,t)=>{var n=G(),r=q(),i=J(),a=(e,t)=>{t===void 0||e.stdin===void 0||(n(t)?t.pipe(e.stdin):e.stdin.end(t))},o=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;let n=i();return e.stdout&&n.add(e.stdout),e.stderr&&n.add(e.stderr),n},s=async(e,t)=>{if(e){e.destroy();try{return await t}catch(e){return e.bufferedData}}},c=(e,{encoding:t,buffer:n,maxBuffer:i})=>{if(!(!e||!n))return t?r(e,{encoding:t,maxBuffer:i}):r.buffer(e,{maxBuffer:i})};t.exports={handleInput:a,makeAllStream:o,getSpawnedResult:async({stdout:e,stderr:t,all:n},{encoding:r,buffer:i,maxBuffer:a},o)=>{let l=c(e,{encoding:r,buffer:i,maxBuffer:a}),u=c(t,{encoding:r,buffer:i,maxBuffer:a}),d=c(n,{encoding:r,buffer:i,maxBuffer:a*2});try{return await Promise.all([o,l,u,d])}catch(r){return Promise.all([{error:r,signal:r.signal,timedOut:r.timedOut},s(e,l),s(t,u),s(n,d)])}},validateInputSync:({input:e})=>{if(n(e))throw TypeError("The `input` option cannot be a stream in sync mode")}}})),X=e.n(((e,t)=>{var n=(async()=>{})().constructor.prototype,r=[`then`,`catch`,`finally`].map(e=>[e,Reflect.getOwnPropertyDescriptor(n,e)]);t.exports={mergePromise:(e,t)=>{for(let[n,i]of r){let r=typeof t==`function`?(...e)=>Reflect.apply(i.value,t(),e):i.value.bind(t);Reflect.defineProperty(e,n,{...i,value:r})}return e},getSpawnedPromise:e=>new Promise((t,n)=>{e.on(`exit`,(e,n)=>{t({exitCode:e,signal:n})}),e.on(`error`,e=>{n(e)}),e.stdin&&e.stdin.on(`error`,e=>{n(e)})})}})),Z=e.n(((e,t)=>{var n=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],r=/^[\w.-]+$/,i=/"/g,a=e=>typeof e!=`string`||r.test(e)?e:`"${e.replace(i,`\\"`)}"`,o=(e,t)=>n(e,t).join(` `),s=(e,t)=>n(e,t).map(e=>a(e)).join(` `),c=/ +/g;t.exports={joinCommand:o,getEscapedCommand:s,parseCommand:e=>{let t=[];for(let n of e.trim().split(c)){let e=t[t.length-1];e&&e.endsWith(`\\`)?t[t.length-1]=`${e.slice(0,-1)} ${n}`:t.push(n)}return t}}})),Q=e.n(((e,t)=>{var n=require("path"),r=require("child_process"),i=j(),a=M(),o=N(),s=F(),c=B(),l=V(),{spawnedKill:u,spawnedCancel:d,setupTimeout:f,validateTimeout:p,setExitHandler:m}=W(),{handleInput:h,getSpawnedResult:g,makeAllStream:_,validateInputSync:v}=Y(),{mergePromise:y,getSpawnedPromise:b}=X(),{joinCommand:x,parseCommand:S,getEscapedCommand:C}=Z(),w=1e3*1e3*100,T=({env:e,extendEnv:t,preferLocal:n,localDir:r,execPath:i})=>{let a=t?{...process.env,...e}:e;return n?o.env({env:a,cwd:r,execPath:i}):a},E=(e,t,r={})=>{let a=i._parse(e,t,r);return e=a.command,t=a.args,r=a.options,r={maxBuffer:w,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:r.cwd||process.cwd(),execPath:process.execPath,encoding:`utf8`,reject:!0,cleanup:!0,all:!1,windowsHide:!0,...r},r.env=T(r),r.stdio=l(r),process.platform===`win32`&&n.basename(e,`.exe`)===`cmd`&&t.unshift(`/q`),{file:e,args:t,options:r,parsed:a}},D=(e,t,n)=>typeof t!=`string`&&!Buffer.isBuffer(t)?n===void 0?void 0:``:e.stripFinalNewline?a(t):t,O=(e,t,n)=>{let i=E(e,t,n),a=x(e,t),o=C(e,t);p(i.options);let l;try{l=r.spawn(i.file,i.args,i.options)}catch(e){return y(new r.ChildProcess,Promise.reject(c({error:e,stdout:``,stderr:``,all:``,command:a,escapedCommand:o,parsed:i,timedOut:!1,isCanceled:!1,killed:!1})))}let v=b(l),S=f(l,i.options,v),w=m(l,i.options,S),T={isCanceled:!1};l.kill=u.bind(null,l.kill.bind(l)),l.cancel=d.bind(null,l,T);let O=s(async()=>{let[{error:e,exitCode:t,signal:n,timedOut:r},s,u,d]=await g(l,i.options,w),f=D(i.options,s),p=D(i.options,u),m=D(i.options,d);if(e||t!==0||n!==null){let s=c({error:e,exitCode:t,signal:n,stdout:f,stderr:p,all:m,command:a,escapedCommand:o,parsed:i,timedOut:r,isCanceled:T.isCanceled,killed:l.killed});if(!i.options.reject)return s;throw s}return{command:a,escapedCommand:o,exitCode:0,stdout:f,stderr:p,all:m,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return h(l,i.options.input),l.all=_(l,i.options),y(l,O)};t.exports=O,t.exports.sync=(e,t,n)=>{let i=E(e,t,n),a=x(e,t),o=C(e,t);v(i.options);let s;try{s=r.spawnSync(i.file,i.args,i.options)}catch(e){throw c({error:e,stdout:``,stderr:``,all:``,command:a,escapedCommand:o,parsed:i,timedOut:!1,isCanceled:!1,killed:!1})}let l=D(i.options,s.stdout,s.error),u=D(i.options,s.stderr,s.error);if(s.error||s.status!==0||s.signal!==null){let e=c({stdout:l,stderr:u,error:s.error,signal:s.signal,exitCode:s.status,command:a,escapedCommand:o,parsed:i,timedOut:s.error&&s.error.code===`ETIMEDOUT`,isCanceled:!1,killed:s.signal!==null});if(!i.options.reject)return e;throw e}return{command:a,escapedCommand:o,exitCode:0,stdout:l,stderr:u,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}},t.exports.command=(e,t)=>{let[n,...r]=S(e);return O(n,r,t)},t.exports.commandSync=(e,t)=>{let[n,...r]=S(e);return O.sync(n,r,t)},t.exports.node=(e,t,n={})=>{t&&!Array.isArray(t)&&typeof t==`object`&&(n=t,t=[]);let r=l.node(n),i=process.execArgv.filter(e=>!e.startsWith(`--inspect`)),{nodePath:a=process.execPath,nodeOptions:o=i}=n;return O(a,[...o,e,...Array.isArray(t)?t:[]],{...n,stdin:void 0,stdout:void 0,stderr:void 0,stdio:r,shell:!1})}})),ee=e.i(Q()),$=async({args:e,appPath:r,signal:a,canInteract:o=!1,onOutput:s})=>{a.throwIfAborted();let c=(0,ee.default)(`npm`,e,{cwd:r,stdio:o?`inherit`:[`ignore`,`pipe`,`pipe`],reject:!1,maxBuffer:4*1024*1024}),l=()=>c.kill(`SIGTERM`,{forceKillAfterTimeout:1e3});a.addEventListener(`abort`,l,{once:!0}),a.aborted&&l();try{let r=await c;if(a.aborted)throw i.t();if(!o&&t.Vt(s)&&((0,_.isNonEmptyString)(r.stdout)&&s(r.stdout),(0,_.isNonEmptyString)(r.stderr)&&s(r.stderr)),r.failed)throw new n.t({code:`PUBLISH_FAILED`,message:`npm ${e[0]} failed.`,hint:`Check that npm is installed and your npm registry credentials and package version are valid.`,details:{exitCode:r.exitCode,stdout:r.stdout?.slice(-16384)??``,stderr:r.stderr?.slice(-16384)??``}});return r.stdout??``}finally{a.removeEventListener(`abort`,l)}},te=async({packedApp:e,appPath:n,tag:r,context:i})=>{let o=t.Vt(process.env.ACTIONS_ID_TOKEN_REQUEST_URL)&&process.env.TWENTY_APP_PUBLISH_DISABLE_PROVENANCE!==`true`;return i.output.progress({message:`Publishing ${e.name}@${e.version} to npm…`}),await $({args:[`publish`,e.path,`--access`,`public`,`--ignore-scripts`,`--workspaces=false`,...o?[`--provenance`]:[],...t.Vt(r)?[`--tag`,r]:[]],appPath:n,signal:i.signal,canInteract:a.t(i),...i.outputMode===`human`?{onOutput:e=>i.output.progress({message:e})}:{}}),{target:`npm`,name:e.name,version:e.version,...t.Vt(r)?{tag:r}:{}}},ne=e=>{let r;try{r=JSON.parse(e)}catch(e){throw new n.t({code:`PUBLISH_FAILED`,message:`npm pack returned invalid JSON.`,cause:e})}let i=(0,_.isArray)(r)&&r.length===1?r[0]:void 0;if(!t.p(i)||!(0,_.isNonEmptyString)(i.name)||!(0,_.isNonEmptyString)(i.version)||!(0,_.isNonEmptyString)(i.filename)||(0,h.basename)(i.filename)!==i.filename||i.filename.includes(`\\`)||!i.filename.endsWith(`.tgz`)||!(0,_.isArray)(i.files))throw new n.t({code:`PUBLISH_FAILED`,message:`npm pack returned an invalid package description.`});let a=i.files.map(e=>{if(!t.p(e)||!(0,_.isNonEmptyString)(e.path))throw new n.t({code:`PUBLISH_FAILED`,message:`npm pack returned an invalid package file.`});return{path:e.path}});return{name:i.name,version:i.version,filename:i.filename,files:a}},re=async({appPath:e,build:t,signal:r,output:i,usePackage:a})=>{let o=u.a({build:t,appPath:e});for(let e of t.files)r.throwIfAborted(),await u.t({snapshotDirectory:o,artifact:e});let s=await(0,m.mkdtemp)((0,h.join)((0,h.dirname)(o),`package-`));try{i.progress({message:`Packing the built app…`});let c=ne(await $({args:[`pack`,o,`--json`,`--ignore-scripts`,`--workspaces=false`,`--pack-destination`,s],appPath:e,signal:r})),l=new Set(c.files.map(e=>e.path)),u=[`manifest.json`,`package.json`,...t.files.map(e=>e.path).filter(e=>e!==`yarn.lock`)],d=[...new Set(u)].filter(e=>!l.has(e));if(d.length>0)throw new n.t({code:`PUBLISH_FAILED`,message:`The npm package is missing files required by the built app.`,hint:`Update the files field in package.json to include the manifest and built files.`,details:{missingPaths:d}});return r.throwIfAborted(),await a({path:(0,h.join)(s,c.filename),name:c.name,version:c.version})}finally{await(0,m.rm)(s,{recursive:!0,force:!0}).catch(()=>{i.warn({code:`PACKAGE_CLEANUP_FAILED`,message:`Could not remove temporary package folder ${s}.`})})}},ie=async e=>{let i=r.r(e.options,`tag`),a=r.t(e.options,`private`);if(a&&t.Vt(i))throw new n.t({code:`INVALID_INPUT`,exitCode:n.n.USAGE,message:`--tag only applies to npm publishing.`});if(t.Vt(i)&&!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(i))throw new n.t({code:`INVALID_INPUT`,exitCode:n.n.USAGE,message:`Invalid npm tag: ${i}.`});if(!a&&t.Vt(r.r(e.options,`remote`)))throw new n.t({code:`INVALID_INPUT`,exitCode:n.n.USAGE,message:`npm publishing does not use a Twenty remote.`});let s=a?await p.t(e):void 0,c,{project:l,diagnostics:u}=await d.t({context:e,useHeldBuild:async({project:n,data:r})=>{c=await re({appPath:n.path,build:r,signal:e.signal,output:e.output,usePackage:async r=>t.Vt(s)?v({packedApp:r,context:{target:s,signal:e.signal,output:e.output}}):te({packedApp:r,appPath:n.path,tag:i,context:e})})}});if(!t.Vt(c))throw new n.t({code:`PUBLISH_FAILED`,message:`The build did not provide a package to publish.`});return{data:{app:{path:l.path,name:l.name},...c,diagnostics:u},human:o.o(`Published ${c.name}@${c.version} to ${s?.apiUrl??`npm`}${a?`. Existing installations may upgrade automatically.`:``}`)}};exports.runAppPublishCommand=ie;
|
|
3
|
+
`);return g?(a.originalMessage=a.message,a.message=v):a=Error(v),a.shortMessage=_,a.command=c,a.escapedCommand=l,a.exitCode=s,a.signal=o,a.signalDescription=m,a.stdout=e,a.stderr=t,i!==void 0&&(a.all=i),`bufferedData`in a&&delete a.bufferedData,a.failed=!0,a.timedOut=!!u,a.isCanceled=d,a.killed=f&&!u,a}})),V=e.n(((e,t)=>{var n=[`stdin`,`stdout`,`stderr`],r=e=>n.some(t=>e[t]!==void 0),i=e=>{if(!e)return;let{stdio:t}=e;if(t===void 0)return n.map(t=>e[t]);if(r(e))throw Error(`It's not possible to provide \`stdio\` in combination with one of ${n.map(e=>`\`${e}\``).join(`, `)}`);if(typeof t==`string`)return t;if(!Array.isArray(t))throw TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let i=Math.max(t.length,n.length);return Array.from({length:i},(e,n)=>t[n])};t.exports=i,t.exports.node=e=>{let t=i(e);return t===`ipc`?`ipc`:t===void 0||typeof t==`string`?[t,t,t,`ipc`]:t.includes(`ipc`)?t:[...t,`ipc`]}})),H=e.n(((e,t)=>{t.exports=[`SIGABRT`,`SIGALRM`,`SIGHUP`,`SIGINT`,`SIGTERM`],process.platform!==`win32`&&t.exports.push(`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&t.exports.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`,`SIGUNUSED`)})),U=e.n(((e,t)=>{var n=global.process,r=function(e){return e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`};if(!r(n))t.exports=function(){return function(){}};else{var i=require("assert"),a=H(),o=/^win/i.test(n.platform),s=require("events");typeof s!=`function`&&(s=s.EventEmitter);var c;n.__signal_exit_emitter__?c=n.__signal_exit_emitter__:(c=n.__signal_exit_emitter__=new s,c.count=0,c.emitted={}),c.infinite||(c.setMaxListeners(1/0),c.infinite=!0),t.exports=function(e,t){if(!r(global.process))return function(){};i.equal(typeof e,`function`,`a callback must be provided for exit handler`),f===!1&&p();var n=`exit`;return t&&t.alwaysLast&&(n=`afterexit`),c.on(n,e),function(){c.removeListener(n,e),c.listeners(`exit`).length===0&&c.listeners(`afterexit`).length===0&&l()}};var l=function(){!f||!r(global.process)||(f=!1,a.forEach(function(e){try{n.removeListener(e,d[e])}catch{}}),n.emit=g,n.reallyExit=m,--c.count)};t.exports.unload=l;var u=function(e,t,n){c.emitted[e]||(c.emitted[e]=!0,c.emit(e,t,n))},d={};a.forEach(function(e){d[e]=function(){r(global.process)&&n.listeners(e).length===c.count&&(l(),u(`exit`,null,e),u(`afterexit`,null,e),o&&e===`SIGHUP`&&(e=`SIGINT`),n.kill(n.pid,e))}}),t.exports.signals=function(){return a};var f=!1,p=function(){f||!r(global.process)||(f=!0,c.count+=1,a=a.filter(function(e){try{return n.on(e,d[e]),!0}catch{return!1}}),n.emit=_,n.reallyExit=h)};t.exports.load=p;var m=n.reallyExit,h=function(e){r(global.process)&&(n.exitCode=e||0,u(`exit`,n.exitCode,null),u(`afterexit`,n.exitCode,null),m.call(n,n.exitCode))},g=n.emit,_=function(e,t){if(e===`exit`&&r(global.process)){t!==void 0&&(n.exitCode=t);var i=g.apply(this,arguments);return u(`exit`,n.exitCode,null),u(`afterexit`,n.exitCode,null),i}else return g.apply(this,arguments)}}})),W=e.n(((e,t)=>{var n=require("os"),r=U(),i=1e3*5,a=(e,t=`SIGTERM`,n={})=>{let r=e(t);return o(e,t,n,r),r},o=(e,t,n,r)=>{if(!s(t,n,r))return;let i=l(n),a=setTimeout(()=>{e(`SIGKILL`)},i);a.unref&&a.unref()},s=(e,{forceKillAfterTimeout:t},n)=>c(e)&&t!==!1&&n,c=e=>e===n.constants.signals.SIGTERM||typeof e==`string`&&e.toUpperCase()===`SIGTERM`,l=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return i;if(!Number.isFinite(e)||e<0)throw TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},u=(e,t)=>{e.kill()&&(t.isCanceled=!0)},d=(e,t,n)=>{e.kill(t),n(Object.assign(Error(`Timed out`),{timedOut:!0,signal:t}))};t.exports={spawnedKill:a,spawnedCancel:u,setupTimeout:(e,{timeout:t,killSignal:n=`SIGTERM`},r)=>{if(t===0||t===void 0)return r;let i,a=new Promise((r,a)=>{i=setTimeout(()=>{d(e,n,a)},t)}),o=r.finally(()=>{clearTimeout(i)});return Promise.race([a,o])},validateTimeout:({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},setExitHandler:async(e,{cleanup:t,detached:n},i)=>{if(!t||n)return i;let a=r(()=>{e.kill()});return i.finally(()=>{a()})}}})),G=e.n(((e,t)=>{var n=e=>typeof e==`object`&&!!e&&typeof e.pipe==`function`;n.writable=e=>n(e)&&e.writable!==!1&&typeof e._write==`function`&&typeof e._writableState==`object`,n.readable=e=>n(e)&&e.readable!==!1&&typeof e._read==`function`&&typeof e._readableState==`object`,n.duplex=e=>n.writable(e)&&n.readable(e),n.transform=e=>n.duplex(e)&&typeof e._transform==`function`,t.exports=n})),K=e.n(((e,t)=>{var{PassThrough:n}=require("stream");t.exports=e=>{e={...e};let{array:t}=e,{encoding:r}=e,i=r===`buffer`,a=!1;t?a=!(r||i):r||=`utf8`,i&&(r=null);let o=new n({objectMode:a});r&&o.setEncoding(r);let s=0,c=[];return o.on(`data`,e=>{c.push(e),a?s=c.length:s+=e.length}),o.getBufferedValue=()=>t?c:i?Buffer.concat(c,s):c.join(``),o.getBufferedLength=()=>s,o}})),q=e.n(((e,t)=>{var{constants:n}=require("buffer"),r=require("stream"),{promisify:i}=require("util"),a=K(),o=i(r.pipeline),s=class extends Error{constructor(){super(`maxBuffer exceeded`),this.name=`MaxBufferError`}};async function c(e,t){if(!e)throw Error(`Expected a stream`);t={maxBuffer:1/0,...t};let{maxBuffer:r}=t,i=a(t);return await new Promise((t,a)=>{let c=e=>{e&&i.getBufferedLength()<=n.MAX_LENGTH&&(e.bufferedData=i.getBufferedValue()),a(e)};(async()=>{try{await o(e,i),t()}catch(e){c(e)}})(),i.on(`data`,()=>{i.getBufferedLength()>r&&c(new s)})}),i.getBufferedValue()}t.exports=c,t.exports.buffer=(e,t)=>c(e,{...t,encoding:`buffer`}),t.exports.array=(e,t)=>c(e,{...t,array:!0}),t.exports.MaxBufferError=s})),J=e.n(((e,t)=>{var{PassThrough:n}=require("stream");t.exports=function(){var e=[],t=new n({objectMode:!0});return t.setMaxListeners(0),t.add=r,t.isEmpty=i,t.on(`unpipe`,a),Array.prototype.slice.call(arguments).forEach(r),t;function r(n){return Array.isArray(n)?(n.forEach(r),this):(e.push(n),n.once(`end`,a.bind(null,n)),n.once(`error`,t.emit.bind(t,`error`)),n.pipe(t,{end:!1}),this)}function i(){return e.length==0}function a(n){e=e.filter(function(e){return e!==n}),!e.length&&t.readable&&t.end()}}})),Y=e.n(((e,t)=>{var n=G(),r=q(),i=J(),a=(e,t)=>{t===void 0||e.stdin===void 0||(n(t)?t.pipe(e.stdin):e.stdin.end(t))},o=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;let n=i();return e.stdout&&n.add(e.stdout),e.stderr&&n.add(e.stderr),n},s=async(e,t)=>{if(e){e.destroy();try{return await t}catch(e){return e.bufferedData}}},c=(e,{encoding:t,buffer:n,maxBuffer:i})=>{if(!(!e||!n))return t?r(e,{encoding:t,maxBuffer:i}):r.buffer(e,{maxBuffer:i})};t.exports={handleInput:a,makeAllStream:o,getSpawnedResult:async({stdout:e,stderr:t,all:n},{encoding:r,buffer:i,maxBuffer:a},o)=>{let l=c(e,{encoding:r,buffer:i,maxBuffer:a}),u=c(t,{encoding:r,buffer:i,maxBuffer:a}),d=c(n,{encoding:r,buffer:i,maxBuffer:a*2});try{return await Promise.all([o,l,u,d])}catch(r){return Promise.all([{error:r,signal:r.signal,timedOut:r.timedOut},s(e,l),s(t,u),s(n,d)])}},validateInputSync:({input:e})=>{if(n(e))throw TypeError("The `input` option cannot be a stream in sync mode")}}})),X=e.n(((e,t)=>{var n=(async()=>{})().constructor.prototype,r=[`then`,`catch`,`finally`].map(e=>[e,Reflect.getOwnPropertyDescriptor(n,e)]);t.exports={mergePromise:(e,t)=>{for(let[n,i]of r){let r=typeof t==`function`?(...e)=>Reflect.apply(i.value,t(),e):i.value.bind(t);Reflect.defineProperty(e,n,{...i,value:r})}return e},getSpawnedPromise:e=>new Promise((t,n)=>{e.on(`exit`,(e,n)=>{t({exitCode:e,signal:n})}),e.on(`error`,e=>{n(e)}),e.stdin&&e.stdin.on(`error`,e=>{n(e)})})}})),Z=e.n(((e,t)=>{var n=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],r=/^[\w.-]+$/,i=/"/g,a=e=>typeof e!=`string`||r.test(e)?e:`"${e.replace(i,`\\"`)}"`,o=(e,t)=>n(e,t).join(` `),s=(e,t)=>n(e,t).map(e=>a(e)).join(` `),c=/ +/g;t.exports={joinCommand:o,getEscapedCommand:s,parseCommand:e=>{let t=[];for(let n of e.trim().split(c)){let e=t[t.length-1];e&&e.endsWith(`\\`)?t[t.length-1]=`${e.slice(0,-1)} ${n}`:t.push(n)}return t}}})),Q=e.n(((e,t)=>{var n=require("path"),r=require("child_process"),i=j(),a=M(),o=N(),s=F(),c=B(),l=V(),{spawnedKill:u,spawnedCancel:d,setupTimeout:f,validateTimeout:p,setExitHandler:m}=W(),{handleInput:h,getSpawnedResult:g,makeAllStream:_,validateInputSync:v}=Y(),{mergePromise:y,getSpawnedPromise:b}=X(),{joinCommand:x,parseCommand:S,getEscapedCommand:C}=Z(),w=1e3*1e3*100,T=({env:e,extendEnv:t,preferLocal:n,localDir:r,execPath:i})=>{let a=t?{...process.env,...e}:e;return n?o.env({env:a,cwd:r,execPath:i}):a},E=(e,t,r={})=>{let a=i._parse(e,t,r);return e=a.command,t=a.args,r=a.options,r={maxBuffer:w,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:r.cwd||process.cwd(),execPath:process.execPath,encoding:`utf8`,reject:!0,cleanup:!0,all:!1,windowsHide:!0,...r},r.env=T(r),r.stdio=l(r),process.platform===`win32`&&n.basename(e,`.exe`)===`cmd`&&t.unshift(`/q`),{file:e,args:t,options:r,parsed:a}},D=(e,t,n)=>typeof t!=`string`&&!Buffer.isBuffer(t)?n===void 0?void 0:``:e.stripFinalNewline?a(t):t,O=(e,t,n)=>{let i=E(e,t,n),a=x(e,t),o=C(e,t);p(i.options);let l;try{l=r.spawn(i.file,i.args,i.options)}catch(e){return y(new r.ChildProcess,Promise.reject(c({error:e,stdout:``,stderr:``,all:``,command:a,escapedCommand:o,parsed:i,timedOut:!1,isCanceled:!1,killed:!1})))}let v=b(l),S=f(l,i.options,v),w=m(l,i.options,S),T={isCanceled:!1};l.kill=u.bind(null,l.kill.bind(l)),l.cancel=d.bind(null,l,T);let O=s(async()=>{let[{error:e,exitCode:t,signal:n,timedOut:r},s,u,d]=await g(l,i.options,w),f=D(i.options,s),p=D(i.options,u),m=D(i.options,d);if(e||t!==0||n!==null){let s=c({error:e,exitCode:t,signal:n,stdout:f,stderr:p,all:m,command:a,escapedCommand:o,parsed:i,timedOut:r,isCanceled:T.isCanceled,killed:l.killed});if(!i.options.reject)return s;throw s}return{command:a,escapedCommand:o,exitCode:0,stdout:f,stderr:p,all:m,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return h(l,i.options.input),l.all=_(l,i.options),y(l,O)};t.exports=O,t.exports.sync=(e,t,n)=>{let i=E(e,t,n),a=x(e,t),o=C(e,t);v(i.options);let s;try{s=r.spawnSync(i.file,i.args,i.options)}catch(e){throw c({error:e,stdout:``,stderr:``,all:``,command:a,escapedCommand:o,parsed:i,timedOut:!1,isCanceled:!1,killed:!1})}let l=D(i.options,s.stdout,s.error),u=D(i.options,s.stderr,s.error);if(s.error||s.status!==0||s.signal!==null){let e=c({stdout:l,stderr:u,error:s.error,signal:s.signal,exitCode:s.status,command:a,escapedCommand:o,parsed:i,timedOut:s.error&&s.error.code===`ETIMEDOUT`,isCanceled:!1,killed:s.signal!==null});if(!i.options.reject)return e;throw e}return{command:a,escapedCommand:o,exitCode:0,stdout:l,stderr:u,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}},t.exports.command=(e,t)=>{let[n,...r]=S(e);return O(n,r,t)},t.exports.commandSync=(e,t)=>{let[n,...r]=S(e);return O.sync(n,r,t)},t.exports.node=(e,t,n={})=>{t&&!Array.isArray(t)&&typeof t==`object`&&(n=t,t=[]);let r=l.node(n),i=process.execArgv.filter(e=>!e.startsWith(`--inspect`)),{nodePath:a=process.execPath,nodeOptions:o=i}=n;return O(a,[...o,e,...Array.isArray(t)?t:[]],{...n,stdin:void 0,stdout:void 0,stderr:void 0,stdio:r,shell:!1})}})),ee=e.i(Q()),$=async({args:e,appPath:r,signal:a,canInteract:o=!1,onOutput:s})=>{a.throwIfAborted();let c=(0,ee.default)(`npm`,e,{cwd:r,stdio:o?`inherit`:[`ignore`,`pipe`,`pipe`],reject:!1,maxBuffer:4*1024*1024}),l=()=>c.kill(`SIGTERM`,{forceKillAfterTimeout:1e3});a.addEventListener(`abort`,l,{once:!0}),a.aborted&&l();try{let r=await c;if(a.aborted)throw i.t();if(!o&&t.Ut(s)&&((0,_.isNonEmptyString)(r.stdout)&&s(r.stdout),(0,_.isNonEmptyString)(r.stderr)&&s(r.stderr)),r.failed)throw new n.t({code:`PUBLISH_FAILED`,message:`npm ${e[0]} failed.`,hint:`Check that npm is installed and your npm registry credentials and package version are valid.`,details:{exitCode:r.exitCode,stdout:r.stdout?.slice(-16384)??``,stderr:r.stderr?.slice(-16384)??``}});return r.stdout??``}finally{a.removeEventListener(`abort`,l)}},te=async({packedApp:e,appPath:n,tag:r,context:i})=>{let o=t.Ut(process.env.ACTIONS_ID_TOKEN_REQUEST_URL)&&process.env.TWENTY_APP_PUBLISH_DISABLE_PROVENANCE!==`true`;return i.output.progress({message:`Publishing ${e.name}@${e.version} to npm…`}),await $({args:[`publish`,e.path,`--access`,`public`,`--ignore-scripts`,`--workspaces=false`,...o?[`--provenance`]:[],...t.Ut(r)?[`--tag`,r]:[]],appPath:n,signal:i.signal,canInteract:a.t(i),...i.outputMode===`human`?{onOutput:e=>i.output.progress({message:e})}:{}}),{target:`npm`,name:e.name,version:e.version,...t.Ut(r)?{tag:r}:{}}},ne=e=>{let r;try{r=JSON.parse(e)}catch(e){throw new n.t({code:`PUBLISH_FAILED`,message:`npm pack returned invalid JSON.`,cause:e})}let i=(0,_.isArray)(r)&&r.length===1?r[0]:void 0;if(!t.u(i)||!(0,_.isNonEmptyString)(i.name)||!(0,_.isNonEmptyString)(i.version)||!(0,_.isNonEmptyString)(i.filename)||(0,h.basename)(i.filename)!==i.filename||i.filename.includes(`\\`)||!i.filename.endsWith(`.tgz`)||!(0,_.isArray)(i.files))throw new n.t({code:`PUBLISH_FAILED`,message:`npm pack returned an invalid package description.`});let a=i.files.map(e=>{if(!t.u(e)||!(0,_.isNonEmptyString)(e.path))throw new n.t({code:`PUBLISH_FAILED`,message:`npm pack returned an invalid package file.`});return{path:e.path}});return{name:i.name,version:i.version,filename:i.filename,files:a}},re=async({appPath:e,build:t,signal:r,output:i,usePackage:a})=>{let o=u.a({build:t,appPath:e});for(let e of t.files)r.throwIfAborted(),await u.t({snapshotDirectory:o,artifact:e});let s=await(0,m.mkdtemp)((0,h.join)((0,h.dirname)(o),`package-`));try{i.progress({message:`Packing the built app…`});let c=ne(await $({args:[`pack`,o,`--json`,`--ignore-scripts`,`--workspaces=false`,`--pack-destination`,s],appPath:e,signal:r})),l=new Set(c.files.map(e=>e.path)),u=[`manifest.json`,`package.json`,...t.files.map(e=>e.path).filter(e=>e!==`yarn.lock`)],d=[...new Set(u)].filter(e=>!l.has(e));if(d.length>0)throw new n.t({code:`PUBLISH_FAILED`,message:`The npm package is missing files required by the built app.`,hint:`Update the files field in package.json to include the manifest and built files.`,details:{missingPaths:d}});return r.throwIfAborted(),await a({path:(0,h.join)(s,c.filename),name:c.name,version:c.version})}finally{await(0,m.rm)(s,{recursive:!0,force:!0}).catch(()=>{i.warn({code:`PACKAGE_CLEANUP_FAILED`,message:`Could not remove temporary package folder ${s}.`})})}},ie=async e=>{let i=r.r(e.options,`tag`),a=r.t(e.options,`private`);if(a&&t.Ut(i))throw new n.t({code:`INVALID_INPUT`,exitCode:n.n.USAGE,message:`--tag only applies to npm publishing.`});if(t.Ut(i)&&!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(i))throw new n.t({code:`INVALID_INPUT`,exitCode:n.n.USAGE,message:`Invalid npm tag: ${i}.`});if(!a&&t.Ut(r.r(e.options,`remote`)))throw new n.t({code:`INVALID_INPUT`,exitCode:n.n.USAGE,message:`npm publishing does not use a Twenty remote.`});let s=a?await p.t(e):void 0,c,{project:l,diagnostics:u}=await d.t({context:e,useHeldBuild:async({project:n,data:r})=>{c=await re({appPath:n.path,build:r,signal:e.signal,output:e.output,usePackage:async r=>t.Ut(s)?v({packedApp:r,context:{target:s,signal:e.signal,output:e.output}}):te({packedApp:r,appPath:n.path,tag:i,context:e})})}});if(!t.Ut(c))throw new n.t({code:`PUBLISH_FAILED`,message:`The build did not provide a package to publish.`});return{data:{app:{path:l.path,name:l.name},...c,diagnostics:u},human:o.o(`Published ${c.name}@${c.version} to ${s?.apiUrl??`npm`}${a?`. Existing installations may upgrade automatically.`:``}`)}};exports.runAppPublishCommand=ie;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-
|
|
2
|
-
`)},_=e.t(),v=e=>(0,_.isString)(e)&&i.t.some(t=>t===e),y=e=>t.
|
|
1
|
+
const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-D-caeNc5-9rDzSg5B.cjs"),n=require("./application-DOWikeQt.cjs"),r=require("./cli-error-CSsayo0u.cjs"),i=require("./build-pull-entities-ShVsLh_s.cjs"),a=require("./read-command-values-uSJqBG_E.cjs"),o=require("./style-BR52fK4V.cjs"),s=require("./to-worker-output-diagnostics-BzdY4Z2V.cjs"),c=require("./read-app-identity-dWB3NG6p.cjs"),l=require("./resolve-app-project-B0KRR-xp.cjs"),u=require("./format-data-value-kug8Yjt2.cjs"),d=require("./fetch-workspace-id-CsvJDu8b.cjs");var f=20,p=[{status:`UNSUPPORTED`,title:`Not written, unsupported by this version`},{status:`FOREIGN_OWNED`,title:`Owned by another application, not written`},{status:`EXCLUDED`,title:`Excluded as workspace runtime state`},{status:`ENGINE_DERIVED`,title:`Derived by the engine, rebuilt on apply`}],m=({title:e,relativePaths:t})=>t.length===0?[]:t.slice().sort().map(t=>` ${e.padEnd(13)}${t}`),h=e=>{let t=new Map;for(let n of e){let e=JSON.stringify([n.metadataName,n.reason]),r=t.get(e)??{metadataName:n.metadataName,reason:n.reason,identifiers:[]};r.identifiers.push(n.universalIdentifier),t.set(e,r)}return[...t.values()].sort((e,t)=>e.metadataName.localeCompare(t.metadataName)||(e.reason??``).localeCompare(t.reason??``))},g=({writes:e,deletions:n,unchangedCount:r,skipped:i,coverage:a,localOnlyRelativePaths:o,unreadableRelativePaths:s=[],compiledTranslationEntryCountByLocale:c={},entityLabelByUniversalIdentifier:l={},verbose:u=!1})=>{let d=[...m({title:`written`,relativePaths:e.filter(e=>!e.isRegeneration).map(e=>e.relativePath)}),...m({title:`regenerated`,relativePaths:e.filter(e=>e.isRegeneration).map(e=>e.relativePath)}),...m({title:`deleted`,relativePaths:n.map(e=>e.relativePath)})];if(r>0&&d.push(` unchanged ${r} file(s)`),i.length>0){d.push(``,`Not written by the writer:`);for(let e of i)d.push(` ${e.kind} ${e.reason}`)}s.length>0&&d.push(``,`Could not be read, so a second file may now define the same entity (check their diagnostics and SDK dependencies before pulling again):`,...s.slice().sort().map(e=>` ${e}`)),o.length>0&&d.push(``,`Local entities the workspace does not have (left untouched):`,...o.slice().sort().map(e=>` ${e}`));let g=a.filter(e=>e.status===`EXPORTED`&&t.Ut(e.reason)).map(e=>` ${e.metadataName} ${l[e.universalIdentifier]??e.universalIdentifier}: ${e.reason}`).sort();if(g.length>0){let e=u?g:g.slice(0,f);d.push(``,`Written without their workspace-local state (${g.length} row(s)):`,...e),g.length>e.length&&d.push(` …and ${g.length-e.length} more, listed with --verbose`)}for(let e of p){let t=a.filter(t=>t.status===e.status);if(t.length!==0){d.push(``,`${e.title} (${t.length} row(s)):`);for(let{metadataName:e,reason:n,identifiers:r}of h(t))if(d.push(` ${e.padEnd(34)}${String(r.length).padEnd(6)}${n??``}`.trimEnd()),u){for(let e of r.slice(0,f))d.push(` ${e}`);r.length>f&&d.push(` …and ${r.length-f} more`)}}}let _=Object.entries(c).filter(([,e])=>e>0).sort(([e],[t])=>e.localeCompare(t));return _.length>0&&d.push(``,`Translations kept in compiled form until their source strings are in this tree (see locales/compiled/):`,..._.map(([e,t])=>` ${e.padEnd(13)}${t} ${t===1?`entry`:`entries`}`)),d.join(`
|
|
2
|
+
`)},_=e.t(),v=e=>(0,_.isString)(e)&&i.t.some(t=>t===e),y=e=>t.u(e)&&(0,_.isString)(e.universalIdentifier)&&(0,_.isString)(e.relativePath),b=e=>t.u(e)&&(v(e.kind)||e.kind===`translation`)&&(0,_.isBoolean)(e.isRegeneration)&&y(e),x=e=>t.u(e)&&v(e.kind)&&(0,_.isString)(e.universalIdentifier)&&(0,_.isString)(e.reason),S=e=>t.u(e)&&Object.values(e).every(_.isString),C=e=>t.u(e)&&Object.values(e).every(_.isNumber),w=e=>{if(!t.u(e)||!t.u(e.application)||!(0,_.isString)(e.application.universalIdentifier)||!(0,_.isString)(e.application.displayName)||!t.u(e.base)||!(0,_.isArray)(e.writes)||!e.writes.every(b)||!(0,_.isArray)(e.deletions)||!e.deletions.every(y)||!(0,_.isArray)(e.overwrittenLocalChanges)||!e.overwrittenLocalChanges.every(y)||!(0,_.isNumber)(e.unchangedCount)||!(0,_.isArray)(e.localOnlyRelativePaths)||!e.localOnlyRelativePaths.every(_.isString)||!(0,_.isArray)(e.unreadableRelativePaths)||!e.unreadableRelativePaths.every(_.isString)||!(0,_.isArray)(e.skipped)||!e.skipped.every(x)||!C(e.compiledTranslationEntryCountByLocale)||!S(e.entityLabelByUniversalIdentifier))return;let n=e.base.status;if(!(n!==`used`&&n!==`missing`&&n!==`other-target`&&n!==`unbound`&&n!==`unreadable`))return{data:{application:{universalIdentifier:e.application.universalIdentifier,displayName:e.application.displayName},base:{status:n},writes:e.writes,deletions:e.deletions,overwrittenLocalChanges:e.overwrittenLocalChanges,unchangedCount:e.unchangedCount,localOnlyRelativePaths:e.localOnlyRelativePaths,unreadableRelativePaths:e.unreadableRelativePaths,skipped:e.skipped,compiledTranslationEntryCountByLocale:e.compiledTranslationEntryCountByLocale,entityLabelByUniversalIdentifier:e.entityLabelByUniversalIdentifier}}},T=async({options:e,target:i,signal:f,output:p,outputMode:m})=>{let h=await l.t({explicitPath:a.r(e,`path`),workingDirectory:process.cwd()}),_=a.r(e,`universalIdentifier`);if(t.Ut(_)&&!n.a(_))throw new r.t({code:`INVALID_INPUT`,exitCode:r.n.USAGE,message:`--universal-identifier must be a UUID of version 4 or later.`});let v=await c.t({appPath:h.path,signal:f,warn:p.warn}),y=(_??v.application?.universalIdentifier)?.toLowerCase();if(!t.Ut(y))throw new r.t({code:`INVALID_INPUT`,exitCode:r.n.USAGE,message:`This project has no application definition.`,hint:`Pass --universal-identifier <uuid> to pull an app into this project.`});if(t.Ut(v.application)&&v.application.universalIdentifier.toLowerCase()!==y)throw new r.t({code:`INVALID_INPUT`,exitCode:r.n.USAGE,message:`This project declares application ${v.application.universalIdentifier}, not ${y}. Pull it into a different directory.`});p.progress({message:`Exporting the app from ${i.apiUrl}…`});let[b,x]=await Promise.all([d.t({target:i,signal:f}),d.n({universalIdentifier:y,target:i,signal:f})]);p.progress({message:`Reconciling local definitions. Changed workspace entities replace local edits…`});let S=await s.n({request:{type:`pull`,appPath:h.path,target:{apiUrl:i.apiUrl,workspaceId:b},applicationExport:x},signal:f}).catch(e=>{throw new r.t({code:e instanceof r.t?e.code:`PULL_FAILED`,exitCode:e instanceof r.t?e.exitCode:r.n.FAILURE,message:e instanceof Error?e.message:String(e),hint:`The worker did not acknowledge completion. Inspect local changes and any backups in .twenty/cli/pull-backup-* before retrying.`,details:{...e instanceof r.t?e.details:{},outcome:`unknown`}})}),C=s.o({value:S.result,parseData:w}),T=[...v.diagnostics,...C.diagnostics,...s.t(S.output)];if(m===`human`)for(let e of T)p.progress({message:s.s(e)});if(!C.success)throw new r.t({code:C.error.code===`CANCELLED`?`CANCELLED`:C.error.code===`SDK_SOURCE_UNSUPPORTED`?`SDK_SOURCE_UNSUPPORTED`:`PULL_FAILED`,exitCode:C.error.code===`CANCELLED`?r.n.CANCELLED:r.n.FAILURE,message:C.error.message,hint:C.error.hint??(C.error.code===`SDK_SOURCE_UNSUPPORTED`?`Upgrade the app to a compatible twenty-sdk version (2.40.0 or later).`:void 0),details:{...C.error.details,diagnostics:T}});let E=C.data;(E.skipped.length>0||E.unreadableRelativePaths.length>0||x.coverage.some(e=>![`EXPORTED`,`ENGINE_DERIVED`].includes(e.status)))&&p.warn({code:`PULL_INCOMPLETE`,message:`Some entities could not be written. See coverage, skipped entities and unreadable files in the pull report.`});let D=g({...E,writes:E.writes.map(e=>({...e,relativePath:u.r(e.relativePath)})),deletions:E.deletions.map(e=>({...e,relativePath:u.r(e.relativePath)})),skipped:E.skipped.map(e=>({...e,reason:u.r(e.reason)})),localOnlyRelativePaths:E.localOnlyRelativePaths.map(u.r),unreadableRelativePaths:E.unreadableRelativePaths.map(u.r),entityLabelByUniversalIdentifier:Object.fromEntries(Object.entries(E.entityLabelByUniversalIdentifier).map(([e,t])=>[e,u.r(t)])),coverage:x.coverage.map(e=>({...e,metadataName:u.r(e.metadataName),universalIdentifier:u.r(e.universalIdentifier),reason:e.reason===null?null:u.r(e.reason)})),verbose:a.t(e,`verbose`)}),O=x.coverage.filter(e=>![`EXPORTED`,`UNSUPPORTED`,`FOREIGN_OWNED`,`EXCLUDED`,`ENGINE_DERIVED`].includes(e.status));return{data:{app:{path:h.path,name:h.name},...E,pulled:!0,coverage:x.coverage,diagnostics:T},human:[o.o(`Pulled ${u.r(E.application.displayName)} into ${u.r(h.path)}`),D,...E.base.status===`used`?[]:[`No matching pull base (${E.base.status}); local-only definitions were kept.`],...E.overwrittenLocalChanges.length>0?[`Local edits replaced by workspace changes:`,...E.overwrittenLocalChanges.map(e=>` ${u.r(e.relativePath)}`)]:[],...O.length>0?[`Unrecognized coverage, not written:`,...O.map(e=>` ${u.r(e.metadataName)} ${u.r(e.status)}: ${u.r(e.reason)}`)]:[],`Run ${o.r(`twenty app typecheck`)} to check the generated definitions.`].filter(Boolean).join(`
|
|
3
3
|
`)}};exports.runAppPullCommand=T;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-
|
|
1
|
+
const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-D-caeNc5-9rDzSg5B.cjs"),n=require("./resolve-source-sdk-CU1wk4bl.cjs"),r=require("./parse-extraction-locale-C7Gdd3Oa.cjs"),i=require("./read-command-values-uSJqBG_E.cjs"),a=require("./style-BR52fK4V.cjs"),o=require("./to-worker-output-diagnostics-BzdY4Z2V.cjs"),s=require("./resolve-app-project-B0KRR-xp.cjs"),c=require("./create-tooling-failure-B2FmNwR2.cjs");var l=e.t(),u=async e=>{let{options:u,output:d,outputMode:f,signal:p}=e,m=r.t(i.r(u,`locale`)),h=await s.t({explicitPath:i.r(u,`path`),workingDirectory:process.cwd()}),g=await n.t({appPath:h.path});d.progress({message:`Extracting translatable strings from ${h.name}…`});let _=await o.n({request:{type:`extractTranslations`,appPath:h.path,locale:m},signal:p}),v=o.o({value:_.result,parseData:e=>{if(!(!t.u(e)||!(0,l.isNumber)(e.sourceCount)||!(0,l.isArray)(e.updatedLocaleFiles)||!e.updatedLocaleFiles.every(l.isString)))return{data:{sourceCount:e.sourceCount,updatedLocaleFiles:e.updatedLocaleFiles}}}}),y=[...v.diagnostics,...o.t(_.output)];if(f===`human`)for(let e of y)d.progress({message:o.s(e)});if(!v.success)throw c.t({error:v.error,diagnostics:y,sdkVersion:g.version});return{data:{app:h,...v.data,diagnostics:y},human:[a.o(`Extracted ${v.data.sourceCount} ${v.data.sourceCount===1?`string`:`strings`} to locales/`),`Updated: ${v.data.updatedLocaleFiles.join(`, `)}`].join(`
|
|
2
2
|
`)}};exports.runAppTranslationsExtractCommand=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./style-BR52fK4V.cjs"),t=require("./format-app-duration-gu2oRLB4.cjs"),n=require("./run-app-operation-
|
|
1
|
+
const e=require("./style-BR52fK4V.cjs"),t=require("./format-app-duration-gu2oRLB4.cjs"),n=require("./run-app-operation-Cw5M8v43.cjs");var r=async r=>{let{project:i,sdk:a,diagnostics:o,durationMilliseconds:s}=await n.n({context:r});return{data:{app:{path:i.path,name:i.name},sdk:{version:a.version},diagnostics:o,durationMilliseconds:s},human:e.o(`No type errors in ${i.name} ${e.i(`· project TypeScript · ${t.t(s)}`)}`)}};exports.runAppTypecheckCommand=r;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./cli-error-CSsayo0u.cjs"),t=require("./read-command-values-uSJqBG_E.cjs"),n=require("./is-interaction-allowed-CF-ko1KI.cjs"),r=require("./style-BR52fK4V.cjs"),i=require("./with-phase-details-Dof8Ao9R.cjs"),a=require("./to-cli-error-BBYf_wqo.cjs"),o=require("./is-application-not-found-error-
|
|
1
|
+
const e=require("./cli-error-CSsayo0u.cjs"),t=require("./read-command-values-uSJqBG_E.cjs"),n=require("./is-interaction-allowed-CF-ko1KI.cjs"),r=require("./style-BR52fK4V.cjs"),i=require("./with-phase-details-Dof8Ao9R.cjs"),a=require("./to-cli-error-BBYf_wqo.cjs"),o=require("./is-application-not-found-error-Cja7iQrL.cjs"),s=require("./create-metadata-client-9IF8ArjT.cjs"),c=require("./format-data-value-kug8Yjt2.cjs"),l=require("./require-approval-D0FfoHhF.cjs"),u=require("./create-app-not-installed-error-DY-iuPPx.cjs"),d=require("./read-application-identifier-BlkRhC8j.cjs");var f=new Set([`AUTH_REQUIRED`,`PERMISSION_DENIED`]),p=({code:e,outcome:t})=>t===`unknown`?`The uninstall may have partly run. Run twenty app uninstall again: it reports APP_NOT_INSTALLED once the app is gone.`:e===`APP_NOT_INSTALLED`?`Nothing was uninstalled. Check the target workspace and the universal identifier.`:`Fix the problem, then run twenty app uninstall again.`,m=({error:e,phase:t,completedPhases:n,signal:r})=>{let o=a.t(e,r),s=t!==`uninstall`||f.has(o.code)?`not-started`:`unknown`;return i.t({error:o,phase:t,outcome:s,completedPhases:n,hint:p({code:o.code,outcome:s})})},h=async({universalIdentifier:t,target:n,signal:r})=>{if((await s.t({target:n,signal:r}).mutation({__name:`UninstallApplication`,uninstallApplication:{__args:{universalIdentifier:t}}}).catch(e=>{throw o.t({error:e,field:`uninstallApplication`})?u.t({universalIdentifier:t,apiUrl:n.apiUrl}):e}))?.uninstallApplication!==!0)throw new e.t({code:`INVALID_RESPONSE`,message:`The server did not confirm the uninstall of ${t}.`})},g=async i=>{let{options:a,target:o,signal:s,output:u,outputMode:f}=i,p=[],g=(e,t)=>m({error:e,phase:t,completedPhases:p,signal:s}),_=await d.t({context:i,onIdentityRead:()=>p.push(`identity`)}).catch(e=>{throw g(e,`identity`)});u.progress({message:`Checking the app on ${o.apiUrl}…`});let v=await d.n({universalIdentifier:_,target:o,signal:s}).catch(e=>{throw g(e,`check`)}),y=c.r(v.name);if(!v.canBeUninstalled)throw g(new e.t({code:`APP_NOT_UNINSTALLABLE`,exitCode:e.n.CONFLICT,message:`${y} cannot be uninstalled from ${o.apiUrl}.`}),`check`);return p.push(`check`),await l.t({isApproved:t.t(a,`yes`),canPrompt:n.t({options:a,outputMode:f}),question:`Uninstall ${y} from ${o.apiUrl}? Its objects, fields and their data are permanently deleted.`,code:`CONFIRMATION_REQUIRED`,message:`Uninstalling ${y} permanently deletes its objects, fields and their data.`,hint:`Pass --yes to uninstall it.`,declinedMessage:`Uninstall stopped at the confirmation prompt.`,signal:s}).catch(e=>{throw g(e,`confirmation`)}),u.progress({message:`Uninstalling ${y}…`}),await h({universalIdentifier:_,target:o,signal:s}).catch(e=>{throw g(e,`uninstall`)}),p.push(`uninstall`),{data:{application:{universalIdentifier:_,name:v.name},uninstalled:!0,completedPhases:p},human:[r.o(`Uninstalled ${y} from ${o.apiUrl}`),r.i(` Its registration is kept, so twenty app apply can install it again.`)].join(`
|
|
2
2
|
`)}};exports.runAppUninstallCommand=g;
|
package/dist/chunks/{run-auth-login-command-C4VI44Xu.cjs → run-auth-login-command-Cb3bITQj.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./constants-
|
|
1
|
+
const e=require("./constants-D-caeNc5-9rDzSg5B.cjs"),t=require("./cli-error-CSsayo0u.cjs"),n=require("./parse-api-url-CFCz3xUA.cjs"),r=require("./read-command-values-uSJqBG_E.cjs"),i=require("./read-input-value-Cxgh_r2g.cjs"),a=require("./is-interaction-allowed-CF-ko1KI.cjs"),o=require("./style-BR52fK4V.cjs"),s=require("./get-config-path-C-D-QHuX.cjs"),c=require("./read-config-Qwl4pAO8.cjs"),l=require("./sign-in-with-browser-BUvT_awm.cjs"),u=require("./update-config-CnB7lDVC.cjs"),d=require("./validate-remote-name-w-qnr43w.cjs"),f=require("./fetch-signed-in-identity-B49Tf79K.cjs");var p=`Pipe it in, for example: printf '%s' "$TWENTY_API_KEY" | twenty auth login --with-token --url <url>`,m=async e=>{if(process.stdin.isTTY===!0)throw new t.t({code:`USAGE`,exitCode:t.n.USAGE,message:`The API key must come from standard input.`,hint:p});let n=(await i.t({value:`-`,optionName:`the API key`,signal:e})).trim();if(n===``||/\s/.test(n))throw new t.t({code:`USAGE`,exitCode:t.n.USAGE,message:n===``?`Standard input is empty.`:`Standard input must contain only the API key.`,hint:p});return n},h=(e,t)=>Object.hasOwn(e.remotes,t)?e.remotes[t]:void 0,g=({existingRemote:r,remoteName:i,apiUrl:a,replace:o})=>{if(!(!e.Ut(r)||o||n.t({rawUrl:r.apiUrl,sourceName:i})===a))throw new t.t({code:`CONFIRMATION_REQUIRED`,exitCode:t.n.USAGE,message:`Remote ${i} points to ${r.apiUrl}.`,hint:`Pass --replace to point it at ${a}.`})},_=async({options:e,apiUrl:n,output:i,outputMode:o,signal:s})=>{if(r.t(e,`withToken`))return{kind:`apiKey`,apiKey:await m(s)};if(!a.t({options:e,outputMode:o}))throw new t.t({code:`USAGE`,exitCode:t.n.USAGE,message:`Browser sign-in only runs in an interactive terminal, not with --no-input, JSON output, redirected stdin or in CI.`,hint:`In scripts and CI, retry this command with --with-token and pipe an API key on standard input.`});return{kind:`oauth`,...await l.t({apiUrl:n,output:i,signal:s})}},v=({remoteName:t,apiUrl:n,credentials:r,identity:i})=>{let a=e.Ut(i.workspaceName)?` · workspace ${i.workspaceName}`:``;return r.kind===`apiKey`?`Saved remote "${t}" ${o.i(`(${n}) · API key${a}`)}`:`Signed in to "${t}"${e.Ut(i.email)?` as ${i.email}`:``}${o.i(a)}`},y=async({options:i,output:a,outputMode:p,signal:m})=>{let y=r.r(i,`name`)??r.r(i,`remote`),b=d.t(y??`default`),x=r.t(i,`replace`),S=s.t(),C=await c.t(S),w=h(C,b),T=r.r(i,`url`);if(!e.Ut(T)&&!e.Ut(w))throw new t.t({code:`USAGE`,exitCode:t.n.USAGE,message:Object.keys(C.remotes).length===0?`No saved connections yet.`:`There is no remote named "${b}" yet.`,hint:e.Ut(y)?`Pass --url to create it.`:`Run twenty auth login --url <url> to save a connection.`});let E=e.Ut(T)?n.t({rawUrl:T,sourceName:`--url`}):n.t({rawUrl:w?.apiUrl??``,sourceName:`The URL of remote ${b}`});g({existingRemote:w,remoteName:b,apiUrl:E,replace:x});let D=await _({options:i,apiUrl:E,output:a,outputMode:p,signal:m}),O=await f.t({target:{apiUrl:E,bearerToken:D.kind===`apiKey`?D.apiKey:D.accessToken,credentialKind:D.kind,source:`remote`,remoteName:b},signal:m}).catch(e=>{throw e instanceof t.t&&e.code===`AUTH_REQUIRED`?new t.t({code:`AUTH_REQUIRED`,exitCode:t.n.AUTHENTICATION,message:`${E} rejected ${D.kind===`apiKey`?`this API key`:`the new session`}. Nothing was saved.`,hint:D.kind===`apiKey`?`Check the key and that it belongs to a workspace on this server.`:`Run twenty auth login again.`,details:e.details}):e}),k=await u.t({configPath:S,signal:m,update:t=>{let n=h(t,b);g({existingRemote:n,remoteName:b,apiUrl:E,replace:x});let a=e.Ut(t.defaultRemote)&&Object.hasOwn(t.remotes,t.defaultRemote),o=r.t(i,`use`)||!a?b:t.defaultRemote;return{result:o===b,config:{...t,defaultRemote:o,remotes:{...t.remotes,[b]:{...l.n({remote:n??{apiUrl:E},credentials:D}),apiUrl:E,...e.Ut(O.workspaceName)?{workspaceName:O.workspaceName}:{}}}}}}});return{data:{remote:b,apiUrl:E,credentials:D.kind,workspaceName:O.workspaceName,email:O.email,isDefault:k},human:o.o(v({remoteName:b,apiUrl:E,credentials:D,identity:O}))}};exports.runAuthLoginCommand=y;
|
package/dist/chunks/{run-auth-logout-command-5Tvqclki.cjs → run-auth-logout-command-iC22soKN.cjs}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./cli-error-CSsayo0u.cjs"),t=require("./read-command-values-uSJqBG_E.cjs"),n=require("./target-environment-variable.constant-D7z8AihP.cjs"),r=require("./style-BR52fK4V.cjs"),i=require("./select-target-
|
|
1
|
+
const e=require("./cli-error-CSsayo0u.cjs"),t=require("./read-command-values-uSJqBG_E.cjs"),n=require("./target-environment-variable.constant-D7z8AihP.cjs"),r=require("./style-BR52fK4V.cjs"),i=require("./select-target-DZlm8j62.cjs"),a=require("./get-config-path-C-D-QHuX.cjs"),o=require("./read-config-Qwl4pAO8.cjs"),s=require("./find-remote-D48r20g0.cjs"),c=require("./get-credential-kind-JI9heHe2.cjs"),l=require("./update-config-CnB7lDVC.cjs");var u=async({options:u,output:d,signal:f})=>{let p=a.t(),m=await i.t({environment:process.env,remoteFlag:t.r(u,`remote`),loadConfig:()=>o.t(p),warn:d.warn});if(m.source===`environment`)throw new e.t({code:`USAGE`,exitCode:e.n.USAGE,message:`${n.t.API_URL} and ${n.t.API_KEY} are not saved, so there is nothing to sign out of.`,hint:`Unset them in your shell, or pick a saved remote with --remote.`});let{remoteName:h}=m,g=await l.t({configPath:p,signal:f,update:e=>{let t=s.t(e,h),{apiKey:n,twentyCLIAccessToken:r,twentyCLIRefreshToken:i,...a}=t;return{result:c.t(t)!==`none`,config:{...e,remotes:{...e.remotes,[h]:a}}}}});return{data:{remote:h,wasSignedIn:g},human:g?[r.o(`Signed out of ${h}.`),`${r.i(` The remote stays; sign in with `)}${r.r(`twenty auth login --remote ${h} --with-token`)}`].join(`
|
|
2
2
|
`):`${h} was already signed out.`}};exports.runAuthLogoutCommand=u;
|
package/dist/chunks/{run-auth-status-command-CLH1bylR.cjs → run-auth-status-command-C0rdb747.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./constants-
|
|
1
|
+
const e=require("./constants-D-caeNc5-9rDzSg5B.cjs"),t=require("./target-environment-variable.constant-D7z8AihP.cjs"),n=require("./style-BR52fK4V.cjs"),r=require("./format-details-COEwKz_M.cjs"),i=require("./get-config-path-C-D-QHuX.cjs"),a=require("./read-config-Qwl4pAO8.cjs"),o=require("./is-access-token-expiring-DT6D8bMy.cjs"),s=require("./fetch-signed-in-identity-B49Tf79K.cjs"),c=require("./credential-kind-labels.constant-CKdoQF8o.cjs");var l=6e4,u=e=>{let t=Math.max(0,Math.round((e-Date.now())/l));return t<120?`${t} minutes`:`${Math.round(t/60)} hours`},d=async({target:l,signal:d})=>{let f=await s.t({target:l,signal:d}),p=e.Ut(l.remoteName)&&(await a.t(i.t())).defaultRemote===l.remoteName,m=l.credentialKind===`oauth`?o.t(l.bearerToken):void 0,h=e.Ut(l.remoteName)?`${l.remoteName}${p?n.i(` (default)`):``}`:n.i(`none, using ${t.t.API_URL} and ${t.t.API_KEY}`),g=e.Ut(f.email)?`${f.email} ${n.i(`via ${c.t[l.credentialKind]}`)}`:c.t[l.credentialKind],_=n.n(`green`,`valid`);return{data:{remote:l.remoteName??null,isDefaultRemote:p,apiUrl:l.apiUrl,source:l.source,credentials:l.credentialKind,email:f.email,workspaceName:f.workspaceName,sessionExpiresAt:e.Ut(m)?new Date(m).toISOString():null},human:r.t([[`Remote`,h],[`Server`,l.apiUrl],[`Workspace`,f.workspaceName??n.i(`unnamed`)],[`Signed in`,g],[`Status`,e.Ut(m)?`${_} ${n.i(`· renews itself, current token expires in ${u(m)}`)}`:_]])}};exports.runAuthStatusCommand=d;
|