twenty 2.66.0 → 2.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-template/yarn.lock +34 -34
- package/dist/app-worker.cjs +1 -1
- package/dist/chunks/CustomError-BUuYEmSr.cjs +1 -0
- package/dist/chunks/RelationType-Bj6kxQ0H.cjs +1 -0
- package/dist/chunks/{assert-app-roles-allowed-Dczuq7Td.cjs → assert-app-roles-allowed-ivmt_Ovf.cjs} +1 -1
- package/dist/chunks/{build-source-manifest-BdwCLi7-.cjs → build-source-manifest-DPNf_SHD.cjs} +1 -1
- package/dist/chunks/{build-source-snapshot-CA4m93n4.cjs → build-source-snapshot-DWimLnHj.cjs} +17 -17
- package/dist/chunks/{cli-version.constant-DEkZ6ft9.cjs → cli-version.constant-BcTtCfja.cjs} +1 -1
- package/dist/chunks/compile-application-translations-Ctxz-abI.cjs +58 -0
- package/dist/chunks/create-metadata-client-CnGWuqf3.cjs +6 -0
- package/dist/chunks/do-not-translate-DURml7MP.cjs +1 -0
- package/dist/chunks/{execa-CAd0sJ7f.cjs → execa-CIDdRA4T.cjs} +1 -1
- package/dist/chunks/{extract-manifest-from-file-Bc9M2pV-.cjs → extract-manifest-from-file-CZSiNIBb.cjs} +1 -1
- package/dist/chunks/{extract-source-translations-LZZZNnCS.cjs → extract-source-translations-Ca9bNo4l.cjs} +1 -1
- package/dist/chunks/{fetch-app-export-CuJJcOIB.cjs → fetch-app-export-BufK5na0.cjs} +1 -1
- package/dist/chunks/{fetch-metadata-inspection-CMxgaywK.cjs → fetch-metadata-inspection-1twsLS72.cjs} +1 -1
- package/dist/chunks/{fetch-signed-in-identity-D8fcFcPu.cjs → fetch-signed-in-identity-D456EFL0.cjs} +1 -1
- package/dist/chunks/{fetch-workspace-or-throw-zRzZP1I8.cjs → fetch-workspace-or-throw-M28SLp-p.cjs} +1 -1
- package/dist/chunks/{get-client-generation-skip-reason-B2TrOrMK.cjs → get-client-generation-skip-reason-Dn-V6L2M.cjs} +1 -1
- package/dist/chunks/get-field-universal-identifier.util-Cq1R4QL5.cjs +1 -0
- package/dist/chunks/getApplicationManifestRoleViolations-Cjxq9trm.cjs +1 -0
- package/dist/chunks/{global-flags.constant-CPWXn90r.cjs → global-flags.constant-CgUYAJiD.cjs} +1 -1
- package/dist/chunks/is-exported-manifest-DKngxSNX.cjs +1 -0
- package/dist/chunks/{is-valid-package-name--H6YNV5Q.cjs → is-valid-package-name-De8pMjCq.cjs} +1 -1
- package/dist/chunks/kebab-case-B3kq7ANN.cjs +1 -0
- package/dist/chunks/{parse-app-export-B9Ocghe1.cjs → parse-app-export-C2EtOTo7.cjs} +1 -1
- package/dist/chunks/pull-minimum-sdk-version.constant-CmGby3BZ.cjs +6 -0
- package/dist/chunks/{pull-source-BfxtqVV9.cjs → pull-source-CI36sCYG.cjs} +1 -1
- package/dist/chunks/{read-application-identifier-ltCC4QI6.cjs → read-application-identifier-C02Esnq_.cjs} +1 -1
- package/dist/chunks/{read-application-identity-BYYdQpIe.cjs → read-application-identity-BCVmSdkM.cjs} +1 -1
- package/dist/chunks/{read-infer-deletion-option-CLz1f4WD.cjs → read-infer-deletion-option-sSJKRpsn.cjs} +1 -1
- package/dist/chunks/{read-local-container-Cs3cWspd.cjs → read-local-container-cd3m1F99.cjs} +1 -1
- package/dist/chunks/{read-source-identity-BgeuDSXD.cjs → read-source-identity-DwLS3ZPe.cjs} +1 -1
- package/dist/chunks/{record-pull-base-DNmPuy-q.cjs → record-pull-base-vp71WJrX.cjs} +1 -1
- package/dist/chunks/{resolve-command-target-fMeudGbM.cjs → resolve-command-target-BfC2U2K3.cjs} +1 -1
- package/dist/chunks/{resolve-proxy-headers-DipR9jft.cjs → resolve-proxy-headers-CnzVk6tu.cjs} +1 -1
- package/dist/chunks/run-app-add-command-BS0nLuyC.cjs +176 -0
- package/dist/chunks/{run-app-apply-command-I6mOjbpr.cjs → run-app-apply-command-CnW6z8lv.cjs} +1 -1
- package/dist/chunks/{run-app-build-command-cFbP918a.cjs → run-app-build-command-dKsFukTy.cjs} +1 -1
- package/dist/chunks/{run-app-dev-command-Br-YbYK_.cjs → run-app-dev-command-C5Kg5vKc.cjs} +1 -1
- package/dist/chunks/{run-app-exec-command-DdeXxz3d.cjs → run-app-exec-command-9_qlrxsx.cjs} +1 -1
- package/dist/chunks/{run-app-generate-client-command-EQxfRIgr.cjs → run-app-generate-client-command-BxVhrqgb.cjs} +1 -1
- package/dist/chunks/{run-app-init-command-DMKcPdWj.cjs → run-app-init-command-C_usp_Lq.cjs} +1 -1
- package/dist/chunks/{run-app-install-command-BeMXjbpp.cjs → run-app-install-command-JrRsVeen.cjs} +1 -1
- package/dist/chunks/{run-app-operation-DowBCQ3X.cjs → run-app-operation-Co_gfkFr.cjs} +1 -1
- package/dist/chunks/{run-app-plan-command-Dk0zNv-m.cjs → run-app-plan-command-n4W9IKXz.cjs} +1 -1
- package/dist/chunks/{run-app-publish-command-BsD4jADF.cjs → run-app-publish-command-BbnCejt7.cjs} +1 -1
- package/dist/chunks/{run-app-pull-command-DpO-LV0D.cjs → run-app-pull-command-C5RzAcs8.cjs} +1 -1
- package/dist/chunks/{run-app-typecheck-command-CwEzeGrv.cjs → run-app-typecheck-command-Nv42qeYW.cjs} +1 -1
- package/dist/chunks/{run-app-uninstall-command-CE2wukpa.cjs → run-app-uninstall-command-D5PzzPaZ.cjs} +1 -1
- package/dist/chunks/{run-auth-login-command-C29QrmRA.cjs → run-auth-login-command-Z6kKqNLB.cjs} +1 -1
- package/dist/chunks/{run-auth-status-command-CNNlbe-Q.cjs → run-auth-status-command-Bt7qomib.cjs} +1 -1
- package/dist/chunks/{run-cli-CRPIPYYa.cjs → run-cli-DbL-0wgf.cjs} +1 -1
- package/dist/chunks/{run-commands-command-4rQ-cM-F.cjs → run-commands-command-bTT3HVp5.cjs} +1 -1
- package/dist/chunks/run-data-export-command-DYqqQEpM.cjs +3 -0
- package/dist/chunks/{run-data-get-command-BHc0_3RY.cjs → run-data-get-command-ym_1vTiY.cjs} +1 -1
- package/dist/chunks/{run-data-list-command-BurvqPYw.cjs → run-data-list-command-BZlT8s0k.cjs} +1 -1
- package/dist/chunks/{run-doctor-command-CvcXquIo.cjs → run-doctor-command-7qFGPVaQ.cjs} +1 -1
- package/dist/chunks/{run-local-logs-command-COsSRk3f.cjs → run-local-logs-command-QPDzB7Eb.cjs} +1 -1
- package/dist/chunks/{run-local-reset-command-m0x-EiA6.cjs → run-local-reset-command-CF2vbJLJ.cjs} +1 -1
- package/dist/chunks/{run-local-start-command-B8N5Jgjd.cjs → run-local-start-command-J81yLVMQ.cjs} +1 -1
- package/dist/chunks/{run-local-status-command-BYxy0R9I.cjs → run-local-status-command-Bqk8uzI7.cjs} +1 -1
- package/dist/chunks/{run-local-stop-command-D66F73fW.cjs → run-local-stop-command-Dm9mLUE0.cjs} +1 -1
- package/dist/chunks/{run-local-upgrade-command-6P71bQw6.cjs → run-local-upgrade-command-Dp3gXUGB.cjs} +1 -1
- package/dist/chunks/{run-metadata-field-describe-command-DrjqeEWX.cjs → run-metadata-field-describe-command-tcGu3RRC.cjs} +1 -1
- package/dist/chunks/{run-metadata-field-list-command-CjMwkqeB.cjs → run-metadata-field-list-command-CTHStwbq.cjs} +1 -1
- package/dist/chunks/{run-metadata-object-describe-command-CG2fraKf.cjs → run-metadata-object-describe-command-C3evyqmN.cjs} +1 -1
- package/dist/chunks/{run-metadata-object-list-command-BJc9VnSu.cjs → run-metadata-object-list-command-DVdLBXVd.cjs} +1 -1
- package/dist/chunks/{run-open-command-DUaVvuo4.cjs → run-open-command-Cunp9tpg.cjs} +1 -1
- package/dist/chunks/{run-version-command-fWqGTIOL.cjs → run-version-command-Buim8HIx.cjs} +1 -1
- package/dist/chunks/{sign-in-to-remote-again-pVRh7bAy.cjs → sign-in-to-remote-again-YWWedZ5H.cjs} +1 -1
- package/dist/chunks/{standard-object-fields.constant-BhUCkuVw.cjs → standard-object-fields.constant-CIwlR4o8.cjs} +1 -1
- package/dist/chunks/{wait-for-local-environment-zNEJcWA1.cjs → wait-for-local-environment-BArlL778.cjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/docs/commands.md +2 -2
- package/package.json +2 -2
- package/src/app/pull/README.md +8 -6
- package/dist/chunks/compile-application-translations-C7_kwWjG.cjs +0 -58
- package/dist/chunks/create-metadata-client-6jnsn6MV.cjs +0 -6
- package/dist/chunks/get-field-universal-identifier.util-4kQ5e4Tv.cjs +0 -1
- package/dist/chunks/getApplicationManifestRoleViolations-B1uo1G5p.cjs +0 -1
- package/dist/chunks/is-exported-manifest-BHA_mGa6.cjs +0 -1
- package/dist/chunks/kebab-case-tmo--p0I.cjs +0 -1
- package/dist/chunks/pull-minimum-sdk-version.constant-BZX306IB.cjs +0 -6
- package/dist/chunks/run-app-add-command-D9UvSCRi.cjs +0 -176
- package/dist/chunks/run-data-export-command-BlQml9Xw.cjs +0 -3
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
const e=require("./build--4zYt4wd.cjs"),t=require("./isDefined-CJctgvfE.cjs"),n=require("./get-field-universal-identifier.util-4kQ5e4Tv.cjs"),r=require("./standard-object-fields.constant-BhUCkuVw.cjs"),i=require("./compute-deterministic-uuid.util-BHojBHTU.cjs"),a=require("./kebab-case-tmo--p0I.cjs"),o=require("./TwentyStandardApplicationUniversalIdentifier-Cm4vo0D3.cjs"),s=require("./print-typescript-value-BjYn0ZFT.cjs");var c=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.IS_BETWEEN=`IS_BETWEEN`,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}({}),l=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}({}),u=function(e){return e.FLOAT=`float`,e.INT=`int`,e.BIGINT=`bigint`,e}({}),d=function(e){return e.RELATIVE=`RELATIVE`,e.USER_SETTINGS=`USER_SETTINGS`,e.CUSTOM=`CUSTOM`,e}({}),ee=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.TAB=`TAB`,e.SECTION=`SECTION`,e}({}),p=function(e){return e.SIDE_PANEL=`SIDE_PANEL`,e.RECORD_PAGE=`RECORD_PAGE`,e.SPLIT_VIEW=`SPLIT_VIEW`,e.USER_CHOICE=`USER_CHOICE`,e}({}),te=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}({}),m=function(e){return e.AND=`AND`,e.OR=`OR`,e}({}),h=function(e){return e.DAY=`DAY`,e.WEEK=`WEEK`,e.MONTH=`MONTH`,e}({}),g=function(e){return e.AND=`AND`,e.OR=`OR`,e.NOT=`NOT`,e}({}),_=function(e){return e.SIDE_PANEL=`SIDE_PANEL`,e.RECORD_PAGE=`RECORD_PAGE`,e}({}),v=function(e){return e.ASC=`ASC`,e.DESC=`DESC`,e}({}),y=({applicationUniversalIdentifier:e,objectUniversalIdentifier:t,name:n})=>i.t({entityNamespace:`pageLayout`,value:t?`${t}:${n}`:n,applicationUniversalIdentifier:e}),ne=({objectMetadataApplicationUniversalIdentifier:e,pageLayoutUniversalIdentifier:t,title:n})=>i.t({entityNamespace:`pageLayoutTab`,value:`${t}:${n}`,applicationUniversalIdentifier:e}),b=({objectMetadataApplicationUniversalIdentifier:e,pageLayoutTabUniversalIdentifier:t,title:n})=>i.t({entityNamespace:`pageLayoutWidget`,value:`${t}:${n}`,applicationUniversalIdentifier:e}),x=({objectMetadataApplicationUniversalIdentifier:e,objectUniversalIdentifier:t})=>y({applicationUniversalIdentifier:e,objectUniversalIdentifier:t,name:r.c.RECORD_FORM}),S=({objectMetadataApplicationUniversalIdentifier:e,objectUniversalIdentifier:t})=>y({applicationUniversalIdentifier:e,objectUniversalIdentifier:t,name:r.c.RECORD_PAGE}),C=e=>{let{folderUniversalIdentifier:n,...r}=e,i=e.parentUniversalIdentifier??n;return t.t(i)?{...r,parentUniversalIdentifier:i}:r},w=({objectUniversalIdentifier:e,tabs:t})=>{let n=S({objectMetadataApplicationUniversalIdentifier:o.t,objectUniversalIdentifier:e});return{universalIdentifier:n,tabs:Object.fromEntries(Object.entries(t).map(([e,{title:t,widgets:r}])=>{let i=ne({objectMetadataApplicationUniversalIdentifier:o.t,pageLayoutUniversalIdentifier:n,title:t});return[e,{universalIdentifier:i,widgets:Object.fromEntries(Object.entries(r).map(([e,t])=>[e,{universalIdentifier:b({objectMetadataApplicationUniversalIdentifier:o.t,pageLayoutTabUniversalIdentifier:i,title:t})}]))}]}))}},T={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:w({objectUniversalIdentifier:r.n.workspaceMember,tabs:{home:{title:`Home`,widgets:{fields:`Fields`}}}}),attachmentRecordPage:w({objectUniversalIdentifier:r.n.attachment,tabs:{home:{title:`Home`,widgets:{preview:`Preview`,fields:`Fields`,attachedTo:`Attached to`}}}}),companyRecordPage:w({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:w({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:w({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:w({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:w({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`}}}}),workflowRunRecordPage:w({objectUniversalIdentifier:r.n.workflowRun,tabs:{home:{title:`Home`,widgets:{fields:`Fields`}},flow:{title:`Flow`,widgets:{workflowRun:`Flow`}}}}),agentChatThreadRecordPage:w({objectUniversalIdentifier:r.n.agentChatThread,tabs:{chat:{title:`Chat`,widgets:{chat:`Chat`}}}}),blocklistRecordPage:w({objectUniversalIdentifier:r.n.blocklist,tabs:{home:{title:`Home`,widgets:{fields:`Fields`}},timeline:{title:`Timeline`,widgets:{timeline:`Timeline`}}}}),calendarChannelEventAssociationRecordPage:w({objectUniversalIdentifier:r.n.calendarChannelEventAssociation,tabs:{home:{title:`Home`,widgets:{fields:`Fields`}},timeline:{title:`Timeline`,widgets:{timeline:`Timeline`}}}}),calendarEventRecordPage:w({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:w({objectUniversalIdentifier:r.n.calendarEventParticipant,tabs:{home:{title:`Home`,widgets:{fields:`Fields`}},timeline:{title:`Timeline`,widgets:{timeline:`Timeline`}}}}),callRecordingRecordPage:w({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:w({objectUniversalIdentifier:r.n.messageChannelMessageAssociation,tabs:{home:{title:`Home`,widgets:{fields:`Fields`}},timeline:{title:`Timeline`,widgets:{timeline:`Timeline`}}}}),messageChannelMessageAssociationMessageFolderRecordPage:w({objectUniversalIdentifier:r.n.messageChannelMessageAssociationMessageFolder,tabs:{home:{title:`Home`,widgets:{fields:`Fields`}},timeline:{title:`Timeline`,widgets:{timeline:`Timeline`}}}}),messageParticipantRecordPage:w({objectUniversalIdentifier:r.n.messageParticipant,tabs:{home:{title:`Home`,widgets:{fields:`Fields`}},timeline:{title:`Timeline`,widgets:{timeline:`Timeline`}}}}),messageRecordPage:w({objectUniversalIdentifier:r.n.message,tabs:{home:{title:`Home`,widgets:{fields:`Fields`}}}}),messageThreadRecordPage:w({objectUniversalIdentifier:r.n.messageThread,tabs:{home:{title:`Home`,widgets:{emailThread:`Thread`}}}}),messageListRecordPage:w({objectUniversalIdentifier:r.n.messageList,tabs:{home:{title:`Home`,widgets:{fields:`Fields`,members:`Members`}},members:{title:`Members`,widgets:{members:`Members`}}}}),messageCampaignRecordPage:w({objectUniversalIdentifier:r.n.messageCampaign,tabs:{home:{title:`Home`,widgets:{details:`Details`,list:`List`,recipients:`Recipients`,fields:`Fields`}},composer:{title:`Email`,widgets:{messageCampaign:`Email`}}}})},E=e.t(),re=80,ie=new Map(Object.entries(r.t).flatMap(([e,t])=>Object.entries(t).map(([t,{universalIdentifier:n}])=>[n,{objectName:e,fieldName:t}]))),D=e=>(0,E.isNonEmptyString)(e)&&(0,E.isNonEmptyString)(a.t(e).replace(/-+/g,``)),O=e=>e.slice(0,re).replace(/-+$/g,``),k=({segments:e,universalIdentifier:n})=>{let r=O(e.filter(t.t).map(a.t).join(`-`).replace(/-{2,}/g,`-`).replace(/^-+|-+$/g,``));return(0,E.isNonEmptyString)(r)?r:n.slice(0,8)},ae=({indexManifest:e,objectName:t,fieldLocationByUniversalIdentifier:n})=>k({segments:[t,...e.fields.map(({fieldUniversalIdentifier:e})=>n.get(e)?.fieldName??null)],universalIdentifier:e.universalIdentifier}),oe=({viewFieldManifest:e,fieldLocationByUniversalIdentifier:n})=>{let r=n.get(e.fieldMetadataUniversalIdentifier)??ie.get(e.fieldMetadataUniversalIdentifier);return k({segments:t.t(r)?[r.objectName,r.fieldName]:[],universalIdentifier:e.universalIdentifier})},se=80,A=e=>[{path:[...e,`type`],symbol:`FieldType`,members:n.r},{path:[...e,`universalSettings`,`relationType`],symbol:`RelationType`,members:n.n},{path:[...e,`universalSettings`,`onDelete`],symbol:`OnDeleteAction`,members:a.n},{path:[...e,`universalSettings`,`dataType`],symbol:`NumberDataType`,members:u},{path:[...e,`universalSettings`,`displayFormat`],symbol:`DateDisplayFormat`,members:d}],j=A([]),M=[{path:[`openRecordIn`],symbol:`ObjectOpenRecordIn`,members:p},...A([`fields`,`[]`])],N=[{path:[`indexType`],symbol:`IndexType`,members:ee}],P=5,F=e=>[`recordsPermissions`,`objects`,`[]`,`rowLevelRecordsPermissions`,`[]`,...Array.from({length:e},()=>[`predicateGroups`,`[]`]).flat()],I=()=>[...Array.from({length:6},(e,t)=>({path:[...F(t),`predicates`,`[]`,`operand`],symbol:`RowLevelPermissionPredicateOperand`,members:c})),...Array.from({length:P},(e,t)=>({path:[...F(t+1),`logicalOperator`],symbol:`RowLevelPermissionPredicateGroupLogicalOperator`,members:m}))],L=e=>[...I(),{path:[`rowLevelPermissionPredicateGroups`,`[]`,`logicalOperator`],symbol:`RowLevelPermissionPredicateGroupLogicalOperator`,members:m},{path:[`rowLevelPermissionPredicates`,`[]`,`operand`],symbol:`RowLevelPermissionPredicateOperand`,members:c},{path:[`permissionFlagUniversalIdentifiers`,`[]`],symbol:`SystemPermissionFlag`,members:e}];L(r.r);var R=e=>({path:e,symbol:`AggregateOperations`,members:l}),z=e=>[{path:[...e,`filters`,`[]`,`operand`],symbol:`ViewFilterOperand`,members:r.u},{path:[...e,`filterGroups`,`[]`,`logicalOperator`],symbol:`ViewFilterGroupLogicalOperator`,members:g},{path:[...e,`sorts`,`[]`,`direction`],symbol:`ViewSortDirection`,members:v},R([...e,`aggregateOperation`])],B=[R([`aggregateOperation`]),...z([`relationScope`])],V=[{path:[`type`],symbol:`ViewType`,members:a.r},{path:[`openRecordIn`],symbol:`ViewOpenRecordIn`,members:_},R([`kanbanAggregateOperation`]),{path:[`calendarLayout`],symbol:`ViewCalendarLayout`,members:h},R([`fields`,`[]`,`aggregateOperation`]),...z([`fields`,`[]`,`relationScope`]),{path:[`filters`,`[]`,`operand`],symbol:`ViewFilterOperand`,members:r.u},{path:[`filterGroups`,`[]`,`logicalOperator`],symbol:`ViewFilterGroupLogicalOperator`,members:g},{path:[`sorts`,`[]`,`direction`],symbol:`ViewSortDirection`,members:v}],H=e=>[{path:[...e,`type`],symbol:`WidgetType`,members:r.d},{path:[...e,`position`,`layoutMode`],symbol:`PageLayoutTabLayoutMode`,members:r.l},R([...e,`configuration`,`aggregateOperation`]),...[`dateGranularity`,`primaryAxisDateGranularity`,`secondaryAxisGroupByDateGranularity`].map(t=>({path:[...e,`configuration`,t],symbol:`ObjectRecordGroupByDateGranularity`,members:te}))],U=e=>[{path:[...e,`layoutMode`],symbol:`PageLayoutTabLayoutMode`,members:r.l},...H([...e,`widgets`,`[]`])],W=H([]),G=U([]),K=[{path:[`type`],symbol:`NavigationMenuItemType`,members:f}],ce=[{path:[`type`],symbol:`PageLayoutType`,members:r.c},...U([`tabs`,`[]`])],q=[`version`,`steps`,`[]`],J=e=>({path:e,symbol:`ViewFilterOperand`,members:r.u}),le=[J([`version`,`trigger`,`settings`,`filter`,`stepFilters`,`[]`,`operand`]),J([...q,`input`,`stepFilters`,`[]`,`operand`]),J([...q,`input`,`filter`,`recordFilters`,`[]`,`operand`]),{path:[...q,`input`,`[]`,`type`],symbol:`FieldType`,members:n.r}],ue=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),de=({definer:e,config:n,enumBindings:r=[],importStatements:i=[]})=>{let a=new Set,o=s.n({value:n,resolveEnumSymbol:({path:e,value:n})=>{let i=r.find(t=>ue(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<=se?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}(${o});
|
|
6
|
-
`,requiredSdkExports:c}},fe=`__typename`,Y=e=>Array.isArray(e)?e.map(Y):typeof e!=`object`||!e?e:Object.fromEntries(Object.entries(e).filter(([e])=>e!==fe).map(([e,t])=>[e,Y(t)])),pe=new Set([`packageJsonChecksum`,`yarnLockChecksum`,`requiredServerVersionRange`,`aboutDescription`,`postInstallLogicFunction`,`preInstallLogicFunction`,`uninstallLogicFunction`,`healthCheckLogicFunction`,`settingsFrontComponent`,`settingsCustomTabFrontComponentUniversalIdentifier`,`frontComponentSharedDependencies`,`logoUrl`,`screenshots`]),me=`public/cover.generated.png`,he=e=>(e.roles??[]).some(({universalIdentifier:t})=>t===e.application.defaultRoleUniversalIdentifier),ge=e=>{let t=Object.fromEntries(Object.entries(e.application).filter(([t])=>!pe.has(t)&&!(t===`defaultRoleUniversalIdentifier`&&he(e)))),{galleryImages:n}=t;if(!Array.isArray(n)||n.length===0||n.every(e=>e===me)){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}),_e=({roleManifest:e,applicationUniversalIdentifier:n})=>{let{universalIdentifier:i,objectPermissions:a,recordsPermissions:o,fieldPermissions:s}=e;return{...e,...t.t(a)?{objectPermissions:X({permissions:a,getDerivedUniversalIdentifier:({objectUniversalIdentifier:e})=>r.o({applicationUniversalIdentifier:n,roleUniversalIdentifier:i,objectUniversalIdentifier:e})})}:{},...t.t(o?.objects)?{recordsPermissions:{...o,objects:X({permissions:o.objects,getDerivedUniversalIdentifier:({objectUniversalIdentifier:e})=>r.o({applicationUniversalIdentifier:n,roleUniversalIdentifier:i,objectUniversalIdentifier:e})})}}:{},...t.t(s)?{fieldPermissions:X({permissions:s,getDerivedUniversalIdentifier:({fieldUniversalIdentifier:e})=>r.s({applicationUniversalIdentifier:n,roleUniversalIdentifier:i,fieldUniversalIdentifier:e})})}:{}}},ve=({objectName:e,fieldName:t,fieldUniversalIdentifier:n})=>k({segments:[e,t],universalIdentifier:n}),ye=new Map(Object.entries(r.n).map(([e,t])=>[t,e])),Z=({objectUniversalIdentifier:e,manifest:t})=>(t.objects??[]).find(t=>t.universalIdentifier===e)?.nameSingular??ye.get(e)??null,be=new Map(Object.entries(T).map(([e,{universalIdentifier:t}])=>[t,e])),Q=({pageLayoutUniversalIdentifier:e,manifest:n})=>{let r=n.pageLayouts?.find(t=>t.universalIdentifier===e);if(t.t(r))return r.name;let i=be.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(x(n)===e)return`${t.nameSingular}RecordForm`}return null},$=({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},xe=({navigationMenuItemManifest:e,manifest:n})=>{let{type:r,name:i,targetObjectUniversalIdentifier:a,viewUniversalIdentifier:o,pageLayoutUniversalIdentifier:s}=e;return D(i)?i:r===f.OBJECT&&t.t(a)?Z({objectUniversalIdentifier:a,manifest:n}):r===f.VIEW&&t.t(o)?$({viewUniversalIdentifier:o,manifest:n}):r===f.PAGE_LAYOUT&&t.t(s)?Q({pageLayoutUniversalIdentifier:s,manifest:n}):null},Se=({navigationMenuItemManifest:e,manifest:t})=>k({segments:[xe({navigationMenuItemManifest:e,manifest:t})],universalIdentifier:e.universalIdentifier}),Ce=({parentUniversalIdentifier:e,manifest:t})=>{let n=t.navigationMenuItems?.find(t=>t.universalIdentifier===e)?.name;return D(n)?n:null},we=[`application`,`frontComponent`,`logicFunction`,`object`,`field`,`index`,`permissionFlag`,`role`,`view`,`viewField`,`pageLayout`,`pageLayoutTab`,`navigationMenuItem`,`pageLayoutWidget`,`workflow`,`skill`,`agent`,`validationRule`,`relatedRecordPath`],Te=({manifest:e,sourceFileByUniversalIdentifier:n=new Map,systemPermissionFlag:i=r.r})=>{let o=e.application.universalIdentifier,s=[],c=[];s.push({kind:`application`,universalIdentifier:o,definer:`defineApplication`,config:ge(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:M,defaultFolder:`src/objects`,fileSuffix:`.object.ts`,fileBaseName:a.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:j,defaultFolder:`src/fields`,fileSuffix:`.field.ts`,fileBaseName:ve({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:N,defaultFolder:`src/indexes`,fileSuffix:`.index.ts`,fileBaseName:ae({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:k({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:k({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:_e({roleManifest:t,applicationUniversalIdentifier:o}),enumBindings:L(i),defaultFolder:`src/roles`,fileSuffix:`.role.ts`,fileBaseName:k({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:V,defaultFolder:`src/views`,fileSuffix:`.view.ts`,fileBaseName:k({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:B,defaultFolder:`src/view-fields`,fileSuffix:`.view-field.ts`,fileBaseName:oe({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:ce,defaultFolder:`src/page-layouts`,fileSuffix:`.page-layout.ts`,fileBaseName:k({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:G,defaultFolder:`src/page-layout-tabs`,fileSuffix:`.page-layout-tab.ts`,fileBaseName:k({segments:[n.title],universalIdentifier:n.universalIdentifier}),parentName:Q({pageLayoutUniversalIdentifier:r,manifest:e})})}for(let n of e.navigationMenuItems??[]){let r=C(n).parentUniversalIdentifier;s.push({kind:`navigationMenuItem`,universalIdentifier:n.universalIdentifier,definer:`defineNavigationMenuItem`,config:n,enumBindings:K,defaultFolder:`src/navigation-menu-items`,fileSuffix:`.navigation-menu-item.ts`,fileBaseName:Se({navigationMenuItemManifest:n,manifest:e}),parentName:t.t(r)?Ce({parentUniversalIdentifier: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:W,defaultFolder:`src/page-layout-widgets`,fileSuffix:`.page-layout-widget.ts`,fileBaseName:k({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:le,defaultFolder:`src/workflows`,fileSuffix:`.workflow.ts`,fileBaseName:k({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:k({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:k({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:k({segments:[t.name],universalIdentifier:t.universalIdentifier}),parentName:null});return{entities:s,skipped:c}},Ee=`2.50.0`;Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return de}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Ee}});
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
const e=require("./isDefined-CJctgvfE.cjs"),t=require("./get-field-universal-identifier.util-4kQ5e4Tv.cjs"),n=require("./isValidUniversalIdentifier-DymFerYs.cjs"),r=require("./kebab-case-tmo--p0I.cjs"),i=require("./has-error-code-DsJeqbZq.cjs"),a=require("./cli-error-CrUD8uMp.cjs"),o=require("./assert-pull-paths-TFGZvzZO.cjs"),s=require("./print-typescript-value-BjYn0ZFT.cjs"),c=require("./read-command-values-l5T9Lba4.cjs"),l=require("./convert-to-label-CI8cZyg_.cjs"),u=require("./confirm-in-terminal-D2e1lKUY.cjs"),d=require("./is-interaction-allowed-BQLOG8RG.cjs"),f=require("./style-BR52fK4V.cjs"),p=require("./to-worker-output-diagnostics-w1hZPfn0.cjs"),m=require("./read-app-identity-M47izSWp.cjs"),h=require("./resolve-app-project-B4IjfcM-.cjs");let g=require("node:crypto"),_=require("node:fs/promises"),v=require("node:path");var y={[r.r.TABLE]:`IconTable`,[r.r.KANBAN]:`IconLayoutKanban`,[r.r.CALENDAR]:`IconCalendar`,[r.r.LIST]:`IconList`,[r.r.INBOX]:`IconInbox`,[r.r.FIELDS_WIDGET]:`IconListDetails`,[r.r.TABLE_WIDGET]:`IconTable`,[r.r.KANBAN_WIDGET]:`IconLayoutKanban`,[r.r.LIST_WIDGET]:`IconList`,[r.r.CALENDAR_WIDGET]:`IconCalendar`},b=[`object`,`field`,`logic-function`,`front-component`,`validation-rule`],x=({name:e,objectUniversalIdentifier:t})=>`import { defineNavigationMenuItem, NavigationMenuItemType } from 'twenty-sdk/define';
|
|
2
|
-
|
|
3
|
-
export default defineNavigationMenuItem({
|
|
4
|
-
universalIdentifier: '${(0,g.randomUUID)()}',
|
|
5
|
-
name: ${s.n({value:e})},
|
|
6
|
-
icon: 'IconCompass',
|
|
7
|
-
position: 0,
|
|
8
|
-
type: NavigationMenuItemType.OBJECT,
|
|
9
|
-
targetObjectUniversalIdentifier: '${t}',
|
|
10
|
-
});
|
|
11
|
-
`,S=({objectLabelSingular:e,objectUniversalIdentifier:t,fieldsWidgetViewUniversalIdentifier:n})=>`import { definePageLayout, PageLayoutTabLayoutMode, PageLayoutType } from 'twenty-sdk/define';
|
|
12
|
-
|
|
13
|
-
export default definePageLayout({
|
|
14
|
-
universalIdentifier: '${(0,g.randomUUID)()}',
|
|
15
|
-
name: ${s.n({value:`Default ${e} Layout`})},
|
|
16
|
-
type: PageLayoutType.RECORD_PAGE,
|
|
17
|
-
objectUniversalIdentifier: '${t}',
|
|
18
|
-
tabs: [
|
|
19
|
-
{
|
|
20
|
-
universalIdentifier: '${(0,g.randomUUID)()}',
|
|
21
|
-
title: 'Home',
|
|
22
|
-
position: 10,
|
|
23
|
-
icon: 'IconHome',
|
|
24
|
-
layoutMode: PageLayoutTabLayoutMode.VERTICAL_LIST,
|
|
25
|
-
widgets: [
|
|
26
|
-
{
|
|
27
|
-
universalIdentifier: '${(0,g.randomUUID)()}',
|
|
28
|
-
title: 'Fields',
|
|
29
|
-
type: 'FIELDS',
|
|
30
|
-
configuration: {
|
|
31
|
-
configurationType: 'FIELDS',
|
|
32
|
-
viewUniversalIdentifier: '${n}',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
universalIdentifier: '${(0,g.randomUUID)()}',
|
|
39
|
-
title: 'Timeline',
|
|
40
|
-
position: 20,
|
|
41
|
-
icon: 'IconTimelineEvent',
|
|
42
|
-
layoutMode: PageLayoutTabLayoutMode.VERTICAL_LIST,
|
|
43
|
-
widgets: [
|
|
44
|
-
{
|
|
45
|
-
universalIdentifier: '${(0,g.randomUUID)()}',
|
|
46
|
-
title: 'Timeline',
|
|
47
|
-
type: 'TIMELINE',
|
|
48
|
-
configuration: {
|
|
49
|
-
configurationType: 'TIMELINE',
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
});
|
|
56
|
-
`,C=({name:e,universalIdentifier:t=(0,g.randomUUID)(),objectUniversalIdentifier:n,fieldUniversalIdentifiers:i,type:a=r.r.TABLE})=>`import { defineView } from 'twenty-sdk/define';
|
|
57
|
-
|
|
58
|
-
export default defineView(${s.n({value:{universalIdentifier:t,name:e,objectUniversalIdentifier:n,type:a,icon:y[a],position:0,fields:i.map((e,t)=>({universalIdentifier:(0,g.randomUUID)(),fieldMetadataUniversalIdentifier:e,position:t,isVisible:!0,size:200}))}})});
|
|
59
|
-
`,w=({name:e,labelSingular:n,objectUniversalIdentifier:i,nameFieldUniversalIdentifier:a,applicationUniversalIdentifier:o,createView:s,createNavigationMenuItem:c,createPageLayout:l})=>{let u=[];if(s&&u.push({path:`src/views/all-${e}.ts`,content:C({name:`all-${e}`,objectUniversalIdentifier:i,fieldUniversalIdentifiers:[a]})}),c&&u.push({path:`src/navigation-menu-items/${e}.ts`,content:x({name:e,objectUniversalIdentifier:i})}),l){let s=(0,g.randomUUID)(),c=[a,...[`createdAt`,`updatedAt`,`createdBy`,`updatedBy`].map(e=>t.t({applicationUniversalIdentifier:o,objectUniversalIdentifier:i,name:e}))];u.push({path:`src/views/${e}-record-page-fields.ts`,content:C({name:`${e}-record-page-fields`,universalIdentifier:s,objectUniversalIdentifier:i,type:r.r.FIELDS_WIDGET,fieldUniversalIdentifiers:c})},{path:`src/page-layouts/${e}-record-page-layout.ts`,content:S({objectLabelSingular:n,objectUniversalIdentifier:i,fieldsWidgetViewUniversalIdentifier:s})})}return u},T=({data:e})=>{let n=(0,g.randomUUID)(),r=e.description?`\n description: ${s.n({value:e.description})},`:``;if(e.type===t.r.RELATION||e.type===t.r.MORPH_RELATION){let i=e.onDelete&&e.onDelete!==`None`,a=`import { defineField, FieldType, RelationType${i?`, OnDeleteAction`:``} } from 'twenty-sdk/define';`,o=i?`, onDelete: OnDeleteAction.${e.onDelete}`:``,c=e.relationType===t.n.MANY_TO_ONE?`, joinColumnName: '${e.name}Id'`:``,l=e.type===t.r.MORPH_RELATION?`\n morphId: '${(0,g.randomUUID)()}',`:``;return`${a}
|
|
60
|
-
|
|
61
|
-
export default defineField({
|
|
62
|
-
universalIdentifier: '${n}',
|
|
63
|
-
name: ${s.n({value:e.name})},
|
|
64
|
-
label: ${s.n({value:e.label})},
|
|
65
|
-
type: FieldType.${e.type},
|
|
66
|
-
objectUniversalIdentifier: ${s.n({value:e.objectUniversalIdentifier})},
|
|
67
|
-
relationTargetObjectMetadataUniversalIdentifier: ${s.n({value:e.relationTargetObjectMetadataUniversalIdentifier})},
|
|
68
|
-
relationTargetFieldMetadataUniversalIdentifier: ${s.n({value:e.relationTargetFieldMetadataUniversalIdentifier})},
|
|
69
|
-
universalSettings: { relationType: RelationType.${e.relationType}${o}${c} },${l}${r}
|
|
70
|
-
});
|
|
71
|
-
`}return`import { defineField, FieldType } from 'twenty-sdk/define';
|
|
72
|
-
|
|
73
|
-
export default defineField({
|
|
74
|
-
universalIdentifier: '${n}',
|
|
75
|
-
name: ${s.n({value:e.name})},
|
|
76
|
-
label: ${s.n({value:e.label})},
|
|
77
|
-
type: FieldType.${e.type},
|
|
78
|
-
objectUniversalIdentifier: ${s.n({value:e.objectUniversalIdentifier})},${r}
|
|
79
|
-
});
|
|
80
|
-
`},E=({name:e,universalIdentifier:t=(0,g.randomUUID)()})=>{let n=r.t(e);return`import { defineFrontComponent } from 'twenty-sdk/define';
|
|
81
|
-
|
|
82
|
-
// React component - implement your UI here
|
|
83
|
-
const Component = () => {
|
|
84
|
-
return (
|
|
85
|
-
<div style={{ padding: '20px', fontFamily: 'sans-serif' }}>
|
|
86
|
-
<h1>My new component!</h1>
|
|
87
|
-
<p>This is your front component: ${n}</p>
|
|
88
|
-
</div>
|
|
89
|
-
);
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export default defineFrontComponent({
|
|
93
|
-
universalIdentifier: '${t}',
|
|
94
|
-
name: '${n}',
|
|
95
|
-
description: 'Add a description for your front component',
|
|
96
|
-
component: Component,
|
|
97
|
-
});
|
|
98
|
-
`},D=({name:e,universalIdentifier:t=(0,g.randomUUID)()})=>{let n=r.t(e);return`import { defineLogicFunction } from 'twenty-sdk/define';
|
|
99
|
-
|
|
100
|
-
// Logic function handler - rename and implement your logic
|
|
101
|
-
const handler = async (params: {
|
|
102
|
-
a: string;
|
|
103
|
-
b: number;
|
|
104
|
-
}): Promise<{ message: string }> => {
|
|
105
|
-
const { a, b } = params;
|
|
106
|
-
|
|
107
|
-
// Replace with your own logic
|
|
108
|
-
const message = \`Hello, input: \${a} and \${b}\`;
|
|
109
|
-
|
|
110
|
-
return { message };
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
export default defineLogicFunction({
|
|
114
|
-
universalIdentifier: '${t}',
|
|
115
|
-
name: '${n}',
|
|
116
|
-
description: 'Add a description for your logic function',
|
|
117
|
-
timeoutSeconds: 5,
|
|
118
|
-
handler,
|
|
119
|
-
// Add your trigger here
|
|
120
|
-
// Route trigger example:
|
|
121
|
-
// httpRouteTriggerSettings: {
|
|
122
|
-
// path: '/${n}',
|
|
123
|
-
// httpMethod: 'POST',
|
|
124
|
-
// isAuthRequired: true,
|
|
125
|
-
// },
|
|
126
|
-
// Cron trigger example:
|
|
127
|
-
// cronTriggerSettings: {
|
|
128
|
-
// pattern: '0 0 * * *', // Daily at midnight
|
|
129
|
-
// },
|
|
130
|
-
// Record event trigger example:
|
|
131
|
-
// eventTriggerSettings: {
|
|
132
|
-
// on: 'recordEvent',
|
|
133
|
-
// objectUniversalIdentifier: '<object universal identifier>',
|
|
134
|
-
// action: 'created',
|
|
135
|
-
// // Optional: receive one call per batch of events instead of one per event,
|
|
136
|
-
// // the handler payload then becomes { ...eventInfo, events: [...] }
|
|
137
|
-
// batchMode: true,
|
|
138
|
-
// },
|
|
139
|
-
});
|
|
140
|
-
`},O=({data:e,universalIdentifier:t=(0,g.randomUUID)(),nameFieldUniversalIdentifier:n=(0,g.randomUUID)()})=>`import { defineObject, FieldType } from 'twenty-sdk/define';
|
|
141
|
-
|
|
142
|
-
export const NAME_FIELD_UNIVERSAL_IDENTIFIER =
|
|
143
|
-
'${n}';
|
|
144
|
-
|
|
145
|
-
export default defineObject({
|
|
146
|
-
universalIdentifier: '${t}',
|
|
147
|
-
nameSingular: ${s.n({value:e.nameSingular})},
|
|
148
|
-
namePlural: ${s.n({value:e.namePlural})},
|
|
149
|
-
labelSingular: ${s.n({value:e.labelSingular})},
|
|
150
|
-
labelPlural: ${s.n({value:e.labelPlural})},
|
|
151
|
-
icon: 'IconBox',
|
|
152
|
-
labelIdentifierFieldMetadataUniversalIdentifier: NAME_FIELD_UNIVERSAL_IDENTIFIER,
|
|
153
|
-
fields: [
|
|
154
|
-
{
|
|
155
|
-
universalIdentifier: NAME_FIELD_UNIVERSAL_IDENTIFIER,
|
|
156
|
-
type: FieldType.TEXT,
|
|
157
|
-
name: 'name',
|
|
158
|
-
label: 'Name',
|
|
159
|
-
description: ${s.n({value:`Name of the ${e.nameSingular}`})},
|
|
160
|
-
icon: 'IconAbc',
|
|
161
|
-
},
|
|
162
|
-
],
|
|
163
|
-
});
|
|
164
|
-
`,k=({name:e,objectUniversalIdentifier:t,universalIdentifier:n=(0,g.randomUUID)()})=>`import { defineValidationRule, ruleExpression } from 'twenty-sdk/define';
|
|
165
|
-
|
|
166
|
-
const { field, isNonEmptyString } = ruleExpression;
|
|
167
|
-
|
|
168
|
-
export default defineValidationRule({
|
|
169
|
-
universalIdentifier: ${s.n({value:n})},
|
|
170
|
-
objectUniversalIdentifier: ${s.n({value:t})},
|
|
171
|
-
name: ${s.n({value:e})},
|
|
172
|
-
expression: isNonEmptyString(field('name')),
|
|
173
|
-
message: 'Add the message shown when a record breaks this rule',
|
|
174
|
-
});
|
|
175
|
-
`,A=e=>new a.t({code:`USAGE`,exitCode:a.n.USAGE,message:e,hint:`Run twenty app add --help for options and examples.`}),j=async({context:i,applicationUniversalIdentifier:a})=>{let{options:o,signal:s}=i,f=d.t(i),p=async({option:t,label:n,value:i=c.i(o,t),defaultValue:a,choices:l})=>{if(s.throwIfAborted(),!e.t(i)&&f?(i=await u.n({question:`${n}${l?` (${l.join(`, `)})`:``}${e.t(a)?` [${a}]`:``}: `,signal:s}),i=i.trim()||a):i=i?.trim()??a,!e.t(i)||i.length===0&&a!==``)throw A(`Missing ${n.toLowerCase()}. Provide ${t===`entity`?`an entity argument`:`--${r.t(t)}`}.`);if(l&&!l.includes(i))throw A(`Invalid ${n.toLowerCase()}: ${i}. Expected ${l.join(`, `)}.`);return i},m=async(e,t)=>{let r=await p({option:e,label:t});if(!n.t(r))throw A(`${t} must be a UUID (version 4 or later).`);return r},h=await p({option:`entity`,label:`Entity`,value:c.n(i.arguments,0),choices:b}),_=[`namePlural`,`labelPlural`,`createView`,`createNavigationMenuItem`,`createPageLayout`],v=[`type`,`object`,`description`],y=[`targetObject`,`targetField`,`relationType`,`onDelete`],x=t=>{let n=t.filter(t=>e.t(o[t]));if(n.length>0)throw A(`Options do not apply to this definition: ${n.map(e=>`--${r.t(e)}`).join(`, `)}.`)};h!==`object`&&x(_),h!==`field`&&x([...v.filter(e=>e!==`object`||h!==`validation-rule`),...y]),h!==`object`&&h!==`field`&&x([`label`]);let S=await p({option:`name`,label:`Name`}),C=r.t(S);if(!/[a-z0-9]/.test(C))throw A(`Name must contain at least one ASCII letter or digit.`);let j,M=[];switch(h){case`object`:{let e=await p({option:`namePlural`,label:`Plural name`});if(e===S)throw A(`Singular and plural object names must differ.`);let t=await p({option:`label`,label:`Singular label`,defaultValue:l.t(S)}),n=await p({option:`labelPlural`,label:`Plural label`,defaultValue:l.t(e)}),r={createView:c.t(o,`createView`),createNavigationMenuItem:c.t(o,`createNavigationMenuItem`),createPageLayout:c.t(o,`createPageLayout`)};if(f&&!Object.values(r).some(e=>e)){let e=await u.t({question:`Also create a view, navigation menu item, and record page layout for this object?`,signal:s});r.createView=e,r.createNavigationMenuItem=e,r.createPageLayout=e}let i=(0,g.randomUUID)(),d=(0,g.randomUUID)();j=O({name:S,universalIdentifier:i,nameFieldUniversalIdentifier:d,data:{nameSingular:S,namePlural:e,labelSingular:t,labelPlural:n}}),M=w({name:C,labelSingular:t,objectUniversalIdentifier:i,nameFieldUniversalIdentifier:d,applicationUniversalIdentifier:a,...r});break}case`field`:{let n=await p({option:`label`,label:`Label`,defaultValue:l.t(S)}),i=await p({option:`type`,label:`Field type`,defaultValue:t.r.TEXT,choices:Object.values(t.r)}),a=Object.values(t.r).find(e=>e===i);if(!e.t(a))throw A(`Invalid field type: ${i}.`);let o={name:S,label:n,type:a,objectUniversalIdentifier:await m(`object`,`Parent object universal identifier`),description:await p({option:`description`,label:`Description`,defaultValue:``})};if(a===t.r.RELATION||a===t.r.MORPH_RELATION){o.relationTargetObjectMetadataUniversalIdentifier=await m(`targetObject`,`Target object universal identifier`),o.relationTargetFieldMetadataUniversalIdentifier=await m(`targetField`,`Target field universal identifier`);let e=await p({option:`relationType`,label:`Relation type`,defaultValue:t.n.ONE_TO_MANY,choices:Object.values(t.n)}),n=await p({option:`onDelete`,label:`On delete`,defaultValue:r.n.CASCADE,choices:[...Object.values(r.n),`None`]});o.relationType=Object.values(t.n).find(t=>t===e),o.onDelete=n===`None`?`None`:Object.values(r.n).find(e=>e===n)}else x(y);j=T({name:S,data:o});break}case`logic-function`:j=D({name:S});break;case`front-component`:j=E({name:S});break;case`validation-rule`:j=k({name:S,objectUniversalIdentifier:await m(`object`,`Object universal identifier`)});break;default:throw A(`Unsupported entity: ${h}.`)}return{entity:h,name:S,files:[{path:`src/${h}s/${C}.${h===`front-component`?`tsx`:`ts`}`,content:j},...M]}},M=async({appPath:e,files:t,signal:n})=>{n.throwIfAborted();for(let n of t)try{throw await o.t({appPath:e,relativePaths:[n.path]}),await(0,_.lstat)((0,v.join)(e,n.path)),new a.t({code:`APP_PATH_UNAVAILABLE`,exitCode:a.n.CONFLICT,message:`${n.path} already exists. No files were changed.`,hint:`Choose a different name, or edit the existing definition.`})}catch(e){if(e instanceof o.n)throw new a.t({code:`APP_PATH_UNAVAILABLE`,exitCode:a.n.CONFLICT,message:`Cannot create ${n.path}: the destination must stay inside the app and cannot contain symbolic links.`});if(!i.t(e,`ENOENT`))throw e}let r=[],s=[],c=[];try{for(let i of t){n.throwIfAborted();let t=(0,v.dirname)((0,v.join)(e,i.path));await(0,_.mkdir)(t,{recursive:!0}),n.throwIfAborted();let a=await(0,_.mkdtemp)((0,v.join)(t,`.twenty-add-`)),o=(0,v.join)(a,`definition`);r.push({path:i.path,stagedPath:o,temporaryDirectory:a}),await(0,_.writeFile)(o,i.content,{flag:`wx`})}for(let t of r){n.throwIfAborted();let r=(0,v.join)(e,t.path),o=t.stagedPath;try{await(0,_.link)(o,r)}catch(e){throw i.t(e,`EEXIST`)?new a.t({code:`APP_PATH_UNAVAILABLE`,exitCode:a.n.CONFLICT,message:`${t.path} already exists.`,hint:`Choose a different name, or edit the existing definition.`}):e}s.push({path:t.path,stagedPath:o})}}catch(t){let n=[];for(let t of s.reverse())try{let n=(0,v.join)(e,t.path),r=await(0,_.lstat)(t.stagedPath),i=await(0,_.lstat)(n);if(r.ino!==i.ino||r.dev!==i.dev)continue;await(0,_.unlink)(n)}catch(e){i.t(e,`ENOENT`)||n.push(t.path)}throw n.length>0?new a.t({code:`APP_PATH_UNAVAILABLE`,message:`Could not create all definitions or remove all files created by this command.`,hint:`Review these files before retrying: ${n.join(`, `)}.`,details:{createdPaths:n},cause:t}):t}finally{for(let{temporaryDirectory:e}of r)await(0,_.rm)(e,{recursive:!0,force:!0}).catch(()=>{c.push(e)})}return c},N=async t=>{let{options:n,signal:r,output:i}=t,o=await h.t({explicitPath:c.i(n,`path`),workingDirectory:process.cwd()}),s=await m.t({appPath:o.path,signal:r,warn:i.warn});if(!e.t(s.application))throw new a.t({code:`IDENTITY_READ_FAILED`,message:`No application definition found in this app.`,hint:`Start with twenty app init, or add a defineApplication definition.`});for(let e of s.diagnostics)i.progress({message:p.c(e)});let{entity:l,name:u,files:d}=await j({context:t,applicationUniversalIdentifier:s.application.universalIdentifier}),g=await M({appPath:o.path,files:d,signal:r});for(let e of g)i.warn({code:`APP_ADD_CLEANUP_FAILED`,message:`Created definitions, but could not remove temporary directory ${e}.`});return{data:{app:o,entity:l,name:u,createdPaths:d.map(e=>e.path),diagnostics:s.diagnostics},human:[...d.map(e=>f.o(`Created ${e.path}`)),...l===`object`&&d.length===1?[`Add views, navigation and record-page layouts separately to expose the object in the UI.`]:[],``,`Review with ${f.r(`twenty app plan`)}, then run ${f.r(`twenty app apply`)}.`].join(`
|
|
176
|
-
`)}};exports.runAppAddCommand=N;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const e=require("./build--4zYt4wd.cjs"),t=require("./isDefined-CJctgvfE.cjs"),n=require("./isPlainObject-fJEJm71P.cjs"),r=require("./isValidUuid-D3NV1xmO.cjs"),i=require("./has-error-code-DsJeqbZq.cjs"),a=require("./cli-error-CrUD8uMp.cjs"),o=require("./read-command-values-l5T9Lba4.cjs"),s=require("./resolve-request-url-C97wPNvF.cjs"),c=require("./read-bounded-body-BekYzK8S.cjs"),l=require("./create-http-status-error-1VM7PoVZ.cjs"),u=require("./style-BR52fK4V.cjs"),d=require("./create-metadata-client-6jnsn6MV.cjs"),f=require("./subscribe-graphql-CZI3g2Qd.cjs"),p=require("./to-public-target-BltDNpJN.cjs"),m=require("./metadata-page.constant-B46C1Qfg.cjs"),h=require("./resolve-metadata-object-XrvX4Ru3.cjs");let g=require("node:crypto"),_=require("node:fs/promises"),v=require("node:path");var y=[`:`,`[`,`,`],b=({character:e,previousCharacter:n,openQuote:r})=>t.t(r)?e===r?null:r:(e===`"`||e===`'`)&&t.t(n)&&y.includes(n)?e:null,x=e=>{let n=[],r=``,i=null,a=`[`;for(let o of e){if(i=b({character:o,previousCharacter:a,openQuote:i}),a=o,o===`,`&&!t.t(i)){n.push(r),r=``;continue}r+=o}return n.push(r),n},S=function(e){return e.AscNullsFirst=`AscNullsFirst`,e.AscNullsLast=`AscNullsLast`,e.DescNullsFirst=`DescNullsFirst`,e.DescNullsLast=`DescNullsLast`,e}({}),C=e.t(),w=1024*1024*1024,T=async({path:e,shouldOverwrite:n,signal:r})=>{let o=(0,v.resolve)(e),s=()=>new a.t({code:`CONFLICT`,exitCode:a.n.CONFLICT,message:`${o} already exists.`,hint:`Choose another output path or use --force to replace a file.`}),c=async e=>{try{return await e()}catch(e){throw i.t(e,`EEXIST`)?s():new a.t({code:`FILE_WRITE_FAILED`,message:`Could not save the CSV file to ${o}.`,hint:`Check that the output directory exists, is writable, and has enough free space.`,cause:e})}},l=await c(()=>(0,_.lstat)(o).catch(e=>{if(!i.t(e,`ENOENT`))throw e}));if(t.t(l)&&(!n||!l.isFile()))throw s();let u=`${o}.${(0,g.randomUUID)()}.tmp`,d=await c(()=>(0,_.open)(u,`wx`,384)),f=async()=>{await d.close().catch(()=>void 0),await(0,_.rm)(u,{force:!0}).catch(()=>void 0)};if(!n){let e=`${u}.probe`;try{await(0,_.link)(u,e)}catch(e){throw await f(),new a.t({code:`FILE_WRITE_FAILED`,message:`Could not prepare a non-overwriting export to ${o}.`,hint:`The output directory must support hard links. Choose a writable directory on a filesystem that supports them, or use --force to allow replacing the destination file.`,cause:e})}try{await c(()=>(0,_.unlink)(e))}catch(t){throw await(0,_.rm)(e,{force:!0}).catch(()=>void 0),await f(),t}}return{outputPath:o,save:async e=>{let t=0,i=e.getReader();try{for(let e=await i.read();!e.done;e=await i.read()){if(r.throwIfAborted(),t+=e.value.byteLength,t>w)throw new a.t({code:`RESPONSE_LIMIT_EXCEEDED`,message:`The CSV export exceeds the 1 GiB download limit.`});await c(()=>d.writeFile(e.value))}}finally{await i.cancel().catch(()=>void 0),i.releaseLock()}return await c(()=>d.sync()),await c(()=>d.close()),r.throwIfAborted(),n?await c(()=>(0,_.rename)(u,o)):await c(()=>(0,_.link)(u,o)),t},cleanup:f}},E=900*1e3,D=async({id:e,downloadPath:n,target:r,signal:i,save:o})=>{if(!n.startsWith(`/file/record-export/${e}?token=`)||!/^\/file\/record-export\/[0-9a-f-]+\?token=[A-Za-z0-9._-]+$/i.test(n))throw new a.t({code:`INVALID_RESPONSE`,message:`The server returned an invalid export download path.`});let u=s.t({apiUrl:r.apiUrl,path:n}),d=AbortSignal.any([i,AbortSignal.timeout(E)]),f;try{if(f=await s.s({proxyHeaders:r.proxyHeaders,requestUrl:u,canReplay:!0,signal:d,send:e=>c.n(u,{headers:s.c({initHeaders:{Accept:`text/csv`},bearerToken:r.bearerToken,proxyHeaderValues:e}),redirect:`manual`,signal:d},E)}),f.status>=300&&f.status<400)throw s.i({response:f,url:u,proxyHeaders:r.proxyHeaders});if(!f.ok)throw l.t({status:f.status,headers:f.headers,body:void 0,target:r});if(!t.t(f.body)||f.headers.get(`content-type`)?.split(`;`)[0].trim().toLowerCase()!==`text/csv`)throw new a.t({code:`INVALID_RESPONSE`,message:`The server did not return a CSV file.`});return await o(f.body)}catch(e){if(e instanceof a.t||i.aborted)throw e;let t=s.o({error:e,signal:i,url:u,timeoutMilliseconds:E});throw t instanceof a.t?new a.t({code:t.code,message:t.message,hint:`Run the export again. Interrupted downloads cannot be resumed.`}):t}finally{await f?.body?.cancel().catch(()=>void 0)}},O=async({client:e,objectMetadataId:t})=>m.n(async n=>{let{fields:r}=await e.query({fields:{__args:{paging:{first:m.t,after:n},filter:{objectMetadataId:{eq:t}}},pageInfo:{hasNextPage:!0,endCursor:!0},edges:{node:{id:!0,name:!0,isActive:!0,isSystem:!0}}}});return r}),k=[`eq`,`neq`,`in`,`containsAny`,`is`,`gt`,`gte`,`lt`,`lte`,`startsWith`,`endsWith`,`like`,`ilike`],A=()=>new a.t({code:`USAGE`,exitCode:a.n.USAGE,message:`Invalid REST filter expression.`,hint:`Use field[operator]:value, for example employees[gte]:5000 or and(tier[eq]:GOLD,employees[gte]:5000).`}),j=e=>{let t=[],n=0,r=0,i=0,a=``,o=!1,s=!1;for(let c=0;c<e.length;c++){let l=e[c];if((0,C.isNonEmptyString)(a)){l===a&&(a=``);continue}if((l===`"`||l===`'`)&&(c===0||[`:`,`[`,`,`].includes(e[c-1]))){a=l;continue}if(l===`(`&&(r++,o=!1),l===`)`&&(r--,o=!1),l===`:`&&e[c-1]===`]`&&(o=!0,s=/\[(in|containsAny)\]$/.test(e.slice(0,c))),l===`[`&&(!o||s&&e[c-1]===`:`)&&i++,l===`]`&&(!o||i>0)&&i--,l===`,`&&i===0&&(o=!1),r<0||i<0)throw A();l===`,`&&r===0&&i===0&&(t.push(e.slice(n,c)),n=c+1)}if(r!==0||i!==0||(0,C.isNonEmptyString)(a))throw A();return t.push(e.slice(n)),t},M=e=>(e.startsWith(`"`)||e.startsWith(`'`))&&(e.endsWith(`"`)||e.endsWith(`'`))?e.slice(1,-1):e,N=({comparator:e,text:t})=>{if(e!==`in`&&e!==`containsAny`)return e===`is`?t:M(t);if(!t.startsWith(`[`)||!t.endsWith(`]`))throw A();return x(t.slice(1,-1)).map(M)},P=({expression:e,depth:n})=>{if(n>50)throw A();let r=/^(and|or|not)\((.+)\)$/.exec(e);if(t.t(r)){let e=j(r[2]).map(e=>P({expression:e,depth:n+1}));if(r[1]===`not`){if(e.length!==1)throw A();return{not:e[0]}}return{[r[1]]:e}}let i=/^([^\[\]]+)\[([^\[\]]+)\]:(.+)$/.exec(e);if(!t.t(i)||!k.includes(i[2]))throw A();let[,a,o,s]=i,c=N({comparator:o,text:s});return a.split(`.`).reverse().reduce((e,t)=>{if(!(0,C.isNonEmptyString)(t))throw A();return{[t]:e}},{[o]:c})},F=e=>{let t=j(e);return t.length===1&&/^(and|or|not)\(/.test(e)?P({expression:e,depth:0}):{and:t.map(e=>P({expression:e,depth:0}))}},I=Object.values(S),L=e=>{let n=e.split(`,`).map(e=>{let n=/^([^\[\]]+)(?:\[([^\[\]]+)\])?$/.exec(e),r=I.find(e=>e===(n?.[2]??S.AscNullsFirst));if(!t.t(n)||!t.t(r))throw new a.t({code:`USAGE`,exitCode:a.n.USAGE,message:`Invalid REST order_by expression.`,hint:`Use field[direction], for example employees[DescNullsLast].`});let[i,...o]=n[1].split(`.`).reverse();return o.reduce((e,t)=>({[t]:e}),{[i]:r})});return n.some(e=>Object.hasOwn(e,`id`))?n:[...n,{id:S.AscNullsLast}]},R=e=>new a.t({code:`USAGE`,exitCode:a.n.USAGE,message:e}),z=()=>new a.t({code:`INVALID_RESPONSE`,message:`The server returned invalid export progress.`}),B=async({arguments:e,options:i,target:s,signal:c,output:l,outputMode:m})=>{let g=o.i(i,`output`);if(!t.t(g)||!(0,C.isNonEmptyString)(g.trim())||g===`-`)throw R(`--output must name a destination CSV file.`);let _=o.i(i,`fields`)?.split(`,`).map(e=>e.trim());if(_?.some(e=>!(0,C.isNonEmptyString)(e)))throw R(`--fields cannot contain empty names.`);let v=o.i(i,`filter`),y=o.i(i,`orderBy`),b=t.t(v)?F(v):void 0,x=t.t(y)?L(y):void 0,S=await T({path:g,shouldOverwrite:o.t(i,`force`),signal:c}),w=Date.now();try{let i=d.t({target:s,signal:c}),v=await h.t({client:i,name:o.n(e,0)??``}),y=await O({client:i,objectMetadataId:v.id}),T=t.t(_)?[...new Set(_)]:y.filter(e=>e.isActive&&!e.isSystem).map(e=>e.name).sort();if(T.length===0||T.length>500)throw R(`Select between 1 and 500 active fields with --fields.`);let E=T.map(e=>{let n=y.find(t=>t.name===e&&t.isActive);if(!t.t(n))throw R(`No active field named ${e} on ${v.namePlural}. Use twenty metadata field list ${v.namePlural}.`);return n.id});await l.event(`start`,{object:v.namePlural,outputPath:S.outputPath,target:p.t(s)},c),m===`human`&&(l.progress({message:`Target: ${s.remoteName??s.source} (${s.apiUrl})`}),l.progress({message:`Exporting ${v.namePlural}…`,percentage:0}));let k,A,j=-1;if(await f.t({target:s,signal:c,interruptionHint:`Run the export again. Interrupted exports cannot be resumed.`,query:`subscription ExportRecords($input: CreateRecordExportInput!) {
|
|
2
|
-
exportRecords(input: $input) { id filename progress downloadPath errorMessage }
|
|
3
|
-
}`,variables:{input:{objectMetadataId:v.id,fieldMetadataIds:E,filter:b,orderBy:x}},onConnected:async()=>void 0,onData:async e=>{if(!n.t(e)||!n.t(e.exportRecords))throw z();let i=e.exportRecords;if(!(0,C.isString)(i.id)||!r.t(i.id)||!Number.isInteger(i.progress)||typeof i.progress!=`number`||i.progress<0||i.progress>100||t.t(A)&&i.id!==A||t.t(i.errorMessage)&&!(0,C.isString)(i.errorMessage)||t.t(i.downloadPath)&&!(0,C.isString)(i.downloadPath))throw z();if(A=i.id,(0,C.isString)(i.errorMessage))throw new a.t({code:`EXPORT_FAILED`,message:i.errorMessage,hint:`Run the export again after resolving the server error.`});if(i.progress!==j&&(await l.event(`progress`,{id:i.id,progress:i.progress},c),m===`human`&&l.progress({message:`Exporting ${v.namePlural}…`,percentage:i.progress}),j=i.progress),(0,C.isString)(i.downloadPath)){if(i.progress!==100)throw z();m===`human`&&l.progress({message:`Downloading CSV…`});let e=await D({id:i.id,downloadPath:i.downloadPath,target:s,signal:c,save:S.save});return k={id:i.id,bytes:e},!1}}}),!t.t(k))throw new a.t({code:`EXPORT_INTERRUPTED`,message:`The export ended before a download was ready.`,hint:`Run the export again.`});let M=Date.now()-w;return{data:{...k,object:v.namePlural,outputPath:S.outputPath,durationMilliseconds:M},human:u.o(`Exported ${v.namePlural} to ${g} (${k.bytes.toLocaleString(`en-US`)} bytes) in ${(M/1e3).toFixed(1)}s`)}}finally{await S.cleanup()}};exports.runDataExportCommand=B;
|