twenty-sdk 2.19.0-alpha.1 → 2.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) 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-BXLh5-WO.mjs +18 -0
  4. package/dist/{catalog-sync-CzxQqSTp.js → catalog-sync-CrfskDrz.js} +1 -1
  5. package/dist/cli/utilities/api/api-service.d.ts +10 -0
  6. package/dist/cli/utilities/api/application-api.d.ts +10 -0
  7. package/dist/cli/utilities/auth/build-app-token-pair-fetcher.d.ts +5 -0
  8. package/dist/cli/utilities/auth/ensure-app-access-token-is-valid-or-refresh.d.ts +11 -4
  9. package/dist/cli/utilities/auth/ensure-app-registration.d.ts +1 -1
  10. package/dist/cli/utilities/build/common/esbuild-result-processor.d.ts +2 -2
  11. package/dist/cli/utilities/dev/orchestrator/dev-mode-orchestrator.d.ts +1 -0
  12. package/dist/cli/utilities/dev/orchestrator/steps/generate-api-client-orchestrator-step.d.ts +2 -4
  13. package/dist/cli/utilities/dev/orchestrator/steps/register-app-orchestrator-step.d.ts +1 -1
  14. package/dist/cli/utilities/version/get-server-version-from-api.d.ts +1 -0
  15. package/dist/cli.cjs +25 -32
  16. package/dist/cli.mjs +39604 -39589
  17. package/dist/define/index.cjs +19 -19
  18. package/dist/define/index.cjs.map +1 -1
  19. package/dist/define/index.d.ts +25 -18
  20. package/dist/define/index.mjs +5338 -5304
  21. package/dist/define/index.mjs.map +1 -1
  22. package/dist/front-component/index.cjs.map +1 -1
  23. package/dist/front-component/index.d.ts +1 -0
  24. package/dist/front-component/index.mjs +1 -1
  25. package/dist/front-component/index.mjs.map +1 -1
  26. package/dist/front-component-renderer/build.cjs +1 -1
  27. package/dist/front-component-renderer/build.mjs +6 -2
  28. package/dist/{get-front-component-build-plugins-Dqpyup2W.js → get-front-component-build-plugins-C7h3DVdC.js} +2 -2
  29. package/dist/{get-front-component-build-plugins-taotEFOp.mjs → get-front-component-build-plugins-klRAsPTE.mjs} +39 -32
  30. package/dist/get-function-input-schema-GNk3NRLJ-DSwo3Odm.mjs +77 -0
  31. package/dist/logic-function/index.cjs.map +1 -1
  32. package/dist/logic-function/index.mjs.map +1 -1
  33. package/dist/{login-D0JZTucw.mjs → login-BBQP9LPn.mjs} +6702 -6698
  34. package/dist/{login-BJysdHYg.js → login-zBnjqpkc.js} +60 -47
  35. package/dist/operations.cjs +1 -1
  36. package/dist/operations.mjs +8 -4
  37. package/dist/utils/index.cjs.map +1 -1
  38. package/dist/utils/index.mjs.map +1 -1
  39. package/package.json +2 -2
  40. package/dist/catalog-sync-wgNckz1h.mjs +0 -14
  41. package/dist/cli/utilities/build/manifest/utils/get-default-object-fields.d.ts +0 -6
  42. package/dist/get-function-input-schema-GNk3NRLJ-VtCYmX8G.mjs +0 -73
@@ -1 +1 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../get-front-component-build-plugins-Dqpyup2W.js");exports.getFrontComponentBuildPlugins=e.t;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../get-front-component-build-plugins-C7h3DVdC.js");exports.getFrontComponentBuildPlugins=e.t;
@@ -1,2 +1,6 @@
1
- import { t as e } from "../get-front-component-build-plugins-taotEFOp.mjs";
2
- export { e as getFrontComponentBuildPlugins };
1
+ import { createRequire as e } from "node:module";
2
+ import { fileURLToPath as t } from "node:url";
3
+ import { dirname as n } from "node:path";
4
+ e(import.meta.url), n(t(import.meta.url));
5
+ import { t as r } from "../get-front-component-build-plugins-klRAsPTE.mjs";
6
+ export { r as getFrontComponentBuildPlugins };
@@ -167,6 +167,6 @@ function createElement(type) {
167
167
  }
168
168
 
169
169
  export { createElement };
170
- export default Object.assign({}, _React, { createElement: createElement });`,_=e=>{let t=e?.usePreact??!1,n=t?`preact/jsx-runtime`:`react/jsx-runtime`,r=t?`preact/compat`:`react`;return{name:`jsx-runtime-remote-wrapper`,setup:e=>{let t,i;e.onResolve({filter:/^__jsx_shared_helpers__$/},()=>({path:`__jsx_shared_helpers__`,namespace:`jsx-shared-helpers`})),e.onLoad({filter:/.*/,namespace:`jsx-shared-helpers`},()=>({contents:m,loader:`js`})),e.onResolve({filter:/^react\/jsx-runtime$/},async r=>{if(!r.pluginData?.skipJsxWrapper)return t||=(await e.resolve(n,{kind:r.kind,resolveDir:r.resolveDir,pluginData:{skipJsxWrapper:!0}})).path,{path:`react/jsx-runtime`,namespace:`jsx-runtime-wrapper`}}),e.onResolve({filter:/^__real_react_jsx_runtime__$/},()=>{if(!t)throw Error(`jsx-runtime-remote-wrapper: real jsx-runtime path not resolved yet`);return{path:t}}),e.onLoad({filter:/.*/,namespace:`jsx-runtime-wrapper`},()=>({contents:h,loader:`js`})),e.onResolve({filter:/^react$/},async t=>{if(!t.pluginData?.skipJsxWrapper)return i||=(await e.resolve(r,{kind:t.kind,resolveDir:t.resolveDir,pluginData:{skipJsxWrapper:!0}})).path,{path:`react`,namespace:`react-wrapper`}}),e.onResolve({filter:/^__real_react__$/},()=>{if(!i)throw Error(`jsx-runtime-remote-wrapper: real react path not resolved yet`);return{path:i}}),e.onLoad({filter:/.*/,namespace:`react-wrapper`},()=>({contents:g,loader:`js`}))}}},v=/import\s*\{\s*defineFrontComponent\s*\}\s*from\s*['"][^'"]+['"];?\n?/g,y=/export\s+default\s+defineFrontComponent\s*\(\s*\{[\s\S]*?component\s*:\s*(\w+)[\s\S]*?\}\s*\)\s*;?/s,b=e=>{let t=e.replace(v,``),n=t.match(y);if(n){let e=n[1],r=RegExp(`export\\s+(const|function)\\s+${e}\\b`);t=t.replace(r,`$1 ${e}`),t=`import { createRoot as __createRoot } from 'react-dom/client';
170
+ export default Object.assign({}, _React, { createElement: createElement });`,_=e=>{let t=e?.usePreact??!1,n=t?`preact/jsx-runtime`:`react/jsx-runtime`,r=t?`preact/compat`:`react`;return{name:`jsx-runtime-remote-wrapper`,setup:e=>{let t,i;e.onResolve({filter:/^__jsx_shared_helpers__$/},()=>({path:`__jsx_shared_helpers__`,namespace:`jsx-shared-helpers`})),e.onLoad({filter:/.*/,namespace:`jsx-shared-helpers`},()=>({contents:m,loader:`js`})),e.onResolve({filter:/^react\/jsx-runtime$/},async r=>{if(!r.pluginData?.skipJsxWrapper)return t||=(await e.resolve(n,{kind:r.kind,resolveDir:r.resolveDir,pluginData:{skipJsxWrapper:!0}})).path,{path:`react/jsx-runtime`,namespace:`jsx-runtime-wrapper`}}),e.onResolve({filter:/^__real_react_jsx_runtime__$/},()=>{if(!t)throw Error(`jsx-runtime-remote-wrapper: real jsx-runtime path not resolved yet`);return{path:t}}),e.onLoad({filter:/.*/,namespace:`jsx-runtime-wrapper`},()=>({contents:h,loader:`js`})),e.onResolve({filter:/^react$/},async t=>{if(!t.pluginData?.skipJsxWrapper)return i||=(await e.resolve(r,{kind:t.kind,resolveDir:t.resolveDir,pluginData:{skipJsxWrapper:!0}})).path,{path:`react`,namespace:`react-wrapper`}}),e.onResolve({filter:/^__real_react__$/},()=>{if(!i)throw Error(`jsx-runtime-remote-wrapper: real react path not resolved yet`);return{path:i}}),e.onLoad({filter:/.*/,namespace:`react-wrapper`},()=>({contents:g,loader:`js`}))}}},v=/import\s*\{\s*defineFrontComponent\s*\}\s*from\s*['"][^'"]+['"];?\n?/g,y=/export\s+default\s+defineFrontComponent\s*\(/,b=/component\s*:\s*([A-Za-z_$][\w$]*)\s*[,}]/,x=`__frontComponentDefinition`,S=e=>{let t=e.replace(v,``);if(!y.test(t))return t;t=t.replace(y,`const ${x} = (`);let n=t.match(b);if(n){let e=n[1];t=t.replace(RegExp(`export\\s+(const|function)\\s+${e}\\b`),`$1 ${e}`)}return`import { createRoot as __createRoot } from 'react-dom/client';
171
171
  import { jsx as __frontComponentJsx } from 'react/jsx-runtime';
172
- `+t,t=t.replace(y,`export default function __renderFrontComponent(__container) { __createRoot(__container).render(__frontComponentJsx(${e}, {})); }`)}return t},x={name:`jsx-transform-to-remote-dom-worker-format-plugin`,setup:e=>{e.onLoad({filter:/\.tsx$/},async({path:e})=>{try{return{contents:b(await(0,d.readFile)(e,`utf8`)),loader:`tsx`}}catch(t){return{errors:[{text:`Failed to transform front component: ${t instanceof Error?t.message:String(t)}`,location:{file:e}}]}}})}},S=()=>({name:`preact-alias`,setup:e=>{let t;e.onResolve({filter:/^react-dom\/client$/},async n=>(t||=(await e.resolve(`preact/compat/client`,{kind:n.kind,resolveDir:n.resolveDir})).path,{path:t})),e.onResolve({filter:/^react-dom$/},async t=>({path:(await e.resolve(`preact/compat`,{kind:t.kind,resolveDir:t.resolveDir})).path}))}}),C=/^\/\/.*$\n/gm,w={name:`strip-comments`,setup:e=>{e.onEnd(async e=>{if(e.errors.length>0)return;let t=Object.keys(e.metafile?.outputs??{}).filter(e=>e.endsWith(`.mjs`));for(let e of t){let t=u.default.resolve(e),n=await(0,d.readFile)(t,`utf-8`),r=n.replace(C,``);r!==n&&await(0,d.writeFile)(t,r,`utf-8`)}})}},T=e=>[_(e?.usePreact?{usePreact:!0}:void 0),...e?.usePreact?[S()]:[],x,p,w];Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return T}});
172
+ `+t+`\nexport default function __renderFrontComponent(__container) { __createRoot(__container).render(__frontComponentJsx(${x}.component, {})); }\n`},C={name:`jsx-transform-to-remote-dom-worker-format-plugin`,setup:e=>{e.onLoad({filter:/\.tsx$/},async({path:e})=>{try{return{contents:S(await(0,d.readFile)(e,`utf8`)),loader:`tsx`}}catch(t){return{errors:[{text:`Failed to transform front component: ${t instanceof Error?t.message:String(t)}`,location:{file:e}}]}}})}},w=()=>({name:`preact-alias`,setup:e=>{let t;e.onResolve({filter:/^react-dom\/client$/},async n=>(t||=(await e.resolve(`preact/compat/client`,{kind:n.kind,resolveDir:n.resolveDir})).path,{path:t})),e.onResolve({filter:/^react-dom$/},async t=>({path:(await e.resolve(`preact/compat`,{kind:t.kind,resolveDir:t.resolveDir})).path}))}}),T=/^\/\/.*$\n/gm,E={name:`strip-comments`,setup:e=>{e.onEnd(async e=>{if(e.errors.length>0)return;let t=Object.keys(e.metafile?.outputs??{}).filter(e=>e.endsWith(`.mjs`));for(let e of t){let t=u.default.resolve(e),n=await(0,d.readFile)(t,`utf-8`),r=n.replace(T,``);r!==n&&await(0,d.writeFile)(t,r,`utf-8`)}})}},D=e=>[_(e?.usePreact?{usePreact:!0}:void 0),...e?.usePreact?[w()]:[],C,p,E];Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return D}});
@@ -1,19 +1,23 @@
1
- import e from "path";
2
- import { readFile as t, writeFile as n } from "node:fs/promises";
1
+ import { createRequire as e } from "node:module";
2
+ import { fileURLToPath as t } from "node:url";
3
+ import { dirname as n } from "node:path";
4
+ e(import.meta.url), n(t(import.meta.url));
5
+ import r from "path";
6
+ import { readFile as i, writeFile as a } from "node:fs/promises";
3
7
  //#region src/cli/utilities/build/common/front-component-build/css-injection-plugin.ts
4
- var r = (e) => `if (typeof document !== 'undefined') {
8
+ var o = (e) => `if (typeof document !== 'undefined') {
5
9
  const styleElement = document.createElement('style');
6
10
  document.head.appendChild(styleElement);
7
11
  styleElement.textContent = ${JSON.stringify(e)};
8
- }`, i = {
12
+ }`, s = {
9
13
  name: "css-injection",
10
14
  setup: (e) => {
11
15
  e.onLoad({ filter: /\.css$/ }, async ({ path: e }) => ({
12
- contents: r(await t(e, "utf8")),
16
+ contents: o(await i(e, "utf8")),
13
17
  loader: "js"
14
18
  }));
15
19
  }
16
- }, a = "export var customElementMap = globalThis.__HTML_TAG_TO_CUSTOM_ELEMENT_TAG__ || {};\n\nvar _injectedStyleKeys = {};\n\nexport function injectStyleViaHead(cssText) {\n if (!cssText) return;\n var hash = 0;\n for (var i = 0; i < cssText.length; i++) {\n hash = ((hash << 5) - hash + cssText.charCodeAt(i)) | 0;\n }\n var key = 'jsx-style-' + hash;\n if (_injectedStyleKeys[key]) return;\n _injectedStyleKeys[key] = true;\n var el = document.createElement('style');\n el.setAttribute('data-jsx-style', key);\n el.textContent = cssText;\n document.head.appendChild(el);\n}\n\nexport function extractCssText(children) {\n if (typeof children === 'string') return children;\n if (Array.isArray(children))\n return children\n .filter(function (c) { return typeof c === 'string'; })\n .join('');\n return '';\n}\n\nvar _reactToDomEvent = {\n ondoubleclick: 'ondblclick',\n};\n\nfunction _isEventProp(name) {\n return (\n name.length > 2 &&\n name.charCodeAt(0) === 111 &&\n name.charCodeAt(1) === 110 &&\n name.charCodeAt(2) >= 65 &&\n name.charCodeAt(2) <= 90\n );\n}\n\nexport function splitEventProps(props) {\n if (!props) return { cleanProps: props, events: null };\n var events = null;\n var cleanProps = null;\n for (var k in props) {\n if (_isEventProp(k) && typeof props[k] === 'function') {\n if (!events) {\n events = {};\n cleanProps = {};\n for (var j in props) {\n if (j === k) break;\n cleanProps[j] = props[j];\n }\n }\n events[k] = props[k];\n } else if (events) {\n cleanProps[k] = props[k];\n }\n }\n return { cleanProps: cleanProps || props, events: events };\n}\n\nexport function makeEventRef(events, userRef) {\n return function(el) {\n if (el) {\n for (var name in events) {\n var domName = _reactToDomEvent[name.toLowerCase()] || name.toLowerCase();\n el[domName] = events[name];\n }\n }\n if (typeof userRef === 'function') userRef(el);\n else if (userRef != null && typeof userRef === 'object') userRef.current = el;\n };\n}", o = "import {\n jsx as _originalJsx,\n jsxs as _originalJsxs,\n Fragment,\n} from '__real_react_jsx_runtime__';\n\nimport {\n customElementMap,\n injectStyleViaHead,\n extractCssText,\n splitEventProps,\n makeEventRef,\n} from '__jsx_shared_helpers__';\n\nfunction _wrapJsxFactory(originalFactory) {\n return function wrappedJsx(type, props, key) {\n if (typeof type === 'string') {\n if (type === 'style') {\n var css =\n props && props.dangerouslySetInnerHTML\n ? props.dangerouslySetInnerHTML.__html || ''\n : extractCssText(props && props.children);\n injectStyleViaHead(css);\n return null;\n }\n\n var customTag = customElementMap[type];\n if (customTag) {\n var split = splitEventProps(props);\n if (split.events) {\n var cp = split.cleanProps;\n cp.ref = makeEventRef(split.events, cp.ref);\n return originalFactory(customTag, cp, key);\n }\n return originalFactory(customTag, props, key);\n }\n }\n return originalFactory(type, props, key);\n };\n}\n\nexport var jsx = _wrapJsxFactory(_originalJsx);\nexport var jsxs = _wrapJsxFactory(_originalJsxs);\nexport { Fragment };", s = "export * from '__real_react__';\nimport _React from '__real_react__';\n\nimport {\n customElementMap,\n injectStyleViaHead,\n extractCssText,\n splitEventProps,\n makeEventRef,\n} from '__jsx_shared_helpers__';\n\nvar _originalCreateElement = _React.createElement;\n\nfunction createElement(type) {\n var args = arguments;\n if (typeof type === 'string') {\n if (type === 'style') {\n var props = args.length > 1 ? args[1] : null;\n if (props) {\n var css = props.dangerouslySetInnerHTML\n ? props.dangerouslySetInnerHTML.__html || ''\n : extractCssText(props.children);\n injectStyleViaHead(css);\n }\n return null;\n }\n\n var customTag = customElementMap[type];\n if (customTag) {\n var ceProps = args.length > 1 ? args[1] : null;\n var split = splitEventProps(ceProps);\n if (split.events) {\n var cp = split.cleanProps || {};\n cp.ref = makeEventRef(split.events, cp.ref);\n var newArgs = [customTag, cp];\n for (var i = 2; i < args.length; i++) newArgs.push(args[i]);\n return _originalCreateElement.apply(null, newArgs);\n }\n var newArgs2 = [customTag];\n for (var i2 = 1; i2 < args.length; i2++) newArgs2.push(args[i2]);\n return _originalCreateElement.apply(null, newArgs2);\n }\n }\n return _originalCreateElement.apply(null, args);\n}\n\nexport { createElement };\nexport default Object.assign({}, _React, { createElement: createElement });", c = (e) => {
20
+ }, c = "export var customElementMap = globalThis.__HTML_TAG_TO_CUSTOM_ELEMENT_TAG__ || {};\n\nvar _injectedStyleKeys = {};\n\nexport function injectStyleViaHead(cssText) {\n if (!cssText) return;\n var hash = 0;\n for (var i = 0; i < cssText.length; i++) {\n hash = ((hash << 5) - hash + cssText.charCodeAt(i)) | 0;\n }\n var key = 'jsx-style-' + hash;\n if (_injectedStyleKeys[key]) return;\n _injectedStyleKeys[key] = true;\n var el = document.createElement('style');\n el.setAttribute('data-jsx-style', key);\n el.textContent = cssText;\n document.head.appendChild(el);\n}\n\nexport function extractCssText(children) {\n if (typeof children === 'string') return children;\n if (Array.isArray(children))\n return children\n .filter(function (c) { return typeof c === 'string'; })\n .join('');\n return '';\n}\n\nvar _reactToDomEvent = {\n ondoubleclick: 'ondblclick',\n};\n\nfunction _isEventProp(name) {\n return (\n name.length > 2 &&\n name.charCodeAt(0) === 111 &&\n name.charCodeAt(1) === 110 &&\n name.charCodeAt(2) >= 65 &&\n name.charCodeAt(2) <= 90\n );\n}\n\nexport function splitEventProps(props) {\n if (!props) return { cleanProps: props, events: null };\n var events = null;\n var cleanProps = null;\n for (var k in props) {\n if (_isEventProp(k) && typeof props[k] === 'function') {\n if (!events) {\n events = {};\n cleanProps = {};\n for (var j in props) {\n if (j === k) break;\n cleanProps[j] = props[j];\n }\n }\n events[k] = props[k];\n } else if (events) {\n cleanProps[k] = props[k];\n }\n }\n return { cleanProps: cleanProps || props, events: events };\n}\n\nexport function makeEventRef(events, userRef) {\n return function(el) {\n if (el) {\n for (var name in events) {\n var domName = _reactToDomEvent[name.toLowerCase()] || name.toLowerCase();\n el[domName] = events[name];\n }\n }\n if (typeof userRef === 'function') userRef(el);\n else if (userRef != null && typeof userRef === 'object') userRef.current = el;\n };\n}", l = "import {\n jsx as _originalJsx,\n jsxs as _originalJsxs,\n Fragment,\n} from '__real_react_jsx_runtime__';\n\nimport {\n customElementMap,\n injectStyleViaHead,\n extractCssText,\n splitEventProps,\n makeEventRef,\n} from '__jsx_shared_helpers__';\n\nfunction _wrapJsxFactory(originalFactory) {\n return function wrappedJsx(type, props, key) {\n if (typeof type === 'string') {\n if (type === 'style') {\n var css =\n props && props.dangerouslySetInnerHTML\n ? props.dangerouslySetInnerHTML.__html || ''\n : extractCssText(props && props.children);\n injectStyleViaHead(css);\n return null;\n }\n\n var customTag = customElementMap[type];\n if (customTag) {\n var split = splitEventProps(props);\n if (split.events) {\n var cp = split.cleanProps;\n cp.ref = makeEventRef(split.events, cp.ref);\n return originalFactory(customTag, cp, key);\n }\n return originalFactory(customTag, props, key);\n }\n }\n return originalFactory(type, props, key);\n };\n}\n\nexport var jsx = _wrapJsxFactory(_originalJsx);\nexport var jsxs = _wrapJsxFactory(_originalJsxs);\nexport { Fragment };", u = "export * from '__real_react__';\nimport _React from '__real_react__';\n\nimport {\n customElementMap,\n injectStyleViaHead,\n extractCssText,\n splitEventProps,\n makeEventRef,\n} from '__jsx_shared_helpers__';\n\nvar _originalCreateElement = _React.createElement;\n\nfunction createElement(type) {\n var args = arguments;\n if (typeof type === 'string') {\n if (type === 'style') {\n var props = args.length > 1 ? args[1] : null;\n if (props) {\n var css = props.dangerouslySetInnerHTML\n ? props.dangerouslySetInnerHTML.__html || ''\n : extractCssText(props.children);\n injectStyleViaHead(css);\n }\n return null;\n }\n\n var customTag = customElementMap[type];\n if (customTag) {\n var ceProps = args.length > 1 ? args[1] : null;\n var split = splitEventProps(ceProps);\n if (split.events) {\n var cp = split.cleanProps || {};\n cp.ref = makeEventRef(split.events, cp.ref);\n var newArgs = [customTag, cp];\n for (var i = 2; i < args.length; i++) newArgs.push(args[i]);\n return _originalCreateElement.apply(null, newArgs);\n }\n var newArgs2 = [customTag];\n for (var i2 = 1; i2 < args.length; i2++) newArgs2.push(args[i2]);\n return _originalCreateElement.apply(null, newArgs2);\n }\n }\n return _originalCreateElement.apply(null, args);\n}\n\nexport { createElement };\nexport default Object.assign({}, _React, { createElement: createElement });", d = (e) => {
17
21
  let t = e?.usePreact ?? !1, n = t ? "preact/jsx-runtime" : "react/jsx-runtime", r = t ? "preact/compat" : "react";
18
22
  return {
19
23
  name: "jsx-runtime-remote-wrapper",
@@ -26,7 +30,7 @@ var r = (e) => `if (typeof document !== 'undefined') {
26
30
  filter: /.*/,
27
31
  namespace: "jsx-shared-helpers"
28
32
  }, () => ({
29
- contents: a,
33
+ contents: c,
30
34
  loader: "js"
31
35
  })), e.onResolve({ filter: /^react\/jsx-runtime$/ }, async (r) => {
32
36
  if (!r.pluginData?.skipJsxWrapper) return t ||= (await e.resolve(n, {
@@ -44,7 +48,7 @@ var r = (e) => `if (typeof document !== 'undefined') {
44
48
  filter: /.*/,
45
49
  namespace: "jsx-runtime-wrapper"
46
50
  }, () => ({
47
- contents: o,
51
+ contents: l,
48
52
  loader: "js"
49
53
  })), e.onResolve({ filter: /^react$/ }, async (t) => {
50
54
  if (!t.pluginData?.skipJsxWrapper) return i ||= (await e.resolve(r, {
@@ -62,25 +66,28 @@ var r = (e) => `if (typeof document !== 'undefined') {
62
66
  filter: /.*/,
63
67
  namespace: "react-wrapper"
64
68
  }, () => ({
65
- contents: s,
69
+ contents: u,
66
70
  loader: "js"
67
71
  }));
68
72
  }
69
73
  };
70
- }, l = /import\s*\{\s*defineFrontComponent\s*\}\s*from\s*['"][^'"]+['"];?\n?/g, u = /export\s+default\s+defineFrontComponent\s*\(\s*\{[\s\S]*?component\s*:\s*(\w+)[\s\S]*?\}\s*\)\s*;?/s, d = (e) => {
71
- let t = e.replace(l, ""), n = t.match(u);
74
+ }, f = /import\s*\{\s*defineFrontComponent\s*\}\s*from\s*['"][^'"]+['"];?\n?/g, p = /export\s+default\s+defineFrontComponent\s*\(/, m = /component\s*:\s*([A-Za-z_$][\w$]*)\s*[,}]/, h = "__frontComponentDefinition", g = (e) => {
75
+ let t = e.replace(f, "");
76
+ if (!p.test(t)) return t;
77
+ t = t.replace(p, `const ${h} = (`);
78
+ let n = t.match(m);
72
79
  if (n) {
73
- let e = n[1], r = RegExp(`export\\s+(const|function)\\s+${e}\\b`);
74
- t = t.replace(r, `$1 ${e}`), t = "import { createRoot as __createRoot } from 'react-dom/client';\nimport { jsx as __frontComponentJsx } from 'react/jsx-runtime';\n" + t, t = t.replace(u, `export default function __renderFrontComponent(__container) { __createRoot(__container).render(__frontComponentJsx(${e}, {})); }`);
80
+ let e = n[1];
81
+ t = t.replace(RegExp(`export\\s+(const|function)\\s+${e}\\b`), `$1 ${e}`);
75
82
  }
76
- return t;
77
- }, f = {
83
+ return "import { createRoot as __createRoot } from 'react-dom/client';\nimport { jsx as __frontComponentJsx } from 'react/jsx-runtime';\n" + t + `\nexport default function __renderFrontComponent(__container) { __createRoot(__container).render(__frontComponentJsx(${h}.component, {})); }\n`;
84
+ }, _ = {
78
85
  name: "jsx-transform-to-remote-dom-worker-format-plugin",
79
86
  setup: (e) => {
80
87
  e.onLoad({ filter: /\.tsx$/ }, async ({ path: e }) => {
81
88
  try {
82
89
  return {
83
- contents: d(await t(e, "utf8")),
90
+ contents: g(await i(e, "utf8")),
84
91
  loader: "tsx"
85
92
  };
86
93
  } catch (t) {
@@ -91,7 +98,7 @@ var r = (e) => `if (typeof document !== 'undefined') {
91
98
  }
92
99
  });
93
100
  }
94
- }, p = () => ({
101
+ }, v = () => ({
95
102
  name: "preact-alias",
96
103
  setup: (e) => {
97
104
  let t;
@@ -103,24 +110,24 @@ var r = (e) => `if (typeof document !== 'undefined') {
103
110
  resolveDir: t.resolveDir
104
111
  })).path }));
105
112
  }
106
- }), m = /^\/\/.*$\n/gm, h = {
113
+ }), y = /^\/\/.*$\n/gm, b = {
107
114
  name: "strip-comments",
108
- setup: (r) => {
109
- r.onEnd(async (r) => {
110
- if (r.errors.length > 0) return;
111
- let i = Object.keys(r.metafile?.outputs ?? {}).filter((e) => e.endsWith(".mjs"));
112
- for (let r of i) {
113
- let i = e.resolve(r), a = await t(i, "utf-8"), o = a.replace(m, "");
114
- o !== a && await n(i, o, "utf-8");
115
+ setup: (e) => {
116
+ e.onEnd(async (e) => {
117
+ if (e.errors.length > 0) return;
118
+ let t = Object.keys(e.metafile?.outputs ?? {}).filter((e) => e.endsWith(".mjs"));
119
+ for (let e of t) {
120
+ let t = r.resolve(e), n = await i(t, "utf-8"), o = n.replace(y, "");
121
+ o !== n && await a(t, o, "utf-8");
115
122
  }
116
123
  });
117
124
  }
118
- }, g = (e) => [
119
- c(e?.usePreact ? { usePreact: !0 } : void 0),
120
- ...e?.usePreact ? [p()] : [],
121
- f,
122
- i,
123
- h
125
+ }, x = (e) => [
126
+ d(e?.usePreact ? { usePreact: !0 } : void 0),
127
+ ...e?.usePreact ? [v()] : [],
128
+ _,
129
+ s,
130
+ b
124
131
  ];
125
132
  //#endregion
126
- export { g as t };
133
+ export { x as t };
@@ -0,0 +1,77 @@
1
+ import { createRequire as e } from "node:module";
2
+ import { fileURLToPath as t } from "node:url";
3
+ import { dirname as n } from "node:path";
4
+ e(import.meta.url), n(t(import.meta.url));
5
+ import { Ot as r } from "./login-BBQP9LPn.mjs";
6
+ import { ScriptTarget as i, SyntaxKind as a, createSourceFile as o } from "typescript";
7
+ //#region ../twenty-shared/dist/get-function-input-schema-GNk3NRLJ.mjs
8
+ var s = "TwentyRecord", c = (e) => {
9
+ let t = e.typeArguments?.[0];
10
+ if (r(t) && t.kind === a.LiteralType && t.literal.kind === a.StringLiteral) return t.literal.text;
11
+ }, l = (e) => e.type === "record" ? {
12
+ type: "records",
13
+ objectUniversalIdentifier: e.objectUniversalIdentifier
14
+ } : {
15
+ type: "array",
16
+ items: e
17
+ }, u = (e) => {
18
+ switch (e.kind) {
19
+ case a.NumberKeyword: return { type: "number" };
20
+ case a.StringKeyword: return { type: "string" };
21
+ case a.BooleanKeyword: return { type: "boolean" };
22
+ case a.ArrayType: return l(u(e.elementType));
23
+ case a.TypeReference: {
24
+ let t = e, n = t.typeName.kind === a.Identifier ? t.typeName.text : void 0;
25
+ if (n === "Array" || n === "ReadonlyArray") {
26
+ let e = t.typeArguments?.[0];
27
+ return l(r(e) ? u(e) : {});
28
+ }
29
+ if (n === s) {
30
+ let e = c(t);
31
+ if (r(e)) return {
32
+ type: "record",
33
+ objectUniversalIdentifier: e
34
+ };
35
+ }
36
+ return {};
37
+ }
38
+ case a.ObjectKeyword: return { type: "object" };
39
+ case a.TypeLiteral: {
40
+ let t = {};
41
+ return e.members.forEach((e) => {
42
+ if (r(e.name) && r(e.type)) {
43
+ let n = e.name.text;
44
+ t[n] = u(e.type);
45
+ }
46
+ }), {
47
+ type: "object",
48
+ properties: t
49
+ };
50
+ }
51
+ case a.UnionType: {
52
+ let t = e, n = [], r = !0;
53
+ return t.types.forEach((e) => {
54
+ if (e.kind === a.LiteralType) {
55
+ let t = e.literal;
56
+ t.kind === a.StringLiteral ? n.push(t.text) : r = !1;
57
+ } else r = !1;
58
+ }), r ? {
59
+ type: "string",
60
+ enum: n
61
+ } : {};
62
+ }
63
+ default: return {};
64
+ }
65
+ }, d = (e, t) => e.parameters.reduce((e, t) => {
66
+ let n = t.type;
67
+ return r(n) ? [...e, u(n)] : [...e, {}];
68
+ }, t), f = (e) => e.kind === a.FunctionDeclaration ? [e] : e.kind === a.VariableStatement ? e.declarationList.declarations.filter((e) => r(e.initializer) && e.initializer.kind === a.ArrowFunction).map((e) => e.initializer) : [], p = (e) => {
69
+ let t = o("temp.ts", e, i.ESNext, !0), n = [];
70
+ return t.forEachChild((e) => {
71
+ (e.kind === a.FunctionDeclaration || e.kind === a.VariableStatement) && f(e).forEach((e) => {
72
+ n = d(e, n);
73
+ });
74
+ }), n;
75
+ };
76
+ //#endregion
77
+ export { p as getFunctionInputSchema };
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["t","a","t","e","o","s","l","u","d","f","p","m","h","g","_","v","y","b","e","t","e","c","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-field-universal-identifier.util-CK9_m9RQ.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});\n//#endregion\nexport { n, t as r, r as t };\n","import { n as e, t } from \"./ViewKey-YV4NySfb.mjs\";\nimport { n, r, t as i } from \"./get-field-universal-identifier.util-CK9_m9RQ.mjs\";\n//#region src/application/applicationVariablesType.ts\nvar a = [\n\te.TEXT,\n\te.ARRAY,\n\te.BOOLEAN,\n\te.DATE,\n\te.DATE_TIME,\n\te.NUMBER,\n\te.NUMERIC,\n\te.RAW_JSON,\n\te.RICH_TEXT,\n\te.SELECT,\n\te.MULTI_SELECT\n], o = \"public\", s = \"TWENTY_API_KEY\", c = \"TWENTY_API_URL\", l = \"TWENTY_APP_ACCESS_TOKEN\", u = \"TWENTY_FUNCTIONS_URL\", d = \"generated\", f = { js: \"import { createRequire as __createRequire } from 'module';\\nconst require = __createRequire(import.meta.url);\" }, p = \".twenty/output\", m = \"Standard\", h = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"agent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), g = ({ applicationUniversalIdentifier: e, key: t }) => n({\n\tentityNamespace: \"applicationVariable\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), _ = \"navigation\", v = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL:${t}`,\n\tapplicationUniversalIdentifier: e\n}), y = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL_OBJECT_CONTEXT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), b = ({ applicationUniversalIdentifier: e, engineComponentKey: t, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `RECORD_SELECTION:${t}:${r ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), x = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `${t}:${_}`,\n\tapplicationUniversalIdentifier: e\n}), S = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"connectionProvider\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), C = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, fieldUniversalIdentifier: r }) => n({\n\tentityNamespace: \"fieldPermission\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), w = ({ applicationUniversalIdentifier: e, componentName: t }) => n({\n\tentityNamespace: \"frontComponent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), T = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"index\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), E = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"logicFunction\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), D = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `FOLDER:${t}`,\n\tapplicationUniversalIdentifier: e\n}), O = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `OBJECT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), k = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `VIEW:${t}`,\n\tapplicationUniversalIdentifier: e\n}), A = ({ applicationUniversalIdentifier: e, link: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `LINK:${t}`,\n\tapplicationUniversalIdentifier: e\n}), j = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"objectPermission\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), M = ({ applicationUniversalIdentifier: e, nameSingular: t }) => n({\n\tentityNamespace: \"objectMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), N = ({ applicationUniversalIdentifier: e, pageLayoutUniversalIdentifier: t, title: r }) => n({\n\tentityNamespace: \"pageLayoutTab\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), P = \"RECORD_PAGE\", F = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"pageLayout\",\n\tvalue: t ? `${t}:${r}` : r,\n\tapplicationUniversalIdentifier: e\n}), I = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"pageLayout\",\n\tvalue: `${t}:${P}`,\n\tapplicationUniversalIdentifier: e\n}), L = ({ applicationUniversalIdentifier: e, pageLayoutTabUniversalIdentifier: t, title: r }) => n({\n\tentityNamespace: \"pageLayoutWidget\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), R = ({ applicationUniversalIdentifier: e, key: t }) => n({\n\tentityNamespace: \"permissionFlag\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), z = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, permissionFlagUniversalIdentifier: r }) => n({\n\tentityNamespace: \"rolePermissionFlag\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), B = ({ applicationUniversalIdentifier: e, label: t }) => n({\n\tentityNamespace: \"role\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), V = ({ applicationUniversalIdentifier: e, fieldMetadataUniversalIdentifier: t }) => n({\n\tentityNamespace: \"searchFieldMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), H = ({ applicationUniversalIdentifier: e, fieldUniversalIdentifier: t, value: r }) => n({\n\tentityNamespace: \"selectOption\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), U = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"skill\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), W = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"viewFieldGroup\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), G = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r }) => n({\n\tentityNamespace: \"viewField\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), K = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r, operand: i, subFieldName: a }) => n({\n\tentityNamespace: \"viewFilter\",\n\tvalue: `${t}:${r}:${i}:${a ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), q = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldValue: r }) => n({\n\tentityNamespace: \"viewGroup\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), J = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r }) => n({\n\tentityNamespace: \"viewSort\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), Y = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"view\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), X = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"view\",\n\tvalue: `${r}:${t.INDEX}`,\n\tapplicationUniversalIdentifier: e\n}), Z = ({ applicationUniversalIdentifier: e, pageLayoutWidgetUniversalIdentifier: t }) => n({\n\tentityNamespace: \"view\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), Q = /* @__PURE__ */ function(e) {\n\treturn e.Object = \"object\", e.Field = \"field\", e.LogicFunction = \"logicFunction\", e.FrontComponent = \"frontComponent\", e.Role = \"role\", e.Skill = \"skill\", e.Agent = \"agent\", e.ConnectionProvider = \"connectionProvider\", e.View = \"view\", e.ViewField = \"viewField\", e.NavigationMenuItem = \"navigationMenuItem\", e.PageLayout = \"pageLayout\", e.PageLayoutTab = \"pageLayoutTab\", e.CommandMenuItem = \"commandMenuItem\", e;\n}({}), $ = (t, n = e.TEXT) => {\n\tif (t == null) return \"\";\n\tswitch (n) {\n\t\tcase e.BOOLEAN: return String(t) === \"true\" ? \"true\" : \"false\";\n\t\tcase e.NUMBER:\n\t\tcase e.NUMERIC: return String(t);\n\t\tcase e.ARRAY:\n\t\tcase e.MULTI_SELECT:\n\t\t\tif (Array.isArray(t)) return JSON.stringify(t);\n\t\t\tif (typeof t == \"string\") {\n\t\t\t\ttry {\n\t\t\t\t\tlet e = JSON.parse(t);\n\t\t\t\t\tif (Array.isArray(e)) return t;\n\t\t\t\t} catch {}\n\t\t\t\treturn JSON.stringify([t]);\n\t\t\t}\n\t\t\treturn JSON.stringify(t);\n\t\tcase e.RAW_JSON:\n\t\tcase e.RICH_TEXT: return typeof t == \"string\" ? t : JSON.stringify(t);\n\t\tdefault: return typeof t == \"string\" ? t : String(t);\n\t}\n}, ee = (t, n = e.TEXT) => {\n\tif (t === \"\") return n === e.ARRAY || n === e.MULTI_SELECT ? [] : \"\";\n\tswitch (n) {\n\t\tcase e.BOOLEAN: return t === \"true\";\n\t\tcase e.NUMBER:\n\t\tcase e.NUMERIC: {\n\t\t\tlet e = Number(t);\n\t\t\treturn Number.isNaN(e) ? t : e;\n\t\t}\n\t\tcase e.ARRAY:\n\t\tcase e.MULTI_SELECT: try {\n\t\t\tlet e = JSON.parse(t);\n\t\t\treturn Array.isArray(e) ? e : [];\n\t\t} catch {\n\t\t\treturn [];\n\t\t}\n\t\tcase e.RAW_JSON:\n\t\tcase e.RICH_TEXT: try {\n\t\t\treturn JSON.parse(t);\n\t\t} catch {\n\t\t\treturn t;\n\t\t}\n\t\tdefault: return t;\n\t}\n};\n//#endregion\nexport { a as APPLICATION_VARIABLE_FIELD_METADATA_TYPES, o as ASSETS_DIR, s as DEFAULT_API_KEY_NAME, c as DEFAULT_API_URL_NAME, l as DEFAULT_APP_ACCESS_TOKEN_NAME, u as DEFAULT_FUNCTIONS_URL_NAME, d as GENERATED_DIR, f as NODE_ESM_CJS_BANNER, p as OUTPUT_DIR, Q as SyncableEntity, m as TWENTY_STANDARD_APPLICATION_NAME, r as TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER, n as computeDeterministicUuid, ee as deserializeApplicationVariableValue, h as getAgentUniversalIdentifier, g as getApplicationVariableUniversalIdentifier, S as getConnectionProviderUniversalIdentifier, C as getFieldPermissionUniversalIdentifier, i as getFieldUniversalIdentifier, Z as getFieldsWidgetViewUniversalIdentifier, D as getFolderNavigationMenuItemUniversalIdentifier, w as getFrontComponentUniversalIdentifier, v as getGlobalCommandMenuItemUniversalIdentifier, y as getGlobalObjectContextCommandMenuItemUniversalIdentifier, T as getIndexUniversalIdentifier, X as getIndexViewUniversalIdentifier, A as getLinkNavigationMenuItemUniversalIdentifier, E as getLogicFunctionUniversalIdentifier, x as getNavigationCommandUniversalIdentifier, O as getObjectNavigationMenuItemUniversalIdentifier, j as getObjectPermissionUniversalIdentifier, M as getObjectUniversalIdentifier, N as getPageLayoutTabUniversalIdentifier, F as getPageLayoutUniversalIdentifier, L as getPageLayoutWidgetUniversalIdentifier, R as getPermissionFlagUniversalIdentifier, I as getRecordPageLayoutUniversalIdentifier, b as getRecordSelectionCommandMenuItemUniversalIdentifier, z as getRolePermissionFlagUniversalIdentifier, B as getRoleUniversalIdentifier, V as getSearchFieldUniversalIdentifier, H as getSelectOptionUniversalIdentifier, U as getSkillUniversalIdentifier, W as getViewFieldGroupUniversalIdentifier, G as getViewFieldUniversalIdentifier, K as getViewFilterUniversalIdentifier, q as getViewGroupUniversalIdentifier, k as getViewNavigationMenuItemUniversalIdentifier, J as getViewSortUniversalIdentifier, Y as getViewUniversalIdentifier, $ as serializeApplicationVariableValue };\n","import {\n DEFAULT_API_URL_NAME,\n DEFAULT_APP_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application';\n\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,ECE1F,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,EAAGC,GAAK,EAAG,IAAM,CAChB,GAAIC,EAAE,CAAC,EAAG,MAAO,CAChB,KAAM,SACN,YAAa,EAAE,EAAE,0BAA2B,CAAC,CAC9C,EACA,GAAI,EAAE,OAAS,UAAW,MAAO,CAChC,KAAM,QACN,MAAO,CACN,KAAM,SACN,YAAa,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,OAAOC,EAAAA,EAAE,CAAC,IAAM,EAAE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AAM,CAAE,iBAAkB,MAAM,EAG9B,CACA,MAAO,EACP,UAAW,CAAE,IAAG,EAChB,OAAQ,eACV,CAAC,EAED,GAAI,EAAc,eAAiB,KACjC,MAAM,IAAI,EAA6B,EAAc,EAAE,EAGzD,OAAO,CACT,EChCM,EAA6B;;;;;;;;;;;;;;EAsBtB,EAAkB,MAC7B,EAAgC,CAAC,IACJ,CAC7B,GAAM,CAAE,kBAAmB,MAAM,EAG/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","a","t","e","o","s","l","u","d","f","p","m","h","g","_","v","y","b","e","t","e","c","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-field-universal-identifier.util-CK9_m9RQ.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});\n//#endregion\nexport { n, t as r, r as t };\n","import { n as e, t } from \"./ViewKey-YV4NySfb.mjs\";\nimport { n, r, t as i } from \"./get-field-universal-identifier.util-CK9_m9RQ.mjs\";\n//#region src/application/applicationCategoryType.ts\nvar a = [\n\t\"Communication\",\n\t\"Productivity\",\n\t\"Product management\",\n\t\"Sales\",\n\t\"Marketing\",\n\t\"Enrichment\",\n\t\"Data\",\n\t\"Search\",\n\t\"Other\"\n], o = (e) => a.includes(e), s = [\n\te.TEXT,\n\te.ARRAY,\n\te.BOOLEAN,\n\te.DATE,\n\te.DATE_TIME,\n\te.NUMBER,\n\te.NUMERIC,\n\te.RAW_JSON,\n\te.RICH_TEXT,\n\te.SELECT,\n\te.MULTI_SELECT\n], c = \"public\", l = \"TWENTY_API_KEY\", u = \"TWENTY_API_URL\", d = \"TWENTY_APP_ACCESS_TOKEN\", f = \"TWENTY_FUNCTIONS_URL\", p = \"generated\", m = { js: \"import { createRequire as __createRequire } from 'module';\\nconst require = __createRequire(import.meta.url);\" }, h = \".twenty/output\", g = \"Standard\", _ = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"agent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), v = ({ applicationUniversalIdentifier: e, key: t }) => n({\n\tentityNamespace: \"applicationVariable\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), y = \"navigation\", b = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL:${t}`,\n\tapplicationUniversalIdentifier: e\n}), x = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL_OBJECT_CONTEXT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), S = ({ applicationUniversalIdentifier: e, engineComponentKey: t, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `RECORD_SELECTION:${t}:${r ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), C = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `${t}:${y}`,\n\tapplicationUniversalIdentifier: e\n}), w = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"connectionProvider\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), T = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, fieldUniversalIdentifier: r }) => n({\n\tentityNamespace: \"fieldPermission\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), E = ({ applicationUniversalIdentifier: e, componentName: t }) => n({\n\tentityNamespace: \"frontComponent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), D = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"index\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), O = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"logicFunction\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), k = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `FOLDER:${t}`,\n\tapplicationUniversalIdentifier: e\n}), A = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `OBJECT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), ee = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `VIEW:${t}`,\n\tapplicationUniversalIdentifier: e\n}), j = ({ applicationUniversalIdentifier: e, link: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `LINK:${t}`,\n\tapplicationUniversalIdentifier: e\n}), M = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"objectPermission\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), N = ({ applicationUniversalIdentifier: e, nameSingular: t }) => n({\n\tentityNamespace: \"objectMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), P = ({ applicationUniversalIdentifier: e, pageLayoutUniversalIdentifier: t, title: r }) => n({\n\tentityNamespace: \"pageLayoutTab\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), F = \"RECORD_PAGE\", I = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"pageLayout\",\n\tvalue: t ? `${t}:${r}` : r,\n\tapplicationUniversalIdentifier: e\n}), L = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"pageLayout\",\n\tvalue: `${t}:${F}`,\n\tapplicationUniversalIdentifier: e\n}), R = ({ applicationUniversalIdentifier: e, pageLayoutTabUniversalIdentifier: t, title: r }) => n({\n\tentityNamespace: \"pageLayoutWidget\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), z = ({ applicationUniversalIdentifier: e, key: t }) => n({\n\tentityNamespace: \"permissionFlag\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), B = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, permissionFlagUniversalIdentifier: r }) => n({\n\tentityNamespace: \"rolePermissionFlag\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), V = ({ applicationUniversalIdentifier: e, label: t }) => n({\n\tentityNamespace: \"role\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), H = ({ applicationUniversalIdentifier: e, fieldMetadataUniversalIdentifier: t }) => n({\n\tentityNamespace: \"searchFieldMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), U = ({ applicationUniversalIdentifier: e, fieldUniversalIdentifier: t, value: r }) => n({\n\tentityNamespace: \"selectOption\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), W = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"skill\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), G = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"viewFieldGroup\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), K = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r }) => n({\n\tentityNamespace: \"viewField\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), q = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r, operand: i, subFieldName: a }) => n({\n\tentityNamespace: \"viewFilter\",\n\tvalue: `${t}:${r}:${i}:${a ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), J = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldValue: r }) => n({\n\tentityNamespace: \"viewGroup\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), Y = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r }) => n({\n\tentityNamespace: \"viewSort\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), X = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"view\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), Z = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"view\",\n\tvalue: `${r}:${t.INDEX}`,\n\tapplicationUniversalIdentifier: e\n}), Q = ({ applicationUniversalIdentifier: e, pageLayoutWidgetUniversalIdentifier: t }) => n({\n\tentityNamespace: \"view\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), $ = /* @__PURE__ */ function(e) {\n\treturn e.Object = \"object\", e.Field = \"field\", e.LogicFunction = \"logicFunction\", e.FrontComponent = \"frontComponent\", e.Role = \"role\", e.Skill = \"skill\", e.Agent = \"agent\", e.ConnectionProvider = \"connectionProvider\", e.View = \"view\", e.ViewField = \"viewField\", e.NavigationMenuItem = \"navigationMenuItem\", e.PageLayout = \"pageLayout\", e.PageLayoutTab = \"pageLayoutTab\", e.CommandMenuItem = \"commandMenuItem\", e;\n}({}), te = (t, n = e.TEXT) => {\n\tif (t == null) return \"\";\n\tswitch (n) {\n\t\tcase e.BOOLEAN: return String(t) === \"true\" ? \"true\" : \"false\";\n\t\tcase e.NUMBER:\n\t\tcase e.NUMERIC: return String(t);\n\t\tcase e.ARRAY:\n\t\tcase e.MULTI_SELECT:\n\t\t\tif (Array.isArray(t)) return JSON.stringify(t);\n\t\t\tif (typeof t == \"string\") {\n\t\t\t\ttry {\n\t\t\t\t\tlet e = JSON.parse(t);\n\t\t\t\t\tif (Array.isArray(e)) return t;\n\t\t\t\t} catch {}\n\t\t\t\treturn JSON.stringify([t]);\n\t\t\t}\n\t\t\treturn JSON.stringify(t);\n\t\tcase e.RAW_JSON:\n\t\tcase e.RICH_TEXT: return typeof t == \"string\" ? t : JSON.stringify(t);\n\t\tdefault: return typeof t == \"string\" ? t : String(t);\n\t}\n}, ne = (t, n = e.TEXT) => {\n\tif (t === \"\") return n === e.ARRAY || n === e.MULTI_SELECT ? [] : \"\";\n\tswitch (n) {\n\t\tcase e.BOOLEAN: return t === \"true\";\n\t\tcase e.NUMBER:\n\t\tcase e.NUMERIC: {\n\t\t\tlet e = Number(t);\n\t\t\treturn Number.isNaN(e) ? t : e;\n\t\t}\n\t\tcase e.ARRAY:\n\t\tcase e.MULTI_SELECT: try {\n\t\t\tlet e = JSON.parse(t);\n\t\t\treturn Array.isArray(e) ? e : [];\n\t\t} catch {\n\t\t\treturn [];\n\t\t}\n\t\tcase e.RAW_JSON:\n\t\tcase e.RICH_TEXT: try {\n\t\t\treturn JSON.parse(t);\n\t\t} catch {\n\t\t\treturn t;\n\t\t}\n\t\tdefault: return t;\n\t}\n};\n//#endregion\nexport { a as APPLICATION_CATEGORIES, s as APPLICATION_VARIABLE_FIELD_METADATA_TYPES, c as ASSETS_DIR, l as DEFAULT_API_KEY_NAME, u as DEFAULT_API_URL_NAME, d as DEFAULT_APP_ACCESS_TOKEN_NAME, f as DEFAULT_FUNCTIONS_URL_NAME, p as GENERATED_DIR, m as NODE_ESM_CJS_BANNER, h as OUTPUT_DIR, $ as SyncableEntity, g as TWENTY_STANDARD_APPLICATION_NAME, r as TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER, n as computeDeterministicUuid, ne as deserializeApplicationVariableValue, _ as getAgentUniversalIdentifier, v as getApplicationVariableUniversalIdentifier, w as getConnectionProviderUniversalIdentifier, T as getFieldPermissionUniversalIdentifier, i as getFieldUniversalIdentifier, Q as getFieldsWidgetViewUniversalIdentifier, k as getFolderNavigationMenuItemUniversalIdentifier, E as getFrontComponentUniversalIdentifier, b as getGlobalCommandMenuItemUniversalIdentifier, x as getGlobalObjectContextCommandMenuItemUniversalIdentifier, D as getIndexUniversalIdentifier, Z as getIndexViewUniversalIdentifier, j as getLinkNavigationMenuItemUniversalIdentifier, O as getLogicFunctionUniversalIdentifier, C as getNavigationCommandUniversalIdentifier, A as getObjectNavigationMenuItemUniversalIdentifier, M as getObjectPermissionUniversalIdentifier, N as getObjectUniversalIdentifier, P as getPageLayoutTabUniversalIdentifier, I as getPageLayoutUniversalIdentifier, R as getPageLayoutWidgetUniversalIdentifier, z as getPermissionFlagUniversalIdentifier, L as getRecordPageLayoutUniversalIdentifier, S as getRecordSelectionCommandMenuItemUniversalIdentifier, B as getRolePermissionFlagUniversalIdentifier, V as getRoleUniversalIdentifier, H as getSearchFieldUniversalIdentifier, U as getSelectOptionUniversalIdentifier, W as getSkillUniversalIdentifier, G as getViewFieldGroupUniversalIdentifier, K as getViewFieldUniversalIdentifier, q as getViewFilterUniversalIdentifier, J as getViewGroupUniversalIdentifier, ee as getViewNavigationMenuItemUniversalIdentifier, Y as getViewSortUniversalIdentifier, X as getViewUniversalIdentifier, o as isKnownApplicationCategory, te as serializeApplicationVariableValue };\n","import {\n DEFAULT_API_URL_NAME,\n DEFAULT_APP_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application';\n\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,ECE1F,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,EAAGC,GAAK,EAAG,IAAM,CAChB,GAAIC,EAAE,CAAC,EAAG,MAAO,CAChB,KAAM,SACN,YAAa,EAAE,EAAE,0BAA2B,CAAC,CAC9C,EACA,GAAI,EAAE,OAAS,UAAW,MAAO,CAChC,KAAM,QACN,MAAO,CACN,KAAM,SACN,YAAa,EAAE,EAAE,0BAA2B,CAAC,CAC9C,CACD,EACA,GAAI,CAAE,0BAA2B,EAAG,UAAW,EAAG,MAAO,EAAG,MAAO,EAAG,WAAY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AAG,EAAO,uCAAuC,EAGnE,OAAO,EAAK,IACd,ECnDM,EAA2B;;;;;;;;;;;;;;EAgBpB,EAAgB,KAAO,IAAuC,CACzE,GAAM,CAAE,iBAAkB,MAAM,EAG9B,CACA,MAAO,EACP,UAAW,CAAE,IAAG,EAChB,OAAQ,eACV,CAAC,EAED,GAAI,EAAc,eAAiB,KACjC,MAAM,IAAI,EAA6B,EAAc,EAAE,EAGzD,OAAO,CACT,EChCM,EAA6B;;;;;;;;;;;;;;EAsBtB,EAAkB,MAC7B,EAAgC,CAAC,IACJ,CAC7B,GAAM,CAAE,kBAAmB,MAAM,EAG/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 +1 @@
1
- {"version":3,"file":"index.mjs","names":["t","e","n","a","t","e","r","o","s","l","u","d","f","p","m","h","g","_","v","y","b","t","e","c","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-field-universal-identifier.util-CK9_m9RQ.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});\n//#endregion\nexport { n, t as r, r as t };\n","import { n as e, t } from \"./ViewKey-YV4NySfb.mjs\";\nimport { n, r, t as i } from \"./get-field-universal-identifier.util-CK9_m9RQ.mjs\";\n//#region src/application/applicationVariablesType.ts\nvar a = [\n\te.TEXT,\n\te.ARRAY,\n\te.BOOLEAN,\n\te.DATE,\n\te.DATE_TIME,\n\te.NUMBER,\n\te.NUMERIC,\n\te.RAW_JSON,\n\te.RICH_TEXT,\n\te.SELECT,\n\te.MULTI_SELECT\n], o = \"public\", s = \"TWENTY_API_KEY\", c = \"TWENTY_API_URL\", l = \"TWENTY_APP_ACCESS_TOKEN\", u = \"TWENTY_FUNCTIONS_URL\", d = \"generated\", f = { js: \"import { createRequire as __createRequire } from 'module';\\nconst require = __createRequire(import.meta.url);\" }, p = \".twenty/output\", m = \"Standard\", h = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"agent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), g = ({ applicationUniversalIdentifier: e, key: t }) => n({\n\tentityNamespace: \"applicationVariable\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), _ = \"navigation\", v = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL:${t}`,\n\tapplicationUniversalIdentifier: e\n}), y = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL_OBJECT_CONTEXT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), b = ({ applicationUniversalIdentifier: e, engineComponentKey: t, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `RECORD_SELECTION:${t}:${r ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), x = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `${t}:${_}`,\n\tapplicationUniversalIdentifier: e\n}), S = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"connectionProvider\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), C = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, fieldUniversalIdentifier: r }) => n({\n\tentityNamespace: \"fieldPermission\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), w = ({ applicationUniversalIdentifier: e, componentName: t }) => n({\n\tentityNamespace: \"frontComponent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), T = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"index\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), E = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"logicFunction\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), D = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `FOLDER:${t}`,\n\tapplicationUniversalIdentifier: e\n}), O = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `OBJECT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), k = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `VIEW:${t}`,\n\tapplicationUniversalIdentifier: e\n}), A = ({ applicationUniversalIdentifier: e, link: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `LINK:${t}`,\n\tapplicationUniversalIdentifier: e\n}), j = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"objectPermission\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), M = ({ applicationUniversalIdentifier: e, nameSingular: t }) => n({\n\tentityNamespace: \"objectMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), N = ({ applicationUniversalIdentifier: e, pageLayoutUniversalIdentifier: t, title: r }) => n({\n\tentityNamespace: \"pageLayoutTab\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), P = \"RECORD_PAGE\", F = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"pageLayout\",\n\tvalue: t ? `${t}:${r}` : r,\n\tapplicationUniversalIdentifier: e\n}), I = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"pageLayout\",\n\tvalue: `${t}:${P}`,\n\tapplicationUniversalIdentifier: e\n}), L = ({ applicationUniversalIdentifier: e, pageLayoutTabUniversalIdentifier: t, title: r }) => n({\n\tentityNamespace: \"pageLayoutWidget\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), R = ({ applicationUniversalIdentifier: e, key: t }) => n({\n\tentityNamespace: \"permissionFlag\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), z = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, permissionFlagUniversalIdentifier: r }) => n({\n\tentityNamespace: \"rolePermissionFlag\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), B = ({ applicationUniversalIdentifier: e, label: t }) => n({\n\tentityNamespace: \"role\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), V = ({ applicationUniversalIdentifier: e, fieldMetadataUniversalIdentifier: t }) => n({\n\tentityNamespace: \"searchFieldMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), H = ({ applicationUniversalIdentifier: e, fieldUniversalIdentifier: t, value: r }) => n({\n\tentityNamespace: \"selectOption\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), U = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"skill\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), W = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"viewFieldGroup\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), G = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r }) => n({\n\tentityNamespace: \"viewField\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), K = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r, operand: i, subFieldName: a }) => n({\n\tentityNamespace: \"viewFilter\",\n\tvalue: `${t}:${r}:${i}:${a ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), q = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldValue: r }) => n({\n\tentityNamespace: \"viewGroup\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), J = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r }) => n({\n\tentityNamespace: \"viewSort\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), Y = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"view\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), X = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"view\",\n\tvalue: `${r}:${t.INDEX}`,\n\tapplicationUniversalIdentifier: e\n}), Z = ({ applicationUniversalIdentifier: e, pageLayoutWidgetUniversalIdentifier: t }) => n({\n\tentityNamespace: \"view\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), Q = /* @__PURE__ */ function(e) {\n\treturn e.Object = \"object\", e.Field = \"field\", e.LogicFunction = \"logicFunction\", e.FrontComponent = \"frontComponent\", e.Role = \"role\", e.Skill = \"skill\", e.Agent = \"agent\", e.ConnectionProvider = \"connectionProvider\", e.View = \"view\", e.ViewField = \"viewField\", e.NavigationMenuItem = \"navigationMenuItem\", e.PageLayout = \"pageLayout\", e.PageLayoutTab = \"pageLayoutTab\", e.CommandMenuItem = \"commandMenuItem\", e;\n}({}), $ = (t, n = e.TEXT) => {\n\tif (t == null) return \"\";\n\tswitch (n) {\n\t\tcase e.BOOLEAN: return String(t) === \"true\" ? \"true\" : \"false\";\n\t\tcase e.NUMBER:\n\t\tcase e.NUMERIC: return String(t);\n\t\tcase e.ARRAY:\n\t\tcase e.MULTI_SELECT:\n\t\t\tif (Array.isArray(t)) return JSON.stringify(t);\n\t\t\tif (typeof t == \"string\") {\n\t\t\t\ttry {\n\t\t\t\t\tlet e = JSON.parse(t);\n\t\t\t\t\tif (Array.isArray(e)) return t;\n\t\t\t\t} catch {}\n\t\t\t\treturn JSON.stringify([t]);\n\t\t\t}\n\t\t\treturn JSON.stringify(t);\n\t\tcase e.RAW_JSON:\n\t\tcase e.RICH_TEXT: return typeof t == \"string\" ? t : JSON.stringify(t);\n\t\tdefault: return typeof t == \"string\" ? t : String(t);\n\t}\n}, ee = (t, n = e.TEXT) => {\n\tif (t === \"\") return n === e.ARRAY || n === e.MULTI_SELECT ? [] : \"\";\n\tswitch (n) {\n\t\tcase e.BOOLEAN: return t === \"true\";\n\t\tcase e.NUMBER:\n\t\tcase e.NUMERIC: {\n\t\t\tlet e = Number(t);\n\t\t\treturn Number.isNaN(e) ? t : e;\n\t\t}\n\t\tcase e.ARRAY:\n\t\tcase e.MULTI_SELECT: try {\n\t\t\tlet e = JSON.parse(t);\n\t\t\treturn Array.isArray(e) ? e : [];\n\t\t} catch {\n\t\t\treturn [];\n\t\t}\n\t\tcase e.RAW_JSON:\n\t\tcase e.RICH_TEXT: try {\n\t\t\treturn JSON.parse(t);\n\t\t} catch {\n\t\t\treturn t;\n\t\t}\n\t\tdefault: return t;\n\t}\n};\n//#endregion\nexport { a as APPLICATION_VARIABLE_FIELD_METADATA_TYPES, o as ASSETS_DIR, s as DEFAULT_API_KEY_NAME, c as DEFAULT_API_URL_NAME, l as DEFAULT_APP_ACCESS_TOKEN_NAME, u as DEFAULT_FUNCTIONS_URL_NAME, d as GENERATED_DIR, f as NODE_ESM_CJS_BANNER, p as OUTPUT_DIR, Q as SyncableEntity, m as TWENTY_STANDARD_APPLICATION_NAME, r as TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER, n as computeDeterministicUuid, ee as deserializeApplicationVariableValue, h as getAgentUniversalIdentifier, g as getApplicationVariableUniversalIdentifier, S as getConnectionProviderUniversalIdentifier, C as getFieldPermissionUniversalIdentifier, i as getFieldUniversalIdentifier, Z as getFieldsWidgetViewUniversalIdentifier, D as getFolderNavigationMenuItemUniversalIdentifier, w as getFrontComponentUniversalIdentifier, v as getGlobalCommandMenuItemUniversalIdentifier, y as getGlobalObjectContextCommandMenuItemUniversalIdentifier, T as getIndexUniversalIdentifier, X as getIndexViewUniversalIdentifier, A as getLinkNavigationMenuItemUniversalIdentifier, E as getLogicFunctionUniversalIdentifier, x as getNavigationCommandUniversalIdentifier, O as getObjectNavigationMenuItemUniversalIdentifier, j as getObjectPermissionUniversalIdentifier, M as getObjectUniversalIdentifier, N as getPageLayoutTabUniversalIdentifier, F as getPageLayoutUniversalIdentifier, L as getPageLayoutWidgetUniversalIdentifier, R as getPermissionFlagUniversalIdentifier, I as getRecordPageLayoutUniversalIdentifier, b as getRecordSelectionCommandMenuItemUniversalIdentifier, z as getRolePermissionFlagUniversalIdentifier, B as getRoleUniversalIdentifier, V as getSearchFieldUniversalIdentifier, H as getSelectOptionUniversalIdentifier, U as getSkillUniversalIdentifier, W as getViewFieldGroupUniversalIdentifier, G as getViewFieldUniversalIdentifier, K as getViewFilterUniversalIdentifier, q as getViewGroupUniversalIdentifier, k as getViewNavigationMenuItemUniversalIdentifier, J as getViewSortUniversalIdentifier, Y as getViewUniversalIdentifier, $ as serializeApplicationVariableValue };\n","import {\n DEFAULT_API_URL_NAME,\n DEFAULT_APP_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application';\n\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,GCE1F,KAAK,GAAG,MAAM;CACjB,IAAI,IAAIC,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK;CAC7B,OAAO,aAAaA,EAAE,CAAC,IAAI,IAAI,SAAS;AACzC,GAAGC,KAAK,GAAG,MAAM;CAChB,IAAIC,EAAE,CAAC,GAAG,OAAO;EAChB,MAAM;EACN,aAAa,EAAE,EAAE,2BAA2B,CAAC;CAC9C;CACA,IAAI,EAAE,SAAS,WAAW,OAAO;EAChC,MAAM;EACN,OAAO;GACN,MAAM;GACN,aAAa,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,OAAOC,EAAE,CAAC,M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;CAED,IAAI,EAAc,iBAAiB,MACjC,MAAM,IAAI,EAA6B,EAAc,EAAE;CAGzD,OAAO;AACT,GChCM,IAA6B,+QAsBtB,IAAkB,OAC7B,IAAgC,CAAC,MACJ;CAC7B,IAAM,EAAE,sBAAmB,MAAM,EAG/B;EACA,OAAO;EACP,WAAW,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","n","a","t","e","r","o","s","l","u","d","f","p","m","h","g","_","v","y","b","t","e","c","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-field-universal-identifier.util-CK9_m9RQ.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});\n//#endregion\nexport { n, t as r, r as t };\n","import { n as e, t } from \"./ViewKey-YV4NySfb.mjs\";\nimport { n, r, t as i } from \"./get-field-universal-identifier.util-CK9_m9RQ.mjs\";\n//#region src/application/applicationCategoryType.ts\nvar a = [\n\t\"Communication\",\n\t\"Productivity\",\n\t\"Product management\",\n\t\"Sales\",\n\t\"Marketing\",\n\t\"Enrichment\",\n\t\"Data\",\n\t\"Search\",\n\t\"Other\"\n], o = (e) => a.includes(e), s = [\n\te.TEXT,\n\te.ARRAY,\n\te.BOOLEAN,\n\te.DATE,\n\te.DATE_TIME,\n\te.NUMBER,\n\te.NUMERIC,\n\te.RAW_JSON,\n\te.RICH_TEXT,\n\te.SELECT,\n\te.MULTI_SELECT\n], c = \"public\", l = \"TWENTY_API_KEY\", u = \"TWENTY_API_URL\", d = \"TWENTY_APP_ACCESS_TOKEN\", f = \"TWENTY_FUNCTIONS_URL\", p = \"generated\", m = { js: \"import { createRequire as __createRequire } from 'module';\\nconst require = __createRequire(import.meta.url);\" }, h = \".twenty/output\", g = \"Standard\", _ = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"agent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), v = ({ applicationUniversalIdentifier: e, key: t }) => n({\n\tentityNamespace: \"applicationVariable\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), y = \"navigation\", b = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL:${t}`,\n\tapplicationUniversalIdentifier: e\n}), x = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL_OBJECT_CONTEXT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), S = ({ applicationUniversalIdentifier: e, engineComponentKey: t, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `RECORD_SELECTION:${t}:${r ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), C = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `${t}:${y}`,\n\tapplicationUniversalIdentifier: e\n}), w = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"connectionProvider\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), T = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, fieldUniversalIdentifier: r }) => n({\n\tentityNamespace: \"fieldPermission\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), E = ({ applicationUniversalIdentifier: e, componentName: t }) => n({\n\tentityNamespace: \"frontComponent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), D = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"index\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), O = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"logicFunction\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), k = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `FOLDER:${t}`,\n\tapplicationUniversalIdentifier: e\n}), A = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `OBJECT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), ee = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `VIEW:${t}`,\n\tapplicationUniversalIdentifier: e\n}), j = ({ applicationUniversalIdentifier: e, link: t }) => n({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `LINK:${t}`,\n\tapplicationUniversalIdentifier: e\n}), M = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"objectPermission\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), N = ({ applicationUniversalIdentifier: e, nameSingular: t }) => n({\n\tentityNamespace: \"objectMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), P = ({ applicationUniversalIdentifier: e, pageLayoutUniversalIdentifier: t, title: r }) => n({\n\tentityNamespace: \"pageLayoutTab\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), F = \"RECORD_PAGE\", I = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"pageLayout\",\n\tvalue: t ? `${t}:${r}` : r,\n\tapplicationUniversalIdentifier: e\n}), L = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => n({\n\tentityNamespace: \"pageLayout\",\n\tvalue: `${t}:${F}`,\n\tapplicationUniversalIdentifier: e\n}), R = ({ applicationUniversalIdentifier: e, pageLayoutTabUniversalIdentifier: t, title: r }) => n({\n\tentityNamespace: \"pageLayoutWidget\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), z = ({ applicationUniversalIdentifier: e, key: t }) => n({\n\tentityNamespace: \"permissionFlag\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), B = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, permissionFlagUniversalIdentifier: r }) => n({\n\tentityNamespace: \"rolePermissionFlag\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), V = ({ applicationUniversalIdentifier: e, label: t }) => n({\n\tentityNamespace: \"role\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), H = ({ applicationUniversalIdentifier: e, fieldMetadataUniversalIdentifier: t }) => n({\n\tentityNamespace: \"searchFieldMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), U = ({ applicationUniversalIdentifier: e, fieldUniversalIdentifier: t, value: r }) => n({\n\tentityNamespace: \"selectOption\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), W = ({ applicationUniversalIdentifier: e, name: t }) => n({\n\tentityNamespace: \"skill\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), G = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"viewFieldGroup\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), K = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r }) => n({\n\tentityNamespace: \"viewField\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), q = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r, operand: i, subFieldName: a }) => n({\n\tentityNamespace: \"viewFilter\",\n\tvalue: `${t}:${r}:${i}:${a ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), J = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldValue: r }) => n({\n\tentityNamespace: \"viewGroup\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), Y = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: r }) => n({\n\tentityNamespace: \"viewSort\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), X = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: r }) => n({\n\tentityNamespace: \"view\",\n\tvalue: `${t}:${r}`,\n\tapplicationUniversalIdentifier: e\n}), Z = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: r }) => n({\n\tentityNamespace: \"view\",\n\tvalue: `${r}:${t.INDEX}`,\n\tapplicationUniversalIdentifier: e\n}), Q = ({ applicationUniversalIdentifier: e, pageLayoutWidgetUniversalIdentifier: t }) => n({\n\tentityNamespace: \"view\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), $ = /* @__PURE__ */ function(e) {\n\treturn e.Object = \"object\", e.Field = \"field\", e.LogicFunction = \"logicFunction\", e.FrontComponent = \"frontComponent\", e.Role = \"role\", e.Skill = \"skill\", e.Agent = \"agent\", e.ConnectionProvider = \"connectionProvider\", e.View = \"view\", e.ViewField = \"viewField\", e.NavigationMenuItem = \"navigationMenuItem\", e.PageLayout = \"pageLayout\", e.PageLayoutTab = \"pageLayoutTab\", e.CommandMenuItem = \"commandMenuItem\", e;\n}({}), te = (t, n = e.TEXT) => {\n\tif (t == null) return \"\";\n\tswitch (n) {\n\t\tcase e.BOOLEAN: return String(t) === \"true\" ? \"true\" : \"false\";\n\t\tcase e.NUMBER:\n\t\tcase e.NUMERIC: return String(t);\n\t\tcase e.ARRAY:\n\t\tcase e.MULTI_SELECT:\n\t\t\tif (Array.isArray(t)) return JSON.stringify(t);\n\t\t\tif (typeof t == \"string\") {\n\t\t\t\ttry {\n\t\t\t\t\tlet e = JSON.parse(t);\n\t\t\t\t\tif (Array.isArray(e)) return t;\n\t\t\t\t} catch {}\n\t\t\t\treturn JSON.stringify([t]);\n\t\t\t}\n\t\t\treturn JSON.stringify(t);\n\t\tcase e.RAW_JSON:\n\t\tcase e.RICH_TEXT: return typeof t == \"string\" ? t : JSON.stringify(t);\n\t\tdefault: return typeof t == \"string\" ? t : String(t);\n\t}\n}, ne = (t, n = e.TEXT) => {\n\tif (t === \"\") return n === e.ARRAY || n === e.MULTI_SELECT ? [] : \"\";\n\tswitch (n) {\n\t\tcase e.BOOLEAN: return t === \"true\";\n\t\tcase e.NUMBER:\n\t\tcase e.NUMERIC: {\n\t\t\tlet e = Number(t);\n\t\t\treturn Number.isNaN(e) ? t : e;\n\t\t}\n\t\tcase e.ARRAY:\n\t\tcase e.MULTI_SELECT: try {\n\t\t\tlet e = JSON.parse(t);\n\t\t\treturn Array.isArray(e) ? e : [];\n\t\t} catch {\n\t\t\treturn [];\n\t\t}\n\t\tcase e.RAW_JSON:\n\t\tcase e.RICH_TEXT: try {\n\t\t\treturn JSON.parse(t);\n\t\t} catch {\n\t\t\treturn t;\n\t\t}\n\t\tdefault: return t;\n\t}\n};\n//#endregion\nexport { a as APPLICATION_CATEGORIES, s as APPLICATION_VARIABLE_FIELD_METADATA_TYPES, c as ASSETS_DIR, l as DEFAULT_API_KEY_NAME, u as DEFAULT_API_URL_NAME, d as DEFAULT_APP_ACCESS_TOKEN_NAME, f as DEFAULT_FUNCTIONS_URL_NAME, p as GENERATED_DIR, m as NODE_ESM_CJS_BANNER, h as OUTPUT_DIR, $ as SyncableEntity, g as TWENTY_STANDARD_APPLICATION_NAME, r as TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER, n as computeDeterministicUuid, ne as deserializeApplicationVariableValue, _ as getAgentUniversalIdentifier, v as getApplicationVariableUniversalIdentifier, w as getConnectionProviderUniversalIdentifier, T as getFieldPermissionUniversalIdentifier, i as getFieldUniversalIdentifier, Q as getFieldsWidgetViewUniversalIdentifier, k as getFolderNavigationMenuItemUniversalIdentifier, E as getFrontComponentUniversalIdentifier, b as getGlobalCommandMenuItemUniversalIdentifier, x as getGlobalObjectContextCommandMenuItemUniversalIdentifier, D as getIndexUniversalIdentifier, Z as getIndexViewUniversalIdentifier, j as getLinkNavigationMenuItemUniversalIdentifier, O as getLogicFunctionUniversalIdentifier, C as getNavigationCommandUniversalIdentifier, A as getObjectNavigationMenuItemUniversalIdentifier, M as getObjectPermissionUniversalIdentifier, N as getObjectUniversalIdentifier, P as getPageLayoutTabUniversalIdentifier, I as getPageLayoutUniversalIdentifier, R as getPageLayoutWidgetUniversalIdentifier, z as getPermissionFlagUniversalIdentifier, L as getRecordPageLayoutUniversalIdentifier, S as getRecordSelectionCommandMenuItemUniversalIdentifier, B as getRolePermissionFlagUniversalIdentifier, V as getRoleUniversalIdentifier, H as getSearchFieldUniversalIdentifier, U as getSelectOptionUniversalIdentifier, W as getSkillUniversalIdentifier, G as getViewFieldGroupUniversalIdentifier, K as getViewFieldUniversalIdentifier, q as getViewFilterUniversalIdentifier, J as getViewGroupUniversalIdentifier, ee as getViewNavigationMenuItemUniversalIdentifier, Y as getViewSortUniversalIdentifier, X as getViewUniversalIdentifier, o as isKnownApplicationCategory, te as serializeApplicationVariableValue };\n","import {\n DEFAULT_API_URL_NAME,\n DEFAULT_APP_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application';\n\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,GCE1F,KAAK,GAAG,MAAM;CACjB,IAAI,IAAIC,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK;CAC7B,OAAO,aAAaA,EAAE,CAAC,IAAI,IAAI,SAAS;AACzC,GAAGC,KAAK,GAAG,MAAM;CAChB,IAAIC,EAAE,CAAC,GAAG,OAAO;EAChB,MAAM;EACN,aAAa,EAAE,EAAE,2BAA2B,CAAC;CAC9C;CACA,IAAI,EAAE,SAAS,WAAW,OAAO;EAChC,MAAM;EACN,OAAO;GACN,MAAM;GACN,aAAa,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,OAAOC,EAAE,CAAC,MAAM,EAAE,QAAQF,EAAE,GAAG,CAAC,IAAI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