twenty 2.58.0 → 2.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +82 -54
- package/README.md +35 -22
- package/dist/app-template/.nvmrc +1 -1
- package/dist/app-template/example/files/README.md +20 -4
- package/dist/app-template/example/files/github/workflows/publish.yml +1 -1
- package/dist/app-template/example/files/src/default-role.ts +6 -4
- package/dist/app-template/yarn.lock +181 -118
- package/dist/app-worker.cjs +1 -1
- package/dist/chunks/{cli-version.constant-jomCqLLP.cjs → AssetDirectory-c_JEwMr2.cjs} +1 -1
- package/dist/chunks/application-source-globs-FUknjGdt.cjs +1 -0
- package/dist/chunks/{build-source-manifest-DcRIFlDb.cjs → build-source-manifest-CiNlHV98.cjs} +1 -1
- package/dist/chunks/build-source-snapshot-Dchjr_ga.cjs +898 -0
- package/dist/chunks/cli-version.constant-B200rijQ.cjs +1 -0
- package/dist/chunks/compile-application-translations-roDnPf1t.cjs +58 -0
- package/dist/chunks/create-metadata-client-DVQbIGNu.cjs +6 -0
- package/dist/chunks/create-pull-base-write-CX8xZhMz.cjs +1 -0
- package/dist/chunks/{create-rest-client-CMUss3u-.cjs → create-rest-client-HbzXSfhZ.cjs} +1 -1
- package/dist/chunks/extract-manifest-from-file-CaWVLmLU.cjs +1 -0
- package/dist/chunks/{extract-source-translations--J7rPcdh.cjs → extract-source-translations-CBveJ4xT.cjs} +1 -1
- package/dist/chunks/{fetch-metadata-inspection-LB3RA2cV.cjs → fetch-metadata-inspection-yvVdh4oY.cjs} +1 -1
- package/dist/chunks/{fetch-signed-in-identity-GVHuJKXy.cjs → fetch-signed-in-identity-B6fnxBHj.cjs} +1 -1
- package/dist/chunks/fetch-workspace-or-throw-C6tCV0YH.cjs +1 -0
- package/dist/chunks/{get-client-generation-skip-reason-CkpxXdRw.cjs → get-client-generation-skip-reason-CFgiU52t.cjs} +1 -1
- package/dist/chunks/get-mismatched-remote-url-D5jFYvVx.cjs +1 -0
- package/dist/chunks/global-flags.constant-Celofkx1.cjs +1 -0
- package/dist/chunks/{is-exported-manifest-DRPkDqYh.cjs → is-exported-manifest-C4lO285q.cjs} +1 -1
- package/dist/chunks/{is-valid-package-name-Bv-sKHlR.cjs → is-valid-package-name-zAWZPNrj.cjs} +1 -1
- package/dist/chunks/isRestorableApplicationSourcePath-Du_zM55R.cjs +1 -0
- package/dist/chunks/isValidUuid-D3NV1xmO.cjs +1 -0
- package/dist/chunks/{metadata-page.constant-Bt8myt0X.cjs → metadata-page.constant-D4-pGQWp.cjs} +1 -1
- package/dist/chunks/parse-app-export-BsxpQED7.cjs +1 -0
- package/dist/chunks/{parse-graphql-response-D3WfxVAu.cjs → parse-graphql-response-Cl8_fBgo.cjs} +1 -1
- package/dist/chunks/proxy-header-environment-variable.constant-CJyhJMve.cjs +1 -0
- package/dist/chunks/pull-minimum-sdk-version.constant-BTfcyhwh.cjs +6 -0
- package/dist/chunks/pull-source-CIsoJ2eR.cjs +1 -0
- package/dist/chunks/{read-app-identity-DyMNXRhZ.cjs → read-app-identity-Cny6sAGs.cjs} +1 -1
- package/dist/chunks/{read-application-identifier-hrv6xLTN.cjs → read-application-identifier-DcBW74TB.cjs} +1 -1
- package/dist/chunks/read-application-identity-BrtopaMa.cjs +1 -0
- package/dist/chunks/read-command-values-l5T9Lba4.cjs +1 -0
- package/dist/chunks/read-infer-deletion-option-D1HMBsfw.cjs +8 -0
- package/dist/chunks/{read-local-container-DsjjrgOn.cjs → read-local-container-Cs3cWspd.cjs} +1 -1
- package/dist/chunks/read-snapshot-file-Dxla2ete.cjs +1 -0
- package/dist/chunks/{read-source-identity-CXzcnYKk.cjs → read-source-identity-CnPDqB6X.cjs} +1 -1
- package/dist/chunks/record-pull-base-Dz4BldQf.cjs +1 -0
- package/dist/chunks/request-oauth-tokens-_Xwy2q9c.cjs +1 -0
- package/dist/chunks/resolve-command-target-QjBwHpMj.cjs +1 -0
- package/dist/chunks/{resolve-metadata-object-CN7eAeDR.cjs → resolve-metadata-object-7DhvIcEm.cjs} +1 -1
- package/dist/chunks/resolve-proxy-headers-DipR9jft.cjs +1 -0
- package/dist/chunks/resolve-request-url-CfvGDGkw.cjs +1 -0
- package/dist/chunks/{run-api-graphql-command-x0ynMacW.cjs → run-api-graphql-command-ELrIPdM5.cjs} +1 -1
- package/dist/chunks/{run-api-rest-command-p5A2Fb05.cjs → run-api-rest-command-COVnszcN.cjs} +1 -1
- package/dist/chunks/{run-app-add-command-oHIkbKe1.cjs → run-app-add-command-b9sm20rn.cjs} +2 -2
- package/dist/chunks/{run-app-apply-command-Ww_5FeZf.cjs → run-app-apply-command-CCsvdn3A.cjs} +2 -2
- package/dist/chunks/{run-app-build-command-DpgKL1XF.cjs → run-app-build-command-Daxe8O14.cjs} +1 -1
- package/dist/chunks/{run-app-dev-command-DVOvwZdx.cjs → run-app-dev-command-BPwltUcL.cjs} +2 -2
- package/dist/chunks/{run-app-exec-command-Cly1JhuE.cjs → run-app-exec-command-BMhrv7YU.cjs} +2 -2
- package/dist/chunks/{run-app-generate-client-command-CVwOI5-n.cjs → run-app-generate-client-command-Z-2bRkaH.cjs} +1 -1
- package/dist/chunks/{run-app-init-command-DdSdOmo5.cjs → run-app-init-command-B6npylwO.cjs} +2 -2
- package/dist/chunks/{run-app-install-command-zs9OY8uz.cjs → run-app-install-command-DqPQXj09.cjs} +1 -1
- package/dist/chunks/run-app-logs-command-CaLIVesh.cjs +8 -0
- package/dist/chunks/{run-app-operation-CBy4X1VK.cjs → run-app-operation-D_zIxvuw.cjs} +1 -1
- package/dist/chunks/{run-app-plan-command-Cuz9v8Db.cjs → run-app-plan-command-pc6mp7th.cjs} +1 -1
- package/dist/chunks/run-app-publish-command-CflX1x0o.cjs +1 -0
- package/dist/chunks/run-app-pull-command-PCMBNH6R.cjs +6 -0
- package/dist/chunks/{run-app-translations-extract-command-BZEJppmw.cjs → run-app-translations-extract-command-CGIFvpC1.cjs} +1 -1
- package/dist/chunks/{run-app-typecheck-command-BHFWyv_1.cjs → run-app-typecheck-command-DnCMdagB.cjs} +1 -1
- package/dist/chunks/{run-app-uninstall-command-DvBgm_4t.cjs → run-app-uninstall-command-DWXEgVKe.cjs} +1 -1
- package/dist/chunks/run-auth-login-command-DKCO9bot.cjs +1 -0
- package/dist/chunks/{run-auth-logout-command-BMpq04ml.cjs → run-auth-logout-command-hvi_HvpQ.cjs} +1 -1
- package/dist/chunks/{run-auth-status-command-2Xrg0AoZ.cjs → run-auth-status-command-0vh-ENNj.cjs} +1 -1
- package/dist/chunks/{run-cli-BoGVmb1j.cjs → run-cli-BG3itvCe.cjs} +1 -1
- package/dist/chunks/{run-commands-command-DZkaWdQm.cjs → run-commands-command-CJ7qNty3.cjs} +1 -1
- package/dist/chunks/run-data-export-command-DqyztEHe.cjs +3 -0
- package/dist/chunks/run-data-get-command-D7_BdNBa.cjs +1 -0
- package/dist/chunks/{run-data-list-command-CVubWAFh.cjs → run-data-list-command-ZIpyFE04.cjs} +1 -1
- package/dist/chunks/run-doctor-command-CgWSXl7H.cjs +2 -0
- package/dist/chunks/{run-local-logs-command-CkZln0BN.cjs → run-local-logs-command-COsSRk3f.cjs} +1 -1
- package/dist/chunks/{run-local-reset-command-B5UrKkAf.cjs → run-local-reset-command-m0x-EiA6.cjs} +1 -1
- package/dist/chunks/run-local-start-command-B8N5Jgjd.cjs +1 -0
- package/dist/chunks/{run-local-status-command-E3cpSfTu.cjs → run-local-status-command-BYxy0R9I.cjs} +1 -1
- package/dist/chunks/{run-local-stop-command-Cr3oAzQ9.cjs → run-local-stop-command-D66F73fW.cjs} +1 -1
- package/dist/chunks/{run-local-upgrade-command-Ch5AvQjt.cjs → run-local-upgrade-command-6P71bQw6.cjs} +1 -1
- package/dist/chunks/{run-metadata-field-describe-command-Bof9tzyG.cjs → run-metadata-field-describe-command-DZBqoC6c.cjs} +1 -1
- package/dist/chunks/{run-metadata-field-list-command-C2AxyLJH.cjs → run-metadata-field-list-command-3pXf6DzX.cjs} +1 -1
- package/dist/chunks/{run-metadata-object-describe-command-CEh8rVCs.cjs → run-metadata-object-describe-command-Dpmt4WVc.cjs} +1 -1
- package/dist/chunks/{run-metadata-object-list-command-4qWTuJlm.cjs → run-metadata-object-list-command-B2PTelCt.cjs} +1 -1
- package/dist/chunks/{run-open-command-BWRHlLfS.cjs → run-open-command-B4YhDwqh.cjs} +1 -1
- package/dist/chunks/{run-remote-remove-command-Dc0XJydM.cjs → run-remote-remove-command-DgSQvjeN.cjs} +1 -1
- package/dist/chunks/{run-remote-rename-command-3AzuENYT.cjs → run-remote-rename-command--37-GTRY.cjs} +1 -1
- package/dist/chunks/{run-remote-use-command-BKVP65QI.cjs → run-remote-use-command-B6obKSPB.cjs} +1 -1
- package/dist/chunks/{run-version-command-BZ_R0Tss.cjs → run-version-command-YPMJadrD.cjs} +1 -1
- package/dist/chunks/{sign-in-to-remote-again-DN6ov5o2.cjs → sign-in-to-remote-again-D9amgIOZ.cjs} +1 -1
- package/dist/chunks/{sign-in-with-browser-DXd6hkJk.cjs → sign-in-with-browser-TQANmPyb.cjs} +2 -2
- package/dist/chunks/standard-object-fields.constant-jQV_KO0f.cjs +1 -0
- package/dist/chunks/subscribe-graphql-w-Ar4hCj.cjs +2 -0
- package/dist/chunks/to-worker-output-diagnostics-w1hZPfn0.cjs +2 -0
- package/dist/chunks/{wait-for-local-environment-BmOFeICJ.cjs → wait-for-local-environment-zNEJcWA1.cjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/docs/commands.md +878 -233
- package/package.json +3 -2
- package/src/app/README.md +15 -10
- package/src/app/add/README.md +75 -51
- package/src/app/bundles/README.md +63 -33
- package/src/app/client/README.md +23 -21
- package/src/app/dev/README.md +30 -16
- package/src/app/exec/README.md +61 -41
- package/src/app/function-logs/README.md +49 -32
- package/src/app/manifest/README.md +31 -25
- package/src/app/pull/README.md +207 -21
- package/src/app/source/README.md +67 -14
- package/src/app/typecheck/README.md +29 -24
- package/dist/chunks/FileFolder-BmCXp_bX.cjs +0 -1
- package/dist/chunks/build-source-snapshot-C0UVzVTo.cjs +0 -897
- package/dist/chunks/compile-application-translations-Da3xWXl-.cjs +0 -58
- package/dist/chunks/create-metadata-client-oO0QvH6j.cjs +0 -6
- package/dist/chunks/create-pull-base-write-CQHTbtQP.cjs +0 -1
- package/dist/chunks/extract-manifest-from-file-DPDIhnyg.cjs +0 -1
- package/dist/chunks/fetch-workspace-or-throw-CGlqJOIG.cjs +0 -1
- package/dist/chunks/global-flags.constant-DooTv_Uq.cjs +0 -1
- package/dist/chunks/list-application-source-files-jEau5Rie.cjs +0 -1
- package/dist/chunks/parse-app-export-CmFKsj2e.cjs +0 -1
- package/dist/chunks/pull-minimum-sdk-version.constant-0v8yv93F.cjs +0 -6
- package/dist/chunks/pull-source-C6LiDOqa.cjs +0 -1
- package/dist/chunks/read-application-identity-CyVawH0m.cjs +0 -1
- package/dist/chunks/read-command-values-rGaU2qHz.cjs +0 -1
- package/dist/chunks/read-infer-deletion-option-Br1FJCfZ.cjs +0 -8
- package/dist/chunks/read-snapshot-file-D-s1kuCP.cjs +0 -1
- package/dist/chunks/record-pull-base-BZ6YgdEp.cjs +0 -1
- package/dist/chunks/request-oauth-tokens-B4JHBmVU.cjs +0 -1
- package/dist/chunks/resolve-command-target-CwC9p_NB.cjs +0 -1
- package/dist/chunks/resolve-request-url-BzW185lE.cjs +0 -1
- package/dist/chunks/run-app-logs-command-CnW8I5a0.cjs +0 -9
- package/dist/chunks/run-app-publish-command-DACw_WFa.cjs +0 -1
- package/dist/chunks/run-app-pull-command-CNbC_iZs.cjs +0 -6
- package/dist/chunks/run-auth-login-command-DmnIxGG3.cjs +0 -1
- package/dist/chunks/run-data-get-command-BE6hUvWQ.cjs +0 -1
- package/dist/chunks/run-doctor-command-OCHUN5AA.cjs +0 -2
- package/dist/chunks/run-local-start-command-Cp8nzjc6.cjs +0 -1
- package/dist/chunks/standard-object-fields.constant-2yLND0Cg.cjs +0 -1
- package/dist/chunks/to-worker-output-diagnostics-DlISjOqp.cjs +0 -2
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={path:[`local`,`start`],description:`Start the local Twenty development environment`,options:[{flags:`-p, --port <port>`,description:`HTTP port for a new instance (default: 2020, or 2021 with --test)`},{flags:`--test`,description:`Use the separate local test instance`}],arguments:[{name:`version`,description:`Twenty version or image tag (new instances: engines.twenty, then latest)`,required:!1}],examples:[`twenty local start`,`twenty local start 2.53.1 --test`],outputModes:[`human`,`json`],writes:!0,needsProject:!1,needsTarget:!1,load:async()=>(await Promise.resolve().then(()=>require("./run-local-start-command-Cp8nzjc6.cjs"))).runLocalStartCommand},t={path:[`local`,`stop`],description:`Stop the local environment, preserving its data`,options:[{flags:`--test`,description:`Use the separate local test instance`}],examples:[`twenty local stop`],outputModes:[`human`,`json`],writes:!0,needsProject:!1,needsTarget:!1,load:async()=>(await Promise.resolve().then(()=>require("./run-local-stop-command-Cr3oAzQ9.cjs"))).runLocalStopCommand},n={path:[`local`,`status`],description:`Show local environment status, URL and image`,options:[{flags:`--test`,description:`Use the separate local test instance`}],examples:[`twenty local status --json`],outputModes:[`human`,`json`],writes:!1,needsProject:!1,needsTarget:!1,load:async()=>(await Promise.resolve().then(()=>require("./run-local-status-command-E3cpSfTu.cjs"))).runLocalStatusCommand},r={path:[`local`,`logs`],description:`Stream local environment logs`,options:[{flags:`-n, --lines <lines>`,description:`Number of recent log lines (default: 50, maximum: 10000)`},{flags:`--no-follow`,description:`Print recent logs and exit`},{flags:`--test`,description:`Use the separate local test instance`}],examples:[`twenty local logs`,`twenty local logs --test --no-follow`],outputModes:[`human`,`ndjson`],writes:!1,needsProject:!1,needsTarget:!1,load:async()=>(await Promise.resolve().then(()=>require("./run-local-logs-command-CkZln0BN.cjs"))).runLocalLogsCommand},i={path:[`local`,`reset`],description:`Delete the local environment and all its data`,options:[{flags:`--yes`,description:`Delete the local environment and its data without asking`},{flags:`--test`,description:`Use the separate local test instance`}],examples:[`twenty local reset`,`twenty local reset --test --yes`],outputModes:[`human`,`json`],writes:!0,needsProject:!1,needsTarget:!1,load:async()=>(await Promise.resolve().then(()=>require("./run-local-reset-command-B5UrKkAf.cjs"))).runLocalResetCommand},a={path:[`local`,`upgrade`],description:`Upgrade the local environment, preserving its data volumes`,options:[{flags:`--test`,description:`Use the separate local test instance`}],arguments:[{name:`version`,description:`Twenty version or image tag (default: engines.twenty, then latest)`,required:!1}],examples:[`twenty local upgrade`,`twenty local upgrade 2.53.1 --test`],outputModes:[`human`,`json`],writes:!0,needsProject:!1,needsTarget:!1,load:async()=>(await Promise.resolve().then(()=>require("./run-local-upgrade-command-Ch5AvQjt.cjs"))).runLocalUpgradeCommand},o={path:[`app`,`install`],description:`Install a registered app package in the target workspace`,options:[{flags:`--path <directory>`,description:`App directory (default: the app containing the current folder)`},{flags:`--universal-identifier <id>`,description:`Registered app universal identifier, works without a local project`}],examples:[`twenty app install --remote dev`,`twenty app install --path ./apps/billing --json`,`twenty app install --universal-identifier <id> --remote staging --json`],outputModes:[`human`,`json`],writes:!0,needsProject:!0,needsTarget:!0,requiredPermissions:[`APPLICATIONS`],load:async()=>(await Promise.resolve().then(()=>require("./run-app-install-command-zs9OY8uz.cjs"))).runAppInstallCommand},s={path:[`app`,`publish`],description:`Build and publish the app to npm or a private Twenty registry`,options:[{flags:`--private`,description:`Publish to a Twenty server registry using --remote or the active target`},{flags:`--path <directory>`,description:`App directory (default: the app containing the current folder)`},{flags:`--tag <tag>`,description:`npm dist-tag, for example beta or next`}],examples:[`twenty app publish`,`twenty app publish --private --remote dev`,`twenty app publish --path ./apps/billing --tag beta --json`],outputModes:[`human`,`json`],writes:!0,needsProject:!0,needsTarget:!1,load:async()=>(await Promise.resolve().then(()=>require("./run-app-publish-command-DACw_WFa.cjs"))).runAppPublishCommand},c={path:[`app`,`dev`],description:`Watch app source, build complete snapshots and sync changes to the workspace`,options:[{flags:`--path <directory>`,description:`App directory (default: the app containing the current folder)`},{flags:`--prune`,description:`Delete remote entities missing from the app source (the default, except for the workspace custom application)`},{flags:`--no-prune`,description:`Keep remote entities missing from the app source`},{flags:`--no-delete`,description:`Deprecated alias of --no-prune`,hidden:!0},{flags:`--create`,description:`Allow registering and installing an app with no registration`},{flags:`--yes`,description:`Allow object and field deletions without asking`}],examples:[`twenty app dev --remote dev`,`twenty app dev --create --no-prune`,`twenty app dev --format ndjson --no-prune`],outputModes:[`human`,`ndjson`],writes:!0,needsProject:!0,needsTarget:!0,requiredPermissions:[`APPLICATIONS`,`UPLOAD_FILE`],load:async()=>(await Promise.resolve().then(()=>require("./run-app-dev-command-DVOvwZdx.cjs"))).runAppDevCommand},l={path:[`app`,`add`],description:`Add an object, field, logic function, front component or validation rule to an app`,arguments:[{name:`entity`,description:`object, field, logic-function, front-component or validation-rule (prompted when omitted)`,required:!1}],options:[{flags:`--path <directory>`,description:`App directory (default: the app containing the current folder)`},{flags:`--name <name>`,description:`Definition name; also determines the generated filename`},{flags:`--create-view`,description:`Create a table view for the new object`},{flags:`--create-navigation-menu-item`,description:`Create a navigation menu item for the new object`},{flags:`--create-page-layout`,description:`Create a record page layout and its fields view for the new object`},{flags:`--name-plural <name>`,description:`Plural API name (object)`},{flags:`--label <label>`,description:`Display label (object or field; default: derived from name)`},{flags:`--label-plural <label>`,description:`Plural display label (object; default: derived from plural name)`},{flags:`--type <type>`,description:`Field type, for example TEXT, NUMBER or RELATION (default: TEXT)`},{flags:`--object <uuid>`,description:`Parent object universal identifier (field or validation rule)`},{flags:`--description <text>`,description:`Field description`},{flags:`--target-object <uuid>`,description:`Target object universal identifier (relation field)`},{flags:`--target-field <uuid>`,description:`Target field universal identifier (relation field)`},{flags:`--relation-type <type>`,description:`ONE_TO_MANY or MANY_TO_ONE (relation field; default: ONE_TO_MANY)`},{flags:`--on-delete <action>`,description:`CASCADE, RESTRICT, SET_NULL, NO_ACTION or None (relation field; default: CASCADE)`}],examples:[`twenty app add`,`twenty app add object --name invoice --name-plural invoices --no-input`,`twenty app add object --name invoice --name-plural invoices --create-view --create-navigation-menu-item --create-page-layout --no-input`,`twenty app add field --name amount --type NUMBER --object <object-universal-identifier> --json`,`twenty app add logic-function --name send-invoice --no-input`,`twenty app add front-component --name invoice-panel --no-input`],outputModes:[`human`,`json`],writes:!0,needsProject:!0,needsTarget:!1,load:async()=>(await Promise.resolve().then(()=>require("./run-app-add-command-oHIkbKe1.cjs"))).runAppAddCommand},u={path:[`app`,`exec`],description:`Execute a deployed app logic function as the signed-in user`,options:[{flags:`--path <directory>`,description:`App directory (default: the app containing the current folder)`},{flags:`--name <name>`,description:`Exact deployed function name`},{flags:`--universal-identifier <id>`,description:`Function universal identifier`},{flags:`--post-install`,description:`Execute the post-install hook without installing the app`},{flags:`--pre-install`,description:`Execute the pre-install hook without installing the app`},{flags:`--uninstall-hook`,description:`Execute the uninstall hook without uninstalling the app`},{flags:`--payload <json>`,description:`JSON object, @file or - for stdin (default: {})`}],examples:[`twenty app exec --name add-numbers --remote dev`,`twenty app exec --name add-numbers --payload @payload.json --json`,`twenty app exec --post-install --payload '{}'`],outputModes:[`human`,`json`],writes:!0,needsProject:!0,needsTarget:!0,requiredPermissions:[`APPLICATIONS`,`WORKFLOWS`],load:async()=>(await Promise.resolve().then(()=>require("./run-app-exec-command-Cly1JhuE.cjs"))).runAppExecCommand},d={path:[`app`,`generate-client`],description:`Regenerate the app's typed API client from the workspace schema, without building or syncing`,options:[{flags:`--path <directory>`,description:`App directory (default: the app containing the current folder)`}],examples:[`twenty app generate-client --remote dev`,`twenty app generate-client --path ./apps/billing --json`],outputModes:[`human`,`json`],writes:!0,needsProject:!0,needsTarget:!0,load:async()=>(await Promise.resolve().then(()=>require("./run-app-generate-client-command-CVwOI5-n.cjs"))).runAppGenerateClientCommand},f={path:[`app`,`logs`],description:`Watch new logic-function logs from this app`,options:[{flags:`--path <directory>`,description:`App directory (default: the app containing the current folder)`},{flags:`--name <name>`,description:`Filter all functions with this exact name within the app`},{flags:`--universal-identifier <id>`,description:`Filter one function by universal identifier`}],examples:[`twenty app logs --remote dev`,`twenty app logs --name add-numbers --remote dev`,`twenty app logs --format ndjson`],outputModes:[`human`,`ndjson`],writes:!1,needsProject:!0,needsTarget:!0,requiredPermissions:[`WORKFLOWS`],load:async()=>(await Promise.resolve().then(()=>require("./run-app-logs-command-CnW8I5a0.cjs"))).runAppLogsCommand},p={path:[`app`,`apply`],description:`Build the app, preview the changes, then upload and sync it to the workspace`,options:[{flags:`--path <directory>`,description:`App directory (default: the app containing the current folder)`},{flags:`--prune`,description:`Delete remote entities missing from the app source (the default, except for the workspace custom application)`},{flags:`--no-prune`,description:`Keep remote entities missing from the app source`},{flags:`--no-delete`,description:`Deprecated alias of --no-prune`,hidden:!0},{flags:`--create`,description:`Register the app and install it in the workspace if it has no registration yet`},{flags:`--yes`,description:`Apply object and field deletions without asking; does not change which entities are deleted`}],examples:[`twenty app apply --remote dev`,`twenty app apply --create --json`,`twenty app apply --no-prune`,`twenty app apply --prune`],outputModes:[`human`,`json`],writes:!0,needsProject:!0,needsTarget:!0,requiredPermissions:[`APPLICATIONS`,`UPLOAD_FILE`],load:async()=>(await Promise.resolve().then(()=>require("./run-app-apply-command-Ww_5FeZf.cjs"))).runAppApplyCommand},m={path:[`app`,`build`],description:`Build the app with the CLI and report the artifacts`,options:[{flags:`--path <directory>`,description:`App directory (default: the app containing the current folder)`}],examples:[`twenty app build`,`twenty app build --path ./apps/billing --json`],outputModes:[`human`,`json`],writes:!1,needsProject:!0,needsTarget:!1,load:async()=>(await Promise.resolve().then(()=>require("./run-app-build-command-DpgKL1XF.cjs"))).runAppBuildCommand},h={path:[`app`,`init`],description:`Create an app from the template bundled with this CLI, without installing anything`,arguments:[{name:`name`,description:`Package name of the app, for example my-app`,required:!0}],options:[{flags:`--path <directory>`,description:`Directory to create (default: ./<name>)`},{flags:`--display-name <name>`,description:`Name shown in Twenty (default: derived from the package name)`},{flags:`--description <text>`,description:`Description shown in Twenty`}],examples:[`twenty app init my-app`,`twenty app init billing --path ./apps/billing --display-name Billing --json`],outputModes:[`human`,`json`],writes:!0,needsProject:!1,needsTarget:!1,load:async()=>(await Promise.resolve().then(()=>require("./run-app-init-command-DdSdOmo5.cjs"))).runAppInitCommand},g={path:[`app`,`pull`],description:`Pull an app, or create a local project for the workspace custom app`,options:[{flags:`--path <directory>`,description:`App directory, or a new or empty directory for the workspace custom app`},{flags:`--yes`,description:`Create a missing project and install its dependencies without prompting`},{flags:`--verbose`,description:`List coverage details`}],examples:[`twenty app pull --remote dev`,`twenty app pull --path ./apps/billing`,`twenty app pull --path ./workspace-app --yes --json`],outputModes:[`human`,`json`],writes:!0,needsProject:!1,needsTarget:!0,requiredPermissions:[`APPLICATIONS`],load:async()=>(await Promise.resolve().then(()=>require("./run-app-pull-command-CNbC_iZs.cjs"))).runAppPullCommand},_={path:[`app`,`plan`],description:`Build the app and preview metadata changes without applying them`,options:[{flags:`--path <directory>`,description:`App directory (default: the app containing the current folder)`},{flags:`--prune`,description:`Delete remote entities missing from the app source (the default, except for the workspace custom application)`},{flags:`--no-prune`,description:`Keep remote entities missing from the app source`},{flags:`--no-delete`,description:`Deprecated alias of --no-prune`,hidden:!0}],examples:[`twenty app plan --remote dev`,`twenty app plan --path ./apps/billing --no-prune --json`,`twenty app plan --prune`],outputModes:[`human`,`json`],writes:!1,needsProject:!0,needsTarget:!0,requiredPermissions:[`APPLICATIONS`],load:async()=>(await Promise.resolve().then(()=>require("./run-app-plan-command-Cuz9v8Db.cjs"))).runAppPlanCommand},v={path:[`app`,`translations`,`extract`],description:`Extract app strings and update translation catalogs`,options:[{flags:`--path <directory>`,description:`App directory (default: the app containing the current folder)`},{flags:`--locale <locale>`,description:`Create a target locale catalog if missing, for example fr-FR`}],examples:[`twenty app translations extract`,`twenty app translations extract --locale fr-FR`,`twenty app translations extract --path ./apps/billing --json`],outputModes:[`human`,`json`],writes:!0,needsProject:!0,needsTarget:!1,load:async()=>(await Promise.resolve().then(()=>require("./run-app-translations-extract-command-BZEJppmw.cjs"))).runAppTranslationsExtractCommand},y={path:[`app`,`typecheck`],description:`Typecheck the app with its project TypeScript, without building`,options:[{flags:`--path <directory>`,description:`App directory (default: the app containing the current folder)`}],examples:[`twenty app typecheck`,`twenty app typecheck --json`],outputModes:[`human`,`json`],writes:!1,needsProject:!0,needsTarget:!1,load:async()=>(await Promise.resolve().then(()=>require("./run-app-typecheck-command-BHFWyv_1.cjs"))).runAppTypecheckCommand},b={path:[`app`,`uninstall`],description:`Uninstall the app from the workspace, deleting its objects, fields and their data`,options:[{flags:`--path <directory>`,description:`App directory (default: the app containing the current folder)`},{flags:`--universal-identifier <id>`,description:`Uninstall the app with this universal identifier, works without a local project`},{flags:`--yes`,description:`Uninstall without asking`}],examples:[`twenty app uninstall --remote dev`,`twenty app uninstall --yes --json`,`twenty app uninstall --universal-identifier <id> --yes`],outputModes:[`human`,`json`],writes:!0,needsProject:!0,needsTarget:!0,requiredPermissions:[`APPLICATIONS`],load:async()=>(await Promise.resolve().then(()=>require("./run-app-uninstall-command-DvBgm_4t.cjs"))).runAppUninstallCommand},x={path:[`auth`,`login`],description:`Sign in with your browser or an API key, and save the remote`,options:[{flags:`--with-token`,description:`Read an API key from standard input`},{flags:`--url <url>`,description:`Twenty server URL, for example https://acme.twenty.com`},{flags:`--name <name>`,description:`Name of the remote to save (defaults to "default")`},{flags:`--use`,description:`Make this remote the default`},{flags:`--replace`,description:`Point an existing remote at a different URL`}],examples:[`twenty auth login --url https://acme.twenty.com`,`twenty auth login --url https://acme.twenty.com --name prod --use`,`printf '%s' "$TWENTY_API_KEY" | twenty auth login --with-token --url https://acme.twenty.com --name prod --use`,`twenty auth login --with-token --remote prod < api-key.txt`],outputModes:[`human`,`json`],writes:!0,needsProject:!1,needsTarget:!1,load:async()=>(await Promise.resolve().then(()=>require("./run-auth-login-command-DmnIxGG3.cjs"))).runAuthLoginCommand},S={path:[`auth`,`logout`],description:`Forget the credentials of a saved remote, keeping the remote`,examples:[`twenty auth logout --remote staging`],outputModes:[`human`,`json`],writes:!0,needsProject:!1,needsTarget:!1,load:async()=>(await Promise.resolve().then(()=>require("./run-auth-logout-command-BMpq04ml.cjs"))).runAuthLogoutCommand},C={path:[`auth`,`status`],description:`Show which workspace commands use and check its credentials`,outputModes:[`human`,`json`],writes:!1,needsProject:!1,needsTarget:!0,load:async()=>(await Promise.resolve().then(()=>require("./run-auth-status-command-2Xrg0AoZ.cjs"))).runAuthStatusCommand},w={path:[`auth`,`token`],description:`Print the credential commands send, for scripts`,examples:[`curl -H "Authorization: Bearer $(twenty auth token)" https://acme.twenty.com/rest/companies`],outputModes:[`human`,`json`],writes:!1,needsProject:!1,needsTarget:!0,load:async()=>(await Promise.resolve().then(()=>require("./run-auth-token-command-D4geJ-rx.cjs"))).runAuthTokenCommand},T={path:[`api`,`graphql`],description:`Send a GraphQL query or mutation`,options:[{flags:`--query <query>`,description:`GraphQL document: inline, @file.graphql, or - for standard input`,required:!0},{flags:`--variables <json>`,description:`Variables as a JSON object: inline, @file.json, or - for standard input`},{flags:`--metadata`,description:`Send to the metadata API instead of the core API`}],examples:[`twenty api graphql --query '{ companies(first: 2) { edges { node { name } } } }'`,`twenty api graphql --metadata --query '{ currentWorkspace { displayName } }'`,`twenty api graphql --query @create-company.graphql --variables @variables.json`],outputModes:[`human`,`json`],writes:!0,needsProject:!1,needsTarget:!0,load:async()=>(await Promise.resolve().then(()=>require("./run-api-graphql-command-x0ynMacW.cjs"))).runApiGraphqlCommand},E={path:[`api`,`rest`],description:`Send a request to the REST API`,arguments:[{name:`path`,description:`Path under the API URL, for example /rest/companies`,required:!0}],options:[{flags:`-X, --method <method>`,description:`HTTP method, defaults to GET; required with --body`,choices:[`GET`,`POST`,`PATCH`,`PUT`,`DELETE`]},{flags:`--body <json>`,description:`Request body: JSON, @file.json, or - for standard input`}],examples:[`twenty api rest '/rest/companies?limit=5'`,`twenty api rest /rest/companies --method POST --body '{"name":"Linear"}'`,`twenty api rest /rest/companies/<id> --method PATCH --body @changes.json`],outputModes:[`human`,`json`],writes:!0,needsProject:!1,needsTarget:!0,load:async()=>(await Promise.resolve().then(()=>require("./run-api-rest-command-p5A2Fb05.cjs"))).runApiRestCommand},D={WORKSPACE:`Workspace:`,APP:`App development:`,TOOLS:`Tools:`},O={path:[`commands`],description:`List the available commands`,helpGroup:D.TOOLS,outputModes:[`human`,`json`],writes:!1,needsProject:!1,needsTarget:!1,load:async()=>(await Promise.resolve().then(()=>require("./run-commands-command-DZkaWdQm.cjs"))).runCommandsCommand},k={path:[`data`,`get`],description:`Inspect a record by id`,arguments:[{name:`object`,description:`Exact singular or plural API name`,required:!0},{name:`id`,description:`Record id`,required:!0}],examples:[`twenty data get companies <id>`,`twenty data get people <id> --json`],outputModes:[`human`,`json`],writes:!1,needsProject:!1,needsTarget:!0,load:async()=>(await Promise.resolve().then(()=>require("./run-data-get-command-BE6hUvWQ.cjs"))).runDataGetCommand},A={path:[`data`,`list`],description:`List records with REST filters and pagination`,arguments:[{name:`object`,description:`Exact singular or plural API name`,required:!0}],options:[{flags:`--filter <expression>`,description:`REST filter expression, passed through unchanged`},{flags:`--order-by <expression>`,description:`REST order_by expression, passed through unchanged`},{flags:`--fields <names>`,description:`Comma-separated human table columns; JSON and NDJSON retain full records`},{flags:`--limit <count>`,description:`Records per page, 1–200 (default: 50)`},{flags:`--cursor <cursor>`,description:`Start after this opaque REST cursor`},{flags:`--all`,description:`Read every remaining page, bounded unless --format ndjson is used`}],examples:[`twenty data list companies --limit 20`,`twenty data list companies --filter 'employees[gte]:5000' --order-by 'employees[DescNullsLast]'`,`twenty data list people --all --format ndjson`],outputModes:[`human`,`json`,`ndjson`],writes:!1,needsProject:!1,needsTarget:!0,load:async()=>(await Promise.resolve().then(()=>require("./run-data-list-command-CVubWAFh.cjs"))).runDataListCommand},j={path:[`doctor`],description:`Diagnose CLI, app SDK and workspace connection problems`,helpGroup:D.TOOLS,options:[{flags:`--path <directory>`,description:`App directory to inspect`},{flags:`--offline`,description:`Skip network checks`}],examples:[`twenty doctor`,`twenty doctor --remote staging --path ./my-app --json`,`twenty doctor --offline`],outputModes:[`human`,`json`],writes:!1,needsProject:!1,needsTarget:!1,load:async()=>(await Promise.resolve().then(()=>require("./run-doctor-command-OCHUN5AA.cjs"))).runDoctorCommand},M={path:[`metadata`,`object`,`describe`],description:`Describe an object`,arguments:[{name:`object`,description:`Exact singular or plural API name`,required:!0}],examples:[`twenty metadata object describe companies`,`twenty metadata object describe person --json`],outputModes:[`human`,`json`],writes:!1,needsProject:!1,needsTarget:!0,load:async()=>(await Promise.resolve().then(()=>require("./run-metadata-object-describe-command-CEh8rVCs.cjs"))).runMetadataObjectDescribeCommand},N={path:[`metadata`,`field`,`list`],description:`List fields and who owns each one`,arguments:[{name:`object`,description:`Exact singular or plural API name`,required:!0}],options:[{flags:`--all`,description:`Include system fields`}],examples:[`twenty metadata field list companies`,`twenty metadata field list companies --all --json`],outputModes:[`human`,`json`],writes:!1,needsProject:!1,needsTarget:!0,load:async()=>(await Promise.resolve().then(()=>require("./run-metadata-field-list-command-C2AxyLJH.cjs"))).runMetadataFieldListCommand},P={path:[`metadata`,`field`,`describe`],description:`Describe a field, its constraints, options and relations`,arguments:[{name:`object`,description:`Exact singular or plural object API name`,required:!0},{name:`field`,description:`Exact field API name, including system fields`,required:!0}],examples:[`twenty metadata field describe companies tier`,`twenty metadata field describe people company --json`],outputModes:[`human`,`json`],writes:!1,needsProject:!1,needsTarget:!0,load:async()=>(await Promise.resolve().then(()=>require("./run-metadata-field-describe-command-Bof9tzyG.cjs"))).runMetadataFieldDescribeCommand},F={path:[`metadata`,`object`,`list`],description:`List objects and who owns each one`,options:[{flags:`--all`,description:`Include system objects`}],examples:[`twenty metadata object list`,`twenty metadata object list --all --json`],outputModes:[`human`,`json`],writes:!1,needsProject:!1,needsTarget:!0,load:async()=>(await Promise.resolve().then(()=>require("./run-metadata-object-list-command-4qWTuJlm.cjs"))).runMetadataObjectListCommand},I={path:[`open`],description:`Open the workspace in your browser`,helpGroup:D.WORKSPACE,arguments:[{name:`page`,description:`Page to open, for example settings/applications`,required:!1}],options:[{flags:`--url-only`,description:`Print the address instead of opening a browser`}],examples:[`twenty open`,`twenty open settings/applications`,`twenty open --remote staging --url-only --json`],outputModes:[`human`,`json`],writes:!1,needsProject:!1,needsTarget:!0,load:async()=>(await Promise.resolve().then(()=>require("./run-open-command-BWRHlLfS.cjs"))).runOpenCommand},L={path:[`remote`,`list`],description:`List saved remotes`,outputModes:[`human`,`json`],writes:!1,needsProject:!1,needsTarget:!1,load:async()=>(await Promise.resolve().then(()=>require("./run-remote-list-command-C2tZHRAT.cjs"))).runRemoteListCommand},R={path:[`remote`,`remove`],description:`Remove a saved remote and its credentials`,arguments:[{name:`name`,description:`Saved remote`,required:!0}],outputModes:[`human`,`json`],writes:!0,needsProject:!1,needsTarget:!1,load:async()=>(await Promise.resolve().then(()=>require("./run-remote-remove-command-Dc0XJydM.cjs"))).runRemoteRemoveCommand},z={path:[`remote`,`rename`],description:`Rename a saved remote`,arguments:[{name:`current`,description:`Current name`,required:!0},{name:`new`,description:`New name`,required:!0}],outputModes:[`human`,`json`],writes:!0,needsProject:!1,needsTarget:!1,load:async()=>(await Promise.resolve().then(()=>require("./run-remote-rename-command-3AzuENYT.cjs"))).runRemoteRenameCommand},B={path:[`remote`,`use`],description:`Make a saved remote the default`,arguments:[{name:`name`,description:`Saved remote`,required:!0}],outputModes:[`human`,`json`],writes:!0,needsProject:!1,needsTarget:!1,load:async()=>(await Promise.resolve().then(()=>require("./run-remote-use-command-BKVP65QI.cjs"))).runRemoteUseCommand},V={path:[`version`],description:`Print version information`,helpGroup:D.TOOLS,outputModes:[`human`,`json`],writes:!1,needsProject:!1,needsTarget:!1,load:async()=>(await Promise.resolve().then(()=>require("./run-version-command-BZ_R0Tss.cjs"))).runVersionCommand},H=[e,t,n,r,i,a,l,p,c,u,f,m,d,h,_,g,s,v,y,o,b,x,S,C,w,L,B,z,R,T,E,O,A,k,j,F,M,N,P,I,V],U=e=>e.path.join(` `),W={JSON:`--json`,FORMAT:`--format <format>`,REMOTE:`-r, --remote <name>`,NO_INPUT:`--no-input`,HELP:`-h, --help`,VERSION:`-v, --version`};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return W}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let e=require("tinyglobby");var t=[`**/*.ts`,`**/*.tsx`],n=[`**/node_modules/**`,`**/*.d.ts`,`**/dist/**`,`**/.twenty/**`],r=async r=>(await(0,e.glob)(t,{cwd:r,absolute:!0,ignore:n,onlyFiles:!0})).sort();Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./build--4zYt4wd.cjs"),t=require("./isPlainObject-fJEJm71P.cjs"),n=require("./cli-error-CrUD8uMp.cjs"),r=require("./FileFolder-BmCXp_bX.cjs"),i=require("./is-same-universal-identifier-Bm_wb6Ez.cjs"),a=require("./is-exported-manifest-DRPkDqYh.cjs");var o=e=>/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e),s=e=>{if(!(e.endsWith(`.ts`)||e.endsWith(`.tsx`))||e.endsWith(`.d.ts`)||e.startsWith(`/`)||/^[a-z]:/i.test(e)||e.includes(`\\`))return!1;let t=[`..`,`.`,``,`node_modules`,`dist`,`.twenty`];return e.split(`/`).every(e=>!t.includes(e))},c=e=>e,l=e.t(),u=e=>{try{return t.t(JSON.parse(e))}catch{return!1}},d=({value:e,frontComponents:i=[]})=>{if(!(0,l.isArray)(e))throw new n.t({code:`INVALID_RESPONSE`,message:`The exported files must be an array.`});let a=[],o=new Set;for(let c of e){if(!t.t(c)||!(0,l.isString)(c.folder)||!(0,l.isString)(c.path)||!(0,l.isString)(c.content))throw new n.t({code:`INVALID_RESPONSE`,message:`The server returned an invalid exported file.`});if(!(c.folder===r.t.Source&&i.some(e=>e.sourceComponentPath===c.path)&&s(c.path))&&(c.folder!==r.t.Dependencies||![`package.json`,`yarn.lock`].includes(c.path)))throw new n.t({code:`TOOLING_UNSUPPORTED`,message:`This CLI can only pull dependency files and declared front component sources. No local files were changed.`});if(o.has(c.path))throw new n.t({code:`INVALID_RESPONSE`,message:`The server exported ${c.path} more than once.`});if(c.path===`package.json`&&!u(c.content))throw new n.t({code:`INVALID_RESPONSE`,message:`The exported package.json must contain a JSON object.`});o.add(c.path),a.push({folder:c.folder,path:c.path,content:c.content})}return a},f=e=>t.t(e)&&(0,l.isString)(e.metadataName)&&(0,l.isString)(e.universalIdentifier)&&(0,l.isString)(e.status)&&((0,l.isString)(e.reason)||(0,l.isNull)(e.reason)),p=({value:e,universalIdentifier:r})=>{let o=e;if(!t.t(o)||!t.t(o.application)||!(0,l.isString)(o.application.universalIdentifier)||!i.t({value:o.application.universalIdentifier,universalIdentifier:r})||!(0,l.isString)(o.application.displayName)||!(0,l.isString)(o.application.sourceType)||!a.t(o.manifest)||!i.t({value:o.manifest.application.universalIdentifier,universalIdentifier:r})||!(0,l.isArray)(o.coverage)||!o.coverage.every(f)||!(0,l.isArray)(o.files))throw new n.t({code:`INVALID_RESPONSE`,message:`The server returned an export of ${r} that this CLI cannot read.`});return{application:{universalIdentifier:o.application.universalIdentifier,displayName:o.application.displayName,sourceType:o.application.sourceType},manifest:o.manifest,coverage:o.coverage,files:d({value:o.files,frontComponents:c(o.manifest).frontComponents??[]})}};Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return p}});
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
const e=require("./build--4zYt4wd.cjs"),t=require("./isDefined-CJctgvfE.cjs"),n=require("./get-field-universal-identifier.util-d1401qKf.cjs"),r=require("./standard-object-fields.constant-2yLND0Cg.cjs"),i=require("./kebab-case-B3kq7ANN.cjs"),a=require("./TwentyStandardApplicationUniversalIdentifier-Cm4vo0D3.cjs"),o=require("./print-typescript-value-BjYn0ZFT.cjs");var s=function(e){return e.IS=`IS`,e.IS_NOT_NULL=`IS_NOT_NULL`,e.IS_NOT=`IS_NOT`,e.LESS_THAN_OR_EQUAL=`LESS_THAN_OR_EQUAL`,e.GREATER_THAN_OR_EQUAL=`GREATER_THAN_OR_EQUAL`,e.IS_BEFORE=`IS_BEFORE`,e.IS_AFTER=`IS_AFTER`,e.CONTAINS=`CONTAINS`,e.DOES_NOT_CONTAIN=`DOES_NOT_CONTAIN`,e.IS_EMPTY=`IS_EMPTY`,e.IS_NOT_EMPTY=`IS_NOT_EMPTY`,e.IS_RELATIVE=`IS_RELATIVE`,e.IS_IN_PAST=`IS_IN_PAST`,e.IS_IN_FUTURE=`IS_IN_FUTURE`,e.IS_TODAY=`IS_TODAY`,e.VECTOR_SEARCH=`VECTOR_SEARCH`,e}({}),c=function(e){return e.MIN=`MIN`,e.MAX=`MAX`,e.AVG=`AVG`,e.SUM=`SUM`,e.COUNT=`COUNT`,e.COUNT_UNIQUE_VALUES=`COUNT_UNIQUE_VALUES`,e.COUNT_EMPTY=`COUNT_EMPTY`,e.COUNT_NOT_EMPTY=`COUNT_NOT_EMPTY`,e.COUNT_TRUE=`COUNT_TRUE`,e.COUNT_FALSE=`COUNT_FALSE`,e.PERCENTAGE_EMPTY=`PERCENTAGE_EMPTY`,e.PERCENTAGE_NOT_EMPTY=`PERCENTAGE_NOT_EMPTY`,e}({}),l=function(e){return e.FLOAT=`float`,e.INT=`int`,e.BIGINT=`bigint`,e}({}),u=function(e){return e.RELATIVE=`RELATIVE`,e.USER_SETTINGS=`USER_SETTINGS`,e.CUSTOM=`CUSTOM`,e}({}),d=function(e){return e.BTREE=`BTREE`,e.GIN=`GIN`,e}({}),f=function(e){return e.VIEW=`VIEW`,e.FOLDER=`FOLDER`,e.LINK=`LINK`,e.OBJECT=`OBJECT`,e.RECORD=`RECORD`,e.PAGE_LAYOUT=`PAGE_LAYOUT`,e.AGENT_CHAT_CHANNEL=`AGENT_CHAT_CHANNEL`,e.NATIVE_PAGE=`NATIVE_PAGE`,e.WORKFLOW=`WORKFLOW`,e.AGENT=`AGENT`,e}({}),p=function(e){return e.SIDE_PANEL=`SIDE_PANEL`,e.RECORD_PAGE=`RECORD_PAGE`,e.USER_CHOICE=`USER_CHOICE`,e}({}),m=function(e){return e.DAY=`DAY`,e.MONTH=`MONTH`,e.QUARTER=`QUARTER`,e.YEAR=`YEAR`,e.WEEK=`WEEK`,e.DAY_OF_THE_WEEK=`DAY_OF_THE_WEEK`,e.MONTH_OF_THE_YEAR=`MONTH_OF_THE_YEAR`,e.QUARTER_OF_THE_YEAR=`QUARTER_OF_THE_YEAR`,e.NONE=`NONE`,e}({}),ee=function(e){return e.AND=`AND`,e.OR=`OR`,e}({}),te=function(e){return e.DAY=`DAY`,e.WEEK=`WEEK`,e.MONTH=`MONTH`,e}({}),h=function(e){return e.AND=`AND`,e.OR=`OR`,e.NOT=`NOT`,e}({}),g=function(e){return e.SIDE_PANEL=`SIDE_PANEL`,e.RECORD_PAGE=`RECORD_PAGE`,e}({}),_=function(e){return e.ASC=`ASC`,e.DESC=`DESC`,e}({}),v=function(e){return e.WORKSPACE=`WORKSPACE`,e.UNLISTED=`UNLISTED`,e}({}),y=({applicationUniversalIdentifier:e,objectUniversalIdentifier:t,name:r})=>n.n({entityNamespace:`pageLayout`,value:t?`${t}:${r}`:r,applicationUniversalIdentifier:e}),b=({objectMetadataApplicationUniversalIdentifier:e,pageLayoutUniversalIdentifier:t,title:r})=>n.n({entityNamespace:`pageLayoutTab`,value:`${t}:${r}`,applicationUniversalIdentifier:e}),x=({objectMetadataApplicationUniversalIdentifier:e,pageLayoutTabUniversalIdentifier:t,title:r})=>n.n({entityNamespace:`pageLayoutWidget`,value:`${t}:${r}`,applicationUniversalIdentifier:e}),ne=({objectMetadataApplicationUniversalIdentifier:e,objectUniversalIdentifier:t})=>y({applicationUniversalIdentifier:e,objectUniversalIdentifier:t,name:r.l.RECORD_FORM}),S=({objectMetadataApplicationUniversalIdentifier:e,objectUniversalIdentifier:t})=>y({applicationUniversalIdentifier:e,objectUniversalIdentifier:t,name:r.l.RECORD_PAGE}),C=({objectUniversalIdentifier:e,tabs:t})=>{let n=S({objectMetadataApplicationUniversalIdentifier:a.t,objectUniversalIdentifier:e});return{universalIdentifier:n,tabs:Object.fromEntries(Object.entries(t).map(([e,{title:t,widgets:r}])=>{let i=b({objectMetadataApplicationUniversalIdentifier:a.t,pageLayoutUniversalIdentifier:n,title:t});return[e,{universalIdentifier:i,widgets:Object.fromEntries(Object.entries(r).map(([e,t])=>[e,{universalIdentifier:x({objectMetadataApplicationUniversalIdentifier:a.t,pageLayoutTabUniversalIdentifier:i,title:t})}]))}]}))}},re={myFirstDashboard:{universalIdentifier:`20202020-d001-4d01-8d01-da5ab0a00001`,tabs:{tab1:{universalIdentifier:`20202020-d011-4d11-8d11-da5ab0a01001`,widgets:{welcomeRichText:{universalIdentifier:`20202020-d111-4d11-8d11-da5ab0a11001`},dealsByCompany:{universalIdentifier:`20202020-d111-4d11-8d11-da5ab0a11002`},pipelineValueByStage:{universalIdentifier:`20202020-d111-4d11-8d11-da5ab0a11003`},revenueTimeline:{universalIdentifier:`20202020-d111-4d11-8d11-da5ab0a11004`},opportunitiesByOwner:{universalIdentifier:`20202020-d111-4d11-8d11-da5ab0a11005`},stockMarketIframe:{universalIdentifier:`20202020-d111-4d11-8d11-da5ab0a11006`},dealsCreatedThisMonth:{universalIdentifier:`20202020-d111-4d11-8d11-da5ab0a11007`},dealValueCreatedThisMonth:{universalIdentifier:`20202020-d111-4d11-8d11-da5ab0a11008`}}}}},workspaceMemberRecordPage:C({objectUniversalIdentifier:r.n.workspaceMember,tabs:{home:{title:`Home`,widgets:{fields:`Fields`}}}}),attachmentRecordPage:C({objectUniversalIdentifier:r.n.attachment,tabs:{home:{title:`Home`,widgets:{preview:`Preview`,fields:`Fields`,attachedTo:`Attached to`}}}}),companyRecordPage:C({objectUniversalIdentifier:r.n.company,tabs:{home:{title:`Home`,widgets:{fields:`Fields`,people:`People`,opportunities:`Opportunities`}},timeline:{title:`Timeline`,widgets:{timeline:`Timeline`}},tasks:{title:`Tasks`,widgets:{tasks:`Tasks`}},notes:{title:`Notes`,widgets:{notes:`Notes`}},files:{title:`Files`,widgets:{files:`Files`}},emails:{title:`Emails`,widgets:{emails:`Emails`}},conversations:{title:`Conversations`,widgets:{conversations:`Conversations`}},calendar:{title:`Calendar`,widgets:{calendar:`Calendar`}}}}),personRecordPage:C({objectUniversalIdentifier:r.n.person,tabs:{home:{title:`Home`,widgets:{fields:`Fields`,company:`Company`,pointOfContactForOpportunities:`Opportunities`,listMemberships:`Lists`}},timeline:{title:`Timeline`,widgets:{timeline:`Timeline`}},tasks:{title:`Tasks`,widgets:{tasks:`Tasks`}},notes:{title:`Notes`,widgets:{notes:`Notes`}},files:{title:`Files`,widgets:{files:`Files`}},emails:{title:`Emails`,widgets:{emails:`Emails`}},conversations:{title:`Conversations`,widgets:{conversations:`Conversations`}},calendar:{title:`Calendar`,widgets:{calendar:`Calendar`}}}}),opportunityRecordPage:C({objectUniversalIdentifier:r.n.opportunity,tabs:{home:{title:`Home`,widgets:{fields:`Fields`,pointOfContact:`Point of Contact`,company:`Company`,owner:`Owner`}},timeline:{title:`Timeline`,widgets:{timeline:`Timeline`}},tasks:{title:`Tasks`,widgets:{tasks:`Tasks`}},notes:{title:`Notes`,widgets:{notes:`Notes`}},files:{title:`Files`,widgets:{files:`Files`}},emails:{title:`Emails`,widgets:{emails:`Emails`}},conversations:{title:`Conversations`,widgets:{conversations:`Conversations`}},calendar:{title:`Calendar`,widgets:{calendar:`Calendar`}}}}),noteRecordPage:C({objectUniversalIdentifier:r.n.note,tabs:{home:{title:`Home`,widgets:{fields:`Fields`,noteRichText:`Note`}},note:{title:`Note`,widgets:{noteRichText:`Note`}},timeline:{title:`Timeline`,widgets:{timeline:`Timeline`}},files:{title:`Files`,widgets:{files:`Files`}}}}),taskRecordPage:C({objectUniversalIdentifier:r.n.task,tabs:{home:{title:`Home`,widgets:{fields:`Fields`,taskRichText:`Task`}},note:{title:`Note`,widgets:{taskRichText:`Task`}},timeline:{title:`Timeline`,widgets:{timeline:`Timeline`}},files:{title:`Files`,widgets:{files:`Files`}}}}),workflowVersionRecordPage:C({objectUniversalIdentifier:r.n.workflowVersion,tabs:{home:{title:`Home`,widgets:{fields:`Fields`}},flow:{title:`Flow`,widgets:{workflowVersion:`Flow`}}}}),workflowRunRecordPage:C({objectUniversalIdentifier:r.n.workflowRun,tabs:{home:{title:`Home`,widgets:{fields:`Fields`}},flow:{title:`Flow`,widgets:{workflowRun:`Flow`}}}}),agentChatThreadRecordPage:C({objectUniversalIdentifier:r.n.agentChatThread,tabs:{chat:{title:`Chat`,widgets:{chat:`Chat`}}}}),blocklistRecordPage:C({objectUniversalIdentifier:r.n.blocklist,tabs:{home:{title:`Home`,widgets:{fields:`Fields`}},timeline:{title:`Timeline`,widgets:{timeline:`Timeline`}}}}),calendarChannelEventAssociationRecordPage:C({objectUniversalIdentifier:r.n.calendarChannelEventAssociation,tabs:{home:{title:`Home`,widgets:{fields:`Fields`}},timeline:{title:`Timeline`,widgets:{timeline:`Timeline`}}}}),calendarEventRecordPage:C({objectUniversalIdentifier:r.n.calendarEvent,tabs:{home:{title:`Home`,widgets:{fields:`Fields`,participants:`Participants`,callRecordings:`Call Recordings`}},timeline:{title:`Timeline`,widgets:{timeline:`Timeline`}},summary:{title:`Summary`,widgets:{summary:`Summary`}},callRecording:{title:`Call Recording`,widgets:{transcript:`Transcript`}}}}),calendarEventParticipantRecordPage:C({objectUniversalIdentifier:r.n.calendarEventParticipant,tabs:{home:{title:`Home`,widgets:{fields:`Fields`}},timeline:{title:`Timeline`,widgets:{timeline:`Timeline`}}}}),callRecordingRecordPage:C({objectUniversalIdentifier:r.n.callRecording,tabs:{home:{title:`Home`,widgets:{fields:`Fields`}},timeline:{title:`Timeline`,widgets:{timeline:`Timeline`}},summary:{title:`Summary`,widgets:{summary:`Summary`}},callRecording:{title:`Call Recording`,widgets:{transcript:`Transcript`}}}}),messageChannelMessageAssociationRecordPage:C({objectUniversalIdentifier:r.n.messageChannelMessageAssociation,tabs:{home:{title:`Home`,widgets:{fields:`Fields`}},timeline:{title:`Timeline`,widgets:{timeline:`Timeline`}}}}),messageChannelMessageAssociationMessageFolderRecordPage:C({objectUniversalIdentifier:r.n.messageChannelMessageAssociationMessageFolder,tabs:{home:{title:`Home`,widgets:{fields:`Fields`}},timeline:{title:`Timeline`,widgets:{timeline:`Timeline`}}}}),messageParticipantRecordPage:C({objectUniversalIdentifier:r.n.messageParticipant,tabs:{home:{title:`Home`,widgets:{fields:`Fields`}},timeline:{title:`Timeline`,widgets:{timeline:`Timeline`}}}}),messageRecordPage:C({objectUniversalIdentifier:r.n.message,tabs:{home:{title:`Home`,widgets:{fields:`Fields`}}}}),messageThreadRecordPage:C({objectUniversalIdentifier:r.n.messageThread,tabs:{home:{title:`Home`,widgets:{emailThread:`Thread`}}}}),messageListRecordPage:C({objectUniversalIdentifier:r.n.messageList,tabs:{home:{title:`Home`,widgets:{fields:`Fields`,members:`Members`}},members:{title:`Members`,widgets:{members:`Members`}}}}),messageCampaignRecordPage:C({objectUniversalIdentifier:r.n.messageCampaign,tabs:{home:{title:`Home`,widgets:{details:`Details`,list:`List`,recipients:`Recipients`,fields:`Fields`}},composer:{title:`Email`,widgets:{messageCampaign:`Email`}}}})},w=e.t(),ie=80,ae=new Map(Object.entries(r.t).flatMap(([e,t])=>Object.entries(t).map(([t,{universalIdentifier:n}])=>[n,{objectName:e,fieldName:t}]))),T=e=>(0,w.isNonEmptyString)(e)&&(0,w.isNonEmptyString)(i.t(e).replace(/-+/g,``)),E=e=>e.slice(0,ie).replace(/-+$/g,``),D=({segments:e,universalIdentifier:n})=>{let r=E(e.filter(t.t).map(i.t).join(`-`).replace(/-{2,}/g,`-`).replace(/^-+|-+$/g,``));return(0,w.isNonEmptyString)(r)?r:n.slice(0,8)},O=({indexManifest:e,objectName:t,fieldLocationByUniversalIdentifier:n})=>D({segments:[t,...e.fields.map(({fieldUniversalIdentifier:e})=>n.get(e)?.fieldName??null)],universalIdentifier:e.universalIdentifier}),k=({viewFieldManifest:e,fieldLocationByUniversalIdentifier:n})=>{let r=n.get(e.fieldMetadataUniversalIdentifier)??ae.get(e.fieldMetadataUniversalIdentifier);return D({segments:t.t(r)?[r.objectName,r.fieldName]:[],universalIdentifier:e.universalIdentifier})},A=80,j=e=>[{path:[...e,`type`],symbol:`FieldType`,members:n.a},{path:[...e,`universalSettings`,`relationType`],symbol:`RelationType`,members:n.i},{path:[...e,`universalSettings`,`onDelete`],symbol:`OnDeleteAction`,members:i.n},{path:[...e,`universalSettings`,`dataType`],symbol:`NumberDataType`,members:l},{path:[...e,`universalSettings`,`displayFormat`],symbol:`DateDisplayFormat`,members:u}],M=j([]),N=[{path:[`openRecordIn`],symbol:`ObjectOpenRecordIn`,members:p},...j([`fields`,`[]`])],P=[{path:[`indexType`],symbol:`IndexType`,members:d}],F=e=>[{path:[`rowLevelPermissionPredicateGroups`,`[]`,`logicalOperator`],symbol:`RowLevelPermissionPredicateGroupLogicalOperator`,members:ee},{path:[`rowLevelPermissionPredicates`,`[]`,`operand`],symbol:`RowLevelPermissionPredicateOperand`,members:s},{path:[`permissionFlagUniversalIdentifiers`,`[]`],symbol:`SystemPermissionFlag`,members:e}];r.r;var I=e=>({path:e,symbol:`AggregateOperations`,members:c}),L=[I([`aggregateOperation`])],R=[{path:[`type`],symbol:`ViewType`,members:i.r},{path:[`visibility`],symbol:`ViewVisibility`,members:v},{path:[`openRecordIn`],symbol:`ViewOpenRecordIn`,members:g},I([`kanbanAggregateOperation`]),{path:[`calendarLayout`],symbol:`ViewCalendarLayout`,members:te},I([`fields`,`[]`,`aggregateOperation`]),{path:[`filters`,`[]`,`operand`],symbol:`ViewFilterOperand`,members:r.u},{path:[`filterGroups`,`[]`,`logicalOperator`],symbol:`ViewFilterGroupLogicalOperator`,members:h},{path:[`sorts`,`[]`,`direction`],symbol:`ViewSortDirection`,members:_}],z=e=>[{path:[...e,`type`],symbol:`WidgetType`,members:r.d},{path:[...e,`position`,`layoutMode`],symbol:`PageLayoutTabLayoutMode`,members:r.c},I([...e,`configuration`,`aggregateOperation`]),...[`dateGranularity`,`primaryAxisDateGranularity`,`secondaryAxisGroupByDateGranularity`].map(t=>({path:[...e,`configuration`,t],symbol:`ObjectRecordGroupByDateGranularity`,members:m}))],B=e=>[{path:[...e,`layoutMode`],symbol:`PageLayoutTabLayoutMode`,members:r.c},...z([...e,`widgets`,`[]`])],V=z([]),H=B([]),U=[{path:[`type`],symbol:`NavigationMenuItemType`,members:f}],W=[{path:[`type`],symbol:`PageLayoutType`,members:r.l},...B([`tabs`,`[]`])],G=[`version`,`steps`,`[]`],K=e=>({path:e,symbol:`ViewFilterOperand`,members:r.u}),q=[K([`version`,`trigger`,`settings`,`filter`,`stepFilters`,`[]`,`operand`]),K([...G,`input`,`stepFilters`,`[]`,`operand`]),K([...G,`input`,`filter`,`recordFilters`,`[]`,`operand`]),{path:[...G,`input`,`[]`,`type`],symbol:`FieldType`,members:n.a}],J=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),oe=({definer:e,config:n,enumBindings:r=[],importStatements:i=[]})=>{let a=new Set,s=o.n({value:n,resolveEnumSymbol:({path:e,value:n})=>{let i=r.find(t=>J(t.path,e));if(!t.t(i))return;let o=Object.keys(i.members).find(e=>i.members[e]===n);if(t.t(o))return a.add(i.symbol),`${i.symbol}.${o}`}}),c=[e,...[...a].sort()],l=`import { ${c.join(`, `)} } from 'twenty-sdk/define';`,u=l.length<=A?l:`import {\n${c.map(e=>` ${e},`).join(`
|
|
2
|
-
`)}\n} from 'twenty-sdk/define';`;return{content:`${[...i,u].join(`
|
|
3
|
-
`)}
|
|
4
|
-
|
|
5
|
-
export default ${e}(${s});
|
|
6
|
-
`,requiredSdkExports:c}},se=`__typename`,Y=e=>Array.isArray(e)?e.map(Y):typeof e!=`object`||!e?e:Object.fromEntries(Object.entries(e).filter(([e])=>e!==se).map(([e,t])=>[e,Y(t)])),ce=new Set([`packageJsonChecksum`,`yarnLockChecksum`,`requiredServerVersionRange`,`aboutDescription`,`postInstallLogicFunction`,`preInstallLogicFunction`,`uninstallLogicFunction`,`healthCheckLogicFunction`,`settingsFrontComponent`,`settingsCustomTabFrontComponentUniversalIdentifier`,`frontComponentSharedDependencies`,`logoUrl`,`screenshots`]),le=`public/cover.generated.png`,ue=e=>(e.roles??[]).some(({universalIdentifier:t})=>t===e.application.defaultRoleUniversalIdentifier),de=e=>{let t=Object.fromEntries(Object.entries(e.application).filter(([t])=>!ce.has(t)&&!(t===`defaultRoleUniversalIdentifier`&&ue(e)))),{galleryImages:n}=t;if(!Array.isArray(n)||n.length===0||n.every(e=>e===le)){let{galleryImages:e,...n}=t;return n}return t},X=({permissions:e,getDerivedUniversalIdentifier:t})=>e.map(({universalIdentifier:e,...n})=>e===t(n)?n:{universalIdentifier:e,...n}),fe=({roleManifest:e,applicationUniversalIdentifier:n})=>{let{universalIdentifier:i,objectPermissions:a,fieldPermissions:o}=e;return{...e,...t.t(a)?{objectPermissions:X({permissions:a,getDerivedUniversalIdentifier:({objectUniversalIdentifier:e})=>r.o({applicationUniversalIdentifier:n,roleUniversalIdentifier:i,objectUniversalIdentifier:e})})}:{},...t.t(o)?{fieldPermissions:X({permissions:o,getDerivedUniversalIdentifier:({fieldUniversalIdentifier:e})=>r.s({applicationUniversalIdentifier:n,roleUniversalIdentifier:i,fieldUniversalIdentifier:e})})}:{}}},pe=({objectName:e,fieldName:t,fieldUniversalIdentifier:n})=>D({segments:[e,t],universalIdentifier:n}),me=new Map(Object.entries(r.n).map(([e,t])=>[t,e])),Z=({objectUniversalIdentifier:e,manifest:t})=>(t.objects??[]).find(t=>t.universalIdentifier===e)?.nameSingular??me.get(e)??null,Q=new Map(Object.entries(re).map(([e,{universalIdentifier:t}])=>[t,e])),$=({pageLayoutUniversalIdentifier:e,manifest:n})=>{let r=n.pageLayouts?.find(t=>t.universalIdentifier===e);if(t.t(r))return r.name;let i=Q.get(e);if(t.t(i))return i;let a=n.application.universalIdentifier;for(let t of n.objects??[]){let n={objectMetadataApplicationUniversalIdentifier:a,objectUniversalIdentifier:t.universalIdentifier};if(S(n)===e)return`${t.nameSingular}RecordPage`;if(ne(n)===e)return`${t.nameSingular}RecordForm`}return null},he=({viewUniversalIdentifier:e,manifest:n})=>{let i=n.views?.find(t=>t.universalIdentifier===e);if(t.t(i))return i.name;let a=n.application.universalIdentifier;for(let t of n.objects??[])if(r.i({objectMetadataApplicationUniversalIdentifier:a,objectUniversalIdentifier:t.universalIdentifier,viewKey:r.a.INDEX})===e)return`${t.nameSingular}IndexView`;return null},ge=({navigationMenuItemManifest:e,manifest:n})=>{let{type:r,name:i,targetObjectUniversalIdentifier:a,viewUniversalIdentifier:o,pageLayoutUniversalIdentifier:s}=e;return T(i)?i:r===f.OBJECT&&t.t(a)?Z({objectUniversalIdentifier:a,manifest:n}):r===f.VIEW&&t.t(o)?he({viewUniversalIdentifier:o,manifest:n}):r===f.PAGE_LAYOUT&&t.t(s)?$({pageLayoutUniversalIdentifier:s,manifest:n}):null},_e=({navigationMenuItemManifest:e,manifest:t})=>D({segments:[ge({navigationMenuItemManifest:e,manifest:t})],universalIdentifier:e.universalIdentifier}),ve=({folderUniversalIdentifier:e,manifest:t})=>{let n=t.navigationMenuItems?.find(t=>t.universalIdentifier===e)?.name;return T(n)?n:null},ye=[`application`,`frontComponent`,`object`,`field`,`index`,`permissionFlag`,`role`,`view`,`viewField`,`pageLayout`,`pageLayoutTab`,`navigationMenuItem`,`pageLayoutWidget`,`workflow`,`skill`,`agent`,`validationRule`,`relatedRecordPath`],be=({manifest:e,sourceFileByUniversalIdentifier:n=new Map,systemPermissionFlag:a=r.r})=>{let o=e.application.universalIdentifier,s=[],c=[];s.push({kind:`application`,universalIdentifier:o,definer:`defineApplication`,config:de(e),enumBindings:[],defaultFolder:`src`,fileSuffix:`.config.ts`,fileBaseName:`application`,parentName:null});let l=new Set,u=new Map,d=[...e.fields??[]];for(let t of e.objects??[]){let e=[];for(let r of t.fields??[])u.set(r.universalIdentifier,{objectName:t.nameSingular,fieldName:r.name}),n.get(r.universalIdentifier.toLowerCase())?.entityKey===`fields`?d.push({...r,objectUniversalIdentifier:t.universalIdentifier}):e.push(r);l.add(t.universalIdentifier),s.push({kind:`object`,universalIdentifier:t.universalIdentifier,definer:`defineObject`,config:{...t,fields:e},enumBindings:N,defaultFolder:`src/objects`,fileSuffix:`.object.ts`,fileBaseName:i.t(t.nameSingular),parentName:null})}for(let t of d){let n=Z({objectUniversalIdentifier:t.objectUniversalIdentifier,manifest:e});u.set(t.universalIdentifier,{objectName:n,fieldName:t.name}),s.push({kind:`field`,universalIdentifier:t.universalIdentifier,definer:`defineField`,config:t,enumBindings:M,defaultFolder:`src/fields`,fileSuffix:`.field.ts`,fileBaseName:pe({objectName:n,fieldName:t.name,fieldUniversalIdentifier:t.universalIdentifier}),parentName:n})}for(let t of e.indexes??[]){if(!l.has(t.objectUniversalIdentifier)){c.push({kind:`index`,universalIdentifier:t.universalIdentifier,reason:`its object is not part of the written source`});continue}let n=Z({objectUniversalIdentifier:t.objectUniversalIdentifier,manifest:e});s.push({kind:`index`,universalIdentifier:t.universalIdentifier,definer:`defineIndex`,config:t,enumBindings:P,defaultFolder:`src/indexes`,fileSuffix:`.index.ts`,fileBaseName:O({indexManifest:t,objectName:n,fieldLocationByUniversalIdentifier:u}),parentName:n})}for(let t of e.validationRules??[])s.push({kind:`validationRule`,universalIdentifier:t.universalIdentifier,definer:`defineValidationRule`,config:t,enumBindings:[],defaultFolder:`src/validation-rules`,fileSuffix:`.validation-rule.ts`,fileBaseName:D({segments:[t.name],universalIdentifier:t.universalIdentifier}),parentName:Z({objectUniversalIdentifier:t.objectUniversalIdentifier,manifest:e})});for(let t of e.permissionFlags??[])s.push({kind:`permissionFlag`,universalIdentifier:t.universalIdentifier,definer:`definePermissionFlag`,config:t,enumBindings:[],defaultFolder:`src/permission-flags`,fileSuffix:`.permission-flag.ts`,fileBaseName:D({segments:[t.key],universalIdentifier:t.universalIdentifier}),parentName:null});for(let t of e.roles??[])s.push({kind:`role`,universalIdentifier:t.universalIdentifier,definer:t.universalIdentifier===e.application.defaultRoleUniversalIdentifier?`defineApplicationRole`:`defineRole`,config:fe({roleManifest:t,applicationUniversalIdentifier:o}),enumBindings:F(a),defaultFolder:`src/roles`,fileSuffix:`.role.ts`,fileBaseName:D({segments:[t.label],universalIdentifier:t.universalIdentifier}),parentName:null});for(let t of e.views??[])s.push({kind:`view`,universalIdentifier:t.universalIdentifier,definer:`defineView`,config:t,enumBindings:R,defaultFolder:`src/views`,fileSuffix:`.view.ts`,fileBaseName:D({segments:[t.name],universalIdentifier:t.universalIdentifier}),parentName:Z({objectUniversalIdentifier:t.objectUniversalIdentifier,manifest:e})});for(let t of e.viewFields??[])s.push({kind:`viewField`,universalIdentifier:t.universalIdentifier,definer:`defineViewField`,config:t,enumBindings:L,defaultFolder:`src/view-fields`,fileSuffix:`.view-field.ts`,fileBaseName:k({viewFieldManifest:t,fieldLocationByUniversalIdentifier:u}),parentName:null});for(let n of e.pageLayouts??[])s.push({kind:`pageLayout`,universalIdentifier:n.universalIdentifier,definer:`definePageLayout`,config:Y(n),enumBindings:W,defaultFolder:`src/page-layouts`,fileSuffix:`.page-layout.ts`,fileBaseName:D({segments:[n.name],universalIdentifier:n.universalIdentifier}),parentName:t.t(n.objectUniversalIdentifier)?Z({objectUniversalIdentifier:n.objectUniversalIdentifier,manifest:e}):null});for(let n of e.pageLayoutTabs??[]){let{pageLayoutUniversalIdentifier:r}=n;if(!t.t(r)){c.push({kind:`pageLayoutTab`,universalIdentifier:n.universalIdentifier,reason:`it does not name the page layout it belongs to`});continue}s.push({kind:`pageLayoutTab`,universalIdentifier:n.universalIdentifier,definer:`definePageLayoutTab`,config:Y(n),enumBindings:H,defaultFolder:`src/page-layout-tabs`,fileSuffix:`.page-layout-tab.ts`,fileBaseName:D({segments:[n.title],universalIdentifier:n.universalIdentifier}),parentName:$({pageLayoutUniversalIdentifier:r,manifest:e})})}for(let n of e.navigationMenuItems??[]){let{folderUniversalIdentifier:r}=n;s.push({kind:`navigationMenuItem`,universalIdentifier:n.universalIdentifier,definer:`defineNavigationMenuItem`,config:n,enumBindings:U,defaultFolder:`src/navigation-menu-items`,fileSuffix:`.navigation-menu-item.ts`,fileBaseName:_e({navigationMenuItemManifest:n,manifest:e}),parentName:t.t(r)?ve({folderUniversalIdentifier:r,manifest:e}):null})}for(let n of e.pageLayoutWidgets??[]){let{objectUniversalIdentifier:r}=n;s.push({kind:`pageLayoutWidget`,universalIdentifier:n.universalIdentifier,definer:`definePageLayoutWidget`,config:Y(n),enumBindings:V,defaultFolder:`src/page-layout-widgets`,fileSuffix:`.page-layout-widget.ts`,fileBaseName:D({segments:[n.title],universalIdentifier:n.universalIdentifier}),parentName:t.t(r)?Z({objectUniversalIdentifier:r,manifest:e}):null})}for(let t of e.workflows??[])s.push({kind:`workflow`,universalIdentifier:t.universalIdentifier,definer:`defineWorkflow`,config:t,enumBindings:q,defaultFolder:`src/workflows`,fileSuffix:`.workflow.ts`,fileBaseName:D({segments:[t.name],universalIdentifier:t.universalIdentifier}),parentName:null});for(let t of e.skills??[])s.push({kind:`skill`,universalIdentifier:t.universalIdentifier,definer:`defineSkill`,config:t,enumBindings:[],defaultFolder:`src/skills`,fileSuffix:`.skill.ts`,fileBaseName:D({segments:[t.name],universalIdentifier:t.universalIdentifier}),parentName:null});for(let t of e.relatedRecordPaths??[])s.push({kind:`relatedRecordPath`,universalIdentifier:t.universalIdentifier,definer:`defineRelatedRecordPath`,config:t,enumBindings:[],defaultFolder:`src/related-record-paths`,fileSuffix:`.related-record-path.ts`,fileBaseName:D({segments:[],universalIdentifier:t.universalIdentifier}),parentName:null});for(let t of e.agents??[])s.push({kind:`agent`,universalIdentifier:t.universalIdentifier,definer:`defineAgent`,config:t,enumBindings:[],defaultFolder:`src/agents`,fileSuffix:`.agent.ts`,fileBaseName:D({segments:[t.name],universalIdentifier:t.universalIdentifier}),parentName:null});return{entities:s,skipped:c}},xe=`2.50.0`;Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return be}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return xe}});
|
|
@@ -1 +0,0 @@
|
|
|
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("./is-supported-locale-DUMI9QQ2.cjs"),a=require("./parse-app-export-CmFKsj2e.cjs"),o=require("./pull-minimum-sdk-version.constant-0v8yv93F.cjs"),s=require("./isValidUniversalIdentifier-DymFerYs.cjs"),c=require("./kebab-case-B3kq7ANN.cjs"),l=require("./has-error-code-DsJeqbZq.cjs"),u=require("./fs-utils-DoSmCBu8.cjs"),d=require("./cli-error-CrUD8uMp.cjs"),f=require("./get-tooling-error-context-CZKTM7Q6.cjs"),p=require("./FileFolder-BmCXp_bX.cjs"),m=require("./locale-catalog-format-BD4XDEnl.cjs"),h=require("./list-application-source-files-jEau5Rie.cjs"),g=require("./code-step-file-suffix.constant-B6vqrfcU.cjs"),_=require("./extract-manifest-from-file-DPDIhnyg.cjs"),v=require("./collect-translatable-strings-AWv41yIv.cjs"),y=require("./constants-Cf5-CwMu.cjs"),b=require("./assert-pull-paths-TFGZvzZO.cjs"),x=require("./is-locale-catalog-T4W5NhnW.cjs"),S=require("./is-exported-manifest-DRPkDqYh.cjs"),C=require("./create-pull-base-write-CQHTbtQP.cjs"),w=require("./print-typescript-value-BjYn0ZFT.cjs"),T=require("./read-application-identity-CyVawH0m.cjs");let E=require("node:fs/promises"),D=require("node:path"),O=require("node:module"),k=require("esbuild"),A=require("typescript");A=e.r(A);var j=t.t(),ee=async({appPath:e,manifest:t,baseManifest:r,files:i,scannedFiles:a,protectedIdentifiers:o,reservedPaths:s,remoteSourceFingerprints:c={},sourceFingerprints:l={}})=>{let f=[],m=[],h=0,g={},_={},v=new Set(s);for(let o of t.frontComponents??[]){let{universalIdentifier:t,sourceComponentPath:s}=o,m=i.find(e=>e.folder===p.t.Source&&e.path===s),y=a.find(e=>e.entityKey===`frontComponents`&&e.universalIdentifier?.toLowerCase()===t.toLowerCase()),b=(y?.relativePath??s).split(`\\`).join(`/`),x=b.toLowerCase(),S=await u.i((0,D.join)(e,b))?await(0,E.readFile)((0,D.join)(e,b),`utf8`):void 0;if(!n.t(m)||v.has(x)||n.t(S)&&!n.t(y))throw new d.t({code:`CONFLICT`,message:n.t(m)?`Cannot restore front component ${t}: ${b} is occupied by another local file or definition. No local files were changed.`:`Source for front component ${t} was not exported. No local files were changed.`});v.add(x);let w=C.i(m.content);g[s]=w,S===m.content&&(_[b]=w);let T=r?.frontComponents?.find(e=>e.universalIdentifier.toLowerCase()===t.toLowerCase()),O=(n.t(T)?c[T.sourceComponentPath]:void 0)??l[b];if(S===m.content||n.t(S)&&n.t(T)&&(n.t(O)?O===w:JSON.stringify(T)===JSON.stringify(o))){h++;continue}f.push({kind:`frontComponent`,universalIdentifier:t,relativePath:b,content:m.content,requiredSdkExports:[`defineFrontComponent`],isRegeneration:n.t(S)})}for(let e of r?.frontComponents??[]){if(o.has(e.universalIdentifier.toLowerCase())){let r=c[e.sourceComponentPath];if(!n.t(r)||t.frontComponents?.some(t=>t.universalIdentifier.toLowerCase()===e.universalIdentifier.toLowerCase()))continue;g[e.sourceComponentPath]=r;continue}let r=a.find(t=>t.entityKey===`frontComponents`&&t.universalIdentifier?.toLowerCase()===e.universalIdentifier.toLowerCase())?.relativePath.split(`\\`).join(`/`);n.t(r)&&!v.has(r.toLowerCase())&&m.push({universalIdentifier:e.universalIdentifier,relativePath:r})}return{writes:f,deletions:m,unchangedCount:h,fingerprints:g,unchangedSourceFingerprints:_}},M=({value:e,identifiers:t})=>{(0,j.isArray)(e)?e.forEach(e=>M({value:e,identifiers:t})):r.t(e)&&((0,j.isString)(e.universalIdentifier)&&t.add(e.universalIdentifier.toLowerCase()),Object.values(e).forEach(e=>M({value:e,identifiers:t})))},N=[`import { readFileSync } from 'node:fs';`,`import { join } from 'node:path';`],P=e=>D.posix.basename(e).replace(/(\.workflow)?\.tsx?$/,``),F=e=>D.posix.join(D.posix.dirname(e),P(e)),I=({folderPath:e,fileBaseName:t,universalIdentifier:r,localFileName:i,takenFileNames:a,isCodeStepPathAvailable:o})=>{let s=r.slice(0,8),c=t=>!a.has(t)&&o({relativePath:D.posix.join(e,t),stepUniversalIdentifier:r}),l=[`${t}${g.t}`,`${s}-${t}${g.t}`],u=`${s}-${t}-`,d=e=>l.includes(e)||e.startsWith(u)&&e.endsWith(`.code.ts`)&&/^([2-9]|[1-9]\d+)$/.test(e.slice(u.length,-8)),f=e=>(a.add(e),e);if(n.t(i)&&d(i)&&c(i))return f(i);let[p]=l;c(p)||(p=l[1]);for(let e=2;!c(p);e++)p=`${u}${e}${g.t}`;return f(p)},L=({config:e,workflowRelativePath:t,isCodeStepPathAvailable:i=()=>!0,localCodeStepPathByStepIdentifier:a})=>{if(!r.t(e)||!r.t(e.version)||!Array.isArray(e.version.steps))return{config:e,importStatements:[],codeStepFiles:[]};let s=P(t),c=F(t),l=new Set,u=[],d=e.version.steps.map(e=>{if(!r.t(e)||e.type!==`CODE`||!(0,j.isString)(e.universalIdentifier)||!r.t(e.input)||!(0,j.isString)(e.input.code))return e;let t=a?.get(e.universalIdentifier.toLowerCase()),d=I({folderPath:c,fileBaseName:o.o({segments:[(0,j.isString)(e.name)?e.name:null],universalIdentifier:e.universalIdentifier}),universalIdentifier:e.universalIdentifier,localFileName:n.t(t)&&D.posix.dirname(t)===c?D.posix.basename(t):void 0,takenFileNames:l,isCodeStepPathAvailable:i});return u.push({universalIdentifier:e.universalIdentifier,relativePath:D.posix.join(c,d),content:e.input.code}),{...e,input:{...e.input,code:w.r(`readFileSync(join(__dirname, ${w.t(s)}, ${w.t(d)}), 'utf8')`)}}});return u.length===0?{config:e,importStatements:[],codeStepFiles:u}:{config:{...e,version:{...e.version,steps:d}},importStatements:N,codeStepFiles:u}},te=async({manifest:e,frontComponentSourcePaths:t})=>{let r=[...v.t(e),...await v.n(t)],a=new Map(r.map(e=>[m.r(e.message,e.context),e]));return Object.entries(e.translations??{}).filter(e=>i.t(e[0])&&x.t(e[1])).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>{let r=[],i={};for(let[e,o]of Object.entries(t)){let t=a.get(e);n.t(t)?r.push({message:t.message,context:t.context,translation:o}):i[e]=o}return{locale:e,authored:m.t(r),compiled:i}})},R=e=>n.t(e)&&typeof e==`object`&&!Array.isArray(e),z=e=>`${JSON.stringify(e,null,2)}\n`,B=e=>{if(!n.t(e))return{};try{let t=JSON.parse(e);return n.t(t)&&typeof t==`object`?t:{}}catch{return{}}},V=({message:e,context:t})=>JSON.stringify([t??null,e]),ne=({catalog:e,existingAuthoredContent:t,existingCompiledContent:n})=>{let r=new Set(m.n(e.authored).map(e=>m.r(e.message,e.context))),i=new Set(Object.keys(B(n)).filter(t=>!(t in e.compiled)&&r.has(t)));if(i.size===0)return null;let a=m.n(B(t)),o=new Set(a.map(V)),s=m.n(e.authored).filter(e=>i.has(m.r(e.message,e.context))&&!o.has(V(e)));return m.t([...a,...s])},H=e=>`${y.n}/${e}.json`,U=e=>`${y.t}/${e}.json`,W=async e=>await u.i(e)?await(0,E.readFile)(e,`utf8`):null,G=async({appPath:e,manifest:t,baseManifest:r,frontComponentSourcePaths:a})=>{let o=[],s=[],c={},l=t.translations;if(!R(l))return{writes:o,deletions:s,compiledEntryCountByLocale:c};let d=await te({manifest:t,frontComponentSourcePaths:a}),f=new Set(Object.keys(l)),p=R(r?.translations)?r.translations:{},m=l;for(let t of d){let{locale:r,authored:i,compiled:a}=t,l=Object.keys(a).length;l>0&&(c[r]=l);let u=H(r),d=U(r),f=await W((0,D.join)(e,u)),h=await W((0,D.join)(e,d)),g=r in p&&JSON.stringify(p[r])===JSON.stringify(m[r]),_=(Object.keys(i).length===0||n.t(f))&&(l===0||n.t(h)),v=g&&_?ne({catalog:t,existingAuthoredContent:f,existingCompiledContent:h}):null;if(g&&_&&!n.t(v))continue;let y=[{relativePath:u,content:z(v??i),isWanted:Object.keys(v??i).length>0,existingContent:f},{relativePath:d,content:z(a),isWanted:l>0,existingContent:h}];for(let{relativePath:e,content:t,isWanted:i,existingContent:a}of y){let c=n.t(a);if(!i){c&&e===d&&s.push({universalIdentifier:r,relativePath:e});continue}a!==t&&o.push({kind:`translation`,requiredSdkExports:[],universalIdentifier:r,relativePath:e,content:t,isRegeneration:c})}}for(let[t,n]of Object.entries(p))if(!(f.has(t)||!i.t(t)||!x.t(n)))for(let n of[H(t),U(t)])await u.i((0,D.join)(e,n))&&s.push({universalIdentifier:t,relativePath:n});return{writes:o,deletions:s,compiledEntryCountByLocale:c}},K=({entity:e,relativePath:t,isCodeStepPathAvailable:n,localCodeStepPathByStepIdentifier:r})=>{if(e.kind!==`workflow`)return{...o.i({definer:e.definer,config:e.config,enumBindings:e.enumBindings}),codeStepFiles:[]};let{config:i,importStatements:a,codeStepFiles:s}=L({config:e.config,workflowRelativePath:t,isCodeStepPathAvailable:n,localCodeStepPathByStepIdentifier:r});return{...o.i({definer:e.definer,config:i,enumBindings:e.enumBindings,importStatements:a}),codeStepFiles:s}},re=async({appPath:e,baseManifest:t,writes:r,deletions:i,frontComponentSourcePaths:a,sourceFingerprints:s,baseEntities:c,localCodeStepFilesByWorkflowPath:l})=>{if(!n.t(t))return[];let u=new Map(c.map(e=>[e.universalIdentifier,e])),d=await G({appPath:e,manifest:t,baseManifest:null,frontComponentSourcePaths:a}),f=new Map(d.writes.map(e=>[e.relativePath,e.content])),p=new Set(d.deletions.map(({relativePath:e})=>e)),m=new Map(c.flatMap(e=>e.kind===`workflow`?L({config:e.config,workflowRelativePath:``}).codeStepFiles.map(({universalIdentifier:e,content:t})=>[e.toLowerCase(),t]):[])),h=[...l.values()].flat(),g=new Map(h.map(({universalIdentifier:e,relativePath:t})=>[e.toLowerCase(),t])),_=new Map(h.flatMap(({universalIdentifier:e,relativePath:t})=>{let r=m.get(e.toLowerCase());return n.t(r)?[[t,r]]:[]})),v=({universalIdentifier:e,relativePath:t})=>{let r=u.get(e);if(n.t(r))return[K({entity:r,relativePath:t,localCodeStepPathByStepIdentifier:g}).content,o.i({definer:r.definer,config:r.config,enumBindings:r.enumBindings}).content];let i=_.get(t)??f.get(t);return n.t(i)?[i]:[]},y=[];for(let{universalIdentifier:t,relativePath:a}of[...r.filter(e=>e.isRegeneration),...i]){let r=s?.[a];if(n.t(r)){C.i(await(0,E.readFile)((0,D.join)(e,a)))!==r&&y.push({universalIdentifier:t,relativePath:a});continue}let i=v({universalIdentifier:t,relativePath:a});(p.has(a)||i.length>0&&!i.includes(await(0,E.readFile)((0,D.join)(e,a),`utf8`)))&&y.push({universalIdentifier:t,relativePath:a})}return y},q=e=>e.split(`\\`).join(`/`),J=({node:e,name:t})=>n.t(e)&&A.isIdentifier(e)&&e.text===t,Y=({objectLiteral:e,propertyName:t})=>e.properties.find(e=>A.isPropertyAssignment(e)&&!A.isComputedPropertyName(e.name)&&e.name.text===t)?.initializer,ie=e=>{if(!n.t(e)||!A.isCallExpression(e)||!J({node:e.expression,name:`readFileSync`}))return;let[t]=e.arguments;if(!n.t(t)||!A.isCallExpression(t)||!J({node:t.expression,name:`join`}))return;let[r,...i]=t.arguments;return J({node:r,name:`__dirname`})&&i.every(A.isStringLiteralLike)?i.map(e=>e.text):void 0},ae=({workflowPath:e,source:t})=>{let r=new Map,i=t=>{if(A.isObjectLiteralExpression(t)){let i=Y({objectLiteral:t,propertyName:`universalIdentifier`}),a=Y({objectLiteral:t,propertyName:`input`}),o=n.t(a)&&A.isObjectLiteralExpression(a)?ie(Y({objectLiteral:a,propertyName:`code`})):void 0;n.t(i)&&A.isStringLiteralLike(i)&&n.t(o)&&r.set(i.text.toLowerCase(),D.posix.join(D.posix.dirname(e),...o))}A.forEachChild(t,i)};return i(A.createSourceFile(e,t,A.ScriptTarget.Latest,!1)),r},oe=async({appPath:e,scannedFiles:t,baseEntities:r})=>{let i=new Set(t.filter(e=>e.isReadable).map(e=>q(e.relativePath))),a=new Map(r.filter(e=>e.kind===`workflow`).map(e=>[e.universalIdentifier.toLowerCase(),e.config])),o=new Map;for(let r of t){if(r.entityKey!==`workflows`)continue;let t=q(r.relativePath),s=`${F(t)}/`,c=new Map,l=new Set,u=e=>e.startsWith(s)&&e.endsWith(`.code.ts`)&&i.has(e)&&!l.has(e),d=({stepIdentifier:e,relativePath:t})=>{c.set(e,t),l.add(t)};for(let[n,r]of ae({workflowPath:t,source:await(0,E.readFile)((0,D.join)(e,t),`utf8`)}))u(r)&&d({stepIdentifier:n,relativePath:r});let f=L({config:n.t(r.universalIdentifier)?a.get(r.universalIdentifier.toLowerCase()):void 0,workflowRelativePath:t,localCodeStepPathByStepIdentifier:c}).codeStepFiles;for(let{universalIdentifier:t,relativePath:n,content:r}of f){let i=t.toLowerCase();!c.has(i)&&u(n)&&await(0,E.readFile)((0,D.join)(e,n),`utf8`)===r&&d({stepIdentifier:i,relativePath:n})}o.set(t,[...c].map(([e,t])=>({universalIdentifier:e,relativePath:t})))}return o},se=async({appPath:e,applicationExport:t,target:i,signal:o})=>{o.throwIfAborted();let s=C.n(i),c=a.n({value:t.files,frontComponents:a.r(t.manifest).frontComponents??[]});if(await b.t({appPath:e,relativePaths:[C.r,...c.map(e=>e.path)]}),!r.t(JSON.parse(await(0,E.readFile)((0,D.join)(e,`package.json`),`utf8`))))throw Error(`Pull requires a project with a package.json object.`);let l=await T.t({appPath:e,signal:o});if(n.t(l.application)&&l.application.universalIdentifier.toLowerCase()!==t.application.universalIdentifier.toLowerCase())throw Error(`This project declares application ${l.application.universalIdentifier}, but the export belongs to ${t.application.universalIdentifier}. Pull it into a different directory.`);return o.throwIfAborted(),{applicationExport:{...t,files:c},target:s}},ce=({entities:e,unreconciledUniversalIdentifiers:t})=>e.map(e=>{if(e.kind!==`application`||!r.t(e.config)||!(0,j.isString)(e.config.defaultRoleUniversalIdentifier)||!t?.has(e.config.defaultRoleUniversalIdentifier.toLowerCase()))return e;let{defaultRoleUniversalIdentifier:n,...i}=e.config;return{...e,config:i}}),le=({manifest:e,baseManifest:t,scannedFiles:r,unreconciledUniversalIdentifiers:i,systemPermissionFlag:a})=>{let s=new Map;for(let e of r)e.isReadable&&n.t(e.universalIdentifier)&&s.set(e.universalIdentifier.toLowerCase(),e);let{entities:c,skipped:l}=o.r({manifest:e,sourceFileByUniversalIdentifier:s,systemPermissionFlag:a});return{entities:c,baseEntities:ce({entities:n.t(t)?o.r({manifest:t,sourceFileByUniversalIdentifier:s}).entities:[],unreconciledUniversalIdentifiers:i}),skipped:l}},ue=({entities:e,baseEntities:t,protectedIdentifiers:r,writes:i,deletions:a,scannedFiles:o})=>{let s=new Set;M({value:t,identifiers:s});let c=new Map(o.map(e=>{let t=new Set;return M({value:e.config,identifiers:t}),[e.relativePath.split(`\\`).join(`/`),t]})),l=new Map(e.map(e=>[e.universalIdentifier.toLowerCase(),e.config])),u=new Map(t.map(e=>[e.universalIdentifier.toLowerCase(),e])),d=[...i.filter(e=>e.kind!==`translation`&&e.isRegeneration),...a.flatMap(e=>{let t=u.get(e.universalIdentifier.toLowerCase());return n.t(t)?[{...e,kind:t.kind}]:[]})],f=[],p=new Set,m=[],h;do{h=p.size;let e=new Map(c);for(let t of i){if(t.kind===`translation`||p.has(t.relativePath))continue;let n=new Set;M({value:l.get(t.universalIdentifier.toLowerCase()),identifiers:n}),e.set(t.relativePath,n)}for(let t of a)p.has(t.relativePath)||e.delete(t.relativePath);let t=new Set([...e.values()].flatMap(e=>[...e]));for(let e of d){if(p.has(e.relativePath)||e.kind===`translation`||e.kind===`dependency`)continue;let i=[...c.get(e.relativePath)??[]].find(e=>!t.has(e)&&(r.has(e)||!s.has(e)));if(n.t(i)){if(p.add(e.relativePath),e.kind===`workflow`){let t=new Set(c.get(e.relativePath));M({value:l.get(e.universalIdentifier.toLowerCase()),identifiers:t}),m.push({codeStepFolderPath:`${F(e.relativePath)}/`,identifiers:t})}f.push({kind:e.kind,universalIdentifier:e.universalIdentifier,reason:`preserving ${e.relativePath}, replacement would remove nested local definition ${i} without a confirmed remote deletion`})}}}while(p.size!==h);let g=({relativePath:e,universalIdentifier:t})=>p.has(e)||m.some(({codeStepFolderPath:n,identifiers:r})=>e.startsWith(n)&&r.has(t.toLowerCase()));return{writes:i.filter(e=>!g(e)),deletions:a.filter(e=>!g(e)),skipped:f}},de=({manifest:e,baseManifest:t,unreconciledUniversalIdentifiers:i,protectedIdentifiers:a})=>{let o=e=>r.t(e)&&(0,j.isString)(e.universalIdentifier)?e.universalIdentifier.toLowerCase():void 0,s=(e,t)=>{let s=new Map(t.map(e=>[o(e),e])),l=e.filter(e=>{let t=o(e);return!n.t(t)||!i.has(t)}).map(e=>{let t=o(e),i=s.get(t);return!n.t(t)||!r.t(e)||!r.t(i)?e:c(e,i)}),u=new Set(l.map(o)),d=t.filter(e=>{let t=o(e);return n.t(t)&&!u.has(t)&&(i.has(t)||a.has(t))});return[...l,...d]},c=(e,t)=>{let n={...e};for(let r of new Set([...Object.keys(e),...Object.keys(t??{})])){let i=e[r],a=t?.[r];if(!(0,j.isArray)(i)&&!(0,j.isArray)(a))continue;let o=s((0,j.isArray)(i)?i:[],(0,j.isArray)(a)?a:[]);((0,j.isArray)(i)||o.length>0)&&(n[r]=o)}return n},l={...e,...c(e,t)};return n.t(t)&&i.has(e.application.universalIdentifier.toLowerCase())&&(l.application=t.application),l},fe=/^[0-9a-f]{64}$/,X=e=>r.t(e)&&Object.values(e).every(e=>(0,j.isString)(e)&&fe.test(e)),pe=async({appPath:e,target:t,applicationUniversalIdentifier:i})=>{await b.t({appPath:e,relativePaths:[C.r]});let a=C.n(t);try{let t=JSON.parse(await(0,E.readFile)((0,D.join)(e,C.r),`utf8`));if(r.t(t)&&t.version===1)return{status:`unbound`,manifest:null};if(!r.t(t)||t.version!==2||!r.t(t.target)||!(0,j.isString)(t.target.apiUrl)||!(0,j.isString)(t.target.workspaceId)||!(0,j.isString)(t.applicationUniversalIdentifier)||!S.t(t.manifest)||t.applicationUniversalIdentifier.toLowerCase()!==t.manifest.application.universalIdentifier.toLowerCase()||n.t(t.unreconciledUniversalIdentifiers)&&(!(0,j.isArray)(t.unreconciledUniversalIdentifiers)||!t.unreconciledUniversalIdentifiers.every(e=>(0,j.isString)(e)&&s.t(e)))||n.t(t.sourceFingerprints)&&!X(t.sourceFingerprints)||n.t(t.remoteSourceFingerprints)&&!X(t.remoteSourceFingerprints)||n.t(t.dependencyFingerprints)&&!X(t.dependencyFingerprints))return{status:`unreadable`,manifest:null};let o=C.n({apiUrl:t.target.apiUrl,workspaceId:t.target.workspaceId});return o.apiUrl!==a.apiUrl||o.workspaceId!==a.workspaceId||t.applicationUniversalIdentifier.toLowerCase()!==i.toLowerCase()?{status:`other-target`,manifest:null}:{status:`used`,manifest:t.manifest,unreconciledUniversalIdentifiers:t.unreconciledUniversalIdentifiers?.filter(j.isString).map(e=>e.toLowerCase()),dependencyFingerprints:X(t.dependencyFingerprints)?t.dependencyFingerprints:void 0,remoteSourceFingerprints:X(t.remoteSourceFingerprints)?t.remoteSourceFingerprints:void 0,sourceFingerprints:X(t.sourceFingerprints)?t.sourceFingerprints:void 0}}catch(e){return{status:l.t(e,`ENOENT`)?`missing`:`unreadable`,manifest:null}}},me=({appPath:e,writes:t})=>{let r=new Set(t.flatMap(e=>e.requiredSdkExports));if(r.size===0)return;let i=(0,O.createRequire)((0,D.join)(e,`package.json`))(`twenty-sdk/define`),a=[...r].filter(e=>!n.t(i[e])).sort();if(a.length>0)throw new d.t({code:`SDK_SOURCE_UNSUPPORTED`,message:`The app's twenty-sdk cannot read the generated definitions. Missing exports: ${a.join(`, `)}.`,hint:`Upgrade the app to a compatible twenty-sdk version (${o.t} or later).`,details:{missingNames:a}})},he=`.twenty/cli`,ge=async({appPath:e,writes:t,deletions:n})=>{let r=t.map(e=>e.relativePath);if(new Set(r).size!==r.length)throw Error(`Refusing to write: two entities resolved to the same file path`);let i=(0,D.resolve)(e);for(let t of[...r,...n.map(e=>e.relativePath)]){let n=(0,D.relative)(i,(0,D.resolve)(i,t));if(n.length===0||n===`..`||n.startsWith(`..${D.sep}`)||(0,D.isAbsolute)(n))throw Error(`Refusing to write: ${t} leaves the application directory`);let r=(0,D.join)(e,t);if(await u.i(r)&&(await(0,E.lstat)(r)).isDirectory())throw Error(`Refusing to write: ${t} is a directory, and pull never deletes a folder`)}},_e=async({appPath:e,backupDirectory:t,relativePath:n})=>{let r=(0,D.join)(e,n);if(!await u.i(r))return!1;let i=(0,D.join)(t,n);return await u.r((0,D.dirname)(i)),await u.t(r,i),!0},ve=async({appPath:e,backupDirectory:t,backedUpRelativePaths:n,writtenRelativePaths:r})=>{for(let t of r)await(0,E.rm)((0,D.join)(e,t),{force:!0});for(let r of n){let n=(0,D.join)(e,r);await u.r((0,D.dirname)(n)),await(0,E.rm)(n,{force:!0}),await u.t((0,D.join)(t,r),n)}},ye=async({appPath:e,writes:t,deletions:n,finalWrite:r,signal:i})=>{let a=r?[...t,r]:t;i?.throwIfAborted(),await ge({appPath:e,writes:a,deletions:n});let o=(0,D.join)(e,he);await u.r(o);let s=await(0,E.mkdtemp)((0,D.join)(o,`pull-staging-`)),c=await(0,E.mkdtemp)((0,D.join)(o,`pull-backup-`)),l=[],f=[];try{for(let e of a){let t=(0,D.join)(s,e.relativePath);await u.r((0,D.dirname)(t)),await(0,E.writeFile)(t,e.content,e===r?{mode:384}:void 0)}for(let t of[...a.map(e=>e.relativePath),...n.map(e=>e.relativePath)])await _e({appPath:e,backupDirectory:c,relativePath:t})&&l.push(t);i?.throwIfAborted();for(let n of t){let t=(0,D.join)(e,n.relativePath);await u.r((0,D.dirname)(t)),f.push(n.relativePath),await u.t((0,D.join)(s,n.relativePath),t)}for(let t of n)await(0,E.rm)((0,D.join)(e,t.relativePath),{force:!0});if(r){let t=(0,D.join)(e,r.relativePath);await u.r((0,D.dirname)(t)),f.push(r.relativePath),await u.t((0,D.join)(s,r.relativePath),t)}}catch(t){try{await ve({appPath:e,backupDirectory:c,backedUpRelativePaths:l,writtenRelativePaths:f.filter(e=>!l.includes(e))})}catch(e){throw await u.s(s).catch(()=>void 0),new d.t({code:`PULL_FAILED`,details:{outcome:`unknown`,backupDirectory:c},message:`Pull failed and could not restore every file it had replaced. The originals are kept in ${c}.\nOriginal failure: ${t instanceof Error?t.message:String(t)}\nRestore failure: ${e instanceof Error?e.message:String(e)}`})}throw await u.s(s),await u.s(c),i?.aborted&&Object.is(t,i.reason)?t:new d.t({code:`PULL_FAILED`,message:t instanceof Error?t.message:String(t),details:{outcome:`unchanged`}})}try{await u.s(s),await u.s(c)}catch(e){throw new d.t({code:`PULL_FAILED`,message:`Pull completed, but temporary files could not be removed: ${e instanceof Error?e.message:String(e)}`,details:{outcome:`pulled`,backupDirectory:c,stagingDirectory:s}})}},be=[`nameSingular`,`name`,`label`,`title`],xe=e=>{let t={},i=[{value:e}];for(;i.length>0;){let e=i.pop();if(!n.t(e))break;let{value:a,parentLabel:o}=e;if(Array.isArray(a)){for(let e of[...a].reverse())i.push({value:e,parentLabel:o});continue}if(!r.t(a))continue;let s=be.map(e=>a[e]).find(j.isNonEmptyString),c=n.t(s)&&n.t(o)?`${o}.${s}`:s??o;n.t(s)&&n.t(c)&&(0,j.isNonEmptyString)(a.universalIdentifier)&&(t[a.universalIdentifier]=c);for(let e of Object.values(a).reverse())i.push({value:e,parentLabel:c})}return t},Se=e=>{let t=new Map;for(let n of e){let e=`${n.defaultFolder}/${n.fileBaseName}${n.fileSuffix}`,r=t.get(e)??[];r.push(n),t.set(e,r)}let r=new Map;for(let e of t.values()){if(e.length===1){r.set(e[0].universalIdentifier,e[0].fileBaseName);continue}let t=e.map(e=>n.t(e.parentName)?o.a(`${c.t(e.parentName)}-${e.fileBaseName}`):e.fileBaseName),i=new Map;for(let e of t)i.set(e,(i.get(e)??0)+1);e.forEach((e,n)=>{let a=t[n],s=i.get(a)===1;r.set(e.universalIdentifier,s?a:o.a(`${e.universalIdentifier.slice(0,8)}-${a}`))})}return r},Z=e=>e.toLowerCase(),Q=e=>e.split(`\\`).join(`/`),Ce=({scannedFiles:e,entityKey:t})=>{let n=new Map;for(let r of e){if(r.entityKey!==t)continue;let e=Q((0,D.dirname)(r.relativePath));n.set(e,(n.get(e)??0)+1)}return[...n.entries()].sort(([e,t],[n,r])=>r-t||e.localeCompare(n))[0]?.[0]??null},we=({folder:e,fileBaseName:t,fileSuffix:n,universalIdentifier:r,takenRelativePaths:i})=>{let a=r.slice(0,8),o=[t,`${a}-${t}`,...Array.from({length:100},(e,n)=>`${a}-${t}-${n+2}`)];for(let t of o){let r=D.posix.join(e,`${t}${n}`);if(!i.has(Z(r)))return r}throw Error(`Could not find a free file name for ${r} in ${e}`)},Te=({entity:e,applicationFile:t,scannedFileByUniversalIdentifier:n})=>e.kind===`application`?t:n.get(e.universalIdentifier.toLowerCase()),Ee=({entities:e,baseEntities:t,scannedFiles:r,workspaceUniversalIdentifiers:i,unreconciledUniversalIdentifiers:a,localCodeStepFilesByWorkflowPath:o})=>{let s=new Set(e.map(e=>e.universalIdentifier.toLowerCase())),c=new Map(t.map(e=>[e.universalIdentifier,JSON.stringify(e.config)])),l=Se(e),u=new Map,d=r.find(e=>e.entityKey===`application`);for(let e of r)n.t(e.universalIdentifier)&&u.set(e.universalIdentifier.toLowerCase(),e);let f=[],p=[],m=new Set,h=new Set(r.map(e=>Z(Q(e.relativePath)))),g=new Set(h),_=[],v=new Set,y=e=>o?.get(e)??[];for(let t of e){let e=Te({entity:t,applicationFile:d,scannedFileByUniversalIdentifier:u}),i=n.t(e)?Q(e.relativePath):void 0,o=Ce({scannedFiles:r,entityKey:S.n[t.kind]})??t.defaultFolder,b=l.get(t.universalIdentifier)??t.fileBaseName,x=i??we({folder:o,fileBaseName:b,fileSuffix:t.fileSuffix,universalIdentifier:t.universalIdentifier,takenRelativePaths:g});m.add(x),g.add(Z(x)),v.add(Z(x));let C=c.get(t.universalIdentifier),w=new Set,T=new Set;M({value:e?.config,identifiers:w}),M({value:t.config,identifiers:T});let E=[...w].some(e=>!T.has(e)&&s.has(e));if(n.t(e)&&e.targetFunctionName===t.definer&&!E&&!a?.has(t.universalIdentifier.toLowerCase())&&n.t(C)&&C===JSON.stringify(t.config)){p.push(t);continue}let D=n.t(i)?y(i):[],O=new Map(D.map(e=>[e.universalIdentifier.toLowerCase(),Z(e.relativePath)])),{codeStepFiles:k,...A}=K({entity:t,relativePath:x,isCodeStepPathAvailable:({relativePath:e,stepUniversalIdentifier:t})=>{let n=Z(e);return!g.has(n)||!v.has(n)&&O.get(t.toLowerCase())===n}});f.push({kind:t.kind,universalIdentifier:t.universalIdentifier,relativePath:x,...A,isRegeneration:n.t(i)});for(let e of k){let n=Z(e.relativePath);f.push({kind:t.kind,...e,requiredSdkExports:[],isRegeneration:h.has(n)}),m.add(e.relativePath),g.add(n),v.add(n)}_.push(...D)}let b=[];for(let e of c.keys()){if(s.has(e.toLowerCase()))continue;let t=u.get(e.toLowerCase()),r=n.t(t)?Q(t.relativePath):void 0;!n.t(r)||m.has(r)||(b.push({universalIdentifier:e,relativePath:r}),i.has(e)||_.push(...y(r)))}let x=r.filter(e=>n.t(e.universalIdentifier)&&!s.has(e.universalIdentifier.toLowerCase())&&!c.has(e.universalIdentifier)&&!i.has(e.universalIdentifier)&&!m.has(Q(e.relativePath))).map(e=>Q(e.relativePath));return{writes:f,unchanged:p,deletions:b,codeStepFileDeletions:_.filter(e=>!m.has(e.relativePath)),localOnlyRelativePaths:x}},$=[`dependencies`,`devDependencies`,`peerDependencies`],De=({content:e,existingContent:t})=>{let n=JSON.parse(e),i=JSON.parse(t);if($.some(e=>{let t=n[e];return r.t(t)&&Object.hasOwn(t,`twenty-sdk`)}))return e;for(let e of $){let t=i[e];if(!r.t(t)||!(0,j.isString)(t[`twenty-sdk`]))continue;let a=n[e];return n[e]={...r.t(a)?a:{},"twenty-sdk":t[`twenty-sdk`]},`${JSON.stringify(n,null,2)}\n`}return e},Oe=async({appPath:e,files:t,sourceFingerprints:r={},dependencyFingerprints:i={}})=>{let a=[],o={},s={};for(let{path:c,content:l}of t){let t=(0,D.join)(e,c),d=await u.i(t)?await(0,E.readFile)(t,`utf8`):void 0,f=C.i(l);if(o[c]=f,n.t(d)&&(i[c]??r[c])===f)continue;let p=c===`package.json`&&n.t(d)?De({content:l,existingContent:d}):l;if(d===p){s[c]=C.i(p);continue}a.push({kind:`dependency`,universalIdentifier:`dependencies/${c}`,relativePath:c,content:p,requiredSdkExports:[],isRegeneration:n.t(d)})}return{writes:a,fingerprints:o,unchangedSourceFingerprints:s,unchangedCount:t.length-a.length}},ke=async({appPath:e,includeConfig:t=!1,signal:r})=>{r.throwIfAborted();let i=await h.t(e),a=[];for(let o of i){r.throwIfAborted();let i=(0,D.relative)(e,o),s;try{s=await(0,E.readFile)(o,`utf-8`)}catch{a.push({relativePath:i,entityKey:null,targetFunctionName:null,universalIdentifier:null,isReadable:!1});continue}let c=_.r({fileContent:s,filePath:o});if(!n.t(c)){a.push({relativePath:i,entityKey:null,targetFunctionName:null,universalIdentifier:null,isReadable:!0});continue}let l=_.n[c],u={},f=!0;try{u=(await _.t({appPath:e,filePath:o})).config}catch(e){if(e instanceof d.t&&e.code===`SDK_SOURCE_UNSUPPORTED`)throw e;u={},f=!1}a.push({relativePath:i,entityKey:l,targetFunctionName:c,universalIdentifier:(0,j.isString)(u.universalIdentifier)?u.universalIdentifier:null,isReadable:f,...t?{config:u}:{}})}return r.throwIfAborted(),a},Ae=({sourceFingerprints:e={},writes:t,deletions:n})=>{let r=new Set(n.map(e=>e.relativePath));return{...Object.fromEntries(Object.entries(e).filter(([e])=>!r.has(e))),...Object.fromEntries(t.map(e=>[e.relativePath,C.i(e.content)]))}},je=async e=>{let{appPath:t,signal:r}=e;try{let{applicationExport:i,target:o}=await se(e),s=a.r(i.manifest),c=await pe({appPath:t,target:o,applicationUniversalIdentifier:i.application.universalIdentifier}),l=n.t(c.manifest)?a.r(c.manifest):null,u=await ke({appPath:t,includeConfig:!0,signal:r}),d=new Set(c.unreconciledUniversalIdentifiers),{entities:f,baseEntities:h,skipped:g}=le({manifest:s,baseManifest:l,scannedFiles:u,unreconciledUniversalIdentifiers:d,systemPermissionFlag:m.i(t)});r?.throwIfAborted();let _=new Set(i.coverage.map(e=>e.universalIdentifier)),v=await oe({appPath:t,scannedFiles:u,baseEntities:h}),y=Ee({entities:f,baseEntities:h,scannedFiles:u,workspaceUniversalIdentifiers:_,unreconciledUniversalIdentifiers:d,localCodeStepFilesByWorkflowPath:v}),x=new Set;M({value:s,identifiers:x}),M({value:i.coverage,identifiers:x});let S=u.filter(e=>e.entityKey===`frontComponents`).map(e=>(0,D.join)(t,e.relativePath)),w=await G({appPath:t,manifest:s,baseManifest:l,frontComponentSourcePaths:S}),T=ue({entities:f,baseEntities:h,protectedIdentifiers:x,writes:y.writes,deletions:[...y.deletions.filter(e=>!x.has(e.universalIdentifier.toLowerCase())),...y.codeStepFileDeletions],scannedFiles:u}),E=await Oe({appPath:t,files:i.files.filter(e=>e.folder===p.t.Dependencies),sourceFingerprints:c.sourceFingerprints,dependencyFingerprints:c.dependencyFingerprints}),O=await ee({appPath:t,manifest:s,baseManifest:l,files:i.files,scannedFiles:u,protectedIdentifiers:x,remoteSourceFingerprints:c.remoteSourceFingerprints,sourceFingerprints:c.sourceFingerprints,reservedPaths:new Set([...T.writes,...w.writes,...E.writes].map(e=>e.relativePath.toLowerCase()))}),k=[...T.writes,...w.writes,...E.writes,...O.writes],A=[...T.deletions,...O.deletions,...w.deletions.filter(e=>n.t(l?.translations)&&e.universalIdentifier in l.translations)],j=[...g,...T.skipped],N=new Set(j.map(e=>e.universalIdentifier.toLowerCase())),P=C.t({target:o,manifest:de({manifest:i.manifest,baseManifest:c.manifest,unreconciledUniversalIdentifiers:N,protectedIdentifiers:x}),unreconciledUniversalIdentifiers:[...N],remoteSourceFingerprints:O.fingerprints,dependencyFingerprints:{...c.dependencyFingerprints,...E.fingerprints},sourceFingerprints:Ae({sourceFingerprints:{...c.sourceFingerprints,...E.unchangedSourceFingerprints,...O.unchangedSourceFingerprints},writes:k,deletions:A})});await b.t({appPath:t,relativePaths:[...k.map(e=>e.relativePath),...A.map(e=>e.relativePath),P.relativePath]});let F=await re({appPath:t,baseManifest:l,writes:k,deletions:A,frontComponentSourcePaths:S,baseEntities:h,localCodeStepFilesByWorkflowPath:v,sourceFingerprints:c.sourceFingerprints}),I=xe(s);return me({appPath:t,writes:k}),r?.throwIfAborted(),await ye({appPath:t,writes:k,deletions:A,finalWrite:P,signal:r}),{success:!0,data:{application:{universalIdentifier:i.application.universalIdentifier,displayName:i.application.displayName},base:{status:c.status},writes:k.map(({content:e,requiredSdkExports:t,...n})=>n),deletions:A,overwrittenLocalChanges:F,unchangedCount:y.unchanged.length+E.unchangedCount+O.unchangedCount,localOnlyRelativePaths:y.localOnlyRelativePaths,unreadableRelativePaths:u.filter(e=>!e.isReadable).map(e=>e.relativePath),skipped:j,compiledTranslationEntryCountByLocale:w.compiledEntryCountByLocale,entityLabelByUniversalIdentifier:I},diagnostics:[]}}catch(e){return{success:!1,error:{code:r?.aborted&&Object.is(e,r.reason)?`CANCELLED`:e instanceof d.t?e.code:`PULL_FAILED`,message:e instanceof Error?e.message:String(e),...f.t(e),details:{outcome:`unchanged`,...e instanceof d.t?e.details:{}}},diagnostics:[]}}},Me=async e=>{try{let t=e.applicationExport,n=r.t(t)&&r.t(t.application)&&(0,j.isString)(t.application.universalIdentifier)?t.application.universalIdentifier:``;return await je({...e,applicationExport:a.t({value:t,universalIdentifier:n})})}finally{await(0,k.stop)()}};exports.pullSource=Me;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./build--4zYt4wd.cjs"),t=require("./isDefined-CJctgvfE.cjs"),n=require("./isValidUniversalIdentifier-DymFerYs.cjs"),r=require("./list-application-source-files-jEau5Rie.cjs"),i=require("./extract-manifest-from-file-DPDIhnyg.cjs");let a=require("node:fs/promises"),o=require("node:path");var s=e.t(),c=async({appPath:e,signal:c})=>{if(c.throwIfAborted(),!(0,o.isAbsolute)(e)||!(await(0,a.stat)(e)).isDirectory())throw Error(`The app path must be an absolute directory path.`);let l=await r.t(e),u=null;for(let r of l){if(c.throwIfAborted(),i.r({fileContent:await(0,a.readFile)(r,`utf8`),filePath:r})!==`defineApplication`)continue;if(t.t(u))throw Error(`The project declares more than one application.`);let{config:l}=await i.t({appPath:e,filePath:r});if(!(0,s.isString)(l.universalIdentifier)||!n.t(l.universalIdentifier))throw Error(`Could not read the application identifier in ${(0,o.relative)(e,r)}.`);u={universalIdentifier:l.universalIdentifier,displayName:(0,s.isString)(l.displayName)?l.displayName:null}}return c.throwIfAborted(),{application:u}};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=require("./build--4zYt4wd.cjs").t(),t=(t,n)=>{let r=t[n];return(0,e.isString)(r)?r:void 0},n=(e,t)=>e[t]===!0,r=(t,n)=>{let r=t[n];return(0,e.isString)(r)?r:void 0};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return n}});
|
|
@@ -1,8 +0,0 @@
|
|
|
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("./is-same-universal-identifier-Bm_wb6Ez.cjs"),a=require("./style-BR52fK4V.cjs"),o=require("./is-application-not-found-error-CQ7k4hGU.cjs"),s=require("./result-item-limit.constant-QX3teiuy.cjs"),c=require("./create-metadata-client-oO0QvH6j.cjs"),l=require("./format-data-value-D_1TNU-r.cjs");var u=e.t(),d=e=>n.t(e)&&(e.type===`create`||e.type===`update`||e.type===`delete`)&&(0,u.isNonEmptyString)(e.metadataName)&&(e.type===`create`&&(0,u.isUndefined)(e.universalIdentifier)||(0,u.isNonEmptyString)(e.universalIdentifier))&&((0,u.isUndefined)(e.flatEntity)||n.t(e.flatEntity))&&((0,u.isUndefined)(e.diff)||n.t(e.diff)&&Object.values(e.diff).every(n.t)),f=e=>e.metadataName===`applicationVariable`?{...e,...t.t(e.flatEntity)&&`value`in e.flatEntity?{flatEntity:{...e.flatEntity,value:`(redacted)`}}:{},...t.t(e.diff)&&`value`in e.diff?{diff:{...e.diff,value:{before:`(redacted)`,after:`(redacted)`}}}:{}}:e,p=({value:e,applicationUniversalIdentifier:t})=>{if(!n.t(e)||!i.t({value:e.applicationUniversalIdentifier,universalIdentifier:t})||!(0,u.isArray)(e.actions)||!e.actions.every(d))throw new r.t({code:`INVALID_RESPONSE`,message:`The server returned an invalid application plan.`});if(e.actions.length>1e4)throw new r.t({code:`RESPONSE_LIMIT_EXCEEDED`,message:`The application plan exceeds ${s.t} actions.`,hint:`Reduce the app changes before requesting another plan.`});return e.actions.map(f)},m=async({build:e,inferDeletionFromMissingEntities:i,target:a,signal:s})=>{if(e.manifestFormat!==`twenty-application`||!n.t(e.manifest.application)||e.manifest.application.universalIdentifier!==e.application.universalIdentifier)throw new r.t({code:`TOOLING_UNSUPPORTED`,message:`The app build produced a manifest that this CLI cannot plan.`});try{return p({value:(await c.t({target:a,signal:s}).mutation({__name:`PreviewApplication`,syncApplication:{__args:{manifest:e.manifest,dryRun:!0,...t.t(i)&&{inferDeletionFromMissingEntities:i}},applicationUniversalIdentifier:!0,actions:!0}}))?.syncApplication,applicationUniversalIdentifier:e.application.universalIdentifier})}catch(t){throw t instanceof r.t&&o.t({error:t,field:`syncApplication`})?new r.t({code:`PLAN_UNAVAILABLE`,message:`This app must be registered in this workspace before its changes can be planned. Nothing was registered, uploaded or synchronized.`,hint:`Run twenty app apply --create to register it and install it in this workspace.`,details:{...t.details,body:void 0,data:null,applicationUniversalIdentifier:e.application.universalIdentifier,plan:!0}}):t instanceof r.t&&n.t(t.details)?new r.t({code:t.code,exitCode:t.exitCode,message:t.message,hint:t.hint,details:{...t.details,body:void 0,data:null}}):t}},h=e=>e.type===`delete`&&(e.metadataName===`objectMetadata`||e.metadataName===`fieldMetadata`),g=80,_=`(secret)`,v=`Entities missing from your source are destroyed by default. Re-run with --no-prune to keep them.`,y=new Set([`id`,`createdAt`,`updatedAt`,`deletedAt`,`universalIdentifier`,`__typename`]),b={create:0,update:1,delete:2},x={create:`+`,update:`~`,delete:`-`},S={create:`green`,update:`yellow`,delete:`red`},C={create:`will be created`,update:`will be updated in-place`,delete:`will be destroyed`},w=e=>{if(!t.t(e))return`null`;if((0,u.isBoolean)(e)||(0,u.isNumber)(e))return String(e);let n=(JSON.stringify(e)??String(e)).replace(/[\x7f-\x9f]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`);return n.length>g?`${n.slice(0,g-1)}…`:n},T=e=>{let t=e.flatEntity?.isSecret;if((0,u.isBoolean)(t))return t;let n=e.diff?.isSecret?.after;return(0,u.isBoolean)(n)?n:void 0},E=(e,t)=>e.metadataName===`applicationVariable`&&t===`value`&&T(e)!==!1,D=e=>Object.entries(e??{}).filter(([e,n])=>!y.has(e)&&!e.endsWith(`Id`)&&t.t(n)).sort(([e],[t])=>e.localeCompare(t)),O=e=>[e.flatEntity?.name,e.flatEntity?.nameSingular,e.flatEntity?.universalIdentifier].find(u.isString)??(e.type===`create`?`unknown`:e.universalIdentifier??`unknown`),k=e=>{let t=new Map;return e.forEach((e,n)=>{t.has(e.metadataName)||t.set(e.metadataName,n)}),[...e].sort((e,n)=>(t.get(e.metadataName)??0)-(t.get(n.metadataName)??0)||b[e.type]-b[n.type]||O(e).localeCompare(O(n)))},A=(e,t)=>a.t(` # ${l.r(e.metadataName)} ${w(O(e))} ${C[e.type]}`,t),j=(e,t)=>{let n=D(e.flatEntity),r=S[e.type];if(n.length===0)return[e.type===`delete`?a.n(r,` - name = ${w(O(e))}`,t):a.n(r,` + (no attributes to display)`,t)];let i=Math.max(...n.map(([e])=>e.length));return n.map(([n,o])=>a.n(r,` ${x[e.type]} ${n.padEnd(i)} = ${E(e,n)?_:w(o)}`,t))},M=(e,t)=>{let n=Object.keys(e.diff??{}).sort((e,t)=>e.localeCompare(t));if(n.length===0)return[];let r=Math.max(...n.map(e=>e.length));return n.map(n=>{let i=e.diff?.[n],o=E(e,n),s=o?_:w(i?.before),c=o?_:w(i?.after);return` ${a.n(`yellow`,`~`,t)} ${a.n(`yellow`,n.padEnd(r),t)} = ${a.n(`red`,s,t)} ${a.i(`->`,t)} ${a.n(`green`,c,t)}`})},N=(e,t)=>{let n=e.type===`update`?M(e,t):j(e,t);return e.type===`update`&&n.length===0?void 0:[A(e,t),...n].join(`
|
|
2
|
-
`)},P=(e,t)=>{let n=e.filter(h);return[a.t(a.n(`red`,`Warning: ${n.length} destructive change(s) will permanently delete data.`,t),t),...n.map(e=>a.n(`red`,` - ${l.r(e.metadataName)} ${w(O(e))}: ${e.metadataName===`objectMetadata`?`drops the table and all its rows`:`drops the column and its data`}`,t)),a.n(`red`,`Destroys are irreversible. Review carefully before applying.`,t)].join(`
|
|
3
|
-
`)},F=({actions:e,summary:n,inferDeletionFromMissingEntities:r,stream:i=process.stdout})=>{if(e.length===0)return`No changes. Twenty metadata matches your manifest.`;let o=k(e).map(e=>N(e,i)).filter(t.t);return[a.t(`Twenty will perform the following actions:`,i),``,o.join(`
|
|
4
|
-
|
|
5
|
-
`),``,`Plan: ${a.n(`green`,`${n.create} to add`,i)}, ${a.n(`yellow`,`${n.update} to change`,i)}, ${a.n(`red`,`${n.delete} to destroy`,i)}.`,...!t.t(r)&&n.delete>0?[a.i(v,i)]:[],...n.destructive>0?[``,P(e,i)]:[]].join(`
|
|
6
|
-
`)},I=({applicationName:e,apiUrl:t,actions:n,summary:r,inferDeletionFromMissingEntities:i})=>[`Plan for ${l.r(e)} on ${t}`,F({actions:n,summary:r,inferDeletionFromMissingEntities:i}),`Use --json for complete action details.`,`Nothing was registered, uploaded or synchronized. The server may return different actions when you apply.`].join(`
|
|
7
|
-
|
|
8
|
-
`),L=e=>{let t={create:0,update:0,delete:0,destructive:0};for(let n of e)t[n.type]+=1,h(n)&&(t.destructive+=1);return t},R=({options:e,output:t})=>{let n=e.delete===!1;return n&&t.warn({code:`DEPRECATED_OPTION`,message:`--no-delete is deprecated, use --no-prune instead.`}),(0,u.isBoolean)(e.prune)?e.prune:!n&&void 0};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return R}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./isDefined-CJctgvfE.cjs"),t=require("./is-inside-directory-CymDrDJC.cjs"),n=require("./cli-error-CrUD8uMp.cjs"),r=require("./api-url-protocols.constant-EEmR3Pmg.cjs"),i=require("./read-bounded-body-BekYzK8S.cjs");let a=require("node:crypto"),o=require("node:path"),s=require("node:fs");var c=({build:r,appPath:i})=>{if(!e.t(r.directory))throw new n.t({code:`SNAPSHOT_INVALID`,message:`The build did not report its snapshot directory, so the CLI cannot upload it.`});if(!t.t({filePath:r.directory,directory:(0,o.join)(i,`.twenty`,`cli`,`snapshots`)}))throw new n.t({code:`SNAPSHOT_INVALID`,message:`The build snapshot ${r.directory} is outside the app's .twenty/cli/snapshots folder.`,details:{directory:r.directory}});return r.directory},l={UPLOAD_CONCURRENCY:4,UPLOAD_TIMEOUT_MILLISECONDS:3e5},u=async({uploadUrl:t,contentType:a,bytes:o,signal:s})=>{let c=URL.parse(t);if(!e.t(c)||!r.t.includes(c.protocol))throw new n.t({code:`INVALID_RESPONSE`,message:`The server returned an upload URL the CLI cannot use.`});let u=await i.n(c,{method:`PUT`,headers:{"Content-Type":a},body:o,redirect:`manual`,signal:AbortSignal.any([s,AbortSignal.timeout(l.UPLOAD_TIMEOUT_MILLISECONDS)])});return await u.body?.cancel().catch(()=>void 0),u.status};async function*d(e){let t=e.stream().getReader();try{for(;;){let{done:e,value:n}=await t.read();if(e)return;yield n}}finally{try{await t.cancel()}catch{}finally{t.releaseLock()}}}var f=({message:e,path:t})=>new n.t({code:`SNAPSHOT_INVALID`,message:e,hint:`Build again. If it keeps happening, check that nothing else writes to the snapshot directory.`,details:{path:t}}),p=async({snapshotDirectory:e,artifact:n})=>{let r=(0,o.resolve)(e,n.path);if(!t.t({filePath:r,directory:e}))throw f({message:`The build lists a file outside its snapshot: ${n.path}`,path:n.path});let i=await(0,s.openAsBlob)(r),c=(0,a.createHash)(`sha256`);try{for await(let e of d(i))c.update(e)}catch(e){throw e instanceof DOMException&&e.name===`NotReadableError`?f({message:`${n.path} changed after the build.`,path:n.path}):e}let l=c.digest(`hex`);if(i.size!==n.size||l!==n.sha256)throw f({message:`${n.path} changed after the build.`,path:n.path});return i};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return p}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./build--4zYt4wd.cjs"),t=require("./isDefined-CJctgvfE.cjs"),n=require("./isPlainObject-fJEJm71P.cjs"),r=require("./isNonEmptyArray-v52xg4Xj.cjs"),i=require("./cli-error-CrUD8uMp.cjs"),a=require("./list-application-source-files-jEau5Rie.cjs"),o=require("./constants-Cf5-CwMu.cjs"),s=require("./assert-pull-paths-TFGZvzZO.cjs"),c=require("./is-same-universal-identifier-Bm_wb6Ez.cjs"),l=require("./create-pull-base-write-CQHTbtQP.cjs"),u=require("./create-cancelled-error-BBhAY8fS.cjs"),d=require("./is-interaction-allowed-BQLOG8RG.cjs"),f=require("./with-phase-details-CRqY0f3c.cjs"),p=require("./to-cli-error-4pSpVaW9.cjs"),m=require("./read-infer-deletion-option-Br1FJCfZ.cjs"),h=require("./create-metadata-client-oO0QvH6j.cjs"),g=require("./require-approval-BIgPOy_r.cjs"),_=require("./read-snapshot-file-D-s1kuCP.cjs"),v=require("./fetch-workspace-or-throw-CGlqJOIG.cjs");let y=require("node:crypto"),b=require("node:fs/promises"),x=require("node:path"),S=require("tinyglobby");var C=new Set([`AUTH_REQUIRED`,`PERMISSION_DENIED`]),w=new Set([`SNAPSHOT_INVALID`,`TOOLING_UNSUPPORTED`]),T=({phase:e,code:t,upload:n})=>e===`build`||e===`preview`||e===`confirmation`?`not-started`:e===`upload`&&n.fileCount>0?`partial`:e===`upload`&&n.hasCreatedTargets?`unknown`:C.has(t)||w.has(t)?`not-started`:`unknown`,E=({phase:e,outcome:t})=>t===`not-started`?`Fix the problem, then run twenty app apply again. It rebuilds the app and requests a fresh plan.`:`The ${e} step may have changed the workspace. Run twenty app plan to see where it stands before applying again.`,D=({error:e,phase:t,completedPhases:n,upload:r,signal:i})=>{let a=p.t(e,i),o=T({phase:t,code:a.code,upload:r});return f.t({error:a,phase:t,outcome:o,completedPhases:n,hint:E({phase:t,outcome:o})})},O=e.t(),k=async({application:e,target:t,signal:r})=>{let a=(await h.t({target:t,signal:r}).mutation({__name:`InstallDevelopmentApplication`,createDevelopmentApplication:{__args:{universalIdentifier:e.universalIdentifier,name:e.displayName},id:!0,universalIdentifier:!0}}))?.createDevelopmentApplication;if(!n.t(a)||!(0,O.isNonEmptyString)(a.id)||!c.t({value:a.universalIdentifier,universalIdentifier:e.universalIdentifier}))throw new i.t({code:`INVALID_RESPONSE`,message:`The server returned an invalid development installation.`});return{applicationId:a.id}},A=async({application:e,target:t,signal:r})=>{let a=(await h.t({target:t,signal:r}).mutation({__name:`RegisterApplication`,createApplicationRegistration:{__args:{input:{name:e.displayName,universalIdentifier:e.universalIdentifier}},applicationRegistration:{id:!0,universalIdentifier:!0}}}))?.createApplicationRegistration,o=n.t(a)?a.applicationRegistration:void 0;if(!n.t(o)||!(0,O.isNonEmptyString)(o.id)||!c.t({value:o.universalIdentifier,universalIdentifier:e.universalIdentifier}))throw new i.t({code:`INVALID_RESPONSE`,message:`The server returned an invalid application registration.`});return{registrationId:o.id}},j=e=>{if(!(e instanceof i.t)||!n.t(e.details))return e;let{body:t,...r}=e.details;return new i.t({code:e.code,exitCode:e.exitCode,message:e.message,hint:e.hint,details:{...r,data:null}})},M=({value:e,applicationUniversalIdentifier:t})=>{try{return m.o({value:e,applicationUniversalIdentifier:t})}catch(e){if(e instanceof i.t)return;throw e}},N=async({build:e,inferDeletionFromMissingEntities:r,target:a,signal:o})=>{let s=e.application.universalIdentifier,l=(await h.t({target:a,signal:o}).mutation({__name:`SyncApplication`,syncApplication:{__args:{manifest:e.manifest,...t.t(r)&&{inferDeletionFromMissingEntities:r}},applicationUniversalIdentifier:!0,actions:!0}}).catch(e=>{throw j(e)}))?.syncApplication;if(!n.t(l)||!(0,O.isString)(l.applicationUniversalIdentifier)||!c.t({value:l.applicationUniversalIdentifier,universalIdentifier:s}))throw new i.t({code:`INVALID_RESPONSE`,message:`The server did not confirm the sync of ${s}.`});return{actions:M({value:l,applicationUniversalIdentifier:s}),acknowledgedUniversalIdentifier:l.applicationUniversalIdentifier}},P={"built-logic-function":`BuiltLogicFunction`,"built-front-component":`BuiltFrontComponent`,source:`Source`,dependencies:`Dependencies`,"public-asset":`PublicAsset`},F=()=>new i.t({code:`INVALID_RESPONSE`,message:`The server returned an invalid file upload response.`}),I=e=>n.t(e)&&(0,O.isNonEmptyString)(e.fileId)&&(0,O.isNonEmptyString)(e.filePath)&&(0,O.isNonEmptyString)(e.uploadUrl)&&(0,O.isNonEmptyString)(e.contentType),L=({value:e,idKey:t})=>{if(!(0,O.isArray)(e))throw F();return e.map(e=>{let r=n.t(e)?e[t]:void 0;if(!n.t(e)||!(0,O.isNonEmptyString)(r))throw F();return{id:r,message:(0,O.isNonEmptyString)(e.message)?e.message:`The server refused this file.`}})},R=e=>{let n=P[e.role];if(!t.t(n))throw new i.t({code:`TOOLING_UNSUPPORTED`,message:`The build contains a ${e.role} file, which the CLI cannot upload.`,details:{path:e.path,role:e.role}});return{fileFolder:n,filePath:e.path,size:e.size}},z=async({items:e,run:n})=>{let r=0,i,a=async()=>{if(r>=e.length||t.t(i))return;let o=e[r];r+=1;try{await n(o)}catch(e){i??={error:e}}await a()};if(await Promise.all(Array.from({length:Math.min(_.i.UPLOAD_CONCURRENCY,e.length)},a)),t.t(i))throw i.error},B=async({artifacts:e,context:t})=>{let r=(await h.t({target:t.target,signal:t.signal}).mutation({__name:`CreateApplicationFileUploads`,createApplicationFileUploads:{__args:{applicationUniversalIdentifier:t.applicationUniversalIdentifier,files:e.map(R)},targets:{fileId:!0,filePath:!0,uploadUrl:!0,contentType:!0},errors:{filePath:!0,message:!0}}}))?.createApplicationFileUploads;if(!n.t(r)||!(0,O.isArray)(r.targets)||!r.targets.every(I))throw F();t.progress.hasCreatedTargets=!0;let i=L({value:r.errors,idKey:`filePath`}),a=new Set([...r.targets.map(e=>e.filePath),...i.map(({id:e})=>e)]);return{uploadTargets:r.targets,failures:[...i.map(({id:e,message:t})=>({path:e,message:t})),...e.filter(e=>!a.has(e.path)).map(e=>({path:e.path,message:`The server did not accept this file.`}))]}},V=async({uploadTargets:e,artifactByPath:n,context:r,failures:a})=>{let o=[];return await z({items:e,run:async e=>{let s=n.get(e.filePath);if(!t.t(s)){a.push({path:e.filePath,message:`The server asked for a file this build does not have.`});return}let c=await _.t({snapshotDirectory:r.snapshotDirectory,artifact:s});try{let t=await _.r({uploadUrl:e.uploadUrl,contentType:e.contentType,bytes:c,signal:r.signal});if(t<200||t>=300){a.push({path:s.path,message:`File storage answered ${t}.`});return}o.push(e)}catch(e){if(r.signal.aborted||e instanceof i.t)throw e;a.push({path:s.path,message:e instanceof Error?e.message:String(e)})}}}),o},H=async({sentTargets:e,artifactByPath:t,context:i,failures:a})=>{if(!r.t(e))return;let o=(await h.t({target:i.target,signal:i.signal}).mutation({__name:`CompleteApplicationFileUploads`,completeApplicationFileUploads:{__args:{applicationUniversalIdentifier:i.applicationUniversalIdentifier,fileIds:e.map(e=>e.fileId)},errors:{fileId:!0,message:!0}}}))?.completeApplicationFileUploads;if(!n.t(o))throw F();let s=L({value:o.errors,idKey:`fileId`}),c=new Set(s.map(({id:e})=>e)),l=new Map(e.map(e=>[e.fileId,e.filePath]));a.push(...s.map(({id:e,message:t})=>({path:l.get(e)??e,message:t})));for(let n of e)c.has(n.fileId)||(i.progress.fileCount+=1,i.progress.byteCount+=t.get(n.filePath)?.size??0)},U=async({build:e,snapshotDirectory:t,target:n,signal:a,progress:o})=>{e.files.forEach(R);for(let n of e.files)await _.t({snapshotDirectory:t,artifact:n});let s={applicationUniversalIdentifier:e.application.universalIdentifier,snapshotDirectory:t,target:n,signal:a,progress:o},c=new Map(e.files.map(e=>[e.path,e])),l=[];for(let t=0;t<e.files.length;t+=100){let{uploadTargets:n,failures:r}=await B({artifacts:e.files.slice(t,t+100),context:s});l.push(...r),await H({sentTargets:await V({uploadTargets:n,artifactByPath:c,context:s,failures:l}),artifactByPath:c,context:s,failures:l})}if(r.t(l))throw new i.t({code:`UPLOAD_FAILED`,message:`${l.length} of ${e.files.length} files could not be uploaded.`,details:{failures:l}})},W=e=>e instanceof i.t&&e.code===`PLAN_UNAVAILABLE`,G=async({build:e,appPath:t,context:{target:n,signal:r,output:i,outputMode:a,options:o},inferDeletionFromMissingEntities:s,isCreationApproved:c,isDeletionApproved:l,approvalSignal:u,beforeWrite:f,flushProgress:p})=>{let h=[`build`],v={fileCount:0,byteCount:0,hasCreatedTargets:!1},y=d.t({options:o,outputMode:a}),b=e.application,x=(e,t)=>D({error:e,phase:t,completedPhases:h,upload:v,signal:r}),S=async(e,t)=>{if(await p?.().catch(e=>{throw x(e,`confirmation`)}),[`registration`,`installation`,`upload`,`sync`].includes(e))try{f?.()}catch(e){throw x(e,`confirmation`)}try{let n=await t();return h.push(e),n}catch(t){throw x(t,e)}},C=async e=>(await p?.().catch(e=>{throw x(e,`confirmation`)}),g.t({...e,canPrompt:y,declinedMessage:`Apply stopped at the confirmation prompt.`,signal:u??r}).then(()=>u?.throwIfAborted()).catch(e=>{throw x(e,`confirmation`)})),w=()=>m.a({build:e,inferDeletionFromMissingEntities:s,target:n,signal:r}),T=async()=>{try{let e=await w();return h.push(`preview`),{actions:e,isRegistrationCreated:!1}}catch(e){if(!W(e))throw x(e,`preview`)}return await C({isApproved:c,question:`${b.displayName} is not registered. Register it and install it on ${n.apiUrl}?`,code:`CREATE_REQUIRED`,message:`${b.displayName} has no registration yet. Applying it would create one.`,hint:`Run twenty app apply --create to register it and install it in this workspace.`}),i.progress({message:`Registering the app…`}),await S(`registration`,()=>A({application:b,target:n,signal:r})),i.progress({message:`Installing the development app…`}),await S(`installation`,()=>k({application:b,target:n,signal:r})),i.progress({message:`Computing metadata plan…`}),{actions:await S(`preview`,w),isRegistrationCreated:!0}},E=_.a({build:e,appPath:t});i.progress({message:`Computing metadata plan on ${n.apiUrl}…`});let{actions:O,isRegistrationCreated:j}=await T(),M=m.n(O);if(a===`human`&&i.progress({message:m.i({actions:O,summary:M,inferDeletionFromMissingEntities:s,stream:process.stderr})}),M.destructive>0){let e=M.destructive===1?`object or field deletion that permanently deletes`:`object or field deletions that permanently delete`;await C({isApproved:l,question:`Apply ${M.destructive} ${e} stored data on ${n.apiUrl}?`,code:`CONFIRMATION_REQUIRED`,message:`The plan includes ${M.destructive} ${e} stored data.`,hint:`Review it with twenty app plan, then pass --yes to apply it, or --no-prune to keep entities missing from source.`})}j||await S(`installation`,()=>k({application:b,target:n,signal:r})),i.progress({message:`Uploading ${e.files.length} ${e.files.length===1?`file`:`files`}…`}),await S(`upload`,()=>U({build:e,snapshotDirectory:E,target:n,signal:r,progress:v})),i.progress({message:`Synchronizing the app…`});let{actions:P,acknowledgedUniversalIdentifier:F}=await S(`sync`,()=>N({build:e,inferDeletionFromMissingEntities:s,target:n,signal:r}));return{completedPhases:h,isRegistrationCreated:j,appliedActions:P,acknowledgedUniversalIdentifier:F,upload:v}},K={pullBase:{cancelledMessage:`recording its pull base was cancelled`,failedMessage:`its pull base was not recorded`,hint:`The workspace already has this version of the app. Any previous pull base was kept. The typed API client was not regenerated. Review twenty app plan before retrying twenty app apply, which repeats the sync before recording the base and regenerating the client.`},clientGeneration:{cancelledMessage:`generating its typed API client was cancelled`,failedMessage:`its typed API client was not regenerated`,hint:`The workspace already has this version of the app, but the client files in node_modules/twenty-client-sdk may be incomplete. Fix the problem, then run twenty app generate-client to regenerate the client without syncing again.`}},q=({error:e,phase:t,applicationName:n,apiUrl:r,completedPhases:a,signal:o})=>{let s=p.t(e,o),c=K[t],l=s.code===`CANCELLED`?`${n} was applied to ${r}, but ${c.cancelledMessage}.`:`${n} was applied to ${r}, but ${c.failedMessage}: ${s.message}`;return f.t({error:new i.t({code:s.code,exitCode:s.exitCode,message:l,hint:[c.hint,s.hint].filter(O.isNonEmptyString).join(` `),details:s.details}),phase:t,outcome:`applied`,completedPhases:a,hint:c.hint})},J=async e=>{let t=await(0,S.glob)([`${o.n}/*.json`,`${o.t}/*.json`,`package.json`,`yarn.lock`],{cwd:e,absolute:!0,onlyFiles:!0}),n={};for(let r of[...await a.t(e),...t.sort()])n[(0,x.relative)(e,r).split(x.sep).join(`/`)]=l.i(await(0,b.readFile)(r));return n},Y=async({appPath:e,manifest:t,target:n,sourceFingerprints:r,signal:a})=>{let o=(0,x.join)(e,l.r),c=`${o}.${(0,y.randomUUID)()}.tmp`,u;try{a.throwIfAborted(),await s.t({appPath:e,relativePaths:[l.r]}),await(0,b.mkdir)((0,x.dirname)(o),{recursive:!0}),u=await(0,b.open)(c,`wx`,384),await u.writeFile(l.t({manifest:t,target:n,sourceFingerprints:r}).content),await u.sync(),await u.close(),await s.t({appPath:e,relativePaths:[l.r]}),a.throwIfAborted(),await(0,b.rename)(c,o)}catch(e){throw await u?.close().catch(()=>void 0),await(0,b.rm)(c,{force:!0}).catch(()=>void 0),a.aborted&&Object.is(e,a.reason)?e:new i.t({code:`PULL_BASE_RECORD_FAILED`,message:e instanceof Error?e.message:String(e)})}},X=async({appPath:e,universalIdentifier:t,sourceFingerprints:n,context:{target:r,signal:i,output:a}})=>{a.progress({message:`Recording the pull base…`});try{let{id:a}=await v.t({target:r,signal:i});return await Y({appPath:e,manifest:(await v.n({universalIdentifier:t,target:r,signal:i,shouldIncludeSourceFiles:!0})).manifest,target:{apiUrl:r.apiUrl,workspaceId:a},sourceFingerprints:n,signal:i}),`recorded`}catch(e){if(i.aborted)throw u.t();let t=p.t(e);return t.code===`APP_EXPORT_UNSUPPORTED`?`unsupported`:(a.warn({code:`PULL_BASE_NOT_RECORDED`,message:`The app was applied, but its pull base was not updated: ${t.message} Any previous base was kept. A later pull may report changes from this apply as remote changes.`}),`failed`)}};Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return X}});
|
|
@@ -1 +0,0 @@
|
|
|
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("./parse-api-url-B5c0Gh_n.cjs"),o=require("./resolve-request-url-BzW185lE.cjs");var s=e.t(),c=`/.well-known/oauth-authorization-server`,l=(e,t)=>new r.t({code:`OAUTH_UNAVAILABLE`,message:`Browser sign-in is not available on ${e}: ${t}`,hint:`Pipe an API key into twenty auth login --with-token. Use --remote <name> for a saved connection, or --url ${e} for a new one.`}),u=e=>{let n=(0,s.isNonEmptyString)(e)?URL.parse(e):null;return t.t(n)&&i.t.includes(n.protocol)?n:void 0},d=async({apiUrl:e,signal:r})=>{let i=await o.r({apiUrl:e,signal:r})(o.t({apiUrl:e,path:c}),{headers:{Accept:`application/json`}}),d=await o.n(i);if(!i.ok||!n.t(d))throw l(e,`the server answered ${i.status}.`);let f=u(d.authorization_endpoint),p=u(d.token_endpoint),m=d.code_challenge_methods_supported;if(!(0,s.isNonEmptyString)(d.issuer)||!(0,s.isNonEmptyString)(d.cli_client_id)||!t.t(f)||!t.t(p)||(0,s.isArray)(m)&&!m.includes(`S256`))throw l(e,`its OAuth metadata is incomplete.`);let h=URL.parse(d.issuer);if(!t.t(h)||a.n(h)!==e)throw l(e,`it identifies itself as ${d.issuer}.`);try{o.c({url:p,apiUrl:e,requestedPath:p.href})}catch{throw l(e,`its token endpoint ${p.origin} is on another server.`)}return{issuer:d.issuer,isIssuerInResponse:d.authorization_response_iss_parameter_supported===!0,authorizationEndpoint:f.href,tokenEndpoint:p.href,clientId:d.cli_client_id}},f=async({apiUrl:e,tokenEndpoint:t,parameters:i,signal:a})=>{let c=await o.r({apiUrl:e,signal:a})(t,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify(i)}),l=await o.n(c),u=n.t(l)?l:{};if(!c.ok||!(0,s.isNonEmptyString)(u.access_token))throw new r.t({code:`OAUTH_FAILED`,message:(0,s.isNonEmptyString)(u.error_description)?u.error_description:`The token endpoint answered ${c.status}.`,details:{status:c.status,error:(0,s.isNonEmptyString)(u.error)?u.error:null}});return{accessToken:u.access_token,...(0,s.isNonEmptyString)(u.refresh_token)?{refreshToken:u.refresh_token}:{}}};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return f}});
|
|
@@ -1 +0,0 @@
|
|
|
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("./parse-api-url-B5c0Gh_n.cjs"),a=require("./read-command-values-rGaU2qHz.cjs"),o=require("./target-environment-variable.constant-D7z8AihP.cjs"),s=require("./is-interaction-allowed-BQLOG8RG.cjs"),c=require("./select-target-Ck9mdMLQ.cjs"),l=require("./get-config-path-C-D-QHuX.cjs"),u=require("./read-config-6GnzcpJm.cjs"),d=require("./is-access-token-expiring-BvJhEqtV.cjs"),f=require("./get-credential-kind-qxy7oLdW.cjs"),p=require("./write-config-atomically-B6XQJ6XK.cjs"),m=require("./request-oauth-tokens-B4JHBmVU.cjs");var h=e.t(),g=(e,t)=>new r.t({code:`AUTH_REQUIRED`,exitCode:r.n.AUTHENTICATION,message:`Your session on ${e} expired and could not be refreshed.`,hint:`Sign in again: twenty auth login --remote ${e}`,details:{remote:e,refresh:t??null}}),_=(e,t)=>new r.t({code:`CONFLICT`,exitCode:r.n.CONFLICT,message:`Remote ${e} ${t} while this command was waiting to refresh its session. Nothing was sent.`,hint:`Run the command again.`,details:{remote:e}}),v=({config:e,remoteName:t,apiUrl:n})=>{if(!Object.hasOwn(e.remotes,t))throw _(t,`was renamed or removed`);let a=e.remotes[t];if(i.t({rawUrl:a.apiUrl,sourceName:t})!==n)throw _(t,`was pointed at another server`);let o=f.t(a);if(o===`apiKey`)throw _(t,`switched to an API key`);if(o===`none`)throw new r.t({code:`AUTH_REQUIRED`,exitCode:r.n.AUTHENTICATION,message:`Remote ${t} was signed out while this command was waiting.`,hint:`Sign in again: twenty auth login --remote ${t}`,details:{remote:t}});return a},y=({configPath:e,remoteName:t,apiUrl:n,signal:i})=>p.n({configPath:e,signal:i,operation:async()=>{let a=await u.t(e),o=v({config:a,remoteName:t,apiUrl:n}),{twentyCLIAccessToken:s,twentyCLIRefreshToken:c,twentyCLIRegistrationClientId:l}=o;if((0,h.isNonEmptyString)(s)&&!d.n(s))return s;if(!(0,h.isNonEmptyString)(c)||!(0,h.isNonEmptyString)(l))throw g(t);let{tokenEndpoint:f}=await m.n({apiUrl:n,signal:i}),_=await m.t({apiUrl:n,tokenEndpoint:f,parameters:{grant_type:`refresh_token`,refresh_token:c,client_id:l},signal:i}).catch(e=>{throw e instanceof r.t&&e.code===`OAUTH_FAILED`?g(t,e.details):e});return i.throwIfAborted(),await p.t(e,{...a,remotes:{...a.remotes,[t]:{...o,twentyCLIAccessToken:_.accessToken,...(0,h.isNonEmptyString)(_.refreshToken)?{twentyCLIRefreshToken:_.refreshToken}:{}}}}),_.accessToken}}),b=async({remoteName:e,remote:t,configPath:n,signal:a,onAuthenticationRequired:o})=>{let s=t.twentyCLIAccessToken,c=i.t({rawUrl:t.apiUrl,sourceName:`The URL of remote ${e}`});if((0,h.isNonEmptyString)(s)){let t={apiUrl:c,bearerToken:s,credentialKind:`oauth`,source:`remote`,remoteName:e};if(!d.n(s))return t;try{return{...t,bearerToken:await y({configPath:n,remoteName:e,apiUrl:c,signal:a})}}catch(e){if(o)return o({target:t,error:e});throw e}}let l=t.apiKey;if(!(0,h.isNonEmptyString)(l))throw new r.t({code:`AUTH_REQUIRED`,exitCode:r.n.AUTHENTICATION,message:`Remote ${e} has no saved credentials.`,hint:`Sign in: twenty auth login --remote ${e}`,details:{remote:e}});return{apiUrl:c,bearerToken:l,credentialKind:`apiKey`,source:`remote`,remoteName:e}},x=async({environment:e,remoteFlag:t,configPath:n,signal:r,warn:a,onAuthenticationRequired:s})=>{let l=await c.t({environment:e,remoteFlag:t,loadConfig:()=>u.t(n),warn:a});return l.source===`remote`?b({remoteName:l.remoteName,remote:l.remote,configPath:n,signal:r,onAuthenticationRequired:s}):{apiUrl:i.t({rawUrl:l.apiUrl,sourceName:o.t.API_URL}),bearerToken:l.apiKey,credentialKind:`apiKey`,source:`environment`}},S=async({options:e,outputMode:i,output:o,signal:c})=>{let u=l.t(),d=s.t({options:e,outputMode:i}),f=!1,p=async({target:e,error:i})=>{let a=i instanceof r.t?i.details?.refresh:void 0;if(!d||f||c.aborted||e.source!==`remote`||e.credentialKind!==`oauth`||!t.t(e.remoteName)||!(i instanceof r.t)||i.code!==`AUTH_REQUIRED`||n.t(a)&&a.status!==400&&a.status!==401)throw i;f=!0;let{signInToRemoteAgain:s}=await Promise.resolve().then(()=>require("./sign-in-to-remote-again-DN6ov5o2.cjs"));return s({target:e,remoteName:e.remoteName,error:i,configPath:u,output:o,signal:c})},m=await x({environment:process.env,remoteFlag:a.r(e,`remote`),configPath:u,signal:c,warn:o.warn,onAuthenticationRequired:p});if(!d||m.credentialKind!==`oauth`||f)return m;let{fetchSignedInIdentity:h}=await Promise.resolve().then(()=>require("./fetch-signed-in-identity-GVHuJKXy.cjs")).then(e=>e.n);try{return await h({target:m,signal:c}),m}catch(e){return p({target:m,error:e})}};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return S}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./build--4zYt4wd.cjs"),t=require("./isDefined-CJctgvfE.cjs"),n=require("./cli-error-CrUD8uMp.cjs"),r=require("./request-timeout-milliseconds.constant-BkZTOtpY.cjs"),i=require("./read-bounded-body-BekYzK8S.cjs");var a=e.t(),o=({url:e,apiUrl:t,requestedPath:r})=>{let i=new URL(`${t}/`);if(e.origin!==i.origin||!e.pathname.startsWith(i.pathname))throw new n.t({code:`INVALID_REQUEST_PATH`,exitCode:n.n.USAGE,message:`${r} is outside ${t}.`,hint:`Pass a path relative to the API URL, for example /rest/companies.`,details:{path:r}})},s=16*1024*1024,c=new Set([101,204,205,304]),l=e=>e>=300&&e<400,u=(e,n)=>{let r=e.headers.get(`location`);return t.t(r)?URL.parse(r,n.href)?.origin:void 0},d=({error:e,signal:r,url:i,timeoutMilliseconds:o})=>{if(e instanceof n.t||r.aborted)return e;if(e instanceof Error&&e.name===`TimeoutError`)return new n.t({code:`TIMEOUT`,message:`${i.origin} did not answer within ${o/1e3} seconds.`});let s=e instanceof Error&&e.cause instanceof Error?e.cause.message:String(e),c=e instanceof Error&&e.cause instanceof Error?e.cause:e,l=c instanceof Error&&`code`in c&&(0,a.isString)(c.code)?c.code:void 0;return new n.t({code:`NETWORK_ERROR`,message:`Could not reach ${i.origin}.`,hint:`Check the API URL and that the server is running.`,details:{reason:s,...t.t(l)?{networkCode:l}:{}}})},f=(e,r)=>{let i=u(e,r);return new n.t({code:`REDIRECT_NOT_FOLLOWED`,message:`${r.origin} answered with a redirect (${e.status}), and redirects are not followed.`,hint:t.t(i)?`It redirects to ${i}. If that is the right server, use it as the API URL.`:`Check that the API URL points at the Twenty server itself.`,details:{status:e.status,redirectOrigin:i??null}})},p=({apiUrl:e,bearerToken:n,signal:a,timeoutMilliseconds:u=r.t})=>async(r,p={})=>{let m=new URL(r instanceof Request?r.url:r);o({url:m,apiUrl:e,requestedPath:m.pathname});let h=new Headers(p.headers);t.t(n)&&h.set(`Authorization`,`Bearer ${n}`);try{let e=await i.n(m,{...p,headers:h,redirect:`manual`,signal:AbortSignal.any([a,AbortSignal.timeout(u)])},u===6e4?void 0:u);if(l(e.status))throw await e.body?.cancel(),f(e,m);let t=await i.t(e,s);return new Response(c.has(e.status)?null:t,{status:e.status,statusText:e.statusText,headers:e.headers})}catch(e){throw d({error:e,signal:a,url:m,timeoutMilliseconds:u})}},m=({target:e,signal:t,timeoutMilliseconds:n})=>p({apiUrl:e.apiUrl,bearerToken:e.bearerToken,signal:t,timeoutMilliseconds:n}),h=/^application\/([\w.+-]+\+)?json/i,g=/^(text\/|application\/([\w.+-]+\+)?(json|xml)|application\/javascript)/i,_=async e=>{let t=e.headers.get(`content-type`)??``;if(t!==``&&!g.test(t))throw new n.t({code:`UNSUPPORTED_RESPONSE_TYPE`,message:`The response is ${t}, and binary bodies are not supported yet.`,details:{status:e.status,contentType:t}});let r=await e.text();if(r===``)return null;if(!h.test(t))return r;try{return JSON.parse(r)}catch{return r}},v=/^[a-z][a-z\d+.-]*:/i,y=({apiUrl:e,path:t})=>{let r=t.trim();if(v.test(r)||r.startsWith(`//`)||r.includes(`\\`))throw new n.t({code:`INVALID_REQUEST_PATH`,exitCode:n.n.USAGE,message:`${t} is not a relative path.`,hint:`Pass the path only, for example /rest/companies. Requests always go to the selected workspace.`,details:{path:t}});let i=new URL(r.replace(/^\/+/,``),`${e}/`);return o({url:i,apiUrl:e,requestedPath:t}),i};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return y}});
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const e=require("./build--4zYt4wd.cjs"),t=require("./isDefined-CJctgvfE.cjs"),n=require("./isPlainObject-fJEJm71P.cjs"),r=require("./isValidUniversalIdentifier-DymFerYs.cjs"),i=require("./cli-error-CrUD8uMp.cjs"),a=require("./read-command-values-rGaU2qHz.cjs"),o=require("./resolve-request-url-BzW185lE.cjs"),s=require("./request-timeout-milliseconds.constant-BkZTOtpY.cjs"),c=require("./read-bounded-body-BekYzK8S.cjs"),l=require("./parse-graphql-response-D3WfxVAu.cjs"),u=require("./create-http-status-error-1VM7PoVZ.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("./to-cli-error-4pSpVaW9.cjs"),g=require("./format-data-value-D_1TNU-r.cjs"),_=require("./to-public-target-BltDNpJN.cjs");let v=require("node:events");var y=e=>{let n=a.r(e,`name`),o=a.r(e,`universalIdentifier`);if(t.t(n)&&t.t(o)||t.t(n)&&n.trim().length===0||t.t(o)&&!r.t(o))throw new i.t({code:`INVALID_INPUT`,exitCode:i.n.USAGE,message:`Use either a nonempty --name or a UUID of version 4 or later for --universal-identifier, or neither to watch every function in the app.`});return{...t.t(n)?{name:n}:{},...t.t(o)?{universalIdentifier:o.toLowerCase()}:{}}},b=e.t();async function*x({body:e,signal:t,frameByteLimit:n=o.s}){let r=e.getReader(),a=new TextDecoder,s=``,c=``,l=[],u=0,d=!1,f=e=>{if(u+=e,u>n)throw new i.t({code:`RESPONSE_LIMIT_EXCEEDED`,message:`A log stream frame exceeds ${n} bytes.`,details:{byteLimit:n}})},p=()=>{r.cancel().catch(()=>void 0)};t.addEventListener(`abort`,p,{once:!0});try{t.throwIfAborted();for(let e=await r.read();!e.done;e=await r.read()){t.throwIfAborted();let n=0;for(let r=0;r<e.value.length;r+=1){let i=e.value[r];if(d&&(d=!1,i===10)){f(1),n=r+1;continue}if(!(i!==10&&i!==13)){if(f(r-n+1),s+=a.decode(e.value.subarray(n,r),{stream:!0}),s+=a.decode(),n=r+1,d=i===13,s.length===0){let e={event:c,data:l.join(`
|
|
2
|
-
`)};c=``,l=[],u=0,(e.event.length>0||e.data.length>0)&&(yield e,t.throwIfAborted())}else{let e=s.indexOf(`:`),t=e===-1?s:s.slice(0,e),n=e===-1?``:s.slice(e+1).replace(/^ /,``);t===`event`?c=n:t===`data`&&l.push(n)}s=``}}f(e.value.length-n),s+=a.decode(e.value.subarray(n),{stream:!0})}t.throwIfAborted()}finally{t.removeEventListener(`abort`,p),await r.cancel().catch(()=>void 0),r.releaseLock()}}var S=async({response:e,target:r,signal:i})=>{if(t.t(e.body))for await(let t of x({body:e.body,signal:i})){if(t.event!==`next`)break;let i;try{i=JSON.parse(t.data)}catch{break}if(n.t(i)&&(0,b.isNonEmptyArray)(i.errors))return l.n({errors:i.errors,data:i.data,status:e.status,headers:e.headers,target:r});break}return u.t({status:e.status,headers:e.headers,body:void 0,target:r})},C=e=>new i.t({code:`INVALID_RESPONSE`,message:e}),w=async({target:e,signal:r,query:a,variables:u,onConnected:d,onData:f})=>{let p=o.t({apiUrl:e.apiUrl,path:l.r.metadata}),m=new AbortController,h=AbortSignal.any([r,m.signal]),g=setTimeout(()=>m.abort(new DOMException(`Connection timed out`,`TimeoutError`)),s.t);try{let r=await c.n(p,{method:`POST`,headers:{Authorization:`Bearer ${e.bearerToken}`,"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify({query:a,variables:u}),redirect:`manual`,signal:h},s.t);if(r.status>=300&&r.status<400)throw await r.body?.cancel(),o.i(r,p);if(r.headers.get(`content-type`)?.split(`;`)[0].trim().toLowerCase()!==`text/event-stream`){let t=await c.t(r,o.s);throw await l.t({response:new Response([204,205].includes(r.status)?null:t,{status:r.status,headers:r.headers}),target:e}),C(`The server did not return a GraphQL event stream.`)}if(!r.ok)throw await S({response:r,target:e,signal:h});if(!t.t(r.body))throw C(`The server returned an empty log stream.`);clearTimeout(g),await d();for await(let t of x({body:r.body,signal:h})){if(t.event===`complete`)return;if(t.event!==`next`)throw C(`The server returned an unsupported GraphQL stream event.`);let i;try{i=JSON.parse(t.data)}catch{throw C(`The log stream contains invalid JSON.`)}if(!n.t(i))throw C(`The log stream contains an invalid GraphQL result.`);if((0,b.isArray)(i.errors)&&i.errors.length>0)throw l.n({errors:i.errors,data:i.data,status:r.status,headers:r.headers,target:e});if(!(`data`in i))throw C(`The log stream contains no GraphQL data.`);await f(i.data)}throw new i.t({code:`NETWORK_ERROR`,message:`The log stream ended without a completion event.`,hint:`Restart twenty app logs to resume watching. Logs produced while disconnected cannot be replayed.`})}catch(e){throw o.o({error:e,signal:r,url:p,timeoutMilliseconds:s.t})}finally{clearTimeout(g),m.abort()}},T=e=>{if(!(e instanceof i.t)||e.code!==`GRAPHQL_ERROR`)return!1;let r=e.details?.errors;return(0,b.isArray)(r)&&r.length>0&&r.every(e=>n.t(e)&&(!t.t(e.code)||e.code===`GRAPHQL_VALIDATION_FAILED`)&&(0,b.isString)(e.message)&&/Cannot query field "(?:name|universalIdentifier)" on type "LogicFunctionLogs"/.test(e.message))},E=async({applicationUniversalIdentifier:e,filter:r,target:a,signal:o,onConnected:s,onIdentityUnavailable:c,onRecord:l})=>{let u=0,d=c=>w({target:a,signal:o,query:`subscription SubscribeToLogs($input: LogicFunctionLogsInput!) {
|
|
3
|
-
logicFunctionLogs(input: $input) {
|
|
4
|
-
logs
|
|
5
|
-
${c?`name universalIdentifier`:``}
|
|
6
|
-
}
|
|
7
|
-
}`,variables:{input:{applicationUniversalIdentifier:e,...r}},onConnected:s,onData:async a=>{let o=n.t(a)?a.logicFunctionLogs:void 0;if(!n.t(o)||!(0,b.isString)(o.logs)||t.t(o.name)&&!(0,b.isString)(o.name)||t.t(o.universalIdentifier)&&!(0,b.isString)(o.universalIdentifier))throw new i.t({code:`INVALID_RESPONSE`,message:`The server returned an invalid application log record.`});u+=1,await l({applicationUniversalIdentifier:e,functionName:o.name??r.name??null,functionUniversalIdentifier:o.universalIdentifier??r.universalIdentifier??null,logs:o.logs})}});try{await d(!0)}catch(e){if(o.aborted||u>0||!T(e))throw e;await c(),await d(!1)}},D=async e=>{let{options:n,output:r,outputMode:o,signal:s,target:c}=e,l=e=>{o===`human`?r.progress({message:d.s(e.message)}):r.warn(e)},u=y(n),b=await p.t({appPath:(await m.t({explicitPath:a.r(n,`path`),workingDirectory:process.cwd()})).path,signal:s,warn:l});if(!t.t(b.application))throw new i.t({code:`INVALID_INPUT`,exitCode:i.n.USAGE,message:`This project has no application definition.`});let x=b.application.universalIdentifier.toLowerCase(),S=0;if(await r.event(`start`,{target:_.t(c),applicationUniversalIdentifier:x,filter:u,diagnostics:b.diagnostics},s),o===`human`){for(let e of b.diagnostics)r.progress({message:f.c(e)});r.progress({message:`Watching ${g.r(b.application.displayName??x)} logs on ${c.apiUrl}. New executions only. Press Ctrl+C to stop.`})}try{await E({applicationUniversalIdentifier:x,filter:u,target:c,signal:s,onConnected:()=>r.event(`progress`,{kind:`connected`},s),onIdentityUnavailable:async()=>l({code:`LOG_IDENTITY_UNAVAILABLE`,message:`This server returns log text without function identities. Mixed logs cannot be attributed to individual functions; use --universal-identifier to isolate one, or upgrade the server.`}),onRecord:async e=>{if(o===`ndjson`)await r.event(`record`,e,s);else{let n=[...t.t(e.functionName)?[d.n(`cyan`,g.r(e.functionName))]:[],...t.t(e.functionUniversalIdentifier)?[d.i(g.r(e.functionUniversalIdentifier))]:[]].join(` · `),r=[...n.length>0?[`[${n}]`]:[],...e.logs.replace(/\n$/,``).split(`
|
|
8
|
-
`).map(g.r)].join(`
|
|
9
|
-
`);s.throwIfAborted(),process.stdout.write(`${r}\n`)||await(0,v.once)(process.stdout,`drain`,{signal:s}),s.throwIfAborted()}S+=1}})}catch(e){let t=h.t(e,s);throw new i.t({code:t.code,exitCode:t.exitCode,message:t.message,hint:t.code===`NETWORK_ERROR`?`Restart twenty app logs to resume watching. Logs produced while disconnected cannot be replayed.`:t.hint,details:{...t.details,applicationUniversalIdentifier:x,filter:u,recordCount:S}})}return{data:{applicationUniversalIdentifier:x,filter:u,recordCount:S},human:`Log stream completed.`}};exports.runAppLogsCommand=D;
|
|
@@ -1 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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
|
-
`).map(h.r).join(`
|
|
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`,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
|
-
`)}};exports.runAppPullCommand=L;
|
|
@@ -1 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
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;
|
|
@@ -1,2 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
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;
|