twenty-sdk 2.19.0 → 2.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/billing/index.cjs.map +1 -1
- package/dist/billing/index.mjs.map +1 -1
- package/dist/catalog-sync-BXLh5-WO.mjs +18 -0
- package/dist/{catalog-sync-DHopgolZ.js → catalog-sync-CrfskDrz.js} +1 -1
- package/dist/cli/utilities/api/api-service.d.ts +10 -0
- package/dist/cli/utilities/api/application-api.d.ts +10 -0
- package/dist/cli/utilities/auth/build-app-token-pair-fetcher.d.ts +5 -0
- package/dist/cli/utilities/auth/ensure-app-access-token-is-valid-or-refresh.d.ts +11 -4
- package/dist/cli/utilities/auth/ensure-app-registration.d.ts +1 -1
- package/dist/cli/utilities/build/common/esbuild-result-processor.d.ts +2 -2
- package/dist/cli/utilities/dev/orchestrator/dev-mode-orchestrator.d.ts +1 -0
- package/dist/cli/utilities/dev/orchestrator/steps/generate-api-client-orchestrator-step.d.ts +2 -4
- package/dist/cli/utilities/dev/orchestrator/steps/register-app-orchestrator-step.d.ts +1 -1
- package/dist/cli/utilities/version/get-server-version-from-api.d.ts +1 -0
- package/dist/cli.cjs +25 -32
- package/dist/cli.mjs +39604 -39589
- package/dist/define/index.cjs +19 -19
- package/dist/define/index.cjs.map +1 -1
- package/dist/define/index.d.ts +96 -18
- package/dist/define/index.mjs +5362 -5306
- package/dist/define/index.mjs.map +1 -1
- package/dist/front-component/index.cjs.map +1 -1
- package/dist/front-component/index.d.ts +1 -0
- package/dist/front-component/index.mjs +1 -1
- package/dist/front-component/index.mjs.map +1 -1
- package/dist/front-component-renderer/build.cjs +1 -1
- package/dist/front-component-renderer/build.mjs +6 -2
- package/dist/{get-front-component-build-plugins-Dqpyup2W.js → get-front-component-build-plugins-C7h3DVdC.js} +2 -2
- package/dist/{get-front-component-build-plugins-taotEFOp.mjs → get-front-component-build-plugins-klRAsPTE.mjs} +39 -32
- package/dist/get-function-input-schema-GNk3NRLJ-DSwo3Odm.mjs +77 -0
- package/dist/logic-function/index.cjs.map +1 -1
- package/dist/logic-function/index.mjs.map +1 -1
- package/dist/{login-Dasbw3em.mjs → login-BBQP9LPn.mjs} +6726 -6700
- package/dist/{login-eEfUoaiV.js → login-zBnjqpkc.js} +60 -47
- package/dist/operations.cjs +1 -1
- package/dist/operations.mjs +8 -4
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/catalog-sync-COKCJ_xf.mjs +0 -14
- package/dist/cli/utilities/build/manifest/utils/get-default-object-fields.d.ts +0 -6
- package/dist/get-function-input-schema-GNk3NRLJ-BoFRwEYV.mjs +0 -73
package/dist/operations.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./login-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./login-zBnjqpkc.js");var t=async t=>(t?.remote&&e.U.setActiveRemote(t.remote),await new e.U().clearConfig(),{success:!0,data:void 0}),n=n=>e.X(()=>t(n),e.q.AUTH_FAILED),r=`eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyMDIwMjAyMC0xYzI1LTRkMDItYmYyNS02YWVjY2Y3ZWE0MTkiLCJ0eXBlIjoiQVBJX0tFWSIsIndvcmtzcGFjZUlkIjoiMjAyMDIwMjAtMWMyNS00ZDAyLWJmMjUtNmFlY2NmN2VhNDE5IiwiaWF0IjoxNzM1Njg5NjAwLCJleHAiOjQ4OTE0NDk2MDAsImp0aSI6IjIwMjAyMDIwLWY0MDEtNGQ4YS1hNzMxLTY0ZDAwN2MyN2JhZCJ9.bfQjfyN0NEtTCLE_xPyNcwonDzlSXFoP8kdCQTdnuDc`,i=`http://localhost:2020`;exports.APP_ERROR_CODES=e.K,exports.AUTH_ERROR_CODES=e.q,exports.ConfigService=e.U,exports.DEV_API_KEY=r,exports.DEV_API_URL=i,exports.FUNCTION_ERROR_CODES=e.J,exports.SERVER_ERROR_CODES=e.Y,exports.appBuild=e.G,exports.appDeploy=e.R,exports.appDevOnce=e.a,exports.appInstall=e.N,exports.appPublish=e.L,exports.appUninstall=e.v,exports.authLogin=e.t,exports.authLoginOAuth=e.H,exports.authLogout=n,exports.checkDockerRunning=e.T,exports.containerExists=e.E,exports.detectLocalServer=e.m,exports.functionExecute=e._,exports.getContainerDigest=e.D,exports.getEngineVersionRange=e.et,exports.getImageDigest=e.A,exports.getImageForVersion=e.j,exports.resolveHighestEngineVersion=e.r,exports.serverStart=e.n,exports.serverUpgrade=e.i;
|
package/dist/operations.mjs
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createRequire as e } from "node:module";
|
|
2
|
+
import { fileURLToPath as t } from "node:url";
|
|
3
|
+
import { dirname as n } from "node:path";
|
|
4
|
+
e(import.meta.url), n(t(import.meta.url));
|
|
5
|
+
import { A as r, D as i, E as a, G as o, H as s, J as c, K as l, L as u, N as d, R as f, T as p, U as m, X as h, Y as g, _, a as v, et as y, i as b, j as x, m as S, n as C, q as w, r as T, t as E, v as D } from "./login-BBQP9LPn.mjs";
|
|
2
6
|
//#region src/cli/operations/logout.ts
|
|
3
|
-
var
|
|
7
|
+
var O = async (e) => (e?.remote && m.setActiveRemote(e.remote), await new m().clearConfig(), {
|
|
4
8
|
success: !0,
|
|
5
9
|
data: void 0
|
|
6
|
-
}),
|
|
10
|
+
}), k = (e) => h(() => O(e), w.AUTH_FAILED), A = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyMDIwMjAyMC0xYzI1LTRkMDItYmYyNS02YWVjY2Y3ZWE0MTkiLCJ0eXBlIjoiQVBJX0tFWSIsIndvcmtzcGFjZUlkIjoiMjAyMDIwMjAtMWMyNS00ZDAyLWJmMjUtNmFlY2NmN2VhNDE5IiwiaWF0IjoxNzM1Njg5NjAwLCJleHAiOjQ4OTE0NDk2MDAsImp0aSI6IjIwMjAyMDIwLWY0MDEtNGQ4YS1hNzMxLTY0ZDAwN2MyN2JhZCJ9.bfQjfyN0NEtTCLE_xPyNcwonDzlSXFoP8kdCQTdnuDc", j = "http://localhost:2020";
|
|
7
11
|
//#endregion
|
|
8
|
-
export {
|
|
12
|
+
export { l as APP_ERROR_CODES, w as AUTH_ERROR_CODES, m as ConfigService, A as DEV_API_KEY, j as DEV_API_URL, c as FUNCTION_ERROR_CODES, g as SERVER_ERROR_CODES, o as appBuild, f as appDeploy, v as appDevOnce, d as appInstall, u as appPublish, D as appUninstall, E as authLogin, s as authLoginOAuth, k as authLogout, p as checkDockerRunning, a as containerExists, S as detectLocalServer, _ as functionExecute, i as getContainerDigest, y as getEngineVersionRange, r as getImageDigest, x as getImageForVersion, T as resolveHighestEngineVersion, C as serverStart, b as serverUpgrade };
|
package/dist/utils/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["e","t","t","n","e","n","t"],"sources":["../../../twenty-shared/dist/ViewKey-YV4NySfb.mjs","../../../twenty-shared/dist/get-field-universal-identifier.util-CK9_m9RQ.mjs","../../../twenty-shared/dist/application.mjs","../../src/sdk/utils/get-public-asset-url.ts","../../../twenty-shared/dist/isDefined-Dtu5EYqP.mjs"],"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});\n//#endregion\nexport { n, t as r, r as t };\n","import { n as e, t } from \"./ViewKey-YV4NySfb.mjs\";\nimport { n, r, t as i } from \"./get-field-universal-identifier.util-CK9_m9RQ.mjs\";\n//#region src/application/applicationVariablesType.ts\nvar a = [\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], o = \"public\", s = \"TWENTY_API_KEY\", c = \"TWENTY_API_URL\", l = \"TWENTY_APP_ACCESS_TOKEN\", u = \"TWENTY_FUNCTIONS_URL\", d = \"generated\", f = { js: \"import { createRequire as __createRequire } from 'module';\\nconst require = __createRequire(import.meta.url);\" }, p = \".twenty/output\", m = \"Standard\", h = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"agent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), g = ({ applicationUniversalIdentifier: e, key: t }) => n({\n\tentityNamespace: \"applicationVariable\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), _ = \"navigation\", v = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL:${t}`,\n\tapplicationUniversalIdentifier: e\n}), y = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL_OBJECT_CONTEXT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), b = ({ applicationUniversalIdentifier: e, engineComponentKey: t, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `RECORD_SELECTION:${t}:${r ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), x = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `${t}:${_}`,\n\tapplicationUniversalIdentifier: e\n}), S = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"connectionProvider\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), C = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, fieldUniversalIdentifier: r }) => n({\n\tentityNamespace: \"fieldPermission\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), w = ({ applicationUniversalIdentifier: e, componentName: t }) => n({\n\tentityNamespace: \"frontComponent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), T = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"index\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), E = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"logicFunction\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), D = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `FOLDER:${t}`,\n\tapplicationUniversalIdentifier: e\n}), O = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `OBJECT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), k = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `VIEW:${t}`,\n\tapplicationUniversalIdentifier: e\n}), A = ({ applicationUniversalIdentifier: e, link: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `LINK:${t}`,\n\tapplicationUniversalIdentifier: e\n}), j = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"objectPermission\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), M = ({ applicationUniversalIdentifier: e, nameSingular: t }) => n({\n\tentityNamespace: \"objectMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), N = ({ applicationUniversalIdentifier: e, pageLayoutUniversalIdentifier: t, title: r }) => n({\n\tentityNamespace: \"pageLayoutTab\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), P = \"RECORD_PAGE\", F = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"pageLayout\",\n\tvalue: t ? `${t}:${r}` : r,\n\tapplicationUniversalIdentifier: e\n}), I = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"pageLayout\",\n\tvalue: `${t}:${P}`,\n\tapplicationUniversalIdentifier: e\n}), L = ({ applicationUniversalIdentifier: e, pageLayoutTabUniversalIdentifier: t, title: r }) => n({\n\tentityNamespace: \"pageLayoutWidget\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), R = ({ applicationUniversalIdentifier: e, key: t }) => n({\n\tentityNamespace: \"permissionFlag\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), z = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, permissionFlagUniversalIdentifier: r }) => n({\n\tentityNamespace: \"rolePermissionFlag\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), B = ({ applicationUniversalIdentifier: e, label: t }) => n({\n\tentityNamespace: \"role\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), V = ({ applicationUniversalIdentifier: e, fieldMetadataUniversalIdentifier: t }) => n({\n\tentityNamespace: \"searchFieldMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), H = ({ applicationUniversalIdentifier: e, fieldUniversalIdentifier: t, value: r }) => n({\n\tentityNamespace: \"selectOption\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), U = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"skill\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), W = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"viewFieldGroup\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), G = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r }) => n({\n\tentityNamespace: \"viewField\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), K = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r, operand: i, subFieldName: a }) => n({\n\tentityNamespace: \"viewFilter\",\n\tvalue: `${t}:${r}:${i}:${a ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), q = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldValue: r }) => n({\n\tentityNamespace: \"viewGroup\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), J = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r }) => n({\n\tentityNamespace: \"viewSort\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), Y = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"view\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), X = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"view\",\n\tvalue: `${r}:${t.INDEX}`,\n\tapplicationUniversalIdentifier: e\n}), Z = ({ applicationUniversalIdentifier: e, pageLayoutWidgetUniversalIdentifier: t }) => n({\n\tentityNamespace: \"view\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), Q = /* @__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}({}), $ = (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}, ee = (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 { a as APPLICATION_VARIABLE_FIELD_METADATA_TYPES, o as ASSETS_DIR, s as DEFAULT_API_KEY_NAME, c as DEFAULT_API_URL_NAME, l as DEFAULT_APP_ACCESS_TOKEN_NAME, u as DEFAULT_FUNCTIONS_URL_NAME, d as GENERATED_DIR, f as NODE_ESM_CJS_BANNER, p as OUTPUT_DIR, Q as SyncableEntity, m as TWENTY_STANDARD_APPLICATION_NAME, r as TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER, n as computeDeterministicUuid, ee as deserializeApplicationVariableValue, h as getAgentUniversalIdentifier, g as getApplicationVariableUniversalIdentifier, S as getConnectionProviderUniversalIdentifier, C as getFieldPermissionUniversalIdentifier, i as getFieldUniversalIdentifier, Z as getFieldsWidgetViewUniversalIdentifier, D as getFolderNavigationMenuItemUniversalIdentifier, w as getFrontComponentUniversalIdentifier, v as getGlobalCommandMenuItemUniversalIdentifier, y as getGlobalObjectContextCommandMenuItemUniversalIdentifier, T as getIndexUniversalIdentifier, X as getIndexViewUniversalIdentifier, A as getLinkNavigationMenuItemUniversalIdentifier, E as getLogicFunctionUniversalIdentifier, x as getNavigationCommandUniversalIdentifier, O as getObjectNavigationMenuItemUniversalIdentifier, j as getObjectPermissionUniversalIdentifier, M as getObjectUniversalIdentifier, N as getPageLayoutTabUniversalIdentifier, F as getPageLayoutUniversalIdentifier, L as getPageLayoutWidgetUniversalIdentifier, R as getPermissionFlagUniversalIdentifier, I as getRecordPageLayoutUniversalIdentifier, b as getRecordSelectionCommandMenuItemUniversalIdentifier, z as getRolePermissionFlagUniversalIdentifier, B as getRoleUniversalIdentifier, V as getSearchFieldUniversalIdentifier, H as getSelectOptionUniversalIdentifier, U as getSkillUniversalIdentifier, W as getViewFieldGroupUniversalIdentifier, G as getViewFieldUniversalIdentifier, K as getViewFilterUniversalIdentifier, q as getViewGroupUniversalIdentifier, k as getViewNavigationMenuItemUniversalIdentifier, J as getViewSortUniversalIdentifier, Y as getViewUniversalIdentifier, $ as serializeApplicationVariableValue };\n","import {\n DEFAULT_API_URL_NAME,\n DEFAULT_APP_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application';\n\nconst decodeTokenPayload = (\n token: string,\n): { workspaceId: string; applicationId: string } => {\n const payload = JSON.parse(atob(token.split('.')[1]));\n\n return {\n workspaceId: payload.workspaceId,\n applicationId: payload.applicationId,\n };\n};\n\n// Returns the public URL for a file in the app's public/ directory.\n// Works in both logic functions and front components.\n// The path is relative to the public/ folder (e.g. \"images/logo.png\").\nexport const getPublicAssetUrl = (path: string): string => {\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 throw new Error(\n 'getPublicAssetUrl can only be called from within a logic function or front component',\n );\n }\n\n const { workspaceId, applicationId } = decodeTokenPayload(token);\n const withoutLeadingSlash = path.startsWith('/') ? path.slice(1) : path;\n const withPublicPrefix = withoutLeadingSlash.startsWith('public/')\n ? withoutLeadingSlash\n : `public/${withoutLeadingSlash}`;\n\n const encodedPath = withPublicPrefix\n .split('/')\n .map(encodeURIComponent)\n .join('/');\n\n return `${apiUrl}/public-assets/${workspaceId}/${applicationId}/${encodedPath}`;\n};\n","import { isNull as e, isUndefined as t } from \"@sniptt/guards\";\n//#region src/utils/validation/isDefined.ts\nvar n = (n) => !t(n) && !e(n);\n//#endregion\nexport { n as t };\n"],"mappings":"mHACA,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,EECHI,EAAE,KACFA,EAAE,MACFA,EAAE,QACFA,EAAE,KACFA,EAAE,UACFA,EAAE,OACFA,EAAE,QACFA,EAAE,SACFA,EAAE,UACFA,EAAE,OACFA,EAAE,aAXH,IAYuC,EAAI,iBAAkB,EAAI,0BCV3D,EACJ,GACmD,CACnD,IAAM,EAAU,KAAK,MAAM,KAAK,EAAM,MAAM,GAAG,EAAE,EAAE,CAAC,EAEpD,MAAO,CACL,YAAa,EAAQ,YACrB,cAAe,EAAQ,aACzB,CACF,EAKa,EAAqB,GAAyB,CACzD,IAAM,EAAS,QAAQ,IAAI,GACrB,EAAQ,QAAQ,IAAI,GAE1B,GAAI,CAAC,GAAU,CAAC,EACd,MAAU,MACR,sFACF,EAGF,GAAM,CAAE,cAAa,iBAAkB,EAAmB,CAAK,EACzD,EAAsB,EAAK,WAAW,GAAG,EAAI,EAAK,MAAM,CAAC,EAAI,EAUnE,MAAO,GAAG,EAAO,iBAAiB,EAAY,GAAG,EAAc,IATtC,EAAoB,WAAW,SAAS,EAC7D,EACA,UAAU,KAGX,MAAM,GAAG,EACT,IAAI,kBAAkB,EACtB,KAAK,GAE0D,GACpE,ECvCI,EAAK,GAAM,EAAA,EAAA,EAAA,aAAG,CAAC,GAAK,EAAA,EAAA,EAAA,QAAG,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["e","t","t","n","e","n","t"],"sources":["../../../twenty-shared/dist/ViewKey-YV4NySfb.mjs","../../../twenty-shared/dist/get-field-universal-identifier.util-CK9_m9RQ.mjs","../../../twenty-shared/dist/application.mjs","../../src/sdk/utils/get-public-asset-url.ts","../../../twenty-shared/dist/isDefined-Dtu5EYqP.mjs"],"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});\n//#endregion\nexport { n, t as r, r as t };\n","import { n as e, t } from \"./ViewKey-YV4NySfb.mjs\";\nimport { n, r, t as i } from \"./get-field-universal-identifier.util-CK9_m9RQ.mjs\";\n//#region src/application/applicationCategoryType.ts\nvar a = [\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], o = (e) => a.includes(e), s = [\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], c = \"public\", l = \"TWENTY_API_KEY\", u = \"TWENTY_API_URL\", d = \"TWENTY_APP_ACCESS_TOKEN\", f = \"TWENTY_FUNCTIONS_URL\", p = \"generated\", m = { js: \"import { createRequire as __createRequire } from 'module';\\nconst require = __createRequire(import.meta.url);\" }, h = \".twenty/output\", g = \"Standard\", _ = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"agent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), v = ({ applicationUniversalIdentifier: e, key: t }) => n({\n\tentityNamespace: \"applicationVariable\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), y = \"navigation\", b = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL:${t}`,\n\tapplicationUniversalIdentifier: e\n}), x = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL_OBJECT_CONTEXT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), S = ({ applicationUniversalIdentifier: e, engineComponentKey: t, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `RECORD_SELECTION:${t}:${r ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), C = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `${t}:${y}`,\n\tapplicationUniversalIdentifier: e\n}), w = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"connectionProvider\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), T = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, fieldUniversalIdentifier: r }) => n({\n\tentityNamespace: \"fieldPermission\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), E = ({ applicationUniversalIdentifier: e, componentName: t }) => n({\n\tentityNamespace: \"frontComponent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), D = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"index\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), O = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"logicFunction\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), k = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `FOLDER:${t}`,\n\tapplicationUniversalIdentifier: e\n}), A = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `OBJECT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), ee = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `VIEW:${t}`,\n\tapplicationUniversalIdentifier: e\n}), j = ({ applicationUniversalIdentifier: e, link: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `LINK:${t}`,\n\tapplicationUniversalIdentifier: e\n}), M = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"objectPermission\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), N = ({ applicationUniversalIdentifier: e, nameSingular: t }) => n({\n\tentityNamespace: \"objectMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), P = ({ applicationUniversalIdentifier: e, pageLayoutUniversalIdentifier: t, title: r }) => n({\n\tentityNamespace: \"pageLayoutTab\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), F = \"RECORD_PAGE\", I = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"pageLayout\",\n\tvalue: t ? `${t}:${r}` : r,\n\tapplicationUniversalIdentifier: e\n}), L = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"pageLayout\",\n\tvalue: `${t}:${F}`,\n\tapplicationUniversalIdentifier: e\n}), R = ({ applicationUniversalIdentifier: e, pageLayoutTabUniversalIdentifier: t, title: r }) => n({\n\tentityNamespace: \"pageLayoutWidget\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), z = ({ applicationUniversalIdentifier: e, key: t }) => n({\n\tentityNamespace: \"permissionFlag\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), B = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, permissionFlagUniversalIdentifier: r }) => n({\n\tentityNamespace: \"rolePermissionFlag\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), V = ({ applicationUniversalIdentifier: e, label: t }) => n({\n\tentityNamespace: \"role\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), H = ({ applicationUniversalIdentifier: e, fieldMetadataUniversalIdentifier: t }) => n({\n\tentityNamespace: \"searchFieldMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), U = ({ applicationUniversalIdentifier: e, fieldUniversalIdentifier: t, value: r }) => n({\n\tentityNamespace: \"selectOption\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), W = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"skill\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), G = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"viewFieldGroup\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), K = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r }) => n({\n\tentityNamespace: \"viewField\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), q = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r, operand: i, subFieldName: a }) => n({\n\tentityNamespace: \"viewFilter\",\n\tvalue: `${t}:${r}:${i}:${a ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), J = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldValue: r }) => n({\n\tentityNamespace: \"viewGroup\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), Y = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r }) => n({\n\tentityNamespace: \"viewSort\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), X = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"view\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), Z = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"view\",\n\tvalue: `${r}:${t.INDEX}`,\n\tapplicationUniversalIdentifier: e\n}), Q = ({ applicationUniversalIdentifier: e, pageLayoutWidgetUniversalIdentifier: t }) => n({\n\tentityNamespace: \"view\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), $ = /* @__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}({}), te = (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}, ne = (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 { a as APPLICATION_CATEGORIES, s as APPLICATION_VARIABLE_FIELD_METADATA_TYPES, c as ASSETS_DIR, l as DEFAULT_API_KEY_NAME, u as DEFAULT_API_URL_NAME, d as DEFAULT_APP_ACCESS_TOKEN_NAME, f as DEFAULT_FUNCTIONS_URL_NAME, p as GENERATED_DIR, m as NODE_ESM_CJS_BANNER, h as OUTPUT_DIR, $ as SyncableEntity, g as TWENTY_STANDARD_APPLICATION_NAME, r as TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER, n as computeDeterministicUuid, ne as deserializeApplicationVariableValue, _ as getAgentUniversalIdentifier, v as getApplicationVariableUniversalIdentifier, w as getConnectionProviderUniversalIdentifier, T as getFieldPermissionUniversalIdentifier, i as getFieldUniversalIdentifier, Q as getFieldsWidgetViewUniversalIdentifier, k as getFolderNavigationMenuItemUniversalIdentifier, E as getFrontComponentUniversalIdentifier, b as getGlobalCommandMenuItemUniversalIdentifier, x as getGlobalObjectContextCommandMenuItemUniversalIdentifier, D as getIndexUniversalIdentifier, Z as getIndexViewUniversalIdentifier, j as getLinkNavigationMenuItemUniversalIdentifier, O as getLogicFunctionUniversalIdentifier, C as getNavigationCommandUniversalIdentifier, A as getObjectNavigationMenuItemUniversalIdentifier, M as getObjectPermissionUniversalIdentifier, N as getObjectUniversalIdentifier, P as getPageLayoutTabUniversalIdentifier, I as getPageLayoutUniversalIdentifier, R as getPageLayoutWidgetUniversalIdentifier, z as getPermissionFlagUniversalIdentifier, L as getRecordPageLayoutUniversalIdentifier, S as getRecordSelectionCommandMenuItemUniversalIdentifier, B as getRolePermissionFlagUniversalIdentifier, V as getRoleUniversalIdentifier, H as getSearchFieldUniversalIdentifier, U as getSelectOptionUniversalIdentifier, W as getSkillUniversalIdentifier, G as getViewFieldGroupUniversalIdentifier, K as getViewFieldUniversalIdentifier, q as getViewFilterUniversalIdentifier, J as getViewGroupUniversalIdentifier, ee as getViewNavigationMenuItemUniversalIdentifier, Y as getViewSortUniversalIdentifier, X as getViewUniversalIdentifier, o as isKnownApplicationCategory, te as serializeApplicationVariableValue };\n","import {\n DEFAULT_API_URL_NAME,\n DEFAULT_APP_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application';\n\nconst decodeTokenPayload = (\n token: string,\n): { workspaceId: string; applicationId: string } => {\n const payload = JSON.parse(atob(token.split('.')[1]));\n\n return {\n workspaceId: payload.workspaceId,\n applicationId: payload.applicationId,\n };\n};\n\n// Returns the public URL for a file in the app's public/ directory.\n// Works in both logic functions and front components.\n// The path is relative to the public/ folder (e.g. \"images/logo.png\").\nexport const getPublicAssetUrl = (path: string): string => {\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 throw new Error(\n 'getPublicAssetUrl can only be called from within a logic function or front component',\n );\n }\n\n const { workspaceId, applicationId } = decodeTokenPayload(token);\n const withoutLeadingSlash = path.startsWith('/') ? path.slice(1) : path;\n const withPublicPrefix = withoutLeadingSlash.startsWith('public/')\n ? withoutLeadingSlash\n : `public/${withoutLeadingSlash}`;\n\n const encodedPath = withPublicPrefix\n .split('/')\n .map(encodeURIComponent)\n .join('/');\n\n return `${apiUrl}/public-assets/${workspaceId}/${applicationId}/${encodedPath}`;\n};\n","import { isNull as e, isUndefined as t } from \"@sniptt/guards\";\n//#region src/utils/validation/isDefined.ts\nvar n = (n) => !t(n) && !e(n);\n//#endregion\nexport { n as t };\n"],"mappings":"mHACA,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,EEWHI,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,EACJ,GACmD,CACnD,IAAM,EAAU,KAAK,MAAM,KAAK,EAAM,MAAM,GAAG,EAAE,EAAE,CAAC,EAEpD,MAAO,CACL,YAAa,EAAQ,YACrB,cAAe,EAAQ,aACzB,CACF,EAKa,EAAqB,GAAyB,CACzD,IAAM,EAAS,QAAQ,IAAI,GACrB,EAAQ,QAAQ,IAAI,GAE1B,GAAI,CAAC,GAAU,CAAC,EACd,MAAU,MACR,sFACF,EAGF,GAAM,CAAE,cAAa,iBAAkB,EAAmB,CAAK,EACzD,EAAsB,EAAK,WAAW,GAAG,EAAI,EAAK,MAAM,CAAC,EAAI,EAUnE,MAAO,GAAG,EAAO,iBAAiB,EAAY,GAAG,EAAc,IATtC,EAAoB,WAAW,SAAS,EAC7D,EACA,UAAU,KAGX,MAAM,GAAG,EACT,IAAI,kBAAkB,EACtB,KAAK,GAE0D,GACpE,ECvCI,EAAK,GAAM,EAAA,EAAA,EAAA,aAAG,CAAC,GAAK,EAAA,EAAA,EAAA,QAAG,CAAC"}
|
package/dist/utils/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["t","n","e","n","t","t","e"],"sources":["../../../twenty-shared/dist/ViewKey-YV4NySfb.mjs","../../../twenty-shared/dist/get-field-universal-identifier.util-CK9_m9RQ.mjs","../../../twenty-shared/dist/application.mjs","../../src/sdk/utils/get-public-asset-url.ts","../../../twenty-shared/dist/isDefined-Dtu5EYqP.mjs"],"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});\n//#endregion\nexport { n, t as r, r as t };\n","import { n as e, t } from \"./ViewKey-YV4NySfb.mjs\";\nimport { n, r, t as i } from \"./get-field-universal-identifier.util-CK9_m9RQ.mjs\";\n//#region src/application/applicationVariablesType.ts\nvar a = [\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], o = \"public\", s = \"TWENTY_API_KEY\", c = \"TWENTY_API_URL\", l = \"TWENTY_APP_ACCESS_TOKEN\", u = \"TWENTY_FUNCTIONS_URL\", d = \"generated\", f = { js: \"import { createRequire as __createRequire } from 'module';\\nconst require = __createRequire(import.meta.url);\" }, p = \".twenty/output\", m = \"Standard\", h = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"agent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), g = ({ applicationUniversalIdentifier: e, key: t }) => n({\n\tentityNamespace: \"applicationVariable\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), _ = \"navigation\", v = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL:${t}`,\n\tapplicationUniversalIdentifier: e\n}), y = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL_OBJECT_CONTEXT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), b = ({ applicationUniversalIdentifier: e, engineComponentKey: t, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `RECORD_SELECTION:${t}:${r ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), x = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `${t}:${_}`,\n\tapplicationUniversalIdentifier: e\n}), S = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"connectionProvider\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), C = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, fieldUniversalIdentifier: r }) => n({\n\tentityNamespace: \"fieldPermission\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), w = ({ applicationUniversalIdentifier: e, componentName: t }) => n({\n\tentityNamespace: \"frontComponent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), T = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"index\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), E = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"logicFunction\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), D = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `FOLDER:${t}`,\n\tapplicationUniversalIdentifier: e\n}), O = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `OBJECT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), k = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `VIEW:${t}`,\n\tapplicationUniversalIdentifier: e\n}), A = ({ applicationUniversalIdentifier: e, link: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `LINK:${t}`,\n\tapplicationUniversalIdentifier: e\n}), j = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"objectPermission\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), M = ({ applicationUniversalIdentifier: e, nameSingular: t }) => n({\n\tentityNamespace: \"objectMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), N = ({ applicationUniversalIdentifier: e, pageLayoutUniversalIdentifier: t, title: r }) => n({\n\tentityNamespace: \"pageLayoutTab\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), P = \"RECORD_PAGE\", F = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"pageLayout\",\n\tvalue: t ? `${t}:${r}` : r,\n\tapplicationUniversalIdentifier: e\n}), I = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"pageLayout\",\n\tvalue: `${t}:${P}`,\n\tapplicationUniversalIdentifier: e\n}), L = ({ applicationUniversalIdentifier: e, pageLayoutTabUniversalIdentifier: t, title: r }) => n({\n\tentityNamespace: \"pageLayoutWidget\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), R = ({ applicationUniversalIdentifier: e, key: t }) => n({\n\tentityNamespace: \"permissionFlag\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), z = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, permissionFlagUniversalIdentifier: r }) => n({\n\tentityNamespace: \"rolePermissionFlag\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), B = ({ applicationUniversalIdentifier: e, label: t }) => n({\n\tentityNamespace: \"role\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), V = ({ applicationUniversalIdentifier: e, fieldMetadataUniversalIdentifier: t }) => n({\n\tentityNamespace: \"searchFieldMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), H = ({ applicationUniversalIdentifier: e, fieldUniversalIdentifier: t, value: r }) => n({\n\tentityNamespace: \"selectOption\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), U = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"skill\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), W = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"viewFieldGroup\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), G = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r }) => n({\n\tentityNamespace: \"viewField\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), K = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r, operand: i, subFieldName: a }) => n({\n\tentityNamespace: \"viewFilter\",\n\tvalue: `${t}:${r}:${i}:${a ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), q = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldValue: r }) => n({\n\tentityNamespace: \"viewGroup\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), J = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r }) => n({\n\tentityNamespace: \"viewSort\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), Y = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"view\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), X = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"view\",\n\tvalue: `${r}:${t.INDEX}`,\n\tapplicationUniversalIdentifier: e\n}), Z = ({ applicationUniversalIdentifier: e, pageLayoutWidgetUniversalIdentifier: t }) => n({\n\tentityNamespace: \"view\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), Q = /* @__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}({}), $ = (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}, ee = (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 { a as APPLICATION_VARIABLE_FIELD_METADATA_TYPES, o as ASSETS_DIR, s as DEFAULT_API_KEY_NAME, c as DEFAULT_API_URL_NAME, l as DEFAULT_APP_ACCESS_TOKEN_NAME, u as DEFAULT_FUNCTIONS_URL_NAME, d as GENERATED_DIR, f as NODE_ESM_CJS_BANNER, p as OUTPUT_DIR, Q as SyncableEntity, m as TWENTY_STANDARD_APPLICATION_NAME, r as TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER, n as computeDeterministicUuid, ee as deserializeApplicationVariableValue, h as getAgentUniversalIdentifier, g as getApplicationVariableUniversalIdentifier, S as getConnectionProviderUniversalIdentifier, C as getFieldPermissionUniversalIdentifier, i as getFieldUniversalIdentifier, Z as getFieldsWidgetViewUniversalIdentifier, D as getFolderNavigationMenuItemUniversalIdentifier, w as getFrontComponentUniversalIdentifier, v as getGlobalCommandMenuItemUniversalIdentifier, y as getGlobalObjectContextCommandMenuItemUniversalIdentifier, T as getIndexUniversalIdentifier, X as getIndexViewUniversalIdentifier, A as getLinkNavigationMenuItemUniversalIdentifier, E as getLogicFunctionUniversalIdentifier, x as getNavigationCommandUniversalIdentifier, O as getObjectNavigationMenuItemUniversalIdentifier, j as getObjectPermissionUniversalIdentifier, M as getObjectUniversalIdentifier, N as getPageLayoutTabUniversalIdentifier, F as getPageLayoutUniversalIdentifier, L as getPageLayoutWidgetUniversalIdentifier, R as getPermissionFlagUniversalIdentifier, I as getRecordPageLayoutUniversalIdentifier, b as getRecordSelectionCommandMenuItemUniversalIdentifier, z as getRolePermissionFlagUniversalIdentifier, B as getRoleUniversalIdentifier, V as getSearchFieldUniversalIdentifier, H as getSelectOptionUniversalIdentifier, U as getSkillUniversalIdentifier, W as getViewFieldGroupUniversalIdentifier, G as getViewFieldUniversalIdentifier, K as getViewFilterUniversalIdentifier, q as getViewGroupUniversalIdentifier, k as getViewNavigationMenuItemUniversalIdentifier, J as getViewSortUniversalIdentifier, Y as getViewUniversalIdentifier, $ as serializeApplicationVariableValue };\n","import {\n DEFAULT_API_URL_NAME,\n DEFAULT_APP_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application';\n\nconst decodeTokenPayload = (\n token: string,\n): { workspaceId: string; applicationId: string } => {\n const payload = JSON.parse(atob(token.split('.')[1]));\n\n return {\n workspaceId: payload.workspaceId,\n applicationId: payload.applicationId,\n };\n};\n\n// Returns the public URL for a file in the app's public/ directory.\n// Works in both logic functions and front components.\n// The path is relative to the public/ folder (e.g. \"images/logo.png\").\nexport const getPublicAssetUrl = (path: string): string => {\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 throw new Error(\n 'getPublicAssetUrl can only be called from within a logic function or front component',\n );\n }\n\n const { workspaceId, applicationId } = decodeTokenPayload(token);\n const withoutLeadingSlash = path.startsWith('/') ? path.slice(1) : path;\n const withPublicPrefix = withoutLeadingSlash.startsWith('public/')\n ? withoutLeadingSlash\n : `public/${withoutLeadingSlash}`;\n\n const encodedPath = withPublicPrefix\n .split('/')\n .map(encodeURIComponent)\n .join('/');\n\n return `${apiUrl}/public-assets/${workspaceId}/${applicationId}/${encodedPath}`;\n};\n","import { isNull as e, isUndefined as t } from \"@sniptt/guards\";\n//#region src/utils/validation/isDefined.ts\nvar n = (n) => !t(n) && !e(n);\n//#endregion\nexport { n as t };\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;AECH,EAAE,MACF,EAAE,OACF,EAAE,SACF,EAAE,MACF,EAAE,WACF,EAAE,QACF,EAAE,SACF,EAAE,UACF,EAAE,WACF,EAAE,QACF,EAAE;;;AAXH,IAYuC,IAAI,kBAAkB,IAAI,2BCV3D,KACJ,MACmD;CACnD,IAAM,IAAU,KAAK,MAAM,KAAK,EAAM,MAAM,GAAG,EAAE,EAAE,CAAC;CAEpD,OAAO;EACL,aAAa,EAAQ;EACrB,eAAe,EAAQ;CACzB;AACF,GAKa,KAAqB,MAAyB;CACzD,IAAM,IAAS,QAAQ,IAAI,IACrB,IAAQ,QAAQ,IAAI;CAE1B,IAAI,CAAC,KAAU,CAAC,GACd,MAAU,MACR,sFACF;CAGF,IAAM,EAAE,gBAAa,qBAAkB,EAAmB,CAAK,GACzD,IAAsB,EAAK,WAAW,GAAG,IAAI,EAAK,MAAM,CAAC,IAAI;CAUnE,OAAO,GAAG,EAAO,iBAAiB,EAAY,GAAG,EAAc,IATtC,EAAoB,WAAW,SAAS,IAC7D,IACA,UAAU,KAGX,MAAM,GAAG,EACT,IAAI,kBAAkB,EACtB,KAAK,GAE0D;AACpE,GCvCI,KAAK,MAAM,CAACK,EAAE,CAAC,KAAK,CAACC,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["t","n","e","n","t","t","e"],"sources":["../../../twenty-shared/dist/ViewKey-YV4NySfb.mjs","../../../twenty-shared/dist/get-field-universal-identifier.util-CK9_m9RQ.mjs","../../../twenty-shared/dist/application.mjs","../../src/sdk/utils/get-public-asset-url.ts","../../../twenty-shared/dist/isDefined-Dtu5EYqP.mjs"],"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});\n//#endregion\nexport { n, t as r, r as t };\n","import { n as e, t } from \"./ViewKey-YV4NySfb.mjs\";\nimport { n, r, t as i } from \"./get-field-universal-identifier.util-CK9_m9RQ.mjs\";\n//#region src/application/applicationCategoryType.ts\nvar a = [\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], o = (e) => a.includes(e), s = [\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], c = \"public\", l = \"TWENTY_API_KEY\", u = \"TWENTY_API_URL\", d = \"TWENTY_APP_ACCESS_TOKEN\", f = \"TWENTY_FUNCTIONS_URL\", p = \"generated\", m = { js: \"import { createRequire as __createRequire } from 'module';\\nconst require = __createRequire(import.meta.url);\" }, h = \".twenty/output\", g = \"Standard\", _ = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"agent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), v = ({ applicationUniversalIdentifier: e, key: t }) => n({\n\tentityNamespace: \"applicationVariable\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), y = \"navigation\", b = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL:${t}`,\n\tapplicationUniversalIdentifier: e\n}), x = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL_OBJECT_CONTEXT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), S = ({ applicationUniversalIdentifier: e, engineComponentKey: t, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `RECORD_SELECTION:${t}:${r ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), C = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `${t}:${y}`,\n\tapplicationUniversalIdentifier: e\n}), w = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"connectionProvider\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), T = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, fieldUniversalIdentifier: r }) => n({\n\tentityNamespace: \"fieldPermission\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), E = ({ applicationUniversalIdentifier: e, componentName: t }) => n({\n\tentityNamespace: \"frontComponent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), D = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"index\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), O = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"logicFunction\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), k = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `FOLDER:${t}`,\n\tapplicationUniversalIdentifier: e\n}), A = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `OBJECT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), ee = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `VIEW:${t}`,\n\tapplicationUniversalIdentifier: e\n}), j = ({ applicationUniversalIdentifier: e, link: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `LINK:${t}`,\n\tapplicationUniversalIdentifier: e\n}), M = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"objectPermission\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), N = ({ applicationUniversalIdentifier: e, nameSingular: t }) => n({\n\tentityNamespace: \"objectMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), P = ({ applicationUniversalIdentifier: e, pageLayoutUniversalIdentifier: t, title: r }) => n({\n\tentityNamespace: \"pageLayoutTab\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), F = \"RECORD_PAGE\", I = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"pageLayout\",\n\tvalue: t ? `${t}:${r}` : r,\n\tapplicationUniversalIdentifier: e\n}), L = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"pageLayout\",\n\tvalue: `${t}:${F}`,\n\tapplicationUniversalIdentifier: e\n}), R = ({ applicationUniversalIdentifier: e, pageLayoutTabUniversalIdentifier: t, title: r }) => n({\n\tentityNamespace: \"pageLayoutWidget\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), z = ({ applicationUniversalIdentifier: e, key: t }) => n({\n\tentityNamespace: \"permissionFlag\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), B = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, permissionFlagUniversalIdentifier: r }) => n({\n\tentityNamespace: \"rolePermissionFlag\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), V = ({ applicationUniversalIdentifier: e, label: t }) => n({\n\tentityNamespace: \"role\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), H = ({ applicationUniversalIdentifier: e, fieldMetadataUniversalIdentifier: t }) => n({\n\tentityNamespace: \"searchFieldMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), U = ({ applicationUniversalIdentifier: e, fieldUniversalIdentifier: t, value: r }) => n({\n\tentityNamespace: \"selectOption\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), W = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"skill\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), G = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"viewFieldGroup\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), K = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r }) => n({\n\tentityNamespace: \"viewField\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), q = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r, operand: i, subFieldName: a }) => n({\n\tentityNamespace: \"viewFilter\",\n\tvalue: `${t}:${r}:${i}:${a ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), J = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldValue: r }) => n({\n\tentityNamespace: \"viewGroup\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), Y = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r }) => n({\n\tentityNamespace: \"viewSort\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), X = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"view\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), Z = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"view\",\n\tvalue: `${r}:${t.INDEX}`,\n\tapplicationUniversalIdentifier: e\n}), Q = ({ applicationUniversalIdentifier: e, pageLayoutWidgetUniversalIdentifier: t }) => n({\n\tentityNamespace: \"view\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), $ = /* @__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}({}), te = (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}, ne = (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 { a as APPLICATION_CATEGORIES, s as APPLICATION_VARIABLE_FIELD_METADATA_TYPES, c as ASSETS_DIR, l as DEFAULT_API_KEY_NAME, u as DEFAULT_API_URL_NAME, d as DEFAULT_APP_ACCESS_TOKEN_NAME, f as DEFAULT_FUNCTIONS_URL_NAME, p as GENERATED_DIR, m as NODE_ESM_CJS_BANNER, h as OUTPUT_DIR, $ as SyncableEntity, g as TWENTY_STANDARD_APPLICATION_NAME, r as TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER, n as computeDeterministicUuid, ne as deserializeApplicationVariableValue, _ as getAgentUniversalIdentifier, v as getApplicationVariableUniversalIdentifier, w as getConnectionProviderUniversalIdentifier, T as getFieldPermissionUniversalIdentifier, i as getFieldUniversalIdentifier, Q as getFieldsWidgetViewUniversalIdentifier, k as getFolderNavigationMenuItemUniversalIdentifier, E as getFrontComponentUniversalIdentifier, b as getGlobalCommandMenuItemUniversalIdentifier, x as getGlobalObjectContextCommandMenuItemUniversalIdentifier, D as getIndexUniversalIdentifier, Z as getIndexViewUniversalIdentifier, j as getLinkNavigationMenuItemUniversalIdentifier, O as getLogicFunctionUniversalIdentifier, C as getNavigationCommandUniversalIdentifier, A as getObjectNavigationMenuItemUniversalIdentifier, M as getObjectPermissionUniversalIdentifier, N as getObjectUniversalIdentifier, P as getPageLayoutTabUniversalIdentifier, I as getPageLayoutUniversalIdentifier, R as getPageLayoutWidgetUniversalIdentifier, z as getPermissionFlagUniversalIdentifier, L as getRecordPageLayoutUniversalIdentifier, S as getRecordSelectionCommandMenuItemUniversalIdentifier, B as getRolePermissionFlagUniversalIdentifier, V as getRoleUniversalIdentifier, H as getSearchFieldUniversalIdentifier, U as getSelectOptionUniversalIdentifier, W as getSkillUniversalIdentifier, G as getViewFieldGroupUniversalIdentifier, K as getViewFieldUniversalIdentifier, q as getViewFilterUniversalIdentifier, J as getViewGroupUniversalIdentifier, ee as getViewNavigationMenuItemUniversalIdentifier, Y as getViewSortUniversalIdentifier, X as getViewUniversalIdentifier, o as isKnownApplicationCategory, te as serializeApplicationVariableValue };\n","import {\n DEFAULT_API_URL_NAME,\n DEFAULT_APP_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application';\n\nconst decodeTokenPayload = (\n token: string,\n): { workspaceId: string; applicationId: string } => {\n const payload = JSON.parse(atob(token.split('.')[1]));\n\n return {\n workspaceId: payload.workspaceId,\n applicationId: payload.applicationId,\n };\n};\n\n// Returns the public URL for a file in the app's public/ directory.\n// Works in both logic functions and front components.\n// The path is relative to the public/ folder (e.g. \"images/logo.png\").\nexport const getPublicAssetUrl = (path: string): string => {\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 throw new Error(\n 'getPublicAssetUrl can only be called from within a logic function or front component',\n );\n }\n\n const { workspaceId, applicationId } = decodeTokenPayload(token);\n const withoutLeadingSlash = path.startsWith('/') ? path.slice(1) : path;\n const withPublicPrefix = withoutLeadingSlash.startsWith('public/')\n ? withoutLeadingSlash\n : `public/${withoutLeadingSlash}`;\n\n const encodedPath = withPublicPrefix\n .split('/')\n .map(encodeURIComponent)\n .join('/');\n\n return `${apiUrl}/public-assets/${workspaceId}/${applicationId}/${encodedPath}`;\n};\n","import { isNull as e, isUndefined as t } from \"@sniptt/guards\";\n//#region src/utils/validation/isDefined.ts\nvar n = (n) => !t(n) && !e(n);\n//#endregion\nexport { n as t };\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,KACJ,MACmD;CACnD,IAAM,IAAU,KAAK,MAAM,KAAK,EAAM,MAAM,GAAG,EAAE,EAAE,CAAC;CAEpD,OAAO;EACL,aAAa,EAAQ;EACrB,eAAe,EAAQ;CACzB;AACF,GAKa,KAAqB,MAAyB;CACzD,IAAM,IAAS,QAAQ,IAAI,IACrB,IAAQ,QAAQ,IAAI;CAE1B,IAAI,CAAC,KAAU,CAAC,GACd,MAAU,MACR,sFACF;CAGF,IAAM,EAAE,gBAAa,qBAAkB,EAAmB,CAAK,GACzD,IAAsB,EAAK,WAAW,GAAG,IAAI,EAAK,MAAM,CAAC,IAAI;CAUnE,OAAO,GAAG,EAAO,iBAAiB,EAAY,GAAG,EAAc,IATtC,EAAoB,WAAW,SAAS,IAC7D,IACA,UAAU,KAGX,MAAM,GAAG,EACT,IAAI,kBAAkB,EACtB,KAAK,GAE0D;AACpE,GCvCI,KAAK,MAAM,CAACK,EAAE,CAAC,KAAK,CAACC,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "twenty-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.20.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"bin": {
|
|
6
6
|
"twenty": "dist/cli.cjs"
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"semver": "7.6.3",
|
|
84
84
|
"sharp": "^0.34.5",
|
|
85
85
|
"tinyglobby": "^0.2.15",
|
|
86
|
-
"twenty-client-sdk": "2.
|
|
86
|
+
"twenty-client-sdk": "2.20.0",
|
|
87
87
|
"typescript": "^5.9.3",
|
|
88
88
|
"uuid": "^13.0.2"
|
|
89
89
|
},
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { U as e, z as t } from "./login-Dasbw3em.mjs";
|
|
2
|
-
import n from "chalk";
|
|
3
|
-
//#region src/cli/commands/dev/catalog-sync.ts
|
|
4
|
-
var r = class {
|
|
5
|
-
async execute(r) {
|
|
6
|
-
r.remote && e.setActiveRemote(r.remote);
|
|
7
|
-
let i = e.getActiveRemote();
|
|
8
|
-
console.log(n.blue(`Syncing marketplace catalog on ${i}...`));
|
|
9
|
-
let a = await new t().syncMarketplaceCatalog();
|
|
10
|
-
a.success || (console.error(n.red(`Catalog sync failed: ${a.error instanceof Error ? a.error.message : String(a.error)}`)), process.exit(1)), console.log(n.green("✓ Marketplace catalog synced successfully"));
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
//#endregion
|
|
14
|
-
export { r as CatalogSyncCommand };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ObjectConfig } from '../../../../../sdk/define/objects/object-config';
|
|
2
|
-
import { type ObjectFieldManifest } from 'twenty-shared/application';
|
|
3
|
-
export declare const getDefaultObjectFields: ({ objectConfig, applicationUniversalIdentifier, }: {
|
|
4
|
-
objectConfig: ObjectConfig;
|
|
5
|
-
applicationUniversalIdentifier: string;
|
|
6
|
-
}) => ObjectFieldManifest[];
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Et as e } from "./login-Dasbw3em.mjs";
|
|
2
|
-
import { ScriptTarget as t, SyntaxKind as n, createSourceFile as r } from "typescript";
|
|
3
|
-
//#region ../twenty-shared/dist/get-function-input-schema-GNk3NRLJ.mjs
|
|
4
|
-
var i = "TwentyRecord", a = (t) => {
|
|
5
|
-
let r = t.typeArguments?.[0];
|
|
6
|
-
if (e(r) && r.kind === n.LiteralType && r.literal.kind === n.StringLiteral) return r.literal.text;
|
|
7
|
-
}, o = (e) => e.type === "record" ? {
|
|
8
|
-
type: "records",
|
|
9
|
-
objectUniversalIdentifier: e.objectUniversalIdentifier
|
|
10
|
-
} : {
|
|
11
|
-
type: "array",
|
|
12
|
-
items: e
|
|
13
|
-
}, s = (t) => {
|
|
14
|
-
switch (t.kind) {
|
|
15
|
-
case n.NumberKeyword: return { type: "number" };
|
|
16
|
-
case n.StringKeyword: return { type: "string" };
|
|
17
|
-
case n.BooleanKeyword: return { type: "boolean" };
|
|
18
|
-
case n.ArrayType: return o(s(t.elementType));
|
|
19
|
-
case n.TypeReference: {
|
|
20
|
-
let r = t, c = r.typeName.kind === n.Identifier ? r.typeName.text : void 0;
|
|
21
|
-
if (c === "Array" || c === "ReadonlyArray") {
|
|
22
|
-
let t = r.typeArguments?.[0];
|
|
23
|
-
return o(e(t) ? s(t) : {});
|
|
24
|
-
}
|
|
25
|
-
if (c === i) {
|
|
26
|
-
let t = a(r);
|
|
27
|
-
if (e(t)) return {
|
|
28
|
-
type: "record",
|
|
29
|
-
objectUniversalIdentifier: t
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
return {};
|
|
33
|
-
}
|
|
34
|
-
case n.ObjectKeyword: return { type: "object" };
|
|
35
|
-
case n.TypeLiteral: {
|
|
36
|
-
let n = {};
|
|
37
|
-
return t.members.forEach((t) => {
|
|
38
|
-
if (e(t.name) && e(t.type)) {
|
|
39
|
-
let e = t.name.text;
|
|
40
|
-
n[e] = s(t.type);
|
|
41
|
-
}
|
|
42
|
-
}), {
|
|
43
|
-
type: "object",
|
|
44
|
-
properties: n
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
case n.UnionType: {
|
|
48
|
-
let e = t, r = [], i = !0;
|
|
49
|
-
return e.types.forEach((e) => {
|
|
50
|
-
if (e.kind === n.LiteralType) {
|
|
51
|
-
let t = e.literal;
|
|
52
|
-
t.kind === n.StringLiteral ? r.push(t.text) : i = !1;
|
|
53
|
-
} else i = !1;
|
|
54
|
-
}), i ? {
|
|
55
|
-
type: "string",
|
|
56
|
-
enum: r
|
|
57
|
-
} : {};
|
|
58
|
-
}
|
|
59
|
-
default: return {};
|
|
60
|
-
}
|
|
61
|
-
}, c = (t, n) => t.parameters.reduce((t, n) => {
|
|
62
|
-
let r = n.type;
|
|
63
|
-
return e(r) ? [...t, s(r)] : [...t, {}];
|
|
64
|
-
}, n), l = (t) => t.kind === n.FunctionDeclaration ? [t] : t.kind === n.VariableStatement ? t.declarationList.declarations.filter((t) => e(t.initializer) && t.initializer.kind === n.ArrowFunction).map((e) => e.initializer) : [], u = (e) => {
|
|
65
|
-
let i = r("temp.ts", e, t.ESNext, !0), a = [];
|
|
66
|
-
return i.forEachChild((e) => {
|
|
67
|
-
(e.kind === n.FunctionDeclaration || e.kind === n.VariableStatement) && l(e).forEach((e) => {
|
|
68
|
-
a = c(e, a);
|
|
69
|
-
});
|
|
70
|
-
}), a;
|
|
71
|
-
};
|
|
72
|
-
//#endregion
|
|
73
|
-
export { u as getFunctionInputSchema };
|