twenty-sdk 2.23.0-alpha.2 → 2.25.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 (32) hide show
  1. package/dist/billing/index.cjs.map +1 -1
  2. package/dist/billing/index.mjs.map +1 -1
  3. package/dist/{catalog-sync-vCny1eqz.js → catalog-sync-BQ4qqj5b.js} +1 -1
  4. package/dist/{catalog-sync-Duh0toYz.mjs → catalog-sync-Bd0XMuNL.mjs} +1 -1
  5. package/dist/cli/commands/dev/exec.d.ts +2 -1
  6. package/dist/cli/operations/execute.d.ts +2 -0
  7. package/dist/cli/utilities/build/manifest/manifest-extract-config.d.ts +2 -0
  8. package/dist/cli.cjs +116 -116
  9. package/dist/cli.mjs +5216 -5201
  10. package/dist/define/index.cjs +3 -3
  11. package/dist/define/index.cjs.map +1 -1
  12. package/dist/define/index.d.ts +103 -14
  13. package/dist/define/index.mjs +2751 -2714
  14. package/dist/define/index.mjs.map +1 -1
  15. package/dist/front-component/index.cjs +1 -1
  16. package/dist/front-component/index.cjs.map +1 -1
  17. package/dist/front-component/index.d.ts +2 -1
  18. package/dist/front-component/index.mjs +3 -3
  19. package/dist/front-component/index.mjs.map +1 -1
  20. package/dist/{get-function-input-schema-GNk3NRLJ-CINgHnhw.mjs → get-function-input-schema-GNk3NRLJ-DmwN8d1n.mjs} +1 -1
  21. package/dist/logic-function/index.cjs +21 -1
  22. package/dist/logic-function/index.cjs.map +1 -1
  23. package/dist/logic-function/index.d.ts +28 -4
  24. package/dist/logic-function/index.mjs +36 -2
  25. package/dist/logic-function/index.mjs.map +1 -1
  26. package/dist/{login-DRLsbxdb.js → login-C1meSrEJ.js} +53 -53
  27. package/dist/{login-C1WTDmkF.mjs → login-CjlKXuH6.mjs} +3932 -3888
  28. package/dist/operations.cjs +1 -1
  29. package/dist/operations.mjs +1 -1
  30. package/dist/utils/index.cjs.map +1 -1
  31. package/dist/utils/index.mjs.map +1 -1
  32. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["e","t","e","i","n","t"],"sources":["../../../twenty-shared/dist/ViewKey-YV4NySfb.mjs","../../../twenty-shared/dist/get-system-relation-field-universal-identifier.util-DGoOUfu_.mjs","../../../twenty-shared/dist/application.mjs","../../src/sdk/billing/charge-credits.ts"],"sourcesContent":["//#region src/types/FieldMetadataType.ts\nvar e = /* @__PURE__ */ function(e) {\n\treturn e.ACTOR = \"ACTOR\", e.ADDRESS = \"ADDRESS\", e.ARRAY = \"ARRAY\", e.BOOLEAN = \"BOOLEAN\", e.CURRENCY = \"CURRENCY\", e.DATE = \"DATE\", e.DATE_TIME = \"DATE_TIME\", e.EMAILS = \"EMAILS\", e.FILES = \"FILES\", e.FULL_NAME = \"FULL_NAME\", e.LINKS = \"LINKS\", e.MORPH_RELATION = \"MORPH_RELATION\", e.MULTI_SELECT = \"MULTI_SELECT\", e.NUMBER = \"NUMBER\", e.NUMERIC = \"NUMERIC\", e.PHONES = \"PHONES\", e.POSITION = \"POSITION\", e.RATING = \"RATING\", e.RAW_JSON = \"RAW_JSON\", e.RELATION = \"RELATION\", e.RICH_TEXT = \"RICH_TEXT\", e.SELECT = \"SELECT\", e.TEXT = \"TEXT\", e.TS_VECTOR = \"TS_VECTOR\", e.UUID = \"UUID\", e;\n}({}), t = /* @__PURE__ */ function(e) {\n\treturn e.INDEX = \"INDEX\", e;\n}({});\n//#endregion\nexport { e as n, t };\n","import { v5 as e } from \"uuid\";\n//#region src/application/constants/TwentyStandardApplicationUniversalIdentifier.ts\nvar t = \"20202020-64aa-4b6f-b003-9c74b97cee20\", n = ({ entityNamespace: t, value: n, applicationUniversalIdentifier: r }) => e(`${t}:${n}`, r), r = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"fieldMetadata\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), i = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, relationTargetObjectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"fieldMetadata\",\n\tvalue: `${t}:systemRelation:${r}`,\n\tapplicationUniversalIdentifier: e\n});\n//#endregion\nexport { t as i, r as n, n as r, i as t };\n","import { n as e, t } from \"./ViewKey-YV4NySfb.mjs\";\nimport { i as n, n as r, r as i, t as a } from \"./get-system-relation-field-universal-identifier.util-DGoOUfu_.mjs\";\n//#region src/application/applicationCategoryType.ts\nvar o = [\n\t\"Communication\",\n\t\"Productivity\",\n\t\"Product management\",\n\t\"Sales\",\n\t\"Marketing\",\n\t\"Enrichment\",\n\t\"Data\",\n\t\"Search\",\n\t\"Other\"\n], s = (e) => o.includes(e), c = [\n\te.TEXT,\n\te.ARRAY,\n\te.BOOLEAN,\n\te.DATE,\n\te.DATE_TIME,\n\te.NUMBER,\n\te.NUMERIC,\n\te.RAW_JSON,\n\te.RICH_TEXT,\n\te.SELECT,\n\te.MULTI_SELECT\n], l = \"public\", u = \"TWENTY_API_KEY\", d = \"TWENTY_API_URL\", f = \"TWENTY_APP_ACCESS_TOKEN\", p = \"TWENTY_FUNCTIONS_URL\", m = \"generated\", h = { js: \"import { createRequire as __createRequire } from 'module';\\nconst require = __createRequire(import.meta.url);\" }, g = \".twenty/output\", _ = \"Standard\", v = ({ applicationUniversalIdentifier: e, name: t }) => i({\n\tentityNamespace: \"agent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), y = ({ applicationUniversalIdentifier: e, key: t }) => i({\n\tentityNamespace: \"applicationVariable\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), b = \"navigation\", x = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => i({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL:${t}`,\n\tapplicationUniversalIdentifier: e\n}), S = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => i({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL_OBJECT_CONTEXT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), C = ({ applicationUniversalIdentifier: e, engineComponentKey: t, objectUniversalIdentifier: n }) => i({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `RECORD_SELECTION:${t}:${n ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), w = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => i({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `${t}:${b}`,\n\tapplicationUniversalIdentifier: e\n}), T = ({ applicationUniversalIdentifier: e, name: t }) => i({\n\tentityNamespace: \"connectionProvider\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), E = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, fieldUniversalIdentifier: n }) => i({\n\tentityNamespace: \"fieldPermission\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), D = ({ applicationUniversalIdentifier: e, componentName: t }) => i({\n\tentityNamespace: \"frontComponent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), O = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: n }) => i({\n\tentityNamespace: \"index\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), k = ({ applicationUniversalIdentifier: e, name: t }) => i({\n\tentityNamespace: \"logicFunction\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), A = ({ applicationUniversalIdentifier: e, name: t }) => i({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `FOLDER:${t}`,\n\tapplicationUniversalIdentifier: e\n}), j = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => i({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `OBJECT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), ee = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t }) => i({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `VIEW:${t}`,\n\tapplicationUniversalIdentifier: e\n}), M = ({ applicationUniversalIdentifier: e, link: t }) => i({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `LINK:${t}`,\n\tapplicationUniversalIdentifier: e\n}), N = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, objectUniversalIdentifier: n }) => i({\n\tentityNamespace: \"objectPermission\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), P = ({ applicationUniversalIdentifier: e, nameSingular: t }) => i({\n\tentityNamespace: \"objectMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), F = ({ applicationUniversalIdentifier: e, pageLayoutUniversalIdentifier: t, title: n }) => i({\n\tentityNamespace: \"pageLayoutTab\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), I = \"RECORD_PAGE\", L = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: n }) => i({\n\tentityNamespace: \"pageLayout\",\n\tvalue: t ? `${t}:${n}` : n,\n\tapplicationUniversalIdentifier: e\n}), R = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => i({\n\tentityNamespace: \"pageLayout\",\n\tvalue: `${t}:${I}`,\n\tapplicationUniversalIdentifier: e\n}), z = ({ applicationUniversalIdentifier: e, pageLayoutTabUniversalIdentifier: t, title: n }) => i({\n\tentityNamespace: \"pageLayoutWidget\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), B = ({ applicationUniversalIdentifier: e, key: t }) => i({\n\tentityNamespace: \"permissionFlag\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), V = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, permissionFlagUniversalIdentifier: n }) => i({\n\tentityNamespace: \"rolePermissionFlag\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), H = ({ applicationUniversalIdentifier: e, label: t }) => i({\n\tentityNamespace: \"role\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), U = ({ applicationUniversalIdentifier: e, fieldMetadataUniversalIdentifier: t }) => i({\n\tentityNamespace: \"searchFieldMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), W = ({ applicationUniversalIdentifier: e, fieldUniversalIdentifier: t, value: n }) => i({\n\tentityNamespace: \"selectOption\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), G = ({ applicationUniversalIdentifier: e, name: t }) => i({\n\tentityNamespace: \"skill\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), K = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, name: n }) => i({\n\tentityNamespace: \"viewFieldGroup\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), q = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: n }) => i({\n\tentityNamespace: \"viewField\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), J = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: n, operand: r, subFieldName: a }) => i({\n\tentityNamespace: \"viewFilter\",\n\tvalue: `${t}:${n}:${r}:${a ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), Y = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldValue: n }) => i({\n\tentityNamespace: \"viewGroup\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), X = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: n }) => i({\n\tentityNamespace: \"viewSort\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), Z = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: n }) => i({\n\tentityNamespace: \"view\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), Q = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: n }) => i({\n\tentityNamespace: \"view\",\n\tvalue: `${n}:${t.INDEX}`,\n\tapplicationUniversalIdentifier: e\n}), $ = ({ applicationUniversalIdentifier: e, pageLayoutWidgetUniversalIdentifier: t }) => i({\n\tentityNamespace: \"view\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), te = /* @__PURE__ */ function(e) {\n\treturn e.Object = \"object\", e.Field = \"field\", e.LogicFunction = \"logicFunction\", e.FrontComponent = \"frontComponent\", e.Role = \"role\", e.Skill = \"skill\", e.Agent = \"agent\", e.ConnectionProvider = \"connectionProvider\", e.View = \"view\", e.ViewField = \"viewField\", e.NavigationMenuItem = \"navigationMenuItem\", e.PageLayout = \"pageLayout\", e.PageLayoutTab = \"pageLayoutTab\", e.CommandMenuItem = \"commandMenuItem\", e;\n}({}), ne = (t, n = e.TEXT) => {\n\tif (t == null) return \"\";\n\tswitch (n) {\n\t\tcase e.BOOLEAN: return String(t) === \"true\" ? \"true\" : \"false\";\n\t\tcase e.NUMBER:\n\t\tcase e.NUMERIC: return String(t);\n\t\tcase e.ARRAY:\n\t\tcase e.MULTI_SELECT:\n\t\t\tif (Array.isArray(t)) return JSON.stringify(t);\n\t\t\tif (typeof t == \"string\") {\n\t\t\t\ttry {\n\t\t\t\t\tlet e = JSON.parse(t);\n\t\t\t\t\tif (Array.isArray(e)) return t;\n\t\t\t\t} catch {}\n\t\t\t\treturn JSON.stringify([t]);\n\t\t\t}\n\t\t\treturn JSON.stringify(t);\n\t\tcase e.RAW_JSON:\n\t\tcase e.RICH_TEXT: return typeof t == \"string\" ? t : JSON.stringify(t);\n\t\tdefault: return typeof t == \"string\" ? t : String(t);\n\t}\n}, re = (t, n = e.TEXT) => {\n\tif (t === \"\") return n === e.ARRAY || n === e.MULTI_SELECT ? [] : \"\";\n\tswitch (n) {\n\t\tcase e.BOOLEAN: return t === \"true\";\n\t\tcase e.NUMBER:\n\t\tcase e.NUMERIC: {\n\t\t\tlet e = Number(t);\n\t\t\treturn Number.isNaN(e) ? t : e;\n\t\t}\n\t\tcase e.ARRAY:\n\t\tcase e.MULTI_SELECT: try {\n\t\t\tlet e = JSON.parse(t);\n\t\t\treturn Array.isArray(e) ? e : [];\n\t\t} catch {\n\t\t\treturn [];\n\t\t}\n\t\tcase e.RAW_JSON:\n\t\tcase e.RICH_TEXT: try {\n\t\t\treturn JSON.parse(t);\n\t\t} catch {\n\t\t\treturn t;\n\t\t}\n\t\tdefault: return t;\n\t}\n};\n//#endregion\nexport { o as APPLICATION_CATEGORIES, c as APPLICATION_VARIABLE_FIELD_METADATA_TYPES, l as ASSETS_DIR, u as DEFAULT_API_KEY_NAME, d as DEFAULT_API_URL_NAME, f as DEFAULT_APP_ACCESS_TOKEN_NAME, p as DEFAULT_FUNCTIONS_URL_NAME, m as GENERATED_DIR, h as NODE_ESM_CJS_BANNER, g as OUTPUT_DIR, te as SyncableEntity, _ as TWENTY_STANDARD_APPLICATION_NAME, n as TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER, i as computeDeterministicUuid, re as deserializeApplicationVariableValue, v as getAgentUniversalIdentifier, y as getApplicationVariableUniversalIdentifier, T as getConnectionProviderUniversalIdentifier, E as getFieldPermissionUniversalIdentifier, r as getFieldUniversalIdentifier, $ as getFieldsWidgetViewUniversalIdentifier, A as getFolderNavigationMenuItemUniversalIdentifier, D as getFrontComponentUniversalIdentifier, x as getGlobalCommandMenuItemUniversalIdentifier, S as getGlobalObjectContextCommandMenuItemUniversalIdentifier, O as getIndexUniversalIdentifier, Q as getIndexViewUniversalIdentifier, M as getLinkNavigationMenuItemUniversalIdentifier, k as getLogicFunctionUniversalIdentifier, w as getNavigationCommandUniversalIdentifier, j as getObjectNavigationMenuItemUniversalIdentifier, N as getObjectPermissionUniversalIdentifier, P as getObjectUniversalIdentifier, F as getPageLayoutTabUniversalIdentifier, L as getPageLayoutUniversalIdentifier, z as getPageLayoutWidgetUniversalIdentifier, B as getPermissionFlagUniversalIdentifier, R as getRecordPageLayoutUniversalIdentifier, C as getRecordSelectionCommandMenuItemUniversalIdentifier, V as getRolePermissionFlagUniversalIdentifier, H as getRoleUniversalIdentifier, U as getSearchFieldUniversalIdentifier, W as getSelectOptionUniversalIdentifier, G as getSkillUniversalIdentifier, a as getSystemRelationFieldUniversalIdentifier, K as getViewFieldGroupUniversalIdentifier, q as getViewFieldUniversalIdentifier, J as getViewFilterUniversalIdentifier, Y as getViewGroupUniversalIdentifier, ee as getViewNavigationMenuItemUniversalIdentifier, X as getViewSortUniversalIdentifier, Z as getViewUniversalIdentifier, s as isKnownApplicationCategory, ne as serializeApplicationVariableValue };\n","import {\n DEFAULT_API_URL_NAME,\n DEFAULT_APP_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application';\n\nconst BILLING_CHARGE_TIMEOUT_MS = 5_000;\n\nexport type ChargeCreditsParams = {\n creditsUsedMicro: number;\n operationType: string;\n quantity?: number;\n resourceContext?: string;\n};\n\n// Records credit usage against the running application via the Twenty\n// server's `/app/billing/charge` endpoint. Reads `TWENTY_API_URL` and\n// `TWENTY_APP_ACCESS_TOKEN` from the execution env (injected by the\n// logic-function runtime). No-ops silently when either is missing so\n// local/test runs don't crash. Failures are non-fatal — a billing error\n// never surfaces as a tool failure.\nexport const chargeCredits = async ({\n creditsUsedMicro,\n operationType,\n quantity = 1,\n resourceContext,\n}: ChargeCreditsParams): Promise<void> => {\n const apiUrl = process.env[DEFAULT_API_URL_NAME];\n const token = process.env[DEFAULT_APP_ACCESS_TOKEN_NAME];\n\n if (!apiUrl || !token) {\n return;\n }\n\n try {\n const response = await fetch(\n `${apiUrl.replace(/\\/$/, '')}/app/billing/charge`,\n {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${token}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n creditsUsedMicro,\n quantity,\n operationType,\n resourceContext,\n }),\n signal: AbortSignal.timeout(BILLING_CHARGE_TIMEOUT_MS),\n },\n );\n\n if (!response.ok) {\n const body = await response.text().catch(() => '');\n\n console.error(\n `chargeCredits: ${response.status} ${response.statusText}: ${body}`,\n );\n }\n } catch (error) {\n console.error(\n `chargeCredits: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n};\n"],"mappings":"mFACA,IAAIA,EAAoB,SAAS,EAAG,CACnC,MAAO,GAAE,MAAQ,QAAS,EAAE,QAAU,UAAW,EAAE,MAAQ,QAAS,EAAE,QAAU,UAAW,EAAE,SAAW,WAAY,EAAE,KAAO,OAAQ,EAAE,UAAY,YAAa,EAAE,OAAS,SAAU,EAAE,MAAQ,QAAS,EAAE,UAAY,YAAa,EAAE,MAAQ,QAAS,EAAE,eAAiB,iBAAkB,EAAE,aAAe,eAAgB,EAAE,OAAS,SAAU,EAAE,QAAU,UAAW,EAAE,OAAS,SAAU,EAAE,SAAW,WAAY,EAAE,OAAS,SAAU,EAAE,SAAW,WAAY,EAAE,SAAW,WAAY,EAAE,UAAY,YAAa,EAAE,OAAS,SAAU,EAAE,KAAO,OAAQ,EAAE,UAAY,YAAa,EAAE,KAAO,OAAQ,CAC3kB,EAAE,CAAC,CAAC,EEWHE,EAAE,KACFA,EAAE,MACFA,EAAE,QACFA,EAAE,KACFA,EAAE,UACFA,EAAE,OACFA,EAAE,QACFA,EAAE,SACFA,EAAE,UACFA,EAAE,OACFA,EAAE,aArBH,IAsBuC,EAAI,iBAAkB,EAAI,0BCpB3D,EAA4B,IAerB,EAAgB,MAAO,CAClC,mBACA,gBACA,WAAW,EACX,qBACwC,CACxC,IAAM,EAAS,QAAQ,IAAI,GACrB,EAAQ,QAAQ,IAAI,GAEtB,MAAC,GAAU,CAAC,GAIhB,GAAI,CACF,IAAM,EAAW,MAAM,MACrB,GAAG,EAAO,QAAQ,MAAO,EAAE,EAAE,qBAC7B,CACE,OAAQ,OACR,QAAS,CACP,cAAe,UAAU,IACzB,eAAgB,kBAClB,EACA,KAAM,KAAK,UAAU,CACnB,mBACA,WACA,gBACA,iBACF,CAAC,EACD,OAAQ,YAAY,QAAQ,CAAyB,CACvD,CACF,EAEA,GAAI,CAAC,EAAS,GAAI,CAChB,IAAM,EAAO,MAAM,EAAS,KAAK,EAAE,UAAY,EAAE,EAEjD,QAAQ,MACN,kBAAkB,EAAS,OAAO,GAAG,EAAS,WAAW,IAAI,GAC/D,CACF,CACF,OAAS,EAAO,CACd,QAAQ,MACN,kBAAkB,aAAiB,MAAQ,EAAM,QAAU,OAAO,CAAK,GACzE,CACF,CACF"}
1
+ {"version":3,"file":"index.cjs","names":["e","t","e","i","n","t"],"sources":["../../../twenty-shared/dist/ViewKey-YV4NySfb.mjs","../../../twenty-shared/dist/get-system-relation-field-universal-identifier.util-DGoOUfu_.mjs","../../../twenty-shared/dist/application.mjs","../../src/sdk/billing/charge-credits.ts"],"sourcesContent":["//#region src/types/FieldMetadataType.ts\nvar e = /* @__PURE__ */ function(e) {\n\treturn e.ACTOR = \"ACTOR\", e.ADDRESS = \"ADDRESS\", e.ARRAY = \"ARRAY\", e.BOOLEAN = \"BOOLEAN\", e.CURRENCY = \"CURRENCY\", e.DATE = \"DATE\", e.DATE_TIME = \"DATE_TIME\", e.EMAILS = \"EMAILS\", e.FILES = \"FILES\", e.FULL_NAME = \"FULL_NAME\", e.LINKS = \"LINKS\", e.MORPH_RELATION = \"MORPH_RELATION\", e.MULTI_SELECT = \"MULTI_SELECT\", e.NUMBER = \"NUMBER\", e.NUMERIC = \"NUMERIC\", e.PHONES = \"PHONES\", e.POSITION = \"POSITION\", e.RATING = \"RATING\", e.RAW_JSON = \"RAW_JSON\", e.RELATION = \"RELATION\", e.RICH_TEXT = \"RICH_TEXT\", e.SELECT = \"SELECT\", e.TEXT = \"TEXT\", e.TS_VECTOR = \"TS_VECTOR\", e.UUID = \"UUID\", e;\n}({}), t = /* @__PURE__ */ function(e) {\n\treturn e.INDEX = \"INDEX\", e;\n}({});\n//#endregion\nexport { e as n, t };\n","import { v5 as e } from \"uuid\";\n//#region src/application/constants/TwentyStandardApplicationUniversalIdentifier.ts\nvar t = \"20202020-64aa-4b6f-b003-9c74b97cee20\", n = ({ entityNamespace: t, value: n, applicationUniversalIdentifier: r }) => e(`${t}:${n}`, r), r = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"fieldMetadata\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), i = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, relationTargetObjectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"fieldMetadata\",\n\tvalue: `${t}:systemRelation:${r}`,\n\tapplicationUniversalIdentifier: e\n});\n//#endregion\nexport { t as i, r as n, n as r, i as t };\n","import { n as e, t } from \"./ViewKey-YV4NySfb.mjs\";\nimport { i as n, n as r, r as i, t as a } from \"./get-system-relation-field-universal-identifier.util-DGoOUfu_.mjs\";\n//#region src/application/applicationCategoryType.ts\nvar o = [\n\t\"Communication\",\n\t\"Productivity\",\n\t\"Product management\",\n\t\"Sales\",\n\t\"Marketing\",\n\t\"Enrichment\",\n\t\"Data\",\n\t\"Search\",\n\t\"Other\"\n], s = (e) => o.includes(e), c = [\n\te.TEXT,\n\te.ARRAY,\n\te.BOOLEAN,\n\te.DATE,\n\te.DATE_TIME,\n\te.NUMBER,\n\te.NUMERIC,\n\te.RAW_JSON,\n\te.RICH_TEXT,\n\te.SELECT,\n\te.MULTI_SELECT\n], l = \"public\", u = \"TWENTY_API_KEY\", d = \"TWENTY_API_URL\", f = \"TWENTY_APP_ACCESS_TOKEN\", p = \"TWENTY_FUNCTIONS_URL\", m = \"generated\", h = { js: \"import { createRequire as __createRequire } from 'module';\\nconst require = __createRequire(import.meta.url);\" }, g = \".twenty/output\", _ = \"Standard\", v = ({ applicationUniversalIdentifier: e, name: t }) => i({\n\tentityNamespace: \"agent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), y = ({ applicationUniversalIdentifier: e, key: t }) => i({\n\tentityNamespace: \"applicationVariable\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), b = \"navigation\", x = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => i({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL:${t}`,\n\tapplicationUniversalIdentifier: e\n}), S = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => i({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL_OBJECT_CONTEXT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), C = ({ applicationUniversalIdentifier: e, engineComponentKey: t, objectUniversalIdentifier: n }) => i({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `RECORD_SELECTION:${t}:${n ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), w = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => i({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `${t}:${b}`,\n\tapplicationUniversalIdentifier: e\n}), T = ({ applicationUniversalIdentifier: e, name: t }) => i({\n\tentityNamespace: \"connectionProvider\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), E = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, fieldUniversalIdentifier: n }) => i({\n\tentityNamespace: \"fieldPermission\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), D = ({ applicationUniversalIdentifier: e, componentName: t }) => i({\n\tentityNamespace: \"frontComponent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), O = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: n }) => i({\n\tentityNamespace: \"index\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), k = ({ applicationUniversalIdentifier: e, name: t }) => i({\n\tentityNamespace: \"logicFunction\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), A = ({ applicationUniversalIdentifier: e, name: t }) => i({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `FOLDER:${t}`,\n\tapplicationUniversalIdentifier: e\n}), j = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => i({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `OBJECT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), ee = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t }) => i({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `VIEW:${t}`,\n\tapplicationUniversalIdentifier: e\n}), M = ({ applicationUniversalIdentifier: e, link: t }) => i({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `LINK:${t}`,\n\tapplicationUniversalIdentifier: e\n}), N = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, objectUniversalIdentifier: n }) => i({\n\tentityNamespace: \"objectPermission\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), P = ({ applicationUniversalIdentifier: e, nameSingular: t }) => i({\n\tentityNamespace: \"objectMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), F = ({ applicationUniversalIdentifier: e, pageLayoutUniversalIdentifier: t, title: n }) => i({\n\tentityNamespace: \"pageLayoutTab\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), I = \"RECORD_PAGE\", L = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: n }) => i({\n\tentityNamespace: \"pageLayout\",\n\tvalue: t ? `${t}:${n}` : n,\n\tapplicationUniversalIdentifier: e\n}), R = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => i({\n\tentityNamespace: \"pageLayout\",\n\tvalue: `${t}:${I}`,\n\tapplicationUniversalIdentifier: e\n}), z = ({ applicationUniversalIdentifier: e, pageLayoutTabUniversalIdentifier: t, title: n }) => i({\n\tentityNamespace: \"pageLayoutWidget\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), B = ({ applicationUniversalIdentifier: e, key: t }) => i({\n\tentityNamespace: \"permissionFlag\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), V = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, permissionFlagUniversalIdentifier: n }) => i({\n\tentityNamespace: \"rolePermissionFlag\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), H = ({ applicationUniversalIdentifier: e, agentUniversalIdentifier: t }) => i({\n\tentityNamespace: \"roleTarget\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), U = ({ applicationUniversalIdentifier: e, label: t }) => i({\n\tentityNamespace: \"role\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), W = ({ applicationUniversalIdentifier: e, fieldMetadataUniversalIdentifier: t }) => i({\n\tentityNamespace: \"searchFieldMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), G = ({ applicationUniversalIdentifier: e, fieldUniversalIdentifier: t, value: n }) => i({\n\tentityNamespace: \"selectOption\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), K = ({ applicationUniversalIdentifier: e, name: t }) => i({\n\tentityNamespace: \"skill\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), q = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, name: n }) => i({\n\tentityNamespace: \"viewFieldGroup\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), J = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: n }) => i({\n\tentityNamespace: \"viewField\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), Y = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: n, operand: r, subFieldName: a }) => i({\n\tentityNamespace: \"viewFilter\",\n\tvalue: `${t}:${n}:${r}:${a ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), X = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldValue: n }) => i({\n\tentityNamespace: \"viewGroup\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), Z = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: n }) => i({\n\tentityNamespace: \"viewSort\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), Q = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: n }) => i({\n\tentityNamespace: \"view\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), $ = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: n }) => i({\n\tentityNamespace: \"view\",\n\tvalue: `${n}:${t.INDEX}`,\n\tapplicationUniversalIdentifier: e\n}), te = ({ applicationUniversalIdentifier: e, pageLayoutWidgetUniversalIdentifier: t }) => i({\n\tentityNamespace: \"view\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), ne = /* @__PURE__ */ function(e) {\n\treturn e.Object = \"object\", e.Field = \"field\", e.LogicFunction = \"logicFunction\", e.FrontComponent = \"frontComponent\", e.Role = \"role\", e.Skill = \"skill\", e.Agent = \"agent\", e.ConnectionProvider = \"connectionProvider\", e.View = \"view\", e.ViewField = \"viewField\", e.NavigationMenuItem = \"navigationMenuItem\", e.PageLayout = \"pageLayout\", e.PageLayoutTab = \"pageLayoutTab\", e.CommandMenuItem = \"commandMenuItem\", e;\n}({}), re = (t, n = e.TEXT) => {\n\tif (t == null) return \"\";\n\tswitch (n) {\n\t\tcase e.BOOLEAN: return String(t) === \"true\" ? \"true\" : \"false\";\n\t\tcase e.NUMBER:\n\t\tcase e.NUMERIC: return String(t);\n\t\tcase e.ARRAY:\n\t\tcase e.MULTI_SELECT:\n\t\t\tif (Array.isArray(t)) return JSON.stringify(t);\n\t\t\tif (typeof t == \"string\") {\n\t\t\t\ttry {\n\t\t\t\t\tlet e = JSON.parse(t);\n\t\t\t\t\tif (Array.isArray(e)) return t;\n\t\t\t\t} catch {}\n\t\t\t\treturn JSON.stringify([t]);\n\t\t\t}\n\t\t\treturn JSON.stringify(t);\n\t\tcase e.RAW_JSON:\n\t\tcase e.RICH_TEXT: return typeof t == \"string\" ? t : JSON.stringify(t);\n\t\tdefault: return typeof t == \"string\" ? t : String(t);\n\t}\n}, ie = (t, n = e.TEXT) => {\n\tif (t === \"\") return n === e.ARRAY || n === e.MULTI_SELECT ? [] : \"\";\n\tswitch (n) {\n\t\tcase e.BOOLEAN: return t === \"true\";\n\t\tcase e.NUMBER:\n\t\tcase e.NUMERIC: {\n\t\t\tlet e = Number(t);\n\t\t\treturn Number.isNaN(e) ? t : e;\n\t\t}\n\t\tcase e.ARRAY:\n\t\tcase e.MULTI_SELECT: try {\n\t\t\tlet e = JSON.parse(t);\n\t\t\treturn Array.isArray(e) ? e : [];\n\t\t} catch {\n\t\t\treturn [];\n\t\t}\n\t\tcase e.RAW_JSON:\n\t\tcase e.RICH_TEXT: try {\n\t\t\treturn JSON.parse(t);\n\t\t} catch {\n\t\t\treturn t;\n\t\t}\n\t\tdefault: return t;\n\t}\n};\n//#endregion\nexport { o as APPLICATION_CATEGORIES, c as APPLICATION_VARIABLE_FIELD_METADATA_TYPES, l as ASSETS_DIR, u as DEFAULT_API_KEY_NAME, d as DEFAULT_API_URL_NAME, f as DEFAULT_APP_ACCESS_TOKEN_NAME, p as DEFAULT_FUNCTIONS_URL_NAME, m as GENERATED_DIR, h as NODE_ESM_CJS_BANNER, g as OUTPUT_DIR, ne as SyncableEntity, _ as TWENTY_STANDARD_APPLICATION_NAME, n as TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER, i as computeDeterministicUuid, ie as deserializeApplicationVariableValue, v as getAgentUniversalIdentifier, y as getApplicationVariableUniversalIdentifier, T as getConnectionProviderUniversalIdentifier, E as getFieldPermissionUniversalIdentifier, r as getFieldUniversalIdentifier, te as getFieldsWidgetViewUniversalIdentifier, A as getFolderNavigationMenuItemUniversalIdentifier, D as getFrontComponentUniversalIdentifier, x as getGlobalCommandMenuItemUniversalIdentifier, S as getGlobalObjectContextCommandMenuItemUniversalIdentifier, O as getIndexUniversalIdentifier, $ as getIndexViewUniversalIdentifier, M as getLinkNavigationMenuItemUniversalIdentifier, k as getLogicFunctionUniversalIdentifier, w as getNavigationCommandUniversalIdentifier, j as getObjectNavigationMenuItemUniversalIdentifier, N as getObjectPermissionUniversalIdentifier, P as getObjectUniversalIdentifier, F as getPageLayoutTabUniversalIdentifier, L as getPageLayoutUniversalIdentifier, z as getPageLayoutWidgetUniversalIdentifier, B as getPermissionFlagUniversalIdentifier, R as getRecordPageLayoutUniversalIdentifier, C as getRecordSelectionCommandMenuItemUniversalIdentifier, V as getRolePermissionFlagUniversalIdentifier, H as getRoleTargetUniversalIdentifier, U as getRoleUniversalIdentifier, W as getSearchFieldUniversalIdentifier, G as getSelectOptionUniversalIdentifier, K as getSkillUniversalIdentifier, a as getSystemRelationFieldUniversalIdentifier, q as getViewFieldGroupUniversalIdentifier, J as getViewFieldUniversalIdentifier, Y as getViewFilterUniversalIdentifier, X as getViewGroupUniversalIdentifier, ee as getViewNavigationMenuItemUniversalIdentifier, Z as getViewSortUniversalIdentifier, Q as getViewUniversalIdentifier, s as isKnownApplicationCategory, re as serializeApplicationVariableValue };\n","import {\n DEFAULT_API_URL_NAME,\n DEFAULT_APP_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application';\n\nconst BILLING_CHARGE_TIMEOUT_MS = 5_000;\n\nexport type ChargeCreditsParams = {\n creditsUsedMicro: number;\n operationType: string;\n quantity?: number;\n resourceContext?: string;\n};\n\n// Records credit usage against the running application via the Twenty\n// server's `/app/billing/charge` endpoint. Reads `TWENTY_API_URL` and\n// `TWENTY_APP_ACCESS_TOKEN` from the execution env (injected by the\n// logic-function runtime). No-ops silently when either is missing so\n// local/test runs don't crash. Failures are non-fatal — a billing error\n// never surfaces as a tool failure.\nexport const chargeCredits = async ({\n creditsUsedMicro,\n operationType,\n quantity = 1,\n resourceContext,\n}: ChargeCreditsParams): Promise<void> => {\n const apiUrl = process.env[DEFAULT_API_URL_NAME];\n const token = process.env[DEFAULT_APP_ACCESS_TOKEN_NAME];\n\n if (!apiUrl || !token) {\n return;\n }\n\n try {\n const response = await fetch(\n `${apiUrl.replace(/\\/$/, '')}/app/billing/charge`,\n {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${token}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n creditsUsedMicro,\n quantity,\n operationType,\n resourceContext,\n }),\n signal: AbortSignal.timeout(BILLING_CHARGE_TIMEOUT_MS),\n },\n );\n\n if (!response.ok) {\n const body = await response.text().catch(() => '');\n\n console.error(\n `chargeCredits: ${response.status} ${response.statusText}: ${body}`,\n );\n }\n } catch (error) {\n console.error(\n `chargeCredits: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n};\n"],"mappings":"mFACA,IAAIA,EAAoB,SAAS,EAAG,CACnC,MAAO,GAAE,MAAQ,QAAS,EAAE,QAAU,UAAW,EAAE,MAAQ,QAAS,EAAE,QAAU,UAAW,EAAE,SAAW,WAAY,EAAE,KAAO,OAAQ,EAAE,UAAY,YAAa,EAAE,OAAS,SAAU,EAAE,MAAQ,QAAS,EAAE,UAAY,YAAa,EAAE,MAAQ,QAAS,EAAE,eAAiB,iBAAkB,EAAE,aAAe,eAAgB,EAAE,OAAS,SAAU,EAAE,QAAU,UAAW,EAAE,OAAS,SAAU,EAAE,SAAW,WAAY,EAAE,OAAS,SAAU,EAAE,SAAW,WAAY,EAAE,SAAW,WAAY,EAAE,UAAY,YAAa,EAAE,OAAS,SAAU,EAAE,KAAO,OAAQ,EAAE,UAAY,YAAa,EAAE,KAAO,OAAQ,CAC3kB,EAAE,CAAC,CAAC,EEWHE,EAAE,KACFA,EAAE,MACFA,EAAE,QACFA,EAAE,KACFA,EAAE,UACFA,EAAE,OACFA,EAAE,QACFA,EAAE,SACFA,EAAE,UACFA,EAAE,OACFA,EAAE,aArBH,IAsBuC,EAAI,iBAAkB,EAAI,0BCpB3D,EAA4B,IAerB,EAAgB,MAAO,CAClC,mBACA,gBACA,WAAW,EACX,qBACwC,CACxC,IAAM,EAAS,QAAQ,IAAI,GACrB,EAAQ,QAAQ,IAAI,GAEtB,MAAC,GAAU,CAAC,GAIhB,GAAI,CACF,IAAM,EAAW,MAAM,MACrB,GAAG,EAAO,QAAQ,MAAO,EAAE,EAAE,qBAC7B,CACE,OAAQ,OACR,QAAS,CACP,cAAe,UAAU,IACzB,eAAgB,kBAClB,EACA,KAAM,KAAK,UAAU,CACnB,mBACA,WACA,gBACA,iBACF,CAAC,EACD,OAAQ,YAAY,QAAQ,CAAyB,CACvD,CACF,EAEA,GAAI,CAAC,EAAS,GAAI,CAChB,IAAM,EAAO,MAAM,EAAS,KAAK,EAAE,UAAY,EAAE,EAEjD,QAAQ,MACN,kBAAkB,EAAS,OAAO,GAAG,EAAS,WAAW,IAAI,GAC/D,CACF,CACF,OAAS,EAAO,CACd,QAAQ,MACN,kBAAkB,aAAiB,MAAQ,EAAM,QAAU,OAAO,CAAK,GACzE,CACF,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["t","e","i","n","t"],"sources":["../../../twenty-shared/dist/ViewKey-YV4NySfb.mjs","../../../twenty-shared/dist/get-system-relation-field-universal-identifier.util-DGoOUfu_.mjs","../../../twenty-shared/dist/application.mjs","../../src/sdk/billing/charge-credits.ts"],"sourcesContent":["//#region src/types/FieldMetadataType.ts\nvar e = /* @__PURE__ */ function(e) {\n\treturn e.ACTOR = \"ACTOR\", e.ADDRESS = \"ADDRESS\", e.ARRAY = \"ARRAY\", e.BOOLEAN = \"BOOLEAN\", e.CURRENCY = \"CURRENCY\", e.DATE = \"DATE\", e.DATE_TIME = \"DATE_TIME\", e.EMAILS = \"EMAILS\", e.FILES = \"FILES\", e.FULL_NAME = \"FULL_NAME\", e.LINKS = \"LINKS\", e.MORPH_RELATION = \"MORPH_RELATION\", e.MULTI_SELECT = \"MULTI_SELECT\", e.NUMBER = \"NUMBER\", e.NUMERIC = \"NUMERIC\", e.PHONES = \"PHONES\", e.POSITION = \"POSITION\", e.RATING = \"RATING\", e.RAW_JSON = \"RAW_JSON\", e.RELATION = \"RELATION\", e.RICH_TEXT = \"RICH_TEXT\", e.SELECT = \"SELECT\", e.TEXT = \"TEXT\", e.TS_VECTOR = \"TS_VECTOR\", e.UUID = \"UUID\", e;\n}({}), t = /* @__PURE__ */ function(e) {\n\treturn e.INDEX = \"INDEX\", e;\n}({});\n//#endregion\nexport { e as n, t };\n","import { v5 as e } from \"uuid\";\n//#region src/application/constants/TwentyStandardApplicationUniversalIdentifier.ts\nvar t = \"20202020-64aa-4b6f-b003-9c74b97cee20\", n = ({ entityNamespace: t, value: n, applicationUniversalIdentifier: r }) => e(`${t}:${n}`, r), r = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"fieldMetadata\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), i = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, relationTargetObjectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"fieldMetadata\",\n\tvalue: `${t}:systemRelation:${r}`,\n\tapplicationUniversalIdentifier: e\n});\n//#endregion\nexport { t as i, r as n, n as r, i as t };\n","import { n as e, t } from \"./ViewKey-YV4NySfb.mjs\";\nimport { i as n, n as r, r as i, t as a } from \"./get-system-relation-field-universal-identifier.util-DGoOUfu_.mjs\";\n//#region src/application/applicationCategoryType.ts\nvar o = [\n\t\"Communication\",\n\t\"Productivity\",\n\t\"Product management\",\n\t\"Sales\",\n\t\"Marketing\",\n\t\"Enrichment\",\n\t\"Data\",\n\t\"Search\",\n\t\"Other\"\n], s = (e) => o.includes(e), c = [\n\te.TEXT,\n\te.ARRAY,\n\te.BOOLEAN,\n\te.DATE,\n\te.DATE_TIME,\n\te.NUMBER,\n\te.NUMERIC,\n\te.RAW_JSON,\n\te.RICH_TEXT,\n\te.SELECT,\n\te.MULTI_SELECT\n], l = \"public\", u = \"TWENTY_API_KEY\", d = \"TWENTY_API_URL\", f = \"TWENTY_APP_ACCESS_TOKEN\", p = \"TWENTY_FUNCTIONS_URL\", m = \"generated\", h = { js: \"import { createRequire as __createRequire } from 'module';\\nconst require = __createRequire(import.meta.url);\" }, g = \".twenty/output\", _ = \"Standard\", v = ({ applicationUniversalIdentifier: e, name: t }) => i({\n\tentityNamespace: \"agent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), y = ({ applicationUniversalIdentifier: e, key: t }) => i({\n\tentityNamespace: \"applicationVariable\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), b = \"navigation\", x = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => i({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL:${t}`,\n\tapplicationUniversalIdentifier: e\n}), S = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => i({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL_OBJECT_CONTEXT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), C = ({ applicationUniversalIdentifier: e, engineComponentKey: t, objectUniversalIdentifier: n }) => i({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `RECORD_SELECTION:${t}:${n ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), w = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => i({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `${t}:${b}`,\n\tapplicationUniversalIdentifier: e\n}), T = ({ applicationUniversalIdentifier: e, name: t }) => i({\n\tentityNamespace: \"connectionProvider\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), E = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, fieldUniversalIdentifier: n }) => i({\n\tentityNamespace: \"fieldPermission\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), D = ({ applicationUniversalIdentifier: e, componentName: t }) => i({\n\tentityNamespace: \"frontComponent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), O = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: n }) => i({\n\tentityNamespace: \"index\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), k = ({ applicationUniversalIdentifier: e, name: t }) => i({\n\tentityNamespace: \"logicFunction\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), A = ({ applicationUniversalIdentifier: e, name: t }) => i({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `FOLDER:${t}`,\n\tapplicationUniversalIdentifier: e\n}), j = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => i({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `OBJECT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), ee = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t }) => i({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `VIEW:${t}`,\n\tapplicationUniversalIdentifier: e\n}), M = ({ applicationUniversalIdentifier: e, link: t }) => i({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `LINK:${t}`,\n\tapplicationUniversalIdentifier: e\n}), N = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, objectUniversalIdentifier: n }) => i({\n\tentityNamespace: \"objectPermission\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), P = ({ applicationUniversalIdentifier: e, nameSingular: t }) => i({\n\tentityNamespace: \"objectMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), F = ({ applicationUniversalIdentifier: e, pageLayoutUniversalIdentifier: t, title: n }) => i({\n\tentityNamespace: \"pageLayoutTab\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), I = \"RECORD_PAGE\", L = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: n }) => i({\n\tentityNamespace: \"pageLayout\",\n\tvalue: t ? `${t}:${n}` : n,\n\tapplicationUniversalIdentifier: e\n}), R = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => i({\n\tentityNamespace: \"pageLayout\",\n\tvalue: `${t}:${I}`,\n\tapplicationUniversalIdentifier: e\n}), z = ({ applicationUniversalIdentifier: e, pageLayoutTabUniversalIdentifier: t, title: n }) => i({\n\tentityNamespace: \"pageLayoutWidget\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), B = ({ applicationUniversalIdentifier: e, key: t }) => i({\n\tentityNamespace: \"permissionFlag\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), V = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, permissionFlagUniversalIdentifier: n }) => i({\n\tentityNamespace: \"rolePermissionFlag\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), H = ({ applicationUniversalIdentifier: e, label: t }) => i({\n\tentityNamespace: \"role\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), U = ({ applicationUniversalIdentifier: e, fieldMetadataUniversalIdentifier: t }) => i({\n\tentityNamespace: \"searchFieldMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), W = ({ applicationUniversalIdentifier: e, fieldUniversalIdentifier: t, value: n }) => i({\n\tentityNamespace: \"selectOption\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), G = ({ applicationUniversalIdentifier: e, name: t }) => i({\n\tentityNamespace: \"skill\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), K = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, name: n }) => i({\n\tentityNamespace: \"viewFieldGroup\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), q = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: n }) => i({\n\tentityNamespace: \"viewField\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), J = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: n, operand: r, subFieldName: a }) => i({\n\tentityNamespace: \"viewFilter\",\n\tvalue: `${t}:${n}:${r}:${a ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), Y = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldValue: n }) => i({\n\tentityNamespace: \"viewGroup\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), X = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: n }) => i({\n\tentityNamespace: \"viewSort\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), Z = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: n }) => i({\n\tentityNamespace: \"view\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), Q = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: n }) => i({\n\tentityNamespace: \"view\",\n\tvalue: `${n}:${t.INDEX}`,\n\tapplicationUniversalIdentifier: e\n}), $ = ({ applicationUniversalIdentifier: e, pageLayoutWidgetUniversalIdentifier: t }) => i({\n\tentityNamespace: \"view\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), te = /* @__PURE__ */ function(e) {\n\treturn e.Object = \"object\", e.Field = \"field\", e.LogicFunction = \"logicFunction\", e.FrontComponent = \"frontComponent\", e.Role = \"role\", e.Skill = \"skill\", e.Agent = \"agent\", e.ConnectionProvider = \"connectionProvider\", e.View = \"view\", e.ViewField = \"viewField\", e.NavigationMenuItem = \"navigationMenuItem\", e.PageLayout = \"pageLayout\", e.PageLayoutTab = \"pageLayoutTab\", e.CommandMenuItem = \"commandMenuItem\", e;\n}({}), ne = (t, n = e.TEXT) => {\n\tif (t == null) return \"\";\n\tswitch (n) {\n\t\tcase e.BOOLEAN: return String(t) === \"true\" ? \"true\" : \"false\";\n\t\tcase e.NUMBER:\n\t\tcase e.NUMERIC: return String(t);\n\t\tcase e.ARRAY:\n\t\tcase e.MULTI_SELECT:\n\t\t\tif (Array.isArray(t)) return JSON.stringify(t);\n\t\t\tif (typeof t == \"string\") {\n\t\t\t\ttry {\n\t\t\t\t\tlet e = JSON.parse(t);\n\t\t\t\t\tif (Array.isArray(e)) return t;\n\t\t\t\t} catch {}\n\t\t\t\treturn JSON.stringify([t]);\n\t\t\t}\n\t\t\treturn JSON.stringify(t);\n\t\tcase e.RAW_JSON:\n\t\tcase e.RICH_TEXT: return typeof t == \"string\" ? t : JSON.stringify(t);\n\t\tdefault: return typeof t == \"string\" ? t : String(t);\n\t}\n}, re = (t, n = e.TEXT) => {\n\tif (t === \"\") return n === e.ARRAY || n === e.MULTI_SELECT ? [] : \"\";\n\tswitch (n) {\n\t\tcase e.BOOLEAN: return t === \"true\";\n\t\tcase e.NUMBER:\n\t\tcase e.NUMERIC: {\n\t\t\tlet e = Number(t);\n\t\t\treturn Number.isNaN(e) ? t : e;\n\t\t}\n\t\tcase e.ARRAY:\n\t\tcase e.MULTI_SELECT: try {\n\t\t\tlet e = JSON.parse(t);\n\t\t\treturn Array.isArray(e) ? e : [];\n\t\t} catch {\n\t\t\treturn [];\n\t\t}\n\t\tcase e.RAW_JSON:\n\t\tcase e.RICH_TEXT: try {\n\t\t\treturn JSON.parse(t);\n\t\t} catch {\n\t\t\treturn t;\n\t\t}\n\t\tdefault: return t;\n\t}\n};\n//#endregion\nexport { o as APPLICATION_CATEGORIES, c as APPLICATION_VARIABLE_FIELD_METADATA_TYPES, l as ASSETS_DIR, u as DEFAULT_API_KEY_NAME, d as DEFAULT_API_URL_NAME, f as DEFAULT_APP_ACCESS_TOKEN_NAME, p as DEFAULT_FUNCTIONS_URL_NAME, m as GENERATED_DIR, h as NODE_ESM_CJS_BANNER, g as OUTPUT_DIR, te as SyncableEntity, _ as TWENTY_STANDARD_APPLICATION_NAME, n as TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER, i as computeDeterministicUuid, re as deserializeApplicationVariableValue, v as getAgentUniversalIdentifier, y as getApplicationVariableUniversalIdentifier, T as getConnectionProviderUniversalIdentifier, E as getFieldPermissionUniversalIdentifier, r as getFieldUniversalIdentifier, $ as getFieldsWidgetViewUniversalIdentifier, A as getFolderNavigationMenuItemUniversalIdentifier, D as getFrontComponentUniversalIdentifier, x as getGlobalCommandMenuItemUniversalIdentifier, S as getGlobalObjectContextCommandMenuItemUniversalIdentifier, O as getIndexUniversalIdentifier, Q as getIndexViewUniversalIdentifier, M as getLinkNavigationMenuItemUniversalIdentifier, k as getLogicFunctionUniversalIdentifier, w as getNavigationCommandUniversalIdentifier, j as getObjectNavigationMenuItemUniversalIdentifier, N as getObjectPermissionUniversalIdentifier, P as getObjectUniversalIdentifier, F as getPageLayoutTabUniversalIdentifier, L as getPageLayoutUniversalIdentifier, z as getPageLayoutWidgetUniversalIdentifier, B as getPermissionFlagUniversalIdentifier, R as getRecordPageLayoutUniversalIdentifier, C as getRecordSelectionCommandMenuItemUniversalIdentifier, V as getRolePermissionFlagUniversalIdentifier, H as getRoleUniversalIdentifier, U as getSearchFieldUniversalIdentifier, W as getSelectOptionUniversalIdentifier, G as getSkillUniversalIdentifier, a as getSystemRelationFieldUniversalIdentifier, K as getViewFieldGroupUniversalIdentifier, q as getViewFieldUniversalIdentifier, J as getViewFilterUniversalIdentifier, Y as getViewGroupUniversalIdentifier, ee as getViewNavigationMenuItemUniversalIdentifier, X as getViewSortUniversalIdentifier, Z as getViewUniversalIdentifier, s as isKnownApplicationCategory, ne as serializeApplicationVariableValue };\n","import {\n DEFAULT_API_URL_NAME,\n DEFAULT_APP_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application';\n\nconst BILLING_CHARGE_TIMEOUT_MS = 5_000;\n\nexport type ChargeCreditsParams = {\n creditsUsedMicro: number;\n operationType: string;\n quantity?: number;\n resourceContext?: string;\n};\n\n// Records credit usage against the running application via the Twenty\n// server's `/app/billing/charge` endpoint. Reads `TWENTY_API_URL` and\n// `TWENTY_APP_ACCESS_TOKEN` from the execution env (injected by the\n// logic-function runtime). No-ops silently when either is missing so\n// local/test runs don't crash. Failures are non-fatal — a billing error\n// never surfaces as a tool failure.\nexport const chargeCredits = async ({\n creditsUsedMicro,\n operationType,\n quantity = 1,\n resourceContext,\n}: ChargeCreditsParams): Promise<void> => {\n const apiUrl = process.env[DEFAULT_API_URL_NAME];\n const token = process.env[DEFAULT_APP_ACCESS_TOKEN_NAME];\n\n if (!apiUrl || !token) {\n return;\n }\n\n try {\n const response = await fetch(\n `${apiUrl.replace(/\\/$/, '')}/app/billing/charge`,\n {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${token}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n creditsUsedMicro,\n quantity,\n operationType,\n resourceContext,\n }),\n signal: AbortSignal.timeout(BILLING_CHARGE_TIMEOUT_MS),\n },\n );\n\n if (!response.ok) {\n const body = await response.text().catch(() => '');\n\n console.error(\n `chargeCredits: ${response.status} ${response.statusText}: ${body}`,\n );\n }\n } catch (error) {\n console.error(\n `chargeCredits: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n};\n"],"mappings":";;AACA,IAAI,IAAoB,yBAAS,GAAG;CACnC,OAAO,EAAE,QAAQ,SAAS,EAAE,UAAU,WAAW,EAAE,QAAQ,SAAS,EAAE,UAAU,WAAW,EAAE,WAAW,YAAY,EAAE,OAAO,QAAQ,EAAE,YAAY,aAAa,EAAE,SAAS,UAAU,EAAE,QAAQ,SAAS,EAAE,YAAY,aAAa,EAAE,QAAQ,SAAS,EAAE,iBAAiB,kBAAkB,EAAE,eAAe,gBAAgB,EAAE,SAAS,UAAU,EAAE,UAAU,WAAW,EAAE,SAAS,UAAU,EAAE,WAAW,YAAY,EAAE,SAAS,UAAU,EAAE,WAAW,YAAY,EAAE,WAAW,YAAY,EAAE,YAAY,aAAa,EAAE,SAAS,UAAU,EAAE,OAAO,QAAQ,EAAE,YAAY,aAAa,EAAE,OAAO,QAAQ;AAC3kB,EAAE,CAAC,CAAC;AEWH,EAAE,MACF,EAAE,OACF,EAAE,SACF,EAAE,MACF,EAAE,WACF,EAAE,QACF,EAAE,SACF,EAAE,UACF,EAAE,WACF,EAAE,QACF,EAAE;;;AArBH,IAsBuC,IAAI,kBAAkB,IAAI,2BCpB3D,IAA4B,KAerB,IAAgB,OAAO,EAClC,qBACA,kBACA,cAAW,GACX,yBACwC;CACxC,IAAM,IAAS,QAAQ,IAAI,IACrB,IAAQ,QAAQ,IAAI;CAEtB,OAAC,KAAU,CAAC,IAIhB,IAAI;EACF,IAAM,IAAW,MAAM,MACrB,GAAG,EAAO,QAAQ,OAAO,EAAE,EAAE,sBAC7B;GACE,QAAQ;GACR,SAAS;IACP,eAAe,UAAU;IACzB,gBAAgB;GAClB;GACA,MAAM,KAAK,UAAU;IACnB;IACA;IACA;IACA;GACF,CAAC;GACD,QAAQ,YAAY,QAAQ,CAAyB;EACvD,CACF;EAEA,IAAI,CAAC,EAAS,IAAI;GAChB,IAAM,IAAO,MAAM,EAAS,KAAK,EAAE,YAAY,EAAE;GAEjD,QAAQ,MACN,kBAAkB,EAAS,OAAO,GAAG,EAAS,WAAW,IAAI,GAC/D;EACF;CACF,SAAS,GAAO;EACd,QAAQ,MACN,kBAAkB,aAAiB,QAAQ,EAAM,UAAU,OAAO,CAAK,GACzE;CACF;AACF"}
1
+ {"version":3,"file":"index.mjs","names":["t","e","i","n","t"],"sources":["../../../twenty-shared/dist/ViewKey-YV4NySfb.mjs","../../../twenty-shared/dist/get-system-relation-field-universal-identifier.util-DGoOUfu_.mjs","../../../twenty-shared/dist/application.mjs","../../src/sdk/billing/charge-credits.ts"],"sourcesContent":["//#region src/types/FieldMetadataType.ts\nvar e = /* @__PURE__ */ function(e) {\n\treturn e.ACTOR = \"ACTOR\", e.ADDRESS = \"ADDRESS\", e.ARRAY = \"ARRAY\", e.BOOLEAN = \"BOOLEAN\", e.CURRENCY = \"CURRENCY\", e.DATE = \"DATE\", e.DATE_TIME = \"DATE_TIME\", e.EMAILS = \"EMAILS\", e.FILES = \"FILES\", e.FULL_NAME = \"FULL_NAME\", e.LINKS = \"LINKS\", e.MORPH_RELATION = \"MORPH_RELATION\", e.MULTI_SELECT = \"MULTI_SELECT\", e.NUMBER = \"NUMBER\", e.NUMERIC = \"NUMERIC\", e.PHONES = \"PHONES\", e.POSITION = \"POSITION\", e.RATING = \"RATING\", e.RAW_JSON = \"RAW_JSON\", e.RELATION = \"RELATION\", e.RICH_TEXT = \"RICH_TEXT\", e.SELECT = \"SELECT\", e.TEXT = \"TEXT\", e.TS_VECTOR = \"TS_VECTOR\", e.UUID = \"UUID\", e;\n}({}), t = /* @__PURE__ */ function(e) {\n\treturn e.INDEX = \"INDEX\", e;\n}({});\n//#endregion\nexport { e as n, t };\n","import { v5 as e } from \"uuid\";\n//#region src/application/constants/TwentyStandardApplicationUniversalIdentifier.ts\nvar t = \"20202020-64aa-4b6f-b003-9c74b97cee20\", n = ({ entityNamespace: t, value: n, applicationUniversalIdentifier: r }) => e(`${t}:${n}`, r), r = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"fieldMetadata\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), i = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, relationTargetObjectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"fieldMetadata\",\n\tvalue: `${t}:systemRelation:${r}`,\n\tapplicationUniversalIdentifier: e\n});\n//#endregion\nexport { t as i, r as n, n as r, i as t };\n","import { n as e, t } from \"./ViewKey-YV4NySfb.mjs\";\nimport { i as n, n as r, r as i, t as a } from \"./get-system-relation-field-universal-identifier.util-DGoOUfu_.mjs\";\n//#region src/application/applicationCategoryType.ts\nvar o = [\n\t\"Communication\",\n\t\"Productivity\",\n\t\"Product management\",\n\t\"Sales\",\n\t\"Marketing\",\n\t\"Enrichment\",\n\t\"Data\",\n\t\"Search\",\n\t\"Other\"\n], s = (e) => o.includes(e), c = [\n\te.TEXT,\n\te.ARRAY,\n\te.BOOLEAN,\n\te.DATE,\n\te.DATE_TIME,\n\te.NUMBER,\n\te.NUMERIC,\n\te.RAW_JSON,\n\te.RICH_TEXT,\n\te.SELECT,\n\te.MULTI_SELECT\n], l = \"public\", u = \"TWENTY_API_KEY\", d = \"TWENTY_API_URL\", f = \"TWENTY_APP_ACCESS_TOKEN\", p = \"TWENTY_FUNCTIONS_URL\", m = \"generated\", h = { js: \"import { createRequire as __createRequire } from 'module';\\nconst require = __createRequire(import.meta.url);\" }, g = \".twenty/output\", _ = \"Standard\", v = ({ applicationUniversalIdentifier: e, name: t }) => i({\n\tentityNamespace: \"agent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), y = ({ applicationUniversalIdentifier: e, key: t }) => i({\n\tentityNamespace: \"applicationVariable\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), b = \"navigation\", x = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => i({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL:${t}`,\n\tapplicationUniversalIdentifier: e\n}), S = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => i({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL_OBJECT_CONTEXT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), C = ({ applicationUniversalIdentifier: e, engineComponentKey: t, objectUniversalIdentifier: n }) => i({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `RECORD_SELECTION:${t}:${n ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), w = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => i({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `${t}:${b}`,\n\tapplicationUniversalIdentifier: e\n}), T = ({ applicationUniversalIdentifier: e, name: t }) => i({\n\tentityNamespace: \"connectionProvider\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), E = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, fieldUniversalIdentifier: n }) => i({\n\tentityNamespace: \"fieldPermission\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), D = ({ applicationUniversalIdentifier: e, componentName: t }) => i({\n\tentityNamespace: \"frontComponent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), O = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: n }) => i({\n\tentityNamespace: \"index\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), k = ({ applicationUniversalIdentifier: e, name: t }) => i({\n\tentityNamespace: \"logicFunction\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), A = ({ applicationUniversalIdentifier: e, name: t }) => i({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `FOLDER:${t}`,\n\tapplicationUniversalIdentifier: e\n}), j = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => i({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `OBJECT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), ee = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t }) => i({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `VIEW:${t}`,\n\tapplicationUniversalIdentifier: e\n}), M = ({ applicationUniversalIdentifier: e, link: t }) => i({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `LINK:${t}`,\n\tapplicationUniversalIdentifier: e\n}), N = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, objectUniversalIdentifier: n }) => i({\n\tentityNamespace: \"objectPermission\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), P = ({ applicationUniversalIdentifier: e, nameSingular: t }) => i({\n\tentityNamespace: \"objectMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), F = ({ applicationUniversalIdentifier: e, pageLayoutUniversalIdentifier: t, title: n }) => i({\n\tentityNamespace: \"pageLayoutTab\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), I = \"RECORD_PAGE\", L = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: n }) => i({\n\tentityNamespace: \"pageLayout\",\n\tvalue: t ? `${t}:${n}` : n,\n\tapplicationUniversalIdentifier: e\n}), R = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => i({\n\tentityNamespace: \"pageLayout\",\n\tvalue: `${t}:${I}`,\n\tapplicationUniversalIdentifier: e\n}), z = ({ applicationUniversalIdentifier: e, pageLayoutTabUniversalIdentifier: t, title: n }) => i({\n\tentityNamespace: \"pageLayoutWidget\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), B = ({ applicationUniversalIdentifier: e, key: t }) => i({\n\tentityNamespace: \"permissionFlag\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), V = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, permissionFlagUniversalIdentifier: n }) => i({\n\tentityNamespace: \"rolePermissionFlag\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), H = ({ applicationUniversalIdentifier: e, agentUniversalIdentifier: t }) => i({\n\tentityNamespace: \"roleTarget\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), U = ({ applicationUniversalIdentifier: e, label: t }) => i({\n\tentityNamespace: \"role\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), W = ({ applicationUniversalIdentifier: e, fieldMetadataUniversalIdentifier: t }) => i({\n\tentityNamespace: \"searchFieldMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), G = ({ applicationUniversalIdentifier: e, fieldUniversalIdentifier: t, value: n }) => i({\n\tentityNamespace: \"selectOption\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), K = ({ applicationUniversalIdentifier: e, name: t }) => i({\n\tentityNamespace: \"skill\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), q = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, name: n }) => i({\n\tentityNamespace: \"viewFieldGroup\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), J = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: n }) => i({\n\tentityNamespace: \"viewField\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), Y = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: n, operand: r, subFieldName: a }) => i({\n\tentityNamespace: \"viewFilter\",\n\tvalue: `${t}:${n}:${r}:${a ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), X = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldValue: n }) => i({\n\tentityNamespace: \"viewGroup\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), Z = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: n }) => i({\n\tentityNamespace: \"viewSort\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), Q = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: n }) => i({\n\tentityNamespace: \"view\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), $ = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: n }) => i({\n\tentityNamespace: \"view\",\n\tvalue: `${n}:${t.INDEX}`,\n\tapplicationUniversalIdentifier: e\n}), te = ({ applicationUniversalIdentifier: e, pageLayoutWidgetUniversalIdentifier: t }) => i({\n\tentityNamespace: \"view\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), ne = /* @__PURE__ */ function(e) {\n\treturn e.Object = \"object\", e.Field = \"field\", e.LogicFunction = \"logicFunction\", e.FrontComponent = \"frontComponent\", e.Role = \"role\", e.Skill = \"skill\", e.Agent = \"agent\", e.ConnectionProvider = \"connectionProvider\", e.View = \"view\", e.ViewField = \"viewField\", e.NavigationMenuItem = \"navigationMenuItem\", e.PageLayout = \"pageLayout\", e.PageLayoutTab = \"pageLayoutTab\", e.CommandMenuItem = \"commandMenuItem\", e;\n}({}), re = (t, n = e.TEXT) => {\n\tif (t == null) return \"\";\n\tswitch (n) {\n\t\tcase e.BOOLEAN: return String(t) === \"true\" ? \"true\" : \"false\";\n\t\tcase e.NUMBER:\n\t\tcase e.NUMERIC: return String(t);\n\t\tcase e.ARRAY:\n\t\tcase e.MULTI_SELECT:\n\t\t\tif (Array.isArray(t)) return JSON.stringify(t);\n\t\t\tif (typeof t == \"string\") {\n\t\t\t\ttry {\n\t\t\t\t\tlet e = JSON.parse(t);\n\t\t\t\t\tif (Array.isArray(e)) return t;\n\t\t\t\t} catch {}\n\t\t\t\treturn JSON.stringify([t]);\n\t\t\t}\n\t\t\treturn JSON.stringify(t);\n\t\tcase e.RAW_JSON:\n\t\tcase e.RICH_TEXT: return typeof t == \"string\" ? t : JSON.stringify(t);\n\t\tdefault: return typeof t == \"string\" ? t : String(t);\n\t}\n}, ie = (t, n = e.TEXT) => {\n\tif (t === \"\") return n === e.ARRAY || n === e.MULTI_SELECT ? [] : \"\";\n\tswitch (n) {\n\t\tcase e.BOOLEAN: return t === \"true\";\n\t\tcase e.NUMBER:\n\t\tcase e.NUMERIC: {\n\t\t\tlet e = Number(t);\n\t\t\treturn Number.isNaN(e) ? t : e;\n\t\t}\n\t\tcase e.ARRAY:\n\t\tcase e.MULTI_SELECT: try {\n\t\t\tlet e = JSON.parse(t);\n\t\t\treturn Array.isArray(e) ? e : [];\n\t\t} catch {\n\t\t\treturn [];\n\t\t}\n\t\tcase e.RAW_JSON:\n\t\tcase e.RICH_TEXT: try {\n\t\t\treturn JSON.parse(t);\n\t\t} catch {\n\t\t\treturn t;\n\t\t}\n\t\tdefault: return t;\n\t}\n};\n//#endregion\nexport { o as APPLICATION_CATEGORIES, c as APPLICATION_VARIABLE_FIELD_METADATA_TYPES, l as ASSETS_DIR, u as DEFAULT_API_KEY_NAME, d as DEFAULT_API_URL_NAME, f as DEFAULT_APP_ACCESS_TOKEN_NAME, p as DEFAULT_FUNCTIONS_URL_NAME, m as GENERATED_DIR, h as NODE_ESM_CJS_BANNER, g as OUTPUT_DIR, ne as SyncableEntity, _ as TWENTY_STANDARD_APPLICATION_NAME, n as TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER, i as computeDeterministicUuid, ie as deserializeApplicationVariableValue, v as getAgentUniversalIdentifier, y as getApplicationVariableUniversalIdentifier, T as getConnectionProviderUniversalIdentifier, E as getFieldPermissionUniversalIdentifier, r as getFieldUniversalIdentifier, te as getFieldsWidgetViewUniversalIdentifier, A as getFolderNavigationMenuItemUniversalIdentifier, D as getFrontComponentUniversalIdentifier, x as getGlobalCommandMenuItemUniversalIdentifier, S as getGlobalObjectContextCommandMenuItemUniversalIdentifier, O as getIndexUniversalIdentifier, $ as getIndexViewUniversalIdentifier, M as getLinkNavigationMenuItemUniversalIdentifier, k as getLogicFunctionUniversalIdentifier, w as getNavigationCommandUniversalIdentifier, j as getObjectNavigationMenuItemUniversalIdentifier, N as getObjectPermissionUniversalIdentifier, P as getObjectUniversalIdentifier, F as getPageLayoutTabUniversalIdentifier, L as getPageLayoutUniversalIdentifier, z as getPageLayoutWidgetUniversalIdentifier, B as getPermissionFlagUniversalIdentifier, R as getRecordPageLayoutUniversalIdentifier, C as getRecordSelectionCommandMenuItemUniversalIdentifier, V as getRolePermissionFlagUniversalIdentifier, H as getRoleTargetUniversalIdentifier, U as getRoleUniversalIdentifier, W as getSearchFieldUniversalIdentifier, G as getSelectOptionUniversalIdentifier, K as getSkillUniversalIdentifier, a as getSystemRelationFieldUniversalIdentifier, q as getViewFieldGroupUniversalIdentifier, J as getViewFieldUniversalIdentifier, Y as getViewFilterUniversalIdentifier, X as getViewGroupUniversalIdentifier, ee as getViewNavigationMenuItemUniversalIdentifier, Z as getViewSortUniversalIdentifier, Q as getViewUniversalIdentifier, s as isKnownApplicationCategory, re as serializeApplicationVariableValue };\n","import {\n DEFAULT_API_URL_NAME,\n DEFAULT_APP_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application';\n\nconst BILLING_CHARGE_TIMEOUT_MS = 5_000;\n\nexport type ChargeCreditsParams = {\n creditsUsedMicro: number;\n operationType: string;\n quantity?: number;\n resourceContext?: string;\n};\n\n// Records credit usage against the running application via the Twenty\n// server's `/app/billing/charge` endpoint. Reads `TWENTY_API_URL` and\n// `TWENTY_APP_ACCESS_TOKEN` from the execution env (injected by the\n// logic-function runtime). No-ops silently when either is missing so\n// local/test runs don't crash. Failures are non-fatal — a billing error\n// never surfaces as a tool failure.\nexport const chargeCredits = async ({\n creditsUsedMicro,\n operationType,\n quantity = 1,\n resourceContext,\n}: ChargeCreditsParams): Promise<void> => {\n const apiUrl = process.env[DEFAULT_API_URL_NAME];\n const token = process.env[DEFAULT_APP_ACCESS_TOKEN_NAME];\n\n if (!apiUrl || !token) {\n return;\n }\n\n try {\n const response = await fetch(\n `${apiUrl.replace(/\\/$/, '')}/app/billing/charge`,\n {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${token}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n creditsUsedMicro,\n quantity,\n operationType,\n resourceContext,\n }),\n signal: AbortSignal.timeout(BILLING_CHARGE_TIMEOUT_MS),\n },\n );\n\n if (!response.ok) {\n const body = await response.text().catch(() => '');\n\n console.error(\n `chargeCredits: ${response.status} ${response.statusText}: ${body}`,\n );\n }\n } catch (error) {\n console.error(\n `chargeCredits: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n};\n"],"mappings":";;AACA,IAAI,IAAoB,yBAAS,GAAG;CACnC,OAAO,EAAE,QAAQ,SAAS,EAAE,UAAU,WAAW,EAAE,QAAQ,SAAS,EAAE,UAAU,WAAW,EAAE,WAAW,YAAY,EAAE,OAAO,QAAQ,EAAE,YAAY,aAAa,EAAE,SAAS,UAAU,EAAE,QAAQ,SAAS,EAAE,YAAY,aAAa,EAAE,QAAQ,SAAS,EAAE,iBAAiB,kBAAkB,EAAE,eAAe,gBAAgB,EAAE,SAAS,UAAU,EAAE,UAAU,WAAW,EAAE,SAAS,UAAU,EAAE,WAAW,YAAY,EAAE,SAAS,UAAU,EAAE,WAAW,YAAY,EAAE,WAAW,YAAY,EAAE,YAAY,aAAa,EAAE,SAAS,UAAU,EAAE,OAAO,QAAQ,EAAE,YAAY,aAAa,EAAE,OAAO,QAAQ;AAC3kB,EAAE,CAAC,CAAC;AEWH,EAAE,MACF,EAAE,OACF,EAAE,SACF,EAAE,MACF,EAAE,WACF,EAAE,QACF,EAAE,SACF,EAAE,UACF,EAAE,WACF,EAAE,QACF,EAAE;;;AArBH,IAsBuC,IAAI,kBAAkB,IAAI,2BCpB3D,IAA4B,KAerB,IAAgB,OAAO,EAClC,qBACA,kBACA,cAAW,GACX,yBACwC;CACxC,IAAM,IAAS,QAAQ,IAAI,IACrB,IAAQ,QAAQ,IAAI;CAEtB,OAAC,KAAU,CAAC,IAIhB,IAAI;EACF,IAAM,IAAW,MAAM,MACrB,GAAG,EAAO,QAAQ,OAAO,EAAE,EAAE,sBAC7B;GACE,QAAQ;GACR,SAAS;IACP,eAAe,UAAU;IACzB,gBAAgB;GAClB;GACA,MAAM,KAAK,UAAU;IACnB;IACA;IACA;IACA;GACF,CAAC;GACD,QAAQ,YAAY,QAAQ,CAAyB;EACvD,CACF;EAEA,IAAI,CAAC,EAAS,IAAI;GAChB,IAAM,IAAO,MAAM,EAAS,KAAK,EAAE,YAAY,EAAE;GAEjD,QAAQ,MACN,kBAAkB,EAAS,OAAO,GAAG,EAAS,WAAW,IAAI,GAC/D;EACF;CACF,SAAS,GAAO;EACd,QAAQ,MACN,kBAAkB,aAAiB,QAAQ,EAAM,UAAU,OAAO,CAAK,GACzE;CACF;AACF"}
@@ -1 +1 @@
1
- const e=require("./get-front-component-build-plugins-C7h3DVdC.js"),t=require("./login-DRLsbxdb.js");let n=require("chalk");n=e.i(n);var r=class{async execute(e){e.remote&&t.U.setActiveRemote(e.remote);let r=t.U.getActiveRemote();console.log(n.default.blue(`Syncing marketplace catalog on ${r}...`));let i=await new t.z().syncMarketplaceCatalog();i.success||(console.error(n.default.red(`Catalog sync failed: ${i.error instanceof Error?i.error.message:String(i.error)}`)),process.exit(1)),console.log(n.default.green(`✓ Marketplace catalog synced successfully`))}};exports.CatalogSyncCommand=r;
1
+ const e=require("./get-front-component-build-plugins-C7h3DVdC.js"),t=require("./login-C1meSrEJ.js");let n=require("chalk");n=e.i(n);var r=class{async execute(e){e.remote&&t.U.setActiveRemote(e.remote);let r=t.U.getActiveRemote();console.log(n.default.blue(`Syncing marketplace catalog on ${r}...`));let i=await new t.z().syncMarketplaceCatalog();i.success||(console.error(n.default.red(`Catalog sync failed: ${i.error instanceof Error?i.error.message:String(i.error)}`)),process.exit(1)),console.log(n.default.green(`✓ Marketplace catalog synced successfully`))}};exports.CatalogSyncCommand=r;
@@ -2,7 +2,7 @@ import { createRequire as e } from "node:module";
2
2
  import { fileURLToPath as t } from "node:url";
3
3
  import { dirname as n } from "node:path";
4
4
  e(import.meta.url), n(t(import.meta.url));
5
- import { U as r, z as i } from "./login-C1WTDmkF.mjs";
5
+ import { U as r, z as i } from "./login-CjlKXuH6.mjs";
6
6
  import a from "chalk";
7
7
  //#region src/cli/commands/dev/catalog-sync.ts
8
8
  var o = class {
@@ -1,8 +1,9 @@
1
1
  export declare class LogicFunctionExecuteCommand {
2
- execute({ appPath, postInstall, preInstall, functionUniversalIdentifier, functionName, payload }: {
2
+ execute({ appPath, postInstall, preInstall, uninstall, functionUniversalIdentifier, functionName, payload }: {
3
3
  appPath?: string;
4
4
  postInstall?: boolean;
5
5
  preInstall?: boolean;
6
+ uninstall?: boolean;
6
7
  functionUniversalIdentifier?: string;
7
8
  functionName?: string;
8
9
  payload?: string;
@@ -7,6 +7,8 @@ export type FunctionExecuteOptions = {
7
7
  postInstall: true;
8
8
  } | {
9
9
  preInstall: true;
10
+ } | {
11
+ uninstall: true;
10
12
  } | {
11
13
  functionUniversalIdentifier: string;
12
14
  } | {
@@ -6,6 +6,7 @@ export declare enum TargetFunction {
6
6
  DefineLogicFunction = "defineLogicFunction",
7
7
  DefinePostInstallLogicFunction = "definePostInstallLogicFunction",
8
8
  DefinePreInstallLogicFunction = "definePreInstallLogicFunction",
9
+ DefineUninstallLogicFunction = "defineUninstallLogicFunction",
9
10
  DefineObject = "defineObject",
10
11
  DefinePermissionFlag = "definePermissionFlag",
11
12
  DefineRole = "defineRole",
@@ -13,6 +14,7 @@ export declare enum TargetFunction {
13
14
  DefineAgent = "defineAgent",
14
15
  DefineConnectionProvider = "defineConnectionProvider",
15
16
  DefineFrontComponent = "defineFrontComponent",
17
+ DefineSettingsFrontComponent = "defineSettingsFrontComponent",
16
18
  DefineView = "defineView",
17
19
  DefineViewField = "defineViewField",
18
20
  DefineNavigationMenuItem = "defineNavigationMenuItem",