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
@@ -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 { Ot as r } from "./login-C1WTDmkF.mjs";
5
+ import { Ot as r } from "./login-CjlKXuH6.mjs";
6
6
  import { ScriptTarget as i, SyntaxKind as a, createSourceFile as o } from "typescript";
7
7
  //#region ../twenty-shared/dist/get-function-input-schema-GNk3NRLJ.mjs
8
8
  var s = "TwentyRecord", c = (e) => {
@@ -34,5 +34,25 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
34
34
  success
35
35
  }
36
36
  }
37
- `,E=async e=>{let{runAgent:t}=await y({query:T,variables:{input:e},caller:`runAgent`});return t},D=class{constructor(e,t){this.__twentyHttpResponse=!0,this.body=e,this.status=t?.status,this.headers=t?.headers}};exports.AppConnectionAuthFailedError=h,exports.Response=D,exports.findConnectionForRequest=w,exports.getConnection=x,exports.jsonSchemaToInputSchema=o,exports.listConnections=C,exports.runAgent=E;
37
+ `,E=async e=>{let{runAgent:t}=await y({query:T,variables:{input:e},caller:`runAgent`});return t},D=`
38
+ query GetAppKeyValue($key: String!, $scope: AppKeyValueScope) {
39
+ appKeyValue(key: $key, scope: $scope) {
40
+ key
41
+ value
42
+ scope
43
+ }
44
+ }
45
+ `,O=`
46
+ mutation SetAppKeyValue($input: SetAppKeyValueInput!) {
47
+ setAppKeyValue(input: $input) {
48
+ key
49
+ value
50
+ scope
51
+ }
52
+ }
53
+ `,k=`
54
+ mutation DeleteAppKeyValue($key: String!, $scope: AppKeyValueScope) {
55
+ deleteAppKeyValue(key: $key, scope: $scope)
56
+ }
57
+ `,A=`WORKSPACE`,j={async get(e,t){let{appKeyValue:n}=await y({query:D,variables:{key:e,scope:t?.scope??A},caller:`kv.get`});return n?.value??null},async set(e,t,n){await y({query:O,variables:{input:{key:e,value:t,scope:n?.scope??A}},caller:`kv.set`})},async delete(e,t){let{deleteAppKeyValue:n}=await y({query:k,variables:{key:e,scope:t?.scope??A},caller:`kv.delete`});return n}},M=class{constructor(e,t){this.__twentyHttpResponse=!0,this.body=e,this.status=t?.status,this.headers=t?.headers}};exports.AppConnectionAuthFailedError=h,exports.Response=M,exports.findConnectionForRequest=w,exports.getConnection=x,exports.jsonSchemaToInputSchema=o,exports.kv=j,exports.listConnections=C,exports.runAgent=E;
38
58
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["t","i","t","e","o","s","l","u","d","f","p","m","h","g","_","v","y","b","e","t","c","e","i","n","t"],"sources":["../../../twenty-shared/dist/is-record-object-schema-CwzshFdt.mjs","../../../twenty-shared/dist/logic-function.mjs","../../src/sdk/logic-function/connections/errors/app-connection-auth-failed.error.ts","../../../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/logic-function/utils/post-graphql-request.util.ts","../../src/sdk/logic-function/connections/get-connection.ts","../../src/sdk/logic-function/connections/list-connections.ts","../../src/sdk/logic-function/connections/find-connection-for-request.ts","../../src/sdk/logic-function/agents/run-agent.ts","../../src/sdk/logic-function/response.ts"],"sourcesContent":["import { isNonEmptyString as e } from \"@sniptt/guards\";\n//#region src/logic-function/is-record-object-schema.ts\nvar t = (t) => (t?.type === \"record\" || t?.type === \"object\") && e(t.objectUniversalIdentifier);\n//#endregion\nexport { t };\n","import { t as e } from \"./isDefined-Dtu5EYqP.mjs\";\nimport { t } from \"./is-record-object-schema-CwzshFdt.mjs\";\nimport { isNonEmptyString as n, isObject as r } from \"@sniptt/guards\";\n//#region src/logic-function/build-tool-input-json-schema.ts\nvar i = (e, t) => {\n\tlet r = n(e) ? t?.(e) : void 0;\n\treturn `Id of the ${n(r) ? r : \"linked\"} record`;\n}, a = (n, o) => {\n\tif (t(n)) return {\n\t\ttype: \"string\",\n\t\tdescription: i(n.objectUniversalIdentifier, o)\n\t};\n\tif (n.type === \"records\") return {\n\t\ttype: \"array\",\n\t\titems: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: i(n.objectUniversalIdentifier, o)\n\t\t}\n\t};\n\tlet { objectUniversalIdentifier: s, multiline: c, label: l, items: u, properties: d, additionalProperties: f, ...p } = n, m = { ...p };\n\treturn e(u) && (m.items = a(u, o)), e(d) && (m.properties = Object.fromEntries(Object.entries(d).map(([e, t]) => [e, a(t, o)]))), e(f) && (m.additionalProperties = r(f) ? a(f, o) : f), m;\n}, o = {\n\ttype: \"object\",\n\tproperties: {}\n}, s = (e) => {\n\tlet t = { type: \"unknown\" };\n\tswitch (e.type) {\n\t\tcase \"string\":\n\t\t\tt.type = \"string\";\n\t\t\tbreak;\n\t\tcase \"number\":\n\t\tcase \"integer\":\n\t\t\tt.type = \"number\";\n\t\t\tbreak;\n\t\tcase \"boolean\":\n\t\t\tt.type = \"boolean\";\n\t\t\tbreak;\n\t\tcase \"array\":\n\t\t\tt.type = \"array\", e.items && (t.items = s(e.items));\n\t\t\tbreak;\n\t\tcase \"object\":\n\t\t\tt.type = \"object\", e.properties && (t.properties = Object.fromEntries(Object.entries(e.properties).map(([e, t]) => [e, s(t)])));\n\t\t\tbreak;\n\t\tcase \"record\":\n\t\t\tt.type = \"record\";\n\t\t\tbreak;\n\t\tcase \"records\":\n\t\t\tt.type = \"records\";\n\t\t\tbreak;\n\t\tdefault: t.type = \"unknown\";\n\t}\n\treturn Array.isArray(e.enum) && (t.enum = e.enum.filter((e) => typeof e == \"string\")), e.multiline === !0 && (t.multiline = !0), n(e.label) && (t.label = e.label), n(e.objectUniversalIdentifier) && (t.objectUniversalIdentifier = e.objectUniversalIdentifier), t;\n}, c = (e) => [s(e)], l = { inputSchema: c({\n\ttype: \"object\",\n\tproperties: {\n\t\ta: { type: \"string\" },\n\t\tb: { type: \"number\" }\n\t}\n}) }, u = async (t) => {\n\tlet { getFunctionInputSchema: n } = await import(\"./get-function-input-schema-GNk3NRLJ.mjs\"), r = n(t)[0];\n\treturn r?.type === \"object\" && e(r.properties) ? {\n\t\ttype: \"object\",\n\t\tproperties: r.properties\n\t} : o;\n}, d = (t) => !e(t) || t === null ? \"unknown\" : typeof t == \"string\" ? \"string\" : typeof t == \"number\" ? \"number\" : typeof t == \"boolean\" ? \"boolean\" : Array.isArray(t) ? \"array\" : \"unknown\", f = (e) => e ? Object.entries(e).reduce((e, [t, n]) => (r(n) && !Array.isArray(n) ? e[t] = {\n\tisLeaf: !1,\n\ttype: \"object\",\n\tlabel: t,\n\tvalue: f(n)\n} : e[t] = {\n\tisLeaf: !0,\n\tvalue: n,\n\ttype: d(n),\n\tlabel: t\n}, e), {}) : {}, p = (e, t) => e ? `${e}.${t}` : t, m = (t, n, r = \"\") => {\n\tlet i = [];\n\tfor (let [a, o] of Object.entries(n)) {\n\t\tlet n = p(r, a), s = t[a];\n\t\tif (!e(s)) {\n\t\t\ti.push(`Missing key \"${n}\" in declared output schema.`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (o.isLeaf !== s.isLeaf) {\n\t\t\ti.push(`Type mismatch at \"${n}\": expected ${o.isLeaf ? o.type : \"object\"} but declared ${s.isLeaf ? s.type : \"object\"}.`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!o.isLeaf && !s.isLeaf) {\n\t\t\ti.push(...m(s.value, o.value, n));\n\t\t\tcontinue;\n\t\t}\n\t\to.isLeaf && s.isLeaf && o.type !== \"unknown\" && s.type !== \"unknown\" && o.type !== s.type && i.push(`Type mismatch at \"${n}\": expected ${o.type} but declared ${s.type}.`);\n\t}\n\treturn i;\n}, h = [\n\t\"string\",\n\t\"number\",\n\t\"boolean\",\n\t\"array\",\n\t\"unknown\"\n], g = (e) => h.includes(e), _ = (e, t) => {\n\tlet n = t.label ?? e;\n\treturn t.type === \"record\" ? {\n\t\tisLeaf: !0,\n\t\ttype: \"string\",\n\t\tlabel: n,\n\t\tvalue: null\n\t} : t.type === \"records\" ? {\n\t\tisLeaf: !0,\n\t\ttype: \"array\",\n\t\tlabel: n,\n\t\tvalue: null\n\t} : t.type === \"object\" ? {\n\t\tisLeaf: !1,\n\t\ttype: \"object\",\n\t\tlabel: n,\n\t\tvalue: r(t.properties) ? v(t.properties) : {}\n\t} : {\n\t\tisLeaf: !0,\n\t\ttype: g(t.type) ? t.type : \"unknown\",\n\t\tlabel: n,\n\t\tvalue: null\n\t};\n}, v = (e) => Object.entries(e).reduce((e, [t, n]) => (e[t] = _(t, n), e), {}), y = (e) => {\n\tlet t = e[0];\n\treturn t?.type !== \"object\" || !r(t.properties) ? {} : v(t.properties);\n}, b = (e) => e?.type === \"records\" && n(e.objectUniversalIdentifier) || e?.type === \"array\" && t(e?.items);\n//#endregion\nexport { o as DEFAULT_TOOL_INPUT_SCHEMA, l as SEED_WORKFLOW_ACTION_TRIGGER_SETTINGS, a as buildToolInputJsonSchema, u as getInputSchemaFromSourceCode, f as getOutputSchemaFromValue, m as getOutputSchemaMismatchIssues, y as inputSchemaToOutputSchema, b as isRecordArraySchema, t as isRecordObjectSchema, c as jsonSchemaToInputSchema };\n","// Thrown when the platform asks the SDK to operate on a connection whose\n// OAuth refresh failed permanently (`authFailedAt` is set). The end user\n// must reconnect from the app's settings tab — the app cannot recover on\n// its own.\n//\n// `listConnections` filters these out by default (the user can't act on\n// them anyway). `getConnection` throws this when the looked-up connection\n// is in this state, so a stored connection id can be safely retried until\n// it works again.\nexport class AppConnectionAuthFailedError extends Error {\n readonly connectionId: string;\n\n constructor(connectionId: string) {\n super(\n `App connection ${connectionId} requires the user to reconnect ` +\n `(authFailedAt is set). Surface a \"Reconnect\" prompt in your UI.`,\n );\n this.name = 'AppConnectionAuthFailedError';\n this.connectionId = connectionId;\n }\n}\n","//#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\nexport const postGraphqlRequest = async <TVariables, TData>({\n query,\n variables,\n caller,\n}: {\n query: string;\n variables: TVariables;\n caller: string;\n}): Promise<TData> => {\n const apiUrl = process.env[DEFAULT_API_URL_NAME];\n const accessToken = process.env[DEFAULT_APP_ACCESS_TOKEN_NAME];\n\n if (!apiUrl || !accessToken) {\n throw new Error(\n `${caller}() requires the app runtime env vars ` +\n `${DEFAULT_API_URL_NAME} and ${DEFAULT_APP_ACCESS_TOKEN_NAME}.`,\n );\n }\n\n const response = await fetch(`${apiUrl}/metadata`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${accessToken}`,\n },\n body: JSON.stringify({ query, variables }),\n });\n\n if (!response.ok) {\n throw new Error(\n `${caller}() failed: HTTP ${response.status} ${response.statusText}`,\n );\n }\n\n const body = (await response.json()) as {\n data?: TData;\n errors?: { message: string }[];\n };\n\n if (body.errors && body.errors.length > 0) {\n throw new Error(\n `${caller}() failed: ${body.errors.map((error) => error.message).join(', ')}`,\n );\n }\n\n if (!body.data) {\n throw new Error(`${caller}() failed: response contained no data.`);\n }\n\n return body.data;\n};\n","import { AppConnectionAuthFailedError } from '@/sdk/logic-function/connections/errors/app-connection-auth-failed.error';\nimport { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst GET_APP_CONNECTION_QUERY = `\n query GetAppConnection($id: ID!) {\n appConnection(id: $id) {\n id\n providerName\n name\n handle\n visibility\n userWorkspaceId\n accessToken\n scopes\n authFailedAt\n }\n }\n`;\n\nexport const getConnection = async (id: string): Promise<AppConnection> => {\n const { appConnection } = await postGraphqlRequest<\n { id: string },\n { appConnection: AppConnection }\n >({\n query: GET_APP_CONNECTION_QUERY,\n variables: { id },\n caller: 'getConnection',\n });\n\n if (appConnection.authFailedAt !== null) {\n throw new AppConnectionAuthFailedError(appConnection.id);\n }\n\n return appConnection;\n};\n","import { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst LIST_APP_CONNECTIONS_QUERY = `\n query ListAppConnections($filter: ListAppConnectionsInput) {\n appConnections(filter: $filter) {\n id\n providerName\n name\n handle\n visibility\n userWorkspaceId\n accessToken\n scopes\n authFailedAt\n }\n }\n`;\n\nexport type ListConnectionsFilter = {\n providerName?: string;\n userWorkspaceId?: string;\n visibility?: 'user' | 'workspace';\n};\n\nexport const listConnections = async (\n filter: ListConnectionsFilter = {},\n): Promise<AppConnection[]> => {\n const { appConnections } = await postGraphqlRequest<\n { filter: ListConnectionsFilter },\n { appConnections: AppConnection[] }\n >({\n query: LIST_APP_CONNECTIONS_QUERY,\n variables: { filter },\n caller: 'listConnections',\n });\n\n return appConnections;\n};\n","import { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\n\nexport const findConnectionForRequest = (\n connections: AppConnection[],\n event: { userWorkspaceId: string | null },\n): AppConnection | null => {\n if (event.userWorkspaceId !== null) {\n const personal = connections.find(\n (connection) =>\n connection.visibility === 'user' &&\n connection.userWorkspaceId === event.userWorkspaceId,\n );\n\n if (personal) {\n return personal;\n }\n }\n\n const workspaceShared = connections.find(\n (connection) => connection.visibility === 'workspace',\n );\n\n return workspaceShared ?? null;\n};\n","import {\n type RunAgentInput,\n type RunAgentResult,\n} from 'twenty-shared/application';\n\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst RUN_AGENT_MUTATION = `\n mutation RunAgent($input: RunAgentInput!) {\n runAgent(input: $input) {\n result\n error\n success\n }\n }\n`;\n\nexport const runAgent = async (\n input: RunAgentInput,\n): Promise<RunAgentResult> => {\n const { runAgent: result } = await postGraphqlRequest<\n { input: RunAgentInput },\n { runAgent: RunAgentResult }\n >({\n query: RUN_AGENT_MUTATION,\n variables: { input },\n caller: 'runAgent',\n });\n\n return result;\n};\n","import { type LogicFunctionHttpResponse } from 'twenty-shared/types';\n\nexport type ResponseInit = {\n status?: number;\n headers?: Record<string, string>;\n};\n\nexport class Response implements LogicFunctionHttpResponse {\n readonly __twentyHttpResponse = true as const;\n readonly body: unknown;\n readonly status?: number;\n readonly headers?: Record<string, string>;\n\n constructor(body: unknown, init?: ResponseInit) {\n this.body = body;\n this.status = init?.status;\n this.headers = init?.headers;\n }\n}\n"],"mappings":"uKAEA,IAAIA,EAAK,IAAO,GAAG,OAAS,UAAY,GAAG,OAAS,YAAA,EAAA,EAAA,kBAAe,EAAE,yBAAyB,ECE1FC,GAAK,EAAG,IAAM,CACjB,IAAI,GAAA,EAAA,EAAA,kBAAM,CAAC,EAAI,IAAI,CAAC,EAAI,IAAK,GAC7B,MAAO,cAAA,EAAA,EAAA,kBAAe,CAAC,EAAI,EAAI,SAAS,QACzC,EAAG,GAAK,EAAG,IAAM,CAChB,GAAIC,EAAE,CAAC,EAAG,MAAO,CAChB,KAAM,SACN,YAAaD,EAAE,EAAE,0BAA2B,CAAC,CAC9C,EACA,GAAI,EAAE,OAAS,UAAW,MAAO,CAChC,KAAM,QACN,MAAO,CACN,KAAM,SACN,YAAaA,EAAE,EAAE,0BAA2B,CAAC,CAC9C,CACD,EACA,GAAI,CAAE,0BAA2B,EAAG,UAAW,EAAG,MAAO,EAAG,MAAO,EAAG,WAAY,EAAG,qBAAsB,EAAG,GAAG,GAAM,EAAG,EAAI,CAAE,GAAG,CAAE,EACrI,OAAOE,EAAAA,EAAE,CAAC,IAAM,EAAE,MAAQ,EAAE,EAAG,CAAC,GAAIA,EAAAA,EAAE,CAAC,IAAM,EAAE,WAAa,OAAO,YAAY,OAAO,QAAQ,CAAC,EAAE,KAAK,CAAC,EAAG,KAAO,CAAC,EAAG,EAAE,EAAG,CAAC,CAAC,CAAC,CAAC,GAAIA,EAAAA,EAAE,CAAC,IAAM,EAAE,sBAAA,EAAA,EAAA,UAAyB,CAAC,EAAI,EAAE,EAAG,CAAC,E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G/B,CACA,MAAO,EACP,UAAW,CAAE,QAAO,EACpB,OAAQ,iBACV,CAAC,EAED,OAAO,CACT,ECpCa,GACX,EACA,IACyB,CACzB,GAAI,EAAM,kBAAoB,KAAM,CAClC,IAAM,EAAW,EAAY,KAC1B,GACC,EAAW,aAAe,QAC1B,EAAW,kBAAoB,EAAM,eACzC,EAEA,GAAI,EACF,OAAO,CAEX,CAMA,OAJwB,EAAY,KACjC,GAAe,EAAW,aAAe,WAGrC,GAAmB,IAC5B,EChBM,EAAqB;;;;;;;;EAUd,EAAW,KACtB,IAC4B,CAC5B,GAAM,CAAE,SAAU,GAAW,MAAM,EAGjC,CACA,MAAO,EACP,UAAW,CAAE,OAAM,EACnB,OAAQ,UACV,CAAC,EAED,OAAO,CACT,ECvBa,EAAb,KAA2D,CAMzD,YAAY,EAAe,EAAqB,2BALhB,GAM9B,KAAK,KAAO,EACZ,KAAK,OAAS,GAAM,OACpB,KAAK,QAAU,GAAM,OACvB,CACF"}
1
+ {"version":3,"file":"index.cjs","names":["t","i","t","e","o","s","l","u","d","f","p","m","h","g","_","v","y","b","e","t","c","e","i","n","t"],"sources":["../../../twenty-shared/dist/is-record-object-schema-CwzshFdt.mjs","../../../twenty-shared/dist/logic-function.mjs","../../src/sdk/logic-function/connections/errors/app-connection-auth-failed.error.ts","../../../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/logic-function/utils/post-graphql-request.util.ts","../../src/sdk/logic-function/connections/get-connection.ts","../../src/sdk/logic-function/connections/list-connections.ts","../../src/sdk/logic-function/connections/find-connection-for-request.ts","../../src/sdk/logic-function/agents/run-agent.ts","../../src/sdk/logic-function/key-value/kv.ts","../../src/sdk/logic-function/response.ts"],"sourcesContent":["import { isNonEmptyString as e } from \"@sniptt/guards\";\n//#region src/logic-function/is-record-object-schema.ts\nvar t = (t) => (t?.type === \"record\" || t?.type === \"object\") && e(t.objectUniversalIdentifier);\n//#endregion\nexport { t };\n","import { t as e } from \"./isDefined-Dtu5EYqP.mjs\";\nimport { t } from \"./is-record-object-schema-CwzshFdt.mjs\";\nimport { isNonEmptyString as n, isObject as r } from \"@sniptt/guards\";\n//#region src/logic-function/build-tool-input-json-schema.ts\nvar i = (e, t) => {\n\tlet r = n(e) ? t?.(e) : void 0;\n\treturn `Id of the ${n(r) ? r : \"linked\"} record`;\n}, a = (n, o) => {\n\tif (t(n)) return {\n\t\ttype: \"string\",\n\t\tdescription: i(n.objectUniversalIdentifier, o)\n\t};\n\tif (n.type === \"records\") return {\n\t\ttype: \"array\",\n\t\titems: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: i(n.objectUniversalIdentifier, o)\n\t\t}\n\t};\n\tlet { objectUniversalIdentifier: s, multiline: c, label: l, items: u, properties: d, additionalProperties: f, ...p } = n, m = { ...p };\n\treturn e(u) && (m.items = a(u, o)), e(d) && (m.properties = Object.fromEntries(Object.entries(d).map(([e, t]) => [e, a(t, o)]))), e(f) && (m.additionalProperties = r(f) ? a(f, o) : f), m;\n}, o = {\n\ttype: \"object\",\n\tproperties: {}\n}, s = (e) => {\n\tlet t = { type: \"unknown\" };\n\tswitch (e.type) {\n\t\tcase \"string\":\n\t\t\tt.type = \"string\";\n\t\t\tbreak;\n\t\tcase \"number\":\n\t\tcase \"integer\":\n\t\t\tt.type = \"number\";\n\t\t\tbreak;\n\t\tcase \"boolean\":\n\t\t\tt.type = \"boolean\";\n\t\t\tbreak;\n\t\tcase \"array\":\n\t\t\tt.type = \"array\", e.items && (t.items = s(e.items));\n\t\t\tbreak;\n\t\tcase \"object\":\n\t\t\tt.type = \"object\", e.properties && (t.properties = Object.fromEntries(Object.entries(e.properties).map(([e, t]) => [e, s(t)])));\n\t\t\tbreak;\n\t\tcase \"record\":\n\t\t\tt.type = \"record\";\n\t\t\tbreak;\n\t\tcase \"records\":\n\t\t\tt.type = \"records\";\n\t\t\tbreak;\n\t\tdefault: t.type = \"unknown\";\n\t}\n\treturn Array.isArray(e.enum) && (t.enum = e.enum.filter((e) => typeof e == \"string\")), e.multiline === !0 && (t.multiline = !0), n(e.label) && (t.label = e.label), n(e.objectUniversalIdentifier) && (t.objectUniversalIdentifier = e.objectUniversalIdentifier), t;\n}, c = (e) => [s(e)], l = { inputSchema: c({\n\ttype: \"object\",\n\tproperties: {\n\t\ta: { type: \"string\" },\n\t\tb: { type: \"number\" }\n\t}\n}) }, u = async (t) => {\n\tlet { getFunctionInputSchema: n } = await import(\"./get-function-input-schema-GNk3NRLJ.mjs\"), r = n(t)[0];\n\treturn r?.type === \"object\" && e(r.properties) ? {\n\t\ttype: \"object\",\n\t\tproperties: r.properties\n\t} : o;\n}, d = (t) => !e(t) || t === null ? \"unknown\" : typeof t == \"string\" ? \"string\" : typeof t == \"number\" ? \"number\" : typeof t == \"boolean\" ? \"boolean\" : Array.isArray(t) ? \"array\" : \"unknown\", f = (e) => e ? Object.entries(e).reduce((e, [t, n]) => (r(n) && !Array.isArray(n) ? e[t] = {\n\tisLeaf: !1,\n\ttype: \"object\",\n\tlabel: t,\n\tvalue: f(n)\n} : e[t] = {\n\tisLeaf: !0,\n\tvalue: n,\n\ttype: d(n),\n\tlabel: t\n}, e), {}) : {}, p = (e, t) => e ? `${e}.${t}` : t, m = (t, n, r = \"\") => {\n\tlet i = [];\n\tfor (let [a, o] of Object.entries(n)) {\n\t\tlet n = p(r, a), s = t[a];\n\t\tif (!e(s)) {\n\t\t\ti.push(`Missing key \"${n}\" in declared output schema.`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (o.isLeaf !== s.isLeaf) {\n\t\t\ti.push(`Type mismatch at \"${n}\": expected ${o.isLeaf ? o.type : \"object\"} but declared ${s.isLeaf ? s.type : \"object\"}.`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!o.isLeaf && !s.isLeaf) {\n\t\t\ti.push(...m(s.value, o.value, n));\n\t\t\tcontinue;\n\t\t}\n\t\to.isLeaf && s.isLeaf && o.type !== \"unknown\" && s.type !== \"unknown\" && o.type !== s.type && i.push(`Type mismatch at \"${n}\": expected ${o.type} but declared ${s.type}.`);\n\t}\n\treturn i;\n}, h = [\n\t\"string\",\n\t\"number\",\n\t\"boolean\",\n\t\"array\",\n\t\"unknown\"\n], g = (e) => h.includes(e), _ = (e, t) => {\n\tlet n = t.label ?? e;\n\treturn t.type === \"record\" ? {\n\t\tisLeaf: !0,\n\t\ttype: \"string\",\n\t\tlabel: n,\n\t\tvalue: null\n\t} : t.type === \"records\" ? {\n\t\tisLeaf: !0,\n\t\ttype: \"array\",\n\t\tlabel: n,\n\t\tvalue: null\n\t} : t.type === \"object\" ? {\n\t\tisLeaf: !1,\n\t\ttype: \"object\",\n\t\tlabel: n,\n\t\tvalue: r(t.properties) ? v(t.properties) : {}\n\t} : {\n\t\tisLeaf: !0,\n\t\ttype: g(t.type) ? t.type : \"unknown\",\n\t\tlabel: n,\n\t\tvalue: null\n\t};\n}, v = (e) => Object.entries(e).reduce((e, [t, n]) => (e[t] = _(t, n), e), {}), y = (e) => {\n\tlet t = e[0];\n\treturn t?.type !== \"object\" || !r(t.properties) ? {} : v(t.properties);\n}, b = (e) => e?.type === \"records\" && n(e.objectUniversalIdentifier) || e?.type === \"array\" && t(e?.items);\n//#endregion\nexport { o as DEFAULT_TOOL_INPUT_SCHEMA, l as SEED_WORKFLOW_ACTION_TRIGGER_SETTINGS, a as buildToolInputJsonSchema, u as getInputSchemaFromSourceCode, f as getOutputSchemaFromValue, m as getOutputSchemaMismatchIssues, y as inputSchemaToOutputSchema, b as isRecordArraySchema, t as isRecordObjectSchema, c as jsonSchemaToInputSchema };\n","// Thrown when the platform asks the SDK to operate on a connection whose\n// OAuth refresh failed permanently (`authFailedAt` is set). The end user\n// must reconnect from the app's settings tab — the app cannot recover on\n// its own.\n//\n// `listConnections` filters these out by default (the user can't act on\n// them anyway). `getConnection` throws this when the looked-up connection\n// is in this state, so a stored connection id can be safely retried until\n// it works again.\nexport class AppConnectionAuthFailedError extends Error {\n readonly connectionId: string;\n\n constructor(connectionId: string) {\n super(\n `App connection ${connectionId} requires the user to reconnect ` +\n `(authFailedAt is set). Surface a \"Reconnect\" prompt in your UI.`,\n );\n this.name = 'AppConnectionAuthFailedError';\n this.connectionId = connectionId;\n }\n}\n","//#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\nexport const postGraphqlRequest = async <TVariables, TData>({\n query,\n variables,\n caller,\n}: {\n query: string;\n variables: TVariables;\n caller: string;\n}): Promise<TData> => {\n const apiUrl = process.env[DEFAULT_API_URL_NAME];\n const accessToken = process.env[DEFAULT_APP_ACCESS_TOKEN_NAME];\n\n if (!apiUrl || !accessToken) {\n throw new Error(\n `${caller}() requires the app runtime env vars ` +\n `${DEFAULT_API_URL_NAME} and ${DEFAULT_APP_ACCESS_TOKEN_NAME}.`,\n );\n }\n\n const response = await fetch(`${apiUrl}/metadata`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${accessToken}`,\n },\n body: JSON.stringify({ query, variables }),\n });\n\n if (!response.ok) {\n throw new Error(\n `${caller}() failed: HTTP ${response.status} ${response.statusText}`,\n );\n }\n\n const body = (await response.json()) as {\n data?: TData;\n errors?: { message: string }[];\n };\n\n if (body.errors && body.errors.length > 0) {\n throw new Error(\n `${caller}() failed: ${body.errors.map((error) => error.message).join(', ')}`,\n );\n }\n\n if (!body.data) {\n throw new Error(`${caller}() failed: response contained no data.`);\n }\n\n return body.data;\n};\n","import { AppConnectionAuthFailedError } from '@/sdk/logic-function/connections/errors/app-connection-auth-failed.error';\nimport { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst GET_APP_CONNECTION_QUERY = `\n query GetAppConnection($id: ID!) {\n appConnection(id: $id) {\n id\n providerName\n name\n handle\n visibility\n userWorkspaceId\n accessToken\n scopes\n authFailedAt\n }\n }\n`;\n\nexport const getConnection = async (id: string): Promise<AppConnection> => {\n const { appConnection } = await postGraphqlRequest<\n { id: string },\n { appConnection: AppConnection }\n >({\n query: GET_APP_CONNECTION_QUERY,\n variables: { id },\n caller: 'getConnection',\n });\n\n if (appConnection.authFailedAt !== null) {\n throw new AppConnectionAuthFailedError(appConnection.id);\n }\n\n return appConnection;\n};\n","import { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst LIST_APP_CONNECTIONS_QUERY = `\n query ListAppConnections($filter: ListAppConnectionsInput) {\n appConnections(filter: $filter) {\n id\n providerName\n name\n handle\n visibility\n userWorkspaceId\n accessToken\n scopes\n authFailedAt\n }\n }\n`;\n\nexport type ListConnectionsFilter = {\n providerName?: string;\n userWorkspaceId?: string;\n visibility?: 'user' | 'workspace';\n};\n\nexport const listConnections = async (\n filter: ListConnectionsFilter = {},\n): Promise<AppConnection[]> => {\n const { appConnections } = await postGraphqlRequest<\n { filter: ListConnectionsFilter },\n { appConnections: AppConnection[] }\n >({\n query: LIST_APP_CONNECTIONS_QUERY,\n variables: { filter },\n caller: 'listConnections',\n });\n\n return appConnections;\n};\n","import { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\n\nexport const findConnectionForRequest = (\n connections: AppConnection[],\n event: { userWorkspaceId: string | null },\n): AppConnection | null => {\n if (event.userWorkspaceId !== null) {\n const personal = connections.find(\n (connection) =>\n connection.visibility === 'user' &&\n connection.userWorkspaceId === event.userWorkspaceId,\n );\n\n if (personal) {\n return personal;\n }\n }\n\n const workspaceShared = connections.find(\n (connection) => connection.visibility === 'workspace',\n );\n\n return workspaceShared ?? null;\n};\n","import {\n type RunAgentInput,\n type RunAgentResult,\n} from 'twenty-shared/application';\n\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst RUN_AGENT_MUTATION = `\n mutation RunAgent($input: RunAgentInput!) {\n runAgent(input: $input) {\n result\n error\n success\n }\n }\n`;\n\nexport const runAgent = async (\n input: RunAgentInput,\n): Promise<RunAgentResult> => {\n const { runAgent: result } = await postGraphqlRequest<\n { input: RunAgentInput },\n { runAgent: RunAgentResult }\n >({\n query: RUN_AGENT_MUTATION,\n variables: { input },\n caller: 'runAgent',\n });\n\n return result;\n};\n","import {\n type AppKeyValue,\n type AppKeyValueScope,\n} from 'twenty-shared/application';\n\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst GET_APP_KEY_VALUE_QUERY = `\n query GetAppKeyValue($key: String!, $scope: AppKeyValueScope) {\n appKeyValue(key: $key, scope: $scope) {\n key\n value\n scope\n }\n }\n`;\n\nconst SET_APP_KEY_VALUE_MUTATION = `\n mutation SetAppKeyValue($input: SetAppKeyValueInput!) {\n setAppKeyValue(input: $input) {\n key\n value\n scope\n }\n }\n`;\n\nconst DELETE_APP_KEY_VALUE_MUTATION = `\n mutation DeleteAppKeyValue($key: String!, $scope: AppKeyValueScope) {\n deleteAppKeyValue(key: $key, scope: $scope)\n }\n`;\n\nconst DEFAULT_APP_KEY_VALUE_SCOPE: AppKeyValueScope = 'WORKSPACE';\n\ntype KvOptions = {\n scope?: AppKeyValueScope;\n};\n\nexport const kv = {\n async get<TValue = unknown>(\n key: string,\n options?: KvOptions,\n ): Promise<TValue | null> {\n const { appKeyValue } = await postGraphqlRequest<\n { key: string; scope: AppKeyValueScope },\n { appKeyValue: AppKeyValue | null }\n >({\n query: GET_APP_KEY_VALUE_QUERY,\n variables: { key, scope: options?.scope ?? DEFAULT_APP_KEY_VALUE_SCOPE },\n caller: 'kv.get',\n });\n\n return (appKeyValue?.value ?? null) as TValue | null;\n },\n\n async set<TValue>(\n key: string,\n value: TValue,\n options?: KvOptions,\n ): Promise<void> {\n await postGraphqlRequest<\n {\n input: { key: string; value: TValue; scope: AppKeyValueScope };\n },\n { setAppKeyValue: AppKeyValue }\n >({\n query: SET_APP_KEY_VALUE_MUTATION,\n variables: {\n input: {\n key,\n value,\n scope: options?.scope ?? DEFAULT_APP_KEY_VALUE_SCOPE,\n },\n },\n caller: 'kv.set',\n });\n },\n\n async delete(key: string, options?: KvOptions): Promise<boolean> {\n const { deleteAppKeyValue } = await postGraphqlRequest<\n { key: string; scope: AppKeyValueScope },\n { deleteAppKeyValue: boolean }\n >({\n query: DELETE_APP_KEY_VALUE_MUTATION,\n variables: { key, scope: options?.scope ?? DEFAULT_APP_KEY_VALUE_SCOPE },\n caller: 'kv.delete',\n });\n\n return deleteAppKeyValue;\n },\n};\n","import { type LogicFunctionHttpResponse } from 'twenty-shared/types';\n\nexport type ResponseInit = {\n status?: number;\n headers?: Record<string, string>;\n};\n\nexport class Response implements LogicFunctionHttpResponse {\n readonly __twentyHttpResponse = true as const;\n readonly body: unknown;\n readonly status?: number;\n readonly headers?: Record<string, string>;\n\n constructor(body: unknown, init?: ResponseInit) {\n this.body = body;\n this.status = init?.status;\n this.headers = init?.headers;\n }\n}\n"],"mappings":"uKAEA,IAAIA,EAAK,IAAO,GAAG,OAAS,UAAY,GAAG,OAAS,YAAA,EAAA,EAAA,kBAAe,EAAE,yBAAyB,ECE1FC,GAAK,EAAG,IAAM,CACjB,IAAI,GAAA,EAAA,EAAA,kBAAM,CAAC,EAAI,IAAI,CAAC,EAAI,IAAK,GAC7B,MAAO,cAAA,EAAA,EAAA,kBAAe,CAAC,EAAI,EAAI,SAAS,QACzC,EAAG,GAAK,EAAG,IAAM,CAChB,GAAIC,EAAE,CAAC,EAAG,MAAO,CAChB,KAAM,SAC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eAAgB,MAAM,EAG5B,CACA,MAAO,EACP,UAAW,CAAE,MAAK,MAAO,GAAS,OAAS,CAA4B,EACvE,OAAQ,QACV,CAAC,EAED,OAAQ,GAAa,OAAS,IAChC,EAEA,MAAM,IACJ,EACA,EACA,EACe,CACf,MAAM,EAKJ,CACA,MAAO,EACP,UAAW,CACT,MAAO,CACL,MACA,QACA,MAAO,GAAS,OAAS,CAC3B,CACF,EACA,OAAQ,QACV,CAAC,CACH,EAEA,MAAM,OAAO,EAAa,EAAuC,CAC/D,GAAM,CAAE,qBAAsB,MAAM,EAGlC,CACA,MAAO,EACP,UAAW,CAAE,MAAK,MAAO,GAAS,OAAS,CAA4B,EACvE,OAAQ,WACV,CAAC,EAED,OAAO,CACT,CACF,ECpFa,EAAb,KAA2D,CAMzD,YAAY,EAAe,EAAqB,2BALhB,GAM9B,KAAK,KAAO,EACZ,KAAK,OAAS,GAAM,OACpB,KAAK,QAAU,GAAM,OACvB,CACF"}
@@ -14,6 +14,14 @@ type AppConnection = {
14
14
  authFailedAt: string | null;
15
15
  };
16
16
 
17
+ type AppKeyValueScope = 'WORKSPACE' | 'SERVER';
18
+
19
+ type AppKeyValue = {
20
+ key: string;
21
+ value: unknown;
22
+ scope: AppKeyValueScope;
23
+ };
24
+
17
25
  declare enum FieldMetadataType {
18
26
  ACTOR = "ACTOR",
19
27
  ADDRESS = "ADDRESS",
@@ -163,12 +171,14 @@ type RunAgentResult = {
163
171
  success: boolean;
164
172
  };
165
173
 
166
- type LogicFunctionHandler = (...args: any[]) => any | Promise<any>;
167
- type ServerRouteResolverResult = {
174
+ type ServerRouteDispatchResult = {
168
175
  workspaceId: string;
169
176
  targetLogicFunctionUniversalIdentifier: string;
170
177
  payload?: object;
171
178
  };
179
+
180
+ type LogicFunctionHandler = (...args: any[]) => any | Promise<any>;
181
+ type ServerRouteResolverResult = ServerRouteDispatchResult | LogicFunctionHttpResponse;
172
182
  type ServerRouteResolverHandler = (...args: any[]) => ServerRouteResolverResult | Promise<ServerRouteResolverResult>;
173
183
  type LogicFunctionConfigBase = Omit<LogicFunctionManifest, 'sourceHandlerPath' | 'builtHandlerPath' | 'builtHandlerChecksum' | 'handlerName' | 'serverRouteTriggerSettings'>;
174
184
  type LogicFunctionConfig = LogicFunctionConfigBase & ({
@@ -185,6 +195,11 @@ type InstallPayload = {
185
195
  };
186
196
  type InstallHandler = (payload: InstallPayload) => any | Promise<any>;
187
197
 
198
+ type UninstallPayload = {
199
+ version?: string;
200
+ };
201
+ type UninstallHandler = (payload: UninstallPayload) => any | Promise<any>;
202
+
188
203
  type CronPayload = Record<string, never>;
189
204
 
190
205
  type ObjectRecordDiff<T> = {
@@ -322,6 +337,15 @@ declare class AppConnectionAuthFailedError extends Error {
322
337
 
323
338
  declare const runAgent: (input: RunAgentInput) => Promise<RunAgentResult>;
324
339
 
340
+ type KvOptions = {
341
+ scope?: AppKeyValueScope;
342
+ };
343
+ declare const kv: {
344
+ get<TValue = unknown>(key: string, options?: KvOptions): Promise<TValue | null>;
345
+ set<TValue>(key: string, value: TValue, options?: KvOptions): Promise<void>;
346
+ delete(key: string, options?: KvOptions): Promise<boolean>;
347
+ };
348
+
325
349
  type ResponseInit = {
326
350
  status?: number;
327
351
  headers?: Record<string, string>;
@@ -334,5 +358,5 @@ declare class Response implements LogicFunctionHttpResponse {
334
358
  constructor(body: unknown, init?: ResponseInit);
335
359
  }
336
360
 
337
- export { AppConnectionAuthFailedError, ObjectRecordBaseEvent, ObjectRecordCreateEvent, ObjectRecordDeleteEvent, ObjectRecordDestroyEvent, ObjectRecordRestoreEvent, ObjectRecordUpdateEvent, ObjectRecordUpsertEvent, Response, findConnectionForRequest, getConnection, jsonSchemaToInputSchema, listConnections, runAgent };
338
- export type { AppConnection, CronPayload, DatabaseEventPayload, InputJsonSchema, InstallHandler, InstallPayload, ListConnectionsFilter, LogicFunctionConfig, LogicFunctionHandler, ObjectRecordEvent, ResponseInit, LogicFunctionEvent as RoutePayload, RunAgentInput, RunAgentResult };
361
+ export { AppConnectionAuthFailedError, ObjectRecordBaseEvent, ObjectRecordCreateEvent, ObjectRecordDeleteEvent, ObjectRecordDestroyEvent, ObjectRecordRestoreEvent, ObjectRecordUpdateEvent, ObjectRecordUpsertEvent, Response, findConnectionForRequest, getConnection, jsonSchemaToInputSchema, kv, listConnections, runAgent };
362
+ export type { AppConnection, AppKeyValue, AppKeyValueScope, CronPayload, DatabaseEventPayload, InputJsonSchema, InstallHandler, InstallPayload, ListConnectionsFilter, LogicFunctionConfig, LogicFunctionHandler, ObjectRecordEvent, ResponseInit, LogicFunctionEvent as RoutePayload, RunAgentInput, RunAgentResult, ServerRouteDispatchResult, ServerRouteResolverResult, UninstallHandler, UninstallPayload };
@@ -172,12 +172,46 @@ var v = "TWENTY_API_URL", y = "TWENTY_APP_ACCESS_TOKEN", b = async ({ query: e,
172
172
  caller: "runAgent"
173
173
  });
174
174
  return t;
175
- }, O = class {
175
+ }, O = "\n query GetAppKeyValue($key: String!, $scope: AppKeyValueScope) {\n appKeyValue(key: $key, scope: $scope) {\n key\n value\n scope\n }\n }\n", k = "\n mutation SetAppKeyValue($input: SetAppKeyValueInput!) {\n setAppKeyValue(input: $input) {\n key\n value\n scope\n }\n }\n", A = "\n mutation DeleteAppKeyValue($key: String!, $scope: AppKeyValueScope) {\n deleteAppKeyValue(key: $key, scope: $scope)\n }\n", j = "WORKSPACE", M = {
176
+ async get(e, t) {
177
+ let { appKeyValue: n } = await b({
178
+ query: O,
179
+ variables: {
180
+ key: e,
181
+ scope: t?.scope ?? j
182
+ },
183
+ caller: "kv.get"
184
+ });
185
+ return n?.value ?? null;
186
+ },
187
+ async set(e, t, n) {
188
+ await b({
189
+ query: k,
190
+ variables: { input: {
191
+ key: e,
192
+ value: t,
193
+ scope: n?.scope ?? j
194
+ } },
195
+ caller: "kv.set"
196
+ });
197
+ },
198
+ async delete(e, t) {
199
+ let { deleteAppKeyValue: n } = await b({
200
+ query: A,
201
+ variables: {
202
+ key: e,
203
+ scope: t?.scope ?? j
204
+ },
205
+ caller: "kv.delete"
206
+ });
207
+ return n;
208
+ }
209
+ }, N = class {
176
210
  constructor(e, t) {
177
211
  this.__twentyHttpResponse = !0, this.body = e, this.status = t?.status, this.headers = t?.headers;
178
212
  }
179
213
  };
180
214
  //#endregion
181
- export { g as AppConnectionAuthFailedError, O as Response, T as findConnectionForRequest, S as getConnection, s as jsonSchemaToInputSchema, w as listConnections, D as runAgent };
215
+ export { g as AppConnectionAuthFailedError, N as Response, T as findConnectionForRequest, S as getConnection, s as jsonSchemaToInputSchema, M as kv, w as listConnections, D as runAgent };
182
216
 
183
217
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["t","e","i","n","t","e","r","o","s","l","u","d","f","p","m","h","g","_","v","y","b","t","e","c","i","n","t"],"sources":["../../../twenty-shared/dist/is-record-object-schema-CwzshFdt.mjs","../../../twenty-shared/dist/logic-function.mjs","../../src/sdk/logic-function/connections/errors/app-connection-auth-failed.error.ts","../../../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/logic-function/utils/post-graphql-request.util.ts","../../src/sdk/logic-function/connections/get-connection.ts","../../src/sdk/logic-function/connections/list-connections.ts","../../src/sdk/logic-function/connections/find-connection-for-request.ts","../../src/sdk/logic-function/agents/run-agent.ts","../../src/sdk/logic-function/response.ts"],"sourcesContent":["import { isNonEmptyString as e } from \"@sniptt/guards\";\n//#region src/logic-function/is-record-object-schema.ts\nvar t = (t) => (t?.type === \"record\" || t?.type === \"object\") && e(t.objectUniversalIdentifier);\n//#endregion\nexport { t };\n","import { t as e } from \"./isDefined-Dtu5EYqP.mjs\";\nimport { t } from \"./is-record-object-schema-CwzshFdt.mjs\";\nimport { isNonEmptyString as n, isObject as r } from \"@sniptt/guards\";\n//#region src/logic-function/build-tool-input-json-schema.ts\nvar i = (e, t) => {\n\tlet r = n(e) ? t?.(e) : void 0;\n\treturn `Id of the ${n(r) ? r : \"linked\"} record`;\n}, a = (n, o) => {\n\tif (t(n)) return {\n\t\ttype: \"string\",\n\t\tdescription: i(n.objectUniversalIdentifier, o)\n\t};\n\tif (n.type === \"records\") return {\n\t\ttype: \"array\",\n\t\titems: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: i(n.objectUniversalIdentifier, o)\n\t\t}\n\t};\n\tlet { objectUniversalIdentifier: s, multiline: c, label: l, items: u, properties: d, additionalProperties: f, ...p } = n, m = { ...p };\n\treturn e(u) && (m.items = a(u, o)), e(d) && (m.properties = Object.fromEntries(Object.entries(d).map(([e, t]) => [e, a(t, o)]))), e(f) && (m.additionalProperties = r(f) ? a(f, o) : f), m;\n}, o = {\n\ttype: \"object\",\n\tproperties: {}\n}, s = (e) => {\n\tlet t = { type: \"unknown\" };\n\tswitch (e.type) {\n\t\tcase \"string\":\n\t\t\tt.type = \"string\";\n\t\t\tbreak;\n\t\tcase \"number\":\n\t\tcase \"integer\":\n\t\t\tt.type = \"number\";\n\t\t\tbreak;\n\t\tcase \"boolean\":\n\t\t\tt.type = \"boolean\";\n\t\t\tbreak;\n\t\tcase \"array\":\n\t\t\tt.type = \"array\", e.items && (t.items = s(e.items));\n\t\t\tbreak;\n\t\tcase \"object\":\n\t\t\tt.type = \"object\", e.properties && (t.properties = Object.fromEntries(Object.entries(e.properties).map(([e, t]) => [e, s(t)])));\n\t\t\tbreak;\n\t\tcase \"record\":\n\t\t\tt.type = \"record\";\n\t\t\tbreak;\n\t\tcase \"records\":\n\t\t\tt.type = \"records\";\n\t\t\tbreak;\n\t\tdefault: t.type = \"unknown\";\n\t}\n\treturn Array.isArray(e.enum) && (t.enum = e.enum.filter((e) => typeof e == \"string\")), e.multiline === !0 && (t.multiline = !0), n(e.label) && (t.label = e.label), n(e.objectUniversalIdentifier) && (t.objectUniversalIdentifier = e.objectUniversalIdentifier), t;\n}, c = (e) => [s(e)], l = { inputSchema: c({\n\ttype: \"object\",\n\tproperties: {\n\t\ta: { type: \"string\" },\n\t\tb: { type: \"number\" }\n\t}\n}) }, u = async (t) => {\n\tlet { getFunctionInputSchema: n } = await import(\"./get-function-input-schema-GNk3NRLJ.mjs\"), r = n(t)[0];\n\treturn r?.type === \"object\" && e(r.properties) ? {\n\t\ttype: \"object\",\n\t\tproperties: r.properties\n\t} : o;\n}, d = (t) => !e(t) || t === null ? \"unknown\" : typeof t == \"string\" ? \"string\" : typeof t == \"number\" ? \"number\" : typeof t == \"boolean\" ? \"boolean\" : Array.isArray(t) ? \"array\" : \"unknown\", f = (e) => e ? Object.entries(e).reduce((e, [t, n]) => (r(n) && !Array.isArray(n) ? e[t] = {\n\tisLeaf: !1,\n\ttype: \"object\",\n\tlabel: t,\n\tvalue: f(n)\n} : e[t] = {\n\tisLeaf: !0,\n\tvalue: n,\n\ttype: d(n),\n\tlabel: t\n}, e), {}) : {}, p = (e, t) => e ? `${e}.${t}` : t, m = (t, n, r = \"\") => {\n\tlet i = [];\n\tfor (let [a, o] of Object.entries(n)) {\n\t\tlet n = p(r, a), s = t[a];\n\t\tif (!e(s)) {\n\t\t\ti.push(`Missing key \"${n}\" in declared output schema.`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (o.isLeaf !== s.isLeaf) {\n\t\t\ti.push(`Type mismatch at \"${n}\": expected ${o.isLeaf ? o.type : \"object\"} but declared ${s.isLeaf ? s.type : \"object\"}.`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!o.isLeaf && !s.isLeaf) {\n\t\t\ti.push(...m(s.value, o.value, n));\n\t\t\tcontinue;\n\t\t}\n\t\to.isLeaf && s.isLeaf && o.type !== \"unknown\" && s.type !== \"unknown\" && o.type !== s.type && i.push(`Type mismatch at \"${n}\": expected ${o.type} but declared ${s.type}.`);\n\t}\n\treturn i;\n}, h = [\n\t\"string\",\n\t\"number\",\n\t\"boolean\",\n\t\"array\",\n\t\"unknown\"\n], g = (e) => h.includes(e), _ = (e, t) => {\n\tlet n = t.label ?? e;\n\treturn t.type === \"record\" ? {\n\t\tisLeaf: !0,\n\t\ttype: \"string\",\n\t\tlabel: n,\n\t\tvalue: null\n\t} : t.type === \"records\" ? {\n\t\tisLeaf: !0,\n\t\ttype: \"array\",\n\t\tlabel: n,\n\t\tvalue: null\n\t} : t.type === \"object\" ? {\n\t\tisLeaf: !1,\n\t\ttype: \"object\",\n\t\tlabel: n,\n\t\tvalue: r(t.properties) ? v(t.properties) : {}\n\t} : {\n\t\tisLeaf: !0,\n\t\ttype: g(t.type) ? t.type : \"unknown\",\n\t\tlabel: n,\n\t\tvalue: null\n\t};\n}, v = (e) => Object.entries(e).reduce((e, [t, n]) => (e[t] = _(t, n), e), {}), y = (e) => {\n\tlet t = e[0];\n\treturn t?.type !== \"object\" || !r(t.properties) ? {} : v(t.properties);\n}, b = (e) => e?.type === \"records\" && n(e.objectUniversalIdentifier) || e?.type === \"array\" && t(e?.items);\n//#endregion\nexport { o as DEFAULT_TOOL_INPUT_SCHEMA, l as SEED_WORKFLOW_ACTION_TRIGGER_SETTINGS, a as buildToolInputJsonSchema, u as getInputSchemaFromSourceCode, f as getOutputSchemaFromValue, m as getOutputSchemaMismatchIssues, y as inputSchemaToOutputSchema, b as isRecordArraySchema, t as isRecordObjectSchema, c as jsonSchemaToInputSchema };\n","// Thrown when the platform asks the SDK to operate on a connection whose\n// OAuth refresh failed permanently (`authFailedAt` is set). The end user\n// must reconnect from the app's settings tab — the app cannot recover on\n// its own.\n//\n// `listConnections` filters these out by default (the user can't act on\n// them anyway). `getConnection` throws this when the looked-up connection\n// is in this state, so a stored connection id can be safely retried until\n// it works again.\nexport class AppConnectionAuthFailedError extends Error {\n readonly connectionId: string;\n\n constructor(connectionId: string) {\n super(\n `App connection ${connectionId} requires the user to reconnect ` +\n `(authFailedAt is set). Surface a \"Reconnect\" prompt in your UI.`,\n );\n this.name = 'AppConnectionAuthFailedError';\n this.connectionId = connectionId;\n }\n}\n","//#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\nexport const postGraphqlRequest = async <TVariables, TData>({\n query,\n variables,\n caller,\n}: {\n query: string;\n variables: TVariables;\n caller: string;\n}): Promise<TData> => {\n const apiUrl = process.env[DEFAULT_API_URL_NAME];\n const accessToken = process.env[DEFAULT_APP_ACCESS_TOKEN_NAME];\n\n if (!apiUrl || !accessToken) {\n throw new Error(\n `${caller}() requires the app runtime env vars ` +\n `${DEFAULT_API_URL_NAME} and ${DEFAULT_APP_ACCESS_TOKEN_NAME}.`,\n );\n }\n\n const response = await fetch(`${apiUrl}/metadata`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${accessToken}`,\n },\n body: JSON.stringify({ query, variables }),\n });\n\n if (!response.ok) {\n throw new Error(\n `${caller}() failed: HTTP ${response.status} ${response.statusText}`,\n );\n }\n\n const body = (await response.json()) as {\n data?: TData;\n errors?: { message: string }[];\n };\n\n if (body.errors && body.errors.length > 0) {\n throw new Error(\n `${caller}() failed: ${body.errors.map((error) => error.message).join(', ')}`,\n );\n }\n\n if (!body.data) {\n throw new Error(`${caller}() failed: response contained no data.`);\n }\n\n return body.data;\n};\n","import { AppConnectionAuthFailedError } from '@/sdk/logic-function/connections/errors/app-connection-auth-failed.error';\nimport { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst GET_APP_CONNECTION_QUERY = `\n query GetAppConnection($id: ID!) {\n appConnection(id: $id) {\n id\n providerName\n name\n handle\n visibility\n userWorkspaceId\n accessToken\n scopes\n authFailedAt\n }\n }\n`;\n\nexport const getConnection = async (id: string): Promise<AppConnection> => {\n const { appConnection } = await postGraphqlRequest<\n { id: string },\n { appConnection: AppConnection }\n >({\n query: GET_APP_CONNECTION_QUERY,\n variables: { id },\n caller: 'getConnection',\n });\n\n if (appConnection.authFailedAt !== null) {\n throw new AppConnectionAuthFailedError(appConnection.id);\n }\n\n return appConnection;\n};\n","import { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst LIST_APP_CONNECTIONS_QUERY = `\n query ListAppConnections($filter: ListAppConnectionsInput) {\n appConnections(filter: $filter) {\n id\n providerName\n name\n handle\n visibility\n userWorkspaceId\n accessToken\n scopes\n authFailedAt\n }\n }\n`;\n\nexport type ListConnectionsFilter = {\n providerName?: string;\n userWorkspaceId?: string;\n visibility?: 'user' | 'workspace';\n};\n\nexport const listConnections = async (\n filter: ListConnectionsFilter = {},\n): Promise<AppConnection[]> => {\n const { appConnections } = await postGraphqlRequest<\n { filter: ListConnectionsFilter },\n { appConnections: AppConnection[] }\n >({\n query: LIST_APP_CONNECTIONS_QUERY,\n variables: { filter },\n caller: 'listConnections',\n });\n\n return appConnections;\n};\n","import { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\n\nexport const findConnectionForRequest = (\n connections: AppConnection[],\n event: { userWorkspaceId: string | null },\n): AppConnection | null => {\n if (event.userWorkspaceId !== null) {\n const personal = connections.find(\n (connection) =>\n connection.visibility === 'user' &&\n connection.userWorkspaceId === event.userWorkspaceId,\n );\n\n if (personal) {\n return personal;\n }\n }\n\n const workspaceShared = connections.find(\n (connection) => connection.visibility === 'workspace',\n );\n\n return workspaceShared ?? null;\n};\n","import {\n type RunAgentInput,\n type RunAgentResult,\n} from 'twenty-shared/application';\n\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst RUN_AGENT_MUTATION = `\n mutation RunAgent($input: RunAgentInput!) {\n runAgent(input: $input) {\n result\n error\n success\n }\n }\n`;\n\nexport const runAgent = async (\n input: RunAgentInput,\n): Promise<RunAgentResult> => {\n const { runAgent: result } = await postGraphqlRequest<\n { input: RunAgentInput },\n { runAgent: RunAgentResult }\n >({\n query: RUN_AGENT_MUTATION,\n variables: { input },\n caller: 'runAgent',\n });\n\n return result;\n};\n","import { type LogicFunctionHttpResponse } from 'twenty-shared/types';\n\nexport type ResponseInit = {\n status?: number;\n headers?: Record<string, string>;\n};\n\nexport class Response implements LogicFunctionHttpResponse {\n readonly __twentyHttpResponse = true as const;\n readonly body: unknown;\n readonly status?: number;\n readonly headers?: Record<string, string>;\n\n constructor(body: unknown, init?: ResponseInit) {\n this.body = body;\n this.status = init?.status;\n this.headers = init?.headers;\n }\n}\n"],"mappings":";;;;AAEA,IAAIA,KAAK,OAAO,GAAG,SAAS,YAAY,GAAG,SAAS,aAAaC,EAAE,EAAE,yBAAyB,GCE1FC,KAAK,GAAG,MAAM;CACjB,IAAI,IAAIC,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK;CAC7B,OAAO,aAAaA,EAAE,CAAC,IAAI,IAAI,SAAS;AACzC,GAAG,KAAK,GAAG,MAAM;CAChB,IAAIC,EAAE,CAAC,GAAG,OAAO;EAChB,MAAM;EACN,aAAaF,EAAE,EAAE,2BAA2B,CAAC;CAC9C;CACA,IAAI,EAAE,SAAS,WAAW,OAAO;EAChC,MAAM;EACN,OAAO;GACN,MAAM;GACN,aAAaA,EAAE,EAAE,2BAA2B,CAAC;EAC9C;CACD;CACA,IAAI,EAAE,2BAA2B,GAAG,WAAW,GAAG,OAAO,GAAG,OAAO,GAAG,YAAY,GAAG,sBAAsB,GAAG,GAAG,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE;CACrI,OAAOG,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,IAAIA,EAAE,CAAC,MAAM,EAAE,aAAa,OAAO,YAAY,OAAO,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAIA,EAAE,CA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W,EAAE,UAAO;EACpB,QAAQ;CACV,CAAC;CAED,OAAO;AACT,GCpCa,KACX,GACA,MACyB;CACzB,IAAI,EAAM,oBAAoB,MAAM;EAClC,IAAM,IAAW,EAAY,MAC1B,MACC,EAAW,eAAe,UAC1B,EAAW,oBAAoB,EAAM,eACzC;EAEA,IAAI,GACF,OAAO;CAEX;CAMA,OAJwB,EAAY,MACjC,MAAe,EAAW,eAAe,WAGrC,KAAmB;AAC5B,GChBM,IAAqB,0IAUd,IAAW,OACtB,MAC4B;CAC5B,IAAM,EAAE,UAAU,MAAW,MAAM,EAGjC;EACA,OAAO;EACP,WAAW,EAAE,SAAM;EACnB,QAAQ;CACV,CAAC;CAED,OAAO;AACT,GCvBa,IAAb,MAA2D;CAMzD,YAAY,GAAe,GAAqB;EAG9C,4BAR8B,IAM9B,KAAK,OAAO,GACZ,KAAK,SAAS,GAAM,QACpB,KAAK,UAAU,GAAM;CACvB;AACF"}
1
+ {"version":3,"file":"index.mjs","names":["t","e","i","n","t","e","r","o","s","l","u","d","f","p","m","h","g","_","v","y","b","t","e","c","i","n","t"],"sources":["../../../twenty-shared/dist/is-record-object-schema-CwzshFdt.mjs","../../../twenty-shared/dist/logic-function.mjs","../../src/sdk/logic-function/connections/errors/app-connection-auth-failed.error.ts","../../../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/logic-function/utils/post-graphql-request.util.ts","../../src/sdk/logic-function/connections/get-connection.ts","../../src/sdk/logic-function/connections/list-connections.ts","../../src/sdk/logic-function/connections/find-connection-for-request.ts","../../src/sdk/logic-function/agents/run-agent.ts","../../src/sdk/logic-function/key-value/kv.ts","../../src/sdk/logic-function/response.ts"],"sourcesContent":["import { isNonEmptyString as e } from \"@sniptt/guards\";\n//#region src/logic-function/is-record-object-schema.ts\nvar t = (t) => (t?.type === \"record\" || t?.type === \"object\") && e(t.objectUniversalIdentifier);\n//#endregion\nexport { t };\n","import { t as e } from \"./isDefined-Dtu5EYqP.mjs\";\nimport { t } from \"./is-record-object-schema-CwzshFdt.mjs\";\nimport { isNonEmptyString as n, isObject as r } from \"@sniptt/guards\";\n//#region src/logic-function/build-tool-input-json-schema.ts\nvar i = (e, t) => {\n\tlet r = n(e) ? t?.(e) : void 0;\n\treturn `Id of the ${n(r) ? r : \"linked\"} record`;\n}, a = (n, o) => {\n\tif (t(n)) return {\n\t\ttype: \"string\",\n\t\tdescription: i(n.objectUniversalIdentifier, o)\n\t};\n\tif (n.type === \"records\") return {\n\t\ttype: \"array\",\n\t\titems: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: i(n.objectUniversalIdentifier, o)\n\t\t}\n\t};\n\tlet { objectUniversalIdentifier: s, multiline: c, label: l, items: u, properties: d, additionalProperties: f, ...p } = n, m = { ...p };\n\treturn e(u) && (m.items = a(u, o)), e(d) && (m.properties = Object.fromEntries(Object.entries(d).map(([e, t]) => [e, a(t, o)]))), e(f) && (m.additionalProperties = r(f) ? a(f, o) : f), m;\n}, o = {\n\ttype: \"object\",\n\tproperties: {}\n}, s = (e) => {\n\tlet t = { type: \"unknown\" };\n\tswitch (e.type) {\n\t\tcase \"string\":\n\t\t\tt.type = \"string\";\n\t\t\tbreak;\n\t\tcase \"number\":\n\t\tcase \"integer\":\n\t\t\tt.type = \"number\";\n\t\t\tbreak;\n\t\tcase \"boolean\":\n\t\t\tt.type = \"boolean\";\n\t\t\tbreak;\n\t\tcase \"array\":\n\t\t\tt.type = \"array\", e.items && (t.items = s(e.items));\n\t\t\tbreak;\n\t\tcase \"object\":\n\t\t\tt.type = \"object\", e.properties && (t.properties = Object.fromEntries(Object.entries(e.properties).map(([e, t]) => [e, s(t)])));\n\t\t\tbreak;\n\t\tcase \"record\":\n\t\t\tt.type = \"record\";\n\t\t\tbreak;\n\t\tcase \"records\":\n\t\t\tt.type = \"records\";\n\t\t\tbreak;\n\t\tdefault: t.type = \"unknown\";\n\t}\n\treturn Array.isArray(e.enum) && (t.enum = e.enum.filter((e) => typeof e == \"string\")), e.multiline === !0 && (t.multiline = !0), n(e.label) && (t.label = e.label), n(e.objectUniversalIdentifier) && (t.objectUniversalIdentifier = e.objectUniversalIdentifier), t;\n}, c = (e) => [s(e)], l = { inputSchema: c({\n\ttype: \"object\",\n\tproperties: {\n\t\ta: { type: \"string\" },\n\t\tb: { type: \"number\" }\n\t}\n}) }, u = async (t) => {\n\tlet { getFunctionInputSchema: n } = await import(\"./get-function-input-schema-GNk3NRLJ.mjs\"), r = n(t)[0];\n\treturn r?.type === \"object\" && e(r.properties) ? {\n\t\ttype: \"object\",\n\t\tproperties: r.properties\n\t} : o;\n}, d = (t) => !e(t) || t === null ? \"unknown\" : typeof t == \"string\" ? \"string\" : typeof t == \"number\" ? \"number\" : typeof t == \"boolean\" ? \"boolean\" : Array.isArray(t) ? \"array\" : \"unknown\", f = (e) => e ? Object.entries(e).reduce((e, [t, n]) => (r(n) && !Array.isArray(n) ? e[t] = {\n\tisLeaf: !1,\n\ttype: \"object\",\n\tlabel: t,\n\tvalue: f(n)\n} : e[t] = {\n\tisLeaf: !0,\n\tvalue: n,\n\ttype: d(n),\n\tlabel: t\n}, e), {}) : {}, p = (e, t) => e ? `${e}.${t}` : t, m = (t, n, r = \"\") => {\n\tlet i = [];\n\tfor (let [a, o] of Object.entries(n)) {\n\t\tlet n = p(r, a), s = t[a];\n\t\tif (!e(s)) {\n\t\t\ti.push(`Missing key \"${n}\" in declared output schema.`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (o.isLeaf !== s.isLeaf) {\n\t\t\ti.push(`Type mismatch at \"${n}\": expected ${o.isLeaf ? o.type : \"object\"} but declared ${s.isLeaf ? s.type : \"object\"}.`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!o.isLeaf && !s.isLeaf) {\n\t\t\ti.push(...m(s.value, o.value, n));\n\t\t\tcontinue;\n\t\t}\n\t\to.isLeaf && s.isLeaf && o.type !== \"unknown\" && s.type !== \"unknown\" && o.type !== s.type && i.push(`Type mismatch at \"${n}\": expected ${o.type} but declared ${s.type}.`);\n\t}\n\treturn i;\n}, h = [\n\t\"string\",\n\t\"number\",\n\t\"boolean\",\n\t\"array\",\n\t\"unknown\"\n], g = (e) => h.includes(e), _ = (e, t) => {\n\tlet n = t.label ?? e;\n\treturn t.type === \"record\" ? {\n\t\tisLeaf: !0,\n\t\ttype: \"string\",\n\t\tlabel: n,\n\t\tvalue: null\n\t} : t.type === \"records\" ? {\n\t\tisLeaf: !0,\n\t\ttype: \"array\",\n\t\tlabel: n,\n\t\tvalue: null\n\t} : t.type === \"object\" ? {\n\t\tisLeaf: !1,\n\t\ttype: \"object\",\n\t\tlabel: n,\n\t\tvalue: r(t.properties) ? v(t.properties) : {}\n\t} : {\n\t\tisLeaf: !0,\n\t\ttype: g(t.type) ? t.type : \"unknown\",\n\t\tlabel: n,\n\t\tvalue: null\n\t};\n}, v = (e) => Object.entries(e).reduce((e, [t, n]) => (e[t] = _(t, n), e), {}), y = (e) => {\n\tlet t = e[0];\n\treturn t?.type !== \"object\" || !r(t.properties) ? {} : v(t.properties);\n}, b = (e) => e?.type === \"records\" && n(e.objectUniversalIdentifier) || e?.type === \"array\" && t(e?.items);\n//#endregion\nexport { o as DEFAULT_TOOL_INPUT_SCHEMA, l as SEED_WORKFLOW_ACTION_TRIGGER_SETTINGS, a as buildToolInputJsonSchema, u as getInputSchemaFromSourceCode, f as getOutputSchemaFromValue, m as getOutputSchemaMismatchIssues, y as inputSchemaToOutputSchema, b as isRecordArraySchema, t as isRecordObjectSchema, c as jsonSchemaToInputSchema };\n","// Thrown when the platform asks the SDK to operate on a connection whose\n// OAuth refresh failed permanently (`authFailedAt` is set). The end user\n// must reconnect from the app's settings tab — the app cannot recover on\n// its own.\n//\n// `listConnections` filters these out by default (the user can't act on\n// them anyway). `getConnection` throws this when the looked-up connection\n// is in this state, so a stored connection id can be safely retried until\n// it works again.\nexport class AppConnectionAuthFailedError extends Error {\n readonly connectionId: string;\n\n constructor(connectionId: string) {\n super(\n `App connection ${connectionId} requires the user to reconnect ` +\n `(authFailedAt is set). Surface a \"Reconnect\" prompt in your UI.`,\n );\n this.name = 'AppConnectionAuthFailedError';\n this.connectionId = connectionId;\n }\n}\n","//#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\nexport const postGraphqlRequest = async <TVariables, TData>({\n query,\n variables,\n caller,\n}: {\n query: string;\n variables: TVariables;\n caller: string;\n}): Promise<TData> => {\n const apiUrl = process.env[DEFAULT_API_URL_NAME];\n const accessToken = process.env[DEFAULT_APP_ACCESS_TOKEN_NAME];\n\n if (!apiUrl || !accessToken) {\n throw new Error(\n `${caller}() requires the app runtime env vars ` +\n `${DEFAULT_API_URL_NAME} and ${DEFAULT_APP_ACCESS_TOKEN_NAME}.`,\n );\n }\n\n const response = await fetch(`${apiUrl}/metadata`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${accessToken}`,\n },\n body: JSON.stringify({ query, variables }),\n });\n\n if (!response.ok) {\n throw new Error(\n `${caller}() failed: HTTP ${response.status} ${response.statusText}`,\n );\n }\n\n const body = (await response.json()) as {\n data?: TData;\n errors?: { message: string }[];\n };\n\n if (body.errors && body.errors.length > 0) {\n throw new Error(\n `${caller}() failed: ${body.errors.map((error) => error.message).join(', ')}`,\n );\n }\n\n if (!body.data) {\n throw new Error(`${caller}() failed: response contained no data.`);\n }\n\n return body.data;\n};\n","import { AppConnectionAuthFailedError } from '@/sdk/logic-function/connections/errors/app-connection-auth-failed.error';\nimport { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst GET_APP_CONNECTION_QUERY = `\n query GetAppConnection($id: ID!) {\n appConnection(id: $id) {\n id\n providerName\n name\n handle\n visibility\n userWorkspaceId\n accessToken\n scopes\n authFailedAt\n }\n }\n`;\n\nexport const getConnection = async (id: string): Promise<AppConnection> => {\n const { appConnection } = await postGraphqlRequest<\n { id: string },\n { appConnection: AppConnection }\n >({\n query: GET_APP_CONNECTION_QUERY,\n variables: { id },\n caller: 'getConnection',\n });\n\n if (appConnection.authFailedAt !== null) {\n throw new AppConnectionAuthFailedError(appConnection.id);\n }\n\n return appConnection;\n};\n","import { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst LIST_APP_CONNECTIONS_QUERY = `\n query ListAppConnections($filter: ListAppConnectionsInput) {\n appConnections(filter: $filter) {\n id\n providerName\n name\n handle\n visibility\n userWorkspaceId\n accessToken\n scopes\n authFailedAt\n }\n }\n`;\n\nexport type ListConnectionsFilter = {\n providerName?: string;\n userWorkspaceId?: string;\n visibility?: 'user' | 'workspace';\n};\n\nexport const listConnections = async (\n filter: ListConnectionsFilter = {},\n): Promise<AppConnection[]> => {\n const { appConnections } = await postGraphqlRequest<\n { filter: ListConnectionsFilter },\n { appConnections: AppConnection[] }\n >({\n query: LIST_APP_CONNECTIONS_QUERY,\n variables: { filter },\n caller: 'listConnections',\n });\n\n return appConnections;\n};\n","import { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\n\nexport const findConnectionForRequest = (\n connections: AppConnection[],\n event: { userWorkspaceId: string | null },\n): AppConnection | null => {\n if (event.userWorkspaceId !== null) {\n const personal = connections.find(\n (connection) =>\n connection.visibility === 'user' &&\n connection.userWorkspaceId === event.userWorkspaceId,\n );\n\n if (personal) {\n return personal;\n }\n }\n\n const workspaceShared = connections.find(\n (connection) => connection.visibility === 'workspace',\n );\n\n return workspaceShared ?? null;\n};\n","import {\n type RunAgentInput,\n type RunAgentResult,\n} from 'twenty-shared/application';\n\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst RUN_AGENT_MUTATION = `\n mutation RunAgent($input: RunAgentInput!) {\n runAgent(input: $input) {\n result\n error\n success\n }\n }\n`;\n\nexport const runAgent = async (\n input: RunAgentInput,\n): Promise<RunAgentResult> => {\n const { runAgent: result } = await postGraphqlRequest<\n { input: RunAgentInput },\n { runAgent: RunAgentResult }\n >({\n query: RUN_AGENT_MUTATION,\n variables: { input },\n caller: 'runAgent',\n });\n\n return result;\n};\n","import {\n type AppKeyValue,\n type AppKeyValueScope,\n} from 'twenty-shared/application';\n\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst GET_APP_KEY_VALUE_QUERY = `\n query GetAppKeyValue($key: String!, $scope: AppKeyValueScope) {\n appKeyValue(key: $key, scope: $scope) {\n key\n value\n scope\n }\n }\n`;\n\nconst SET_APP_KEY_VALUE_MUTATION = `\n mutation SetAppKeyValue($input: SetAppKeyValueInput!) {\n setAppKeyValue(input: $input) {\n key\n value\n scope\n }\n }\n`;\n\nconst DELETE_APP_KEY_VALUE_MUTATION = `\n mutation DeleteAppKeyValue($key: String!, $scope: AppKeyValueScope) {\n deleteAppKeyValue(key: $key, scope: $scope)\n }\n`;\n\nconst DEFAULT_APP_KEY_VALUE_SCOPE: AppKeyValueScope = 'WORKSPACE';\n\ntype KvOptions = {\n scope?: AppKeyValueScope;\n};\n\nexport const kv = {\n async get<TValue = unknown>(\n key: string,\n options?: KvOptions,\n ): Promise<TValue | null> {\n const { appKeyValue } = await postGraphqlRequest<\n { key: string; scope: AppKeyValueScope },\n { appKeyValue: AppKeyValue | null }\n >({\n query: GET_APP_KEY_VALUE_QUERY,\n variables: { key, scope: options?.scope ?? DEFAULT_APP_KEY_VALUE_SCOPE },\n caller: 'kv.get',\n });\n\n return (appKeyValue?.value ?? null) as TValue | null;\n },\n\n async set<TValue>(\n key: string,\n value: TValue,\n options?: KvOptions,\n ): Promise<void> {\n await postGraphqlRequest<\n {\n input: { key: string; value: TValue; scope: AppKeyValueScope };\n },\n { setAppKeyValue: AppKeyValue }\n >({\n query: SET_APP_KEY_VALUE_MUTATION,\n variables: {\n input: {\n key,\n value,\n scope: options?.scope ?? DEFAULT_APP_KEY_VALUE_SCOPE,\n },\n },\n caller: 'kv.set',\n });\n },\n\n async delete(key: string, options?: KvOptions): Promise<boolean> {\n const { deleteAppKeyValue } = await postGraphqlRequest<\n { key: string; scope: AppKeyValueScope },\n { deleteAppKeyValue: boolean }\n >({\n query: DELETE_APP_KEY_VALUE_MUTATION,\n variables: { key, scope: options?.scope ?? DEFAULT_APP_KEY_VALUE_SCOPE },\n caller: 'kv.delete',\n });\n\n return deleteAppKeyValue;\n },\n};\n","import { type LogicFunctionHttpResponse } from 'twenty-shared/types';\n\nexport type ResponseInit = {\n status?: number;\n headers?: Record<string, string>;\n};\n\nexport class Response implements LogicFunctionHttpResponse {\n readonly __twentyHttpResponse = true as const;\n readonly body: unknown;\n readonly status?: number;\n readonly headers?: Record<string, string>;\n\n constructor(body: unknown, init?: ResponseInit) {\n this.body = body;\n this.status = init?.status;\n this.headers = init?.headers;\n }\n}\n"],"mappings":";;;;AAEA,IAAIA,KAAK,OAAO,GAAG,SAAS,YAAY,GAAG,SAAS,aAAaC,EAAE,EAAE,yBAAyB,GCE1FC,KAAK,GAAG,MAAM;CACjB,IAAI,IAAIC,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK;CAC7B,OAAO,aAAaA,EAAE,CAAC,IAAI,IAAI,SAAS;AACzC,GAAG,KAAK,GAAG,MAAM;CAChB,IAAIC,EAAE,CAAC,GAAG,OAAO;EAChB,MAAM;EACN,aAAaF,EAAE,EAAE,2BAA2B,CAAC;CAC9C;CACA,IAAI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