@dawntech/dwntbots-models 0.0.57 → 0.0.59
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 +14 -9
- package/src/lib/blip.d.ts +33 -7
- package/src/lib/blip.js +32 -6
- package/src/lib/blip.js.map +1 -1
- package/src/lib/dawntech.js.map +1 -1
- package/src/lib/monitoring/Event.d.ts +18 -0
- package/src/lib/monitoring/Event.js +3 -0
- package/src/lib/monitoring/Event.js.map +1 -0
- package/src/lib/monitoring/Log.d.ts +27 -0
- package/src/lib/monitoring/Log.js +13 -0
- package/src/lib/monitoring/Log.js.map +1 -0
- package/src/lib/monitoring/Metric.d.ts +9 -0
- package/src/lib/monitoring/Metric.js +3 -0
- package/src/lib/monitoring/Metric.js.map +1 -0
- package/src/lib/monitoring/Monitor.d.ts +37 -0
- package/src/lib/monitoring/Monitor.js +131 -0
- package/src/lib/monitoring/Monitor.js.map +1 -0
- package/src/lib/monitoring/Trace.d.ts +106 -0
- package/src/lib/monitoring/Trace.js +3 -0
- package/src/lib/monitoring/Trace.js.map +1 -0
- package/src/lib/vnd.d.ts +8 -2
- package/src/lib/vnd.js +1 -0
- package/src/lib/vnd.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dawntech/dwntbots-models",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.59",
|
|
4
|
+
"engines": {
|
|
5
|
+
"node": "20 || >=22"
|
|
6
|
+
},
|
|
4
7
|
"type": "commonjs",
|
|
5
8
|
"exports": {
|
|
6
9
|
".": {
|
|
@@ -26,14 +29,16 @@
|
|
|
26
29
|
},
|
|
27
30
|
"main": "./src/index.js",
|
|
28
31
|
"types": "./src/index.d.ts",
|
|
29
|
-
"dependencies": {
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
"
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"mongodb": "6.1.0",
|
|
34
|
+
"joi": "17.13.9",
|
|
35
|
+
"lodash": "4.18.1",
|
|
36
|
+
"@dawntech/dwntbots-utils": "0.0.57",
|
|
33
37
|
"rxjs": "7.6.0",
|
|
34
|
-
"@dawntech/dwntbots-logger": "0.0.
|
|
35
|
-
"micromatch": "4.0.5",
|
|
38
|
+
"@dawntech/dwntbots-logger": "0.0.55",
|
|
36
39
|
"date-fns": "2.29.3",
|
|
37
|
-
"chalk": "4.1.2"
|
|
38
|
-
|
|
40
|
+
"chalk": "4.1.2",
|
|
41
|
+
"minimatch": "11.0.6"
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {}
|
|
39
44
|
}
|
package/src/lib/blip.d.ts
CHANGED
|
@@ -20,7 +20,8 @@ export declare namespace Builder {
|
|
|
20
20
|
type CommandTo = string;
|
|
21
21
|
type ManageListAction = "Add" | "Remove";
|
|
22
22
|
type ConditionComparsion = "equals" | "notEquals" | "contains" | "greaterThanOrEquals" | "lessThanOrEquals" | "greaterThan" | "lessThan" | "startsWith" | "endsWith" | "matches" | "exists" | "notExists";
|
|
23
|
-
type CustomActionType = "SendMessage" | "SendRawMessage" | "ProcessHttp" | "TrackEvent" | "MergeContact" | "Redirect" | "ManageList" | "ExecuteScript" | "SetVariable" | "ProcessCommand" | "ForwardToDesk" | "LeavingFromDesk" | "ForwardMessageToDesk" | "TrackContactsJourney";
|
|
23
|
+
type CustomActionType = "SendMessage" | "SendRawMessage" | "ProcessHttp" | "TrackEvent" | "MergeContact" | "Redirect" | "ManageList" | "ExecuteScript" | "ExecuteScriptV2" | "SetVariable" | "ProcessCommand" | "ForwardToDesk" | "LeavingFromDesk" | "ForwardMessageToDesk" | "TrackContactsJourney";
|
|
24
|
+
type ContentActionType = "INPUT" | "MESSAGE" | "RAW-MESSAGE";
|
|
24
25
|
interface Tag {
|
|
25
26
|
background: string;
|
|
26
27
|
label: string;
|
|
@@ -63,7 +64,7 @@ export declare namespace Builder {
|
|
|
63
64
|
}
|
|
64
65
|
interface InputContentActionPayload {
|
|
65
66
|
bypass: boolean;
|
|
66
|
-
conditions
|
|
67
|
+
conditions?: Array<Condition>;
|
|
67
68
|
$cardContent: {
|
|
68
69
|
document: CardContent;
|
|
69
70
|
editable: boolean;
|
|
@@ -141,7 +142,7 @@ export declare namespace Builder {
|
|
|
141
142
|
}>;
|
|
142
143
|
type SetVariableCustomAction = CustomActionBuilder<"SetVariable", {
|
|
143
144
|
variable: string;
|
|
144
|
-
value
|
|
145
|
+
value?: string;
|
|
145
146
|
expiration?: number;
|
|
146
147
|
}>;
|
|
147
148
|
type ExecuteScriptCustomAction = CustomActionBuilder<"ExecuteScript", {
|
|
@@ -151,6 +152,13 @@ export declare namespace Builder {
|
|
|
151
152
|
outputVariable: string;
|
|
152
153
|
LocalTimeZoneEnabled?: boolean;
|
|
153
154
|
}>;
|
|
155
|
+
type ExecuteScriptV2CustomAction = CustomActionBuilder<"ExecuteScriptV2", {
|
|
156
|
+
function: string;
|
|
157
|
+
source: string;
|
|
158
|
+
inputVariables: Array<string>;
|
|
159
|
+
outputVariable: string;
|
|
160
|
+
LocalTimeZoneEnabled?: boolean;
|
|
161
|
+
}>;
|
|
154
162
|
type ProcessCommandCustomAction = CustomActionBuilder<"ProcessCommand", {
|
|
155
163
|
from?: CommandFrom;
|
|
156
164
|
type?: CommandType;
|
|
@@ -164,9 +172,14 @@ export declare namespace Builder {
|
|
|
164
172
|
type ForwardToDeskAction = CustomActionBuilder<"ForwardToDesk", {}>;
|
|
165
173
|
type LeavingFromDeskAction = CustomActionBuilder<"LeavingFromDesk", {}>;
|
|
166
174
|
type ForwardMessageToDeskkAction = CustomActionBuilder<"ForwardMessageToDesk", {}>;
|
|
167
|
-
type CustomAction = ProcessHttpCustomAction | TrackEventCustomAction | MergeContactCustomAction | RedirectCustomAction | ManageListCustomAction | ExecuteScriptCustomAction | ProcessCommandCustomAction | SetVariableCustomAction | ForwardToDeskAction | LeavingFromDeskAction | ForwardMessageToDeskkAction;
|
|
168
|
-
|
|
169
|
-
|
|
175
|
+
type CustomAction = ProcessHttpCustomAction | TrackEventCustomAction | MergeContactCustomAction | RedirectCustomAction | ManageListCustomAction | ExecuteScriptCustomAction | ExecuteScriptV2CustomAction | ProcessCommandCustomAction | SetVariableCustomAction | ForwardToDeskAction | LeavingFromDeskAction | ForwardMessageToDeskkAction;
|
|
176
|
+
type AnyAction = ContentAction | CustomAction | ConditionOutput;
|
|
177
|
+
type AnyEntity = AnyAction | Block;
|
|
178
|
+
function getContentActionType(action: ContentAction): ContentActionType;
|
|
179
|
+
function isCustomAction(entity: AnyEntity): entity is CustomAction;
|
|
180
|
+
function isContentAction(entity: AnyEntity): entity is ContentAction;
|
|
181
|
+
function isConditionOutput(entity: AnyEntity): entity is ConditionOutput;
|
|
182
|
+
function isBlock(entity: AnyEntity): entity is Block;
|
|
170
183
|
function isInputContentAction(action: ContentAction): action is InputContentAction;
|
|
171
184
|
function isMessageContentAction(action: ContentAction): action is MessageContentAction;
|
|
172
185
|
function isRawMessageContentAction(action: ContentAction): action is RawMessageContentAction;
|
|
@@ -200,6 +213,11 @@ export declare namespace Builder {
|
|
|
200
213
|
configuration: Configuration;
|
|
201
214
|
}
|
|
202
215
|
namespace Unsanitized {
|
|
216
|
+
interface Bot {
|
|
217
|
+
flow: Flow;
|
|
218
|
+
globalActions: GlobalActions;
|
|
219
|
+
configuration: Configuration;
|
|
220
|
+
}
|
|
203
221
|
interface Condition extends Partial<Builder.Condition> {
|
|
204
222
|
$$hashKey?: string;
|
|
205
223
|
}
|
|
@@ -327,6 +345,13 @@ export declare namespace Builder {
|
|
|
327
345
|
outputVariable: string;
|
|
328
346
|
LocalTimeZoneEnabled?: boolean;
|
|
329
347
|
}>;
|
|
348
|
+
type ExecuteScriptV2CustomAction = CustomActionBuilder<"ExecuteScriptV2", {
|
|
349
|
+
function: string;
|
|
350
|
+
source: string;
|
|
351
|
+
inputVariables: Array<string>;
|
|
352
|
+
outputVariable: string;
|
|
353
|
+
LocalTimeZoneEnabled?: boolean;
|
|
354
|
+
}>;
|
|
330
355
|
type ProcessCommandCustomAction = CustomActionBuilder<"ProcessCommand", {
|
|
331
356
|
from?: CommandFrom;
|
|
332
357
|
to: CommandTo;
|
|
@@ -340,7 +365,7 @@ export declare namespace Builder {
|
|
|
340
365
|
type ForwardToDeskAction = CustomActionBuilder<"ForwardToDesk", {}>;
|
|
341
366
|
type LeavingFromDeskAction = CustomActionBuilder<"LeavingFromDesk", {}>;
|
|
342
367
|
type ForwardMessageToDeskkAction = CustomActionBuilder<"ForwardMessageToDesk", {}>;
|
|
343
|
-
type CustomAction = ProcessHttpCustomAction | TrackEventCustomAction | MergeContactCustomAction | RedirectCustomAction | ManageListCustomAction | ExecuteScriptCustomAction | ProcessCommandCustomAction | SetVariableCustomAction | ForwardToDeskAction | LeavingFromDeskAction | ForwardMessageToDeskkAction;
|
|
368
|
+
type CustomAction = ProcessHttpCustomAction | TrackEventCustomAction | MergeContactCustomAction | RedirectCustomAction | ManageListCustomAction | ExecuteScriptCustomAction | ExecuteScriptV2CustomAction | ProcessCommandCustomAction | SetVariableCustomAction | ForwardToDeskAction | LeavingFromDeskAction | ForwardMessageToDeskkAction;
|
|
344
369
|
interface Block extends Omit<Partial<Builder.Block>, "$defaultOutput" | "$conditionOutputs" | "$contentActions" | "$enteringCustomActions" | "$leavingCustomActions"> {
|
|
345
370
|
$defaultOutput: {
|
|
346
371
|
stateId: ID;
|
|
@@ -359,6 +384,7 @@ export declare namespace Builder {
|
|
|
359
384
|
}
|
|
360
385
|
type Flow = Record<ID, Block>;
|
|
361
386
|
type GlobalActions = Block;
|
|
387
|
+
type Configuration = Record<string, string>;
|
|
362
388
|
type JSON = {
|
|
363
389
|
flow: Flow;
|
|
364
390
|
globalActions: GlobalActions;
|
package/src/lib/blip.js
CHANGED
|
@@ -3,18 +3,44 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Builder = void 0;
|
|
4
4
|
var Builder;
|
|
5
5
|
(function (Builder) {
|
|
6
|
-
function
|
|
7
|
-
|
|
6
|
+
function getContentActionType(action) {
|
|
7
|
+
if (isInputContentAction(action)) {
|
|
8
|
+
return "INPUT";
|
|
9
|
+
}
|
|
10
|
+
else if (isMessageContentAction(action)) {
|
|
11
|
+
return "MESSAGE";
|
|
12
|
+
}
|
|
13
|
+
else if (isRawMessageContentAction(action)) {
|
|
14
|
+
return "RAW-MESSAGE";
|
|
15
|
+
}
|
|
16
|
+
throw new Error("Unknown content action type");
|
|
17
|
+
}
|
|
18
|
+
Builder.getContentActionType = getContentActionType;
|
|
19
|
+
function isCustomAction(entity) {
|
|
20
|
+
const props = Object.keys(entity);
|
|
21
|
+
const conditionOutput = isConditionOutput(entity);
|
|
8
22
|
return !(props.length < 5 &&
|
|
23
|
+
!conditionOutput &&
|
|
9
24
|
(props.includes("action") || props.includes("input")));
|
|
10
25
|
}
|
|
11
26
|
Builder.isCustomAction = isCustomAction;
|
|
12
|
-
function isContentAction(
|
|
13
|
-
const props = Object.keys(
|
|
14
|
-
return (props.length < 5 &&
|
|
15
|
-
(props.includes("action") || props.includes("input")));
|
|
27
|
+
function isContentAction(entity) {
|
|
28
|
+
const props = Object.keys(entity);
|
|
29
|
+
return (props.length < 5 && (props.includes("action") || props.includes("input")));
|
|
16
30
|
}
|
|
17
31
|
Builder.isContentAction = isContentAction;
|
|
32
|
+
function isConditionOutput(entity) {
|
|
33
|
+
const props = Object.keys(entity);
|
|
34
|
+
return props.includes("stateId") && props.includes("typeOfStateId");
|
|
35
|
+
}
|
|
36
|
+
Builder.isConditionOutput = isConditionOutput;
|
|
37
|
+
function isBlock(entity) {
|
|
38
|
+
const props = Object.keys(entity);
|
|
39
|
+
return (props.includes("$contentActions") &&
|
|
40
|
+
props.includes("$enteringCustomActions") &&
|
|
41
|
+
props.includes("$leavingCustomActions"));
|
|
42
|
+
}
|
|
43
|
+
Builder.isBlock = isBlock;
|
|
18
44
|
function isInputContentAction(action) {
|
|
19
45
|
return Object.keys(action).includes("input");
|
|
20
46
|
}
|
package/src/lib/blip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blip.js","sourceRoot":"","sources":["../../../../../libs/models/src/lib/blip.ts"],"names":[],"mappings":";;;AAEA,IAAiB,OAAO,
|
|
1
|
+
{"version":3,"file":"blip.js","sourceRoot":"","sources":["../../../../../libs/models/src/lib/blip.ts"],"names":[],"mappings":";;;AAEA,IAAiB,OAAO,CA+sBvB;AA/sBD,WAAiB,OAAO;IAySvB,SAAgB,oBAAoB,CACnC,MAAqB;QAErB,IAAI,oBAAoB,CAAC,MAAM,CAAC,EAAE;YACjC,OAAO,OAAO,CAAC;SACf;aAAM,IAAI,sBAAsB,CAAC,MAAM,CAAC,EAAE;YAC1C,OAAO,SAAS,CAAC;SACjB;aAAM,IAAI,yBAAyB,CAAC,MAAM,CAAC,EAAE;YAC7C,OAAO,aAAa,CAAC;SACrB;QACD,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAChD,CAAC;IAXe,4BAAoB,uBAWnC,CAAA;IAED,SAAgB,cAAc,CAAC,MAAiB;QAC/C,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClC,MAAM,eAAe,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAClD,OAAO,CAAC,CACP,KAAK,CAAC,MAAM,GAAG,CAAC;YAChB,CAAC,eAAe;YAChB,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CACrD,CAAC;IACH,CAAC;IARe,sBAAc,iBAQ7B,CAAA;IAED,SAAgB,eAAe,CAAC,MAAiB;QAChD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClC,OAAO,CACN,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,K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;QAED,SAAgB,yBAAyB,CACxC,MAAqB;YAErB,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;gBAC3C,MAAM,GAAG,GAAG,MAAwD,CAAC;gBACrE,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,gBAAgB,CAAC;aAC5C;YACD,OAAO,KAAK,CAAC;QACd,CAAC;QARe,qCAAyB,4BAQxC,CAAA;IACF,CAAC,EAhUgB,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAgU3B;AACF,CAAC,EA/sBgB,OAAO,GAAP,eAAO,KAAP,eAAO,QA+sBvB"}
|
package/src/lib/dawntech.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dawntech.js","sourceRoot":"","sources":["../../../../../libs/models/src/lib/dawntech.ts"],"names":[],"mappings":";;;AAAA,IAAiB,IAAI,
|
|
1
|
+
{"version":3,"file":"dawntech.js","sourceRoot":"","sources":["../../../../../libs/models/src/lib/dawntech.ts"],"names":[],"mappings":";;;AAAA,IAAiB,IAAI,CA4IpB;AA5ID,WAAiB,IAAI;IA4CpB,IAAiB,UAAU,CAsB1B;IAtBD,WAAiB,UAAU;QAC1B,IAAY,iBAIX;QAJD,WAAY,iBAAiB;YAC5B,kDAA6B,CAAA;YAC7B,kDAA6B,CAAA;YAC7B,kDAA6B,CAAA;QAC9B,CAAC,EAJW,iBAAiB,GAAjB,4BAAiB,KAAjB,4BAAiB,QAI5B;QAED,IAAY,eAIX;QAJD,WAAY,eAAe;YAC1B,8CAA2B,CAAA;YAC3B,8CAA2B,CAAA;YAC3B,8CAA2B,CAAA;QAC5B,CAAC,EAJW,eAAe,GAAf,0BAAe,KAAf,0BAAe,QAI1B;QAQY,mBAAQ,GAAG,eAAe,CAAC;QAE3B,qBAAU,GAAG,iBAAiB,CAAC;IAC7C,CAAC,EAtBgB,UAAU,GAAV,eAAU,KAAV,eAAU,QAsB1B;IAED,IAAiB,OAAO,CAmBvB;IAnBD,WAAiB,OAAO;QACvB,IAAY,IAGX;QAHD,WAAY,IAAI;YACf,mDAA2C,CAAA;YAC3C,uDAA+C,CAAA;QAChD,CAAC,EAHW,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAGf;QACD,IAAY,MAEX;QAFD,WAAY,MAAM;YACjB,mBAAS,CAAA;QACV,CAAC,EAFW,MAAM,GAAN,cAAM,KAAN,cAAM,QAEjB;IAYF,CAAC,EAnBgB,OAAO,GAAP,YAAO,KAAP,YAAO,QAmBvB;IAoCD,IAAiB,IAAI,CAgBpB;IAhBD,WAAiB,IAAI;QACpB,IAAY,iBAEX;QAFD,WAAY,iBAAiB;YAC5B,gDAA2B,CAAA;QAC5B,CAAC,EAFW,iBAAiB,GAAjB,sBAAiB,KAAjB,sBAAiB,QAE5B;IAaF,CAAC,EAhBgB,IAAI,GAAJ,SAAI,KAAJ,SAAI,QAgBpB;AACF,CAAC,EA5IgB,IAAI,GAAJ,YAAI,KAAJ,YAAI,QA4IpB;AAED,kBAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface Metadata {
|
|
2
|
+
date: Date;
|
|
3
|
+
channel: string;
|
|
4
|
+
DDD?: string;
|
|
5
|
+
UF?: string;
|
|
6
|
+
lat?: string;
|
|
7
|
+
long?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface Event {
|
|
10
|
+
router_id: string;
|
|
11
|
+
contact_id: string;
|
|
12
|
+
category: string;
|
|
13
|
+
journey?: string;
|
|
14
|
+
action?: string;
|
|
15
|
+
metadata: Metadata;
|
|
16
|
+
data: Record<string, string | number | boolean | Date>;
|
|
17
|
+
}
|
|
18
|
+
export declare type AnalyticsEventPayload = Omit<Event, "router_id" | "category" | "metadata">;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Event.js","sourceRoot":"","sources":["../../../../../../libs/models/src/lib/monitoring/Event.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Vnd } from "../vnd";
|
|
2
|
+
export interface BotInfo {
|
|
3
|
+
contract_id: string;
|
|
4
|
+
bot_id: string;
|
|
5
|
+
}
|
|
6
|
+
export declare type LogType = "ERROR" | "HTTP" | "COMMAND" | "MESSAGE" | "EXCEPTION" | "TICKET" | "JOURNEY";
|
|
7
|
+
export declare const LogTypes: string[];
|
|
8
|
+
export interface LocaleInfo {
|
|
9
|
+
ddd: string;
|
|
10
|
+
state: string;
|
|
11
|
+
coordinates: {
|
|
12
|
+
lat: number;
|
|
13
|
+
lon: number;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare type LogPriority = "HIGH" | "NORMAL" | "LOW";
|
|
17
|
+
export interface Log<T extends Object = Object> {
|
|
18
|
+
timestamp: string;
|
|
19
|
+
type: LogType;
|
|
20
|
+
priority: LogPriority;
|
|
21
|
+
info: BotInfo;
|
|
22
|
+
contact: Vnd.Iris.Contact;
|
|
23
|
+
context: Record<string, string>;
|
|
24
|
+
message: string;
|
|
25
|
+
data: T;
|
|
26
|
+
locale: LocaleInfo;
|
|
27
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogTypes = void 0;
|
|
4
|
+
exports.LogTypes = [
|
|
5
|
+
"ERROR",
|
|
6
|
+
"HTTP",
|
|
7
|
+
"COMMAND",
|
|
8
|
+
"MESSAGE",
|
|
9
|
+
"JOURNEY",
|
|
10
|
+
"EXCEPTION",
|
|
11
|
+
"TICKET",
|
|
12
|
+
];
|
|
13
|
+
//# sourceMappingURL=Log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Log.js","sourceRoot":"","sources":["../../../../../../libs/models/src/lib/monitoring/Log.ts"],"names":[],"mappings":";;;AAgBa,QAAA,QAAQ,GAAG;IACvB,OAAO;IACP,MAAM;IACN,SAAS;IACT,SAAS;IACT,SAAS;IACT,WAAW;IACX,QAAQ;CACR,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare type MetricType = "DAU" | "MAU" | "SENT_MESSAGES" | "TOTAL_MESSAGES" | "MESSAGE" | "CONTACT" | "ERROR" | "EXCEPTION" | "HTTP_ERROR";
|
|
2
|
+
export interface Metric {
|
|
3
|
+
timestamp: number;
|
|
4
|
+
interval: number;
|
|
5
|
+
type: MetricType;
|
|
6
|
+
contract_id: string;
|
|
7
|
+
value: number;
|
|
8
|
+
message: string;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Metric.js","sourceRoot":"","sources":["../../../../../../libs/models/src/lib/monitoring/Metric.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Db, WithId } from "mongodb";
|
|
2
|
+
import Joi from "joi";
|
|
3
|
+
import { LogType } from "./Log";
|
|
4
|
+
export interface Bot {
|
|
5
|
+
id: string;
|
|
6
|
+
key: string | null;
|
|
7
|
+
}
|
|
8
|
+
export interface Owner {
|
|
9
|
+
email: string;
|
|
10
|
+
snowflake: string;
|
|
11
|
+
}
|
|
12
|
+
export interface Monitor {
|
|
13
|
+
name: string;
|
|
14
|
+
secret: string;
|
|
15
|
+
bots: Array<string | Bot>;
|
|
16
|
+
contract_id: string;
|
|
17
|
+
router_key: string;
|
|
18
|
+
active: boolean;
|
|
19
|
+
types: Array<LogType>;
|
|
20
|
+
events: Array<string>;
|
|
21
|
+
owners: Array<Owner>;
|
|
22
|
+
}
|
|
23
|
+
export declare class MonitorRepository {
|
|
24
|
+
private database;
|
|
25
|
+
static schema: Joi.ObjectSchema<any>;
|
|
26
|
+
private collection;
|
|
27
|
+
constructor(database: Db);
|
|
28
|
+
static validate(monitor: Monitor): Promise<void>;
|
|
29
|
+
static toMonitor(monitor: WithId<Monitor> | Monitor): Monitor;
|
|
30
|
+
insert(monitor: Monitor): Promise<Monitor>;
|
|
31
|
+
update(name: string, monitor: Monitor): Promise<Monitor>;
|
|
32
|
+
delete(name: string): Promise<void>;
|
|
33
|
+
get(name: string): Promise<Monitor>;
|
|
34
|
+
getAll(options?: {
|
|
35
|
+
events?: boolean;
|
|
36
|
+
}): Promise<Monitor[]>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.MonitorRepository = void 0;
|
|
16
|
+
const joi_1 = __importDefault(require("joi"));
|
|
17
|
+
const Log_1 = require("./Log");
|
|
18
|
+
const SECRET = "4f17dfab-7b3c-407c-9e73-112a0e956bd8";
|
|
19
|
+
class MonitorRepository {
|
|
20
|
+
constructor(database) {
|
|
21
|
+
this.database = database;
|
|
22
|
+
this.collection = database.collection("monitor");
|
|
23
|
+
this.collection.createIndex("name", { unique: true });
|
|
24
|
+
}
|
|
25
|
+
static validate(monitor) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
yield MonitorRepository.schema.validateAsync(monitor);
|
|
28
|
+
const URL = `https://${monitor.contract_id}.http.msging.net`;
|
|
29
|
+
try {
|
|
30
|
+
//await BlipService.withHttp(URL, monitor.router_key).ping();
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
throw new Error("Router key is wrong");
|
|
34
|
+
}
|
|
35
|
+
for (let bot of monitor.bots) {
|
|
36
|
+
if (typeof bot !== "string") {
|
|
37
|
+
try {
|
|
38
|
+
const key = bot.key;
|
|
39
|
+
//await BlipService.withHttp(URL, key).ping();
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
throw new Error(`Bot ${bot.id} key is wrong`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
static toMonitor(monitor) {
|
|
49
|
+
return Object.assign(Object.assign({}, monitor), { _id: undefined, active: monitor.active != undefined ? monitor.active : true });
|
|
50
|
+
}
|
|
51
|
+
insert(monitor) {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
monitor.secret = monitor.secret || SECRET;
|
|
54
|
+
yield MonitorRepository.validate(monitor);
|
|
55
|
+
const exists = yield this.collection.findOne({ name: monitor.name });
|
|
56
|
+
if (exists) {
|
|
57
|
+
throw new Error(`Monitor ${monitor.name} already exists`);
|
|
58
|
+
}
|
|
59
|
+
const result = yield this.collection.insertOne(monitor);
|
|
60
|
+
if (!result.acknowledged) {
|
|
61
|
+
throw new Error(`Monitor ${monitor.name} was not inserted`);
|
|
62
|
+
}
|
|
63
|
+
return MonitorRepository.toMonitor(monitor);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
update(name, monitor) {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
monitor.secret = monitor.secret || SECRET;
|
|
69
|
+
yield MonitorRepository.validate(monitor);
|
|
70
|
+
const result = yield this.collection.updateOne({ name }, { $set: monitor });
|
|
71
|
+
if (result.matchedCount !== 1) {
|
|
72
|
+
throw new Error(`Monitor ${name} not found`);
|
|
73
|
+
}
|
|
74
|
+
return MonitorRepository.toMonitor(monitor);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
delete(name) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
const result = yield this.collection.deleteOne({ name });
|
|
80
|
+
if (result.deletedCount !== 1) {
|
|
81
|
+
throw new Error(`Monitor ${name} not found`);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
get(name) {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
const monitor = yield this.collection.findOne({ name });
|
|
88
|
+
if (!monitor) {
|
|
89
|
+
throw new Error(`Monitor ${name} not found`);
|
|
90
|
+
}
|
|
91
|
+
return MonitorRepository.toMonitor(monitor);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
getAll(options = {}) {
|
|
95
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
96
|
+
let query = {};
|
|
97
|
+
if (options.events) {
|
|
98
|
+
query = { "events.0": { $exists: true } };
|
|
99
|
+
}
|
|
100
|
+
const monitors = yield this.collection.find(query).toArray();
|
|
101
|
+
return monitors.map(MonitorRepository.toMonitor);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.MonitorRepository = MonitorRepository;
|
|
106
|
+
MonitorRepository.schema = joi_1.default.object({
|
|
107
|
+
name: joi_1.default.string()
|
|
108
|
+
.pattern(/^[\w-]+$/)
|
|
109
|
+
.required(),
|
|
110
|
+
secret: joi_1.default.string().required(),
|
|
111
|
+
bots: joi_1.default.array()
|
|
112
|
+
.items(joi_1.default.alternatives(joi_1.default.string(), joi_1.default.object({
|
|
113
|
+
id: joi_1.default.string().required(),
|
|
114
|
+
key: joi_1.default.string().allow(null).required(),
|
|
115
|
+
})))
|
|
116
|
+
.required(),
|
|
117
|
+
contract_id: joi_1.default.string().required(),
|
|
118
|
+
router_key: joi_1.default.string().required(),
|
|
119
|
+
active: joi_1.default.boolean(),
|
|
120
|
+
types: joi_1.default.array()
|
|
121
|
+
.items(joi_1.default.string().valid(...Log_1.LogTypes))
|
|
122
|
+
.required(),
|
|
123
|
+
events: joi_1.default.array().items(joi_1.default.string()).required(),
|
|
124
|
+
owners: joi_1.default.array()
|
|
125
|
+
.items(joi_1.default.object({
|
|
126
|
+
email: joi_1.default.string().required(),
|
|
127
|
+
snowflake: joi_1.default.string().required(),
|
|
128
|
+
}))
|
|
129
|
+
.required(),
|
|
130
|
+
});
|
|
131
|
+
//# sourceMappingURL=Monitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Monitor.js","sourceRoot":"","sources":["../../../../../../libs/models/src/lib/monitoring/Monitor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,8CAAsB;AACtB,+BAA0C;AAE1C,MAAM,MAAM,GAAG,sCAAsC,CAAC;AAwBtD,MAAa,iBAAiB;IAmC7B,YAAoB,QAAY;QAAZ,aAAQ,GAAR,QAAQ,CAAI;QAC/B,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QACjD,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,CAAO,QAAQ,CAAC,OAAgB;;YACrC,MAAM,iBAAiB,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YACtD,MAAM,GAAG,GAAG,WAAW,OAAO,CAAC,WAAW,kBAAkB,CAAC;YAC7D,IAAI;gBACH,6DAA6D;aAC7D;YAAC,OAAO,GAAG,EAAE;gBACb,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;aACvC;YAED,KAAK,IAAI,GAAG,IAAI,OAAO,CAAC,IAAI,EAAE;gBAC7B,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;oBAC5B,IAAI;wBACH,MAAM,GAA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CACZ,CAAC,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Builder, Vnd } from "@dawntech/dwntbots-models";
|
|
2
|
+
export interface TraceOutput {
|
|
3
|
+
stateId: string;
|
|
4
|
+
conditionsCount: number;
|
|
5
|
+
timestamp: string;
|
|
6
|
+
elapsedMilliseconds: number;
|
|
7
|
+
warning: string | null;
|
|
8
|
+
error: string | null;
|
|
9
|
+
}
|
|
10
|
+
export interface TraceActionBuilder<T extends Builder.CustomActionType, S = {}> {
|
|
11
|
+
type: T;
|
|
12
|
+
parsedSettings: S;
|
|
13
|
+
order: number;
|
|
14
|
+
continueOrError: number;
|
|
15
|
+
timestamp: string;
|
|
16
|
+
elapsedMilliseconds: number;
|
|
17
|
+
warning: string | null;
|
|
18
|
+
error: string | null;
|
|
19
|
+
}
|
|
20
|
+
export declare type SendMessageAction = TraceActionBuilder<"SendMessage", {
|
|
21
|
+
id: string;
|
|
22
|
+
type: string;
|
|
23
|
+
content: string | Object;
|
|
24
|
+
metadata: Record<string, string>;
|
|
25
|
+
}>;
|
|
26
|
+
export declare type SendRawMessageAction = TraceActionBuilder<"SendRawMessage", {
|
|
27
|
+
type: string;
|
|
28
|
+
rawContent: string;
|
|
29
|
+
metadata: Record<string, string>;
|
|
30
|
+
}>;
|
|
31
|
+
export declare type TraceProcessHttpAction = TraceActionBuilder<"ProcessHttp", {
|
|
32
|
+
method: Builder.HttpMethod;
|
|
33
|
+
uri: string;
|
|
34
|
+
headers: Record<string, string>;
|
|
35
|
+
body?: string;
|
|
36
|
+
responseStatusVariable: string;
|
|
37
|
+
responseBodyVariable: string;
|
|
38
|
+
}>;
|
|
39
|
+
export declare type TraceTrackEventAction = TraceActionBuilder<"TrackEvent", {
|
|
40
|
+
category: string;
|
|
41
|
+
action: string;
|
|
42
|
+
extras: Record<string, string>;
|
|
43
|
+
}>;
|
|
44
|
+
export declare type TraceMergeContactAction = TraceActionBuilder<"MergeContact", Partial<Vnd.Iris.Contact>>;
|
|
45
|
+
export declare type TraceRedirectAction = TraceActionBuilder<"Redirect", {
|
|
46
|
+
context?: {
|
|
47
|
+
type: Builder.Type;
|
|
48
|
+
value: string;
|
|
49
|
+
};
|
|
50
|
+
address: string;
|
|
51
|
+
}>;
|
|
52
|
+
export declare type TraceManageListAction = TraceActionBuilder<"ManageList", {
|
|
53
|
+
listName: string;
|
|
54
|
+
action: Builder.ManageListAction;
|
|
55
|
+
}>;
|
|
56
|
+
export declare type TraceSetVariableAction = TraceActionBuilder<"SetVariable", {
|
|
57
|
+
variable: string;
|
|
58
|
+
value: string;
|
|
59
|
+
}>;
|
|
60
|
+
export declare type TraceExecuteScriptAction = TraceActionBuilder<"ExecuteScript", {
|
|
61
|
+
function: string;
|
|
62
|
+
source: string;
|
|
63
|
+
inputVariables: Array<string>;
|
|
64
|
+
outputVariable: string;
|
|
65
|
+
LocalTimeZoneEnabled: boolean;
|
|
66
|
+
}>;
|
|
67
|
+
export declare type TraceProcessCommandAction = TraceActionBuilder<"ProcessCommand", {
|
|
68
|
+
from?: Builder.CommandFrom;
|
|
69
|
+
type?: Builder.CommandType;
|
|
70
|
+
to: Builder.CommandTo;
|
|
71
|
+
resource?: Object;
|
|
72
|
+
method: Builder.CommandMethod;
|
|
73
|
+
uri: string;
|
|
74
|
+
metadata: Record<string, any>;
|
|
75
|
+
variable?: string;
|
|
76
|
+
}>;
|
|
77
|
+
export declare type TraceForwardToDeskAction = TraceActionBuilder<"ForwardToDesk", {}>;
|
|
78
|
+
export declare type TraceLeavingFromDeskAction = TraceActionBuilder<"LeavingFromDesk", {}>;
|
|
79
|
+
export declare type TraceForwardMessageToDeskkAction = TraceActionBuilder<"ForwardMessageToDesk", {}>;
|
|
80
|
+
export declare type TraceAction = SendMessageAction | SendRawMessageAction | TraceProcessHttpAction | TraceTrackEventAction | TraceMergeContactAction | TraceRedirectAction | TraceManageListAction | TraceExecuteScriptAction | TraceProcessCommandAction | TraceSetVariableAction | TraceForwardToDeskAction | TraceLeavingFromDeskAction | TraceForwardMessageToDeskkAction;
|
|
81
|
+
export interface TraceState {
|
|
82
|
+
id: string;
|
|
83
|
+
inputActions: Array<TraceAction>;
|
|
84
|
+
outputActions: Array<TraceAction>;
|
|
85
|
+
outputs: Array<TraceOutput>;
|
|
86
|
+
extensionData: {
|
|
87
|
+
name: string;
|
|
88
|
+
};
|
|
89
|
+
timestamp: string;
|
|
90
|
+
elapsedMilliseconds: number;
|
|
91
|
+
warning: string | null;
|
|
92
|
+
error: string | null;
|
|
93
|
+
}
|
|
94
|
+
export interface Trace {
|
|
95
|
+
id: string;
|
|
96
|
+
owner: {
|
|
97
|
+
name: string;
|
|
98
|
+
domain: string;
|
|
99
|
+
};
|
|
100
|
+
states: Array<TraceState>;
|
|
101
|
+
timestamp: string;
|
|
102
|
+
user: string;
|
|
103
|
+
input: string;
|
|
104
|
+
warning: string | null;
|
|
105
|
+
error: string | null;
|
|
106
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Trace.js","sourceRoot":"","sources":["../../../../../../libs/models/src/lib/monitoring/Trace.ts"],"names":[],"mappings":""}
|
package/src/lib/vnd.d.ts
CHANGED
|
@@ -8,7 +8,8 @@ export declare namespace Vnd {
|
|
|
8
8
|
WHATSAPP_ORDER = "application/x-whatsapp-order+json",
|
|
9
9
|
VND_LIME_CONTACT = "application/vnd.lime.contact+json",
|
|
10
10
|
VND_LIME_CHATSATE = "application/vnd.lime.chatstate+json",
|
|
11
|
-
VND_LIME_REDIRECT = "application/vnd.lime.redirect+json"
|
|
11
|
+
VND_LIME_REDIRECT = "application/vnd.lime.redirect+json",
|
|
12
|
+
VND_LIME_MEDIA_LINK = "application/vnd.lime.media-link+json"
|
|
12
13
|
}
|
|
13
14
|
namespace Common {
|
|
14
15
|
type Identity = string;
|
|
@@ -42,6 +43,10 @@ export declare namespace Vnd {
|
|
|
42
43
|
code: number;
|
|
43
44
|
description: string;
|
|
44
45
|
}
|
|
46
|
+
interface MideaLink {
|
|
47
|
+
type: string;
|
|
48
|
+
uri: string;
|
|
49
|
+
}
|
|
45
50
|
interface Base {
|
|
46
51
|
id: GUID;
|
|
47
52
|
to: Vnd.Common.Identity;
|
|
@@ -157,8 +162,9 @@ export declare namespace Vnd {
|
|
|
157
162
|
isPending: boolean;
|
|
158
163
|
sharePresence: boolean;
|
|
159
164
|
shareAccountInfo: boolean;
|
|
160
|
-
group:
|
|
165
|
+
group: string;
|
|
161
166
|
lastMessageDate: Vnd.Common.DateTimeOffset;
|
|
167
|
+
lastUpdateDate: Vnd.Common.DateTimeOffset;
|
|
162
168
|
taxDocument: string;
|
|
163
169
|
source: string;
|
|
164
170
|
}
|
package/src/lib/vnd.js
CHANGED
|
@@ -14,6 +14,7 @@ var Vnd;
|
|
|
14
14
|
ContenType["VND_LIME_CONTACT"] = "application/vnd.lime.contact+json";
|
|
15
15
|
ContenType["VND_LIME_CHATSATE"] = "application/vnd.lime.chatstate+json";
|
|
16
16
|
ContenType["VND_LIME_REDIRECT"] = "application/vnd.lime.redirect+json";
|
|
17
|
+
ContenType["VND_LIME_MEDIA_LINK"] = "application/vnd.lime.media-link+json";
|
|
17
18
|
})(ContenType = Vnd.ContenType || (Vnd.ContenType = {}));
|
|
18
19
|
let Lime;
|
|
19
20
|
(function (Lime) {
|
package/src/lib/vnd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vnd.js","sourceRoot":"","sources":["../../../../../libs/models/src/lib/vnd.ts"],"names":[],"mappings":";;;AAAA,mCAA6B;AAO7B,IAAiB,GAAG,
|
|
1
|
+
{"version":3,"file":"vnd.js","sourceRoot":"","sources":["../../../../../libs/models/src/lib/vnd.ts"],"names":[],"mappings":";;;AAAA,mCAA6B;AAO7B,IAAiB,GAAG,CAqiBnB;AAriBD,WAAiB,GAAG;IACnB,IAAY,UAUX;IAVD,WAAY,UAAU;QACrB,0BAAY,CAAA;QACZ,uCAAyB,CAAA;QACzB,uCAAyB,CAAA;QACzB,kEA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