twenty 2.57.0 → 2.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-template/yarn.lock +95 -95
- package/dist/app-worker.cjs +1 -1
- package/dist/chunks/FileFolder-BmCXp_bX.cjs +1 -0
- package/dist/chunks/TwentyStandardApplicationUniversalIdentifier-Cm4vo0D3.cjs +1 -0
- package/dist/chunks/build-source-manifest-DcRIFlDb.cjs +2 -0
- package/dist/chunks/build-source-snapshot-C0UVzVTo.cjs +897 -0
- package/dist/chunks/{cli-version.constant-1uwk-lMz.cjs → cli-version.constant-jomCqLLP.cjs} +1 -1
- package/dist/chunks/code-step-file-suffix.constant-B6vqrfcU.cjs +1 -0
- package/dist/chunks/collect-translatable-strings-AWv41yIv.cjs +1 -0
- package/dist/chunks/collect-watch-inputs-DfWAkX1r.cjs +1 -0
- package/dist/chunks/compile-application-translations-Da3xWXl-.cjs +58 -0
- package/dist/chunks/convert-to-label-CI8cZyg_.cjs +1 -0
- package/dist/chunks/create-http-status-error-1VM7PoVZ.cjs +1 -0
- package/dist/chunks/create-metadata-client-oO0QvH6j.cjs +6 -0
- package/dist/chunks/create-pull-base-write-CQHTbtQP.cjs +1 -0
- package/dist/chunks/create-rest-client-CMUss3u-.cjs +1 -0
- package/dist/chunks/extract-manifest-from-file-DPDIhnyg.cjs +1 -0
- package/dist/chunks/extract-source-translations--J7rPcdh.cjs +1 -0
- package/dist/chunks/{fetch-metadata-inspection-Dqn8jToW.cjs → fetch-metadata-inspection-LB3RA2cV.cjs} +1 -1
- package/dist/chunks/{fetch-signed-in-identity-DCqCwASL.cjs → fetch-signed-in-identity-GVHuJKXy.cjs} +1 -1
- package/dist/chunks/fetch-workspace-or-throw-CGlqJOIG.cjs +1 -0
- package/dist/chunks/format-body-DlJyFFVS.cjs +1 -0
- package/dist/chunks/format-data-value-D_1TNU-r.cjs +1 -0
- package/dist/chunks/format-metadata-fields-DmRandPR.cjs +2 -0
- package/dist/chunks/format-metadata-owner-ByoX2plp.cjs +1 -0
- package/dist/chunks/format-progress-line-BoU0vHbc.cjs +1 -0
- package/dist/chunks/formatBytes-CUW21d2t.cjs +1 -0
- package/dist/chunks/generate-application-client-Dlp_O7qk.cjs +1 -0
- package/dist/chunks/{get-client-generation-skip-reason-DZmeP0IC.cjs → get-client-generation-skip-reason-CkpxXdRw.cjs} +1 -1
- package/dist/chunks/get-field-universal-identifier.util-d1401qKf.cjs +1 -0
- package/dist/chunks/get-function-input-schema-ClPQURr8.cjs +1 -0
- package/dist/chunks/get-local-status-BbRv0a22.cjs +1 -0
- package/dist/chunks/{global-flags.constant-C8Yu1rWc.cjs → global-flags.constant-DooTv_Uq.cjs} +1 -1
- package/dist/chunks/is-access-token-expiring-BvJhEqtV.cjs +1 -0
- package/dist/chunks/is-application-not-found-error-CQ7k4hGU.cjs +1 -0
- package/dist/chunks/is-exported-manifest-DRPkDqYh.cjs +1 -0
- package/dist/chunks/is-locale-catalog-T4W5NhnW.cjs +1 -0
- package/dist/chunks/{AppLocales-CcZVcJIa-BjjIbbsZ.cjs → is-supported-locale-DUMI9QQ2.cjs} +1 -1
- package/dist/chunks/is-valid-package-name-Bv-sKHlR.cjs +1 -0
- package/dist/chunks/isNonEmptyArray-v52xg4Xj.cjs +1 -0
- package/dist/chunks/isPlainObject-fJEJm71P.cjs +1 -0
- package/dist/chunks/isValidUniversalIdentifier-DymFerYs.cjs +1 -0
- package/dist/chunks/kebab-case-B3kq7ANN.cjs +1 -0
- package/dist/chunks/locale-catalog-format-BD4XDEnl.cjs +1 -0
- package/dist/chunks/{metadata-page.constant-qMNOJLjJ.cjs → metadata-page.constant-Bt8myt0X.cjs} +1 -1
- package/dist/chunks/parse-api-url-B5c0Gh_n.cjs +1 -0
- package/dist/chunks/parse-app-export-CmFKsj2e.cjs +1 -0
- package/dist/chunks/parse-extraction-locale-B0apfizg.cjs +1 -0
- package/dist/chunks/parse-graphql-response-D3WfxVAu.cjs +1 -0
- package/dist/chunks/parse-json-input-DxGKbeED.cjs +1 -0
- package/dist/chunks/print-typescript-value-BjYn0ZFT.cjs +3 -0
- package/dist/chunks/pull-minimum-sdk-version.constant-0v8yv93F.cjs +6 -0
- package/dist/chunks/pull-source-C6LiDOqa.cjs +1 -0
- package/dist/chunks/read-app-identity-DyMNXRhZ.cjs +1 -0
- package/dist/chunks/read-application-identifier-hrv6xLTN.cjs +1 -0
- package/dist/chunks/read-application-identity-CyVawH0m.cjs +1 -0
- package/dist/chunks/read-bounded-body-BekYzK8S.cjs +1 -0
- package/dist/chunks/read-config-6GnzcpJm.cjs +1 -0
- package/dist/chunks/read-infer-deletion-option-Br1FJCfZ.cjs +8 -0
- package/dist/chunks/read-json-object-BMftwGZ5.cjs +1 -0
- package/dist/chunks/read-local-container-DsjjrgOn.cjs +1 -0
- package/dist/chunks/read-snapshot-file-D-s1kuCP.cjs +1 -0
- package/dist/chunks/{read-source-identity-CaErC5Qk.cjs → read-source-identity-CXzcnYKk.cjs} +1 -1
- package/dist/chunks/record-pull-base-BZ6YgdEp.cjs +1 -0
- package/dist/chunks/{record-typecheck-config-inputs-BAruvIZV.cjs → record-typecheck-config-inputs-U2RUjjp9.cjs} +1 -1
- package/dist/chunks/request-oauth-tokens-B4JHBmVU.cjs +1 -0
- package/dist/chunks/resolve-app-project-B4IjfcM-.cjs +1 -0
- package/dist/chunks/resolve-command-target-CwC9p_NB.cjs +1 -0
- package/dist/chunks/resolve-inside-sdk-DA7EQpf0.cjs +1 -0
- package/dist/chunks/resolve-metadata-object-CN7eAeDR.cjs +1 -0
- package/dist/chunks/resolve-project-typescript-DO4LrLr-.cjs +1 -0
- package/dist/chunks/resolve-request-url-BzW185lE.cjs +1 -0
- package/dist/chunks/resolve-source-sdk-C4Hu045V.cjs +1 -0
- package/dist/chunks/run-api-graphql-command-x0ynMacW.cjs +1 -0
- package/dist/chunks/run-api-rest-command-p5A2Fb05.cjs +1 -0
- package/dist/chunks/{run-app-add-command-qkKHuv9-.cjs → run-app-add-command-oHIkbKe1.cjs} +20 -18
- package/dist/chunks/{run-app-apply-command-XNJHctjU.cjs → run-app-apply-command-Ww_5FeZf.cjs} +2 -2
- package/dist/chunks/run-app-build-command-DpgKL1XF.cjs +2 -0
- package/dist/chunks/{run-app-dev-command-D6zVdTId.cjs → run-app-dev-command-DVOvwZdx.cjs} +1 -1
- package/dist/chunks/run-app-exec-command-Cly1JhuE.cjs +3 -0
- package/dist/chunks/run-app-generate-client-command-CVwOI5-n.cjs +2 -0
- package/dist/chunks/{run-app-init-command-DcS8RfBK.cjs → run-app-init-command-DdSdOmo5.cjs} +1 -1
- package/dist/chunks/run-app-install-command-zs9OY8uz.cjs +1 -0
- package/dist/chunks/{run-app-logs-command-CQHxh_Dt.cjs → run-app-logs-command-CnW8I5a0.cjs} +3 -3
- package/dist/chunks/run-app-operation-CBy4X1VK.cjs +1 -0
- package/dist/chunks/{run-app-plan-command-DcjgbzTy.cjs → run-app-plan-command-Cuz9v8Db.cjs} +1 -1
- package/dist/chunks/run-app-publish-command-DACw_WFa.cjs +1 -0
- package/dist/chunks/{run-app-pull-command-B-hxnqvY.cjs → run-app-pull-command-CNbC_iZs.cjs} +3 -3
- package/dist/chunks/run-app-translations-extract-command-BZEJppmw.cjs +2 -0
- package/dist/chunks/{run-app-typecheck-command-D2Po43IB.cjs → run-app-typecheck-command-BHFWyv_1.cjs} +1 -1
- package/dist/chunks/{run-app-uninstall-command-DXyjeBwO.cjs → run-app-uninstall-command-DvBgm_4t.cjs} +1 -1
- package/dist/chunks/run-auth-login-command-DmnIxGG3.cjs +1 -0
- package/dist/chunks/{run-auth-logout-command-ChrdwI-r.cjs → run-auth-logout-command-BMpq04ml.cjs} +1 -1
- package/dist/chunks/run-auth-status-command-2Xrg0AoZ.cjs +1 -0
- package/dist/chunks/{run-cli-BoGzN25b.cjs → run-cli-BoGVmb1j.cjs} +6 -6
- package/dist/chunks/run-commands-command-DZkaWdQm.cjs +2 -0
- package/dist/chunks/{run-data-get-command-DFE4NM2R.cjs → run-data-get-command-BE6hUvWQ.cjs} +1 -1
- package/dist/chunks/run-data-list-command-CVubWAFh.cjs +1 -0
- package/dist/chunks/{run-doctor-command-Bj2UR9ai.cjs → run-doctor-command-OCHUN5AA.cjs} +2 -2
- package/dist/chunks/run-local-logs-command-CkZln0BN.cjs +1 -0
- package/dist/chunks/run-local-reset-command-B5UrKkAf.cjs +2 -0
- package/dist/chunks/run-local-start-command-Cp8nzjc6.cjs +1 -0
- package/dist/chunks/{run-local-status-command-ClvEgxcU.cjs → run-local-status-command-E3cpSfTu.cjs} +1 -1
- package/dist/chunks/run-local-stop-command-Cr3oAzQ9.cjs +1 -0
- package/dist/chunks/run-local-upgrade-command-Ch5AvQjt.cjs +1 -0
- package/dist/chunks/run-metadata-field-describe-command-Bof9tzyG.cjs +3 -0
- package/dist/chunks/{run-metadata-field-list-command-YCsoqOo1.cjs → run-metadata-field-list-command-C2AxyLJH.cjs} +1 -1
- package/dist/chunks/{run-metadata-object-describe-command-DpTobKR3.cjs → run-metadata-object-describe-command-CEh8rVCs.cjs} +1 -1
- package/dist/chunks/{run-metadata-object-list-command-BnSIIMDP.cjs → run-metadata-object-list-command-4qWTuJlm.cjs} +1 -1
- package/dist/chunks/run-open-command-BWRHlLfS.cjs +1 -0
- package/dist/chunks/{run-remote-list-command-0f2QIf8C.cjs → run-remote-list-command-C2tZHRAT.cjs} +1 -1
- package/dist/chunks/{run-remote-remove-command-ClFB0Ub7.cjs → run-remote-remove-command-Dc0XJydM.cjs} +1 -1
- package/dist/chunks/{run-remote-rename-command-BVUcpZxq.cjs → run-remote-rename-command-3AzuENYT.cjs} +1 -1
- package/dist/chunks/{run-remote-use-command-ByRTqnq5.cjs → run-remote-use-command-BKVP65QI.cjs} +1 -1
- package/dist/chunks/{run-version-command-_9OGraNf.cjs → run-version-command-BZ_R0Tss.cjs} +1 -1
- package/dist/chunks/select-target-Ck9mdMLQ.cjs +1 -0
- package/dist/chunks/sign-in-to-remote-again-DN6ov5o2.cjs +1 -0
- package/dist/chunks/sign-in-with-browser-DXd6hkJk.cjs +124 -0
- package/dist/chunks/standard-object-fields.constant-2yLND0Cg.cjs +1 -0
- package/dist/chunks/to-public-target-BltDNpJN.cjs +1 -0
- package/dist/chunks/to-worker-output-diagnostics-DlISjOqp.cjs +2 -0
- package/dist/chunks/{typecheck-application-BYPGp8lW.cjs → typecheck-application-8A504oUF.cjs} +1 -1
- package/dist/chunks/{update-config-ClCVH3C5.cjs → update-config-Bk0qgzgZ.cjs} +1 -1
- package/dist/chunks/wait-for-local-environment-BmOFeICJ.cjs +1 -0
- package/dist/chunks/write-config-atomically-B6XQJ6XK.cjs +1 -0
- package/dist/cli.cjs +1 -1
- package/package.json +2 -2
- package/src/app/pull/README.md +1 -1
- package/src/app/source/README.md +1 -1
- package/dist/chunks/application-T4xvzjbB.cjs +0 -5
- package/dist/chunks/build-source-manifest-tGYOCdor.cjs +0 -2
- package/dist/chunks/build-source-snapshot-CzwiB8HK.cjs +0 -26
- package/dist/chunks/collect-translatable-strings-BB6KpZT2.cjs +0 -1
- package/dist/chunks/collect-watch-inputs-Dn6g1cNu.cjs +0 -1
- package/dist/chunks/compile-application-translations-S-xuODkF.cjs +0 -870
- package/dist/chunks/constants-Bw_pUpSi-BsJPlw-e.cjs +0 -55
- package/dist/chunks/convert-to-label-CbLHl7Lv.cjs +0 -1
- package/dist/chunks/create-http-status-error-DBUhBnxP.cjs +0 -1
- package/dist/chunks/create-metadata-client-wHecaKNL.cjs +0 -6
- package/dist/chunks/create-pull-base-write-BZnZwrLk.cjs +0 -1
- package/dist/chunks/create-rest-client-B-kdRm7C.cjs +0 -1
- package/dist/chunks/extract-manifest-from-file-CNGCZF6o.cjs +0 -1
- package/dist/chunks/extract-source-translations-BHWNS2e9.cjs +0 -1
- package/dist/chunks/fetch-workspace-or-throw-CBKYiJI0.cjs +0 -1
- package/dist/chunks/format-body-C7fmVDAZ.cjs +0 -1
- package/dist/chunks/format-data-value-DuQjxLye.cjs +0 -1
- package/dist/chunks/format-metadata-fields-DPClLlzD.cjs +0 -2
- package/dist/chunks/format-metadata-owner-ffrpq9D6.cjs +0 -1
- package/dist/chunks/format-progress-line-Cj65-DU5.cjs +0 -1
- package/dist/chunks/generate-application-client-DjE_Tp0M.cjs +0 -1
- package/dist/chunks/get-function-input-schema-GNk3NRLJ-DscBUsKy.cjs +0 -1
- package/dist/chunks/get-local-status-D52rgA2e.cjs +0 -1
- package/dist/chunks/get-system-view-universal-identifier.util-DgYnPEO1-CKEQWit5.cjs +0 -1
- package/dist/chunks/is-access-token-expiring-Cin0OQ-E.cjs +0 -1
- package/dist/chunks/is-application-not-found-error-BAsQDAoQ.cjs +0 -1
- package/dist/chunks/is-exported-manifest-COVWXnDs.cjs +0 -1
- package/dist/chunks/is-locale-catalog-D0wFrW8f.cjs +0 -1
- package/dist/chunks/is-supported-locale-C33Of85N.cjs +0 -1
- package/dist/chunks/is-valid-package-name-CfHS8_Lr.cjs +0 -1
- package/dist/chunks/kebab-case-D0usAzG-.cjs +0 -1
- package/dist/chunks/locale-catalog-format-Cg9YplKA.cjs +0 -20
- package/dist/chunks/metadata-Db5EuDpT.cjs +0 -1
- package/dist/chunks/parse-api-url-jHzjLWX1.cjs +0 -1
- package/dist/chunks/parse-app-export-Dnu8mFrS.cjs +0 -1
- package/dist/chunks/parse-extraction-locale-h0bmy8hf.cjs +0 -1
- package/dist/chunks/parse-graphql-response-BSRJqolm.cjs +0 -1
- package/dist/chunks/parse-json-input-CN9Wyj73.cjs +0 -1
- package/dist/chunks/print-typescript-value-BsjFUceV.cjs +0 -3
- package/dist/chunks/pull-minimum-sdk-version.constant-BxmmUfee.cjs +0 -6
- package/dist/chunks/pull-source-BPng2lln.cjs +0 -1
- package/dist/chunks/read-app-identity-yX9-Ylxj.cjs +0 -1
- package/dist/chunks/read-application-identifier-DuI_jnU7.cjs +0 -1
- package/dist/chunks/read-application-identity-BFQ0oOna.cjs +0 -1
- package/dist/chunks/read-bounded-body-BHRu5J2Y.cjs +0 -1
- package/dist/chunks/read-config-DdGLulo-.cjs +0 -1
- package/dist/chunks/read-infer-deletion-option-uFunybak.cjs +0 -8
- package/dist/chunks/read-json-object-DcNHNB8I.cjs +0 -1
- package/dist/chunks/read-local-container-CPiVE1-D.cjs +0 -1
- package/dist/chunks/read-snapshot-file-BPLzlSH_.cjs +0 -1
- package/dist/chunks/record-pull-base-RQ2mlIWr.cjs +0 -1
- package/dist/chunks/request-oauth-tokens-Bp2eRh4F.cjs +0 -1
- package/dist/chunks/resolve-app-project-aqOLK3Gb.cjs +0 -1
- package/dist/chunks/resolve-command-target-D4gMeXgA.cjs +0 -1
- package/dist/chunks/resolve-inside-sdk-Ca2uRzQW.cjs +0 -1
- package/dist/chunks/resolve-metadata-object-xK90Ursp.cjs +0 -1
- package/dist/chunks/resolve-project-typescript-DkwXiCmt.cjs +0 -1
- package/dist/chunks/resolve-request-url-I1EOOumy.cjs +0 -1
- package/dist/chunks/resolve-source-sdk-CggXRBVx.cjs +0 -1
- package/dist/chunks/run-api-graphql-command-C3sJMP8H.cjs +0 -1
- package/dist/chunks/run-api-rest-command-DQOP-cn8.cjs +0 -1
- package/dist/chunks/run-app-build-command-CaInzuD2.cjs +0 -2
- package/dist/chunks/run-app-exec-command-DMHS9gpq.cjs +0 -3
- package/dist/chunks/run-app-generate-client-command-Ddq9lT40.cjs +0 -2
- package/dist/chunks/run-app-install-command-DUB3JTon.cjs +0 -1
- package/dist/chunks/run-app-operation-KdXiXPb6.cjs +0 -1
- package/dist/chunks/run-app-publish-command-DEV9zgL1.cjs +0 -1
- package/dist/chunks/run-app-translations-extract-command-C0OfqFii.cjs +0 -2
- package/dist/chunks/run-auth-login-command-CVLvoJ7G.cjs +0 -1
- package/dist/chunks/run-auth-status-command-X0m6rzI-.cjs +0 -1
- package/dist/chunks/run-commands-command-hMdnwU8-.cjs +0 -2
- package/dist/chunks/run-data-list-command-BMEzitv6.cjs +0 -1
- package/dist/chunks/run-local-logs-command-mUwB2XdV.cjs +0 -1
- package/dist/chunks/run-local-reset-command-WooW50PQ.cjs +0 -2
- package/dist/chunks/run-local-start-command-CiXP155w.cjs +0 -1
- package/dist/chunks/run-local-stop-command-BuV_YdJ7.cjs +0 -1
- package/dist/chunks/run-local-upgrade-command--O_EiVZc.cjs +0 -1
- package/dist/chunks/run-metadata-field-describe-command-iEw4KqIg.cjs +0 -3
- package/dist/chunks/run-open-command-DWLQ7z_P.cjs +0 -1
- package/dist/chunks/select-target-BHGEOc55.cjs +0 -1
- package/dist/chunks/sign-in-to-remote-again-DF27JFsz.cjs +0 -1
- package/dist/chunks/sign-in-with-browser-BNG4oa7e.cjs +0 -124
- package/dist/chunks/to-public-target-D00so1uO.cjs +0 -1
- package/dist/chunks/to-worker-output-diagnostics-WZlUWvcj.cjs +0 -2
- package/dist/chunks/utils-Ds_lD5Ag-DfSfzJJP.cjs +0 -11
- package/dist/chunks/wait-for-local-environment-CjCRJnhK.cjs +0 -1
- package/dist/chunks/write-config-atomically-CQdFdvWo.cjs +0 -1
- /package/dist/chunks/{capitalize-DFPVt1IM-CF4z3TZK.cjs → capitalize-CF4z3TZK.cjs} +0 -0
- /package/dist/chunks/{isDefined-Dtu5EYqP-CJctgvfE.cjs → isDefined-CJctgvfE.cjs} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-mLOUI7ql.cjs"),t=require("./build--4zYt4wd.cjs"),n=require("./isDefined-CJctgvfE.cjs"),r=require("./isPlainObject-fJEJm71P.cjs"),i=require("./cli-error-CrUD8uMp.cjs"),a=require("./read-command-values-rGaU2qHz.cjs"),o=require("./create-cancelled-error-BBhAY8fS.cjs"),s=require("./is-interaction-allowed-BQLOG8RG.cjs"),c=require("./style-BR52fK4V.cjs"),l=require("./with-phase-details-CRqY0f3c.cjs"),u=require("./to-cli-error-4pSpVaW9.cjs"),d=require("./create-metadata-client-oO0QvH6j.cjs"),f=require("./read-snapshot-file-D-s1kuCP.cjs"),p=require("./run-app-operation-CBy4X1VK.cjs"),m=require("./to-public-target-BltDNpJN.cjs"),h=require("./resolve-command-target-CwC9p_NB.cjs"),g=require("./execa-CAd0sJ7f.cjs");let _=require("node:fs/promises"),v=require("node:path"),y=require("node:fs");var b=`dependencies/yarn.lock`,x=t.t(),S=async({packedApp:e,context:{target:t,signal:a,output:o}})=>{let s=`prepare-upload`,c=[],p;try{a.throwIfAborted();let{size:n}=await(0,_.stat)(e.path),l=d.t({target:t,signal:a}),u=(await l.mutation({__name:`CreateAppTarballUpload`,createFileUpload:{__args:{filename:(0,v.basename)(e.path),size:n,fileFolder:`AppTarball`},fileId:!0,uploadUrl:!0,contentType:!0}})).createFileUpload;if(!r.t(u)||!(0,x.isNonEmptyString)(u.fileId)||!(0,x.isNonEmptyString)(u.uploadUrl)||!(0,x.isNonEmptyString)(u.contentType))throw new i.t({code:`INVALID_RESPONSE`,message:`The server returned an invalid tarball upload target.`});p=u.fileId,c.push(s),s=`upload`,o.progress({message:`Uploading ${e.name}@${e.version} to ${t.apiUrl}…`});let h=await f.r({uploadUrl:u.uploadUrl,contentType:u.contentType,bytes:await(0,y.openAsBlob)(e.path),signal:a});if(h<200||h>=300)throw new i.t({code:`UPLOAD_FAILED`,message:`File storage answered ${h}.`});c.push(s),a.throwIfAborted(),o.progress({message:`Registering the uploaded app…`}),s=`register`;let g=(await l.mutation({__name:`CompleteAppTarballUpload`,completeAppTarballUpload:{__args:{fileId:p},id:!0,name:!0,universalIdentifier:!0}})).completeAppTarballUpload;if(!r.t(g)||!(0,x.isNonEmptyString)(g.id)||!(0,x.isNonEmptyString)(g.name)||!(0,x.isNonEmptyString)(g.universalIdentifier))throw new i.t({code:`INVALID_RESPONSE`,message:`The server did not return the published app registration.`});return c.push(s),{target:`private`,registry:m.t(t),name:e.name,version:e.version,registration:g,fileId:p,installed:!1}}catch(e){let r=l.t({error:u.t(e,a),phase:s,completedPhases:c,outcome:s===`register`?`unknown`:`not-published`,hint:s===`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 i.t({cause:r,code:r.code,exitCode:r.exitCode,message:r.message,hint:r.hint,details:{...r.details,...n.t(p)?{fileId:p}:{},registry:m.t(t)}})}},C=e.r(g.t()),w=async({args:e,appPath:t,signal:r,canInteract:a=!1,onOutput:s})=>{r.throwIfAborted();let c=(0,C.default)(`npm`,e,{cwd:t,stdio:a?`inherit`:[`ignore`,`pipe`,`pipe`],reject:!1,maxBuffer:4*1024*1024}),l=()=>c.kill(`SIGTERM`,{forceKillAfterTimeout:1e3});r.addEventListener(`abort`,l,{once:!0}),r.aborted&&l();try{let t=await c;if(r.aborted)throw o.t();if(!a&&n.t(s)&&((0,x.isNonEmptyString)(t.stdout)&&s(t.stdout),(0,x.isNonEmptyString)(t.stderr)&&s(t.stderr)),t.failed)throw new i.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:t.exitCode,stdout:t.stdout?.slice(-16384)??``,stderr:t.stderr?.slice(-16384)??``}});return t.stdout??``}finally{r.removeEventListener(`abort`,l)}},T=async({packedApp:e,appPath:t,tag:r,context:i})=>{let a=n.t(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 w({args:[`publish`,e.path,`--access`,`public`,`--ignore-scripts`,`--workspaces=false`,...a?[`--provenance`]:[],...n.t(r)?[`--tag`,r]:[]],appPath:t,signal:i.signal,canInteract:s.t(i),...i.outputMode===`human`?{onOutput:e=>i.output.progress({message:e})}:{}}),{target:`npm`,name:e.name,version:e.version,...n.t(r)?{tag:r}:{}}},E=async e=>{let t=(0,v.join)(e,b);await(0,_.mkdir)((0,v.dirname)(t),{recursive:!0}),await(0,_.copyFile)((0,v.join)(e,`yarn.lock`),t)},D=e=>{let t;try{t=JSON.parse(e)}catch(e){throw new i.t({code:`PUBLISH_FAILED`,message:`npm pack returned invalid JSON.`,cause:e})}let n=(0,x.isArray)(t)&&t.length===1?t[0]:void 0;if(!r.t(n)||!(0,x.isNonEmptyString)(n.name)||!(0,x.isNonEmptyString)(n.version)||!(0,x.isNonEmptyString)(n.filename)||(0,v.basename)(n.filename)!==n.filename||n.filename.includes(`\\`)||!n.filename.endsWith(`.tgz`)||!(0,x.isArray)(n.files))throw new i.t({code:`PUBLISH_FAILED`,message:`npm pack returned an invalid package description.`});let a=n.files.map(e=>{if(!r.t(e)||!(0,x.isNonEmptyString)(e.path))throw new i.t({code:`PUBLISH_FAILED`,message:`npm pack returned an invalid package file.`});return{path:e.path}});return{name:n.name,version:n.version,filename:n.filename,files:a}},O=async({appPath:e,build:t,signal:n,output:r,usePackage:a})=>{let o=f.a({build:t,appPath:e});for(let e of t.files)n.throwIfAborted(),await f.t({snapshotDirectory:o,artifact:e});await E(o);let s=await(0,_.mkdtemp)((0,v.join)((0,v.dirname)(o),`package-`));try{r.progress({message:`Packing the built app…`});let c=D(await w({args:[`pack`,o,`--json`,`--ignore-scripts`,`--workspaces=false`,`--pack-destination`,s],appPath:e,signal:n})),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`),b],d=[...new Set(u)].filter(e=>!l.has(e));if(d.length>0)throw new i.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 n.throwIfAborted(),await a({path:(0,v.join)(s,c.filename),name:c.name,version:c.version})}finally{await(0,_.rm)(s,{recursive:!0,force:!0}).catch(()=>{r.warn({code:`PACKAGE_CLEANUP_FAILED`,message:`Could not remove temporary package folder ${s}.`})})}},k=async e=>{let t=a.r(e.options,`tag`),r=a.t(e.options,`private`);if(r&&n.t(t))throw new i.t({code:`INVALID_INPUT`,exitCode:i.n.USAGE,message:`--tag only applies to npm publishing.`});if(n.t(t)&&!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(t))throw new i.t({code:`INVALID_INPUT`,exitCode:i.n.USAGE,message:`Invalid npm tag: ${t}.`});if(!r&&n.t(a.r(e.options,`remote`)))throw new i.t({code:`INVALID_INPUT`,exitCode:i.n.USAGE,message:`npm publishing does not use a Twenty remote.`});let o=r?await h.t(e):void 0,s,{project:l,diagnostics:u}=await p.t({context:e,useHeldBuild:async({project:r,data:i})=>{s=await O({appPath:r.path,build:i,signal:e.signal,output:e.output,usePackage:async i=>n.t(o)?S({packedApp:i,context:{target:o,signal:e.signal,output:e.output}}):T({packedApp:i,appPath:r.path,tag:t,context:e})})}});if(!n.t(s))throw new i.t({code:`PUBLISH_FAILED`,message:`The build did not provide a package to publish.`});return{data:{app:{path:l.path,name:l.name},...s,diagnostics:u},human:c.o(`Published ${s.name}@${s.version} to ${o?.apiUrl??`npm`}${r?`. Existing installations may upgrade automatically.`:``}`)}};exports.runAppPublishCommand=k;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-mLOUI7ql.cjs"),t=require("./build--4zYt4wd.cjs"),n=require("./isDefined-
|
|
1
|
+
const e=require("./rolldown-runtime-mLOUI7ql.cjs"),t=require("./build--4zYt4wd.cjs"),n=require("./isDefined-CJctgvfE.cjs"),r=require("./isPlainObject-fJEJm71P.cjs"),i=require("./pull-minimum-sdk-version.constant-0v8yv93F.cjs"),a=require("./kebab-case-B3kq7ANN.cjs"),o=require("./cli-error-CrUD8uMp.cjs");require("./code-step-file-suffix.constant-B6vqrfcU.cjs");const s=require("./read-command-values-rGaU2qHz.cjs"),c=require("./create-cancelled-error-BBhAY8fS.cjs"),l=require("./confirm-in-terminal-D2e1lKUY.cjs"),u=require("./is-interaction-allowed-BQLOG8RG.cjs"),d=require("./style-BR52fK4V.cjs"),f=require("./to-worker-output-diagnostics-DlISjOqp.cjs"),p=require("./read-app-identity-DyMNXRhZ.cjs"),m=require("./resolve-app-project-B4IjfcM-.cjs"),h=require("./format-data-value-D_1TNU-r.cjs"),g=require("./require-approval-BIgPOy_r.cjs"),_=require("./fetch-workspace-or-throw-CGlqJOIG.cjs"),v=require("./is-valid-package-name-Bv-sKHlR.cjs"),y=require("./execa-CAd0sJ7f.cjs");let b=require("node:path");var x=e.r(y.t()),S=async({appPath:e,signal:t,output:n})=>{t.throwIfAborted(),n.progress({message:`Installing app dependencies with yarn install…`});let r=(0,x.default)(`yarn`,[`install`],{cwd:e,env:{...f.r(process.env),YARN_ENABLE_IMMUTABLE_INSTALLS:`false`,COREPACK_ENABLE_DOWNLOAD_PROMPT:`0`},extendEnv:!1,stdio:[`ignore`,`pipe`,`pipe`],reject:!1,maxBuffer:4*1024*1024}),i=()=>r.kill(`SIGTERM`,{forceKillAfterTimeout:1e3});t.addEventListener(`abort`,i,{once:!0}),t.aborted&&i();try{let n=await r;if(t.aborted)throw c.t();if(n.failed)throw new o.t({code:`APP_INIT_FAILED`,message:`Could not install dependencies for the new app.`,hint:[(n.stderr?.trim()||n.stdout?.trim()||``).slice(-4e3).split(`
|
|
2
2
|
`).map(h.r).join(`
|
|
3
3
|
`),`The project was created at ${h.r(e)}. Fix the installation error, run yarn install there, then run twenty app pull again.`].filter(Boolean).join(`
|
|
4
|
-
`),details:{path:e,exitCode:n.exitCode,stdout:n.stdout?.slice(-16384)??``,stderr:n.stderr?.slice(-16384)??``}})}finally{t.removeEventListener(`abort`,
|
|
5
|
-
`)},k=t.t(),A=e=>(0,k.isString)(e)&&
|
|
4
|
+
`),details:{path:e,exitCode:n.exitCode,stdout:n.stdout?.slice(-16384)??``,stderr:n.stderr?.slice(-16384)??``}})}finally{t.removeEventListener(`abort`,i)}},C=async({context:e,displayName:t})=>{let{options:r,signal:i,output:c}=e,d=u.t(e),f=a.t(t)||`workspace-app`,p=s.r(r,`path`);if(!n.t(p)&&d&&(p=(await l.n({question:`No Twenty app found. Directory for the workspace custom app [./${h.r(f)}]: `,signal:i})).trim()||f),!n.t(p))throw new o.t({code:`APP_PATH_REQUIRED`,exitCode:o.n.USAGE,message:`Choose a directory for the workspace custom application.`,hint:`Pass --path <new-or-empty-directory> --yes to create the project, install its dependencies and pull.`});let m=(0,b.resolve)(process.cwd(),p),_=a.t((0,b.basename)(m));if(!v.t(_))throw new o.t({code:`INVALID_APP_NAME`,exitCode:o.n.USAGE,message:`The directory name cannot be used as an app package name.`,hint:`Choose a directory such as workspace-app.`});return await g.t({isApproved:s.t(r,`yes`),canPrompt:d,question:`Create ${h.r(t)} in ${h.r(m)}, install its dependencies and pull?`,code:`CONFIRMATION_REQUIRED`,message:`Pull needs to create a local project and install its dependencies.`,hint:`Pass --yes to create the project and install its dependencies.`,declinedMessage:`Pull stopped before creating the project.`,signal:i}),c.progress({message:`Creating ${_} in ${h.r(m)}…`}),await v.n({appDirectory:m,appName:_,appDisplayName:t,appDescription:``,shouldIncludeExample:!1,signal:i}),await S({appPath:m,signal:i,output:c}),{path:m,name:_}},w=20,T=[{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`}],E=({title:e,relativePaths:t})=>t.length===0?[]:t.slice().sort().map(t=>` ${e.padEnd(13)}${t}`),D=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??``))},O=({writes:e,deletions:t,unchangedCount:r,skipped:i,coverage:a,localOnlyRelativePaths:o,unreadableRelativePaths:s=[],compiledTranslationEntryCountByLocale:c={},entityLabelByUniversalIdentifier:l={},verbose:u=!1})=>{let d=[...E({title:`written`,relativePaths:e.filter(e=>!e.isRegeneration).map(e=>e.relativePath)}),...E({title:`regenerated`,relativePaths:e.filter(e=>e.isRegeneration).map(e=>e.relativePath)}),...E({title:`deleted`,relativePaths:t.map(e=>e.relativePath)})];if(r>0&&d.push(` unchanged ${r} file(s)`),e.some(e=>e.relativePath.endsWith(`.code.ts`))&&d.push(``,`Workflow Code-step files contain workspace-authored code, read as text during pull and build.`),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 f=a.filter(e=>e.status===`EXPORTED`&&n.t(e.reason)).map(e=>` ${e.metadataName} ${l[e.universalIdentifier]??e.universalIdentifier}: ${e.reason}`).sort();if(f.length>0){let e=u?f:f.slice(0,w);d.push(``,`Written without their workspace-local state (${f.length} row(s)):`,...e),f.length>e.length&&d.push(` …and ${f.length-e.length} more, listed with --verbose`)}for(let e of T){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 D(t))if(d.push(` ${e.padEnd(34)}${String(r.length).padEnd(6)}${n??``}`.trimEnd()),u){for(let e of r.slice(0,w))d.push(` ${e}`);r.length>w&&d.push(` …and ${r.length-w} more`)}}}let p=Object.entries(c).filter(([,e])=>e>0).sort(([e],[t])=>e.localeCompare(t));return p.length>0&&d.push(``,`Translations kept in compiled form until their source strings are in this tree (see locales/compiled/):`,...p.map(([e,t])=>` ${e.padEnd(13)}${t} ${t===1?`entry`:`entries`}`)),d.join(`
|
|
5
|
+
`)},k=t.t(),A=e=>(0,k.isString)(e)&&i.n.some(t=>t===e),j=e=>r.t(e)&&(0,k.isString)(e.universalIdentifier)&&(0,k.isString)(e.relativePath),M=e=>r.t(e)&&(A(e.kind)||e.kind===`translation`||e.kind===`dependency`)&&(0,k.isBoolean)(e.isRegeneration)&&j(e),N=e=>r.t(e)&&A(e.kind)&&(0,k.isString)(e.universalIdentifier)&&(0,k.isString)(e.reason),P=e=>r.t(e)&&Object.values(e).every(k.isString),F=e=>r.t(e)&&Object.values(e).every(k.isNumber),I=e=>{if(!r.t(e)||!r.t(e.application)||!(0,k.isString)(e.application.universalIdentifier)||!(0,k.isString)(e.application.displayName)||!r.t(e.base)||!(0,k.isArray)(e.writes)||!e.writes.every(M)||!(0,k.isArray)(e.deletions)||!e.deletions.every(j)||!(0,k.isArray)(e.overwrittenLocalChanges)||!e.overwrittenLocalChanges.every(j)||!(0,k.isNumber)(e.unchangedCount)||!(0,k.isArray)(e.localOnlyRelativePaths)||!e.localOnlyRelativePaths.every(k.isString)||!(0,k.isArray)(e.unreadableRelativePaths)||!e.unreadableRelativePaths.every(k.isString)||!(0,k.isArray)(e.skipped)||!e.skipped.every(N)||!F(e.compiledTranslationEntryCountByLocale)||!P(e.entityLabelByUniversalIdentifier))return;let t=e.base.status;if(!(t!==`used`&&t!==`missing`&&t!==`other-target`&&t!==`unbound`&&t!==`unreadable`))return{data:{application:{universalIdentifier:e.application.universalIdentifier,displayName:e.application.displayName},base:{status:t},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}}},L=async e=>{let{options:t,target:r,signal:i,output:a,outputMode:c}=e,l=await m.t({explicitPath:s.r(t,`path`),workingDirectory:process.cwd()}).catch(e=>{if(!(e instanceof o.t&&[`APP_NOT_FOUND`,`APP_PATH_REQUIRED`].includes(e.code)))throw e}),u=n.t(l)?await p.t({appPath:l.path,signal:i,warn:a.warn}):{application:null,diagnostics:[]},g=await _.t({target:r,signal:i,shouldIncludeCustomApplication:!n.t(u.application)}),v=(u.application?.universalIdentifier??g.workspaceCustomApplication?.universalIdentifier)?.toLowerCase();if(!n.t(v))throw new o.t({code:`APP_NOT_FOUND`,message:`This workspace has no custom application to pull.`});a.progress({message:`Exporting the app from ${r.apiUrl}…`});let y=await _.n({universalIdentifier:v,target:r,signal:i,shouldIncludeDependencies:!0,shouldIncludeSourceFiles:!0});n.t(l)||(l=await C({context:e,displayName:y.application.displayName})),a.progress({message:`Reconciling local definitions. Changed workspace entities replace local edits…`});let b=await f.n({request:{type:`pull`,appPath:l.path,target:{apiUrl:r.apiUrl,workspaceId:g.id},applicationExport:y},signal:i}).catch(e=>{throw new o.t({code:e instanceof o.t?e.code:`PULL_FAILED`,exitCode:e instanceof o.t?e.exitCode:o.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 o.t?e.details:{},outcome:`unknown`}})}),x=f.s({value:b.result,parseData:I}),S=[...u.diagnostics,...x.diagnostics,...f.t(b.output)];if(c===`human`)for(let e of S)a.progress({message:f.c(e)});if(!x.success)throw new o.t({code:x.error.code===`CANCELLED`?`CANCELLED`:x.error.code===`SDK_SOURCE_UNSUPPORTED`?`SDK_SOURCE_UNSUPPORTED`:`PULL_FAILED`,exitCode:x.error.code===`CANCELLED`?o.n.CANCELLED:o.n.FAILURE,message:x.error.message,hint:x.error.hint??(x.error.code===`SDK_SOURCE_UNSUPPORTED`?`Upgrade the app to a compatible twenty-sdk version (2.50.0 or later).`:void 0),details:{...x.error.details,diagnostics:S}});let w=x.data;(w.skipped.length>0||w.unreadableRelativePaths.length>0||y.coverage.some(e=>![`EXPORTED`,`ENGINE_DERIVED`].includes(e.status)))&&a.warn({code:`PULL_INCOMPLETE`,message:`Some entities could not be written. See coverage, skipped entities and unreadable files in the pull report.`});let T=O({...w,writes:w.writes.map(e=>({...e,relativePath:h.r(e.relativePath)})),deletions:w.deletions.map(e=>({...e,relativePath:h.r(e.relativePath)})),skipped:w.skipped.map(e=>({...e,reason:h.r(e.reason)})),localOnlyRelativePaths:w.localOnlyRelativePaths.map(h.r),unreadableRelativePaths:w.unreadableRelativePaths.map(h.r),entityLabelByUniversalIdentifier:Object.fromEntries(Object.entries(w.entityLabelByUniversalIdentifier).map(([e,t])=>[e,h.r(t)])),coverage:y.coverage.map(e=>({...e,metadataName:h.r(e.metadataName),universalIdentifier:h.r(e.universalIdentifier),reason:e.reason===null?null:h.r(e.reason)})),verbose:s.t(t,`verbose`)}),E=y.coverage.filter(e=>![`EXPORTED`,`UNSUPPORTED`,`FOREIGN_OWNED`,`EXCLUDED`,`ENGINE_DERIVED`].includes(e.status));return{data:{app:{path:l.path,name:l.name},...w,pulled:!0,coverage:y.coverage,diagnostics:S},human:[d.o(`Pulled ${h.r(w.application.displayName)} into ${h.r(l.path)}`),T,...w.base.status===`used`?[]:[`No matching pull base (${w.base.status}); local-only definitions were kept.`],...w.overwrittenLocalChanges.length>0?[`Local edits replaced by workspace changes:`,...w.overwrittenLocalChanges.map(e=>` ${h.r(e.relativePath)}`)]:[],...E.length>0?[`Unrecognized coverage, not written:`,...E.map(e=>` ${h.r(e.metadataName)} ${h.r(e.status)}: ${h.r(e.reason)}`)]:[],...w.writes.some(e=>e.kind===`dependency`)?[`Run ${d.r(`yarn install`)} to install the pulled dependencies.`]:[],`Run ${d.r(`twenty app typecheck`)} to check the generated definitions.`].filter(Boolean).join(`
|
|
6
6
|
`)}};exports.runAppPullCommand=L;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./build--4zYt4wd.cjs"),t=require("./isPlainObject-fJEJm71P.cjs"),n=require("./resolve-source-sdk-C4Hu045V.cjs"),r=require("./parse-extraction-locale-B0apfizg.cjs"),i=require("./read-command-values-rGaU2qHz.cjs"),a=require("./style-BR52fK4V.cjs"),o=require("./to-worker-output-diagnostics-DlISjOqp.cjs"),s=require("./resolve-app-project-B4IjfcM-.cjs"),c=require("./create-tooling-failure-0Foyei1R.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.s({value:_.result,parseData:e=>{if(!(!t.t(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.c(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
|
+
`)}};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-CBy4X1VK.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-CrUD8uMp.cjs"),t=require("./read-command-values-rGaU2qHz.cjs"),n=require("./is-interaction-allowed-BQLOG8RG.cjs"),r=require("./style-BR52fK4V.cjs"),i=require("./with-phase-details-CRqY0f3c.cjs"),a=require("./to-cli-error-4pSpVaW9.cjs"),o=require("./is-application-not-found-error-
|
|
1
|
+
const e=require("./cli-error-CrUD8uMp.cjs"),t=require("./read-command-values-rGaU2qHz.cjs"),n=require("./is-interaction-allowed-BQLOG8RG.cjs"),r=require("./style-BR52fK4V.cjs"),i=require("./with-phase-details-CRqY0f3c.cjs"),a=require("./to-cli-error-4pSpVaW9.cjs"),o=require("./is-application-not-found-error-CQ7k4hGU.cjs"),s=require("./create-metadata-client-oO0QvH6j.cjs"),c=require("./format-data-value-D_1TNU-r.cjs"),l=require("./require-approval-BIgPOy_r.cjs"),u=require("./create-app-not-installed-error-sN4TzjlV.cjs"),d=require("./read-application-identifier-hrv6xLTN.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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./isDefined-CJctgvfE.cjs"),t=require("./cli-error-CrUD8uMp.cjs"),n=require("./parse-api-url-B5c0Gh_n.cjs"),r=require("./read-command-values-rGaU2qHz.cjs"),i=require("./read-input-value-CzJsE62r.cjs"),a=require("./is-interaction-allowed-BQLOG8RG.cjs"),o=require("./style-BR52fK4V.cjs"),s=require("./get-config-path-C-D-QHuX.cjs"),c=require("./read-config-6GnzcpJm.cjs"),l=require("./api-key-stdin-hint.constant-BTPNgm3m.cjs"),u=require("./sign-in-with-browser-DXd6hkJk.cjs"),d=require("./update-config-Bk0qgzgZ.cjs"),f=require("./validate-remote-name-ZWOgVe80.cjs"),p=require("./fetch-signed-in-identity-GVHuJKXy.cjs");var 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:l.t});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:l.t});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.t(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 u.t({apiUrl:n,output:i,signal:s})}},v=({remoteName:t,apiUrl:n,credentials:r,identity:i})=>{let a=e.t(i.workspaceName)?` · workspace ${i.workspaceName}`:``;return r.kind===`apiKey`?`Saved remote "${t}" ${o.i(`(${n}) · API key${a}`)}`:`Signed in to "${t}"${e.t(i.email)?` as ${i.email}`:``}${o.i(a)}`},y=async({options:i,output:a,outputMode:l,signal:m})=>{let y=r.r(i,`name`)??r.r(i,`remote`),b=f.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.t(T)&&!e.t(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.t(y)?`Pass --url to create it.`:`Run twenty auth login --url <url> to save a connection.`});let E=e.t(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:l,signal:m}),O=await p.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 d.t({configPath:S,signal:m,update:t=>{let n=h(t,b);g({existingRemote:n,remoteName:b,apiUrl:E,replace:x});let a=e.t(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]:{...u.n({remote:n??{apiUrl:E},credentials:D}),apiUrl:E,...e.t(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-ChrdwI-r.cjs → run-auth-logout-command-BMpq04ml.cjs}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./cli-error-CrUD8uMp.cjs"),t=require("./read-command-values-rGaU2qHz.cjs"),n=require("./target-environment-variable.constant-D7z8AihP.cjs"),r=require("./style-BR52fK4V.cjs"),i=require("./select-target-
|
|
1
|
+
const e=require("./cli-error-CrUD8uMp.cjs"),t=require("./read-command-values-rGaU2qHz.cjs"),n=require("./target-environment-variable.constant-D7z8AihP.cjs"),r=require("./style-BR52fK4V.cjs"),i=require("./select-target-Ck9mdMLQ.cjs"),a=require("./get-config-path-C-D-QHuX.cjs"),o=require("./read-config-6GnzcpJm.cjs"),s=require("./find-remote-TcvVyJpy.cjs"),c=require("./get-credential-kind-qxy7oLdW.cjs"),l=require("./update-config-Bk0qgzgZ.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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./isDefined-CJctgvfE.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-6GnzcpJm.cjs"),o=require("./is-access-token-expiring-BvJhEqtV.cjs"),s=require("./fetch-signed-in-identity-GVHuJKXy.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.t(l.remoteName)&&(await a.t(i.t())).defaultRemote===l.remoteName,m=l.credentialKind===`oauth`?o.t(l.bearerToken):void 0,h=e.t(l.remoteName)?`${l.remoteName}${p?n.i(` (default)`):``}`:n.i(`none, using ${t.t.API_URL} and ${t.t.API_KEY}`),g=e.t(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.t(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.t(m)?`${_} ${n.i(`· renews itself, current token expires in ${u(m)}`)}`:_]])}};exports.runAuthStatusCommand=d;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-mLOUI7ql.cjs"),t=require("./build--4zYt4wd.cjs"),n=require("./
|
|
2
|
-
`)?t:`${t}\n`)},be=({mode:e})=>{let t=!1,
|
|
3
|
-
`),Se=e=>!
|
|
1
|
+
const e=require("./rolldown-runtime-mLOUI7ql.cjs"),t=require("./build--4zYt4wd.cjs"),n=require("./isDefined-CJctgvfE.cjs"),r=require("./isPlainObject-fJEJm71P.cjs"),i=require("./isNonEmptyArray-v52xg4Xj.cjs"),a=require("./capitalize-CF4z3TZK.cjs"),o=require("./cli-error-CrUD8uMp.cjs"),s=require("./read-command-values-rGaU2qHz.cjs"),c=require("./is-interaction-allowed-BQLOG8RG.cjs"),l=require("./style-BR52fK4V.cjs"),u=require("./to-cli-error-4pSpVaW9.cjs"),d=require("./cli-version.constant-jomCqLLP.cjs"),f=require("./format-progress-line-BoU0vHbc.cjs"),p=require("./to-public-target-BltDNpJN.cjs"),m=require("./resolve-command-target-CwC9p_NB.cjs"),h=require("./api-key-stdin-hint.constant-BTPNgm3m.cjs"),g=require("./global-flags.constant-DooTv_Uq.cjs");let ee=require("node:events"),_=require("node:readline");var v=t.t();function te({onlyFirst:e=!1}={}){return RegExp(`(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`,e?void 0:`g`)}var ne=te();function re(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes(`\x1B`)&&!e.includes(``)?e:e.replace(ne,``)}var y=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],b=[12288,12288,65281,65376,65504,65510],x=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],S=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],C=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],w=(e,t)=>{let n=0,r=Math.floor(e.length/2)-1;for(;n<=r;){let i=Math.floor((n+r)/2),a=i*2;if(t<e[a])r=i-1;else if(t>e[a+1])n=i+1;else return!0}return!1},ie=y[0],ae=y.at(-1),oe=b[0],se=b.at(-1);x[0],x.at(-1),S[0],S.at(-1);var ce=C[0],le=C.at(-1),T=19968,[ue,de]=fe(C);function fe(e){let t=e[0],n=e[1];for(let r=0;r<e.length;r+=2){let i=e[r],a=e[r+1];if(T>=i&&T<=a)return[i,a];a-i>n-t&&(t=i,n=a)}return[t,n]}var pe=e=>e<ie||e>ae?!1:w(y,e),me=e=>e<oe||e>se?!1:w(b,e),he=e=>e>=ue&&e<=de?!0:e<ce||e>le?!1:w(C,e);function ge(e){if(!Number.isSafeInteger(e))throw TypeError(`Expected a code point, got \`${typeof e}\`.`)}function E(e,{ambiguousAsWide:t=!1}={}){return ge(e),me(e)||he(e)||t&&pe(e)?2:1}var _e=new Intl.Segmenter,ve=/^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{Mark}|\p{Surrogate})+$/v,ye=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v,D=/^\p{RGI_Emoji}$/v,O=/^[\d#*]\u20E3$/,k=/\p{Extended_Pictographic}/gu;function A(e){if(e.length>50)return!1;if(O.test(e))return!0;if(e.includes(``)){let t=e.match(k);return t!==null&&t.length>=2}return!1}function j(e){return e.replace(ye,``)}function M(e){return ve.test(e)}function N(e,t){let n=0;if(e.length>1)for(let r of e.slice(1))r>=``&&r<=``&&(n+=E(r.codePointAt(0),t));return n}function P(e,t={}){if(typeof e!=`string`||e.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:r=!1}=t,i=e;if(!r&&(i.includes(`\x1B`)||i.includes(``))&&(i=re(i)),i.length===0)return 0;if(/^[\u0020-\u007E]*$/.test(i))return i.length;let a=0,o={ambiguousAsWide:!n};for(let{segment:e}of _e.segment(i)){if(M(e))continue;if(D.test(e)||A(e)){a+=2;continue}let t=j(e).codePointAt(0);a+=E(t,o),a+=N(e,o)}return a}var F=({stream:e,text:t})=>{e.write(t.endsWith(`
|
|
2
|
+
`)?t:`${t}\n`)},be=({mode:e})=>{let t=!1,r=()=>{t&&=((0,_.cursorTo)(process.stderr,0),(0,_.clearLine)(process.stderr,0),!1)};return{write:({message:i,percentage:a})=>{let o=n.t(a)?`${a}%`:``,s=Math.min(20,(process.stderr.columns??80)-P(i)-o.length-5);if(r(),e!==`human`||!process.stderr.isTTY||c.n()||process.env.TERM===`dumb`||!n.t(a)||!Number.isFinite(a)||s<4){F({stream:process.stderr,text:f.t({message:i,percentage:a})});return}let l=Math.round(Math.min(100,Math.max(0,a))/100*s),u=`█`.repeat(l)+`░`.repeat(s-l);process.stderr.write(`${i} ${u} ${o}`),t=!0},clear:r}},xe=e=>e.map(({metadataName:e,entityLabel:t,message:r,userFriendlyMessage:i})=>{let a=(0,v.isNonEmptyString)(i)&&i!==r?`${i} (${r})`:r;return`• ${e}${n.t(t)?` ${t}`:``}: ${a}`}).join(`
|
|
3
|
+
`),Se=e=>!n.t(e)||!(0,v.isArray)(e.validationErrors)?[]:e.validationErrors.filter(e=>r.t(e)&&(0,v.isString)(e.metadataName)&&(0,v.isString)(e.message)),Ce=async(e,t)=>{t.throwIfAborted(),process.stdout.write(`${JSON.stringify(e)}\n`)||await(0,ee.once)(process.stdout,`drain`,{signal:t}),t.throwIfAborted()},I=e=>{F({stream:process.stdout,text:JSON.stringify(e)})},L=e=>e.split(`
|
|
4
4
|
`).map(e=>(0,v.isNonEmptyString)(e)?` ${e}`:e).join(`
|
|
5
|
-
`),R=e=>
|
|
5
|
+
`),R=e=>n.t(e)?{target:e}:{},z=({mode:e,command:t})=>{let r=[],i=be({mode:e}),a=0,o=(e,n)=>{a+=1,I({schemaVersion:1,command:t,type:e,sequence:a,data:n})},s=()=>{for(let e of r)F({stream:process.stderr,text:l.s(e.message)})};return{event:async(n,r,i)=>{e===`ndjson`&&(a+=1,await Ce({schemaVersion:1,command:t,type:n,sequence:a,data:r},i))},progress:({message:t,percentage:n})=>{if(e===`ndjson`){o(`progress`,{message:t,percentage:n});return}i.write({message:t,percentage:n})},warn:t=>{if(i.clear(),e===`ndjson`){o(`warning`,t);return}r.push(t)},succeed:({data:n,human:a},c)=>{if(i.clear(),e===`json`){I({schemaVersion:1,ok:!0,command:t,...R(c),data:n,warnings:r});return}if(e===`ndjson`){o(`result`,n);return}let l=a??JSON.stringify(n,null,2);(0,v.isNonEmptyString)(l)&&F({stream:process.stdout,text:l}),s()},fail:(a,c)=>{i.clear(),process.exitCode=a.exitCode;let u={code:a.code,message:a.message,...n.t(a.hint)?{hint:a.hint}:{},...n.t(a.details)?{details:a.details}:{}};if(e===`json`){I({schemaVersion:1,ok:!1,command:t,...R(c),error:u,warnings:r});return}if(e===`ndjson`){o(`error`,u);return}F({stream:process.stderr,text:l.a(a.message)});let d=Se(a.details);d.length>0&&F({stream:process.stderr,text:L(xe(d))}),n.t(a.hint)&&F({stream:process.stderr,text:L(a.hint)}),s()}}},B=`--format`,we=e=>e.reduce((t,n,r)=>n.startsWith(`${B}=`)?n.slice(9):n===B?e[r+1]:t,void 0),Te=e=>{let t=e.indexOf(`--`),n=t===-1?e:e.slice(0,t),r=we(n);return n.includes(`--json`)||r===`json`?`json`:r===`ndjson`?`ndjson`:`human`},V=class extends Error{commanderError;commandName;operands;options;constructor({commanderError:e,commandName:t,operands:n,options:r}){super(e.message),this.name=`CommandParseError`,this.commanderError=e,this.commandName=t,this.operands=n,this.options=r}},H=`twenty`,Ee=()=>{let e={standardOutput:``,standardError:``};return{captured:e,configuration:{writeOut:t=>{e.standardOutput+=t},writeErr:t=>{e.standardError+=t},outputError:t=>{e.standardError+=t}}}},U=e.t((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),W=e.t((e=>{var{InvalidArgumentError:t}=U(),n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),G=e.t((e=>{var{humanReadableArgName:t}=W(),n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
|
|
6
6
|
`)}displayWidth(e){return r(e).length}styleTitle(e){return e}styleUsage(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e===`[command]`?this.styleSubcommandText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleCommandText(e)).join(` `)}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleSubcommandText(e)).join(` `)}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,r){let i=` `.repeat(2);if(!n)return i+e;let a=e.padEnd(t+e.length-r.displayWidth(e)),o=(this.helpWidth??80)-t-2-2,s;return s=o<this.minWidthToWrap||r.preformatted(n)?n:r.boxWrap(n,o).replace(/\n/g,`
|
|
7
7
|
`+` `.repeat(t+2)),i+a+` `.repeat(2)+s.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
|
|
8
8
|
`)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),K=e.t((e=>{var{InvalidArgumentError:t}=U(),n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r!==void 0&&r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
|
|
@@ -20,5 +20,5 @@ Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._life
|
|
|
20
20
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
21
21
|
- ${t?`searched for local subcommand relative to directory '${t}'`:`no directory for search for local subcommand, use .executableDir() to supply a custom directory`}`;throw Error(r)}_executeSubCommand(e,t){t=t.slice();let o=!1,s=[`.js`,`.ts`,`.tsx`,`.mjs`,`.cjs`];function l(e,t){let n=r.resolve(e,t);if(i.existsSync(n))return n;if(s.includes(r.extname(t)))return;let a=s.find(e=>i.existsSync(`${n}${e}`));if(a)return`${n}${a}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||``;if(this._scriptPath){let e;try{e=i.realpathSync(this._scriptPath)}catch{e=this._scriptPath}d=r.resolve(r.dirname(e),d)}if(d){let t=l(d,u);if(!t&&!e._executableFile&&this._scriptPath){let n=r.basename(this._scriptPath,r.extname(this._scriptPath));n!==this._name&&(t=l(d,`${n}-${e._name}`))}u=t||u}o=s.includes(r.extname(u));let f;a.platform===`win32`?(this._checkForMissingExecutable(u,d,e._name),t.unshift(u),t=h(a.execArgv).concat(t),f=n.spawn(a.execPath,t,{stdio:`inherit`})):o?(t.unshift(u),t=h(a.execArgv).concat(t),f=n.spawn(a.argv[0],t,{stdio:`inherit`})):f=n.spawn(u,t,{stdio:`inherit`}),f.killed||[`SIGUSR1`,`SIGUSR2`,`SIGTERM`,`SIGINT`,`SIGHUP`].forEach(e=>{a.on(e,()=>{f.killed===!1&&f.exitCode===null&&f.kill(e)})});let p=this._exitCallback;f.on(`close`,e=>{e??=1,p?p(new c(e,`commander.executeSubCommandAsync`,`(close)`)):a.exit(e)}),f.on(`error`,t=>{if(t.code===`ENOENT`)this._checkForMissingExecutable(u,d,e._name);else if(t.code===`EACCES`)throw Error(`'${u}' not executable`);if(!p)a.exit(1);else{let e=new c(1,`commander.executeSubCommandAsync`,`(error)`);e.nestedError=t,p(e)}}),this.runningCommand=f}_dispatchSubcommand(e,t,n){let r=this._findCommand(e);r||this.help({error:!0}),r._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,r,`preSubcommand`),i=this._chainOrCall(i,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(n));else return r._parseCommand(t,n)}),i}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??`--help`])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(e,t,n)=>{let r=t;if(t!==null&&e.parseArg){let i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;r=this._callParseArg(e,t,n,i)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,r)=>{let i=n.defaultValue;n.variadic?r<this.args.length?(i=this.args.slice(r),n.parseArg&&(i=i.reduce((t,r)=>e(n,r,t),n.defaultValue))):i===void 0&&(i=[]):r<this.args.length&&(i=this.args[r],n.parseArg&&(i=e(n,i,n.defaultValue))),t[r]=i}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then==`function`?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,r=[];return this._getCommandAndAncestors().reverse().filter(e=>e._lifeCycleHooks[t]!==void 0).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{r.push({hookedCommand:e,callback:t})})}),t===`postAction`&&r.reverse(),r.forEach(e=>{n=this._chainOrCall(n,()=>e.callback(e.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let r=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(e=>{r=this._chainOrCall(r,()=>e(this,t))}),r}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let n;return n=this._chainOrCallHooks(n,`preAction`),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(i,e,t)})),n=this._chainOrCallHooks(n,`postAction`),n}if(this.parent?.listenerCount(i))r(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand(`*`))return this._dispatchSubcommand(`*`,e,t);this.listenerCount(`command:*`)?this.emit(`command:*`,e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(e=>{let t=e.attributeName();return this.getOptionValue(t)!==void 0&&this.getOptionValueSource(t)!=="default"});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let n=e.find(e=>t.conflictsWith.includes(e.attributeName()));n&&this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],r=t;function i(e){return e.length>1&&e[0]===`-`}let a=e=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(e)?!this._getCommandAndAncestors().some(e=>e.options.map(e=>e.short).some(e=>/^-\d$/.test(e))):!1,o=null,s=null,c=0;for(;c<e.length||s;){let l=s??e[c++];if(s=null,l===`--`){r===n&&r.push(l),r.push(...e.slice(c));break}if(o&&(!i(l)||a(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,i(l)){let t=this._findOption(l);if(t){if(t.required){let n=e[c++];n===void 0&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,n)}else if(t.optional){let n=null;c<e.length&&(!i(e[c])||a(e[c]))&&(n=e[c++]),this.emit(`option:${t.name()}`,n)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(l.length>2&&l[0]===`-`&&l[1]!==`-`){let e=this._findOption(`-${l[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,l.slice(2)):(this.emit(`option:${e.name()}`),s=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let e=l.indexOf(`=`),t=this._findOption(l.slice(0,e));if(t&&(t.required||t.optional)){this.emit(`option:${t.name()}`,l.slice(e+1));continue}}if(r===t&&i(l)&&!(this.commands.length===0&&a(l))&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(l)){t.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){r.push(l,...e.slice(c));break}r.push(l)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let t=this.options[n].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==`string`?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
22
22
|
`),this.outputHelp({error:!0}));let n=t||{},r=n.exitCode||1,i=n.code||`commander.error`;this._exit(r,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in a.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||[`default`,`config`,`env`].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,a.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new f(this.options),t=e=>this.getOptionValue(e)!==void 0&&![`default`,`implied`].includes(this.getOptionValueSource(e));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],`implied`)})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:`commander.missingArgument`})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:`commander.optionMissingArgument`})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:`commander.missingMandatoryOptionValue`})}_conflictingOption(e,t){let n=e=>{let t=e.attributeName(),n=this.getOptionValue(t),r=this.options.find(e=>e.negate&&t===e.attributeName()),i=this.options.find(e=>!e.negate&&t===e.attributeName());return r&&(r.presetArg===void 0&&n===!1||r.presetArg!==void 0&&n===r.presetArg)?r:i||e},r=e=>{let t=n(e),r=t.attributeName();return this.getOptionValueSource(r)===`env`?`environment variable '${t.envVar}'`:`option '${t.flags}'`},i=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(i,{code:`commander.conflictingOption`})}unknownOption(e){if(this._allowUnknownOption)return;let t=``;if(e.startsWith(`--`)&&this._showSuggestionAfterError){let n=[],r=this;do{let e=r.createHelp().visibleOptions(r).filter(e=>e.long).map(e=>e.long);n=n.concat(e),r=r.parent}while(r&&!r._enablePositionalOptions);t=p(e,n)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:`commander.unknownOption`})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?``:`s`,r=`error: too many arguments${this.parent?` for '${this.name()}'`:``}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:`commander.excessArguments`})}unknownCommand(){let e=this.args[0],t=``;if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(e=>{n.push(e.name()),e.alias()&&n.push(e.alias())}),t=p(e,n)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:`commander.unknownCommand`})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t||=`-V, --version`,n||=`output the version number`;let r=this.createOption(t,n);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on(`option:`+r.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,`commander.version`,e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw Error(`Command alias can't be the same as its name`);let n=this.parent?._findCommand(e);if(n){let t=[n.name()].concat(n.aliases()).join(`|`);throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(e=>s(e));return[].concat(this.options.length||this._helpOption!==null?`[options]`:[],this.commands.length?`[command]`:[],this.registeredArguments.length?e:[]).join(` `)}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??``:(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??``:(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??``:(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=r.basename(e,r.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let r=t.formatHelp(this,t);return n.hasColors?r:this._outputConfiguration.stripColor(r)}_getOutputContext(e){e||={};let t=!!e.error,n,r,i;return t?(n=e=>this._outputConfiguration.writeErr(e),r=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=e=>this._outputConfiguration.writeOut(e),r=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:t,write:e=>(r||(e=this._outputConfiguration.stripColor(e)),n(e)),hasColors:r,helpWidth:i}}outputHelp(e){let t;typeof e==`function`&&(t=e,e=void 0);let n=this._getOutputContext(e),r={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(e=>e.emit(`beforeAllHelp`,r)),this.emit(`beforeHelp`,r);let i=this.helpInformation({error:n.error});if(t&&(i=t(i),typeof i!=`string`&&!Buffer.isBuffer(i)))throw Error(`outputHelp callback must return a string or a Buffer`);n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit(`afterHelp`,r),this._getCommandAndAncestors().forEach(e=>e.emit(`afterAllHelp`,r))}helpOption(e,t){return typeof e==`boolean`?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??`-h, --help`,t??`display help for command`),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(a.exitCode??0);t===0&&e&&typeof e!=`function`&&e.error&&(t=1),this._exit(t,`commander.help`,`(outputHelp)`)}addHelpText(e,t){let n=[`beforeAll`,`before`,`after`,`afterAll`];if(!n.includes(e))throw Error(`Unexpected value for position to addHelpText.
|
|
23
|
-
Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function h(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function g(){if(a.env.NO_COLOR||a.env.FORCE_COLOR===`0`||a.env.FORCE_COLOR===`false`)return!1;if(a.env.FORCE_COLOR||a.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=m,e.useColor=g})),ke=e.t((e=>{var{Argument:t}=W(),{Command:n}=Oe(),{CommanderError:r,InvalidArgumentError:i}=U(),{Help:a}=G(),{Option:o}=K();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i})),{program:Ae,createCommand:je,createArgument:Me,createOption:Ne,CommanderError:Pe,InvalidArgumentError:Fe,InvalidOptionArgumentError:Ie,Command:Le,Argument:Re,Option:q,Help:ze}=e.r(ke(),1).default,Be=[{path:[`local`],description:`Run a local Twenty development environment`,helpGroup:g.a.APP,helpHint:`Runs Twenty, including its web UI, worker and databases. Requires a local Docker installation. Sign in afterward with twenty auth login.`},{path:[`app`],description:`Create, develop and manage applications`,helpGroup:g.a.APP},{path:[`app`,`translations`],description:`Manage app translation catalogs`},{path:[`data`],description:`Read workspace records`,helpGroup:g.a.WORKSPACE},{path:[`auth`],description:`Sign in and manage credentials`,helpGroup:g.a.WORKSPACE},{path:[`remote`],description:`Manage saved workspace connections`,helpGroup:g.a.WORKSPACE,helpHint:`Add a remote using browser sign-in or an API key. See: twenty auth login --help`,examples:g.o.examples},{path:[`metadata`],description:`Inspect the data model`,helpGroup:g.a.WORKSPACE},{path:[`metadata`,`object`],description:`Objects`},{path:[`metadata`,`field`],description:`Fields`},{path:[`api`],description:`Send raw REST and GraphQL requests`,helpGroup:g.a.WORKSPACE}],Ve=[`human`,`json`,`ndjson`],He=(e,t)=>t.reduce((e,t)=>e?.commands.find(e=>e.name()===t),e),J=(e,t)=>{let
|
|
24
|
-
`)}\n`,Ue=(e,t)=>{if(!e.outputModes.includes(t))throw new o.t({code:`USAGE`,exitCode:o.n.USAGE,message:`twenty ${g.n(e)} does not support ${t} output.`,hint:`Supported: ${e.outputModes.join(`, `)}`})},X=async({definition:e,outputMode:t,commandArguments:
|
|
23
|
+
Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function h(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function g(){if(a.env.NO_COLOR||a.env.FORCE_COLOR===`0`||a.env.FORCE_COLOR===`false`)return!1;if(a.env.FORCE_COLOR||a.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=m,e.useColor=g})),ke=e.t((e=>{var{Argument:t}=W(),{Command:n}=Oe(),{CommanderError:r,InvalidArgumentError:i}=U(),{Help:a}=G(),{Option:o}=K();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i})),{program:Ae,createCommand:je,createArgument:Me,createOption:Ne,CommanderError:Pe,InvalidArgumentError:Fe,InvalidOptionArgumentError:Ie,Command:Le,Argument:Re,Option:q,Help:ze}=e.r(ke(),1).default,Be=[{path:[`local`],description:`Run a local Twenty development environment`,helpGroup:g.a.APP,helpHint:`Runs Twenty, including its web UI, worker and databases. Requires a local Docker installation. Sign in afterward with twenty auth login.`},{path:[`app`],description:`Create, develop and manage applications`,helpGroup:g.a.APP},{path:[`app`,`translations`],description:`Manage app translation catalogs`},{path:[`data`],description:`Read workspace records`,helpGroup:g.a.WORKSPACE},{path:[`auth`],description:`Sign in and manage credentials`,helpGroup:g.a.WORKSPACE},{path:[`remote`],description:`Manage saved workspace connections`,helpGroup:g.a.WORKSPACE,helpHint:`Add a remote using browser sign-in or an API key. See: twenty auth login --help`,examples:g.o.examples},{path:[`metadata`],description:`Inspect the data model`,helpGroup:g.a.WORKSPACE},{path:[`metadata`,`object`],description:`Objects`},{path:[`metadata`,`field`],description:`Fields`},{path:[`api`],description:`Send raw REST and GraphQL requests`,helpGroup:g.a.WORKSPACE}],Ve=[`human`,`json`,`ndjson`],He=(e,t)=>t.reduce((e,t)=>e?.commands.find(e=>e.name()===t),e),J=(e,t)=>{let r=He(e,t);if(!n.t(r))throw Error(`Topic "${t.join(` `)}" is not registered.`);return r},Y=e=>`\nExamples:\n${e.map(e=>` ${e}`).join(`
|
|
24
|
+
`)}\n`,Ue=(e,t)=>{if(!e.outputModes.includes(t))throw new o.t({code:`USAGE`,exitCode:o.n.USAGE,message:`twenty ${g.n(e)} does not support ${t} output.`,hint:`Supported: ${e.outputModes.join(`, `)}`})},X=async({definition:e,outputMode:t,commandArguments:r,options:i})=>{let a=g.n(e),o=z({mode:t,command:a}),s=new AbortController,c=()=>s.abort(),l;process.on(`SIGINT`,c);try{Ue(e,t);let n={command:a,arguments:r,options:i,output:o,outputMode:t,signal:s.signal};if(!e.needsTarget){let t=await e.load();o.succeed(await t(n));return}let c=await m.t({options:i,outputMode:t,output:o,signal:s.signal});l=c;let u=await e.load();o.succeed(await u({...n,target:c}),p.t(c))}catch(e){o.fail(u.t(e,s.signal),n.t(l)?p.t(l):void 0)}finally{process.off(`SIGINT`,c),s.abort()}},Z=(e,t)=>e.exitOverride(n=>{throw new V({commanderError:n,commandName:t,operands:e.args,options:e.optsWithGlobals()})}),We=({flags:e,description:t,choices:r,required:i,hidden:a})=>{let o=new q(e,t);return a===!0&&o.hideHelp(),n.t(r)&&o.choices(r),i===!0&&o.makeOptionMandatory(),o},Q=({program:e,definition:t,outputMode:r})=>{let a=J(e,t.path.slice(0,-1)).command(t.path[t.path.length-1]).description(t.description);n.t(t.helpGroup)&&a.helpGroup(t.helpGroup);for(let e of t.arguments??[])a.argument(e.required?`<${e.name}>`:`[${e.name}]`,e.description);for(let e of t.options??[])a.addOption(We(e));i.t(t.examples)&&a.addHelpText(`after`,Y(t.examples)),Z(a,g.n(t)),a.action(()=>X({definition:t,outputMode:r,commandArguments:a.processedArgs,options:a.optsWithGlobals()}))},Ge=({program:e,topic:t})=>{let r=J(e,t.path.slice(0,-1)).command(t.path[t.path.length-1]).description(t.description);n.t(t.helpGroup)&&r.helpGroup(t.helpGroup),n.t(t.helpHint)&&r.addHelpText(`after`,`\n${t.helpHint}`),i.t(t.examples)&&r.addHelpText(`after`,Y(t.examples)),Z(r,t.path.join(` `))},Ke=({outputMode:e,outputConfiguration:t})=>{let n=new Le(H).description(`The Twenty command line`).version(d.t,g.t.VERSION,`Print the version`).addOption(new q(g.t.JSON,`Print one JSON document on stdout`).conflicts(`format`)).addOption(new q(g.t.FORMAT,`Output format`).choices(Ve)).option(g.t.REMOTE,`Saved remote to use for this command`).option(g.t.NO_INPUT,`Never prompt or open a browser`).helpOption(g.t.HELP,`Show help`).commandsGroup(g.a.TOOLS).helpCommand(`help [command]`,`Show help for a command`).configureHelp({showGlobalOptions:!0}).configureOutput(t);Z(n,H);for(let e of Be)Ge({program:n,topic:e});for(let t of g.r)Q({program:n,definition:t,outputMode:e});return n},qe=`help`,Je=e=>a.t(e.replace(/^error: /,``).replace(/\s*\n\s*/g,` `).trim()),Ye=e=>e===`twenty`?H:`${H} ${e}`,$=({message:e,commandName:t})=>new o.t({code:`USAGE`,exitCode:o.n.USAGE,message:e,hint:`See: ${Ye(t)} --help`}),Xe=(e,t)=>e.code===`commander.helpDisplayed`||e.code===`commander.help`&&(e.exitCode===0||!i.t(t)),Ze=e=>(e[0]===qe?e.slice(1):e).join(` `),Qe=async({error:e,outputMode:t,capturedOutput:n})=>{let{commanderError:r,commandName:i,operands:a,options:c}=e;if(r.code===`commander.version`){await X({definition:g.i,outputMode:t,commandArguments:[],options:{}});return}let l=z({mode:t,command:i});if(Xe(r,a)){let e=(0,v.isNonEmptyString)(n.standardOutput)?n.standardOutput:n.standardError;l.succeed({data:{help:e},human:e});return}if(r.code===`commander.help`){l.fail($({message:`Unknown command '${Ze(a)}'`,commandName:i}));return}if(r.code===`commander.excessArguments`&&i===g.n(g.o)&&s.t(c,`withToken`)){l.fail(new o.t({code:`USAGE`,exitCode:o.n.USAGE,message:`--with-token reads the API key from standard input, not as an argument.`,hint:h.t}));return}l.fail($({message:Je(r.message),commandName:i}))},$e=async e=>{let t=Te(e),n=Ee(),r=Ke({outputMode:t,outputConfiguration:n.configuration});try{await r.parseAsync(e,{from:`user`})}catch(e){if(e instanceof V){await Qe({error:e,outputMode:t,capturedOutput:n.captured});return}z({mode:t,command:H}).fail(u.t(e))}};exports.runCli=$e;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./isDefined-CJctgvfE.cjs"),t=require("./style-BR52fK4V.cjs"),n=require("./global-flags.constant-DooTv_Uq.cjs"),r=require("./format-table-4drtI5sP.cjs");var i=async()=>{let i=n.r.map(t=>({name:n.n(t),description:t.description,arguments:(t.arguments??[]).map(({name:e,required:t})=>({name:e,required:t})),flags:(t.options??[]).filter(({hidden:e})=>e!==!0).map(({flags:e})=>e),outputs:t.outputModes,writes:t.writes,needsProject:t.needsProject,needsTarget:t.needsTarget,...e.t(t.requiredPermissions)?{requiredPermissions:t.requiredPermissions}:{}})).sort((e,t)=>e.name.localeCompare(t.name));return{data:{commands:i,globalFlags:Object.values(n.t)},human:[r.t({rows:i,columns:[{header:`COMMAND`,value:e=>e.name},{header:`DESCRIPTION`,value:e=>e.description}]}),`${t.i(`${i.length} commands · details: `)}${t.r(`twenty <command> --help`)}`].join(`
|
|
2
|
+
`)}};exports.runCommandsCommand=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./cli-error-CrUD8uMp.cjs"),t=require("./read-command-values-rGaU2qHz.cjs"),n=require("./create-metadata-client-
|
|
1
|
+
const e=require("./cli-error-CrUD8uMp.cjs"),t=require("./read-command-values-rGaU2qHz.cjs"),n=require("./create-metadata-client-oO0QvH6j.cjs"),r=require("./format-data-value-D_1TNU-r.cjs"),i=require("./format-details-COEwKz_M.cjs"),a=require("./create-rest-client-CMUss3u-.cjs"),o=require("./resolve-metadata-object-CN7eAeDR.cjs");var s=async({arguments:s,target:c,signal:l,outputMode:u})=>{let d=t.n(s,1)??``;if(d.length===0||d===`.`||d===`..`)throw new e.t({code:`USAGE`,exitCode:e.n.USAGE,message:`A record id is required.`});let f=await o.t({client:n.t({target:c,signal:l}),name:t.n(s,0)??``}),p=a.r(await a.t({target:c,signal:l}).get(`/rest/${encodeURIComponent(f.namePlural)}/${encodeURIComponent(d)}`,{query:{depth:1}}),f.nameSingular);return{data:p,...u===`human`?{human:i.t(Object.entries(p).map(([e,t])=>[r.t(e),r.n(t)]))}:{}}};exports.runDataGetCommand=s;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./isDefined-CJctgvfE.cjs"),t=require("./cli-error-CrUD8uMp.cjs"),n=require("./read-command-values-rGaU2qHz.cjs");require("./resolve-request-url-BzW185lE.cjs");const r=require("./style-BR52fK4V.cjs"),i=require("./to-cli-error-4pSpVaW9.cjs");require("./result-item-limit.constant-QX3teiuy.cjs");const a=require("./create-metadata-client-oO0QvH6j.cjs"),o=require("./format-data-value-D_1TNU-r.cjs"),s=require("./to-public-target-BltDNpJN.cjs"),c=require("./format-table-4drtI5sP.cjs"),l=require("./create-rest-client-CMUss3u-.cjs"),u=require("./resolve-metadata-object-CN7eAeDR.cjs");var d=({recordCount:e,bytes:n})=>{if(e>1e4||n>16777216)throw new t.t({code:`RESULT_LIMIT_EXCEEDED`,exitCode:t.n.USAGE,message:`Records exceed the 10,000-item or 16 MiB result limit.`,hint:`Use data list <object> --all --format ndjson to stream records, or request fewer records.`,details:{recordCount:e,bytes:n}})},f=[`id`,`name`],p=new Set([`deletedAt`]),m=(e,t)=>o.t(Object.hasOwn(e,t)?e[t]:void 0),h=({page:e,options:t})=>{let n=Object.keys(e.records[0]??{}),i=t.fields??[...f.filter(e=>n.includes(e)),...n.filter(e=>!f.includes(e)&&!p.has(e))].slice(0,5),a=c.n.ROW_INDENT.length,s=0;for(let t of i){let n=o.t(t),r=n.length;s+=Buffer.byteLength(n,`utf8`)-n.length;for(let n of e.records){let e=m(n,t);r=Math.max(r,e.length),s+=Buffer.byteLength(e,`utf8`)-e.length}a+=r+c.n.COLUMN_GAP.length}d({recordCount:e.records.length,bytes:a*(e.records.length+1)+s});let l=e.records.length===0?`No records.`:c.t({rows:e.records,columns:i.map(e=>({header:o.t(e),value:t=>m(t,e)}))}),u=`${e.records.length} of ${e.totalCount} records`;return`${l}\n${r.i(e.pageInfo.hasNextPage?`${u} · --all for every page · --json for the next cursor`:u)}`};async function*g({fetchPage:e,cursor:n,signal:r}){let i=n,a=n,o=1,s=0,c=!0;for(;c;){r.throwIfAborted();let n=await e(i);r.throwIfAborted();let l=n.pageInfo.endCursor??void 0;if(n.records.length>0&&(l===i||l===a))throw new t.t({code:`INVALID_RESPONSE`,message:`The server returned a repeated pagination cursor.`});c=n.pageInfo.hasNextPage,c&&(s+=1,s===o&&(a=l,o*=2,s=0)),yield n,i=l}}var _=r=>{let i=n.r(r,`limit`)??`50`,a=Number(i),o=n.r(r,`fields`)?.split(`,`).map(e=>e.trim()),s=n.r(r,`cursor`);if(!/^\d+$/.test(i)||!Number.isInteger(a)||a<1||a>200)throw new t.t({code:`USAGE`,exitCode:t.n.USAGE,message:`--limit must be an integer between 1 and 200.`});if(o?.some(e=>e.length===0)||e.t(s)&&s.length===0)throw new t.t({code:`USAGE`,exitCode:t.n.USAGE,message:`--fields and --cursor cannot contain empty values.`});return{limit:a,fields:e.t(o)?[...new Set(o)]:void 0,cursor:s,filter:n.r(r,`filter`),orderBy:n.r(r,`orderBy`),all:n.t(r,`all`)}},v=async({arguments:e,options:r,target:o,signal:c,output:f,outputMode:p})=>{let m=_(r),v=await u.t({client:a.t({target:o,signal:c}),name:n.n(e,0)??``}),y=l.t({target:o,signal:c}),b=p===`ndjson`,x=[],S=0,C=0,w=0,T=m.cursor??null,E={hasNextPage:!1,startCursor:null,endCursor:null},D=0;try{b&&await f.event(`start`,{object:v.namePlural,target:s.t(o)},c);for await(let e of g({cursor:m.cursor,signal:c,fetchPage:async e=>l.n(await y.get(`/rest/${encodeURIComponent(v.namePlural)}`,{query:{limit:m.limit,starting_after:e,filter:m.filter,order_by:m.orderBy}}),v.namePlural,m.limit)})){for(let t of e.records)b?await f.event(`record`,t,c):(w+=Buffer.byteLength(JSON.stringify(t),`utf8`),d({recordCount:S+1,bytes:w+S+Buffer.byteLength(JSON.stringify({records:[],pageInfo:e.pageInfo,totalCount:e.totalCount}),`utf8`)}),x.push(t)),S+=1;if(C+=1,E=e.pageInfo,D=e.totalCount,T=E.endCursor??T,b&&await f.event(`progress`,{recordCount:S,pages:C,resumeCursor:T,pageInfo:E,totalCount:D},c),!m.all)break}}catch(e){let n=i.t(e,c);throw b?new t.t({code:n.code,exitCode:n.exitCode,message:n.message,hint:n.hint,details:{...n.details,recordCount:S,pages:C,resumeCursor:T}}):n}if(b)return{data:{recordCount:S,pages:C,resumeCursor:T,pageInfo:E,totalCount:D}};let O={records:x,pageInfo:E,totalCount:D},k=p===`human`&&x.length>0?(m.fields??[]).filter(e=>!x.some(t=>Object.hasOwn(t,e))):[];return k.length>0&&f.warn({code:`FIELDS_NOT_RETURNED`,message:`No returned record has ${k.join(`, `)}; see twenty metadata field list ${v.namePlural}.`}),{data:O,...p===`human`?{human:h({page:O,options:m})}:{}}};exports.runDataListCommand=v;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./build--4zYt4wd.cjs"),t=require("./check-node-requirement-CIDuA1s-.cjs"),n=require("./cli-node-version-range.constant-D3XrqV07.cjs"),r=require("./
|
|
2
|
-
`),O=e.t(),k={AUTH_REQUIRED:{message:`The metadata endpoint rejected these credentials.`,hint:`Check the configured credentials, or sign in again.`},PERMISSION_DENIED:{message:`The metadata endpoint denied access to the workspace identity.`,hint:`Check the selected remote and the permissions granted to its credentials.`},INVALID_RESPONSE:{message:`The server did not return a valid metadata API response.`,hint:`Check the API URL and base path, and whether a proxy returned another page.`},UNSUPPORTED_RESPONSE_TYPE:{message:`The metadata endpoint returned an unsupported response type.`,hint:`Check the API URL and base path, and whether a proxy returned another page.`},REDIRECT_NOT_FOLLOWED:{message:`The metadata endpoint redirected the request. No redirect was followed.`,hint:`Configure the final Twenty API URL, including the correct protocol and base path.`},TIMEOUT:{message:`The metadata endpoint did not respond before the request timed out.`,hint:`Check server availability and the network connection.`},NETWORK_ERROR:{message:`Could not connect to the metadata endpoint.`,hint:`Check the API URL, network connection, server availability and TLS configuration.`}},A={ENOTFOUND:`DNS could not resolve the metadata endpoint hostname.`,EAI_AGAIN:`DNS resolution of the metadata endpoint temporarily failed.`,ECONNREFUSED:`The metadata endpoint refused the connection.`,ECONNRESET:`The connection to the metadata endpoint was reset.`,EHOSTUNREACH:`The metadata endpoint host is unreachable.`,ENETUNREACH:`The network containing the metadata endpoint is unreachable.`,ETIMEDOUT:`The connection to the metadata endpoint timed out.`,UND_ERR_CONNECT_TIMEOUT:`The connection to the metadata endpoint timed out.`,CERT_HAS_EXPIRED:`The metadata endpoint TLS certificate has expired.`,ERR_TLS_CERT_ALTNAME_INVALID:`The metadata endpoint TLS certificate does not match its hostname.`,DEPTH_ZERO_SELF_SIGNED_CERT:`The metadata endpoint uses an untrusted self-signed TLS certificate.`,SELF_SIGNED_CERT_IN_CHAIN:`The metadata endpoint TLS certificate chain contains an untrusted self-signed certificate.`,UNABLE_TO_VERIFY_LEAF_SIGNATURE:`The metadata endpoint TLS certificate chain could not be verified.`,UNABLE_TO_GET_ISSUER_CERT_LOCALLY:`The metadata endpoint TLS certificate issuer is not trusted locally.`},j=e=>{let t=e instanceof c.t?e.code:`INTERNAL_ERROR`,n=k[t]??{message:`The metadata endpoint could not be verified (${t}).`,hint:`Check the API URL and server availability.`},r=e instanceof c.t&&t===`NETWORK_ERROR`?e.details?.networkCode:void 0,a=(0,O.isString)(r)&&Object.hasOwn(A,r)?A[r]:void 0;return{id:`metadata-api`,status:`fail`,code:t,message:a??n.message,hint:e instanceof c.t&&t===`AUTH_REQUIRED`&&i.t(e.hint)?e.hint:n.hint,...i.t(a)?{details:{networkCode:r}}:{}}},M=async({configPath:e,environment:t,remoteFlag:n,offline:r,signal:a})=>{let o=[],s,l;a.throwIfAborted();try{if(s=await y.t(e),o.push({id:`configuration`,status:`pass`,message:`CLI configuration checked at ${e}.`,details:{path:e,remoteCount:Object.keys(s.remotes).length,defaultRemote:s.defaultRemote??null}}),process.platform!==`win32`){let t=await(0,C.stat)(e).catch(()=>void 0);i.t(t)&&t.mode&63&&o.push({id:`configuration-permissions`,status:`warning`,message:`Other users may access the CLI configuration file.`,hint:`Review its permissions; ${x.t.PRIVATE_FILE.toString(8)} is the expected mode. Doctor does not change them.`})}}catch(t){l=t,o.push({id:`configuration`,status:`fail`,code:t instanceof c.t?t.code:`INVALID_CONFIG`,message:t instanceof c.t?t.message:`The CLI configuration is unreadable or invalid.`,hint:t instanceof c.t?t.hint:`Check ${e}. Doctor does not overwrite it.`})}let d;try{let e=await _.t({environment:t,remoteFlag:n,loadConfig:async()=>{if(!i.t(s))throw l;return s},warn:e=>o.push({id:`target-precedence`,status:`warning`,code:e.code,message:e.message})}),r=u.t({rawUrl:e.source===`remote`?e.remote.apiUrl:e.apiUrl,sourceName:e.source===`remote`?`The URL of remote ${e.remoteName}`:f.t.API_URL}),a={apiUrl:r,source:e.source,remote:e.source===`remote`?e.remoteName:null};o.push({id:`target`,status:`pass`,message:`Selected ${r} from ${e.source}.`,details:a});let c=e.source===`remote`?e.remote.twentyCLIAccessToken:void 0,p=(0,O.isNonEmptyString)(c)?`oauth`:`apiKey`,m=e.source===`remote`?e.remote.apiKey:e.apiKey,h=(0,O.isNonEmptyString)(c)?c:m;if(!(0,O.isNonEmptyString)(h))return o.push({id:`credentials`,status:`fail`,code:`AUTH_REQUIRED`,message:`The selected remote has no saved credentials.`,hint:`Sign in with twenty auth login, then rerun doctor.`}),[...o,{id:`metadata-api`,status:`skipped`,message:`No credentials are available.`}];let g=p===`oauth`?b.t(h):void 0;if(i.t(g)&&g<=Date.now()){let t=e.source===`remote`&&(0,O.isNonEmptyString)(e.remote.twentyCLIRefreshToken);return o.push({id:`credentials`,status:t?`warning`:`fail`,code:`AUTH_REQUIRED`,message:t?`The OAuth access token has expired. A refresh token is saved, but renewal has not been verified.`:`The saved OAuth access token has expired and no refresh token is available.`,hint:`Run twenty auth status with the same remote to refresh the session, or sign in again. Doctor does not refresh credentials.`}),[...o,{id:`metadata-api`,status:`skipped`,message:`The access token has expired.`}]}d={apiUrl:r,source:e.source,...e.source===`remote`?{remoteName:e.remoteName}:{},credentialKind:p,bearerToken:h},o.push({id:`credentials`,status:`pass`,message:`${p===`oauth`?`OAuth token`:`API key`} configured; acceptance is checked separately.`,details:{kind:p}})}catch(e){a.throwIfAborted();let t=e instanceof c.t?e.code:`INTERNAL_ERROR`;return o.push({id:`target`,status:t===`TARGET_REQUIRED`?`skipped`:`fail`,code:t,message:e instanceof c.t?e.message:`Could not select a workspace.`,hint:e instanceof c.t?e.hint:void 0}),[...o,{id:`credentials`,status:`skipped`,message:`No workspace was selected.`},{id:`metadata-api`,status:`skipped`,message:`No workspace was selected.`}]}if(r)return[...o,{id:`metadata-api`,status:`skipped`,message:`Network checks disabled by --offline.`}];try{a.throwIfAborted(),await S.t({target:d,signal:a}),o.push({id:`metadata-api`,status:`pass`,message:`The metadata endpoint accepted the configured credentials.`,details:{...g.t(d)}})}catch(e){a.throwIfAborted(),o.push(j(e))}return o},N=async e=>{for(let t of s.t((0,w.dirname)(e))){let n=await o.t((0,w.join)(t,`package.json`));if(!i.t(n))continue;let r=n.bin,s=(0,O.isString)(r)&&n.name===`twenty`?r:void 0,c=a.i(r)&&(0,O.isString)(r.twenty)?r.twenty:s;if(i.t(c)&&await(0,C.realpath)((0,w.resolve)(t,c)).catch(()=>void 0)===e)return{name:(0,O.isString)(n.name)?n.name:`unknown`,version:(0,O.isString)(n.version)?n.version:`unknown`}}return null},P=async({environment:e,workingDirectory:t,signal:n})=>{let a=[],o=process.platform===`win32`?[`twenty.exe`,`twenty.cmd`,`twenty.bat`,`twenty`]:[`twenty`],s=i.t(e.PATH)?e.PATH.split(w.delimiter):[];for(let e of new Set(s))for(let r of o){n.throwIfAborted();let i=(0,w.resolve)(t,e,r);if(!await(0,C.access)(i,T.constants.X_OK).then(()=>(0,C.stat)(i).then(e=>e.isFile()),()=>!1))continue;let o=await(0,C.realpath)(i);a.push({path:i,resolvedPath:o,owner:await N(o)})}let c=a[0],l=process.argv[1],u=i.t(l)?await(0,C.realpath)((0,w.resolve)(t,l)).catch(()=>void 0):void 0,d=a.filter(e=>e.owner?.name===`twenty-sdk`);return r.o(d)?{id:`path`,status:`warning`,message:`PATH contains legacy twenty-sdk executable(s) named twenty: ${d.map(e=>e.path).join(`, `)}.`,hint:`If this is a global twenty-sdk installation, remove it before installing the twenty CLI so the CLI owns the twenty name. Removing the SDK afterward can remove that executable link. Keep app-local SDK dependencies; use the intended CLI by its full path when needed. Doctor does not change installations.`,details:{candidates:a}}:i.t(c)?i.t(u)&&c.resolvedPath!==u?{id:`path`,status:`warning`,message:`${c.path} is first on PATH and differs from the running CLI.`,hint:`Use the intended executable by its full path, or review PATH order. Shell aliases, functions and command caches are not inspected.`,details:{candidates:a,runningPath:u}}:{id:`path`,status:c.owner?.name===`twenty`?`pass`:`warning`,message:i.t(c.owner)?`First twenty executable on PATH: ${c.path} (${c.owner.name} ${c.owner.version}).`:`First twenty executable on PATH: ${c.path}. Its package owner could not be determined.`,hint:`Shell aliases, functions and command caches are not inspected.`,details:{candidates:a}}:{id:`path`,status:`warning`,message:`No executable named twenty was found on PATH.`,hint:`Use the CLI entry point shown above, or your package manager to invoke the installed CLI.`,details:{candidates:a}}},F=async({explicitPath:e,workingDirectory:t,signal:n})=>{let r;n.throwIfAborted();try{r=await m.t({explicitPath:e,workingDirectory:t})}catch(t){return n.throwIfAborted(),[{id:`project`,status:!i.t(e)&&t instanceof c.t&&(t.code===`APP_NOT_FOUND`||t.code===`APP_PATH_REQUIRED`)?`skipped`:`fail`,message:t instanceof c.t?t.message:`Could not inspect the app directory.`,hint:`Use --path <app directory> to check a specific app.`},{id:`sdk`,status:`skipped`,message:`No app was selected.`}]}let a={id:`project`,status:`pass`,message:`${r.name} at ${r.path}.`,details:{name:r.name,path:r.path}};try{n.throwIfAborted();let e=[],t=await l.t({appPath:r.path,warn:t=>e.push(t)}),[o]=e,s={version:t.version,path:t.packagePath};return[a,i.t(o)?{id:`sdk`,status:`warning`,code:o.code,message:o.message,hint:`Builds continue. If one fails, switch to a Node version in that range.`,details:s}:{id:`sdk`,status:`pass`,message:`twenty-sdk ${t.version} provides the authoring exports required by the CLI.`,details:s}]}catch(e){return n.throwIfAborted(),[a,{id:`sdk`,status:`fail`,code:e instanceof c.t?e.code:`INTERNAL_ERROR`,message:e instanceof c.t?e.message:`Could not inspect the app SDK installation.`,hint:e instanceof c.t?e.hint:`Check that the app dependencies are installed and readable.`}]}},I=()=>{let e=t.t({version:process.versions.node,range:n.t})===`satisfied`;return[{id:`node`,status:e?`pass`:`fail`,message:`Node ${process.versions.node}, required ${n.t}.`,...e?{}:{hint:`Switch to a supported Node version and rerun doctor.`},details:{version:process.versions.node,required:n.t}},{id:`cli`,status:`pass`,message:`twenty ${h.t}, entry point ${process.argv[1]??`unknown`}.`,details:{version:h.t,nodeExecutable:process.execPath,entryPoint:process.argv[1]??null,platform:process.platform,arch:process.arch}}]},L=async({options:e,signal:t,outputMode:n})=>{let i=I(),a=process.cwd();try{i.push(await P({environment:process.env,workingDirectory:a,signal:t}))}catch{t.throwIfAborted(),i.push({id:`path`,status:`fail`,message:`Could not inspect executables on PATH.`})}i.push(...await F({explicitPath:d.r(e,`path`),workingDirectory:a,signal:t})),i.push(...await M({environment:process.env,configPath:v.t(),remoteFlag:d.r(e,`remote`),offline:d.t(e,`offline`),signal:t})),t.throwIfAborted();let o=i.filter(e=>e.status===`fail`),s=D(i,r.o(o)?process.stderr:process.stdout);if(r.o(o))throw new c.t({code:`DOCTOR_FAILED`,message:`${o.length} doctor ${o.length===1?`check`:`checks`} failed.`,hint:n===`human`?s:`Read error.details.checks for the failures and recovery hints.`,details:{checks:i}});return{data:{checks:i},human:s}};exports.runDoctorCommand=L;
|
|
1
|
+
const e=require("./build--4zYt4wd.cjs"),t=require("./check-node-requirement-CIDuA1s-.cjs"),n=require("./cli-node-version-range.constant-D3XrqV07.cjs"),r=require("./isDefined-CJctgvfE.cjs"),i=require("./isPlainObject-fJEJm71P.cjs"),a=require("./isNonEmptyArray-v52xg4Xj.cjs"),o=require("./read-json-object-BMftwGZ5.cjs"),s=require("./list-ancestor-directories-BtB2hNt6.cjs"),c=require("./cli-error-CrUD8uMp.cjs"),l=require("./resolve-source-sdk-C4Hu045V.cjs"),u=require("./parse-api-url-B5c0Gh_n.cjs"),d=require("./read-command-values-rGaU2qHz.cjs"),f=require("./target-environment-variable.constant-D7z8AihP.cjs"),p=require("./style-BR52fK4V.cjs"),m=require("./resolve-app-project-B4IjfcM-.cjs"),h=require("./cli-version.constant-jomCqLLP.cjs"),g=require("./to-public-target-BltDNpJN.cjs"),_=require("./select-target-Ck9mdMLQ.cjs"),v=require("./get-config-path-C-D-QHuX.cjs"),y=require("./read-config-6GnzcpJm.cjs"),b=require("./is-access-token-expiring-BvJhEqtV.cjs"),x=require("./config-file-mode.constant-DLBzKKUl.cjs"),S=require("./fetch-signed-in-identity-GVHuJKXy.cjs");let C=require("node:fs/promises"),w=require("node:path"),T=require("node:fs");var E={pass:`green`,warning:`yellow`,fail:`red`,skipped:`yellow`},D=(e,t=process.stdout)=>e.map(e=>{let n=r.t(e.hint)?`\n ${e.hint}`:``;return`${p.n(E[e.status],`[${e.status.toUpperCase()}]`,t)} ${e.id}: ${e.message}${n}`}).join(`
|
|
2
|
+
`),O=e.t(),k={AUTH_REQUIRED:{message:`The metadata endpoint rejected these credentials.`,hint:`Check the configured credentials, or sign in again.`},PERMISSION_DENIED:{message:`The metadata endpoint denied access to the workspace identity.`,hint:`Check the selected remote and the permissions granted to its credentials.`},INVALID_RESPONSE:{message:`The server did not return a valid metadata API response.`,hint:`Check the API URL and base path, and whether a proxy returned another page.`},UNSUPPORTED_RESPONSE_TYPE:{message:`The metadata endpoint returned an unsupported response type.`,hint:`Check the API URL and base path, and whether a proxy returned another page.`},REDIRECT_NOT_FOLLOWED:{message:`The metadata endpoint redirected the request. No redirect was followed.`,hint:`Configure the final Twenty API URL, including the correct protocol and base path.`},TIMEOUT:{message:`The metadata endpoint did not respond before the request timed out.`,hint:`Check server availability and the network connection.`},NETWORK_ERROR:{message:`Could not connect to the metadata endpoint.`,hint:`Check the API URL, network connection, server availability and TLS configuration.`}},A={ENOTFOUND:`DNS could not resolve the metadata endpoint hostname.`,EAI_AGAIN:`DNS resolution of the metadata endpoint temporarily failed.`,ECONNREFUSED:`The metadata endpoint refused the connection.`,ECONNRESET:`The connection to the metadata endpoint was reset.`,EHOSTUNREACH:`The metadata endpoint host is unreachable.`,ENETUNREACH:`The network containing the metadata endpoint is unreachable.`,ETIMEDOUT:`The connection to the metadata endpoint timed out.`,UND_ERR_CONNECT_TIMEOUT:`The connection to the metadata endpoint timed out.`,CERT_HAS_EXPIRED:`The metadata endpoint TLS certificate has expired.`,ERR_TLS_CERT_ALTNAME_INVALID:`The metadata endpoint TLS certificate does not match its hostname.`,DEPTH_ZERO_SELF_SIGNED_CERT:`The metadata endpoint uses an untrusted self-signed TLS certificate.`,SELF_SIGNED_CERT_IN_CHAIN:`The metadata endpoint TLS certificate chain contains an untrusted self-signed certificate.`,UNABLE_TO_VERIFY_LEAF_SIGNATURE:`The metadata endpoint TLS certificate chain could not be verified.`,UNABLE_TO_GET_ISSUER_CERT_LOCALLY:`The metadata endpoint TLS certificate issuer is not trusted locally.`},j=e=>{let t=e instanceof c.t?e.code:`INTERNAL_ERROR`,n=k[t]??{message:`The metadata endpoint could not be verified (${t}).`,hint:`Check the API URL and server availability.`},i=e instanceof c.t&&t===`NETWORK_ERROR`?e.details?.networkCode:void 0,a=(0,O.isString)(i)&&Object.hasOwn(A,i)?A[i]:void 0;return{id:`metadata-api`,status:`fail`,code:t,message:a??n.message,hint:e instanceof c.t&&t===`AUTH_REQUIRED`&&r.t(e.hint)?e.hint:n.hint,...r.t(a)?{details:{networkCode:i}}:{}}},M=async({configPath:e,environment:t,remoteFlag:n,offline:i,signal:a})=>{let o=[],s,l;a.throwIfAborted();try{if(s=await y.t(e),o.push({id:`configuration`,status:`pass`,message:`CLI configuration checked at ${e}.`,details:{path:e,remoteCount:Object.keys(s.remotes).length,defaultRemote:s.defaultRemote??null}}),process.platform!==`win32`){let t=await(0,C.stat)(e).catch(()=>void 0);r.t(t)&&t.mode&63&&o.push({id:`configuration-permissions`,status:`warning`,message:`Other users may access the CLI configuration file.`,hint:`Review its permissions; ${x.t.PRIVATE_FILE.toString(8)} is the expected mode. Doctor does not change them.`})}}catch(t){l=t,o.push({id:`configuration`,status:`fail`,code:t instanceof c.t?t.code:`INVALID_CONFIG`,message:t instanceof c.t?t.message:`The CLI configuration is unreadable or invalid.`,hint:t instanceof c.t?t.hint:`Check ${e}. Doctor does not overwrite it.`})}let d;try{let e=await _.t({environment:t,remoteFlag:n,loadConfig:async()=>{if(!r.t(s))throw l;return s},warn:e=>o.push({id:`target-precedence`,status:`warning`,code:e.code,message:e.message})}),i=u.t({rawUrl:e.source===`remote`?e.remote.apiUrl:e.apiUrl,sourceName:e.source===`remote`?`The URL of remote ${e.remoteName}`:f.t.API_URL}),a={apiUrl:i,source:e.source,remote:e.source===`remote`?e.remoteName:null};o.push({id:`target`,status:`pass`,message:`Selected ${i} from ${e.source}.`,details:a});let c=e.source===`remote`?e.remote.twentyCLIAccessToken:void 0,p=(0,O.isNonEmptyString)(c)?`oauth`:`apiKey`,m=e.source===`remote`?e.remote.apiKey:e.apiKey,h=(0,O.isNonEmptyString)(c)?c:m;if(!(0,O.isNonEmptyString)(h))return o.push({id:`credentials`,status:`fail`,code:`AUTH_REQUIRED`,message:`The selected remote has no saved credentials.`,hint:`Sign in with twenty auth login, then rerun doctor.`}),[...o,{id:`metadata-api`,status:`skipped`,message:`No credentials are available.`}];let g=p===`oauth`?b.t(h):void 0;if(r.t(g)&&g<=Date.now()){let t=e.source===`remote`&&(0,O.isNonEmptyString)(e.remote.twentyCLIRefreshToken);return o.push({id:`credentials`,status:t?`warning`:`fail`,code:`AUTH_REQUIRED`,message:t?`The OAuth access token has expired. A refresh token is saved, but renewal has not been verified.`:`The saved OAuth access token has expired and no refresh token is available.`,hint:`Run twenty auth status with the same remote to refresh the session, or sign in again. Doctor does not refresh credentials.`}),[...o,{id:`metadata-api`,status:`skipped`,message:`The access token has expired.`}]}d={apiUrl:i,source:e.source,...e.source===`remote`?{remoteName:e.remoteName}:{},credentialKind:p,bearerToken:h},o.push({id:`credentials`,status:`pass`,message:`${p===`oauth`?`OAuth token`:`API key`} configured; acceptance is checked separately.`,details:{kind:p}})}catch(e){a.throwIfAborted();let t=e instanceof c.t?e.code:`INTERNAL_ERROR`;return o.push({id:`target`,status:t===`TARGET_REQUIRED`?`skipped`:`fail`,code:t,message:e instanceof c.t?e.message:`Could not select a workspace.`,hint:e instanceof c.t?e.hint:void 0}),[...o,{id:`credentials`,status:`skipped`,message:`No workspace was selected.`},{id:`metadata-api`,status:`skipped`,message:`No workspace was selected.`}]}if(i)return[...o,{id:`metadata-api`,status:`skipped`,message:`Network checks disabled by --offline.`}];try{a.throwIfAborted(),await S.t({target:d,signal:a}),o.push({id:`metadata-api`,status:`pass`,message:`The metadata endpoint accepted the configured credentials.`,details:{...g.t(d)}})}catch(e){a.throwIfAborted(),o.push(j(e))}return o},N=async e=>{for(let t of s.t((0,w.dirname)(e))){let n=await o.t((0,w.join)(t,`package.json`));if(!r.t(n))continue;let a=n.bin,s=(0,O.isString)(a)&&n.name===`twenty`?a:void 0,c=i.t(a)&&(0,O.isString)(a.twenty)?a.twenty:s;if(r.t(c)&&await(0,C.realpath)((0,w.resolve)(t,c)).catch(()=>void 0)===e)return{name:(0,O.isString)(n.name)?n.name:`unknown`,version:(0,O.isString)(n.version)?n.version:`unknown`}}return null},P=async({environment:e,workingDirectory:t,signal:n})=>{let i=[],o=process.platform===`win32`?[`twenty.exe`,`twenty.cmd`,`twenty.bat`,`twenty`]:[`twenty`],s=r.t(e.PATH)?e.PATH.split(w.delimiter):[];for(let e of new Set(s))for(let r of o){n.throwIfAborted();let a=(0,w.resolve)(t,e,r);if(!await(0,C.access)(a,T.constants.X_OK).then(()=>(0,C.stat)(a).then(e=>e.isFile()),()=>!1))continue;let o=await(0,C.realpath)(a);i.push({path:a,resolvedPath:o,owner:await N(o)})}let c=i[0],l=process.argv[1],u=r.t(l)?await(0,C.realpath)((0,w.resolve)(t,l)).catch(()=>void 0):void 0,d=i.filter(e=>e.owner?.name===`twenty-sdk`);return a.t(d)?{id:`path`,status:`warning`,message:`PATH contains legacy twenty-sdk executable(s) named twenty: ${d.map(e=>e.path).join(`, `)}.`,hint:`If this is a global twenty-sdk installation, remove it before installing the twenty CLI so the CLI owns the twenty name. Removing the SDK afterward can remove that executable link. Keep app-local SDK dependencies; use the intended CLI by its full path when needed. Doctor does not change installations.`,details:{candidates:i}}:r.t(c)?r.t(u)&&c.resolvedPath!==u?{id:`path`,status:`warning`,message:`${c.path} is first on PATH and differs from the running CLI.`,hint:`Use the intended executable by its full path, or review PATH order. Shell aliases, functions and command caches are not inspected.`,details:{candidates:i,runningPath:u}}:{id:`path`,status:c.owner?.name===`twenty`?`pass`:`warning`,message:r.t(c.owner)?`First twenty executable on PATH: ${c.path} (${c.owner.name} ${c.owner.version}).`:`First twenty executable on PATH: ${c.path}. Its package owner could not be determined.`,hint:`Shell aliases, functions and command caches are not inspected.`,details:{candidates:i}}:{id:`path`,status:`warning`,message:`No executable named twenty was found on PATH.`,hint:`Use the CLI entry point shown above, or your package manager to invoke the installed CLI.`,details:{candidates:i}}},F=async({explicitPath:e,workingDirectory:t,signal:n})=>{let i;n.throwIfAborted();try{i=await m.t({explicitPath:e,workingDirectory:t})}catch(t){return n.throwIfAborted(),[{id:`project`,status:!r.t(e)&&t instanceof c.t&&(t.code===`APP_NOT_FOUND`||t.code===`APP_PATH_REQUIRED`)?`skipped`:`fail`,message:t instanceof c.t?t.message:`Could not inspect the app directory.`,hint:`Use --path <app directory> to check a specific app.`},{id:`sdk`,status:`skipped`,message:`No app was selected.`}]}let a={id:`project`,status:`pass`,message:`${i.name} at ${i.path}.`,details:{name:i.name,path:i.path}};try{n.throwIfAborted();let e=[],t=await l.t({appPath:i.path,warn:t=>e.push(t)}),[o]=e,s={version:t.version,path:t.packagePath};return[a,r.t(o)?{id:`sdk`,status:`warning`,code:o.code,message:o.message,hint:`Builds continue. If one fails, switch to a Node version in that range.`,details:s}:{id:`sdk`,status:`pass`,message:`twenty-sdk ${t.version} provides the authoring exports required by the CLI.`,details:s}]}catch(e){return n.throwIfAborted(),[a,{id:`sdk`,status:`fail`,code:e instanceof c.t?e.code:`INTERNAL_ERROR`,message:e instanceof c.t?e.message:`Could not inspect the app SDK installation.`,hint:e instanceof c.t?e.hint:`Check that the app dependencies are installed and readable.`}]}},I=()=>{let e=t.t({version:process.versions.node,range:n.t})===`satisfied`;return[{id:`node`,status:e?`pass`:`fail`,message:`Node ${process.versions.node}, required ${n.t}.`,...e?{}:{hint:`Switch to a supported Node version and rerun doctor.`},details:{version:process.versions.node,required:n.t}},{id:`cli`,status:`pass`,message:`twenty ${h.t}, entry point ${process.argv[1]??`unknown`}.`,details:{version:h.t,nodeExecutable:process.execPath,entryPoint:process.argv[1]??null,platform:process.platform,arch:process.arch}}]},L=async({options:e,signal:t,outputMode:n})=>{let r=I(),i=process.cwd();try{r.push(await P({environment:process.env,workingDirectory:i,signal:t}))}catch{t.throwIfAborted(),r.push({id:`path`,status:`fail`,message:`Could not inspect executables on PATH.`})}r.push(...await F({explicitPath:d.r(e,`path`),workingDirectory:i,signal:t})),r.push(...await M({environment:process.env,configPath:v.t(),remoteFlag:d.r(e,`remote`),offline:d.t(e,`offline`),signal:t})),t.throwIfAborted();let o=r.filter(e=>e.status===`fail`),s=D(r,a.t(o)?process.stderr:process.stdout);if(a.t(o))throw new c.t({code:`DOCTOR_FAILED`,message:`${o.length} doctor ${o.length===1?`check`:`checks`} failed.`,hint:n===`human`?s:`Read error.details.checks for the failures and recovery hints.`,details:{checks:r}});return{data:{checks:r},human:s}};exports.runDoctorCommand=L;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./isDefined-CJctgvfE.cjs"),t=require("./cli-error-CrUD8uMp.cjs"),n=require("./read-command-values-rGaU2qHz.cjs"),r=require("./read-local-container-DsjjrgOn.cjs");let i=require("node:events");var a=async({options:a,signal:o,output:s,outputMode:c})=>{let{environment:l}=r.r(a),u=r.a({value:n.r(a,`lines`),name:`--lines`,maximum:1e4})??50,d=a.follow!==!1;await r.o(o);let f=await r.n({environment:l,signal:o});if(!e.t(f))throw new t.t({code:`NOT_FOUND`,message:`No local environment has been created.`,hint:`Run twenty local start first (add --test for the test instance).`});return await s.event(`start`,{name:l.name,shouldFollow:d},o),await r.s({args:[`logs`,`--tail`,String(u),...d?[`--follow`]:[],f.id],signal:o,onOutput:async e=>{c===`ndjson`?await s.event(`record`,{message:e},o):process.stdout.write(e)||await(0,i.once)(process.stdout,`drain`,{signal:o})}}),{data:{name:l.name,shouldFollow:d},human:`Log stream completed.`}};exports.runLocalLogsCommand=a;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./isDefined-CJctgvfE.cjs"),t=require("./read-command-values-rGaU2qHz.cjs"),n=require("./is-interaction-allowed-BQLOG8RG.cjs"),r=require("./require-approval-BIgPOy_r.cjs"),i=require("./read-local-container-DsjjrgOn.cjs");var a=async({options:a,outputMode:o,signal:s})=>{let{environment:c}=i.r(a);await r.t({isApproved:t.t(a,`yes`),canPrompt:n.t({options:a,outputMode:o}),question:`Delete ${c.name} and all its database, file and analytics data?`,code:`CONFIRMATION_REQUIRED`,message:`Reset permanently deletes all data in ${c.name}.`,hint:`Pass --yes to delete this local environment and its data.`,declinedMessage:`Local environment reset cancelled.`,signal:s}),await i.o(s);let l=await i.n({environment:c,signal:s});e.t(l)&&(i.t({environment:c,container:l}),await i.s({args:[`rm`,`--force`,l.id],signal:s}));let u=(await i.s({args:[`volume`,`ls`,`--format`,`{{.Name}}`],signal:s})).trim().split(`
|
|
2
|
+
`),d=Object.values(c.volumes).filter(e=>u.includes(e));return d.length>0&&await i.s({args:[`volume`,`rm`,...d],signal:s}),{data:{name:c.name,reset:!0,removedVolumes:d},human:`Local environment data deleted. Run twenty local start${a.test?` --test`:``} to create a fresh instance.`}};exports.runLocalResetCommand=a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-mLOUI7ql.cjs"),t=require("./satisfies-Jm-ashRt.cjs"),n=require("./isDefined-CJctgvfE.cjs"),r=require("./cli-error-CrUD8uMp.cjs"),i=require("./read-command-values-rGaU2qHz.cjs"),a=require("./read-local-container-DsjjrgOn.cjs"),o=require("./wait-for-local-environment-BmOFeICJ.cjs");var s=e.r(t.t()),c=async({options:e,arguments:t,output:c,signal:l})=>{let{environment:u,port:d}=a.r(e),f=i.n(t,0),p=n.t(f)?o.r(f):void 0;await a.o(l);let m=await a.n({environment:u,signal:l}),h=m?.port??d??u.port;if(n.t(m)&&(n.t(d)&&d!==m.port||n.t(p)&&p!==m.image))throw new r.t({code:`CONFLICT`,message:`${u.name} already uses ${m.image} on port ${m.port}.`,hint:`Omit --port to reuse this instance. Use twenty local upgrade to change its version.`});let g=n.t(m)?o.i():void 0;if(n.t(m)&&n.t(g)){let e;try{e=await o.a({imageId:m.imageId,signal:l})}catch(e){if(l.throwIfAborted(),!(e instanceof r.t)||e.code!==`INVALID_RESPONSE`)throw e}(!n.t(e)||!(0,s.default)(e,g))&&c.warn({code:`LOCAL_VERSION_MISMATCH`,message:`The existing image ${m.image} does not establish compatibility with engines.twenty ${g}. Use twenty local upgrade to change version.`})}if(n.t(m)&&!m.isRunning&&(c.progress({message:`Starting the existing local environment…`}),await a.s({args:[`start`,m.id],signal:l})),!n.t(m)){let e=p??await o.n({version:void 0,signal:l});c.progress({message:`Pulling ${e}…`}),await a.s({args:[`pull`,e],signal:l}),c.progress({message:`Starting ${e} on http://localhost:${h}…`}),await o.s({environment:u,image:e,port:h,signal:l})}c.progress({message:`Waiting for the local environment to be ready…`});let _=await o.t({environment:{...u,port:h},signal:l});return{data:_,human:`Local Twenty is ready at ${_.url}\nSign in: twenty auth login --url ${_.url} --name ${e.test?`local-test`:`local`}`}};exports.runLocalStartCommand=c;
|
package/dist/chunks/{run-local-status-command-ClvEgxcU.cjs → run-local-status-command-E3cpSfTu.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./read-local-container-
|
|
1
|
+
const e=require("./read-local-container-DsjjrgOn.cjs"),t=require("./get-local-status-BbRv0a22.cjs");var n=async({options:n,signal:r})=>{let{environment:i}=e.r(n);await e.o(r);let a=await t.t({environment:i,container:await e.n({environment:i,signal:r}),signal:r});return{data:a,human:`Status: ${a.status}\nURL: ${a.url}${a.image?`\nImage: ${a.image}`:``}`}};exports.runLocalStatusCommand=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./isDefined-CJctgvfE.cjs"),t=require("./read-local-container-DsjjrgOn.cjs");var n=async({options:n,signal:r})=>{let{environment:i}=t.r(n);await t.o(r);let a=await t.n({environment:i,signal:r});return a?.isRunning&&await t.s({args:[`stop`,a.id],signal:r}),{data:{name:i.name,stopped:e.t(a),dataPreserved:!0},human:e.t(a)?`Local environment stopped. Data is preserved.`:`No local environment has been created.`}};exports.runLocalStopCommand=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-mLOUI7ql.cjs"),t=require("./valid-BPaM0XRk.cjs"),n=require("./isDefined-CJctgvfE.cjs"),r=require("./cli-error-CrUD8uMp.cjs"),i=require("./read-command-values-rGaU2qHz.cjs"),a=require("./read-local-container-DsjjrgOn.cjs"),o=require("./wait-for-local-environment-BmOFeICJ.cjs"),s=require("./get-local-status-BbRv0a22.cjs");var c=e.r(t.o()),l=async({environment:e,existing:t,image:i,environmentVariables:s,signal:c})=>{let l=`${e.name}-previous`;try{await a.s({args:[`rename`,t.id,l],signal:c}),t.isRunning&&await a.s({args:[`stop`,`--time`,`30`,t.id],signal:c}),await o.s({environment:e,image:i,port:t.port,containerPort:t.containerPort,environmentVariables:s,shouldStart:!1,signal:c})}catch(i){let o=AbortSignal.timeout(6e4);try{let r=await a.n({environment:e,signal:o});n.t(r)&&r.id!==t.id&&await a.s({args:[`rm`,r.id],signal:o}),r?.id!==t.id&&await a.s({args:[`rename`,t.id,e.name],signal:o}),t.isRunning&&await a.s({args:[`start`,t.id],signal:o})}catch(e){throw new r.t({code:`LOCAL_ENVIRONMENT_FAILED`,message:`Upgrade failed and the previous container could not be restored automatically.`,hint:`The previous settings remain in container ${t.id}. Inspect it with docker inspect before retrying.`,cause:e,details:{originalError:i instanceof Error?i.message:String(i)}})}throw i}await a.s({args:[`rm`,t.id],signal:AbortSignal.timeout(6e4)}),await a.s({args:[`start`,e.name],signal:c})},u=async({container:e,signal:t})=>{let n=await o.o({imageId:e.imageId,signal:t});return e.environmentVariables.filter(e=>!e.startsWith(`NODE_PORT=`)&&!n.includes(e))},d=async({options:e,arguments:t,output:d,signal:f})=>{let{environment:p}=a.r(e);await a.o(f);let m=await a.n({environment:p,signal:f});if(!n.t(m))throw new r.t({code:`NOT_FOUND`,message:`No local environment has been created.`,hint:`Use twenty local start with the desired version first.`});a.t({environment:p,container:m});let h=await o.n({version:i.n(t,0),signal:f});d.progress({message:`Pulling ${h}…`}),await a.s({args:[`pull`,h],signal:f});let g=(await a.s({args:[`image`,`inspect`,`--format`,`{{.Id}}`,h],signal:f})).trim();if(m.imageId===g)return{data:{...await s.t({environment:p,container:m,signal:f}),isUpgraded:!1},human:`Already using ${h}.`};let _=await o.a({imageId:m.imageId,signal:f}),v=await o.a({imageId:g,signal:f});if((0,c.default)(v,_))throw new r.t({code:`CONFLICT`,message:`Cannot downgrade the local environment from ${_} to ${v}.`,hint:`Database migrations cannot be rolled back. Keep the current version or use a newer one.`});let y=await u({container:m,signal:f});d.progress({message:`Replacing the local environment, preserving its data volumes…`}),await l({environment:p,existing:m,image:h,environmentVariables:y,signal:f});let b=await o.t({environment:{...p,port:m.port},signal:f});return{data:{...b,isUpgraded:!0,isDataPreserved:!0},human:`Local environment upgraded to ${h} at ${b.url}. Data volumes preserved.`}};exports.runLocalUpgradeCommand=d;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const e=require("./build--4zYt4wd.cjs"),t=require("./isDefined-CJctgvfE.cjs"),n=require("./isNonEmptyArray-v52xg4Xj.cjs"),r=require("./cli-error-CrUD8uMp.cjs"),i=require("./read-command-values-rGaU2qHz.cjs"),a=require("./format-details-COEwKz_M.cjs"),o=require("./format-table-4drtI5sP.cjs"),s=require("./format-metadata-owner-ByoX2plp.cjs"),c=require("./fetch-metadata-inspection-LB3RA2cV.cjs"),l=require("./format-metadata-fields-DmRandPR.cjs");var u=e.t(),d=e=>t.t(e)?String(e):`unknown`,f=async({arguments:e,target:f,signal:p,output:m})=>{let h=i.n(e,1)??``,{object:g,fields:_}=await c.t({objectName:i.n(e,0)??``,target:f,signal:p,output:m}),v=_.filter(e=>e.name===h);if(v.length>1)throw new r.t({code:`AMBIGUOUS_RESOURCE`,exitCode:r.n.USAGE,message:`More than one field has the API name ${h} on ${g.namePlural}.`});let y=v[0];if(!t.t(y))throw new r.t({code:`NOT_FOUND`,exitCode:r.n.NOT_FOUND,message:`No field has the API name ${h} on ${g.namePlural}.`,hint:`Use an exact API name from twenty metadata field list ${g.namePlural} --all.`});let b=l.r(y);return{data:{object:g,field:y},human:[`${y.label} (${y.name}) on ${g.namePlural}`,a.t([[`ID`,y.id],[`Type`,y.type],[`Owner`,s.t(y.owner)],[`Active`,d(y.isActive)],[`System`,d(y.isSystem)],[`Nullable`,d(y.isNullable)],[`Unique`,d(y.isUnique)],[`Default`,JSON.stringify(y.defaultValue??null)]]),y.description??``,l.n(y),n.t(b)?o.t({rows:b,columns:[{header:`OPTION`,value:e=>String(e.label??``)},{header:`VALUE`,value:e=>String(e.value??``)},{header:`COLOR`,value:e=>String(e.color??``)}]}):``].filter(u.isNonEmptyString).join(`
|
|
2
|
+
|
|
3
|
+
`)}};exports.runMetadataFieldDescribeCommand=f;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const e=require("./read-command-values-rGaU2qHz.cjs"),t=require("./fetch-metadata-inspection-
|
|
1
|
+
const e=require("./read-command-values-rGaU2qHz.cjs"),t=require("./fetch-metadata-inspection-LB3RA2cV.cjs"),n=require("./format-metadata-fields-DmRandPR.cjs");var r=({fields:e,includeSystemFields:t})=>{let n=e.filter(e=>t||e.isSystem!==!0);return{fields:n,hiddenSystemFieldCount:e.length-n.length}},i=async({arguments:i,options:a,target:o,signal:s,output:c})=>{let l=await t.t({objectName:e.n(i,0)??``,target:o,signal:s,output:c}),{object:u}=l,{fields:d,hiddenSystemFieldCount:f}=r({fields:l.fields,includeSystemFields:e.t(a,`all`)});return{data:{object:u,fields:d,hiddenSystemFieldCount:f},human:[`${u.labelPlural} (${u.namePlural})`,n.t({fields:d,hiddenSystemFieldCount:f,labelIdentifierFieldMetadataId:u.labelIdentifierFieldMetadataId})].join(`
|
|
2
2
|
|
|
3
3
|
`)}};exports.runMetadataFieldListCommand=i;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const e=require("./build--4zYt4wd.cjs"),t=require("./read-command-values-rGaU2qHz.cjs"),n=require("./style-BR52fK4V.cjs"),r=require("./format-data-value-
|
|
1
|
+
const e=require("./build--4zYt4wd.cjs"),t=require("./read-command-values-rGaU2qHz.cjs"),n=require("./style-BR52fK4V.cjs"),r=require("./format-data-value-D_1TNU-r.cjs"),i=require("./format-details-COEwKz_M.cjs"),a=require("./format-metadata-owner-ByoX2plp.cjs"),o=require("./fetch-metadata-inspection-LB3RA2cV.cjs");var s=e.t(),c=async({arguments:e,target:c,signal:l,output:u})=>{let{object:d}=await o.t({objectName:t.n(e,0)??``,target:c,signal:l,output:u});return{data:{object:d},human:[`${d.labelPlural} (${d.namePlural})`,i.t([[`ID`,d.id],[`API names`,`${d.nameSingular} / ${d.namePlural}`],...(0,s.isNonEmptyString)(d.description)?[[`Description`,r.r(d.description)]]:[],[`Owner`,a.t(d.owner)],[`Active`,String(d.isActive)],[`System`,String(d.isSystem)],[`Searchable`,String(d.isSearchable)]]),`Fields: ${n.r(`twenty metadata field list ${d.namePlural}`)}`].join(`
|
|
2
2
|
|
|
3
3
|
`)}};exports.runMetadataObjectDescribeCommand=c;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./read-command-values-rGaU2qHz.cjs"),t=require("./style-BR52fK4V.cjs"),n=require("./create-metadata-client-
|
|
1
|
+
const e=require("./read-command-values-rGaU2qHz.cjs"),t=require("./style-BR52fK4V.cjs"),n=require("./create-metadata-client-oO0QvH6j.cjs"),r=require("./format-table-4drtI5sP.cjs"),i=require("./metadata-page.constant-Bt8myt0X.cjs"),a=require("./format-metadata-owner-ByoX2plp.cjs");var o=[`standard`,`application`,`custom`,`unknown`],s=(e,t)=>e.query({objects:{__args:{paging:{first:i.t,after:t},filter:{}},pageInfo:{hasNextPage:!0,endCursor:!0},edges:{node:{nameSingular:!0,namePlural:!0,labelSingular:!0,labelPlural:!0,isSystem:!0,isActive:!0,applicationId:!0}}},currentWorkspace:{workspaceCustomApplicationId:!0}}),c=async({options:c,output:l,target:u,signal:d})=>{let f=e.t(c,`all`),p=n.t({target:u,signal:d}),[{objects:m,currentWorkspace:h},{applications:g,areOwnersNamed:_}]=await Promise.all([s(p),a.r(p)]),v=await i.n(async e=>e===void 0?m:(await s(p,e)).objects);_||l.warn({code:`OWNERS_UNAVAILABLE`,message:`Owners other than Custom show as unknown: listing apps needs the Workspace Apps permission.`});let y=a.n({applications:g,workspaceCustomApplicationId:h.workspaceCustomApplicationId}),b=v.map(({applicationId:e,...t})=>({...t,owner:y(e)})),x=b.filter(e=>f||!e.isSystem).sort((e,t)=>{let n=o.indexOf(e.owner.kind)-o.indexOf(t.owner.kind);return n===0?e.namePlural.localeCompare(t.namePlural):n}),S=b.length-x.length;return{data:{objects:x,hiddenSystemObjectCount:S},human:[r.t({rows:x,columns:[{header:`API NAME`,value:e=>e.namePlural},{header:`LABEL`,value:e=>e.isActive?e.labelPlural:`${e.labelPlural} ${t.i(`(inactive)`)}`},{header:`OWNER`,value:e=>a.t(e.owner)}]}),t.i(S>0?`${x.length} objects · ${S} system objects hidden, show them with --all`:`${x.length} objects`)].join(`
|
|
2
2
|
`)}};exports.runMetadataObjectListCommand=c;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./build--4zYt4wd.cjs"),t=require("./isDefined-CJctgvfE.cjs"),n=require("./isPlainObject-fJEJm71P.cjs"),r=require("./cli-error-CrUD8uMp.cjs"),i=require("./api-url-protocols.constant-EEmR3Pmg.cjs"),a=require("./read-command-values-rGaU2qHz.cjs"),o=require("./resolve-request-url-BzW185lE.cjs"),s=require("./is-interaction-allowed-BQLOG8RG.cjs"),c=require("./create-metadata-client-oO0QvH6j.cjs"),l=require("./open-browser-LPuVspT7.cjs");var u=({workspaceUrl:e,page:n})=>{if(!t.t(n))return e.href;let i=URL.parse(n,e);if(!t.t(i)||i.origin!==e.origin||i.pathname.startsWith(`//`))throw new r.t({code:`USAGE`,exitCode:r.n.USAGE,message:`${n} is not a page of the workspace.`,hint:`Pass a path inside the workspace, for example settings/applications.`});return i.href},d=e.t(),f=(e,n)=>{let a=(0,d.isNonEmptyString)(e)?URL.parse(e):null;if(!t.t(a)||!i.t.includes(a.protocol))throw new r.t({code:`INVALID_RESPONSE`,message:`${n} did not return a web address for this workspace.`});return a},p=async({target:e,signal:t})=>{let{currentWorkspace:r}=await c.t({target:e,signal:t}).query({currentWorkspace:{workspaceUrls:{customUrl:!0,subdomainUrl:!0}}}),i=r?.workspaceUrls,a=(0,d.isNonEmptyString)(i?.customUrl)?i.customUrl:i?.subdomainUrl;if((0,d.isNonEmptyString)(a))return f(a,e.apiUrl);let s=await o.r({apiUrl:e.apiUrl,signal:t})(o.t({apiUrl:e.apiUrl,path:`/.well-known/oauth-authorization-server`}),{headers:{Accept:`application/json`}}),l=await o.n(s),u=f(s.ok&&n.t(l)?l.authorization_endpoint:void 0,e.apiUrl);return new URL(u.origin)},m=async({arguments:e,options:t,outputMode:n,target:i,signal:o})=>{let c=a.t(t,`urlOnly`);if(!c&&!s.t({options:t,outputMode:n}))throw new r.t({code:`USAGE`,exitCode:r.n.USAGE,message:`twenty open only opens a browser in an interactive terminal, not with --no-input, JSON output, redirected stdin or in CI.`,hint:`Add --url-only to print the address instead.`});let d=u({workspaceUrl:await p({target:i,signal:o}),page:a.n(e,0)});return c?{data:{url:d},human:d}:(l.t(d),{data:{url:d},human:`Opening ${d} in your browser.`})};exports.runOpenCommand=m;
|
package/dist/chunks/{run-remote-list-command-0f2QIf8C.cjs → run-remote-list-command-C2tZHRAT.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./build--4zYt4wd.cjs"),t=require("./style-BR52fK4V.cjs"),n=require("./get-config-path-C-D-QHuX.cjs"),r=require("./read-config-
|
|
1
|
+
const e=require("./build--4zYt4wd.cjs"),t=require("./style-BR52fK4V.cjs"),n=require("./get-config-path-C-D-QHuX.cjs"),r=require("./read-config-6GnzcpJm.cjs"),i=require("./get-credential-kind-qxy7oLdW.cjs"),a=require("./credential-kind-labels.constant-CKdoQF8o.cjs"),o=require("./format-table-4drtI5sP.cjs");var s=e.t(),c=async()=>{let e=await r.t(n.t()),c=Object.entries(e.remotes).map(([t,n])=>({name:t,apiUrl:n.apiUrl,credentials:i.t(n),workspaceName:(0,s.isString)(n.workspaceName)?n.workspaceName:null,isDefault:t===e.defaultRemote})).sort((e,t)=>e.name.localeCompare(t.name));return c.length===0?{data:{remotes:c,defaultRemote:null},human:`No saved remotes. ${t.i(`Sign in with: `)}${t.r(`twenty auth login --url <url>`)}`}:{data:{remotes:c,defaultRemote:e.defaultRemote??null},human:o.t({rows:c,columns:[{header:` `,value:e=>e.isDefault?t.n(`green`,`●`):``},{header:`NAME`,value:e=>e.name},{header:`URL`,value:e=>e.apiUrl},{header:`AUTH`,value:e=>a.t[e.credentials]},{header:`WORKSPACE`,value:e=>e.workspaceName??``}]})}};exports.runRemoteListCommand=c;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./read-command-values-rGaU2qHz.cjs"),t=require("./style-BR52fK4V.cjs"),n=require("./get-config-path-C-D-QHuX.cjs"),r=require("./find-remote-TcvVyJpy.cjs"),i=require("./update-config-
|
|
1
|
+
const e=require("./read-command-values-rGaU2qHz.cjs"),t=require("./style-BR52fK4V.cjs"),n=require("./get-config-path-C-D-QHuX.cjs"),r=require("./find-remote-TcvVyJpy.cjs"),i=require("./update-config-Bk0qgzgZ.cjs");var a=async({arguments:a,signal:o})=>{let s=e.n(a,0)??``,c=await i.t({configPath:n.t(),signal:o,update:e=>{r.t(e,s);let{[s]:t,...n}=e.remotes,{defaultRemote:i,...a}=e,o=i===s;return{result:o,config:{...o?a:e,remotes:n}}}});return{data:{removed:s,wasDefault:c},human:[t.o(`Removed ${s}.`),...c?[t.i(` There is no default remote now. Pick one with: twenty remote use <name>`)]:[]].join(`
|
|
2
2
|
`)}};exports.runRemoteRemoveCommand=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./cli-error-CrUD8uMp.cjs"),t=require("./read-command-values-rGaU2qHz.cjs"),n=require("./style-BR52fK4V.cjs"),r=require("./get-config-path-C-D-QHuX.cjs"),i=require("./find-remote-TcvVyJpy.cjs"),a=require("./update-config-
|
|
1
|
+
const e=require("./cli-error-CrUD8uMp.cjs"),t=require("./read-command-values-rGaU2qHz.cjs"),n=require("./style-BR52fK4V.cjs"),r=require("./get-config-path-C-D-QHuX.cjs"),i=require("./find-remote-TcvVyJpy.cjs"),a=require("./update-config-Bk0qgzgZ.cjs"),o=require("./validate-remote-name-ZWOgVe80.cjs");var s=async({arguments:s,signal:c})=>{let l=t.n(s,0)??``,u=o.t(t.n(s,1)??``);return{data:{previousName:l,name:u,isDefault:await a.t({configPath:r.t(),signal:c,update:t=>{let n=i.t(t,l);if(Object.hasOwn(t.remotes,u))throw new e.t({code:`REMOTE_EXISTS`,exitCode:e.n.USAGE,message:`A remote named ${u} already exists.`,hint:`Pick another name, or remove it first: twenty remote remove ${u}`});let{[l]:r,...a}=t.remotes,o=t.defaultRemote===l;return{result:o,config:{...t,remotes:{...a,[u]:n},...o?{defaultRemote:u}:{}}}}})},human:n.o(`Renamed ${l} to ${u}.`)}};exports.runRemoteRenameCommand=s;
|
package/dist/chunks/{run-remote-use-command-ByRTqnq5.cjs → run-remote-use-command-BKVP65QI.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./read-command-values-rGaU2qHz.cjs"),t=require("./style-BR52fK4V.cjs"),n=require("./get-config-path-C-D-QHuX.cjs"),r=require("./find-remote-TcvVyJpy.cjs"),i=require("./update-config-
|
|
1
|
+
const e=require("./read-command-values-rGaU2qHz.cjs"),t=require("./style-BR52fK4V.cjs"),n=require("./get-config-path-C-D-QHuX.cjs"),r=require("./find-remote-TcvVyJpy.cjs"),i=require("./update-config-Bk0qgzgZ.cjs");var a=async({arguments:a,signal:o})=>{let s=e.n(a,0)??``,c=await i.t({configPath:n.t(),signal:o,update:e=>({result:r.t(e,s),config:{...e,defaultRemote:s}})});return{data:{defaultRemote:s,apiUrl:c.apiUrl},human:t.o(`Default remote is now ${s} ${t.i(`(${c.apiUrl})`)}`)}};exports.runRemoteUseCommand=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./style-BR52fK4V.cjs"),t=require("./cli-version.constant-
|
|
1
|
+
const e=require("./style-BR52fK4V.cjs"),t=require("./cli-version.constant-jomCqLLP.cjs");var n=async()=>{let n={version:t.t,node:process.versions.node,platform:process.platform,arch:process.arch};return{data:n,human:`twenty ${n.version} ${e.i(`(node ${n.node}, ${n.platform}-${n.arch})`)}`}};exports.runVersionCommand=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./build--4zYt4wd.cjs"),t=require("./isDefined-CJctgvfE.cjs"),n=require("./isNonEmptyArray-v52xg4Xj.cjs"),r=require("./cli-error-CrUD8uMp.cjs"),i=require("./target-environment-variable.constant-D7z8AihP.cjs"),a=require("./find-remote-TcvVyJpy.cjs");var o=e.t(),s=e=>e.length<=1?e.join(``):`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]}`,c=(e,t)=>{let n=e[t]?.trim();return(0,o.isNonEmptyString)(n)?n:void 0},l=(e,t)=>({source:`remote`,remoteName:t,remote:a.t(e,t)}),u=async({environment:e,remoteFlag:a,loadConfig:o,warn:u})=>{let d=c(e,i.t.REMOTE),f=c(e,i.t.API_URL),p=c(e,i.t.API_KEY);if(t.t(a)){let r=Object.values(i.t).filter(n=>t.t(c(e,n)));return n.t(r)&&u({code:`ENVIRONMENT_TARGET_IGNORED`,message:`Using remote ${a}. Ignoring ${s(r)}.`}),l(await o(),a)}if(t.t(d)){if(t.t(f)||t.t(p))throw new r.t({code:`CONFLICTING_TARGET`,exitCode:r.n.USAGE,message:`${i.t.REMOTE} cannot be combined with ${i.t.API_URL} or ${i.t.API_KEY}.`,hint:`Unset one of them, or choose with --remote.`});return l(await o(),d)}if(t.t(f)!==t.t(p)){let e=t.t(f)?i.t.API_KEY:i.t.API_URL;throw new r.t({code:`INCOMPLETE_TARGET`,exitCode:r.n.USAGE,message:`${e} is not set.`,hint:`Set both ${i.t.API_URL} and ${i.t.API_KEY}, or neither.`})}if(t.t(f)&&t.t(p))return{source:`environment`,apiUrl:f,apiKey:p};let m=await o();if(t.t(m.defaultRemote))return l(m,m.defaultRemote);throw new r.t({code:`TARGET_REQUIRED`,exitCode:r.n.USAGE,message:`No workspace selected.`,hint:`Sign in with: twenty auth login --url <url>. Or set ${i.t.API_URL} and ${i.t.API_KEY}.`})};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./isDefined-CJctgvfE.cjs"),t=require("./cli-error-CrUD8uMp.cjs"),n=require("./parse-api-url-B5c0Gh_n.cjs"),r=require("./confirm-in-terminal-D2e1lKUY.cjs"),i=require("./read-config-6GnzcpJm.cjs"),a=require("./get-credential-kind-qxy7oLdW.cjs"),o=require("./sign-in-with-browser-DXd6hkJk.cjs"),s=require("./update-config-Bk0qgzgZ.cjs"),c=require("./fetch-signed-in-identity-GVHuJKXy.cjs");var l=(r,i,o)=>{let s=Object.hasOwn(r.remotes,o)?r.remotes[o]:void 0;if(!e.t(s)||a.t(s)!==`oauth`||s.twentyCLIAccessToken!==i.bearerToken||n.t({rawUrl:s.apiUrl,sourceName:o})!==i.apiUrl)throw new t.t({code:`CONFLICT`,exitCode:t.n.CONFLICT,message:`Remote ${o} changed while signing in again. No credentials were saved.`,hint:`Run the command again.`});return s},u=async({target:e,remoteName:t,error:n,configPath:a,output:u,signal:d})=>{if(l(await i.t(a),e,t),!await r.t({question:`Your session on ${t} is no longer valid. Sign in again now?`,signal:d}))throw n;let f=await o.t({apiUrl:e.apiUrl,output:u,signal:d}),p={...e,bearerToken:f.accessToken};return await c.t({target:p,signal:d}),await s.t({configPath:a,signal:d,update:n=>{let r=l(n,e,t);return{result:void 0,config:{...n,remotes:{...n.remotes,[t]:o.n({remote:r,credentials:{kind:`oauth`,...f}})}}}}}),p};exports.signInToRemoteAgain=u;
|