twenty-sdk 2.13.0 → 2.15.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/CHANGELOG.md +17 -0
- package/README.md +4 -0
- package/dist/AllIcons-DEGfvqso-DwtvkCyL.js +1 -0
- package/dist/{AllIcons-BwIoyggb-DpmEuQAR.mjs → AllIcons-DEGfvqso-PUvdkUZm.mjs} +491 -492
- package/dist/catalog-sync-C5Bb1KSh.js +1 -0
- package/dist/{catalog-sync-BfaTQFam.mjs → catalog-sync-DcpUieU5.mjs} +1 -1
- package/dist/cli/commands/dev/dev.d.ts +1 -0
- package/dist/cli/operations/index.d.ts +2 -0
- package/dist/cli/operations/server-start.d.ts +1 -0
- package/dist/cli/utilities/api/api-client.d.ts +3 -1
- package/dist/cli/utilities/api/api-response-type.d.ts +1 -0
- package/dist/cli/utilities/auth/reauth-helper.d.ts +2 -0
- package/dist/cli/utilities/server/docker-container.d.ts +1 -0
- package/dist/cli/utilities/version/get-engine-version-range.d.ts +1 -0
- package/dist/cli/utilities/version/resolve-highest-engine-version.d.ts +1 -0
- package/dist/cli.cjs +34 -34
- package/dist/cli.mjs +1705 -1700
- package/dist/define/index.cjs +11 -11
- package/dist/define/index.cjs.map +1 -1
- package/dist/define/index.d.ts +127 -7
- package/dist/define/index.mjs +36081 -36039
- 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 +6 -3
- package/dist/front-component/index.mjs +8 -8
- package/dist/front-component/index.mjs.map +1 -1
- package/dist/front-component-renderer.cjs +1 -1
- package/dist/get-function-input-schema-GNk3NRLJ-DMgchWCN.js +1 -0
- package/dist/{get-function-input-schema-NI9y_bIk-LH_O2OgF.mjs → get-function-input-schema-GNk3NRLJ-oMYSgib9.mjs} +31 -21
- package/dist/icon-BSeT8K5G-Cuhg-Bz6.js +1 -0
- package/dist/icon-BSeT8K5G-WVhoiRKN.mjs +10144 -0
- package/dist/logic-function/get-function-input-schema-GNk3NRLJ-D8x7FINz.js +2 -0
- package/dist/logic-function/get-function-input-schema-GNk3NRLJ-D8x7FINz.js.map +1 -0
- package/dist/logic-function/get-function-input-schema-GNk3NRLJ-DSc3lI49.mjs +75 -0
- package/dist/logic-function/get-function-input-schema-GNk3NRLJ-DSc3lI49.mjs.map +1 -0
- package/dist/logic-function/index.cjs +4 -4
- package/dist/logic-function/index.cjs.map +1 -1
- package/dist/logic-function/index.d.ts +18 -3
- package/dist/logic-function/index.mjs +143 -28
- package/dist/logic-function/index.mjs.map +1 -1
- package/dist/logic-function/isDefined-Dtu5EYqP-CMNeFg4z.mjs +7 -0
- package/dist/logic-function/isDefined-Dtu5EYqP-CMNeFg4z.mjs.map +1 -0
- package/dist/logic-function/isDefined-Dtu5EYqP-Dp026Ry1.js +2 -0
- package/dist/logic-function/isDefined-Dtu5EYqP-Dp026Ry1.js.map +1 -0
- package/dist/{login-oauth-BMTHndmD.mjs → login-Cm5IBGFm.mjs} +39521 -39320
- package/dist/login-LjERatsq.js +345 -0
- package/dist/operations.cjs +1 -1
- package/dist/operations.mjs +4 -4
- package/dist/ui/index.cjs +33 -6
- package/dist/ui/index.d.ts +18 -12
- package/dist/ui/index.mjs +20408 -1123
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/index.mjs +9 -8
- package/dist/utils/index.mjs.map +1 -1
- package/package.json +5 -3
- package/dist/AllIcons-BwIoyggb-Ck9DmOFs.js +0 -1
- package/dist/catalog-sync-MvJJHh7v.js +0 -1
- package/dist/display-Co0K-nTB-CPdyKmin.js +0 -83
- package/dist/display-Co0K-nTB-DIalVNdw.mjs +0 -54655
- package/dist/get-function-input-schema-NI9y_bIk-BZ2G7LIj.js +0 -1
- package/dist/login-oauth-DN2eTP67.js +0 -345
|
@@ -0,0 +1,2 @@
|
|
|
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;
|
|
2
|
+
//# sourceMappingURL=get-function-input-schema-GNk3NRLJ-D8x7FINz.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-function-input-schema-GNk3NRLJ-D8x7FINz.js","names":["e","n","t"],"sources":["../../../twenty-shared/dist/get-function-input-schema-GNk3NRLJ.mjs"],"sourcesContent":["import { t as e } from \"./isDefined-Dtu5EYqP.mjs\";\nimport { ScriptTarget as t, SyntaxKind as n, createSourceFile as r } from \"typescript\";\n//#region src/logic-function/get-function-input-schema.ts\nvar i = \"TwentyRecord\", a = (t) => {\n\tlet r = t.typeArguments?.[0];\n\tif (e(r) && r.kind === n.LiteralType && r.literal.kind === n.StringLiteral) return r.literal.text;\n}, o = (e) => e.type === \"record\" ? {\n\ttype: \"records\",\n\tobjectUniversalIdentifier: e.objectUniversalIdentifier\n} : {\n\ttype: \"array\",\n\titems: e\n}, s = (t) => {\n\tswitch (t.kind) {\n\t\tcase n.NumberKeyword: return { type: \"number\" };\n\t\tcase n.StringKeyword: return { type: \"string\" };\n\t\tcase n.BooleanKeyword: return { type: \"boolean\" };\n\t\tcase n.ArrayType: return o(s(t.elementType));\n\t\tcase n.TypeReference: {\n\t\t\tlet r = t, c = r.typeName.kind === n.Identifier ? r.typeName.text : void 0;\n\t\t\tif (c === \"Array\" || c === \"ReadonlyArray\") {\n\t\t\t\tlet t = r.typeArguments?.[0];\n\t\t\t\treturn o(e(t) ? s(t) : {});\n\t\t\t}\n\t\t\tif (c === i) {\n\t\t\t\tlet t = a(r);\n\t\t\t\tif (e(t)) return {\n\t\t\t\t\ttype: \"record\",\n\t\t\t\t\tobjectUniversalIdentifier: t\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {};\n\t\t}\n\t\tcase n.ObjectKeyword: return { type: \"object\" };\n\t\tcase n.TypeLiteral: {\n\t\t\tlet n = {};\n\t\t\treturn t.members.forEach((t) => {\n\t\t\t\tif (e(t.name) && e(t.type)) {\n\t\t\t\t\tlet e = t.name.text;\n\t\t\t\t\tn[e] = s(t.type);\n\t\t\t\t}\n\t\t\t}), {\n\t\t\t\ttype: \"object\",\n\t\t\t\tproperties: n\n\t\t\t};\n\t\t}\n\t\tcase n.UnionType: {\n\t\t\tlet e = t, r = [], i = !0;\n\t\t\treturn e.types.forEach((e) => {\n\t\t\t\tif (e.kind === n.LiteralType) {\n\t\t\t\t\tlet t = e.literal;\n\t\t\t\t\tt.kind === n.StringLiteral ? r.push(t.text) : i = !1;\n\t\t\t\t} else i = !1;\n\t\t\t}), i ? {\n\t\t\t\ttype: \"string\",\n\t\t\t\tenum: r\n\t\t\t} : {};\n\t\t}\n\t\tdefault: return {};\n\t}\n}, c = (t, n) => t.parameters.reduce((t, n) => {\n\tlet r = n.type;\n\treturn e(r) ? [...t, s(r)] : [...t, {}];\n}, n), l = (t) => t.kind === n.FunctionDeclaration ? [t] : t.kind === n.VariableStatement ? t.declarationList.declarations.filter((t) => e(t.initializer) && t.initializer.kind === n.ArrowFunction).map((e) => e.initializer) : [], u = (e) => {\n\tlet i = r(\"temp.ts\", e, t.ESNext, !0), a = [];\n\treturn i.forEachChild((e) => {\n\t\t(e.kind === n.FunctionDeclaration || e.kind === n.VariableStatement) && l(e).forEach((e) => {\n\t\t\ta = c(e, a);\n\t\t});\n\t}), a;\n};\n//#endregion\nexport { u as getFunctionInputSchema };\n"],"mappings":"gFAGA,IAAI,EAAI,eAAgB,EAAK,GAAM,CAClC,IAAI,EAAI,EAAE,gBAAgB,GAC1B,GAAIA,EAAAA,EAAE,CAAC,GAAK,EAAE,OAASC,EAAAA,WAAE,aAAe,EAAE,QAAQ,OAASA,EAAAA,WAAE,cAAe,OAAO,EAAE,QAAQ,IAC9F,EAAG,EAAK,GAAM,EAAE,OAAS,SAAW,CACnC,KAAM,UACN,0BAA2B,EAAE,yBAC9B,EAAI,CACH,KAAM,QACN,MAAO,CACR,EAAG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IAAI,EAAI,EAAE,QACV,EAAE,OAASA,EAAAA,WAAE,cAAgB,EAAE,KAAK,EAAE,IAAI,EAAI,EAAI,CAAC,CACpD,MAAO,EAAI,CAAC,CACb,CAAC,EAAG,EAAI,CACP,KAAM,SACN,KAAM,CACP,EAAI,CAAC,CACN,CACA,QAAS,MAAO,CAAC,CAClB,CACD,EAAG,GAAK,EAAG,IAAM,EAAE,WAAW,QAAQ,EAAG,IAAM,CAC9C,IAAI,EAAI,EAAE,KACV,OAAOD,EAAAA,EAAE,CAAC,EAAI,CAAC,GAAG,EAAG,EAAE,CAAC,CAAC,EAAI,CAAC,GAAG,EAAG,CAAC,CAAC,CACvC,EAAG,CAAC,EAAG,EAAK,GAAM,EAAE,OAASC,EAAAA,WAAE,oBAAsB,CAAC,CAAC,EAAI,EAAE,OAASA,EAAAA,WAAE,kBAAoB,EAAE,gBAAgB,aAAa,OAAQ,GAAMD,EAAAA,EAAE,EAAE,WAAW,GAAK,EAAE,YAAY,OAASC,EAAAA,WAAE,aAAa,EAAE,IAAK,GAAM,EAAE,WAAW,EAAI,CAAC,EAAG,EAAK,GAAM,CAC/O,IAAI,GAAA,EAAA,EAAA,kBAAM,UAAW,EAAGC,EAAAA,aAAE,OAAQ,CAAC,CAAC,EAAG,EAAI,CAAC,EAC5C,OAAO,EAAE,aAAc,GAAM,EAC3B,EAAE,OAASD,EAAAA,WAAE,qBAAuB,EAAE,OAASA,EAAAA,WAAE,oBAAsB,EAAE,CAAC,EAAE,QAAS,GAAM,CAC3F,EAAI,EAAE,EAAG,CAAC,CACX,CAAC,CACF,CAAC,EAAG,CACL"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { t as e } from "./isDefined-Dtu5EYqP-CMNeFg4z.mjs";
|
|
2
|
+
import { ScriptTarget as t, SyntaxKind as n, createSourceFile as r } from "typescript";
|
|
3
|
+
//#region ../twenty-shared/dist/get-function-input-schema-GNk3NRLJ.mjs
|
|
4
|
+
var i = "TwentyRecord", a = (t) => {
|
|
5
|
+
let r = t.typeArguments?.[0];
|
|
6
|
+
if (e(r) && r.kind === n.LiteralType && r.literal.kind === n.StringLiteral) return r.literal.text;
|
|
7
|
+
}, o = (e) => e.type === "record" ? {
|
|
8
|
+
type: "records",
|
|
9
|
+
objectUniversalIdentifier: e.objectUniversalIdentifier
|
|
10
|
+
} : {
|
|
11
|
+
type: "array",
|
|
12
|
+
items: e
|
|
13
|
+
}, s = (t) => {
|
|
14
|
+
switch (t.kind) {
|
|
15
|
+
case n.NumberKeyword: return { type: "number" };
|
|
16
|
+
case n.StringKeyword: return { type: "string" };
|
|
17
|
+
case n.BooleanKeyword: return { type: "boolean" };
|
|
18
|
+
case n.ArrayType: return o(s(t.elementType));
|
|
19
|
+
case n.TypeReference: {
|
|
20
|
+
let r = t, c = r.typeName.kind === n.Identifier ? r.typeName.text : void 0;
|
|
21
|
+
if (c === "Array" || c === "ReadonlyArray") {
|
|
22
|
+
let t = r.typeArguments?.[0];
|
|
23
|
+
return o(e(t) ? s(t) : {});
|
|
24
|
+
}
|
|
25
|
+
if (c === i) {
|
|
26
|
+
let t = a(r);
|
|
27
|
+
if (e(t)) return {
|
|
28
|
+
type: "record",
|
|
29
|
+
objectUniversalIdentifier: t
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return {};
|
|
33
|
+
}
|
|
34
|
+
case n.ObjectKeyword: return { type: "object" };
|
|
35
|
+
case n.TypeLiteral: {
|
|
36
|
+
let n = {};
|
|
37
|
+
return t.members.forEach((t) => {
|
|
38
|
+
if (e(t.name) && e(t.type)) {
|
|
39
|
+
let e = t.name.text;
|
|
40
|
+
n[e] = s(t.type);
|
|
41
|
+
}
|
|
42
|
+
}), {
|
|
43
|
+
type: "object",
|
|
44
|
+
properties: n
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
case n.UnionType: {
|
|
48
|
+
let e = t, r = [], i = !0;
|
|
49
|
+
return e.types.forEach((e) => {
|
|
50
|
+
if (e.kind === n.LiteralType) {
|
|
51
|
+
let t = e.literal;
|
|
52
|
+
t.kind === n.StringLiteral ? r.push(t.text) : i = !1;
|
|
53
|
+
} else i = !1;
|
|
54
|
+
}), i ? {
|
|
55
|
+
type: "string",
|
|
56
|
+
enum: r
|
|
57
|
+
} : {};
|
|
58
|
+
}
|
|
59
|
+
default: return {};
|
|
60
|
+
}
|
|
61
|
+
}, c = (t, n) => t.parameters.reduce((t, n) => {
|
|
62
|
+
let r = n.type;
|
|
63
|
+
return e(r) ? [...t, s(r)] : [...t, {}];
|
|
64
|
+
}, n), l = (t) => t.kind === n.FunctionDeclaration ? [t] : t.kind === n.VariableStatement ? t.declarationList.declarations.filter((t) => e(t.initializer) && t.initializer.kind === n.ArrowFunction).map((e) => e.initializer) : [], u = (e) => {
|
|
65
|
+
let i = r("temp.ts", e, t.ESNext, !0), a = [];
|
|
66
|
+
return i.forEachChild((e) => {
|
|
67
|
+
(e.kind === n.FunctionDeclaration || e.kind === n.VariableStatement) && l(e).forEach((e) => {
|
|
68
|
+
a = c(e, a);
|
|
69
|
+
});
|
|
70
|
+
}), a;
|
|
71
|
+
};
|
|
72
|
+
//#endregion
|
|
73
|
+
export { u as getFunctionInputSchema };
|
|
74
|
+
|
|
75
|
+
//# sourceMappingURL=get-function-input-schema-GNk3NRLJ-DSc3lI49.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-function-input-schema-GNk3NRLJ-DSc3lI49.mjs","names":["e","n","r","t"],"sources":["../../../twenty-shared/dist/get-function-input-schema-GNk3NRLJ.mjs"],"sourcesContent":["import { t as e } from \"./isDefined-Dtu5EYqP.mjs\";\nimport { ScriptTarget as t, SyntaxKind as n, createSourceFile as r } from \"typescript\";\n//#region src/logic-function/get-function-input-schema.ts\nvar i = \"TwentyRecord\", a = (t) => {\n\tlet r = t.typeArguments?.[0];\n\tif (e(r) && r.kind === n.LiteralType && r.literal.kind === n.StringLiteral) return r.literal.text;\n}, o = (e) => e.type === \"record\" ? {\n\ttype: \"records\",\n\tobjectUniversalIdentifier: e.objectUniversalIdentifier\n} : {\n\ttype: \"array\",\n\titems: e\n}, s = (t) => {\n\tswitch (t.kind) {\n\t\tcase n.NumberKeyword: return { type: \"number\" };\n\t\tcase n.StringKeyword: return { type: \"string\" };\n\t\tcase n.BooleanKeyword: return { type: \"boolean\" };\n\t\tcase n.ArrayType: return o(s(t.elementType));\n\t\tcase n.TypeReference: {\n\t\t\tlet r = t, c = r.typeName.kind === n.Identifier ? r.typeName.text : void 0;\n\t\t\tif (c === \"Array\" || c === \"ReadonlyArray\") {\n\t\t\t\tlet t = r.typeArguments?.[0];\n\t\t\t\treturn o(e(t) ? s(t) : {});\n\t\t\t}\n\t\t\tif (c === i) {\n\t\t\t\tlet t = a(r);\n\t\t\t\tif (e(t)) return {\n\t\t\t\t\ttype: \"record\",\n\t\t\t\t\tobjectUniversalIdentifier: t\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {};\n\t\t}\n\t\tcase n.ObjectKeyword: return { type: \"object\" };\n\t\tcase n.TypeLiteral: {\n\t\t\tlet n = {};\n\t\t\treturn t.members.forEach((t) => {\n\t\t\t\tif (e(t.name) && e(t.type)) {\n\t\t\t\t\tlet e = t.name.text;\n\t\t\t\t\tn[e] = s(t.type);\n\t\t\t\t}\n\t\t\t}), {\n\t\t\t\ttype: \"object\",\n\t\t\t\tproperties: n\n\t\t\t};\n\t\t}\n\t\tcase n.UnionType: {\n\t\t\tlet e = t, r = [], i = !0;\n\t\t\treturn e.types.forEach((e) => {\n\t\t\t\tif (e.kind === n.LiteralType) {\n\t\t\t\t\tlet t = e.literal;\n\t\t\t\t\tt.kind === n.StringLiteral ? r.push(t.text) : i = !1;\n\t\t\t\t} else i = !1;\n\t\t\t}), i ? {\n\t\t\t\ttype: \"string\",\n\t\t\t\tenum: r\n\t\t\t} : {};\n\t\t}\n\t\tdefault: return {};\n\t}\n}, c = (t, n) => t.parameters.reduce((t, n) => {\n\tlet r = n.type;\n\treturn e(r) ? [...t, s(r)] : [...t, {}];\n}, n), l = (t) => t.kind === n.FunctionDeclaration ? [t] : t.kind === n.VariableStatement ? t.declarationList.declarations.filter((t) => e(t.initializer) && t.initializer.kind === n.ArrowFunction).map((e) => e.initializer) : [], u = (e) => {\n\tlet i = r(\"temp.ts\", e, t.ESNext, !0), a = [];\n\treturn i.forEachChild((e) => {\n\t\t(e.kind === n.FunctionDeclaration || e.kind === n.VariableStatement) && l(e).forEach((e) => {\n\t\t\ta = c(e, a);\n\t\t});\n\t}), a;\n};\n//#endregion\nexport { u as getFunctionInputSchema };\n"],"mappings":";;;AAGA,IAAI,IAAI,gBAAgB,KAAK,MAAM;CAClC,IAAI,IAAI,EAAE,gBAAgB;CAC1B,IAAIA,EAAE,CAAC,KAAK,EAAE,SAASC,EAAE,eAAe,EAAE,QAAQ,SAASA,EAAE,eAAe,OAAO,EAAE,QAAQ;AAC9F,GAAG,KAAK,MAAM,EAAE,SAAS,WAAW;CACnC,MAAM;CACN,2BAA2B,EAAE;AAC9B,IAAI;CACH,MAAM;CACN,OAAO;AACR,GAAG,KAAK,MAAM;CACb,QAAQ,EAAE,MAAV;EACC,KAAKA,EAAE,eAAe,OAAO,EAAE,MAAM,SAAS;EAC9C,KAAKA,EAAE,eAAe,OAAO,EAAE,MAAM,SAAS;EAC9C,KAAKA,EAAE,gBAAgB,OAAO,EAAE,MAAM,UAAU;EAChD,KAAKA,EAAE,WAAW,OAAO,EAAE,EAAE,EAAE,WAAW,CAAC;EAC3C,KAAKA,EAAE,eAAe;GACrB,IAAI,IAAI,GAAG,IAAI,EAAE,SAAS,SAASA,EAAE,aAAa,EAAE,SAAS,OAAO,KAAK;GACzE,IAAI,MAAM,WAAW,MAAM,iBAAiB;IAC3C,IAAI,IAAI,EAAE,gBAAgB;IAC1B,OAAO,EAAED,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC;GAC1B;GACA,IAAI,MAAM,GAAG;IACZ,IAAI,IAAI,EAAE,CAAC;IAC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/O,IAAI,IAAIC,EAAE,WAAW,GAAGC,EAAE,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC;CAC5C,OAAO,EAAE,cAAc,MAAM;EAC5B,CAAC,EAAE,SAASF,EAAE,uBAAuB,EAAE,SAASA,EAAE,sBAAsB,EAAE,CAAC,EAAE,SAAS,MAAM;GAC3F,IAAI,EAAE,GAAG,CAAC;EACX,CAAC;CACF,CAAC,GAAG;AACL"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=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}},
|
|
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=`
|
|
2
2
|
query GetAppConnection($id: ID!) {
|
|
3
3
|
appConnection(id: $id) {
|
|
4
4
|
id
|
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=class e
|
|
|
12
12
|
authFailedAt
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
`,
|
|
15
|
+
`,b=async e=>{let{appConnection:t}=await v({query:y,variables:{id:e},caller:`getConnection`});if(t.authFailedAt!==null)throw new h(t.id);return t},x=`
|
|
16
16
|
query ListAppConnections($filter: ListAppConnectionsInput) {
|
|
17
17
|
appConnections(filter: $filter) {
|
|
18
18
|
id
|
|
@@ -26,7 +26,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=class e
|
|
|
26
26
|
authFailedAt
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
`,
|
|
29
|
+
`,S=async(e={})=>{let{appConnections:t}=await v({query:x,variables:{filter:e},caller:`listConnections`});return t},C=(e,t)=>{if(t.userWorkspaceId!==null){let n=e.find(e=>e.visibility===`user`&&e.userWorkspaceId===t.userWorkspaceId);if(n)return n}return e.find(e=>e.visibility===`workspace`)??null},w=`
|
|
30
30
|
mutation RunAgent($input: RunAgentInput!) {
|
|
31
31
|
runAgent(input: $input) {
|
|
32
32
|
result
|
|
@@ -34,5 +34,5 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=class e
|
|
|
34
34
|
success
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
`,
|
|
37
|
+
`,T=async e=>{let{runAgent:t}=await v({query:w,variables:{input:e},caller:`runAgent`});return t},E=class{constructor(e,t){this.__twentyHttpResponse=!0,this.body=e,this.status=t?.status,this.headers=t?.headers}};exports.AppConnectionAuthFailedError=h,exports.Response=E,exports.findConnectionForRequest=C,exports.getConnection=b,exports.jsonSchemaToInputSchema=o,exports.listConnections=S,exports.runAgent=T;
|
|
38
38
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../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":["// 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":"mEASA,IAAa,EAAb,cAAkD,KAAM,CAGtD,YAAY,EAAsB,CAChC,MACE,kBAAkB,EAAa,gGAEjC,EACA,KAAK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ACzB,GAAI,EAAM,kBAAoB,KAAM,CAClC,IAAM,EAAW,EAAY,KAC1B,GACC,EAAW,aAAe,QAC1B,EAAW,kBAAoB,EAAM,eACzC,EAEA,GAAI,EACF,OAAO,CAEX,CAMA,OAJwB,EAAY,KACjC,GAAe,EAAW,aAAe,WAGrC,GAAmB,IAC5B,EChBM,EAAqB;;;;;;;;EAUd,EAAW,KACtB,IAC4B,CAC5B,GAAM,CAAE,SAAU,GAAW,MAAM,EAGjC,CACA,MAAO,EACP,UAAW,CAAE,OAAM,EACnB,OAAQ,UACV,CAAC,EAED,OAAO,CACT,ECvBa,EAAb,KAA2D,CAMzD,YAAY,EAAe,EAAqB,2BALhB,GAM9B,KAAK,KAAO,EACZ,KAAK,OAAS,GAAM,OACpB,KAAK,QAAU,GAAM,OACvB,CACF"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["t","i","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,C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;;;;;;;;;;;;;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,8 +73,17 @@ type LogicFunctionHttpResponse = {
|
|
|
73
73
|
headers?: Record<string, string>;
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
+
type WebhookWorkspaceIdSource = 'body' | 'query' | 'header';
|
|
77
|
+
type ServerWebhookTriggerSettings = {
|
|
78
|
+
workspaceIdResolver: {
|
|
79
|
+
source: WebhookWorkspaceIdSource;
|
|
80
|
+
path: string;
|
|
81
|
+
};
|
|
82
|
+
forwardedRequestHeaders?: string[];
|
|
83
|
+
};
|
|
84
|
+
|
|
76
85
|
type InputJsonSchema = {
|
|
77
|
-
type?: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'integer' | 'null';
|
|
86
|
+
type?: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'integer' | 'null' | 'record' | 'records';
|
|
78
87
|
description?: string;
|
|
79
88
|
enum?: unknown[];
|
|
80
89
|
items?: InputJsonSchema;
|
|
@@ -85,6 +94,7 @@ type InputJsonSchema = {
|
|
|
85
94
|
maximum?: number;
|
|
86
95
|
multiline?: boolean;
|
|
87
96
|
label?: string;
|
|
97
|
+
objectUniversalIdentifier?: string;
|
|
88
98
|
};
|
|
89
99
|
|
|
90
100
|
type ToolTriggerSettings = {
|
|
@@ -94,7 +104,10 @@ type ToolTriggerSettings = {
|
|
|
94
104
|
type LeafType = 'string' | 'number' | 'boolean' | 'array' | 'unknown';
|
|
95
105
|
type NodeType = 'object' | 'unknown';
|
|
96
106
|
|
|
97
|
-
|
|
107
|
+
declare const jsonSchemaToInputSchema: (jsonSchema: InputJsonSchema) => InputSchema;
|
|
108
|
+
|
|
109
|
+
type RecordSchemaType = 'record' | 'records';
|
|
110
|
+
type InputSchemaPropertyType = LeafType | NodeType | RecordSchemaType | FieldMetadataType;
|
|
98
111
|
type InputSchemaProperty = {
|
|
99
112
|
type: InputSchemaPropertyType;
|
|
100
113
|
enum?: string[];
|
|
@@ -102,6 +115,7 @@ type InputSchemaProperty = {
|
|
|
102
115
|
properties?: Properties$1;
|
|
103
116
|
multiline?: boolean;
|
|
104
117
|
label?: string;
|
|
118
|
+
objectUniversalIdentifier?: string;
|
|
105
119
|
};
|
|
106
120
|
type Properties$1 = {
|
|
107
121
|
[name: string]: InputSchemaProperty;
|
|
@@ -122,6 +136,7 @@ type LogicFunctionManifest = SyncableEntityOptions & {
|
|
|
122
136
|
cronTriggerSettings?: CronTriggerSettings;
|
|
123
137
|
databaseEventTriggerSettings?: DatabaseEventTriggerSettings;
|
|
124
138
|
httpRouteTriggerSettings?: HttpRouteTriggerSettings;
|
|
139
|
+
serverWebhookTriggerSettings?: ServerWebhookTriggerSettings;
|
|
125
140
|
toolTriggerSettings?: ToolTriggerSettings;
|
|
126
141
|
workflowActionTriggerSettings?: WorkflowActionTriggerSettings;
|
|
127
142
|
sourceHandlerPath: string;
|
|
@@ -313,5 +328,5 @@ declare class Response implements LogicFunctionHttpResponse {
|
|
|
313
328
|
constructor(body: unknown, init?: ResponseInit);
|
|
314
329
|
}
|
|
315
330
|
|
|
316
|
-
export { AppConnectionAuthFailedError, ObjectRecordBaseEvent, ObjectRecordCreateEvent, ObjectRecordDeleteEvent, ObjectRecordDestroyEvent, ObjectRecordRestoreEvent, ObjectRecordUpdateEvent, ObjectRecordUpsertEvent, Response, findConnectionForRequest, getConnection, listConnections, runAgent };
|
|
331
|
+
export { AppConnectionAuthFailedError, ObjectRecordBaseEvent, ObjectRecordCreateEvent, ObjectRecordDeleteEvent, ObjectRecordDestroyEvent, ObjectRecordRestoreEvent, ObjectRecordUpdateEvent, ObjectRecordUpsertEvent, Response, findConnectionForRequest, getConnection, jsonSchemaToInputSchema, listConnections, runAgent };
|
|
317
332
|
export type { AppConnection, CronPayload, DatabaseEventPayload, InputJsonSchema, InstallHandler, InstallPayload, ListConnectionsFilter, LogicFunctionConfig, LogicFunctionHandler, ObjectRecordEvent, ResponseInit, LogicFunctionEvent as RoutePayload, RunAgentInput, RunAgentResult };
|
|
@@ -1,61 +1,176 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { t as e } from "./isDefined-Dtu5EYqP-CMNeFg4z.mjs";
|
|
2
|
+
import { isNonEmptyString as t, isObject as n } from "@sniptt/guards";
|
|
3
|
+
//#region ../twenty-shared/dist/is-record-object-schema-CwzshFdt.mjs
|
|
4
|
+
var r = (e) => (e?.type === "record" || e?.type === "object") && t(e.objectUniversalIdentifier), i = (e, n) => {
|
|
5
|
+
let r = t(e) ? n?.(e) : void 0;
|
|
6
|
+
return `Id of the ${t(r) ? r : "linked"} record`;
|
|
7
|
+
}, a = (t, o) => {
|
|
8
|
+
if (r(t)) return {
|
|
9
|
+
type: "string",
|
|
10
|
+
description: i(t.objectUniversalIdentifier, o)
|
|
11
|
+
};
|
|
12
|
+
if (t.type === "records") return {
|
|
13
|
+
type: "array",
|
|
14
|
+
items: {
|
|
15
|
+
type: "string",
|
|
16
|
+
description: i(t.objectUniversalIdentifier, o)
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
let { objectUniversalIdentifier: s, multiline: c, label: l, items: u, properties: d, additionalProperties: f, ...p } = t, m = { ...p };
|
|
20
|
+
return 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 = n(f) ? a(f, o) : f), m;
|
|
21
|
+
}, o = (e) => {
|
|
22
|
+
let n = { type: "unknown" };
|
|
23
|
+
switch (e.type) {
|
|
24
|
+
case "string":
|
|
25
|
+
n.type = "string";
|
|
26
|
+
break;
|
|
27
|
+
case "number":
|
|
28
|
+
case "integer":
|
|
29
|
+
n.type = "number";
|
|
30
|
+
break;
|
|
31
|
+
case "boolean":
|
|
32
|
+
n.type = "boolean";
|
|
33
|
+
break;
|
|
34
|
+
case "array":
|
|
35
|
+
n.type = "array", e.items && (n.items = o(e.items));
|
|
36
|
+
break;
|
|
37
|
+
case "object":
|
|
38
|
+
n.type = "object", e.properties && (n.properties = Object.fromEntries(Object.entries(e.properties).map(([e, t]) => [e, o(t)])));
|
|
39
|
+
break;
|
|
40
|
+
case "record":
|
|
41
|
+
n.type = "record";
|
|
42
|
+
break;
|
|
43
|
+
case "records":
|
|
44
|
+
n.type = "records";
|
|
45
|
+
break;
|
|
46
|
+
default: n.type = "unknown";
|
|
47
|
+
}
|
|
48
|
+
return Array.isArray(e.enum) && (n.enum = e.enum.filter((e) => typeof e == "string")), e.multiline === !0 && (n.multiline = !0), t(e.label) && (n.label = e.label), t(e.objectUniversalIdentifier) && (n.objectUniversalIdentifier = e.objectUniversalIdentifier), n;
|
|
49
|
+
}, s = (e) => [o(e)];
|
|
50
|
+
s({
|
|
51
|
+
type: "object",
|
|
52
|
+
properties: {
|
|
53
|
+
a: { type: "string" },
|
|
54
|
+
b: { type: "number" }
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region ../twenty-shared/dist/logic-function.mjs
|
|
59
|
+
var c = (t) => !e(t) || t === null ? "unknown" : typeof t == "string" ? "string" : typeof t == "number" ? "number" : typeof t == "boolean" ? "boolean" : Array.isArray(t) ? "array" : "unknown", l = (e) => e ? Object.entries(e).reduce((e, [t, r]) => (n(r) && !Array.isArray(r) ? e[t] = {
|
|
60
|
+
isLeaf: !1,
|
|
61
|
+
type: "object",
|
|
62
|
+
label: t,
|
|
63
|
+
value: l(r)
|
|
64
|
+
} : e[t] = {
|
|
65
|
+
isLeaf: !0,
|
|
66
|
+
value: r,
|
|
67
|
+
type: c(r),
|
|
68
|
+
label: t
|
|
69
|
+
}, e), {}) : {}, u = (e, t) => e ? `${e}.${t}` : t, d = (t, n, r = "") => {
|
|
70
|
+
let i = [];
|
|
71
|
+
for (let [a, o] of Object.entries(n)) {
|
|
72
|
+
let n = u(r, a), s = t[a];
|
|
73
|
+
if (!e(s)) {
|
|
74
|
+
i.push(`Missing key "${n}" in declared output schema.`);
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (o.isLeaf !== s.isLeaf) {
|
|
78
|
+
i.push(`Type mismatch at "${n}": expected ${o.isLeaf ? o.type : "object"} but declared ${s.isLeaf ? s.type : "object"}.`);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
if (!o.isLeaf && !s.isLeaf) {
|
|
82
|
+
i.push(...d(s.value, o.value, n));
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
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}.`);
|
|
86
|
+
}
|
|
87
|
+
return i;
|
|
88
|
+
}, f = [
|
|
89
|
+
"string",
|
|
90
|
+
"number",
|
|
91
|
+
"boolean",
|
|
92
|
+
"array",
|
|
93
|
+
"unknown"
|
|
94
|
+
], p = (e) => f.includes(e), m = (e, t) => {
|
|
95
|
+
let r = t.label ?? e;
|
|
96
|
+
return t.type === "record" ? {
|
|
97
|
+
isLeaf: !0,
|
|
98
|
+
type: "string",
|
|
99
|
+
label: r,
|
|
100
|
+
value: null
|
|
101
|
+
} : t.type === "records" ? {
|
|
102
|
+
isLeaf: !0,
|
|
103
|
+
type: "array",
|
|
104
|
+
label: r,
|
|
105
|
+
value: null
|
|
106
|
+
} : t.type === "object" ? {
|
|
107
|
+
isLeaf: !1,
|
|
108
|
+
type: "object",
|
|
109
|
+
label: r,
|
|
110
|
+
value: n(t.properties) ? h(t.properties) : {}
|
|
111
|
+
} : {
|
|
112
|
+
isLeaf: !0,
|
|
113
|
+
type: p(t.type) ? t.type : "unknown",
|
|
114
|
+
label: r,
|
|
115
|
+
value: null
|
|
116
|
+
};
|
|
117
|
+
}, h = (e) => Object.entries(e).reduce((e, [t, n]) => (e[t] = m(t, n), e), {}), g = class extends Error {
|
|
3
118
|
constructor(e) {
|
|
4
119
|
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;
|
|
5
120
|
}
|
|
6
|
-
},
|
|
7
|
-
let
|
|
8
|
-
if (!
|
|
9
|
-
let
|
|
121
|
+
}, _ = "TWENTY_API_URL", v = "TWENTY_APP_ACCESS_TOKEN", y = async ({ query: e, variables: t, caller: n }) => {
|
|
122
|
+
let r = process.env[_], i = process.env[v];
|
|
123
|
+
if (!r || !i) throw Error(`${n}() requires the app runtime env vars ${_} and ${v}.`);
|
|
124
|
+
let a = await fetch(`${r}/metadata`, {
|
|
10
125
|
method: "POST",
|
|
11
126
|
headers: {
|
|
12
127
|
"Content-Type": "application/json",
|
|
13
|
-
Authorization: `Bearer ${
|
|
128
|
+
Authorization: `Bearer ${i}`
|
|
14
129
|
},
|
|
15
130
|
body: JSON.stringify({
|
|
16
131
|
query: e,
|
|
17
|
-
variables:
|
|
132
|
+
variables: t
|
|
18
133
|
})
|
|
19
134
|
});
|
|
20
|
-
if (!
|
|
21
|
-
let
|
|
22
|
-
if (
|
|
23
|
-
if (!
|
|
24
|
-
return
|
|
25
|
-
},
|
|
26
|
-
let { appConnection:
|
|
27
|
-
query:
|
|
28
|
-
variables: { id:
|
|
135
|
+
if (!a.ok) throw Error(`${n}() failed: HTTP ${a.status} ${a.statusText}`);
|
|
136
|
+
let o = await a.json();
|
|
137
|
+
if (o.errors && o.errors.length > 0) throw Error(`${n}() failed: ${o.errors.map((e) => e.message).join(", ")}`);
|
|
138
|
+
if (!o.data) throw Error(`${n}() failed: response contained no data.`);
|
|
139
|
+
return o.data;
|
|
140
|
+
}, b = "\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", x = async (e) => {
|
|
141
|
+
let { appConnection: t } = await y({
|
|
142
|
+
query: b,
|
|
143
|
+
variables: { id: e },
|
|
29
144
|
caller: "getConnection"
|
|
30
145
|
});
|
|
31
|
-
if (
|
|
32
|
-
return
|
|
33
|
-
},
|
|
34
|
-
let { appConnections: t } = await
|
|
35
|
-
query:
|
|
146
|
+
if (t.authFailedAt !== null) throw new g(t.id);
|
|
147
|
+
return t;
|
|
148
|
+
}, S = "\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", C = async (e = {}) => {
|
|
149
|
+
let { appConnections: t } = await y({
|
|
150
|
+
query: S,
|
|
36
151
|
variables: { filter: e },
|
|
37
152
|
caller: "listConnections"
|
|
38
153
|
});
|
|
39
154
|
return t;
|
|
40
|
-
},
|
|
155
|
+
}, w = (e, t) => {
|
|
41
156
|
if (t.userWorkspaceId !== null) {
|
|
42
157
|
let n = e.find((e) => e.visibility === "user" && e.userWorkspaceId === t.userWorkspaceId);
|
|
43
158
|
if (n) return n;
|
|
44
159
|
}
|
|
45
160
|
return e.find((e) => e.visibility === "workspace") ?? null;
|
|
46
|
-
},
|
|
47
|
-
let { runAgent: t } = await
|
|
48
|
-
query:
|
|
161
|
+
}, T = "\n mutation RunAgent($input: RunAgentInput!) {\n runAgent(input: $input) {\n result\n error\n success\n }\n }\n", E = async (e) => {
|
|
162
|
+
let { runAgent: t } = await y({
|
|
163
|
+
query: T,
|
|
49
164
|
variables: { input: e },
|
|
50
165
|
caller: "runAgent"
|
|
51
166
|
});
|
|
52
167
|
return t;
|
|
53
|
-
},
|
|
168
|
+
}, D = class {
|
|
54
169
|
constructor(e, t) {
|
|
55
170
|
this.__twentyHttpResponse = !0, this.body = e, this.status = t?.status, this.headers = t?.headers;
|
|
56
171
|
}
|
|
57
172
|
};
|
|
58
173
|
//#endregion
|
|
59
|
-
export {
|
|
174
|
+
export { g as AppConnectionAuthFailedError, D as Response, w as findConnectionForRequest, x as getConnection, s as jsonSchemaToInputSchema, C as listConnections, E as runAgent };
|
|
60
175
|
|
|
61
176
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../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":["// 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":";AASA,IA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;EACpB,QAAQ;CACV,CAAC;CAED,OAAO;AACT,GCpCa,KACX,GACA,MACyB;CACzB,IAAI,EAAM,oBAAoB,MAAM;EAClC,IAAM,IAAW,EAAY,MAC1B,MACC,EAAW,eAAe,UAC1B,EAAW,oBAAoB,EAAM,eACzC;EAEA,IAAI,GACF,OAAO;CAEX;CAMA,OAJwB,EAAY,MACjC,MAAe,EAAW,eAAe,WAGrC,KAAmB;AAC5B,GChBM,IAAqB,0IAUd,IAAW,OACtB,MAC4B;CAC5B,IAAM,EAAE,UAAU,MAAW,MAAM,EAGjC;EACA,OAAO;EACP,WAAW,EAAE,SAAM;EACnB,QAAQ;CACV,CAAC;CAED,OAAO;AACT,GCvBa,IAAb,MAA2D;CAMzD,YAAY,GAAe,GAAqB;EAG9C,4BAR8B,IAM9B,KAAK,OAAO,GACZ,KAAK,SAAS,GAAM,QACpB,KAAK,UAAU,GAAM;CACvB;AACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["t","e","i","n","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,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AAE,sBAAmB,MAAM,EAG/B;EACA,OAAO;EACP,WAAW,EAAE,UAAO;EACpB,QAAQ;CACV,CAAC;CAED,OAAO;AACT,GCpCa,KACX,GACA,MACyB;CACzB,IAAI,EAAM,oBAAoB,MAAM;EAClC,IAAM,IAAW,EAAY,MAC1B,MACC,EAAW,eAAe,UAC1B,EAAW,oBAAoB,EAAM,eACzC;EAEA,IAAI,GACF,OAAO;CAEX;CAMA,OAJwB,EAAY,MACjC,MAAe,EAAW,eAAe,WAGrC,KAAmB;AAC5B,GChBM,IAAqB,0IAUd,IAAW,OACtB,MAC4B;CAC5B,IAAM,EAAE,UAAU,MAAW,MAAM,EAGjC;EACA,OAAO;EACP,WAAW,EAAE,SAAM;EACnB,QAAQ;CACV,CAAC;CAED,OAAO;AACT,GCvBa,IAAb,MAA2D;CAMzD,YAAY,GAAe,GAAqB;EAG9C,4BAR8B,IAM9B,KAAK,OAAO,GACZ,KAAK,SAAS,GAAM,QACpB,KAAK,UAAU,GAAM;CACvB;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isDefined-Dtu5EYqP-CMNeFg4z.mjs","names":["t","e"],"sources":["../../../twenty-shared/dist/isDefined-Dtu5EYqP.mjs"],"sourcesContent":["import { isNull as e, isUndefined as t } from \"@sniptt/guards\";\n//#region src/utils/validation/isDefined.ts\nvar n = (n) => !t(n) && !e(n);\n//#endregion\nexport { n as t };\n"],"mappings":";;AAEA,IAAI,KAAK,MAAM,CAACA,EAAE,CAAC,KAAK,CAACC,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isDefined-Dtu5EYqP-Dp026Ry1.js","names":[],"sources":["../../../twenty-shared/dist/isDefined-Dtu5EYqP.mjs"],"sourcesContent":["import { isNull as e, isUndefined as t } from \"@sniptt/guards\";\n//#region src/utils/validation/isDefined.ts\nvar n = (n) => !t(n) && !e(n);\n//#endregion\nexport { n as t };\n"],"mappings":"gCAEA,IAAI,EAAK,GAAM,EAAA,EAAA,EAAA,aAAG,CAAC,GAAK,EAAA,EAAA,EAAA,QAAG,CAAC"}
|