twenty-sdk 2.15.0 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/halftone-backdrop.png +0 -0
- package/dist/billing/index.cjs +1 -1
- package/dist/billing/index.cjs.map +1 -1
- package/dist/billing/index.mjs +2 -1
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{catalog-sync-C5Bb1KSh.js → catalog-sync-CgKswjsE.js} +1 -1
- package/dist/{catalog-sync-DcpUieU5.mjs → catalog-sync-YxvEEHz5.mjs} +1 -1
- package/dist/cli/commands/dev/i18n-extract.d.ts +7 -0
- package/dist/cli/utilities/build/common/build-application.d.ts +2 -0
- package/dist/cli/utilities/build/common/front-component-build/css-injection-plugin.d.ts +2 -0
- package/dist/cli/utilities/build/cover/apply-generated-cover.d.ts +9 -0
- package/dist/cli/utilities/build/cover/assets/twenty-logo-mark-path.d.ts +1 -0
- package/dist/cli/utilities/build/cover/generate-cover-image.d.ts +5 -0
- package/dist/cli/utilities/build/cover/generated-asset.type.d.ts +4 -0
- package/dist/cli/utilities/build/cover/generated-cover-path.d.ts +1 -0
- package/dist/cli/utilities/i18n/collect-translatable-strings.d.ts +2 -0
- package/dist/cli/utilities/i18n/compile-application-translations.d.ts +1 -0
- package/dist/cli/utilities/i18n/constants.d.ts +1 -0
- package/dist/cli/utilities/i18n/extract-application-translations.d.ts +10 -0
- package/dist/cli/utilities/i18n/generate-message-id.d.ts +1 -0
- package/dist/cli.cjs +35 -33
- package/dist/cli.mjs +896 -836
- package/dist/define/index.cjs +19 -19
- package/dist/define/index.cjs.map +1 -1
- package/dist/define/index.d.ts +30 -15
- package/dist/define/index.mjs +2293 -1036
- package/dist/define/index.mjs.map +1 -1
- package/dist/front-component/index.cjs +1 -1
- package/dist/front-component/index.cjs.map +1 -1
- package/dist/front-component/index.d.ts +43 -12
- package/dist/front-component/index.mjs +134 -143
- package/dist/front-component/index.mjs.map +1 -1
- package/dist/front-component-renderer/build.cjs +1 -1
- package/dist/front-component-renderer/build.mjs +1 -1
- package/dist/front-component-renderer.cjs +1 -1
- package/dist/{get-front-component-build-plugins-DBupR4cF.js → get-front-component-build-plugins-Dqpyup2W.js} +9 -5
- package/dist/get-front-component-build-plugins-taotEFOp.mjs +126 -0
- package/dist/{get-function-input-schema-GNk3NRLJ-oMYSgib9.mjs → get-function-input-schema-GNk3NRLJ-CfeAvjEl.mjs} +1 -1
- package/dist/get-function-input-schema-GNk3NRLJ-D8x7FINz.js +1 -0
- package/dist/isDefined-Dtu5EYqP-Dp026Ry1.js +1 -0
- package/dist/logic-function/index.cjs +1 -1
- package/dist/logic-function/index.cjs.map +1 -1
- package/dist/logic-function/index.d.ts +15 -9
- package/dist/logic-function/index.mjs +1 -0
- package/dist/logic-function/index.mjs.map +1 -1
- package/dist/login-BOrzi4Z0.js +345 -0
- package/dist/{login-Cm5IBGFm.mjs → login-Dg4Ap-uo.mjs} +6932 -5552
- package/dist/operations.cjs +1 -1
- package/dist/operations.mjs +1 -1
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.mjs +2 -1
- package/dist/utils/index.mjs.map +1 -1
- package/package.json +4 -12
- package/dist/AllIcons-DEGfvqso-DwtvkCyL.js +0 -1
- package/dist/AllIcons-DEGfvqso-PUvdkUZm.mjs +0 -66238
- package/dist/get-front-component-build-plugins-BuE2QdIr.mjs +0 -113
- package/dist/get-function-input-schema-GNk3NRLJ-DMgchWCN.js +0 -1
- package/dist/icon-BSeT8K5G-Cuhg-Bz6.js +0 -1
- package/dist/icon-BSeT8K5G-WVhoiRKN.mjs +0 -10144
- package/dist/login-LjERatsq.js +0 -345
- package/dist/ui/index.cjs +0 -34
- package/dist/ui/index.d.ts +0 -18
- package/dist/ui/index.mjs +0 -20678
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../get-front-component-build-plugins-
|
|
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,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../get-front-component-build-plugins-
|
|
1
|
+
import { t as e } from "../get-front-component-build-plugins-taotEFOp.mjs";
|
|
2
2
|
export { e as getFrontComponentBuildPlugins };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}})
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=`__twentySdkExecutionContext__`,t=`frontComponentHostCommunicationApi`,n=`__twentySdkContextListeners__`;exports.FRONT_COMPONENT_CONTEXT_KEY=e,exports.FRONT_COMPONENT_HOST_COMMUNICATION_API_KEY=t,exports.FRONT_COMPONENT_LISTENERS_KEY=n;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let u=require("path");u=l(u);let d=require("node:fs/promises");var f
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let u=require("path");u=l(u);let d=require("node:fs/promises");var f=e=>`if (typeof document !== 'undefined') {
|
|
2
|
+
const styleElement = document.createElement('style');
|
|
3
|
+
document.head.appendChild(styleElement);
|
|
4
|
+
styleElement.textContent = ${JSON.stringify(e)};
|
|
5
|
+
}`,p={name:`css-injection`,setup:e=>{e.onLoad({filter:/\.css$/},async({path:e})=>({contents:f(await(0,d.readFile)(e,`utf8`)),loader:`js`}))}},m=`export var customElementMap = globalThis.__HTML_TAG_TO_CUSTOM_ELEMENT_TAG__ || {};
|
|
2
6
|
|
|
3
7
|
var _injectedStyleKeys = {};
|
|
4
8
|
|
|
@@ -73,7 +77,7 @@ export function makeEventRef(events, userRef) {
|
|
|
73
77
|
if (typeof userRef === 'function') userRef(el);
|
|
74
78
|
else if (userRef != null && typeof userRef === 'object') userRef.current = el;
|
|
75
79
|
};
|
|
76
|
-
}`,
|
|
80
|
+
}`,h=`import {
|
|
77
81
|
jsx as _originalJsx,
|
|
78
82
|
jsxs as _originalJsxs,
|
|
79
83
|
Fragment,
|
|
@@ -116,7 +120,7 @@ function _wrapJsxFactory(originalFactory) {
|
|
|
116
120
|
|
|
117
121
|
export var jsx = _wrapJsxFactory(_originalJsx);
|
|
118
122
|
export var jsxs = _wrapJsxFactory(_originalJsxs);
|
|
119
|
-
export { Fragment };`,
|
|
123
|
+
export { Fragment };`,g=`export * from '__real_react__';
|
|
120
124
|
import _React from '__real_react__';
|
|
121
125
|
|
|
122
126
|
import {
|
|
@@ -163,6 +167,6 @@ function createElement(type) {
|
|
|
163
167
|
}
|
|
164
168
|
|
|
165
169
|
export { createElement };
|
|
166
|
-
export default Object.assign({}, _React, { createElement: 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';
|
|
167
171
|
import { jsx as __frontComponentJsx } from 'react/jsx-runtime';
|
|
168
|
-
`+t,t=t.replace(
|
|
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}});
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import e from "path";
|
|
2
|
+
import { readFile as t, writeFile as n } from "node:fs/promises";
|
|
3
|
+
//#region src/cli/utilities/build/common/front-component-build/css-injection-plugin.ts
|
|
4
|
+
var r = (e) => `if (typeof document !== 'undefined') {
|
|
5
|
+
const styleElement = document.createElement('style');
|
|
6
|
+
document.head.appendChild(styleElement);
|
|
7
|
+
styleElement.textContent = ${JSON.stringify(e)};
|
|
8
|
+
}`, i = {
|
|
9
|
+
name: "css-injection",
|
|
10
|
+
setup: (e) => {
|
|
11
|
+
e.onLoad({ filter: /\.css$/ }, async ({ path: e }) => ({
|
|
12
|
+
contents: r(await t(e, "utf8")),
|
|
13
|
+
loader: "js"
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
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) => {
|
|
17
|
+
let t = e?.usePreact ?? !1, n = t ? "preact/jsx-runtime" : "react/jsx-runtime", r = t ? "preact/compat" : "react";
|
|
18
|
+
return {
|
|
19
|
+
name: "jsx-runtime-remote-wrapper",
|
|
20
|
+
setup: (e) => {
|
|
21
|
+
let t, i;
|
|
22
|
+
e.onResolve({ filter: /^__jsx_shared_helpers__$/ }, () => ({
|
|
23
|
+
path: "__jsx_shared_helpers__",
|
|
24
|
+
namespace: "jsx-shared-helpers"
|
|
25
|
+
})), e.onLoad({
|
|
26
|
+
filter: /.*/,
|
|
27
|
+
namespace: "jsx-shared-helpers"
|
|
28
|
+
}, () => ({
|
|
29
|
+
contents: a,
|
|
30
|
+
loader: "js"
|
|
31
|
+
})), e.onResolve({ filter: /^react\/jsx-runtime$/ }, async (r) => {
|
|
32
|
+
if (!r.pluginData?.skipJsxWrapper) return t ||= (await e.resolve(n, {
|
|
33
|
+
kind: r.kind,
|
|
34
|
+
resolveDir: r.resolveDir,
|
|
35
|
+
pluginData: { skipJsxWrapper: !0 }
|
|
36
|
+
})).path, {
|
|
37
|
+
path: "react/jsx-runtime",
|
|
38
|
+
namespace: "jsx-runtime-wrapper"
|
|
39
|
+
};
|
|
40
|
+
}), e.onResolve({ filter: /^__real_react_jsx_runtime__$/ }, () => {
|
|
41
|
+
if (!t) throw Error("jsx-runtime-remote-wrapper: real jsx-runtime path not resolved yet");
|
|
42
|
+
return { path: t };
|
|
43
|
+
}), e.onLoad({
|
|
44
|
+
filter: /.*/,
|
|
45
|
+
namespace: "jsx-runtime-wrapper"
|
|
46
|
+
}, () => ({
|
|
47
|
+
contents: o,
|
|
48
|
+
loader: "js"
|
|
49
|
+
})), e.onResolve({ filter: /^react$/ }, async (t) => {
|
|
50
|
+
if (!t.pluginData?.skipJsxWrapper) return i ||= (await e.resolve(r, {
|
|
51
|
+
kind: t.kind,
|
|
52
|
+
resolveDir: t.resolveDir,
|
|
53
|
+
pluginData: { skipJsxWrapper: !0 }
|
|
54
|
+
})).path, {
|
|
55
|
+
path: "react",
|
|
56
|
+
namespace: "react-wrapper"
|
|
57
|
+
};
|
|
58
|
+
}), e.onResolve({ filter: /^__real_react__$/ }, () => {
|
|
59
|
+
if (!i) throw Error("jsx-runtime-remote-wrapper: real react path not resolved yet");
|
|
60
|
+
return { path: i };
|
|
61
|
+
}), e.onLoad({
|
|
62
|
+
filter: /.*/,
|
|
63
|
+
namespace: "react-wrapper"
|
|
64
|
+
}, () => ({
|
|
65
|
+
contents: s,
|
|
66
|
+
loader: "js"
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
};
|
|
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);
|
|
72
|
+
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}, {})); }`);
|
|
75
|
+
}
|
|
76
|
+
return t;
|
|
77
|
+
}, f = {
|
|
78
|
+
name: "jsx-transform-to-remote-dom-worker-format-plugin",
|
|
79
|
+
setup: (e) => {
|
|
80
|
+
e.onLoad({ filter: /\.tsx$/ }, async ({ path: e }) => {
|
|
81
|
+
try {
|
|
82
|
+
return {
|
|
83
|
+
contents: d(await t(e, "utf8")),
|
|
84
|
+
loader: "tsx"
|
|
85
|
+
};
|
|
86
|
+
} catch (t) {
|
|
87
|
+
return { errors: [{
|
|
88
|
+
text: `Failed to transform front component: ${t instanceof Error ? t.message : String(t)}`,
|
|
89
|
+
location: { file: e }
|
|
90
|
+
}] };
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}, p = () => ({
|
|
95
|
+
name: "preact-alias",
|
|
96
|
+
setup: (e) => {
|
|
97
|
+
let t;
|
|
98
|
+
e.onResolve({ filter: /^react-dom\/client$/ }, async (n) => (t ||= (await e.resolve("preact/compat/client", {
|
|
99
|
+
kind: n.kind,
|
|
100
|
+
resolveDir: n.resolveDir
|
|
101
|
+
})).path, { path: t })), e.onResolve({ filter: /^react-dom$/ }, async (t) => ({ path: (await e.resolve("preact/compat", {
|
|
102
|
+
kind: t.kind,
|
|
103
|
+
resolveDir: t.resolveDir
|
|
104
|
+
})).path }));
|
|
105
|
+
}
|
|
106
|
+
}), m = /^\/\/.*$\n/gm, h = {
|
|
107
|
+
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
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}, g = (e) => [
|
|
119
|
+
c(e?.usePreact ? { usePreact: !0 } : void 0),
|
|
120
|
+
...e?.usePreact ? [p()] : [],
|
|
121
|
+
f,
|
|
122
|
+
i,
|
|
123
|
+
h
|
|
124
|
+
];
|
|
125
|
+
//#endregion
|
|
126
|
+
export { g as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { xt as e } from "./login-Dg4Ap-uo.mjs";
|
|
2
2
|
import { ScriptTarget as t, SyntaxKind as n, createSourceFile as r } from "typescript";
|
|
3
3
|
//#region ../twenty-shared/dist/get-function-input-schema-GNk3NRLJ.mjs
|
|
4
4
|
var i = "TwentyRecord", a = (t) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./isDefined-Dtu5EYqP-Dp026Ry1.js");let t=require("typescript");var n=`TwentyRecord`,r=n=>{let r=n.typeArguments?.[0];if(e.t(r)&&r.kind===t.SyntaxKind.LiteralType&&r.literal.kind===t.SyntaxKind.StringLiteral)return r.literal.text},i=e=>e.type===`record`?{type:`records`,objectUniversalIdentifier:e.objectUniversalIdentifier}:{type:`array`,items:e},a=o=>{switch(o.kind){case t.SyntaxKind.NumberKeyword:return{type:`number`};case t.SyntaxKind.StringKeyword:return{type:`string`};case t.SyntaxKind.BooleanKeyword:return{type:`boolean`};case t.SyntaxKind.ArrayType:return i(a(o.elementType));case t.SyntaxKind.TypeReference:{let s=o,c=s.typeName.kind===t.SyntaxKind.Identifier?s.typeName.text:void 0;if(c===`Array`||c===`ReadonlyArray`){let t=s.typeArguments?.[0];return i(e.t(t)?a(t):{})}if(c===n){let t=r(s);if(e.t(t))return{type:`record`,objectUniversalIdentifier:t}}return{}}case t.SyntaxKind.ObjectKeyword:return{type:`object`};case t.SyntaxKind.TypeLiteral:{let t={};return o.members.forEach(n=>{if(e.t(n.name)&&e.t(n.type)){let e=n.name.text;t[e]=a(n.type)}}),{type:`object`,properties:t}}case t.SyntaxKind.UnionType:{let e=o,n=[],r=!0;return e.types.forEach(e=>{if(e.kind===t.SyntaxKind.LiteralType){let i=e.literal;i.kind===t.SyntaxKind.StringLiteral?n.push(i.text):r=!1}else r=!1}),r?{type:`string`,enum:n}:{}}default:return{}}},o=(t,n)=>t.parameters.reduce((t,n)=>{let r=n.type;return e.t(r)?[...t,a(r)]:[...t,{}]},n),s=n=>n.kind===t.SyntaxKind.FunctionDeclaration?[n]:n.kind===t.SyntaxKind.VariableStatement?n.declarationList.declarations.filter(n=>e.t(n.initializer)&&n.initializer.kind===t.SyntaxKind.ArrowFunction).map(e=>e.initializer):[],c=e=>{let n=(0,t.createSourceFile)(`temp.ts`,e,t.ScriptTarget.ESNext,!0),r=[];return n.forEachChild(e=>{(e.kind===t.SyntaxKind.FunctionDeclaration||e.kind===t.SyntaxKind.VariableStatement)&&s(e).forEach(e=>{r=o(e,r)})}),r};exports.getFunctionInputSchema=c;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("@sniptt/guards");var t=t=>!(0,e.isUndefined)(t)&&!(0,e.isNull)(t);Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./isDefined-Dtu5EYqP-Dp026Ry1.js");let t=require("@sniptt/guards");var n=e=>(e?.type===`record`||e?.type===`object`)&&(0,t.isNonEmptyString)(e.objectUniversalIdentifier),r=(e,n)=>{let r=(0,t.isNonEmptyString)(e)?n?.(e):void 0;return`Id of the ${(0,t.isNonEmptyString)(r)?r:`linked`} record`},i=(a,o)=>{if(n(a))return{type:`string`,description:r(a.objectUniversalIdentifier,o)};if(a.type===`records`)return{type:`array`,items:{type:`string`,description:r(a.objectUniversalIdentifier,o)}};let{objectUniversalIdentifier:s,multiline:c,label:l,items:u,properties:d,additionalProperties:f,...p}=a,m={...p};return e.t(u)&&(m.items=i(u,o)),e.t(d)&&(m.properties=Object.fromEntries(Object.entries(d).map(([e,t])=>[e,i(t,o)]))),e.t(f)&&(m.additionalProperties=(0,t.isObject)(f)?i(f,o):f),m},a=e=>{let n={type:`unknown`};switch(e.type){case`string`:n.type=`string`;break;case`number`:case`integer`:n.type=`number`;break;case`boolean`:n.type=`boolean`;break;case`array`:n.type=`array`,e.items&&(n.items=a(e.items));break;case`object`:n.type=`object`,e.properties&&(n.properties=Object.fromEntries(Object.entries(e.properties).map(([e,t])=>[e,a(t)])));break;case`record`:n.type=`record`;break;case`records`:n.type=`records`;break;default:n.type=`unknown`}return Array.isArray(e.enum)&&(n.enum=e.enum.filter(e=>typeof e==`string`)),e.multiline===!0&&(n.multiline=!0),(0,t.isNonEmptyString)(e.label)&&(n.label=e.label),(0,t.isNonEmptyString)(e.objectUniversalIdentifier)&&(n.objectUniversalIdentifier=e.objectUniversalIdentifier),n},o=e=>[a(e)];o({type:`object`,properties:{a:{type:`string`},b:{type:`number`}}});var s=t=>!e.t(t)||t===null?`unknown`:typeof t==`string`?`string`:typeof t==`number`?`number`:typeof t==`boolean`?`boolean`:Array.isArray(t)?`array`:`unknown`,c=e=>e?Object.entries(e).reduce((e,[n,r])=>((0,t.isObject)(r)&&!Array.isArray(r)?e[n]={isLeaf:!1,type:`object`,label:n,value:c(r)}:e[n]={isLeaf:!0,value:r,type:s(r),label:n},e),{}):{},l=(e,t)=>e?`${e}.${t}`:t,u=(t,n,r=``)=>{let i=[];for(let[a,o]of Object.entries(n)){let n=l(r,a),s=t[a];if(!e.t(s)){i.push(`Missing key "${n}" in declared output schema.`);continue}if(o.isLeaf!==s.isLeaf){i.push(`Type mismatch at "${n}": expected ${o.isLeaf?o.type:`object`} but declared ${s.isLeaf?s.type:`object`}.`);continue}if(!o.isLeaf&&!s.isLeaf){i.push(...u(s.value,o.value,n));continue}o.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}.`)}return i},d=[`string`,`number`,`boolean`,`array`,`unknown`],f=e=>d.includes(e),p=(e,n)=>{let r=n.label??e;return n.type===`record`?{isLeaf:!0,type:`string`,label:r,value:null}:n.type===`records`?{isLeaf:!0,type:`array`,label:r,value:null}:n.type===`object`?{isLeaf:!1,type:`object`,label:r,value:(0,t.isObject)(n.properties)?m(n.properties):{}}:{isLeaf:!0,type:f(n.type)?n.type:`unknown`,label:r,value:null}},m=e=>Object.entries(e).reduce((e,[t,n])=>(e[t]=p(t,n),e),{}),h=class extends Error{constructor(e){super(`App connection ${e} requires the user to reconnect (authFailedAt is set). Surface a "Reconnect" prompt in your UI.`),this.name=`AppConnectionAuthFailedError`,this.connectionId=e}},g=`TWENTY_API_URL`,_=`TWENTY_APP_ACCESS_TOKEN`,v=async({query:e,variables:t,caller:n})=>{let r=process.env[g],i=process.env[_];if(!r||!i)throw Error(`${n}() requires the app runtime env vars ${g} and ${_}.`);let a=await fetch(`${r}/metadata`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${i}`},body:JSON.stringify({query:e,variables:t})});if(!a.ok)throw Error(`${n}() failed: HTTP ${a.status} ${a.statusText}`);let o=await a.json();if(o.errors&&o.errors.length>0)throw Error(`${n}() failed: ${o.errors.map(e=>e.message).join(`, `)}`);if(!o.data)throw Error(`${n}() failed: response contained no data.`);return o.data},y=`
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./isDefined-Dtu5EYqP-Dp026Ry1.js");let t=require("@sniptt/guards");require("uuid");var n=e=>(e?.type===`record`||e?.type===`object`)&&(0,t.isNonEmptyString)(e.objectUniversalIdentifier),r=(e,n)=>{let r=(0,t.isNonEmptyString)(e)?n?.(e):void 0;return`Id of the ${(0,t.isNonEmptyString)(r)?r:`linked`} record`},i=(a,o)=>{if(n(a))return{type:`string`,description:r(a.objectUniversalIdentifier,o)};if(a.type===`records`)return{type:`array`,items:{type:`string`,description:r(a.objectUniversalIdentifier,o)}};let{objectUniversalIdentifier:s,multiline:c,label:l,items:u,properties:d,additionalProperties:f,...p}=a,m={...p};return e.t(u)&&(m.items=i(u,o)),e.t(d)&&(m.properties=Object.fromEntries(Object.entries(d).map(([e,t])=>[e,i(t,o)]))),e.t(f)&&(m.additionalProperties=(0,t.isObject)(f)?i(f,o):f),m},a=e=>{let n={type:`unknown`};switch(e.type){case`string`:n.type=`string`;break;case`number`:case`integer`:n.type=`number`;break;case`boolean`:n.type=`boolean`;break;case`array`:n.type=`array`,e.items&&(n.items=a(e.items));break;case`object`:n.type=`object`,e.properties&&(n.properties=Object.fromEntries(Object.entries(e.properties).map(([e,t])=>[e,a(t)])));break;case`record`:n.type=`record`;break;case`records`:n.type=`records`;break;default:n.type=`unknown`}return Array.isArray(e.enum)&&(n.enum=e.enum.filter(e=>typeof e==`string`)),e.multiline===!0&&(n.multiline=!0),(0,t.isNonEmptyString)(e.label)&&(n.label=e.label),(0,t.isNonEmptyString)(e.objectUniversalIdentifier)&&(n.objectUniversalIdentifier=e.objectUniversalIdentifier),n},o=e=>[a(e)];o({type:`object`,properties:{a:{type:`string`},b:{type:`number`}}});var s=t=>!e.t(t)||t===null?`unknown`:typeof t==`string`?`string`:typeof t==`number`?`number`:typeof t==`boolean`?`boolean`:Array.isArray(t)?`array`:`unknown`,c=e=>e?Object.entries(e).reduce((e,[n,r])=>((0,t.isObject)(r)&&!Array.isArray(r)?e[n]={isLeaf:!1,type:`object`,label:n,value:c(r)}:e[n]={isLeaf:!0,value:r,type:s(r),label:n},e),{}):{},l=(e,t)=>e?`${e}.${t}`:t,u=(t,n,r=``)=>{let i=[];for(let[a,o]of Object.entries(n)){let n=l(r,a),s=t[a];if(!e.t(s)){i.push(`Missing key "${n}" in declared output schema.`);continue}if(o.isLeaf!==s.isLeaf){i.push(`Type mismatch at "${n}": expected ${o.isLeaf?o.type:`object`} but declared ${s.isLeaf?s.type:`object`}.`);continue}if(!o.isLeaf&&!s.isLeaf){i.push(...u(s.value,o.value,n));continue}o.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}.`)}return i},d=[`string`,`number`,`boolean`,`array`,`unknown`],f=e=>d.includes(e),p=(e,n)=>{let r=n.label??e;return n.type===`record`?{isLeaf:!0,type:`string`,label:r,value:null}:n.type===`records`?{isLeaf:!0,type:`array`,label:r,value:null}:n.type===`object`?{isLeaf:!1,type:`object`,label:r,value:(0,t.isObject)(n.properties)?m(n.properties):{}}:{isLeaf:!0,type:f(n.type)?n.type:`unknown`,label:r,value:null}},m=e=>Object.entries(e).reduce((e,[t,n])=>(e[t]=p(t,n),e),{}),h=class extends Error{constructor(e){super(`App connection ${e} requires the user to reconnect (authFailedAt is set). Surface a "Reconnect" prompt in your UI.`),this.name=`AppConnectionAuthFailedError`,this.connectionId=e}},g=`TWENTY_API_URL`,_=`TWENTY_APP_ACCESS_TOKEN`,v=async({query:e,variables:t,caller:n})=>{let r=process.env[g],i=process.env[_];if(!r||!i)throw Error(`${n}() requires the app runtime env vars ${g} and ${_}.`);let a=await fetch(`${r}/metadata`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${i}`},body:JSON.stringify({query:e,variables:t})});if(!a.ok)throw Error(`${n}() failed: HTTP ${a.status} ${a.statusText}`);let o=await a.json();if(o.errors&&o.errors.length>0)throw Error(`${n}() failed: ${o.errors.map(e=>e.message).join(`, `)}`);if(!o.data)throw Error(`${n}() failed: response contained no data.`);return o.data},y=`
|
|
2
2
|
query GetAppConnection($id: ID!) {
|
|
3
3
|
appConnection(id: $id) {
|
|
4
4
|
id
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["t","i","a","t","e","o","s","l","c"],"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/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/application/constants/AssetDirectory.ts\nvar e = \"public\", t = \"TWENTY_API_KEY\", n = \"TWENTY_API_URL\", r = \"TWENTY_APP_ACCESS_TOKEN\", i = \"generated\", a = { js: \"import { createRequire as __createRequire } from 'module';\\nconst require = __createRequire(import.meta.url);\" }, o = \".twenty/output\", s = \"Standard\", c = \"20202020-64aa-4b6f-b003-9c74b97cee20\", l = /* @__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}({});\n//#endregion\nexport { e as ASSETS_DIR, t as DEFAULT_API_KEY_NAME, n as DEFAULT_API_URL_NAME, r as DEFAULT_APP_ACCESS_TOKEN_NAME, i as GENERATED_DIR, a as NODE_ESM_CJS_BANNER, o as OUTPUT_DIR, l as SyncableEntity, s as TWENTY_STANDARD_APPLICATION_NAME, c as TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER };\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":"uJAEA,IAAIA,EAAK,IAAO,GAAG,OAAS,UAAY,GAAG,OAAS,YAAA,EAAA,EAAA,kBAAe,EAAE,yBAAyB,ECE1FC,GAAK,EAAG,IAAM,CACjB,IAAI,GAAA,EAAA,EAAA,kBAAM,CAAC,EAAI,IAAI,CAAC,EAAI,IAAK,GAC7B,MAAO,cAAA,EAAA,EAAA,kBAAe,CAAC,EAAI,EAAI,SAAS,QACzC,EAAGC,GAAK,EAAG,IAAM,CAChB,GAAIC,EAAE,CAAC,EAAG,MAAO,CAChB,KAAM,SACN,YAAaF,EAAE,EAAE,0BAA2B,CAAC,CAC9C,EACA,GAAI,EAAE,OAAS,UAAW,MAAO,CAChC,KAAM,QACN,MAAO,CACN,KAAM,SACN,YAAaA,EAAE,EAAE,0BAA2B,CAAC,CAC9C,CACD,EACA,GAAI,CAAE,0BAA2B,EAAG,UAAW,EAAG,MAAO,EAAG,MAAO,EAAG,WAAY,EAAG,qBAAsB,EAAG,GAAG,GAAM,EAAG,EAAI,CAAE,GAAG,CAAE,EACrI,OAAOG,EAAAA,EAAE,CAAC,IAAM,EAAE,MAAQF,EAAE,EAAG,CAAC,GAAIE,EAAAA,EAAE,CAAC,IAAM,EAAE,WAAa,OAAO,YAAY,OAAO,QAAQ,CAAC,EAAE,KAAK,CAAC,E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M9B,KAAK,KAAO,EACZ,KAAK,OAAS,GAAM,OACpB,KAAK,QAAU,GAAM,OACvB,CACF"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["t","i","a","t","e","o","s","l","u","d","f","p","m","h","g","_","v","y","b","c"],"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-Dib-Wyry.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/ViewKey.ts\nvar e = /* @__PURE__ */ function(e) {\n\treturn e.INDEX = \"INDEX\", e;\n}({});\n//#endregion\nexport { e as t };\n","import { t as e } from \"./ViewKey-Dib-Wyry.mjs\";\nimport { v5 as t } from \"uuid\";\n//#region src/application/constants/AssetDirectory.ts\nvar n = \"public\", r = \"TWENTY_API_KEY\", i = \"TWENTY_API_URL\", a = \"TWENTY_APP_ACCESS_TOKEN\", o = \"TWENTY_FUNCTIONS_URL\", s = \"generated\", c = { js: \"import { createRequire as __createRequire } from 'module';\\nconst require = __createRequire(import.meta.url);\" }, l = \".twenty/output\", u = \"Standard\", d = \"20202020-64aa-4b6f-b003-9c74b97cee20\", f = ({ entityNamespace: e, value: n, applicationUniversalIdentifier: r }) => t(`${e}:${n}`, r), p = ({ applicationUniversalIdentifier: e, name: t }) => f({\n\tentityNamespace: \"agent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), m = ({ applicationUniversalIdentifier: e, key: t }) => f({\n\tentityNamespace: \"applicationVariable\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), h = \"navigation\", g = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => f({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL:${t}`,\n\tapplicationUniversalIdentifier: e\n}), _ = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => f({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL_OBJECT_CONTEXT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), v = ({ applicationUniversalIdentifier: e, engineComponentKey: t, objectUniversalIdentifier: n }) => f({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `RECORD_SELECTION:${t}:${n ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), y = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => f({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `${t}:${h}`,\n\tapplicationUniversalIdentifier: e\n}), b = ({ applicationUniversalIdentifier: e, name: t }) => f({\n\tentityNamespace: \"connectionProvider\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), x = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, fieldUniversalIdentifier: n }) => f({\n\tentityNamespace: \"fieldPermission\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), S = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: n }) => f({\n\tentityNamespace: \"fieldMetadata\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), C = ({ applicationUniversalIdentifier: e, componentName: t }) => f({\n\tentityNamespace: \"frontComponent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), w = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: n }) => f({\n\tentityNamespace: \"index\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), T = ({ applicationUniversalIdentifier: e, name: t }) => f({\n\tentityNamespace: \"logicFunction\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), E = ({ applicationUniversalIdentifier: e, name: t }) => f({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `FOLDER:${t}`,\n\tapplicationUniversalIdentifier: e\n}), D = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => f({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `OBJECT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), O = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t }) => f({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `VIEW:${t}`,\n\tapplicationUniversalIdentifier: e\n}), k = ({ applicationUniversalIdentifier: e, link: t }) => f({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `LINK:${t}`,\n\tapplicationUniversalIdentifier: e\n}), A = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, objectUniversalIdentifier: n }) => f({\n\tentityNamespace: \"objectPermission\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), j = ({ applicationUniversalIdentifier: e, nameSingular: t }) => f({\n\tentityNamespace: \"objectMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), M = ({ applicationUniversalIdentifier: e, pageLayoutUniversalIdentifier: t, title: n }) => f({\n\tentityNamespace: \"pageLayoutTab\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), N = \"RECORD_PAGE\", P = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: n }) => f({\n\tentityNamespace: \"pageLayout\",\n\tvalue: t ? `${t}:${n}` : n,\n\tapplicationUniversalIdentifier: e\n}), F = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => f({\n\tentityNamespace: \"pageLayout\",\n\tvalue: `${t}:${N}`,\n\tapplicationUniversalIdentifier: e\n}), I = ({ applicationUniversalIdentifier: e, pageLayoutTabUniversalIdentifier: t, title: n }) => f({\n\tentityNamespace: \"pageLayoutWidget\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), L = ({ applicationUniversalIdentifier: e, key: t }) => f({\n\tentityNamespace: \"permissionFlag\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), R = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, permissionFlagUniversalIdentifier: n }) => f({\n\tentityNamespace: \"rolePermissionFlag\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), z = ({ applicationUniversalIdentifier: e, label: t }) => f({\n\tentityNamespace: \"role\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), B = ({ applicationUniversalIdentifier: e, fieldMetadataUniversalIdentifier: t }) => f({\n\tentityNamespace: \"searchFieldMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), V = ({ applicationUniversalIdentifier: e, fieldUniversalIdentifier: t, value: n }) => f({\n\tentityNamespace: \"selectOption\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), H = ({ applicationUniversalIdentifier: e, name: t }) => f({\n\tentityNamespace: \"skill\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), U = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, name: n }) => f({\n\tentityNamespace: \"viewFieldGroup\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), W = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: n }) => f({\n\tentityNamespace: \"viewField\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), G = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: n, operand: r, subFieldName: i }) => f({\n\tentityNamespace: \"viewFilter\",\n\tvalue: `${t}:${n}:${r}:${i ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), K = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldValue: n }) => f({\n\tentityNamespace: \"viewGroup\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), q = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: n }) => f({\n\tentityNamespace: \"viewSort\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), J = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: n }) => f({\n\tentityNamespace: \"view\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), Y = ({ applicationUniversalIdentifier: t, objectUniversalIdentifier: n }) => f({\n\tentityNamespace: \"view\",\n\tvalue: `${n}:${e.INDEX}`,\n\tapplicationUniversalIdentifier: t\n}), X = ({ applicationUniversalIdentifier: e, pageLayoutWidgetUniversalIdentifier: t }) => f({\n\tentityNamespace: \"view\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), Z = /* @__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}({});\n//#endregion\nexport { n as ASSETS_DIR, r as DEFAULT_API_KEY_NAME, i as DEFAULT_API_URL_NAME, a as DEFAULT_APP_ACCESS_TOKEN_NAME, o as DEFAULT_FUNCTIONS_URL_NAME, s as GENERATED_DIR, c as NODE_ESM_CJS_BANNER, l as OUTPUT_DIR, Z as SyncableEntity, u as TWENTY_STANDARD_APPLICATION_NAME, d as TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER, f as computeDeterministicUuid, p as getAgentUniversalIdentifier, m as getApplicationVariableUniversalIdentifier, b as getConnectionProviderUniversalIdentifier, x as getFieldPermissionUniversalIdentifier, S as getFieldUniversalIdentifier, X as getFieldsWidgetViewUniversalIdentifier, E as getFolderNavigationMenuItemUniversalIdentifier, C as getFrontComponentUniversalIdentifier, g as getGlobalCommandMenuItemUniversalIdentifier, _ as getGlobalObjectContextCommandMenuItemUniversalIdentifier, w as getIndexUniversalIdentifier, Y as getIndexViewUniversalIdentifier, k as getLinkNavigationMenuItemUniversalIdentifier, T as getLogicFunctionUniversalIdentifier, y as getNavigationCommandUniversalIdentifier, D as getObjectNavigationMenuItemUniversalIdentifier, A as getObjectPermissionUniversalIdentifier, j as getObjectUniversalIdentifier, M as getPageLayoutTabUniversalIdentifier, P as getPageLayoutUniversalIdentifier, I as getPageLayoutWidgetUniversalIdentifier, L as getPermissionFlagUniversalIdentifier, F as getRecordPageLayoutUniversalIdentifier, v as getRecordSelectionCommandMenuItemUniversalIdentifier, R as getRolePermissionFlagUniversalIdentifier, z as getRoleUniversalIdentifier, B as getSearchFieldUniversalIdentifier, V as getSelectOptionUniversalIdentifier, H as getSkillUniversalIdentifier, U as getViewFieldGroupUniversalIdentifier, W as getViewFieldUniversalIdentifier, G as getViewFilterUniversalIdentifier, K as getViewGroupUniversalIdentifier, O as getViewNavigationMenuItemUniversalIdentifier, q as getViewSortUniversalIdentifier, J as getViewUniversalIdentifier };\n","import {\n DEFAULT_API_URL_NAME,\n DEFAULT_APP_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application';\n\nexport const postGraphqlRequest = async <TVariables, TData>({\n query,\n variables,\n caller,\n}: {\n query: string;\n variables: TVariables;\n caller: string;\n}): Promise<TData> => {\n const apiUrl = process.env[DEFAULT_API_URL_NAME];\n const accessToken = process.env[DEFAULT_APP_ACCESS_TOKEN_NAME];\n\n if (!apiUrl || !accessToken) {\n throw new Error(\n `${caller}() requires the app runtime env vars ` +\n `${DEFAULT_API_URL_NAME} and ${DEFAULT_APP_ACCESS_TOKEN_NAME}.`,\n );\n }\n\n const response = await fetch(`${apiUrl}/metadata`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${accessToken}`,\n },\n body: JSON.stringify({ query, variables }),\n });\n\n if (!response.ok) {\n throw new Error(\n `${caller}() failed: HTTP ${response.status} ${response.statusText}`,\n );\n }\n\n const body = (await response.json()) as {\n data?: TData;\n errors?: { message: string }[];\n };\n\n if (body.errors && body.errors.length > 0) {\n throw new Error(\n `${caller}() failed: ${body.errors.map((error) => error.message).join(', ')}`,\n );\n }\n\n if (!body.data) {\n throw new Error(`${caller}() failed: response contained no data.`);\n }\n\n return body.data;\n};\n","import { AppConnectionAuthFailedError } from '@/sdk/logic-function/connections/errors/app-connection-auth-failed.error';\nimport { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst GET_APP_CONNECTION_QUERY = `\n query GetAppConnection($id: ID!) {\n appConnection(id: $id) {\n id\n providerName\n name\n handle\n visibility\n userWorkspaceId\n accessToken\n scopes\n authFailedAt\n }\n }\n`;\n\nexport const getConnection = async (id: string): Promise<AppConnection> => {\n const { appConnection } = await postGraphqlRequest<\n { id: string },\n { appConnection: AppConnection }\n >({\n query: GET_APP_CONNECTION_QUERY,\n variables: { id },\n caller: 'getConnection',\n });\n\n if (appConnection.authFailedAt !== null) {\n throw new AppConnectionAuthFailedError(appConnection.id);\n }\n\n return appConnection;\n};\n","import { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst LIST_APP_CONNECTIONS_QUERY = `\n query ListAppConnections($filter: ListAppConnectionsInput) {\n appConnections(filter: $filter) {\n id\n providerName\n name\n handle\n visibility\n userWorkspaceId\n accessToken\n scopes\n authFailedAt\n }\n }\n`;\n\nexport type ListConnectionsFilter = {\n providerName?: string;\n userWorkspaceId?: string;\n visibility?: 'user' | 'workspace';\n};\n\nexport const listConnections = async (\n filter: ListConnectionsFilter = {},\n): Promise<AppConnection[]> => {\n const { appConnections } = await postGraphqlRequest<\n { filter: ListConnectionsFilter },\n { appConnections: AppConnection[] }\n >({\n query: LIST_APP_CONNECTIONS_QUERY,\n variables: { filter },\n caller: 'listConnections',\n });\n\n return appConnections;\n};\n","import { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\n\nexport const findConnectionForRequest = (\n connections: AppConnection[],\n event: { userWorkspaceId: string | null },\n): AppConnection | null => {\n if (event.userWorkspaceId !== null) {\n const personal = connections.find(\n (connection) =>\n connection.visibility === 'user' &&\n connection.userWorkspaceId === event.userWorkspaceId,\n );\n\n if (personal) {\n return personal;\n }\n }\n\n const workspaceShared = connections.find(\n (connection) => connection.visibility === 'workspace',\n );\n\n return workspaceShared ?? null;\n};\n","import {\n type RunAgentInput,\n type RunAgentResult,\n} from 'twenty-shared/application';\n\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst RUN_AGENT_MUTATION = `\n mutation RunAgent($input: RunAgentInput!) {\n runAgent(input: $input) {\n result\n error\n success\n }\n }\n`;\n\nexport const runAgent = async (\n input: RunAgentInput,\n): Promise<RunAgentResult> => {\n const { runAgent: result } = await postGraphqlRequest<\n { input: RunAgentInput },\n { runAgent: RunAgentResult }\n >({\n query: RUN_AGENT_MUTATION,\n variables: { input },\n caller: 'runAgent',\n });\n\n return result;\n};\n","import { type LogicFunctionHttpResponse } from 'twenty-shared/types';\n\nexport type ResponseInit = {\n status?: number;\n headers?: Record<string, string>;\n};\n\nexport class Response implements LogicFunctionHttpResponse {\n readonly __twentyHttpResponse = true as const;\n readonly body: unknown;\n readonly status?: number;\n readonly headers?: Record<string, string>;\n\n constructor(body: unknown, init?: ResponseInit) {\n this.body = body;\n this.status = init?.status;\n this.headers = init?.headers;\n }\n}\n"],"mappings":"uKAEA,IAAIA,EAAK,IAAO,GAAG,OAAS,UAAY,GAAG,OAAS,YAAA,EAAA,EAAA,kBAAe,EAAE,yBAAyB,ECE1FC,GAAK,EAAG,IAAM,CACjB,IAAI,GAAA,EAAA,EAAA,kBAAM,CAAC,EAAI,IAAI,CAAC,EAAI,IAAK,GAC7B,MAAO,cAAA,EAAA,EAAA,kBAAe,CAAC,EAAI,EAAI,SAAS,QACzC,EAAGC,GAAK,EAAG,IAAM,CAChB,GAAIC,EAAE,CAAC,EAAG,MAAO,CAChB,KAAM,SACN,YAAaF,EAAE,EAAE,0BAA2B,CAAC,CAC9C,EACA,GAAI,EAAE,OAAS,UAAW,MAAO,CAChC,KAAM,QACN,MAAO,CACN,KAAM,SACN,YAAaA,EAAE,EAAE,0BAA2B,CAAC,CAC9C,CACD,EACA,GAAI,CAAE,0BAA2B,EAAG,UAAW,EAAG,MAAO,EAAG,MAAO,EAAG,WAAY,EAAG,qBAAsB,EAAG,GAAG,GAAM,EAAG,EAAI,CAAE,GAAG,CAAE,EACrI,OAAOG,EAAAA,EAAE,CAAC,IAAM,EAAE,MAAQF,EAAE,EAAG,CAAC,GAAIE,EAAAA,EAAE,CAAC,IAAM,EAAE,WAAa,OAAO,YAAY,OAAO,QAAQ,CAAC,EAAE,KAAK,CAAC,EAAG,KAAO,CAAC,EAAGF,EAAE,EAAG,CAAC,CAAC,CAAC,CAAC,GAAIE,EAAAA,EAAE,CAAC,IAAM,EAAE,sBAAA,EAAA,EAAA,UAAyB,CAAC,EAAIF,EAAE,EAAG,CAAC,EAAI,GAAI,CAC1L,EAGGI,EAAK,GAAM,CACb,IAAI,EAAI,CAAE,KAAM,SAAU,EAC1B,OAAQ,EAAE,KAAV,CACC,IAAK,SACJ,EAAE,KAAO,SACT,MACD,IAAK,SACL,IAAK,U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,KACR,MAAU,MAAM,GAAG,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"}
|
|
@@ -73,12 +73,7 @@ type LogicFunctionHttpResponse = {
|
|
|
73
73
|
headers?: Record<string, string>;
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
type
|
|
77
|
-
type ServerWebhookTriggerSettings = {
|
|
78
|
-
workspaceIdResolver: {
|
|
79
|
-
source: WebhookWorkspaceIdSource;
|
|
80
|
-
path: string;
|
|
81
|
-
};
|
|
76
|
+
type ServerRouteTriggerSettings = {
|
|
82
77
|
forwardedRequestHeaders?: string[];
|
|
83
78
|
};
|
|
84
79
|
|
|
@@ -136,7 +131,7 @@ type LogicFunctionManifest = SyncableEntityOptions & {
|
|
|
136
131
|
cronTriggerSettings?: CronTriggerSettings;
|
|
137
132
|
databaseEventTriggerSettings?: DatabaseEventTriggerSettings;
|
|
138
133
|
httpRouteTriggerSettings?: HttpRouteTriggerSettings;
|
|
139
|
-
|
|
134
|
+
serverRouteTriggerSettings?: ServerRouteTriggerSettings;
|
|
140
135
|
toolTriggerSettings?: ToolTriggerSettings;
|
|
141
136
|
workflowActionTriggerSettings?: WorkflowActionTriggerSettings;
|
|
142
137
|
sourceHandlerPath: string;
|
|
@@ -169,9 +164,20 @@ type RunAgentResult = {
|
|
|
169
164
|
};
|
|
170
165
|
|
|
171
166
|
type LogicFunctionHandler = (...args: any[]) => any | Promise<any>;
|
|
172
|
-
type
|
|
173
|
-
|
|
167
|
+
type ServerRouteResolverResult = {
|
|
168
|
+
workspaceId: string;
|
|
169
|
+
targetLogicFunctionUniversalIdentifier: string;
|
|
170
|
+
payload?: object;
|
|
174
171
|
};
|
|
172
|
+
type ServerRouteResolverHandler = (...args: any[]) => ServerRouteResolverResult | Promise<ServerRouteResolverResult>;
|
|
173
|
+
type LogicFunctionConfigBase = Omit<LogicFunctionManifest, 'sourceHandlerPath' | 'builtHandlerPath' | 'builtHandlerChecksum' | 'handlerName' | 'serverRouteTriggerSettings'>;
|
|
174
|
+
type LogicFunctionConfig = LogicFunctionConfigBase & ({
|
|
175
|
+
serverRouteTriggerSettings?: undefined;
|
|
176
|
+
handler: LogicFunctionHandler;
|
|
177
|
+
} | {
|
|
178
|
+
serverRouteTriggerSettings: ServerRouteTriggerSettings;
|
|
179
|
+
handler: ServerRouteResolverHandler;
|
|
180
|
+
});
|
|
175
181
|
|
|
176
182
|
type InstallPayload = {
|
|
177
183
|
previousVersion?: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { t as e } from "./isDefined-Dtu5EYqP-CMNeFg4z.mjs";
|
|
2
2
|
import { isNonEmptyString as t, isObject as n } from "@sniptt/guards";
|
|
3
|
+
import "uuid";
|
|
3
4
|
//#region ../twenty-shared/dist/is-record-object-schema-CwzshFdt.mjs
|
|
4
5
|
var r = (e) => (e?.type === "record" || e?.type === "object") && t(e.objectUniversalIdentifier), i = (e, n) => {
|
|
5
6
|
let r = t(e) ? n?.(e) : void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["t","e","i","n","a","t","e","r","o","s","l","c"],"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/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/application/constants/AssetDirectory.ts\nvar e = \"public\", t = \"TWENTY_API_KEY\", n = \"TWENTY_API_URL\", r = \"TWENTY_APP_ACCESS_TOKEN\", i = \"generated\", a = { js: \"import { createRequire as __createRequire } from 'module';\\nconst require = __createRequire(import.meta.url);\" }, o = \".twenty/output\", s = \"Standard\", c = \"20202020-64aa-4b6f-b003-9c74b97cee20\", l = /* @__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}({});\n//#endregion\nexport { e as ASSETS_DIR, t as DEFAULT_API_KEY_NAME, n as DEFAULT_API_URL_NAME, r as DEFAULT_APP_ACCESS_TOKEN_NAME, i as GENERATED_DIR, a as NODE_ESM_CJS_BANNER, o as OUTPUT_DIR, l as SyncableEntity, s as TWENTY_STANDARD_APPLICATION_NAME, c as TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER };\n","import {\n DEFAULT_API_URL_NAME,\n DEFAULT_APP_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application';\n\nexport const postGraphqlRequest = async <TVariables, TData>({\n query,\n variables,\n caller,\n}: {\n query: string;\n variables: TVariables;\n caller: string;\n}): Promise<TData> => {\n const apiUrl = process.env[DEFAULT_API_URL_NAME];\n const accessToken = process.env[DEFAULT_APP_ACCESS_TOKEN_NAME];\n\n if (!apiUrl || !accessToken) {\n throw new Error(\n `${caller}() requires the app runtime env vars ` +\n `${DEFAULT_API_URL_NAME} and ${DEFAULT_APP_ACCESS_TOKEN_NAME}.`,\n );\n }\n\n const response = await fetch(`${apiUrl}/metadata`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${accessToken}`,\n },\n body: JSON.stringify({ query, variables }),\n });\n\n if (!response.ok) {\n throw new Error(\n `${caller}() failed: HTTP ${response.status} ${response.statusText}`,\n );\n }\n\n const body = (await response.json()) as {\n data?: TData;\n errors?: { message: string }[];\n };\n\n if (body.errors && body.errors.length > 0) {\n throw new Error(\n `${caller}() failed: ${body.errors.map((error) => error.message).join(', ')}`,\n );\n }\n\n if (!body.data) {\n throw new Error(`${caller}() failed: response contained no data.`);\n }\n\n return body.data;\n};\n","import { AppConnectionAuthFailedError } from '@/sdk/logic-function/connections/errors/app-connection-auth-failed.error';\nimport { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst GET_APP_CONNECTION_QUERY = `\n query GetAppConnection($id: ID!) {\n appConnection(id: $id) {\n id\n providerName\n name\n handle\n visibility\n userWorkspaceId\n accessToken\n scopes\n authFailedAt\n }\n }\n`;\n\nexport const getConnection = async (id: string): Promise<AppConnection> => {\n const { appConnection } = await postGraphqlRequest<\n { id: string },\n { appConnection: AppConnection }\n >({\n query: GET_APP_CONNECTION_QUERY,\n variables: { id },\n caller: 'getConnection',\n });\n\n if (appConnection.authFailedAt !== null) {\n throw new AppConnectionAuthFailedError(appConnection.id);\n }\n\n return appConnection;\n};\n","import { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst LIST_APP_CONNECTIONS_QUERY = `\n query ListAppConnections($filter: ListAppConnectionsInput) {\n appConnections(filter: $filter) {\n id\n providerName\n name\n handle\n visibility\n userWorkspaceId\n accessToken\n scopes\n authFailedAt\n }\n }\n`;\n\nexport type ListConnectionsFilter = {\n providerName?: string;\n userWorkspaceId?: string;\n visibility?: 'user' | 'workspace';\n};\n\nexport const listConnections = async (\n filter: ListConnectionsFilter = {},\n): Promise<AppConnection[]> => {\n const { appConnections } = await postGraphqlRequest<\n { filter: ListConnectionsFilter },\n { appConnections: AppConnection[] }\n >({\n query: LIST_APP_CONNECTIONS_QUERY,\n variables: { filter },\n caller: 'listConnections',\n });\n\n return appConnections;\n};\n","import { type AppConnection } from '@/sdk/logic-function/connections/types/app-connection.type';\n\nexport const findConnectionForRequest = (\n connections: AppConnection[],\n event: { userWorkspaceId: string | null },\n): AppConnection | null => {\n if (event.userWorkspaceId !== null) {\n const personal = connections.find(\n (connection) =>\n connection.visibility === 'user' &&\n connection.userWorkspaceId === event.userWorkspaceId,\n );\n\n if (personal) {\n return personal;\n }\n }\n\n const workspaceShared = connections.find(\n (connection) => connection.visibility === 'workspace',\n );\n\n return workspaceShared ?? null;\n};\n","import {\n type RunAgentInput,\n type RunAgentResult,\n} from 'twenty-shared/application';\n\nimport { postGraphqlRequest } from '@/sdk/logic-function/utils/post-graphql-request.util';\n\nconst RUN_AGENT_MUTATION = `\n mutation RunAgent($input: RunAgentInput!) {\n runAgent(input: $input) {\n result\n error\n success\n }\n }\n`;\n\nexport const runAgent = async (\n input: RunAgentInput,\n): Promise<RunAgentResult> => {\n const { runAgent: result } = await postGraphqlRequest<\n { input: RunAgentInput },\n { runAgent: RunAgentResult }\n >({\n query: RUN_AGENT_MUTATION,\n variables: { input },\n caller: 'runAgent',\n });\n\n return result;\n};\n","import { type LogicFunctionHttpResponse } from 'twenty-shared/types';\n\nexport type ResponseInit = {\n status?: number;\n headers?: Record<string, string>;\n};\n\nexport class Response implements LogicFunctionHttpResponse {\n readonly __twentyHttpResponse = true as const;\n readonly body: unknown;\n readonly status?: number;\n readonly headers?: Record<string, string>;\n\n constructor(body: unknown, init?: ResponseInit) {\n this.body = body;\n this.status = init?.status;\n this.headers = init?.headers;\n }\n}\n"],"mappings":";;;AAEA,IAAIA,KAAK,OAAO,GAAG,SAAS,YAAY,GAAG,SAAS,aAAaC,EAAE,EAAE,yBAAyB,GCE1FC,KAAK,GAAG,MAAM;CACjB,IAAI,IAAIC,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK;CAC7B,OAAO,aAAaA,EAAE,CAAC,IAAI,IAAI,SAAS;AACzC,GAAGC,KAAK,GAAG,MAAM;CAChB,IAAIC,EAAE,CAAC,GAAG,OAAO;EAChB,MAAM;EACN,aAAaH,EAAE,EAAE,2BAA2B,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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":["e","i","n","a","e","r","o","s","l","u","d","f","p","m","h","g","_","v","y","b","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-Dib-Wyry.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/ViewKey.ts\nvar e = /* @__PURE__ */ function(e) {\n\treturn e.INDEX = \"INDEX\", e;\n}({});\n//#endregion\nexport { e as t };\n","import { t as e } from \"./ViewKey-Dib-Wyry.mjs\";\nimport { v5 as t } from \"uuid\";\n//#region src/application/constants/AssetDirectory.ts\nvar n = \"public\", r = \"TWENTY_API_KEY\", i = \"TWENTY_API_URL\", a = \"TWENTY_APP_ACCESS_TOKEN\", o = \"TWENTY_FUNCTIONS_URL\", s = \"generated\", c = { js: \"import { createRequire as __createRequire } from 'module';\\nconst require = __createRequire(import.meta.url);\" }, l = \".twenty/output\", u = \"Standard\", d = \"20202020-64aa-4b6f-b003-9c74b97cee20\", f = ({ entityNamespace: e, value: n, applicationUniversalIdentifier: r }) => t(`${e}:${n}`, r), p = ({ applicationUniversalIdentifier: e, name: t }) => f({\n\tentityNamespace: \"agent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), m = ({ applicationUniversalIdentifier: e, key: t }) => f({\n\tentityNamespace: \"applicationVariable\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), h = \"navigation\", g = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => f({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL:${t}`,\n\tapplicationUniversalIdentifier: e\n}), _ = ({ applicationUniversalIdentifier: e, engineComponentKey: t }) => f({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `GLOBAL_OBJECT_CONTEXT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), v = ({ applicationUniversalIdentifier: e, engineComponentKey: t, objectUniversalIdentifier: n }) => f({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `RECORD_SELECTION:${t}:${n ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), y = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => f({\n\tentityNamespace: \"commandMenuItem\",\n\tvalue: `${t}:${h}`,\n\tapplicationUniversalIdentifier: e\n}), b = ({ applicationUniversalIdentifier: e, name: t }) => f({\n\tentityNamespace: \"connectionProvider\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), x = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, fieldUniversalIdentifier: n }) => f({\n\tentityNamespace: \"fieldPermission\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), S = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: n }) => f({\n\tentityNamespace: \"fieldMetadata\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), C = ({ applicationUniversalIdentifier: e, componentName: t }) => f({\n\tentityNamespace: \"frontComponent\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), w = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: n }) => f({\n\tentityNamespace: \"index\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), T = ({ applicationUniversalIdentifier: e, name: t }) => f({\n\tentityNamespace: \"logicFunction\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), E = ({ applicationUniversalIdentifier: e, name: t }) => f({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `FOLDER:${t}`,\n\tapplicationUniversalIdentifier: e\n}), D = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => f({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `OBJECT:${t}`,\n\tapplicationUniversalIdentifier: e\n}), O = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t }) => f({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `VIEW:${t}`,\n\tapplicationUniversalIdentifier: e\n}), k = ({ applicationUniversalIdentifier: e, link: t }) => f({\n\tentityNamespace: \"navigationMenuItem\",\n\tvalue: `LINK:${t}`,\n\tapplicationUniversalIdentifier: e\n}), A = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, objectUniversalIdentifier: n }) => f({\n\tentityNamespace: \"objectPermission\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), j = ({ applicationUniversalIdentifier: e, nameSingular: t }) => f({\n\tentityNamespace: \"objectMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), M = ({ applicationUniversalIdentifier: e, pageLayoutUniversalIdentifier: t, title: n }) => f({\n\tentityNamespace: \"pageLayoutTab\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), N = \"RECORD_PAGE\", P = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: n }) => f({\n\tentityNamespace: \"pageLayout\",\n\tvalue: t ? `${t}:${n}` : n,\n\tapplicationUniversalIdentifier: e\n}), F = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t }) => f({\n\tentityNamespace: \"pageLayout\",\n\tvalue: `${t}:${N}`,\n\tapplicationUniversalIdentifier: e\n}), I = ({ applicationUniversalIdentifier: e, pageLayoutTabUniversalIdentifier: t, title: n }) => f({\n\tentityNamespace: \"pageLayoutWidget\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), L = ({ applicationUniversalIdentifier: e, key: t }) => f({\n\tentityNamespace: \"permissionFlag\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), R = ({ applicationUniversalIdentifier: e, roleUniversalIdentifier: t, permissionFlagUniversalIdentifier: n }) => f({\n\tentityNamespace: \"rolePermissionFlag\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), z = ({ applicationUniversalIdentifier: e, label: t }) => f({\n\tentityNamespace: \"role\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), B = ({ applicationUniversalIdentifier: e, fieldMetadataUniversalIdentifier: t }) => f({\n\tentityNamespace: \"searchFieldMetadata\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), V = ({ applicationUniversalIdentifier: e, fieldUniversalIdentifier: t, value: n }) => f({\n\tentityNamespace: \"selectOption\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), H = ({ applicationUniversalIdentifier: e, name: t }) => f({\n\tentityNamespace: \"skill\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), U = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, name: n }) => f({\n\tentityNamespace: \"viewFieldGroup\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), W = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: n }) => f({\n\tentityNamespace: \"viewField\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), G = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: n, operand: r, subFieldName: i }) => f({\n\tentityNamespace: \"viewFilter\",\n\tvalue: `${t}:${n}:${r}:${i ?? \"\"}`,\n\tapplicationUniversalIdentifier: e\n}), K = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldValue: n }) => f({\n\tentityNamespace: \"viewGroup\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), q = ({ applicationUniversalIdentifier: e, viewUniversalIdentifier: t, fieldMetadataUniversalIdentifier: n }) => f({\n\tentityNamespace: \"viewSort\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), J = ({ applicationUniversalIdentifier: e, objectUniversalIdentifier: t, name: n }) => f({\n\tentityNamespace: \"view\",\n\tvalue: `${t}:${n}`,\n\tapplicationUniversalIdentifier: e\n}), Y = ({ applicationUniversalIdentifier: t, objectUniversalIdentifier: n }) => f({\n\tentityNamespace: \"view\",\n\tvalue: `${n}:${e.INDEX}`,\n\tapplicationUniversalIdentifier: t\n}), X = ({ applicationUniversalIdentifier: e, pageLayoutWidgetUniversalIdentifier: t }) => f({\n\tentityNamespace: \"view\",\n\tvalue: t,\n\tapplicationUniversalIdentifier: e\n}), Z = /* @__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}({});\n//#endregion\nexport { n as ASSETS_DIR, r as DEFAULT_API_KEY_NAME, i as DEFAULT_API_URL_NAME, a as DEFAULT_APP_ACCESS_TOKEN_NAME, o as DEFAULT_FUNCTIONS_URL_NAME, s as GENERATED_DIR, c as NODE_ESM_CJS_BANNER, l as OUTPUT_DIR, Z as SyncableEntity, u as TWENTY_STANDARD_APPLICATION_NAME, d as TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER, f as computeDeterministicUuid, p as getAgentUniversalIdentifier, m as getApplicationVariableUniversalIdentifier, b as getConnectionProviderUniversalIdentifier, x as getFieldPermissionUniversalIdentifier, S as getFieldUniversalIdentifier, X as getFieldsWidgetViewUniversalIdentifier, E as getFolderNavigationMenuItemUniversalIdentifier, C as getFrontComponentUniversalIdentifier, g as getGlobalCommandMenuItemUniversalIdentifier, _ as getGlobalObjectContextCommandMenuItemUniversalIdentifier, w as getIndexUniversalIdentifier, Y as getIndexViewUniversalIdentifier, k as getLinkNavigationMenuItemUniversalIdentifier, T as getLogicFunctionUniversalIdentifier, y as getNavigationCommandUniversalIdentifier, D as getObjectNavigationMenuItemUniversalIdentifier, A as getObjectPermissionUniversalIdentifier, j as getObjectUniversalIdentifier, M as getPageLayoutTabUniversalIdentifier, P as getPageLayoutUniversalIdentifier, I as getPageLayoutWidgetUniversalIdentifier, L as getPermissionFlagUniversalIdentifier, F as getRecordPageLayoutUniversalIdentifier, v as getRecordSelectionCommandMenuItemUniversalIdentifier, R as getRolePermissionFlagUniversalIdentifier, z as getRoleUniversalIdentifier, B as getSearchFieldUniversalIdentifier, V as getSelectOptionUniversalIdentifier, H as getSkillUniversalIdentifier, U as getViewFieldGroupUniversalIdentifier, W as getViewFieldUniversalIdentifier, G as getViewFilterUniversalIdentifier, K as getViewGroupUniversalIdentifier, O as getViewNavigationMenuItemUniversalIdentifier, q as getViewSortUniversalIdentifier, J as getViewUniversalIdentifier };\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,IAAI,KAAK,OAAO,GAAG,SAAS,YAAY,GAAG,SAAS,aAAaA,EAAE,EAAE,yBAAyB,GCE1FC,KAAK,GAAG,MAAM;CACjB,IAAI,IAAIC,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK;CAC7B,OAAO,aAAaA,EAAE,CAAC,IAAI,IAAI,SAAS;AACzC,GAAGC,KAAK,GAAG,MAAM;CAChB,IAAI,EAAE,CAAC,GAAG,OAAO;EAChB,MAAM;EACN,aAAaF,EAAE,EAAE,2BAA2B,CAAC;CAC9C;CACA,IAAI,EAAE,SAAS,WAAW,OAAO;EAChC,MAAM;EACN,OAAO;GACN,MAAM;GACN,aAAaA,EAAE,EAAE,2BAA2B,CAAC;EAC9C;CACD;CACA,IAAI,EAAE,2BAA2B,GAAG,WAAW,GAAG,OAAO,GAAG,OAAO,GAAG,YAAY,GAAG,sBAAsB,GAAG,GAAG,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE;CACrI,OAAOG,EAAE,CAAC,MAAM,EAAE,QAAQD,EAAE,GAAG,CAAC,IAAIC,EAAE,CAAC,MAAM,EAAE,aAAa,OAAO,YAAY,OAAO,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,GAAGD,EAAE,GAAG,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