twenty-sdk 0.8.0 → 0.9.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.
Files changed (42) hide show
  1. package/dist/cli/commands/dev-once.d.ts +7 -0
  2. package/dist/cli/commands/exec.d.ts +2 -2
  3. package/dist/cli/operations/dev-once.d.ts +13 -0
  4. package/dist/cli/operations/execute.d.ts +2 -2
  5. package/dist/cli/operations/index.d.ts +2 -0
  6. package/dist/cli/operations/server-start.d.ts +1 -0
  7. package/dist/cli/utilities/build/manifest/manifest-extract-config.d.ts +1 -1
  8. package/dist/cli/utilities/build/manifest/utils/add-missing-field-option-ids.d.ts +2 -0
  9. package/dist/cli/utilities/build/manifest/utils/from-role-config-to-role-manifest.d.ts +3 -0
  10. package/dist/cli/utilities/config/config-service.d.ts +3 -1
  11. package/dist/cli/utilities/config/get-config-path.d.ts +1 -1
  12. package/dist/cli/utilities/server/docker-container.d.ts +5 -3
  13. package/dist/cli.cjs +46 -44
  14. package/dist/cli.mjs +2035 -2089
  15. package/dist/{frontComponentHostCommunicationApi-op3Q7sYg.mjs → frontComponentHostCommunicationApi-Bz03t3FY.mjs} +66 -74
  16. package/dist/{frontComponentHostCommunicationApi-DvdpnfNz.js → frontComponentHostCommunicationApi-DyOxvANW.js} +3 -3
  17. package/dist/{get-function-input-schema-BZ7_XyUh-xI83N7kX.mjs → get-function-input-schema-BZ7_XyUh-CtECetlr.mjs} +1 -1
  18. package/dist/{get-function-input-schema-BZ7_XyUh-Bf_NiyDR.js → get-function-input-schema-BZ7_XyUh-D2ypJxjI.js} +1 -1
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.mjs +9 -9
  21. package/dist/operations.cjs +1 -1
  22. package/dist/operations.mjs +14 -13
  23. package/dist/sdk/application/application-config.d.ts +1 -1
  24. package/dist/sdk/common/types/define-entity.type.d.ts +5 -2
  25. package/dist/sdk/index.d.ts +1 -1
  26. package/dist/sdk/logic-functions/define-post-install-logic-function.d.ts +2 -5
  27. package/dist/sdk/logic-functions/define-post-install-logic-function.js.map +1 -1
  28. package/dist/sdk/logic-functions/define-pre-install-logic-function.d.ts +2 -5
  29. package/dist/sdk/logic-functions/define-pre-install-logic-function.js.map +1 -1
  30. package/dist/sdk/logic-functions/install-payload-type.d.ts +5 -0
  31. package/dist/sdk/logic-functions/post-install-logic-function-config.d.ts +4 -0
  32. package/dist/sdk/logic-functions/pre-install-logic-function-config.d.ts +5 -0
  33. package/dist/sdk/roles/define-role.d.ts +2 -2
  34. package/dist/sdk/roles/define-role.js.map +1 -1
  35. package/dist/sdk/roles/role-config.d.ts +7 -0
  36. package/dist/ui/index.cjs +413 -398
  37. package/dist/ui/index.mjs +2164 -2134
  38. package/dist/uninstall-CXlUxs8p.js +189 -0
  39. package/dist/{uninstall-9yB-e13_.mjs → uninstall-CrGYRb-Z.mjs} +993 -663
  40. package/package.json +2 -2
  41. package/dist/sdk/logic-functions/install-logic-function-payload-type.d.ts +0 -4
  42. package/dist/uninstall-BCUbP_Bn.js +0 -178
@@ -1,5 +1,5 @@
1
1
  import { createSourceFile as p, ScriptTarget as l, SyntaxKind as t } from "typescript";
2
- import { o } from "./frontComponentHostCommunicationApi-op3Q7sYg.mjs";
2
+ import { o } from "./frontComponentHostCommunicationApi-Bz03t3FY.mjs";
3
3
  const c = (r) => {
4
4
  switch (r.kind) {
5
5
  case t.NumberKeyword:
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("typescript"),o=require("./frontComponentHostCommunicationApi-DvdpnfNz.js"),c=n=>{switch(n.kind){case e.SyntaxKind.NumberKeyword:return{type:"number"};case e.SyntaxKind.StringKeyword:return{type:"string"};case e.SyntaxKind.BooleanKeyword:return{type:"boolean"};case e.SyntaxKind.ArrayType:return{type:"array",items:c(n.elementType)};case e.SyntaxKind.ObjectKeyword:return{type:"object"};case e.SyntaxKind.TypeLiteral:{const i={};return n.members.forEach(t=>{if(o.o(t.name)&&o.o(t.type)){const r=t.name.text;i[r]=c(t.type)}}),{type:"object",properties:i}}case e.SyntaxKind.UnionType:{const i=n,t=[];let r=!0;return i.types.forEach(a=>{if(a.kind===e.SyntaxKind.LiteralType){const y=a.literal;y.kind===e.SyntaxKind.StringLiteral?t.push(y.text):r=!1}else r=!1}),r?{type:"string",enum:t}:{}}default:return{}}},s=(n,i)=>n.parameters.reduce((t,r)=>{const a=r.type;return o.o(a)?[...t,c(a)]:[...t,{}]},i),d=n=>n.kind===e.SyntaxKind.FunctionDeclaration?[n]:n.kind===e.SyntaxKind.VariableStatement?n.declarationList.declarations.filter(i=>o.o(i.initializer)&&i.initializer.kind===e.SyntaxKind.ArrowFunction).map(i=>i.initializer):[],u=n=>{const i=e.createSourceFile("temp.ts",n,e.ScriptTarget.ESNext,!0);let t=[];return i.forEachChild(r=>{(r.kind===e.SyntaxKind.FunctionDeclaration||r.kind===e.SyntaxKind.VariableStatement)&&d(r).forEach(a=>{t=s(a,t)})}),t};exports.getFunctionInputSchema=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("typescript"),o=require("./frontComponentHostCommunicationApi-DyOxvANW.js"),c=n=>{switch(n.kind){case e.SyntaxKind.NumberKeyword:return{type:"number"};case e.SyntaxKind.StringKeyword:return{type:"string"};case e.SyntaxKind.BooleanKeyword:return{type:"boolean"};case e.SyntaxKind.ArrayType:return{type:"array",items:c(n.elementType)};case e.SyntaxKind.ObjectKeyword:return{type:"object"};case e.SyntaxKind.TypeLiteral:{const i={};return n.members.forEach(t=>{if(o.o(t.name)&&o.o(t.type)){const r=t.name.text;i[r]=c(t.type)}}),{type:"object",properties:i}}case e.SyntaxKind.UnionType:{const i=n,t=[];let r=!0;return i.types.forEach(a=>{if(a.kind===e.SyntaxKind.LiteralType){const y=a.literal;y.kind===e.SyntaxKind.StringLiteral?t.push(y.text):r=!1}else r=!1}),r?{type:"string",enum:t}:{}}default:return{}}},s=(n,i)=>n.parameters.reduce((t,r)=>{const a=r.type;return o.o(a)?[...t,c(a)]:[...t,{}]},i),d=n=>n.kind===e.SyntaxKind.FunctionDeclaration?[n]:n.kind===e.SyntaxKind.VariableStatement?n.declarationList.declarations.filter(i=>o.o(i.initializer)&&i.initializer.kind===e.SyntaxKind.ArrowFunction).map(i=>i.initializer):[],u=n=>{const i=e.createSourceFile("temp.ts",n,e.ScriptTarget.ESNext,!0);let t=[];return i.forEachChild(r=>{(r.kind===e.SyntaxKind.FunctionDeclaration||r.kind===e.SyntaxKind.VariableStatement)&&d(r).forEach(a=>{t=s(a,t)})}),t};exports.getFunctionInputSchema=u;
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("./frontComponentHostCommunicationApi-DvdpnfNz.js"),h=require("@sniptt/guards"),u=require("react");var d=(e=>(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))(d||{});const a=({config:e,errors:t=[]})=>({success:t.length===0,config:e,errors:t}),R=e=>{const t=[];return e.universalIdentifier||t.push("Application must have a universalIdentifier"),e.defaultRoleUniversalIdentifier||t.push("Application must have a defaultRoleUniversalIdentifier"),(!e.displayName||e.displayName.length===0)&&t.push("Application must have a non empty display name"),a({config:e,errors:t})},b=e=>{const t=[];return e.universalIdentifier||t.push("Front component must have a universalIdentifier"),e.component||t.push("Front component must have a component"),typeof e.component!="function"&&t.push("Front component component must be a React component"),e.command&&(e.command.universalIdentifier||t.push("Command must have a universalIdentifier"),e.command.label||t.push("Command must have a label")),a({config:e,errors:t})},E=e=>{if(!e)return[];const t=[];for(const n of e)h.isNonEmptyString(n.label)||t.push("Field must have a label"),h.isNonEmptyString(n.name)||t.push(`Field "${n.label}" must have a name`),h.isNonEmptyString(n.universalIdentifier)||t.push(`Field "${n.label}" must have a universalIdentifier`),(n.type===i.R.SELECT||n.type===i.R.MULTI_SELECT)&&(!Array.isArray(n.options)||n.options.length===0)&&t.push(`Field "${n.label}" is a SELECT/MULTI_SELECT type and must have options`);return t},F=e=>{const t=[];e.objectUniversalIdentifier||t.push("Field must have an objectUniversalIdentifier");const n=E([e]);return t.push(...n),a({config:e,errors:t})},_=e=>{const t=JSON.parse(atob(e.split(".")[1]));return{workspaceId:t.workspaceId,applicationId:t.applicationId}},L=e=>{const t=process.env[i.t],n=process.env[i.A];if(!t||!n)throw new Error("getPublicAssetUrl can only be called from within a logic function or front component");const{workspaceId:s,applicationId:o}=_(n),r=e.startsWith("/")?e.slice(1):e,c=(r.startsWith("public/")?r:`public/${r}`).split("/").map(encodeURIComponent).join("/");return`${t}/public-assets/${s}/${o}/${c}`},y=e=>{const t=[];return e.universalIdentifier||t.push("Logic function must have a universalIdentifier"),e.handler||t.push("Logic function must have a handler"),typeof e.handler!="function"&&t.push("Logic function handler must be a function"),e.httpRouteTriggerSettings&&(e.httpRouteTriggerSettings.path||t.push("Route trigger must have a path"),e.httpRouteTriggerSettings.httpMethod||t.push("Route trigger must have an httpMethod")),e.cronTriggerSettings&&(e.cronTriggerSettings.pattern||t.push("Cron trigger must have a pattern")),e.databaseEventTriggerSettings&&(e.databaseEventTriggerSettings.eventName||t.push("Database event trigger must have an eventName")),a({config:e,errors:t})},g=e=>{const t=[];return e.universalIdentifier||t.push("Post install logic function must have a universalIdentifier"),e.handler||t.push("Post install logic function must have a handler"),typeof e.handler!="function"&&t.push("Post install logic function handler must be a function"),a({config:e,errors:t})},N=e=>{const t=[];return e.universalIdentifier||t.push("Pre install logic function must have a universalIdentifier"),e.handler||t.push("Pre install logic function must have a handler"),typeof e.handler!="function"&&t.push("Pre install logic function handler must be a function"),a({config:e,errors:t})},w=e=>{const t=[];return e.universalIdentifier||t.push("NavigationMenuItem must have a universalIdentifier"),typeof e.position!="number"&&t.push("NavigationMenuItem must have a position"),a({config:e,errors:t})},M=e=>{const t=[];e.universalIdentifier||t.push("Object must have a universalIdentifier"),e.nameSingular||t.push("Object must have a nameSingular"),e.namePlural||t.push("Object must have a namePlural"),e.labelSingular||t.push("Object must have a labelSingular"),e.labelPlural||t.push("Object must have a labelPlural");const n=E(e.fields);return t.push(...n),i.o(e.labelIdentifierFieldMetadataUniversalIdentifier)&&!e.fields.some(s=>s.universalIdentifier===e.labelIdentifierFieldMetadataUniversalIdentifier)&&t.push("labelIdentifierFieldMetadataUniversalIdentifier must reference a field defined in the fields array"),a({config:e,errors:t})},U=e=>{const t=[];if(e.universalIdentifier||t.push("PageLayout must have a universalIdentifier"),e.name||t.push("PageLayout must have a name"),e.tabs){for(const n of e.tabs)if(n.universalIdentifier||t.push("PageLayoutTab must have a universalIdentifier"),n.title||t.push("PageLayoutTab must have a title"),n.widgets)for(const s of n.widgets)s.universalIdentifier||t.push("PageLayoutWidget must have a universalIdentifier"),s.title||t.push("PageLayoutWidget must have a title"),s.type||t.push("PageLayoutWidget must have a type")}return a({config:e,errors:t})},D=e=>{const t=[];if(e.universalIdentifier||t.push("Role must have a universalIdentifier"),e.label||t.push("Role must have a label"),e.objectPermissions)for(const n of e.objectPermissions)n.objectUniversalIdentifier||t.push("Object permission must have an objectUniversalIdentifier");if(e.fieldPermissions)for(const n of e.fieldPermissions)n.objectUniversalIdentifier||t.push("Field permission must have an objectUniversalIdentifier"),n.fieldUniversalIdentifier||t.push("Field permission must have a fieldUniversalIdentifier");return a({config:e,errors:t})};d.DAY,d.WEEK,d.MONTH,d.QUARTER,d.YEAR;var S=(e=>(e.API_KEYS_AND_WEBHOOKS="API_KEYS_AND_WEBHOOKS",e.WORKSPACE="WORKSPACE",e.WORKSPACE_MEMBERS="WORKSPACE_MEMBERS",e.ROLES="ROLES",e.DATA_MODEL="DATA_MODEL",e.SECURITY="SECURITY",e.WORKFLOWS="WORKFLOWS",e.IMPERSONATE="IMPERSONATE",e.SSO_BYPASS="SSO_BYPASS",e.APPLICATIONS="APPLICATIONS",e.MARKETPLACE_APPS="MARKETPLACE_APPS",e.LAYOUTS="LAYOUTS",e.BILLING="BILLING",e.AI_SETTINGS="AI_SETTINGS",e.AI="AI",e.VIEWS="VIEWS",e.UPLOAD_FILE="UPLOAD_FILE",e.DOWNLOAD_FILE="DOWNLOAD_FILE",e.SEND_EMAIL_TOOL="SEND_EMAIL_TOOL",e.HTTP_REQUEST_TOOL="HTTP_REQUEST_TOOL",e.CODE_INTERPRETER_TOOL="CODE_INTERPRETER_TOOL",e.IMPORT_CSV="IMPORT_CSV",e.EXPORT_CSV="EXPORT_CSV",e.CONNECTED_ACCOUNTS="CONNECTED_ACCOUNTS",e.PROFILE_INFORMATION="PROFILE_INFORMATION",e))(S||{});const V=e=>{const t=[];return e.universalIdentifier||t.push("Agent must have a universalIdentifier"),e.name||t.push("Agent must have a name"),e.label||t.push("Agent must have a label"),e.prompt||t.push("Agent must have a prompt"),a({config:e,errors:t})},j=e=>{const t=[];return e.universalIdentifier||t.push("Skill must have a universalIdentifier"),e.name||t.push("Skill must have a name"),e.label||t.push("Skill must have a label"),e.content||t.push("Skill must have content"),a({config:e,errors:t})},H=e=>{const t=[];if(e.universalIdentifier||t.push("View must have a universalIdentifier"),e.name||t.push("View must have a name"),e.objectUniversalIdentifier||t.push("View must have an objectUniversalIdentifier"),e.fields)for(const n of e.fields)n.universalIdentifier||t.push("ViewField must have a universalIdentifier"),n.fieldMetadataUniversalIdentifier||t.push("ViewField must have a fieldMetadataUniversalIdentifier");if(e.filters)for(const n of e.filters)n.universalIdentifier||t.push("ViewFilter must have a universalIdentifier"),n.fieldMetadataUniversalIdentifier||t.push("ViewFilter must have a fieldMetadataUniversalIdentifier");if(e.filterGroups)for(const n of e.filterGroups)n.universalIdentifier||t.push("ViewFilterGroup must have a universalIdentifier");if(e.groups)for(const n of e.groups)n.universalIdentifier||t.push("ViewGroup must have a universalIdentifier");if(e.fieldGroups)for(const n of e.fieldGroups)n.universalIdentifier||t.push("ViewFieldGroup must have a universalIdentifier");return a({config:e,errors:t})},W=null,K=null,x=null,Y=null,k=null,G=null,q=null,B=null,$=null,Q=null,J=null,X=null,z=null,Z=null,ee=null,te=null,ne=null,ie=null,se=null,oe=null,re=null,ae=null,ue=null,le=null,de=null,ce=null,fe=()=>{const e=i.frontComponentHostCommunicationApi.closeSidePanel;if(!i.o(e))throw new Error("closeSidePanelFunction is not set");return e()},me=e=>{const t=i.frontComponentHostCommunicationApi.enqueueSnackbar;if(!i.o(t))throw new Error("enqueueSnackbarFunction is not set");return t(e)},C=(e,t,n,s)=>{const o=i.frontComponentHostCommunicationApi.navigate;if(!i.o(o))throw new Error("navigateFunction is not set");return o(e,t,n,s)},P=e=>{const t=i.frontComponentHostCommunicationApi.openCommandConfirmationModal;if(!i.o(t))throw new Error("openCommandConfirmationModalFunction is not set");return t(e)},O=e=>{const t=i.frontComponentHostCommunicationApi.openSidePanelPage;if(!i.o(t))throw new Error("openSidePanelPageFunction is not set");return t(e)},f=()=>{const e=i.frontComponentHostCommunicationApi.unmountFrontComponent;if(!i.o(e))throw new Error("unmountFrontComponentFunction is not set");return e()},pe=e=>{const t=i.frontComponentHostCommunicationApi.updateProgress;if(!i.o(t))throw new Error("updateProgressFunction is not set");return t(e)},he="__twentySdkExecutionContext__",v="__twentySdkContextListeners__",A=()=>(globalThis[v]||(globalThis[v]=new Set),globalThis[v]),I=()=>globalThis[he],ve=e=>{A().add(e)},Ee=e=>{A().delete(e)},p=e=>{const[t,n]=u.useState(()=>e(I())),s=u.useRef(t);return u.useEffect(()=>{const o=()=>{const r=e(I());r!==s.current&&(s.current=r,n(r))};return ve(o),o(),()=>Ee(o)},[e]),t},Ie=e=>e.frontComponentId,m=()=>p(Ie),Se=e=>e.recordId,Ce=()=>p(Se),Pe=e=>e.userId,Oe=()=>p(Pe),Ae=e=>`${e}-command-error`,Te=({execute:e})=>{const[t,n]=u.useState(!1),s=m();return u.useEffect(()=>{if(t)return;n(!0),(async()=>{await e(),await f()})()},[e,t,s]),null},Re=({to:e,params:t,queryParams:n,options:s})=>{const[o,r]=u.useState(!1),l=m();return u.useEffect(()=>{if(o)return;r(!0),(async()=>{await C(e,t,n,s),await f()})()},[e,t,n,s,o,l]),null},be=({page:e,pageTitle:t,pageIcon:n,onClick:s,shouldResetSearchState:o=!1})=>{const[r,l]=u.useState(!1),c=m();return u.useEffect(()=>{if(r)return;l(!0),(async()=>{s?.(),await O({page:e,pageTitle:t,pageIcon:n,shouldResetSearchState:o}),await f()})()},[e,t,n,o,s,r,c]),null},Fe=({title:e,subtitle:t,execute:n,confirmButtonText:s,confirmButtonAccent:o})=>{const[r,l]=u.useState(!1),c=m();return u.useEffect(()=>{if(r)return;l(!0),(async()=>{await P({title:e,subtitle:t,confirmButtonText:s,confirmButtonAccent:o})==="confirm"&&await n(),await f()})()},[e,t,n,s,o,r,c]),null};exports.AggregateOperations=i.s;exports.AppPath=i.a;exports.FieldType=i.R;exports.NavigationMenuItemType=i.x;exports.OnDeleteAction=i.Z;exports.PageLayoutTabLayoutMode=i.K;exports.RelationType=i.z;exports.STANDARD_OBJECT=i.y;exports.STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS=i.y;exports.SidePanelPages=i.P;exports.ViewKey=i._E;exports.Command=Te;exports.CommandLink=Re;exports.CommandModal=Fe;exports.CommandOpenSidePanelPage=be;exports.ObjectRecordGroupByDateGranularity=d;exports.PermissionFlag=S;exports.closeSidePanel=fe;exports.createValidationResult=a;exports.defineAgent=V;exports.defineApplication=R;exports.defineField=F;exports.defineFrontComponent=b;exports.defineLogicFunction=y;exports.defineNavigationMenuItem=w;exports.defineObject=M;exports.definePageLayout=U;exports.definePostInstallLogicFunction=g;exports.definePreInstallLogicFunction=N;exports.defineRole=D;exports.defineSkill=j;exports.defineView=H;exports.enqueueSnackbar=me;exports.every=te;exports.everyDefined=ne;exports.everyEquals=ie;exports.favoriteRecordIds=x;exports.featureFlags=$;exports.getFrontComponentCommandErrorDedupeKey=Ae;exports.getPublicAssetUrl=L;exports.hasAnySoftDeleteFilterOnView=k;exports.includes=ee;exports.includesEvery=ce;exports.isDefined=z;exports.isInSidePanel=K;exports.isNonEmptyString=Z;exports.isSelectAll=Y;exports.navigate=C;exports.none=ae;exports.noneDefined=ue;exports.noneEquals=le;exports.numberOfSelectedRecords=G;exports.objectMetadataItem=X;exports.objectPermissions=q;exports.openCommandConfirmationModal=P;exports.openSidePanelPage=O;exports.pageType=W;exports.selectedRecords=B;exports.some=se;exports.someDefined=oe;exports.someEquals=re;exports.someNonEmptyString=de;exports.targetObjectReadPermissions=Q;exports.targetObjectWritePermissions=J;exports.unmountFrontComponent=f;exports.updateProgress=pe;exports.useFrontComponentExecutionContext=p;exports.useFrontComponentId=m;exports.useRecordId=Ce;exports.useUserId=Oe;exports.validateFields=E;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("./frontComponentHostCommunicationApi-DyOxvANW.js"),h=require("@sniptt/guards"),u=require("react");var d=(e=>(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))(d||{});const a=({config:e,errors:t=[]})=>({success:t.length===0,config:e,errors:t}),R=e=>{const t=[];return e.universalIdentifier||t.push("Application must have a universalIdentifier"),e.defaultRoleUniversalIdentifier||t.push("Application must have a defaultRoleUniversalIdentifier"),(!e.displayName||e.displayName.length===0)&&t.push("Application must have a non empty display name"),a({config:e,errors:t})},b=e=>{const t=[];return e.universalIdentifier||t.push("Front component must have a universalIdentifier"),e.component||t.push("Front component must have a component"),typeof e.component!="function"&&t.push("Front component component must be a React component"),e.command&&(e.command.universalIdentifier||t.push("Command must have a universalIdentifier"),e.command.label||t.push("Command must have a label")),a({config:e,errors:t})},E=e=>{if(!e)return[];const t=[];for(const n of e)h.isNonEmptyString(n.label)||t.push("Field must have a label"),h.isNonEmptyString(n.name)||t.push(`Field "${n.label}" must have a name`),h.isNonEmptyString(n.universalIdentifier)||t.push(`Field "${n.label}" must have a universalIdentifier`),(n.type===i.R.SELECT||n.type===i.R.MULTI_SELECT)&&(!Array.isArray(n.options)||n.options.length===0)&&t.push(`Field "${n.label}" is a SELECT/MULTI_SELECT type and must have options`);return t},F=e=>{const t=[];e.objectUniversalIdentifier||t.push("Field must have an objectUniversalIdentifier");const n=E([e]);return t.push(...n),a({config:e,errors:t})},_=e=>{const t=JSON.parse(atob(e.split(".")[1]));return{workspaceId:t.workspaceId,applicationId:t.applicationId}},L=e=>{const t=process.env[i.t],n=process.env[i.A];if(!t||!n)throw new Error("getPublicAssetUrl can only be called from within a logic function or front component");const{workspaceId:s,applicationId:o}=_(n),r=e.startsWith("/")?e.slice(1):e,c=(r.startsWith("public/")?r:`public/${r}`).split("/").map(encodeURIComponent).join("/");return`${t}/public-assets/${s}/${o}/${c}`},g=e=>{const t=[];return e.universalIdentifier||t.push("Logic function must have a universalIdentifier"),e.handler||t.push("Logic function must have a handler"),typeof e.handler!="function"&&t.push("Logic function handler must be a function"),e.httpRouteTriggerSettings&&(e.httpRouteTriggerSettings.path||t.push("Route trigger must have a path"),e.httpRouteTriggerSettings.httpMethod||t.push("Route trigger must have an httpMethod")),e.cronTriggerSettings&&(e.cronTriggerSettings.pattern||t.push("Cron trigger must have a pattern")),e.databaseEventTriggerSettings&&(e.databaseEventTriggerSettings.eventName||t.push("Database event trigger must have an eventName")),a({config:e,errors:t})},y=e=>{const t=[];return e.universalIdentifier||t.push("Post install logic function must have a universalIdentifier"),e.handler||t.push("Post install logic function must have a handler"),typeof e.handler!="function"&&t.push("Post install logic function handler must be a function"),a({config:e,errors:t})},N=e=>{const t=[];return e.universalIdentifier||t.push("Pre install logic function must have a universalIdentifier"),e.handler||t.push("Pre install logic function must have a handler"),typeof e.handler!="function"&&t.push("Pre install logic function handler must be a function"),a({config:e,errors:t})},w=e=>{const t=[];return e.universalIdentifier||t.push("NavigationMenuItem must have a universalIdentifier"),typeof e.position!="number"&&t.push("NavigationMenuItem must have a position"),a({config:e,errors:t})},M=e=>{const t=[];e.universalIdentifier||t.push("Object must have a universalIdentifier"),e.nameSingular||t.push("Object must have a nameSingular"),e.namePlural||t.push("Object must have a namePlural"),e.labelSingular||t.push("Object must have a labelSingular"),e.labelPlural||t.push("Object must have a labelPlural");const n=E(e.fields);return t.push(...n),i.o(e.labelIdentifierFieldMetadataUniversalIdentifier)&&!e.fields.some(s=>s.universalIdentifier===e.labelIdentifierFieldMetadataUniversalIdentifier)&&t.push("labelIdentifierFieldMetadataUniversalIdentifier must reference a field defined in the fields array"),a({config:e,errors:t})},U=e=>{const t=[];if(e.universalIdentifier||t.push("PageLayout must have a universalIdentifier"),e.name||t.push("PageLayout must have a name"),e.tabs){for(const n of e.tabs)if(n.universalIdentifier||t.push("PageLayoutTab must have a universalIdentifier"),n.title||t.push("PageLayoutTab must have a title"),n.widgets)for(const s of n.widgets)s.universalIdentifier||t.push("PageLayoutWidget must have a universalIdentifier"),s.title||t.push("PageLayoutWidget must have a title"),s.type||t.push("PageLayoutWidget must have a type")}return a({config:e,errors:t})},D=e=>{const t=[];if(e.universalIdentifier||t.push("Role must have a universalIdentifier"),e.label||t.push("Role must have a label"),e.objectPermissions)for(const n of e.objectPermissions)n.objectUniversalIdentifier||t.push("Object permission must have an objectUniversalIdentifier");if(e.fieldPermissions)for(const n of e.fieldPermissions)n.objectUniversalIdentifier||t.push("Field permission must have an objectUniversalIdentifier"),n.fieldUniversalIdentifier||t.push("Field permission must have a fieldUniversalIdentifier");return a({config:e,errors:t})};d.DAY,d.WEEK,d.MONTH,d.QUARTER,d.YEAR;var S=(e=>(e.API_KEYS_AND_WEBHOOKS="API_KEYS_AND_WEBHOOKS",e.WORKSPACE="WORKSPACE",e.WORKSPACE_MEMBERS="WORKSPACE_MEMBERS",e.ROLES="ROLES",e.DATA_MODEL="DATA_MODEL",e.SECURITY="SECURITY",e.WORKFLOWS="WORKFLOWS",e.IMPERSONATE="IMPERSONATE",e.SSO_BYPASS="SSO_BYPASS",e.APPLICATIONS="APPLICATIONS",e.MARKETPLACE_APPS="MARKETPLACE_APPS",e.LAYOUTS="LAYOUTS",e.BILLING="BILLING",e.AI_SETTINGS="AI_SETTINGS",e.AI="AI",e.VIEWS="VIEWS",e.UPLOAD_FILE="UPLOAD_FILE",e.DOWNLOAD_FILE="DOWNLOAD_FILE",e.SEND_EMAIL_TOOL="SEND_EMAIL_TOOL",e.HTTP_REQUEST_TOOL="HTTP_REQUEST_TOOL",e.CODE_INTERPRETER_TOOL="CODE_INTERPRETER_TOOL",e.IMPORT_CSV="IMPORT_CSV",e.EXPORT_CSV="EXPORT_CSV",e.CONNECTED_ACCOUNTS="CONNECTED_ACCOUNTS",e.PROFILE_INFORMATION="PROFILE_INFORMATION",e))(S||{});const V=e=>{const t=[];return e.universalIdentifier||t.push("Agent must have a universalIdentifier"),e.name||t.push("Agent must have a name"),e.label||t.push("Agent must have a label"),e.prompt||t.push("Agent must have a prompt"),a({config:e,errors:t})},j=e=>{const t=[];return e.universalIdentifier||t.push("Skill must have a universalIdentifier"),e.name||t.push("Skill must have a name"),e.label||t.push("Skill must have a label"),e.content||t.push("Skill must have content"),a({config:e,errors:t})},H=e=>{const t=[];if(e.universalIdentifier||t.push("View must have a universalIdentifier"),e.name||t.push("View must have a name"),e.objectUniversalIdentifier||t.push("View must have an objectUniversalIdentifier"),e.fields)for(const n of e.fields)n.universalIdentifier||t.push("ViewField must have a universalIdentifier"),n.fieldMetadataUniversalIdentifier||t.push("ViewField must have a fieldMetadataUniversalIdentifier");if(e.filters)for(const n of e.filters)n.universalIdentifier||t.push("ViewFilter must have a universalIdentifier"),n.fieldMetadataUniversalIdentifier||t.push("ViewFilter must have a fieldMetadataUniversalIdentifier");if(e.filterGroups)for(const n of e.filterGroups)n.universalIdentifier||t.push("ViewFilterGroup must have a universalIdentifier");if(e.groups)for(const n of e.groups)n.universalIdentifier||t.push("ViewGroup must have a universalIdentifier");if(e.fieldGroups)for(const n of e.fieldGroups)n.universalIdentifier||t.push("ViewFieldGroup must have a universalIdentifier");return a({config:e,errors:t})},W=null,K=null,x=null,Y=null,k=null,G=null,q=null,B=null,$=null,Q=null,J=null,X=null,z=null,Z=null,ee=null,te=null,ne=null,ie=null,se=null,oe=null,re=null,ae=null,ue=null,le=null,de=null,ce=null,fe=()=>{const e=i.frontComponentHostCommunicationApi.closeSidePanel;if(!i.o(e))throw new Error("closeSidePanelFunction is not set");return e()},me=e=>{const t=i.frontComponentHostCommunicationApi.enqueueSnackbar;if(!i.o(t))throw new Error("enqueueSnackbarFunction is not set");return t(e)},C=(e,t,n,s)=>{const o=i.frontComponentHostCommunicationApi.navigate;if(!i.o(o))throw new Error("navigateFunction is not set");return o(e,t,n,s)},P=e=>{const t=i.frontComponentHostCommunicationApi.openCommandConfirmationModal;if(!i.o(t))throw new Error("openCommandConfirmationModalFunction is not set");return t(e)},O=e=>{const t=i.frontComponentHostCommunicationApi.openSidePanelPage;if(!i.o(t))throw new Error("openSidePanelPageFunction is not set");return t(e)},f=()=>{const e=i.frontComponentHostCommunicationApi.unmountFrontComponent;if(!i.o(e))throw new Error("unmountFrontComponentFunction is not set");return e()},pe=e=>{const t=i.frontComponentHostCommunicationApi.updateProgress;if(!i.o(t))throw new Error("updateProgressFunction is not set");return t(e)},he="__twentySdkExecutionContext__",v="__twentySdkContextListeners__",A=()=>(globalThis[v]||(globalThis[v]=new Set),globalThis[v]),I=()=>globalThis[he],ve=e=>{A().add(e)},Ee=e=>{A().delete(e)},p=e=>{const[t,n]=u.useState(()=>e(I())),s=u.useRef(t);return u.useEffect(()=>{const o=()=>{const r=e(I());r!==s.current&&(s.current=r,n(r))};return ve(o),o(),()=>Ee(o)},[e]),t},Ie=e=>e.frontComponentId,m=()=>p(Ie),Se=e=>e.recordId,Ce=()=>p(Se),Pe=e=>e.userId,Oe=()=>p(Pe),Ae=e=>`${e}-command-error`,Te=({execute:e})=>{const[t,n]=u.useState(!1),s=m();return u.useEffect(()=>{if(t)return;n(!0),(async()=>{await e(),await f()})()},[e,t,s]),null},Re=({to:e,params:t,queryParams:n,options:s})=>{const[o,r]=u.useState(!1),l=m();return u.useEffect(()=>{if(o)return;r(!0),(async()=>{await C(e,t,n,s),await f()})()},[e,t,n,s,o,l]),null},be=({page:e,pageTitle:t,pageIcon:n,onClick:s,shouldResetSearchState:o=!1})=>{const[r,l]=u.useState(!1),c=m();return u.useEffect(()=>{if(r)return;l(!0),(async()=>{s?.(),await O({page:e,pageTitle:t,pageIcon:n,shouldResetSearchState:o}),await f()})()},[e,t,n,o,s,r,c]),null},Fe=({title:e,subtitle:t,execute:n,confirmButtonText:s,confirmButtonAccent:o})=>{const[r,l]=u.useState(!1),c=m();return u.useEffect(()=>{if(r)return;l(!0),(async()=>{await P({title:e,subtitle:t,confirmButtonText:s,confirmButtonAccent:o})==="confirm"&&await n(),await f()})()},[e,t,n,s,o,r,c]),null};exports.AggregateOperations=i.e;exports.AppPath=i.a;exports.FieldType=i.R;exports.NavigationMenuItemType=i.x;exports.OnDeleteAction=i.Z;exports.PageLayoutTabLayoutMode=i.K;exports.RelationType=i.z;exports.STANDARD_OBJECT=i.w;exports.STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS=i.w;exports.SidePanelPages=i.P;exports.ViewKey=i._E;exports.Command=Te;exports.CommandLink=Re;exports.CommandModal=Fe;exports.CommandOpenSidePanelPage=be;exports.ObjectRecordGroupByDateGranularity=d;exports.PermissionFlag=S;exports.closeSidePanel=fe;exports.createValidationResult=a;exports.defineAgent=V;exports.defineApplication=R;exports.defineField=F;exports.defineFrontComponent=b;exports.defineLogicFunction=g;exports.defineNavigationMenuItem=w;exports.defineObject=M;exports.definePageLayout=U;exports.definePostInstallLogicFunction=y;exports.definePreInstallLogicFunction=N;exports.defineRole=D;exports.defineSkill=j;exports.defineView=H;exports.enqueueSnackbar=me;exports.every=te;exports.everyDefined=ne;exports.everyEquals=ie;exports.favoriteRecordIds=x;exports.featureFlags=$;exports.getFrontComponentCommandErrorDedupeKey=Ae;exports.getPublicAssetUrl=L;exports.hasAnySoftDeleteFilterOnView=k;exports.includes=ee;exports.includesEvery=ce;exports.isDefined=z;exports.isInSidePanel=K;exports.isNonEmptyString=Z;exports.isSelectAll=Y;exports.navigate=C;exports.none=ae;exports.noneDefined=ue;exports.noneEquals=le;exports.numberOfSelectedRecords=G;exports.objectMetadataItem=X;exports.objectPermissions=q;exports.openCommandConfirmationModal=P;exports.openSidePanelPage=O;exports.pageType=W;exports.selectedRecords=B;exports.some=se;exports.someDefined=oe;exports.someEquals=re;exports.someNonEmptyString=de;exports.targetObjectReadPermissions=Q;exports.targetObjectWritePermissions=J;exports.unmountFrontComponent=f;exports.updateProgress=pe;exports.useFrontComponentExecutionContext=p;exports.useFrontComponentId=m;exports.useRecordId=Ce;exports.useUserId=Oe;exports.validateFields=E;
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { R as S, t as C, A as R, o, f as l } from "./frontComponentHostCommunicationApi-op3Q7sYg.mjs";
2
- import { s as xe, a as Ke, x as Ye, Z as He, K as ke, z as Ge, y as $e, y as Be, P as Qe, _ as qe } from "./frontComponentHostCommunicationApi-op3Q7sYg.mjs";
1
+ import { R as S, t as C, A as R, o, f as l } from "./frontComponentHostCommunicationApi-Bz03t3FY.mjs";
2
+ import { e as xe, a as Ke, x as Ye, Z as He, K as ke, z as Ge, w as $e, w as Be, P as Qe, _ as qe } from "./frontComponentHostCommunicationApi-Bz03t3FY.mjs";
3
3
  import { isNonEmptyString as v } from "@sniptt/guards";
4
4
  import { useState as f, useRef as _, useEffect as p } from "react";
5
5
  var c = /* @__PURE__ */ ((e) => (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))(c || {});
@@ -151,7 +151,7 @@ const Z = (e) => {
151
151
  if (!o(t))
152
152
  throw new Error("openCommandConfirmationModalFunction is not set");
153
153
  return t(e);
154
- }, y = (e) => {
154
+ }, w = (e) => {
155
155
  const t = l.openSidePanelPage;
156
156
  if (!o(t))
157
157
  throw new Error("openSidePanelPageFunction is not set");
@@ -166,7 +166,7 @@ const Z = (e) => {
166
166
  if (!o(t))
167
167
  throw new Error("updateProgressFunction is not set");
168
168
  return t(e);
169
- }, w = "__twentySdkExecutionContext__", I = "__twentySdkContextListeners__", P = () => (globalThis[I] || (globalThis[I] = /* @__PURE__ */ new Set()), globalThis[I]), O = () => globalThis[w], M = (e) => {
169
+ }, y = "__twentySdkExecutionContext__", I = "__twentySdkContextListeners__", P = () => (globalThis[I] || (globalThis[I] = /* @__PURE__ */ new Set()), globalThis[I]), O = () => globalThis[y], M = (e) => {
170
170
  P().add(e);
171
171
  }, U = (e) => {
172
172
  P().delete(e);
@@ -181,7 +181,7 @@ const Z = (e) => {
181
181
  };
182
182
  return M(i), i(), () => U(i);
183
183
  }, [e]), t;
184
- }, g = (e) => e.frontComponentId, h = () => E(g), D = (e) => e.recordId, ye = () => E(D), V = (e) => e.userId, we = () => E(V), Me = (e) => `${e}-command-error`, Ue = ({ execute: e }) => {
184
+ }, g = (e) => e.frontComponentId, h = () => E(g), D = (e) => e.recordId, we = () => E(D), V = (e) => e.userId, ye = () => E(V), Me = (e) => `${e}-command-error`, Ue = ({ execute: e }) => {
185
185
  const [t, n] = f(!1), s = h();
186
186
  return p(() => {
187
187
  if (t)
@@ -216,7 +216,7 @@ const Z = (e) => {
216
216
  if (r)
217
217
  return;
218
218
  u(!0), (async () => {
219
- s?.(), await y({
219
+ s?.(), await w({
220
220
  page: e,
221
221
  pageTitle: t,
222
222
  pageIcon: n,
@@ -319,7 +319,7 @@ export {
319
319
  pe as objectMetadataItem,
320
320
  ue as objectPermissions,
321
321
  N as openCommandConfirmationModal,
322
- y as openSidePanelPage,
322
+ w as openSidePanelPage,
323
323
  ne as pageType,
324
324
  le as selectedRecords,
325
325
  Oe as some,
@@ -332,7 +332,7 @@ export {
332
332
  Ne as updateProgress,
333
333
  E as useFrontComponentExecutionContext,
334
334
  h as useFrontComponentId,
335
- ye as useRecordId,
336
- we as useUserId,
335
+ we as useRecordId,
336
+ ye as useUserId,
337
337
  T as validateFields
338
338
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./uninstall-BCUbP_Bn.js"),a=async t=>(t?.remote&&e.ConfigService.setActiveRemote(t.remote),await new e.ConfigService().clearConfig(),{success:!0,data:void 0}),i=t=>e.runSafe(()=>a(t),e.AUTH_ERROR_CODES.AUTH_FAILED);exports.APP_ERROR_CODES=e.APP_ERROR_CODES;exports.AUTH_ERROR_CODES=e.AUTH_ERROR_CODES;exports.ConfigService=e.ConfigService;exports.FUNCTION_ERROR_CODES=e.FUNCTION_ERROR_CODES;exports.SERVER_ERROR_CODES=e.SERVER_ERROR_CODES;exports.appBuild=e.appBuild;exports.appDeploy=e.appDeploy;exports.appInstall=e.appInstall;exports.appPublish=e.appPublish;exports.appUninstall=e.appUninstall;exports.authLogin=e.authLogin;exports.authLoginOAuth=e.authLoginOAuth;exports.detectLocalServer=e.detectLocalServer;exports.functionExecute=e.functionExecute;exports.serverStart=e.serverStart;exports.authLogout=i;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./uninstall-CXlUxs8p.js"),a=async t=>(t?.remote&&e.ConfigService.setActiveRemote(t.remote),await new e.ConfigService().clearConfig(),{success:!0,data:void 0}),n=t=>e.runSafe(()=>a(t),e.AUTH_ERROR_CODES.AUTH_FAILED);exports.APP_ERROR_CODES=e.APP_ERROR_CODES;exports.AUTH_ERROR_CODES=e.AUTH_ERROR_CODES;exports.ConfigService=e.ConfigService;exports.FUNCTION_ERROR_CODES=e.FUNCTION_ERROR_CODES;exports.SERVER_ERROR_CODES=e.SERVER_ERROR_CODES;exports.appBuild=e.appBuild;exports.appDeploy=e.appDeploy;exports.appDevOnce=e.appDevOnce;exports.appInstall=e.appInstall;exports.appPublish=e.appPublish;exports.appUninstall=e.appUninstall;exports.authLogin=e.authLogin;exports.authLoginOAuth=e.authLoginOAuth;exports.detectLocalServer=e.detectLocalServer;exports.functionExecute=e.functionExecute;exports.serverStart=e.serverStart;exports.authLogout=n;
@@ -1,21 +1,22 @@
1
- import { r as t, A as s, C as e } from "./uninstall-9yB-e13_.mjs";
2
- import { a as R, F as p, S as E, b as S, c as f, d as O, e as g, f as l, g as _, h as A, i as C, j as h, s as v } from "./uninstall-9yB-e13_.mjs";
3
- const o = async (a) => (a?.remote && e.setActiveRemote(a.remote), await new e().clearConfig(), { success: !0, data: void 0 }), n = (a) => t(() => o(a), s.AUTH_FAILED);
1
+ import { r as s, A as t, C as e } from "./uninstall-CrGYRb-Z.mjs";
2
+ import { a as u, F as R, S as E, b as S, c as O, d as f, e as g, f as l, g as _, h as v, i as A, j as C, k as h, s as D } from "./uninstall-CrGYRb-Z.mjs";
3
+ const o = async (a) => (a?.remote && e.setActiveRemote(a.remote), await new e().clearConfig(), { success: !0, data: void 0 }), c = (a) => s(() => o(a), t.AUTH_FAILED);
4
4
  export {
5
- R as APP_ERROR_CODES,
6
- s as AUTH_ERROR_CODES,
5
+ u as APP_ERROR_CODES,
6
+ t as AUTH_ERROR_CODES,
7
7
  e as ConfigService,
8
- p as FUNCTION_ERROR_CODES,
8
+ R as FUNCTION_ERROR_CODES,
9
9
  E as SERVER_ERROR_CODES,
10
10
  S as appBuild,
11
- f as appDeploy,
12
- O as appInstall,
13
- g as appPublish,
14
- l as appUninstall,
15
- _ as authLogin,
11
+ O as appDeploy,
12
+ f as appDevOnce,
13
+ g as appInstall,
14
+ l as appPublish,
15
+ _ as appUninstall,
16
+ v as authLogin,
16
17
  A as authLoginOAuth,
17
- n as authLogout,
18
+ c as authLogout,
18
19
  C as detectLocalServer,
19
20
  h as functionExecute,
20
- v as serverStart
21
+ D as serverStart
21
22
  };
@@ -1,2 +1,2 @@
1
1
  import { type ApplicationManifest } from 'twenty-shared/application';
2
- export type ApplicationConfig = Omit<ApplicationManifest, 'packageJsonChecksum' | 'yarnLockChecksum' | 'postInstallLogicFunctionUniversalIdentifier' | 'preInstallLogicFunctionUniversalIdentifier'>;
2
+ export type ApplicationConfig = Omit<ApplicationManifest, 'packageJsonChecksum' | 'yarnLockChecksum' | 'postInstallLogicFunction' | 'preInstallLogicFunction'>;
@@ -4,11 +4,14 @@ import { type LogicFunctionConfig } from '../../../sdk/logic-functions/logic-fun
4
4
  import { type ObjectConfig } from '../../../sdk/objects/object-config';
5
5
  import { type PageLayoutConfig } from '../../../sdk/page-layouts/page-layout-config';
6
6
  import { type ViewConfig } from '../../../sdk/views/view-config';
7
- import { type FieldManifest, type NavigationMenuItemManifest, type RoleManifest, type SkillManifest } from 'twenty-shared/application';
7
+ import { type PostInstallLogicFunctionConfig } from '../../../sdk/logic-functions/post-install-logic-function-config';
8
+ import { type PreInstallLogicFunctionConfig } from '../../../sdk/logic-functions/pre-install-logic-function-config';
9
+ import { type RoleConfig } from '../../../sdk/roles/role-config';
10
+ import { type AgentManifest, type FieldManifest, type NavigationMenuItemManifest, type SkillManifest } from 'twenty-shared/application';
8
11
  export type ValidationResult<T> = {
9
12
  success: boolean;
10
13
  config: T;
11
14
  errors: string[];
12
15
  };
13
- export type DefinableEntity = ApplicationConfig | ObjectConfig | FieldManifest | FrontComponentConfig | LogicFunctionConfig | RoleManifest | SkillManifest | ViewConfig | NavigationMenuItemManifest | PageLayoutConfig;
16
+ export type DefinableEntity = ApplicationConfig | ObjectConfig | FieldManifest | FrontComponentConfig | LogicFunctionConfig | PostInstallLogicFunctionConfig | PreInstallLogicFunctionConfig | AgentManifest | RoleConfig | SkillManifest | ViewConfig | NavigationMenuItemManifest | PageLayoutConfig;
14
17
  export type DefineEntity<T extends DefinableEntity = DefinableEntity> = (config: T) => ValidationResult<T>;
@@ -17,7 +17,7 @@ export { getPublicAssetUrl } from './get-public-asset-url';
17
17
  export { defineLogicFunction } from './logic-functions/define-logic-function';
18
18
  export { definePostInstallLogicFunction } from './logic-functions/define-post-install-logic-function';
19
19
  export { definePreInstallLogicFunction } from './logic-functions/define-pre-install-logic-function';
20
- export type { InstallLogicFunctionHandler, InstallLogicFunctionPayload, } from './logic-functions/install-logic-function-payload-type';
20
+ export type { InstallHandler, InstallPayload, } from '../sdk/logic-functions/install-payload-type';
21
21
  export type { LogicFunctionConfig, LogicFunctionHandler, } from './logic-functions/logic-function-config';
22
22
  export type { CronPayload } from './logic-functions/triggers/cron-payload-type';
23
23
  export type { DatabaseEventPayload, ObjectRecordBaseEvent, ObjectRecordCreateEvent, ObjectRecordDeleteEvent, ObjectRecordDestroyEvent, ObjectRecordEvent, ObjectRecordRestoreEvent, ObjectRecordUpdateEvent, ObjectRecordUpsertEvent, } from './logic-functions/triggers/database-event-payload-type';
@@ -1,6 +1,3 @@
1
- import { type LogicFunctionConfig } from '../../sdk/logic-functions/logic-function-config';
2
- import { type InstallLogicFunctionHandler } from '../../sdk/logic-functions/install-logic-function-payload-type';
3
1
  import type { DefineEntity } from '../../sdk/common/types/define-entity.type';
4
- export declare const definePostInstallLogicFunction: DefineEntity<Omit<LogicFunctionConfig, 'cronTriggerSettings' | 'databaseEventTriggerSettings' | 'httpRouteTriggerSettings' | 'isTool' | 'handler'> & {
5
- handler: InstallLogicFunctionHandler;
6
- }>;
2
+ import { type PostInstallLogicFunctionConfig } from '../../sdk/logic-functions/post-install-logic-function-config';
3
+ export declare const definePostInstallLogicFunction: DefineEntity<PostInstallLogicFunctionConfig>;
@@ -1 +1 @@
1
- {"version":3,"file":"define-post-install-logic-function.js","sources":["../../../src/sdk/logic-functions/define-post-install-logic-function.ts"],"sourcesContent":["import { type LogicFunctionConfig } from '@/sdk/logic-functions/logic-function-config';\nimport { type InstallLogicFunctionHandler } from '@/sdk/logic-functions/install-logic-function-payload-type';\nimport { createValidationResult } from '@/sdk/common/utils/create-validation-result';\nimport type { DefineEntity } from '@/sdk/common/types/define-entity.type';\n\nexport const definePostInstallLogicFunction: DefineEntity<\n Omit<\n LogicFunctionConfig,\n | 'cronTriggerSettings'\n | 'databaseEventTriggerSettings'\n | 'httpRouteTriggerSettings'\n | 'isTool'\n | 'handler'\n > & {\n handler: InstallLogicFunctionHandler;\n }\n> = (config) => {\n const errors = [];\n\n if (!config.universalIdentifier) {\n errors.push('Post install logic function must have a universalIdentifier');\n }\n\n if (!config.handler) {\n errors.push('Post install logic function must have a handler');\n }\n\n if (typeof config.handler !== 'function') {\n errors.push('Post install logic function handler must be a function');\n }\n\n return createValidationResult({\n config,\n errors,\n });\n};\n"],"names":["definePostInstallLogicFunction","config","errors","createValidationResult"],"mappings":";AAKO,MAAMA,IAWT,CAACC,MAAW;AACd,QAAMC,IAAS,CAAA;AAEf,SAAKD,EAAO,uBACVC,EAAO,KAAK,6DAA6D,GAGtED,EAAO,WACVC,EAAO,KAAK,iDAAiD,GAG3D,OAAOD,EAAO,WAAY,cAC5BC,EAAO,KAAK,wDAAwD,GAG/DC,EAAuB;AAAA,IAC5B,QAAAF;AAAA,IACA,QAAAC;AAAA,EAAA,CACD;AACH;"}
1
+ {"version":3,"file":"define-post-install-logic-function.js","sources":["../../../src/sdk/logic-functions/define-post-install-logic-function.ts"],"sourcesContent":["import { createValidationResult } from '@/sdk/common/utils/create-validation-result';\nimport type { DefineEntity } from '@/sdk/common/types/define-entity.type';\nimport { type PostInstallLogicFunctionConfig } from '@/sdk/logic-functions/post-install-logic-function-config';\n\nexport const definePostInstallLogicFunction: DefineEntity<\n PostInstallLogicFunctionConfig\n> = (config) => {\n const errors = [];\n\n if (!config.universalIdentifier) {\n errors.push('Post install logic function must have a universalIdentifier');\n }\n\n if (!config.handler) {\n errors.push('Post install logic function must have a handler');\n }\n\n if (typeof config.handler !== 'function') {\n errors.push('Post install logic function handler must be a function');\n }\n\n return createValidationResult({\n config,\n errors,\n });\n};\n"],"names":["definePostInstallLogicFunction","config","errors","createValidationResult"],"mappings":";AAIO,MAAMA,IAET,CAACC,MAAW;AACd,QAAMC,IAAS,CAAA;AAEf,SAAKD,EAAO,uBACVC,EAAO,KAAK,6DAA6D,GAGtED,EAAO,WACVC,EAAO,KAAK,iDAAiD,GAG3D,OAAOD,EAAO,WAAY,cAC5BC,EAAO,KAAK,wDAAwD,GAG/DC,EAAuB;AAAA,IAC5B,QAAAF;AAAA,IACA,QAAAC;AAAA,EAAA,CACD;AACH;"}
@@ -1,6 +1,3 @@
1
- import { type LogicFunctionConfig } from '../../sdk/logic-functions/logic-function-config';
2
- import { type InstallLogicFunctionHandler } from '../../sdk/logic-functions/install-logic-function-payload-type';
3
1
  import type { DefineEntity } from '../../sdk/common/types/define-entity.type';
4
- export declare const definePreInstallLogicFunction: DefineEntity<Omit<LogicFunctionConfig, 'cronTriggerSettings' | 'databaseEventTriggerSettings' | 'httpRouteTriggerSettings' | 'isTool' | 'handler'> & {
5
- handler: InstallLogicFunctionHandler;
6
- }>;
2
+ import { type PreInstallLogicFunctionConfig } from '../../sdk/logic-functions/pre-install-logic-function-config';
3
+ export declare const definePreInstallLogicFunction: DefineEntity<PreInstallLogicFunctionConfig>;
@@ -1 +1 @@
1
- {"version":3,"file":"define-pre-install-logic-function.js","sources":["../../../src/sdk/logic-functions/define-pre-install-logic-function.ts"],"sourcesContent":["import { type LogicFunctionConfig } from '@/sdk/logic-functions/logic-function-config';\nimport { type InstallLogicFunctionHandler } from '@/sdk/logic-functions/install-logic-function-payload-type';\nimport { createValidationResult } from '@/sdk/common/utils/create-validation-result';\nimport type { DefineEntity } from '@/sdk/common/types/define-entity.type';\n\nexport const definePreInstallLogicFunction: DefineEntity<\n Omit<\n LogicFunctionConfig,\n | 'cronTriggerSettings'\n | 'databaseEventTriggerSettings'\n | 'httpRouteTriggerSettings'\n | 'isTool'\n | 'handler'\n > & {\n handler: InstallLogicFunctionHandler;\n }\n> = (config) => {\n const errors = [];\n\n if (!config.universalIdentifier) {\n errors.push('Pre install logic function must have a universalIdentifier');\n }\n\n if (!config.handler) {\n errors.push('Pre install logic function must have a handler');\n }\n\n if (typeof config.handler !== 'function') {\n errors.push('Pre install logic function handler must be a function');\n }\n\n return createValidationResult({\n config,\n errors,\n });\n};\n"],"names":["definePreInstallLogicFunction","config","errors","createValidationResult"],"mappings":";AAKO,MAAMA,IAWT,CAACC,MAAW;AACd,QAAMC,IAAS,CAAA;AAEf,SAAKD,EAAO,uBACVC,EAAO,KAAK,4DAA4D,GAGrED,EAAO,WACVC,EAAO,KAAK,gDAAgD,GAG1D,OAAOD,EAAO,WAAY,cAC5BC,EAAO,KAAK,uDAAuD,GAG9DC,EAAuB;AAAA,IAC5B,QAAAF;AAAA,IACA,QAAAC;AAAA,EAAA,CACD;AACH;"}
1
+ {"version":3,"file":"define-pre-install-logic-function.js","sources":["../../../src/sdk/logic-functions/define-pre-install-logic-function.ts"],"sourcesContent":["import { createValidationResult } from '@/sdk/common/utils/create-validation-result';\nimport type { DefineEntity } from '@/sdk/common/types/define-entity.type';\nimport { type PreInstallLogicFunctionConfig } from '@/sdk/logic-functions/pre-install-logic-function-config';\n\nexport const definePreInstallLogicFunction: DefineEntity<\n PreInstallLogicFunctionConfig\n> = (config) => {\n const errors = [];\n\n if (!config.universalIdentifier) {\n errors.push('Pre install logic function must have a universalIdentifier');\n }\n\n if (!config.handler) {\n errors.push('Pre install logic function must have a handler');\n }\n\n if (typeof config.handler !== 'function') {\n errors.push('Pre install logic function handler must be a function');\n }\n\n return createValidationResult({\n config,\n errors,\n });\n};\n"],"names":["definePreInstallLogicFunction","config","errors","createValidationResult"],"mappings":";AAIO,MAAMA,IAET,CAACC,MAAW;AACd,QAAMC,IAAS,CAAA;AAEf,SAAKD,EAAO,uBACVC,EAAO,KAAK,4DAA4D,GAGrED,EAAO,WACVC,EAAO,KAAK,gDAAgD,GAG1D,OAAOD,EAAO,WAAY,cAC5BC,EAAO,KAAK,uDAAuD,GAG9DC,EAAuB;AAAA,IAC5B,QAAAF;AAAA,IACA,QAAAC;AAAA,EAAA,CACD;AACH;"}
@@ -0,0 +1,5 @@
1
+ export type InstallPayload = {
2
+ previousVersion?: string;
3
+ newVersion: string;
4
+ };
5
+ export type InstallHandler = (payload: InstallPayload) => any | Promise<any>;
@@ -0,0 +1,4 @@
1
+ import { type PreInstallLogicFunctionConfig } from '../../sdk/logic-functions/pre-install-logic-function-config';
2
+ export type PostInstallLogicFunctionConfig = PreInstallLogicFunctionConfig & {
3
+ shouldRunSynchronously?: boolean;
4
+ };
@@ -0,0 +1,5 @@
1
+ import type { InstallHandler, LogicFunctionConfig } from '../../sdk';
2
+ export type PreInstallLogicFunctionConfig = Omit<LogicFunctionConfig, 'cronTriggerSettings' | 'databaseEventTriggerSettings' | 'httpRouteTriggerSettings' | 'isTool' | 'handler'> & {
3
+ handler: InstallHandler;
4
+ shouldRunOnVersionUpgrade?: boolean;
5
+ };
@@ -1,3 +1,3 @@
1
- import { type RoleManifest } from 'twenty-shared/application';
2
1
  import { type DefineEntity } from '../../sdk/common/types/define-entity.type';
3
- export declare const defineRole: DefineEntity<RoleManifest>;
2
+ import { type RoleConfig } from '../../sdk/roles/role-config';
3
+ export declare const defineRole: DefineEntity<RoleConfig>;
@@ -1 +1 @@
1
- {"version":3,"file":"define-role.js","sources":["../../../src/sdk/roles/define-role.ts"],"sourcesContent":["import { createValidationResult } from '@/sdk/common/utils/create-validation-result';\nimport { type RoleManifest } from 'twenty-shared/application';\nimport { type DefineEntity } from '@/sdk/common/types/define-entity.type';\n\nexport const defineRole: DefineEntity<RoleManifest> = (config) => {\n const errors = [];\n\n if (!config.universalIdentifier) {\n errors.push('Role must have a universalIdentifier');\n }\n\n if (!config.label) {\n errors.push('Role must have a label');\n }\n\n if (config.objectPermissions) {\n for (const permission of config.objectPermissions) {\n if (!permission.objectUniversalIdentifier) {\n errors.push('Object permission must have an objectUniversalIdentifier');\n }\n }\n }\n\n if (config.fieldPermissions) {\n for (const permission of config.fieldPermissions) {\n if (!permission.objectUniversalIdentifier) {\n errors.push('Field permission must have an objectUniversalIdentifier');\n }\n\n if (!permission.fieldUniversalIdentifier) {\n errors.push('Field permission must have a fieldUniversalIdentifier');\n }\n }\n }\n\n return createValidationResult({ config, errors });\n};\n"],"names":["defineRole","config","errors","permission","createValidationResult"],"mappings":";AAIO,MAAMA,IAAyC,CAACC,MAAW;AAChE,QAAMC,IAAS,CAAA;AAUf,MARKD,EAAO,uBACVC,EAAO,KAAK,sCAAsC,GAG/CD,EAAO,SACVC,EAAO,KAAK,wBAAwB,GAGlCD,EAAO;AACT,eAAWE,KAAcF,EAAO;AAC9B,MAAKE,EAAW,6BACdD,EAAO,KAAK,0DAA0D;AAK5E,MAAID,EAAO;AACT,eAAWE,KAAcF,EAAO;AAC9B,MAAKE,EAAW,6BACdD,EAAO,KAAK,yDAAyD,GAGlEC,EAAW,4BACdD,EAAO,KAAK,uDAAuD;AAKzE,SAAOE,EAAuB,EAAE,QAAAH,GAAQ,QAAAC,GAAQ;AAClD;"}
1
+ {"version":3,"file":"define-role.js","sources":["../../../src/sdk/roles/define-role.ts"],"sourcesContent":["import { createValidationResult } from '@/sdk/common/utils/create-validation-result';\nimport { type DefineEntity } from '@/sdk/common/types/define-entity.type';\nimport { type RoleConfig } from '@/sdk/roles/role-config';\n\nexport const defineRole: DefineEntity<RoleConfig> = (config) => {\n const errors = [];\n\n if (!config.universalIdentifier) {\n errors.push('Role must have a universalIdentifier');\n }\n\n if (!config.label) {\n errors.push('Role must have a label');\n }\n\n if (config.objectPermissions) {\n for (const permission of config.objectPermissions) {\n if (!permission.objectUniversalIdentifier) {\n errors.push('Object permission must have an objectUniversalIdentifier');\n }\n }\n }\n\n if (config.fieldPermissions) {\n for (const permission of config.fieldPermissions) {\n if (!permission.objectUniversalIdentifier) {\n errors.push('Field permission must have an objectUniversalIdentifier');\n }\n\n if (!permission.fieldUniversalIdentifier) {\n errors.push('Field permission must have a fieldUniversalIdentifier');\n }\n }\n }\n\n return createValidationResult({ config, errors });\n};\n"],"names":["defineRole","config","errors","permission","createValidationResult"],"mappings":";AAIO,MAAMA,IAAuC,CAACC,MAAW;AAC9D,QAAMC,IAAS,CAAA;AAUf,MARKD,EAAO,uBACVC,EAAO,KAAK,sCAAsC,GAG/CD,EAAO,SACVC,EAAO,KAAK,wBAAwB,GAGlCD,EAAO;AACT,eAAWE,KAAcF,EAAO;AAC9B,MAAKE,EAAW,6BACdD,EAAO,KAAK,0DAA0D;AAK5E,MAAID,EAAO;AACT,eAAWE,KAAcF,EAAO;AAC9B,MAAKE,EAAW,6BACdD,EAAO,KAAK,yDAAyD,GAGlEC,EAAW,4BACdD,EAAO,KAAK,uDAAuD;AAKzE,SAAOE,EAAuB,EAAE,QAAAH,GAAQ,QAAAC,GAAQ;AAClD;"}
@@ -0,0 +1,7 @@
1
+ import type { FieldPermissionManifest, ObjectPermissionManifest, RoleManifest } from 'twenty-shared/application';
2
+ import { type PermissionFlagType } from 'twenty-shared/constants';
3
+ export type RoleConfig = Omit<RoleManifest, 'objectPermissions' | 'fieldPermissions' | 'permissionFlags'> & {
4
+ objectPermissions?: Omit<ObjectPermissionManifest, 'universalIdentifier'>[];
5
+ fieldPermissions?: Omit<FieldPermissionManifest, 'universalIdentifier'>[];
6
+ permissionFlags?: PermissionFlagType[];
7
+ };