cecon-interfaces 1.8.82 → 1.8.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm2022/index.mjs +10 -1
- package/dist/esm2022/n8n/entities/chat-api-callback.entity.mjs +91 -0
- package/dist/esm2022/n8n/entities/chat-context.entity.mjs +36 -0
- package/dist/esm2022/n8n/entities/chat-response.entity.mjs +64 -0
- package/dist/esm2022/n8n/entities/chat-trigger.entity.mjs +39 -0
- package/dist/esm2022/n8n/entities/index.mjs +4 -0
- package/dist/esm2022/n8n/index.mjs +13 -0
- package/dist/esm2022/n8n/interfaces/i-chat-api-callback.mjs +2 -0
- package/dist/esm2022/n8n/interfaces/i-chat-context.mjs +2 -0
- package/dist/esm2022/n8n/interfaces/i-chat-response.mjs +2 -0
- package/dist/esm2022/n8n/interfaces/i-chat-trigger.mjs +2 -0
- package/dist/esm2022/n8n/interfaces/index.mjs +2 -0
- package/dist/esm2022/payio/activation-key/entities/activation-key.entity.mjs +5 -3
- package/dist/esm2022/payio/activation-key/enums/activation-key-status.enum.mjs +2 -1
- package/dist/esm2022/payio/activation-key/interfaces/i-activation-key.mjs +1 -1
- package/dist/fesm2022/cecon-interfaces.mjs +236 -3
- package/dist/fesm2022/cecon-interfaces.mjs.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.js +9 -0
- package/dist/n8n/entities/chat-api-callback.entity.d.ts +75 -0
- package/dist/n8n/entities/chat-api-callback.entity.js +77 -0
- package/dist/n8n/entities/chat-context.entity.d.ts +49 -0
- package/dist/n8n/entities/chat-context.entity.js +40 -0
- package/dist/n8n/entities/chat-response.entity.d.ts +77 -0
- package/dist/n8n/entities/chat-response.entity.js +68 -0
- package/dist/n8n/entities/chat-trigger.entity.d.ts +47 -0
- package/dist/n8n/entities/chat-trigger.entity.js +43 -0
- package/dist/n8n/entities/index.d.ts +3 -0
- package/dist/n8n/entities/index.js +9 -0
- package/dist/n8n/index.d.ts +10 -0
- package/dist/n8n/index.js +28 -0
- package/dist/n8n/interfaces/i-chat-api-callback.d.ts +65 -0
- package/dist/n8n/interfaces/i-chat-api-callback.js +2 -0
- package/dist/n8n/interfaces/i-chat-context.d.ts +47 -0
- package/dist/n8n/interfaces/i-chat-context.js +2 -0
- package/dist/n8n/interfaces/i-chat-response.d.ts +50 -0
- package/dist/n8n/interfaces/i-chat-response.js +2 -0
- package/dist/n8n/interfaces/i-chat-trigger.d.ts +45 -0
- package/dist/n8n/interfaces/i-chat-trigger.js +2 -0
- package/dist/n8n/interfaces/index.d.ts +3 -0
- package/dist/n8n/interfaces/index.js +2 -0
- package/dist/payio/activation-key/entities/activation-key.entity.d.ts +2 -0
- package/dist/payio/activation-key/entities/activation-key.entity.js +4 -2
- package/dist/payio/activation-key/enums/activation-key-status.enum.d.ts +1 -0
- package/dist/payio/activation-key/enums/activation-key-status.enum.js +1 -0
- package/dist/payio/activation-key/interfaces/i-activation-key.d.ts +2 -0
- package/docs/examples/n8n-api-callback-example.md +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -37,6 +37,15 @@ export * from './mercado-pago/interfaces';
|
|
37
37
|
export * from './mobyo';
|
38
38
|
export * from './monitor';
|
39
39
|
export * from './mottu';
|
40
|
+
export * from './n8n';
|
41
|
+
export * from './n8n/entities/chat-api-callback.entity';
|
42
|
+
export * from './n8n/entities/chat-context.entity';
|
43
|
+
export * from './n8n/entities/chat-response.entity';
|
44
|
+
export * from './n8n/entities/chat-trigger.entity';
|
45
|
+
export * from './n8n/interfaces/i-chat-api-callback';
|
46
|
+
export * from './n8n/interfaces/i-chat-context';
|
47
|
+
export * from './n8n/interfaces/i-chat-response';
|
48
|
+
export * from './n8n/interfaces/i-chat-trigger';
|
40
49
|
export * from './nati-v1';
|
41
50
|
export * from './nati-v2';
|
42
51
|
export * from './natipay';
|
package/dist/index.js
CHANGED
@@ -53,6 +53,15 @@ __exportStar(require("./mercado-pago/interfaces"), exports);
|
|
53
53
|
__exportStar(require("./mobyo"), exports);
|
54
54
|
__exportStar(require("./monitor"), exports);
|
55
55
|
__exportStar(require("./mottu"), exports);
|
56
|
+
__exportStar(require("./n8n"), exports);
|
57
|
+
__exportStar(require("./n8n/entities/chat-api-callback.entity"), exports);
|
58
|
+
__exportStar(require("./n8n/entities/chat-context.entity"), exports);
|
59
|
+
__exportStar(require("./n8n/entities/chat-response.entity"), exports);
|
60
|
+
__exportStar(require("./n8n/entities/chat-trigger.entity"), exports);
|
61
|
+
__exportStar(require("./n8n/interfaces/i-chat-api-callback"), exports);
|
62
|
+
__exportStar(require("./n8n/interfaces/i-chat-context"), exports);
|
63
|
+
__exportStar(require("./n8n/interfaces/i-chat-response"), exports);
|
64
|
+
__exportStar(require("./n8n/interfaces/i-chat-trigger"), exports);
|
56
65
|
__exportStar(require("./nati-v1"), exports);
|
57
66
|
__exportStar(require("./nati-v2"), exports);
|
58
67
|
__exportStar(require("./natipay"), exports);
|
@@ -0,0 +1,75 @@
|
|
1
|
+
import { IN8nChatApiCallback } from '../interfaces/i-chat-api-callback';
|
2
|
+
export declare class N8nChatApiCallbackEntity implements IN8nChatApiCallback {
|
3
|
+
callApi: boolean;
|
4
|
+
callbackId: string;
|
5
|
+
apiUrl: string;
|
6
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
7
|
+
headers: {
|
8
|
+
authorization?: string;
|
9
|
+
contentType?: string;
|
10
|
+
userAgent?: string;
|
11
|
+
customHeaders?: Record<string, string>;
|
12
|
+
};
|
13
|
+
payload?: {
|
14
|
+
userData?: {
|
15
|
+
userId: string;
|
16
|
+
name?: string;
|
17
|
+
phone?: string;
|
18
|
+
email?: string;
|
19
|
+
};
|
20
|
+
formData?: Record<string, any>;
|
21
|
+
contextData?: {
|
22
|
+
sessionId: string;
|
23
|
+
messageId: string;
|
24
|
+
platform: string;
|
25
|
+
timestamp: Date;
|
26
|
+
};
|
27
|
+
customPayload?: any;
|
28
|
+
};
|
29
|
+
requestConfig?: {
|
30
|
+
timeout?: number;
|
31
|
+
retryAttempts?: number;
|
32
|
+
retryDelay?: number;
|
33
|
+
validateSSL?: boolean;
|
34
|
+
};
|
35
|
+
responseHandling?: {
|
36
|
+
autoResponse: boolean;
|
37
|
+
successMessage?: string;
|
38
|
+
errorMessage?: string;
|
39
|
+
responseTemplate?: string;
|
40
|
+
};
|
41
|
+
metadata?: {
|
42
|
+
action: string;
|
43
|
+
description?: string;
|
44
|
+
requiredFields?: string[];
|
45
|
+
workflow?: {
|
46
|
+
workflowId: string;
|
47
|
+
nodeId: string;
|
48
|
+
stepName: string;
|
49
|
+
};
|
50
|
+
};
|
51
|
+
conditions?: {
|
52
|
+
requireAllFields?: boolean;
|
53
|
+
customValidations?: Array<{
|
54
|
+
field: string;
|
55
|
+
rule: 'required' | 'email' | 'phone' | 'date' | 'regex';
|
56
|
+
value?: string;
|
57
|
+
message?: string;
|
58
|
+
}>;
|
59
|
+
};
|
60
|
+
webhook?: {
|
61
|
+
url: string;
|
62
|
+
method: 'POST' | 'PUT';
|
63
|
+
notifyOnSuccess?: boolean;
|
64
|
+
notifyOnError?: boolean;
|
65
|
+
};
|
66
|
+
constructor(data?: Partial<IN8nChatApiCallback>);
|
67
|
+
/**
|
68
|
+
* Valida se o callback está configurado corretamente para execução
|
69
|
+
*/
|
70
|
+
isValid(): boolean;
|
71
|
+
/**
|
72
|
+
* Valida se todas as condições são atendidas para executar a API
|
73
|
+
*/
|
74
|
+
canExecute(formData?: Record<string, any>): boolean;
|
75
|
+
}
|
@@ -0,0 +1,77 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.N8nChatApiCallbackEntity = void 0;
|
4
|
+
var N8nChatApiCallbackEntity = /** @class */ (function () {
|
5
|
+
// #endregion Properties (12)
|
6
|
+
function N8nChatApiCallbackEntity(data) {
|
7
|
+
if (data === void 0) { data = {}; }
|
8
|
+
var _a, _b, _c, _d, _e;
|
9
|
+
this.callApi = (_a = data.callApi) !== null && _a !== void 0 ? _a : false;
|
10
|
+
this.callbackId = (_b = data.callbackId) !== null && _b !== void 0 ? _b : '';
|
11
|
+
this.apiUrl = (_c = data.apiUrl) !== null && _c !== void 0 ? _c : '';
|
12
|
+
this.method = (_d = data.method) !== null && _d !== void 0 ? _d : 'POST';
|
13
|
+
this.headers = (_e = data.headers) !== null && _e !== void 0 ? _e : {};
|
14
|
+
this.payload = data.payload;
|
15
|
+
this.requestConfig = data.requestConfig;
|
16
|
+
this.responseHandling = data.responseHandling;
|
17
|
+
this.metadata = data.metadata;
|
18
|
+
this.conditions = data.conditions;
|
19
|
+
this.webhook = data.webhook;
|
20
|
+
}
|
21
|
+
/**
|
22
|
+
* Valida se o callback está configurado corretamente para execução
|
23
|
+
*/
|
24
|
+
N8nChatApiCallbackEntity.prototype.isValid = function () {
|
25
|
+
if (!this.callApi)
|
26
|
+
return true; // Se não vai chamar API, é válido
|
27
|
+
return !!(this.callbackId && this.apiUrl && this.method);
|
28
|
+
};
|
29
|
+
/**
|
30
|
+
* Valida se todas as condições são atendidas para executar a API
|
31
|
+
*/
|
32
|
+
N8nChatApiCallbackEntity.prototype.canExecute = function (formData) {
|
33
|
+
var _a, _b, _c;
|
34
|
+
if (!this.callApi || !this.isValid())
|
35
|
+
return false;
|
36
|
+
// Verifica campos obrigatórios
|
37
|
+
if (((_a = this.conditions) === null || _a === void 0 ? void 0 : _a.requireAllFields) && ((_b = this.metadata) === null || _b === void 0 ? void 0 : _b.requiredFields)) {
|
38
|
+
for (var _i = 0, _d = this.metadata.requiredFields; _i < _d.length; _i++) {
|
39
|
+
var field = _d[_i];
|
40
|
+
if (!(formData === null || formData === void 0 ? void 0 : formData[field]))
|
41
|
+
return false;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
// Valida validações customizadas
|
45
|
+
if (((_c = this.conditions) === null || _c === void 0 ? void 0 : _c.customValidations) && formData) {
|
46
|
+
for (var _e = 0, _f = this.conditions.customValidations; _e < _f.length; _e++) {
|
47
|
+
var validation = _f[_e];
|
48
|
+
var value = formData[validation.field];
|
49
|
+
switch (validation.rule) {
|
50
|
+
case 'required':
|
51
|
+
if (!value)
|
52
|
+
return false;
|
53
|
+
break;
|
54
|
+
case 'email':
|
55
|
+
if (value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value))
|
56
|
+
return false;
|
57
|
+
break;
|
58
|
+
case 'phone':
|
59
|
+
if (value && !/^\+?[\d\s\-\(\)]+$/.test(value))
|
60
|
+
return false;
|
61
|
+
break;
|
62
|
+
case 'date':
|
63
|
+
if (value && isNaN(Date.parse(value)))
|
64
|
+
return false;
|
65
|
+
break;
|
66
|
+
case 'regex':
|
67
|
+
if (value && validation.value && !new RegExp(validation.value).test(value))
|
68
|
+
return false;
|
69
|
+
break;
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
return true;
|
74
|
+
};
|
75
|
+
return N8nChatApiCallbackEntity;
|
76
|
+
}());
|
77
|
+
exports.N8nChatApiCallbackEntity = N8nChatApiCallbackEntity;
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import { IN8nChatContext } from '../interfaces/i-chat-context';
|
2
|
+
export declare class N8nChatContextEntity implements IN8nChatContext {
|
3
|
+
contextId: string;
|
4
|
+
sessionId: string;
|
5
|
+
userId: string;
|
6
|
+
platform: string;
|
7
|
+
messageHistory: Array<{
|
8
|
+
messageId: string;
|
9
|
+
message: string;
|
10
|
+
messageType: string;
|
11
|
+
timestamp: Date;
|
12
|
+
sender: 'user' | 'bot';
|
13
|
+
metadata?: any;
|
14
|
+
}>;
|
15
|
+
conversationState: {
|
16
|
+
currentFlow?: string;
|
17
|
+
currentStep?: string;
|
18
|
+
isActive: boolean;
|
19
|
+
lastActivity: Date;
|
20
|
+
variables?: Record<string, any>;
|
21
|
+
};
|
22
|
+
userData: {
|
23
|
+
name?: string;
|
24
|
+
email?: string;
|
25
|
+
phone?: string;
|
26
|
+
preferences?: Record<string, any>;
|
27
|
+
customFields?: Record<string, any>;
|
28
|
+
};
|
29
|
+
sessionConfig: {
|
30
|
+
timeout?: number;
|
31
|
+
maxMessages?: number;
|
32
|
+
language?: string;
|
33
|
+
timezone?: string;
|
34
|
+
};
|
35
|
+
metrics?: {
|
36
|
+
totalMessages: number;
|
37
|
+
userMessages: number;
|
38
|
+
botMessages: number;
|
39
|
+
sessionDuration?: number;
|
40
|
+
firstMessageAt: Date;
|
41
|
+
lastMessageAt: Date;
|
42
|
+
};
|
43
|
+
timestamps: {
|
44
|
+
createdAt: Date;
|
45
|
+
updatedAt: Date;
|
46
|
+
expiresAt?: Date;
|
47
|
+
};
|
48
|
+
constructor(data?: Partial<N8nChatContextEntity>);
|
49
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.N8nChatContextEntity = void 0;
|
4
|
+
var N8nChatContextEntity = /** @class */ (function () {
|
5
|
+
// #endregion Properties (10)
|
6
|
+
// #region Constructors (1)
|
7
|
+
function N8nChatContextEntity(data) {
|
8
|
+
// #region Properties (10)
|
9
|
+
this.contextId = '';
|
10
|
+
this.sessionId = '';
|
11
|
+
this.userId = '';
|
12
|
+
this.platform = '';
|
13
|
+
this.messageHistory = [];
|
14
|
+
this.conversationState = {
|
15
|
+
isActive: false,
|
16
|
+
lastActivity: new Date(),
|
17
|
+
};
|
18
|
+
this.userData = {};
|
19
|
+
this.sessionConfig = {
|
20
|
+
timeout: 30,
|
21
|
+
maxMessages: 100,
|
22
|
+
language: 'pt-BR',
|
23
|
+
timezone: 'America/Sao_Paulo',
|
24
|
+
};
|
25
|
+
this.metrics = undefined;
|
26
|
+
this.timestamps = {
|
27
|
+
createdAt: new Date(),
|
28
|
+
updatedAt: new Date(),
|
29
|
+
};
|
30
|
+
if (data) {
|
31
|
+
for (var key in data) {
|
32
|
+
if (data.hasOwnProperty(key) && key in this) {
|
33
|
+
this[key] = data[key];
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
return N8nChatContextEntity;
|
39
|
+
}());
|
40
|
+
exports.N8nChatContextEntity = N8nChatContextEntity;
|
@@ -0,0 +1,77 @@
|
|
1
|
+
import { IN8nChatApiCallback } from '../interfaces/i-chat-api-callback';
|
2
|
+
import { IN8nChatResponse } from '../interfaces/i-chat-response';
|
3
|
+
export declare class N8nChatResponseEntity implements IN8nChatResponse {
|
4
|
+
responseId: string;
|
5
|
+
originalMessageId: string;
|
6
|
+
sessionId: string;
|
7
|
+
userId: string;
|
8
|
+
message: string;
|
9
|
+
messageType: 'text' | 'image' | 'audio' | 'video' | 'document' | 'template' | 'quick_reply' | 'button';
|
10
|
+
timestamp: Date;
|
11
|
+
platform: string;
|
12
|
+
responseData?: {
|
13
|
+
buttons?: Array<{
|
14
|
+
id: string;
|
15
|
+
text: string;
|
16
|
+
type: 'reply' | 'url' | 'call';
|
17
|
+
payload?: string;
|
18
|
+
url?: string;
|
19
|
+
phoneNumber?: string;
|
20
|
+
apiCallback?: IN8nChatApiCallback;
|
21
|
+
}>;
|
22
|
+
quickReplies?: Array<{
|
23
|
+
id: string;
|
24
|
+
text: string;
|
25
|
+
payload?: string;
|
26
|
+
apiCallback?: IN8nChatApiCallback;
|
27
|
+
}>;
|
28
|
+
template?: {
|
29
|
+
type: string;
|
30
|
+
elements: any[];
|
31
|
+
};
|
32
|
+
media?: {
|
33
|
+
url: string;
|
34
|
+
type: string;
|
35
|
+
caption?: string;
|
36
|
+
filename?: string;
|
37
|
+
};
|
38
|
+
};
|
39
|
+
delivery: {
|
40
|
+
priority: 'low' | 'normal' | 'high';
|
41
|
+
delay?: number;
|
42
|
+
retryAttempts?: number;
|
43
|
+
};
|
44
|
+
metadata?: {
|
45
|
+
automated: boolean;
|
46
|
+
botName?: string;
|
47
|
+
workflowId?: string;
|
48
|
+
nodeId?: string;
|
49
|
+
};
|
50
|
+
status: 'queued' | 'sent' | 'delivered' | 'read' | 'failed';
|
51
|
+
constructor(data?: Partial<N8nChatResponseEntity>);
|
52
|
+
/**
|
53
|
+
* Adiciona um botão com callback de API opcional
|
54
|
+
*/
|
55
|
+
addButton(button: {
|
56
|
+
id: string;
|
57
|
+
text: string;
|
58
|
+
type: 'reply' | 'url' | 'call';
|
59
|
+
payload?: string;
|
60
|
+
url?: string;
|
61
|
+
phoneNumber?: string;
|
62
|
+
apiCallback?: IN8nChatApiCallback;
|
63
|
+
}): void;
|
64
|
+
/**
|
65
|
+
* Adiciona uma resposta rápida com callback de API opcional
|
66
|
+
*/
|
67
|
+
addQuickReply(quickReply: {
|
68
|
+
id: string;
|
69
|
+
text: string;
|
70
|
+
payload?: string;
|
71
|
+
apiCallback?: IN8nChatApiCallback;
|
72
|
+
}): void;
|
73
|
+
/**
|
74
|
+
* Valida se a resposta está pronta para ser enviada
|
75
|
+
*/
|
76
|
+
isValid(): boolean;
|
77
|
+
}
|
@@ -0,0 +1,68 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.N8nChatResponseEntity = void 0;
|
4
|
+
var N8nChatResponseEntity = /** @class */ (function () {
|
5
|
+
// #endregion Properties (12)
|
6
|
+
// #region Constructors (1)
|
7
|
+
function N8nChatResponseEntity(data) {
|
8
|
+
// #region Properties (12)
|
9
|
+
this.responseId = '';
|
10
|
+
this.originalMessageId = '';
|
11
|
+
this.sessionId = '';
|
12
|
+
this.userId = '';
|
13
|
+
this.message = '';
|
14
|
+
this.messageType = 'text';
|
15
|
+
this.timestamp = new Date();
|
16
|
+
this.platform = '';
|
17
|
+
this.responseData = undefined;
|
18
|
+
this.delivery = {
|
19
|
+
priority: 'normal',
|
20
|
+
};
|
21
|
+
this.metadata = undefined;
|
22
|
+
this.status = 'queued';
|
23
|
+
if (data) {
|
24
|
+
for (var key in data) {
|
25
|
+
if (data.hasOwnProperty(key) && key in this) {
|
26
|
+
this[key] = data[key];
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
// #endregion Constructors (1)
|
32
|
+
/**
|
33
|
+
* Adiciona um botão com callback de API opcional
|
34
|
+
*/
|
35
|
+
N8nChatResponseEntity.prototype.addButton = function (button) {
|
36
|
+
if (!this.responseData) {
|
37
|
+
this.responseData = {};
|
38
|
+
}
|
39
|
+
if (!this.responseData.buttons) {
|
40
|
+
this.responseData.buttons = [];
|
41
|
+
}
|
42
|
+
this.responseData.buttons.push(button);
|
43
|
+
this.messageType = 'button';
|
44
|
+
};
|
45
|
+
/**
|
46
|
+
* Adiciona uma resposta rápida com callback de API opcional
|
47
|
+
*/
|
48
|
+
N8nChatResponseEntity.prototype.addQuickReply = function (quickReply) {
|
49
|
+
if (!this.responseData) {
|
50
|
+
this.responseData = {};
|
51
|
+
}
|
52
|
+
if (!this.responseData.quickReplies) {
|
53
|
+
this.responseData.quickReplies = [];
|
54
|
+
}
|
55
|
+
this.responseData.quickReplies.push(quickReply);
|
56
|
+
this.messageType = 'quick_reply';
|
57
|
+
};
|
58
|
+
/**
|
59
|
+
* Valida se a resposta está pronta para ser enviada
|
60
|
+
*/
|
61
|
+
N8nChatResponseEntity.prototype.isValid = function () {
|
62
|
+
var hasBasicData = !!(this.responseId && this.userId && this.sessionId);
|
63
|
+
var hasContent = !!(this.message || this.responseData);
|
64
|
+
return hasBasicData && hasContent;
|
65
|
+
};
|
66
|
+
return N8nChatResponseEntity;
|
67
|
+
}());
|
68
|
+
exports.N8nChatResponseEntity = N8nChatResponseEntity;
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import { IN8nChatTrigger } from '../interfaces/i-chat-trigger';
|
2
|
+
export declare class N8nChatTriggerEntity implements IN8nChatTrigger {
|
3
|
+
messageId: string;
|
4
|
+
sessionId: string;
|
5
|
+
userId: string;
|
6
|
+
message: string;
|
7
|
+
messageType: 'text' | 'image' | 'audio' | 'video' | 'document' | 'location' | 'contact' | 'sticker' | 'emoji';
|
8
|
+
timestamp: Date;
|
9
|
+
platform: string;
|
10
|
+
user: {
|
11
|
+
id: string;
|
12
|
+
name: string;
|
13
|
+
phone?: string;
|
14
|
+
email?: string;
|
15
|
+
avatar?: string;
|
16
|
+
language?: string;
|
17
|
+
};
|
18
|
+
conversation: {
|
19
|
+
id: string;
|
20
|
+
title?: string;
|
21
|
+
isGroup: boolean;
|
22
|
+
participantCount?: number;
|
23
|
+
};
|
24
|
+
metadata: {
|
25
|
+
isForwarded?: boolean;
|
26
|
+
isReply?: boolean;
|
27
|
+
replyToMessageId?: string;
|
28
|
+
hasMedia?: boolean;
|
29
|
+
mediaUrl?: string;
|
30
|
+
mediaType?: string;
|
31
|
+
location?: {
|
32
|
+
latitude: number;
|
33
|
+
longitude: number;
|
34
|
+
address?: string;
|
35
|
+
};
|
36
|
+
};
|
37
|
+
webhook: {
|
38
|
+
id: string;
|
39
|
+
url: string;
|
40
|
+
headers?: Record<string, string>;
|
41
|
+
};
|
42
|
+
rawData?: any;
|
43
|
+
tags?: string[];
|
44
|
+
customData?: Record<string, any>;
|
45
|
+
status: 'pending' | 'processing' | 'completed' | 'error';
|
46
|
+
constructor(data?: Partial<N8nChatTriggerEntity>);
|
47
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.N8nChatTriggerEntity = void 0;
|
4
|
+
var N8nChatTriggerEntity = /** @class */ (function () {
|
5
|
+
// #endregion Properties (15)
|
6
|
+
// #region Constructors (1)
|
7
|
+
function N8nChatTriggerEntity(data) {
|
8
|
+
// #region Properties (15)
|
9
|
+
this.messageId = '';
|
10
|
+
this.sessionId = '';
|
11
|
+
this.userId = '';
|
12
|
+
this.message = '';
|
13
|
+
this.messageType = 'text';
|
14
|
+
this.timestamp = new Date();
|
15
|
+
this.platform = '';
|
16
|
+
this.user = {
|
17
|
+
id: '',
|
18
|
+
name: '',
|
19
|
+
};
|
20
|
+
this.conversation = {
|
21
|
+
id: '',
|
22
|
+
isGroup: false,
|
23
|
+
};
|
24
|
+
this.metadata = {};
|
25
|
+
this.webhook = {
|
26
|
+
id: '',
|
27
|
+
url: '',
|
28
|
+
};
|
29
|
+
this.rawData = null;
|
30
|
+
this.tags = [];
|
31
|
+
this.customData = {};
|
32
|
+
this.status = 'pending';
|
33
|
+
if (data) {
|
34
|
+
for (var key in data) {
|
35
|
+
if (data.hasOwnProperty(key) && key in this) {
|
36
|
+
this[key] = data[key];
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
return N8nChatTriggerEntity;
|
42
|
+
}());
|
43
|
+
exports.N8nChatTriggerEntity = N8nChatTriggerEntity;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.N8nChatTriggerEntity = exports.N8nChatResponseEntity = exports.N8nChatContextEntity = void 0;
|
4
|
+
var chat_context_entity_1 = require("./chat-context.entity");
|
5
|
+
Object.defineProperty(exports, "N8nChatContextEntity", { enumerable: true, get: function () { return chat_context_entity_1.N8nChatContextEntity; } });
|
6
|
+
var chat_response_entity_1 = require("./chat-response.entity");
|
7
|
+
Object.defineProperty(exports, "N8nChatResponseEntity", { enumerable: true, get: function () { return chat_response_entity_1.N8nChatResponseEntity; } });
|
8
|
+
var chat_trigger_entity_1 = require("./chat-trigger.entity");
|
9
|
+
Object.defineProperty(exports, "N8nChatTriggerEntity", { enumerable: true, get: function () { return chat_trigger_entity_1.N8nChatTriggerEntity; } });
|
@@ -0,0 +1,10 @@
|
|
1
|
+
export * from './entities';
|
2
|
+
export * from './interfaces';
|
3
|
+
export * from './interfaces/i-chat-api-callback';
|
4
|
+
export * from './interfaces/i-chat-context';
|
5
|
+
export * from './interfaces/i-chat-response';
|
6
|
+
export * from './interfaces/i-chat-trigger';
|
7
|
+
export * from './entities/chat-api-callback.entity';
|
8
|
+
export * from './entities/chat-context.entity';
|
9
|
+
export * from './entities/chat-response.entity';
|
10
|
+
export * from './entities/chat-trigger.entity';
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./entities"), exports);
|
18
|
+
__exportStar(require("./interfaces"), exports);
|
19
|
+
// Interfaces
|
20
|
+
__exportStar(require("./interfaces/i-chat-api-callback"), exports);
|
21
|
+
__exportStar(require("./interfaces/i-chat-context"), exports);
|
22
|
+
__exportStar(require("./interfaces/i-chat-response"), exports);
|
23
|
+
__exportStar(require("./interfaces/i-chat-trigger"), exports);
|
24
|
+
// Entities
|
25
|
+
__exportStar(require("./entities/chat-api-callback.entity"), exports);
|
26
|
+
__exportStar(require("./entities/chat-context.entity"), exports);
|
27
|
+
__exportStar(require("./entities/chat-response.entity"), exports);
|
28
|
+
__exportStar(require("./entities/chat-trigger.entity"), exports);
|
@@ -0,0 +1,65 @@
|
|
1
|
+
export interface IN8nChatApiCallback {
|
2
|
+
callApi: boolean;
|
3
|
+
callbackId: string;
|
4
|
+
apiUrl: string;
|
5
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
6
|
+
headers: {
|
7
|
+
authorization?: string;
|
8
|
+
contentType?: string;
|
9
|
+
userAgent?: string;
|
10
|
+
customHeaders?: Record<string, string>;
|
11
|
+
};
|
12
|
+
payload?: {
|
13
|
+
userData?: {
|
14
|
+
userId: string;
|
15
|
+
name?: string;
|
16
|
+
phone?: string;
|
17
|
+
email?: string;
|
18
|
+
};
|
19
|
+
formData?: Record<string, any>;
|
20
|
+
contextData?: {
|
21
|
+
sessionId: string;
|
22
|
+
messageId: string;
|
23
|
+
platform: string;
|
24
|
+
timestamp: Date;
|
25
|
+
};
|
26
|
+
customPayload?: any;
|
27
|
+
};
|
28
|
+
requestConfig?: {
|
29
|
+
timeout?: number;
|
30
|
+
retryAttempts?: number;
|
31
|
+
retryDelay?: number;
|
32
|
+
validateSSL?: boolean;
|
33
|
+
};
|
34
|
+
responseHandling?: {
|
35
|
+
autoResponse: boolean;
|
36
|
+
successMessage?: string;
|
37
|
+
errorMessage?: string;
|
38
|
+
responseTemplate?: string;
|
39
|
+
};
|
40
|
+
metadata?: {
|
41
|
+
action: string;
|
42
|
+
description?: string;
|
43
|
+
requiredFields?: string[];
|
44
|
+
workflow?: {
|
45
|
+
workflowId: string;
|
46
|
+
nodeId: string;
|
47
|
+
stepName: string;
|
48
|
+
};
|
49
|
+
};
|
50
|
+
conditions?: {
|
51
|
+
requireAllFields?: boolean;
|
52
|
+
customValidations?: Array<{
|
53
|
+
field: string;
|
54
|
+
rule: 'required' | 'email' | 'phone' | 'date' | 'regex';
|
55
|
+
value?: string;
|
56
|
+
message?: string;
|
57
|
+
}>;
|
58
|
+
};
|
59
|
+
webhook?: {
|
60
|
+
url: string;
|
61
|
+
method: 'POST' | 'PUT';
|
62
|
+
notifyOnSuccess?: boolean;
|
63
|
+
notifyOnError?: boolean;
|
64
|
+
};
|
65
|
+
}
|