@atomoz/workflows-nodes 0.1.13 → 0.1.15
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/package.json +49 -51
- package/src/index.d.ts +0 -2
- package/src/index.d.ts.map +0 -1
- package/src/index.js +0 -1
- package/src/nodes/consts/index.d.ts +0 -3
- package/src/nodes/consts/index.d.ts.map +0 -1
- package/src/nodes/consts/index.js +0 -2
- package/src/nodes/consts/node-colors.d.ts +0 -7
- package/src/nodes/consts/node-colors.d.ts.map +0 -1
- package/src/nodes/consts/node-colors.js +0 -6
- package/src/nodes/consts/node-functions.d.ts +0 -20
- package/src/nodes/consts/node-functions.d.ts.map +0 -1
- package/src/nodes/consts/node-functions.js +0 -29
- package/src/nodes/consts/nodes.d.ts +0 -3
- package/src/nodes/consts/nodes.d.ts.map +0 -1
- package/src/nodes/consts/nodes.js +0 -30
- package/src/nodes/consts/schemas.d.ts +0 -30
- package/src/nodes/consts/schemas.d.ts.map +0 -1
- package/src/nodes/consts/schemas.js +0 -7
- package/src/nodes/ia/agent/data.d.ts +0 -11
- package/src/nodes/ia/agent/data.d.ts.map +0 -1
- package/src/nodes/ia/agent/data.js +0 -111
- package/src/nodes/ia/agent/function.d.ts +0 -2
- package/src/nodes/ia/agent/function.d.ts.map +0 -1
- package/src/nodes/ia/agent/function.js +0 -90
- package/src/nodes/ia/agent/index.d.ts +0 -3
- package/src/nodes/ia/agent/index.d.ts.map +0 -1
- package/src/nodes/ia/agent/index.js +0 -2
- package/src/nodes/ia/index.d.ts +0 -5
- package/src/nodes/ia/index.d.ts.map +0 -1
- package/src/nodes/ia/index.js +0 -4
- package/src/nodes/ia/message/index.d.ts +0 -2
- package/src/nodes/ia/message/index.d.ts.map +0 -1
- package/src/nodes/ia/message/index.js +0 -1
- package/src/nodes/ia/message/message.d.ts +0 -10
- package/src/nodes/ia/message/message.d.ts.map +0 -1
- package/src/nodes/ia/message/message.js +0 -118
- package/src/nodes/ia/supervisor/data.d.ts +0 -10
- package/src/nodes/ia/supervisor/data.d.ts.map +0 -1
- package/src/nodes/ia/supervisor/data.js +0 -84
- package/src/nodes/ia/supervisor/function.d.ts +0 -2
- package/src/nodes/ia/supervisor/function.d.ts.map +0 -1
- package/src/nodes/ia/supervisor/function.js +0 -227
- package/src/nodes/ia/supervisor/index.d.ts +0 -3
- package/src/nodes/ia/supervisor/index.d.ts.map +0 -1
- package/src/nodes/ia/supervisor/index.js +0 -2
- package/src/nodes/ia/tool/data.d.ts +0 -16
- package/src/nodes/ia/tool/data.d.ts.map +0 -1
- package/src/nodes/ia/tool/data.js +0 -70
- package/src/nodes/ia/tool/function.d.ts +0 -4
- package/src/nodes/ia/tool/function.d.ts.map +0 -1
- package/src/nodes/ia/tool/function.js +0 -36
- package/src/nodes/ia/tool/index.d.ts +0 -3
- package/src/nodes/ia/tool/index.d.ts.map +0 -1
- package/src/nodes/ia/tool/index.js +0 -2
- package/src/nodes/index.d.ts +0 -9
- package/src/nodes/index.d.ts.map +0 -1
- package/src/nodes/index.js +0 -8
- package/src/nodes/inputs/chat/chat.d.ts +0 -4
- package/src/nodes/inputs/chat/chat.d.ts.map +0 -1
- package/src/nodes/inputs/chat/chat.js +0 -51
- package/src/nodes/inputs/http/delete/data.d.ts +0 -3
- package/src/nodes/inputs/http/delete/data.d.ts.map +0 -1
- package/src/nodes/inputs/http/delete/data.js +0 -57
- package/src/nodes/inputs/http/delete/function.d.ts +0 -2
- package/src/nodes/inputs/http/delete/function.d.ts.map +0 -1
- package/src/nodes/inputs/http/delete/function.js +0 -28
- package/src/nodes/inputs/http/delete/index.d.ts +0 -4
- package/src/nodes/inputs/http/delete/index.d.ts.map +0 -1
- package/src/nodes/inputs/http/delete/index.js +0 -3
- package/src/nodes/inputs/http/delete/schema.d.ts +0 -16
- package/src/nodes/inputs/http/delete/schema.d.ts.map +0 -1
- package/src/nodes/inputs/http/delete/schema.js +0 -7
- package/src/nodes/inputs/http/get/data.d.ts +0 -3
- package/src/nodes/inputs/http/get/data.d.ts.map +0 -1
- package/src/nodes/inputs/http/get/data.js +0 -58
- package/src/nodes/inputs/http/get/function.d.ts +0 -2
- package/src/nodes/inputs/http/get/function.d.ts.map +0 -1
- package/src/nodes/inputs/http/get/function.js +0 -25
- package/src/nodes/inputs/http/get/index.d.ts +0 -4
- package/src/nodes/inputs/http/get/index.d.ts.map +0 -1
- package/src/nodes/inputs/http/get/index.js +0 -3
- package/src/nodes/inputs/http/get/schema.d.ts +0 -16
- package/src/nodes/inputs/http/get/schema.d.ts.map +0 -1
- package/src/nodes/inputs/http/get/schema.js +0 -7
- package/src/nodes/inputs/http/index.d.ts +0 -8
- package/src/nodes/inputs/http/index.d.ts.map +0 -1
- package/src/nodes/inputs/http/index.js +0 -10
- package/src/nodes/inputs/http/patch/data.d.ts +0 -3
- package/src/nodes/inputs/http/patch/data.d.ts.map +0 -1
- package/src/nodes/inputs/http/patch/data.js +0 -70
- package/src/nodes/inputs/http/patch/function.d.ts +0 -2
- package/src/nodes/inputs/http/patch/function.d.ts.map +0 -1
- package/src/nodes/inputs/http/patch/function.js +0 -36
- package/src/nodes/inputs/http/patch/index.d.ts +0 -4
- package/src/nodes/inputs/http/patch/index.d.ts.map +0 -1
- package/src/nodes/inputs/http/patch/index.js +0 -3
- package/src/nodes/inputs/http/patch/schema.d.ts +0 -21
- package/src/nodes/inputs/http/patch/schema.d.ts.map +0 -1
- package/src/nodes/inputs/http/patch/schema.js +0 -8
- package/src/nodes/inputs/http/post/data.d.ts +0 -3
- package/src/nodes/inputs/http/post/data.d.ts.map +0 -1
- package/src/nodes/inputs/http/post/data.js +0 -70
- package/src/nodes/inputs/http/post/function.d.ts +0 -2
- package/src/nodes/inputs/http/post/function.d.ts.map +0 -1
- package/src/nodes/inputs/http/post/function.js +0 -36
- package/src/nodes/inputs/http/post/index.d.ts +0 -4
- package/src/nodes/inputs/http/post/index.d.ts.map +0 -1
- package/src/nodes/inputs/http/post/index.js +0 -3
- package/src/nodes/inputs/http/post/schema.d.ts +0 -21
- package/src/nodes/inputs/http/post/schema.d.ts.map +0 -1
- package/src/nodes/inputs/http/post/schema.js +0 -8
- package/src/nodes/inputs/http/put/data.d.ts +0 -3
- package/src/nodes/inputs/http/put/data.d.ts.map +0 -1
- package/src/nodes/inputs/http/put/data.js +0 -70
- package/src/nodes/inputs/http/put/function.d.ts +0 -2
- package/src/nodes/inputs/http/put/function.d.ts.map +0 -1
- package/src/nodes/inputs/http/put/function.js +0 -36
- package/src/nodes/inputs/http/put/index.d.ts +0 -4
- package/src/nodes/inputs/http/put/index.d.ts.map +0 -1
- package/src/nodes/inputs/http/put/index.js +0 -3
- package/src/nodes/inputs/http/put/schema.d.ts +0 -21
- package/src/nodes/inputs/http/put/schema.d.ts.map +0 -1
- package/src/nodes/inputs/http/put/schema.js +0 -8
- package/src/nodes/inputs/http/schemas.d.ts +0 -18
- package/src/nodes/inputs/http/schemas.d.ts.map +0 -1
- package/src/nodes/inputs/http/schemas.js +0 -17
- package/src/nodes/inputs/http/utils.d.ts +0 -21
- package/src/nodes/inputs/http/utils.d.ts.map +0 -1
- package/src/nodes/inputs/http/utils.js +0 -63
- package/src/nodes/inputs/index.d.ts +0 -5
- package/src/nodes/inputs/index.d.ts.map +0 -1
- package/src/nodes/inputs/index.js +0 -4
- package/src/nodes/inputs/manual/trigger.d.ts +0 -4
- package/src/nodes/inputs/manual/trigger.d.ts.map +0 -1
- package/src/nodes/inputs/manual/trigger.js +0 -39
- package/src/nodes/output-node/index.d.ts +0 -4
- package/src/nodes/output-node/index.d.ts.map +0 -1
- package/src/nodes/output-node/index.js +0 -123
- package/src/nodes/outputs/chat/output.d.ts +0 -4
- package/src/nodes/outputs/chat/output.d.ts.map +0 -1
- package/src/nodes/outputs/chat/output.js +0 -48
- package/src/nodes/outputs/http-output.d.ts +0 -4
- package/src/nodes/outputs/http-output.d.ts.map +0 -1
- package/src/nodes/outputs/http-output.js +0 -76
- package/src/nodes/processors/concat.d.ts +0 -9
- package/src/nodes/processors/concat.d.ts.map +0 -1
- package/src/nodes/processors/concat.js +0 -68
- package/src/nodes/processors/custom-code.d.ts +0 -4
- package/src/nodes/processors/custom-code.d.ts.map +0 -1
- package/src/nodes/processors/custom-code.js +0 -54
- package/src/nodes/processors/index.d.ts +0 -2
- package/src/nodes/processors/index.d.ts.map +0 -1
- package/src/nodes/processors/index.js +0 -1
- package/src/nodes/processors/transform.d.ts +0 -3
- package/src/nodes/processors/transform.d.ts.map +0 -1
- package/src/nodes/processors/transform.js +0 -48
- package/src/nodes/social/index.d.ts +0 -2
- package/src/nodes/social/index.d.ts.map +0 -1
- package/src/nodes/social/index.js +0 -1
- package/src/nodes/social/whatsapp/index.d.ts +0 -4
- package/src/nodes/social/whatsapp/index.d.ts.map +0 -1
- package/src/nodes/social/whatsapp/index.js +0 -3
- package/src/nodes/social/whatsapp/message-trigger/data.d.ts +0 -3
- package/src/nodes/social/whatsapp/message-trigger/data.d.ts.map +0 -1
- package/src/nodes/social/whatsapp/message-trigger/data.js +0 -55
- package/src/nodes/social/whatsapp/message-trigger/index.d.ts +0 -2
- package/src/nodes/social/whatsapp/message-trigger/index.d.ts.map +0 -1
- package/src/nodes/social/whatsapp/message-trigger/index.js +0 -1
- package/src/nodes/social/whatsapp/send-message/data.d.ts +0 -8
- package/src/nodes/social/whatsapp/send-message/data.d.ts.map +0 -1
- package/src/nodes/social/whatsapp/send-message/data.js +0 -46
- package/src/nodes/social/whatsapp/send-message/functions.d.ts +0 -3
- package/src/nodes/social/whatsapp/send-message/functions.d.ts.map +0 -1
- package/src/nodes/social/whatsapp/send-message/functions.js +0 -32
- package/src/nodes/social/whatsapp/send-message/index.d.ts +0 -3
- package/src/nodes/social/whatsapp/send-message/index.d.ts.map +0 -1
- package/src/nodes/social/whatsapp/send-message/index.js +0 -2
- package/src/nodes/social/whatsapp/send-template/data.d.ts +0 -8
- package/src/nodes/social/whatsapp/send-template/data.d.ts.map +0 -1
- package/src/nodes/social/whatsapp/send-template/data.js +0 -42
- package/src/nodes/social/whatsapp/send-template/functions.d.ts +0 -5
- package/src/nodes/social/whatsapp/send-template/functions.d.ts.map +0 -1
- package/src/nodes/social/whatsapp/send-template/functions.js +0 -60
- package/src/nodes/social/whatsapp/send-template/index.d.ts +0 -3
- package/src/nodes/social/whatsapp/send-template/index.d.ts.map +0 -1
- package/src/nodes/social/whatsapp/send-template/index.js +0 -2
- package/src/nodes/types/base-node.d.ts +0 -17
- package/src/nodes/types/base-node.d.ts.map +0 -1
- package/src/nodes/types/base-node.js +0 -1
- package/src/nodes/types/base-node.types.d.ts +0 -144
- package/src/nodes/types/base-node.types.d.ts.map +0 -1
- package/src/nodes/types/base-node.types.js +0 -1
- package/src/utils/llm-factory.d.ts +0 -16
- package/src/utils/llm-factory.d.ts.map +0 -1
- package/src/utils/llm-factory.js +0 -110
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
const BUSINESS_ACCOUNT_ID = "1079341674316936";
|
|
2
|
-
const NUMBER_ID = "700207253183039";
|
|
3
|
-
const TOKEN = 'EAAUuy5eznhEBPQUOoF07SUTSVjgNIX9eZCWSKPYQhzHiXeEp4Qj3g47bZAPcZAgs8P2B5cZBH9YJjzq0HKNXfA14kaK5Cp2DZCmxzV60MgWlsY1yKavb2qXAQcydoHTTLKcWO53w6ZB7JNzZBeIpZBTb9cB0teRzfX3kjrZBc7utyKq2ZCZCCOQ74pZA28gnmQYzp24oZBQpf7BmuNHgndFVlTba5drxgcpERyNl1dUIDhky7NIruggZDZD';
|
|
4
|
-
const WhatsappStartChatFunction = async (fieldValues) => {
|
|
5
|
-
const { phoneNumber, template } = fieldValues;
|
|
6
|
-
const response = await fetch(`https://graph.facebook.com/v23.0/${NUMBER_ID}/messages`, {
|
|
7
|
-
method: 'POST',
|
|
8
|
-
headers: {
|
|
9
|
-
'Authorization': `Bearer ${TOKEN}`,
|
|
10
|
-
'Content-Type': 'application/json'
|
|
11
|
-
},
|
|
12
|
-
body: JSON.stringify({
|
|
13
|
-
messaging_product: 'whatsapp',
|
|
14
|
-
to: phoneNumber,
|
|
15
|
-
type: 'template',
|
|
16
|
-
template: {
|
|
17
|
-
name: template,
|
|
18
|
-
language: {
|
|
19
|
-
code: 'pt_BR'
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
})
|
|
23
|
-
});
|
|
24
|
-
const data = await response.json();
|
|
25
|
-
if (!response.ok) {
|
|
26
|
-
throw new Error(`Failed to start chat: ${response.statusText}`);
|
|
27
|
-
}
|
|
28
|
-
return data;
|
|
29
|
-
};
|
|
30
|
-
const getMessageTemplates = async () => {
|
|
31
|
-
const response = await fetch(`https://graph.facebook.com/v23.0/${BUSINESS_ACCOUNT_ID}/message_templates`, {
|
|
32
|
-
method: 'GET',
|
|
33
|
-
headers: {
|
|
34
|
-
'Authorization': `Bearer ${TOKEN}`,
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
const data = await response.json();
|
|
38
|
-
return data;
|
|
39
|
-
};
|
|
40
|
-
const createMessageTemplate = async (payload) => {
|
|
41
|
-
const response = await fetch(`https://graph.facebook.com/v23.0/${BUSINESS_ACCOUNT_ID}/message_templates`, {
|
|
42
|
-
method: 'POST',
|
|
43
|
-
headers: {
|
|
44
|
-
'Authorization': `Bearer ${TOKEN}`,
|
|
45
|
-
'Content-Type': 'application/json'
|
|
46
|
-
},
|
|
47
|
-
body: JSON.stringify(payload)
|
|
48
|
-
});
|
|
49
|
-
const data = (await response.json());
|
|
50
|
-
if (!response.ok) {
|
|
51
|
-
const errObj = data.error;
|
|
52
|
-
const msg = errObj?.message || response.statusText;
|
|
53
|
-
const enriched = new Error(`Failed to create template: ${msg}`);
|
|
54
|
-
enriched.details = data;
|
|
55
|
-
enriched.status = response.status;
|
|
56
|
-
throw enriched;
|
|
57
|
-
}
|
|
58
|
-
return data;
|
|
59
|
-
};
|
|
60
|
-
export { WhatsappStartChatFunction, getMessageTemplates, createMessageTemplate };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/nodes/src/nodes/social/whatsapp/send-template/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAe,aAAa,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { NodeField, NodeTags } from './base-node.types';
|
|
2
|
-
export type NodeData = {
|
|
3
|
-
nodeId?: string;
|
|
4
|
-
label: string;
|
|
5
|
-
type: string;
|
|
6
|
-
icon?: string;
|
|
7
|
-
category: string;
|
|
8
|
-
description?: string;
|
|
9
|
-
toolable?: boolean;
|
|
10
|
-
tags?: NodeTags;
|
|
11
|
-
fields?: NodeField[];
|
|
12
|
-
value?: any;
|
|
13
|
-
friendlyId?: string;
|
|
14
|
-
data?: any;
|
|
15
|
-
group?: string;
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=base-node.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-node.d.ts","sourceRoot":"","sources":["../../../../../../libs/nodes/src/nodes/types/base-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,MAAM,QAAQ,GAAG;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { NodeData } from "./base-node";
|
|
2
|
-
export interface NodeHandle {
|
|
3
|
-
type: 'input' | 'output';
|
|
4
|
-
label: string;
|
|
5
|
-
name: string;
|
|
6
|
-
fieldType: string;
|
|
7
|
-
required?: boolean;
|
|
8
|
-
acceptTypes?: string[];
|
|
9
|
-
rejectTypes?: string[];
|
|
10
|
-
maxConnections?: number;
|
|
11
|
-
}
|
|
12
|
-
export interface NodeField {
|
|
13
|
-
id?: string;
|
|
14
|
-
name?: string;
|
|
15
|
-
label: string;
|
|
16
|
-
toolField?: boolean;
|
|
17
|
-
typeable?: boolean;
|
|
18
|
-
type: 'text' | 'textarea' | 'number' | 'boolean' | 'select' | 'json' | 'string' | 'object' | 'HttpOutput' | 'route' | 'code' | 'keyValue' | 'any' | 'llm' | 'function' | 'agent' | 'tool' | 'model' | 'supervisor';
|
|
19
|
-
required?: boolean;
|
|
20
|
-
placeholder?: string;
|
|
21
|
-
defaultValue?: any;
|
|
22
|
-
value?: any;
|
|
23
|
-
options?: Array<{
|
|
24
|
-
label: string;
|
|
25
|
-
value: any;
|
|
26
|
-
}>;
|
|
27
|
-
optionsSource?: {
|
|
28
|
-
provider: string;
|
|
29
|
-
params?: Record<string, any>;
|
|
30
|
-
};
|
|
31
|
-
min?: number;
|
|
32
|
-
max?: number;
|
|
33
|
-
handle?: NodeHandle;
|
|
34
|
-
}
|
|
35
|
-
export interface NodeInput {
|
|
36
|
-
id: string;
|
|
37
|
-
label: string;
|
|
38
|
-
type: 'text' | 'textarea' | 'number' | 'boolean' | 'select' | 'json' | 'keyValue';
|
|
39
|
-
required?: boolean;
|
|
40
|
-
placeholder?: string;
|
|
41
|
-
defaultValue?: any;
|
|
42
|
-
options?: Array<{
|
|
43
|
-
label: string;
|
|
44
|
-
value: any;
|
|
45
|
-
}>;
|
|
46
|
-
min?: number;
|
|
47
|
-
max?: number;
|
|
48
|
-
}
|
|
49
|
-
export interface NodeOutput {
|
|
50
|
-
type: string;
|
|
51
|
-
structure: Array<{
|
|
52
|
-
label: string;
|
|
53
|
-
name: string;
|
|
54
|
-
type: string;
|
|
55
|
-
required: boolean;
|
|
56
|
-
}>;
|
|
57
|
-
}
|
|
58
|
-
export interface HttpOutput {
|
|
59
|
-
status: number;
|
|
60
|
-
statusText: string;
|
|
61
|
-
headers: Record<string, string>;
|
|
62
|
-
data: any;
|
|
63
|
-
url: string;
|
|
64
|
-
method: string;
|
|
65
|
-
responseTime?: number;
|
|
66
|
-
}
|
|
67
|
-
export interface BaseNodeType {
|
|
68
|
-
label: string;
|
|
69
|
-
type: string;
|
|
70
|
-
description: string;
|
|
71
|
-
isInput?: boolean;
|
|
72
|
-
isOutput?: boolean;
|
|
73
|
-
category?: 'input' | 'transform' | 'output' | 'api' | 'custom';
|
|
74
|
-
icon?: string;
|
|
75
|
-
color?: string;
|
|
76
|
-
handles?: NodeHandle[];
|
|
77
|
-
fields?: NodeField[];
|
|
78
|
-
inputs?: NodeInput[];
|
|
79
|
-
output?: NodeOutput;
|
|
80
|
-
config?: Record<string, any>;
|
|
81
|
-
}
|
|
82
|
-
export interface NodeLogicFunction {
|
|
83
|
-
(node: any, inputValue?: string | string[], context?: NodeExecutionContext): any;
|
|
84
|
-
}
|
|
85
|
-
export interface NodeExecutionContext {
|
|
86
|
-
outputs?: Record<string, any>;
|
|
87
|
-
nodeId: string;
|
|
88
|
-
workflowId?: string;
|
|
89
|
-
timestamp: number;
|
|
90
|
-
}
|
|
91
|
-
export interface NodeDefinition {
|
|
92
|
-
type: string;
|
|
93
|
-
name: string;
|
|
94
|
-
description: string;
|
|
95
|
-
logic: (node: any, inputValue?: string | string[]) => any;
|
|
96
|
-
style: NodeStyle;
|
|
97
|
-
fields: NodeField[];
|
|
98
|
-
inputs: NodeInput[];
|
|
99
|
-
validate?: (node: any) => string[];
|
|
100
|
-
sanitize?: (node: any) => any;
|
|
101
|
-
}
|
|
102
|
-
export type NodeInputValue = string | number | boolean | object | any[];
|
|
103
|
-
export type NodeOutputValue = string | number | boolean | object | any[];
|
|
104
|
-
export interface NodeValidation {
|
|
105
|
-
required?: boolean;
|
|
106
|
-
minLength?: number;
|
|
107
|
-
maxLength?: number;
|
|
108
|
-
pattern?: RegExp;
|
|
109
|
-
custom?: (value: any) => boolean;
|
|
110
|
-
message?: string;
|
|
111
|
-
}
|
|
112
|
-
export interface NodeTransformation {
|
|
113
|
-
input?: (value: any) => any;
|
|
114
|
-
output?: (value: any) => any;
|
|
115
|
-
}
|
|
116
|
-
export interface NodeExecutionConfig {
|
|
117
|
-
async?: boolean;
|
|
118
|
-
timeout?: number;
|
|
119
|
-
retries?: number;
|
|
120
|
-
fallback?: any;
|
|
121
|
-
}
|
|
122
|
-
export interface NodeStyle {
|
|
123
|
-
icon: string;
|
|
124
|
-
color: string;
|
|
125
|
-
bgColor: string;
|
|
126
|
-
borderColor?: string;
|
|
127
|
-
}
|
|
128
|
-
export interface ExecutionStep {
|
|
129
|
-
nodeId: string;
|
|
130
|
-
nodeData: NodeData;
|
|
131
|
-
nextSteps: ExecutionStep[];
|
|
132
|
-
fieldConnections?: {
|
|
133
|
-
[sourceHandleId: string]: {
|
|
134
|
-
targetNodeId: string;
|
|
135
|
-
targetFieldId: string;
|
|
136
|
-
}[];
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
export type NodeExecution = 'sync' | 'async';
|
|
140
|
-
export interface NodeTags {
|
|
141
|
-
execution: NodeExecution[] | NodeExecution;
|
|
142
|
-
group: 'IA' | 'HTTP' | 'Data Transformation' | 'Custom' | 'Social';
|
|
143
|
-
}
|
|
144
|
-
//# sourceMappingURL=base-node.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-node.types.d.ts","sourceRoot":"","sources":["../../../../../../libs/nodes/src/nodes/types/base-node.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MA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aAAa,GAAG,MAAM,GAAG,OAAO,CAAC;AAE7C,MAAM,WAAW,QAAQ;IACrB,SAAS,EAAE,aAAa,EAAE,GAAG,aAAa,CAAC;IAC3C,KAAK,EAAE,IAAI,GAAG,MAAM,GAAG,qBAAqB,GAAG,QAAQ,GAAG,QAAQ,CAAC;CACtE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
interface ModelConfig {
|
|
2
|
-
model: string;
|
|
3
|
-
integrationId: string;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Cria uma instância de LLM baseada no modelo e integração fornecidos.
|
|
7
|
-
* Busca as credenciais via GraphQL e instancia o provider apropriado.
|
|
8
|
-
*
|
|
9
|
-
* @param modelConfig - Configuração contendo model e integrationId
|
|
10
|
-
* @param authToken - Token de autenticação para a API GraphQL
|
|
11
|
-
* @param streaming - Habilita streaming (opcional, padrão: false)
|
|
12
|
-
* @returns Instância configurada da LLM
|
|
13
|
-
*/
|
|
14
|
-
export declare function createLLMFromModel(modelConfig: ModelConfig | any, authToken: string, streaming?: boolean): Promise<any>;
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=llm-factory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"llm-factory.d.ts","sourceRoot":"","sources":["../../../../../libs/nodes/src/utils/llm-factory.ts"],"names":[],"mappings":"AAMA,UAAU,WAAW;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;CACzB;AAqCD;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACpC,WAAW,EAAE,WAAW,GAAG,GAAG,EAC9B,SAAS,EAAE,MAAM,EACjB,SAAS,UAAQ,GAClB,OAAO,CAAC,GAAG,CAAC,CAuFd"}
|
package/src/utils/llm-factory.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use server";
|
|
2
|
-
import { GraphQLClient, gql } from 'graphql-request';
|
|
3
|
-
import { ChatGoogle } from "@langchain/google-gauth";
|
|
4
|
-
import { ChatOpenAI } from "@langchain/openai";
|
|
5
|
-
const GRAPHQL_ENDPOINT = process.env['GRAPHQL_URL'] || 'http://localhost:3001/graphql';
|
|
6
|
-
const GET_INTEGRATIONS_QUERY = gql `
|
|
7
|
-
query GetIntegrations($where: IntegrationWhereInput) {
|
|
8
|
-
getIntegrations(where: $where) {
|
|
9
|
-
status
|
|
10
|
-
message
|
|
11
|
-
data {
|
|
12
|
-
id
|
|
13
|
-
status
|
|
14
|
-
data
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
`;
|
|
19
|
-
/**
|
|
20
|
-
* Cria uma instância de LLM baseada no modelo e integração fornecidos.
|
|
21
|
-
* Busca as credenciais via GraphQL e instancia o provider apropriado.
|
|
22
|
-
*
|
|
23
|
-
* @param modelConfig - Configuração contendo model e integrationId
|
|
24
|
-
* @param authToken - Token de autenticação para a API GraphQL
|
|
25
|
-
* @param streaming - Habilita streaming (opcional, padrão: false)
|
|
26
|
-
* @returns Instância configurada da LLM
|
|
27
|
-
*/
|
|
28
|
-
export async function createLLMFromModel(modelConfig, authToken, streaming = false) {
|
|
29
|
-
// Se já é uma instância de LLM, retorna direto
|
|
30
|
-
if (modelConfig?.invoke || modelConfig?.call) {
|
|
31
|
-
return modelConfig;
|
|
32
|
-
}
|
|
33
|
-
// Validar se é um objeto com model e integrationId
|
|
34
|
-
if (!modelConfig?.model || !modelConfig?.integrationId) {
|
|
35
|
-
throw new Error('Model config deve conter "model" e "integrationId"');
|
|
36
|
-
}
|
|
37
|
-
const { model, integrationId } = modelConfig;
|
|
38
|
-
// Buscar integração via GraphQL
|
|
39
|
-
const client = new GraphQLClient(GRAPHQL_ENDPOINT, {
|
|
40
|
-
headers: {
|
|
41
|
-
Authorization: `Bearer ${authToken}`,
|
|
42
|
-
'x-tenant-id': '65d62c52-0c09-473a-8895-359afbed3f5a',
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
let integrationData;
|
|
46
|
-
try {
|
|
47
|
-
const response = await client.request(GET_INTEGRATIONS_QUERY, {
|
|
48
|
-
where: {
|
|
49
|
-
id: {
|
|
50
|
-
eq: integrationId,
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
if (!response.getIntegrations?.data?.[0]) {
|
|
55
|
-
throw new Error(`Integração ${integrationId} não encontrada`);
|
|
56
|
-
}
|
|
57
|
-
integrationData = response.getIntegrations.data[0];
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
console.error('Erro ao buscar integração:', error);
|
|
61
|
-
throw new Error(`Falha ao buscar integração: ${error instanceof Error ? error.message : 'Erro desconhecido'}`);
|
|
62
|
-
}
|
|
63
|
-
// Extrair apiKey do campo data
|
|
64
|
-
const apiKey = integrationData.data?.['token'] || integrationData.data?.['token'];
|
|
65
|
-
if (!apiKey) {
|
|
66
|
-
throw new Error(`API Key não encontrada na integração ${integrationId}`);
|
|
67
|
-
}
|
|
68
|
-
// Identificar provider
|
|
69
|
-
const provider = integrationData.data?.provider?.toLowerCase() || inferProviderFromModel(model);
|
|
70
|
-
// Instanciar LLM baseado no provider
|
|
71
|
-
switch (provider) {
|
|
72
|
-
case 'gemini':
|
|
73
|
-
return new ChatGoogle({
|
|
74
|
-
model: 'gemini-flash-latest',
|
|
75
|
-
apiKey: apiKey,
|
|
76
|
-
streaming: streaming,
|
|
77
|
-
});
|
|
78
|
-
case 'openai':
|
|
79
|
-
return new ChatOpenAI({
|
|
80
|
-
model: model,
|
|
81
|
-
openAIApiKey: apiKey,
|
|
82
|
-
streaming: streaming,
|
|
83
|
-
});
|
|
84
|
-
case 'openrouter':
|
|
85
|
-
return new ChatOpenAI({
|
|
86
|
-
model: model,
|
|
87
|
-
openAIApiKey: apiKey,
|
|
88
|
-
configuration: {
|
|
89
|
-
baseURL: 'https://openrouter.ai/api/v1',
|
|
90
|
-
},
|
|
91
|
-
streaming: streaming,
|
|
92
|
-
});
|
|
93
|
-
default:
|
|
94
|
-
throw new Error(`Provider "${provider}" não suportado. Providers disponíveis: gemini, openai, openrouter`);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Inferir o provider baseado no nome do modelo
|
|
99
|
-
*/
|
|
100
|
-
function inferProviderFromModel(model) {
|
|
101
|
-
const modelLower = model.toLowerCase();
|
|
102
|
-
if (modelLower.includes('gemini') || modelLower.includes('palm')) {
|
|
103
|
-
return 'gemini';
|
|
104
|
-
}
|
|
105
|
-
if (modelLower.includes('gpt') || modelLower.includes('o1') || modelLower.includes('o3')) {
|
|
106
|
-
return 'openai';
|
|
107
|
-
}
|
|
108
|
-
// Padrão para openrouter se não identificado
|
|
109
|
-
return 'openrouter';
|
|
110
|
-
}
|