bkper-js 2.9.2 → 2.10.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 +314 -330
- package/lib/index.d.ts +0 -192
- package/lib/index.js +23 -25
- package/lib/model/App.js +0 -19
- package/lib/model/Bkper.js +0 -20
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +2 -2
- package/lib/model/Conversation.js +0 -134
- package/lib/model/Message.js +0 -200
- package/lib/service/conversation-service.js +0 -42
package/lib/index.d.ts
CHANGED
|
@@ -454,14 +454,6 @@ export declare class App extends Resource<bkper.App> {
|
|
|
454
454
|
* @returns This App, for chaining
|
|
455
455
|
*/
|
|
456
456
|
setWebhookUrlDev(webhookUrlDev: string): App;
|
|
457
|
-
/**
|
|
458
|
-
* Sets the conversation url for development.
|
|
459
|
-
*
|
|
460
|
-
* @param conversationUrlDev - The conversation URL for development
|
|
461
|
-
*
|
|
462
|
-
* @returns This App, for chaining
|
|
463
|
-
*/
|
|
464
|
-
setConversationUrlDev(conversationUrlDev: string): App;
|
|
465
457
|
/**
|
|
466
458
|
* Gets the App universal identifier.
|
|
467
459
|
*
|
|
@@ -498,12 +490,6 @@ export declare class App extends Resource<bkper.App> {
|
|
|
498
490
|
* @returns True if this App is installable
|
|
499
491
|
*/
|
|
500
492
|
isInstallable(): boolean;
|
|
501
|
-
/**
|
|
502
|
-
* Checks if this App is conversational.
|
|
503
|
-
*
|
|
504
|
-
* @returns True if this App is conversational
|
|
505
|
-
*/
|
|
506
|
-
isConversational(): boolean;
|
|
507
493
|
/**
|
|
508
494
|
* Gets the logo url of this App.
|
|
509
495
|
*
|
|
@@ -1271,12 +1257,6 @@ export declare class Bkper {
|
|
|
1271
1257
|
* @returns The retrieved list of Apps
|
|
1272
1258
|
*/
|
|
1273
1259
|
getApps(): Promise<App[]>;
|
|
1274
|
-
/**
|
|
1275
|
-
* Gets all [[Conversations]] available for the user.
|
|
1276
|
-
*
|
|
1277
|
-
* @returns The retrieved list of Conversations
|
|
1278
|
-
*/
|
|
1279
|
-
getConversations(): Promise<Conversation[]>;
|
|
1280
1260
|
/**
|
|
1281
1261
|
* Gets all [[Templates]] available for the user.
|
|
1282
1262
|
*
|
|
@@ -2304,65 +2284,6 @@ export declare class Connection extends Resource<bkper.Connection> {
|
|
|
2304
2284
|
remove(): Promise<Connection>;
|
|
2305
2285
|
}
|
|
2306
2286
|
|
|
2307
|
-
/**
|
|
2308
|
-
* Defines a Conversation on Bkper.
|
|
2309
|
-
*
|
|
2310
|
-
* A Conversation represents an interaction between [[Users]] and [[Apps]].
|
|
2311
|
-
*
|
|
2312
|
-
* @public
|
|
2313
|
-
*/
|
|
2314
|
-
export declare class Conversation extends Resource<bkper.Conversation> {
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
private config?;
|
|
2318
|
-
constructor(agent: Agent, payload?: bkper.Conversation, config?: Config);
|
|
2319
|
-
|
|
2320
|
-
/**
|
|
2321
|
-
* Gets the Agent associated to this Conversation.
|
|
2322
|
-
*
|
|
2323
|
-
* @returns The Agent associated to this Conversation
|
|
2324
|
-
*/
|
|
2325
|
-
getAgent(): Agent;
|
|
2326
|
-
/**
|
|
2327
|
-
* Gets the Conversation universal identifier.
|
|
2328
|
-
*
|
|
2329
|
-
* @returns The Conversation universal identifier
|
|
2330
|
-
*/
|
|
2331
|
-
getId(): string | undefined;
|
|
2332
|
-
/**
|
|
2333
|
-
* Gets the title of the Conversation.
|
|
2334
|
-
*
|
|
2335
|
-
* @returns The title of the Conversation
|
|
2336
|
-
*/
|
|
2337
|
-
getTitle(): string | undefined;
|
|
2338
|
-
/**
|
|
2339
|
-
* Gets the Date the Conversation was created.
|
|
2340
|
-
*
|
|
2341
|
-
* @returns The Date the Conversation was created
|
|
2342
|
-
*/
|
|
2343
|
-
getCreatedAt(): Date | undefined;
|
|
2344
|
-
/**
|
|
2345
|
-
* Gets the Date the Conversation was last updated.
|
|
2346
|
-
*
|
|
2347
|
-
* @returns The Date the Conversation was last updated
|
|
2348
|
-
*/
|
|
2349
|
-
getUpdatedAt(): Date | undefined;
|
|
2350
|
-
/**
|
|
2351
|
-
* Gets the Messages that compose this Conversation.
|
|
2352
|
-
*
|
|
2353
|
-
* @returns The Messages in this Conversation
|
|
2354
|
-
*/
|
|
2355
|
-
getMessages(): Promise<Message[]>;
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
/**
|
|
2359
|
-
* Performs create Conversation.
|
|
2360
|
-
*
|
|
2361
|
-
* @returns The created Conversation object
|
|
2362
|
-
*/
|
|
2363
|
-
create(): Promise<Conversation>;
|
|
2364
|
-
}
|
|
2365
|
-
|
|
2366
2287
|
/**
|
|
2367
2288
|
* Decimal separator of numbers on book
|
|
2368
2289
|
*
|
|
@@ -3006,119 +2927,6 @@ export declare class Integration extends Resource<bkper.Integration> {
|
|
|
3006
2927
|
remove(): Promise<Integration>;
|
|
3007
2928
|
}
|
|
3008
2929
|
|
|
3009
|
-
/**
|
|
3010
|
-
* Defines a Message on Bkper.
|
|
3011
|
-
*
|
|
3012
|
-
* A Message is a building block of a [[Conversation]].
|
|
3013
|
-
*
|
|
3014
|
-
* @public
|
|
3015
|
-
*/
|
|
3016
|
-
export declare class Message extends Resource<bkper.Message> {
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
constructor(conversation: Conversation, payload?: bkper.Message, config?: Config);
|
|
3020
|
-
|
|
3021
|
-
/**
|
|
3022
|
-
* Gets the Message universal identifier.
|
|
3023
|
-
*
|
|
3024
|
-
* @returns The Message universal identifier
|
|
3025
|
-
*/
|
|
3026
|
-
getId(): string | undefined;
|
|
3027
|
-
/**
|
|
3028
|
-
* Gets the Agent associated with the Message.
|
|
3029
|
-
*
|
|
3030
|
-
* @returns The Agent associated with the Message, if any
|
|
3031
|
-
*/
|
|
3032
|
-
getAgent(): Agent | undefined;
|
|
3033
|
-
/**
|
|
3034
|
-
* Gets the Conversation of the Message.
|
|
3035
|
-
*
|
|
3036
|
-
* @returns The Conversation of the Message
|
|
3037
|
-
*/
|
|
3038
|
-
getConversation(): Conversation;
|
|
3039
|
-
/**
|
|
3040
|
-
* Gets the User associated with the Message.
|
|
3041
|
-
*
|
|
3042
|
-
* @returns The User associated with the Message
|
|
3043
|
-
*/
|
|
3044
|
-
getUser(): User | undefined;
|
|
3045
|
-
/**
|
|
3046
|
-
* Gets the Date the Message was created.
|
|
3047
|
-
*
|
|
3048
|
-
* @returns The Date the Message was created
|
|
3049
|
-
*/
|
|
3050
|
-
getCreatedAt(): Date | undefined;
|
|
3051
|
-
/**
|
|
3052
|
-
* Gets the text content of the Message.
|
|
3053
|
-
*
|
|
3054
|
-
* @returns The text content of the Message
|
|
3055
|
-
*/
|
|
3056
|
-
getContent(): string | undefined;
|
|
3057
|
-
/**
|
|
3058
|
-
* Sets the text content of the Message.
|
|
3059
|
-
*
|
|
3060
|
-
* @param content - The text content of the Message
|
|
3061
|
-
*
|
|
3062
|
-
* @returns This Message, for chaining
|
|
3063
|
-
*/
|
|
3064
|
-
setContent(content: string): Message;
|
|
3065
|
-
/**
|
|
3066
|
-
* Gets the custom properties stored in this Message.
|
|
3067
|
-
*
|
|
3068
|
-
* @returns The custom properties stored in this Message
|
|
3069
|
-
*/
|
|
3070
|
-
getProperties(): {
|
|
3071
|
-
[key: string]: string;
|
|
3072
|
-
};
|
|
3073
|
-
/**
|
|
3074
|
-
* Sets the custom properties of the Message
|
|
3075
|
-
*
|
|
3076
|
-
* @param properties - Object with key/value pair properties
|
|
3077
|
-
*
|
|
3078
|
-
* @returns This Message, for chaining
|
|
3079
|
-
*/
|
|
3080
|
-
setProperties(properties: {
|
|
3081
|
-
[key: string]: string;
|
|
3082
|
-
}): Message;
|
|
3083
|
-
/**
|
|
3084
|
-
* Gets the property value for given keys. First property found will be retrieved.
|
|
3085
|
-
*
|
|
3086
|
-
* @param keys - The property key
|
|
3087
|
-
*
|
|
3088
|
-
* @returns The retrieved property value
|
|
3089
|
-
*/
|
|
3090
|
-
getProperty(...keys: string[]): string | undefined;
|
|
3091
|
-
/**
|
|
3092
|
-
* Sets a custom property in the Message.
|
|
3093
|
-
*
|
|
3094
|
-
* @param key - The property key
|
|
3095
|
-
* @param value - The property value
|
|
3096
|
-
*
|
|
3097
|
-
* @returns This Message, for chaining
|
|
3098
|
-
*/
|
|
3099
|
-
setProperty(key: string, value: string | null): Message;
|
|
3100
|
-
/**
|
|
3101
|
-
* Deletes a custom property from the Message.
|
|
3102
|
-
*
|
|
3103
|
-
* @param key - The property key
|
|
3104
|
-
*
|
|
3105
|
-
* @returns This Message, for chaining
|
|
3106
|
-
*/
|
|
3107
|
-
deleteProperty(key: string): Message;
|
|
3108
|
-
/**
|
|
3109
|
-
* Creates the Message and receives the synchronous Agent response.
|
|
3110
|
-
*
|
|
3111
|
-
* @returns The Agent response Message, with the created Message as its parent
|
|
3112
|
-
*/
|
|
3113
|
-
create(): Promise<Message>;
|
|
3114
|
-
/**
|
|
3115
|
-
* Streams the Message to the Bkper API.
|
|
3116
|
-
*
|
|
3117
|
-
* @returns A Promise that resolves when the streaming is complete
|
|
3118
|
-
*/
|
|
3119
|
-
stream(): Promise<void>;
|
|
3120
|
-
}
|
|
3121
|
-
|
|
3122
2930
|
/**
|
|
3123
2931
|
* Enum that represents a Month.
|
|
3124
2932
|
*
|
package/lib/index.js
CHANGED
|
@@ -5,30 +5,28 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @packageDocumentation
|
|
7
7
|
*/
|
|
8
|
-
export { Account } from
|
|
9
|
-
export { Agent } from
|
|
8
|
+
export { Account } from "./model/Account.js";
|
|
9
|
+
export { Agent } from "./model/Agent.js";
|
|
10
10
|
export { Amount } from "./model/Amount.js";
|
|
11
|
-
export { App } from
|
|
12
|
-
export { Balance } from
|
|
13
|
-
export { BalancesDataTableBuilder } from
|
|
14
|
-
export { BalancesReport } from
|
|
15
|
-
export { Bkper } from
|
|
16
|
-
export { Book } from
|
|
17
|
-
export { Collaborator } from
|
|
18
|
-
export { Collection } from
|
|
19
|
-
export { Connection } from
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
28
|
-
export {
|
|
29
|
-
export {
|
|
30
|
-
export {
|
|
31
|
-
export {
|
|
32
|
-
export { User } from './model/User.js';
|
|
33
|
-
export { Periodicity, DecimalSeparator, Permission, Visibility, AccountType, BalanceType, Period, Month, EventType, BotResponseType } from './model/Enums.js';
|
|
11
|
+
export { App } from "./model/App.js";
|
|
12
|
+
export { Balance } from "./model/Balance.js";
|
|
13
|
+
export { BalancesDataTableBuilder } from "./model/BalancesDataTableBuilder.js";
|
|
14
|
+
export { BalancesReport } from "./model/BalancesReport.js";
|
|
15
|
+
export { Bkper } from "./model/Bkper.js";
|
|
16
|
+
export { Book } from "./model/Book.js";
|
|
17
|
+
export { Collaborator } from "./model/Collaborator.js";
|
|
18
|
+
export { Collection } from "./model/Collection.js";
|
|
19
|
+
export { Connection } from "./model/Connection.js";
|
|
20
|
+
export { File } from "./model/File.js";
|
|
21
|
+
export { Group } from "./model/Group.js";
|
|
22
|
+
export { Integration } from "./model/Integration.js";
|
|
23
|
+
export { Query } from "./model/Query.js";
|
|
24
|
+
export { Template } from "./model/Template.js";
|
|
25
|
+
export { Transaction } from "./model/Transaction.js";
|
|
26
|
+
export { TransactionList } from "./model/TransactionList.js";
|
|
27
|
+
export { Event } from "./model/Event.js";
|
|
28
|
+
export { BotResponse } from "./model/BotResponse.js";
|
|
29
|
+
export { EventList } from "./model/EventList.js";
|
|
30
|
+
export { User } from "./model/User.js";
|
|
31
|
+
export { Periodicity, DecimalSeparator, Permission, Visibility, AccountType, BalanceType, Period, Month, EventType, BotResponseType, } from "./model/Enums.js";
|
|
34
32
|
//# sourceMappingURL=index.js.map
|
package/lib/model/App.js
CHANGED
|
@@ -37,17 +37,6 @@ export class App extends Resource {
|
|
|
37
37
|
this.payload.webhookUrlDev = webhookUrlDev;
|
|
38
38
|
return this;
|
|
39
39
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Sets the conversation url for development.
|
|
42
|
-
*
|
|
43
|
-
* @param conversationUrlDev - The conversation URL for development
|
|
44
|
-
*
|
|
45
|
-
* @returns This App, for chaining
|
|
46
|
-
*/
|
|
47
|
-
setConversationUrlDev(conversationUrlDev) {
|
|
48
|
-
this.payload.conversationUrlDev = conversationUrlDev;
|
|
49
|
-
return this;
|
|
50
|
-
}
|
|
51
40
|
/**
|
|
52
41
|
* Gets the App universal identifier.
|
|
53
42
|
*
|
|
@@ -97,14 +86,6 @@ export class App extends Resource {
|
|
|
97
86
|
isInstallable() {
|
|
98
87
|
return this.payload.installable || false;
|
|
99
88
|
}
|
|
100
|
-
/**
|
|
101
|
-
* Checks if this App is conversational.
|
|
102
|
-
*
|
|
103
|
-
* @returns True if this App is conversational
|
|
104
|
-
*/
|
|
105
|
-
isConversational() {
|
|
106
|
-
return this.payload.conversational || false;
|
|
107
|
-
}
|
|
108
89
|
/**
|
|
109
90
|
* Gets the logo url of this App.
|
|
110
91
|
*
|
package/lib/model/Bkper.js
CHANGED
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { Book } from "./Book.js";
|
|
11
11
|
import { App } from "./App.js";
|
|
12
12
|
import * as AppService from "../service/app-service.js";
|
|
13
|
-
import * as ConversationService from "../service/conversation-service.js";
|
|
14
13
|
import * as BookService from "../service/book-service.js";
|
|
15
14
|
import * as CollectionService from "../service/collection-service.js";
|
|
16
15
|
import * as UserService from "../service/user-service.js";
|
|
@@ -18,8 +17,6 @@ import * as TemplateService from "../service/template-service.js";
|
|
|
18
17
|
import { User } from "./User.js";
|
|
19
18
|
import { Template } from "./Template.js";
|
|
20
19
|
import { Collection } from "./Collection.js";
|
|
21
|
-
import { Conversation } from "./Conversation.js";
|
|
22
|
-
import { Agent } from "./Agent.js";
|
|
23
20
|
/**
|
|
24
21
|
* This is the main entry point of the [bkper-js](https://www.npmjs.com/package/bkper-js) library.
|
|
25
22
|
*
|
|
@@ -123,23 +120,6 @@ export class Bkper {
|
|
|
123
120
|
return apps.map((app) => new App(app));
|
|
124
121
|
});
|
|
125
122
|
}
|
|
126
|
-
/**
|
|
127
|
-
* Gets all [[Conversations]] available for the user.
|
|
128
|
-
*
|
|
129
|
-
* @returns The retrieved list of Conversations
|
|
130
|
-
*/
|
|
131
|
-
getConversations() {
|
|
132
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
-
const conversationPayloads = yield ConversationService.getConversations(this.config);
|
|
134
|
-
let conversations = [];
|
|
135
|
-
for (const payload of conversationPayloads) {
|
|
136
|
-
const agent = new Agent(payload.agent);
|
|
137
|
-
const conversation = new Conversation(agent, payload);
|
|
138
|
-
conversations.push(conversation);
|
|
139
|
-
}
|
|
140
|
-
return conversations;
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
123
|
/**
|
|
144
124
|
* Gets all [[Templates]] available for the user.
|
|
145
125
|
*
|
package/lib/tsdoc-metadata.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bkper-js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"description": "Javascript client for Bkper REST API",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"postversion": "git push --tags && yarn publish --new-version $npm_package_version && git push && echo \"Successfully released version $npm_package_version!\""
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@bkper/bkper-api-types": "^5.
|
|
37
|
+
"@bkper/bkper-api-types": "^5.28.0"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"big.js": "^6.0.3",
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import * as ConversationService from "../service/conversation-service.js";
|
|
11
|
-
import { Agent } from "./Agent.js";
|
|
12
|
-
import { Message } from "./Message.js";
|
|
13
|
-
import { Resource } from "./Resource.js";
|
|
14
|
-
import { Bkper } from "./Bkper.js";
|
|
15
|
-
/**
|
|
16
|
-
* Defines a Conversation on Bkper.
|
|
17
|
-
*
|
|
18
|
-
* A Conversation represents an interaction between [[Users]] and [[Apps]].
|
|
19
|
-
*
|
|
20
|
-
* @public
|
|
21
|
-
*/
|
|
22
|
-
export class Conversation extends Resource {
|
|
23
|
-
constructor(agent, payload, config) {
|
|
24
|
-
super(payload || {});
|
|
25
|
-
this.agent = agent;
|
|
26
|
-
this.config = config;
|
|
27
|
-
}
|
|
28
|
-
/** @internal */
|
|
29
|
-
getConfig() {
|
|
30
|
-
return this.config || Bkper.globalConfig;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Gets the Agent associated to this Conversation.
|
|
34
|
-
*
|
|
35
|
-
* @returns The Agent associated to this Conversation
|
|
36
|
-
*/
|
|
37
|
-
getAgent() {
|
|
38
|
-
return this.agent;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Gets the Conversation universal identifier.
|
|
42
|
-
*
|
|
43
|
-
* @returns The Conversation universal identifier
|
|
44
|
-
*/
|
|
45
|
-
getId() {
|
|
46
|
-
return this.payload.id;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Gets the title of the Conversation.
|
|
50
|
-
*
|
|
51
|
-
* @returns The title of the Conversation
|
|
52
|
-
*/
|
|
53
|
-
getTitle() {
|
|
54
|
-
return this.payload.title;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Gets the Date the Conversation was created.
|
|
58
|
-
*
|
|
59
|
-
* @returns The Date the Conversation was created
|
|
60
|
-
*/
|
|
61
|
-
getCreatedAt() {
|
|
62
|
-
return this.payload.createdAt
|
|
63
|
-
? new Date(new Number(this.payload.createdAt).valueOf())
|
|
64
|
-
: undefined;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Gets the Date the Conversation was last updated.
|
|
68
|
-
*
|
|
69
|
-
* @returns The Date the Conversation was last updated
|
|
70
|
-
*/
|
|
71
|
-
getUpdatedAt() {
|
|
72
|
-
return this.payload.updatedAt
|
|
73
|
-
? new Date(new Number(this.payload.updatedAt).valueOf())
|
|
74
|
-
: undefined;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Gets the Messages that compose this Conversation.
|
|
78
|
-
*
|
|
79
|
-
* @returns The Messages in this Conversation
|
|
80
|
-
*/
|
|
81
|
-
getMessages() {
|
|
82
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
if (this.messagesMap != null) {
|
|
84
|
-
return Array.from(this.messagesMap.values());
|
|
85
|
-
}
|
|
86
|
-
const conversationId = this.getId();
|
|
87
|
-
if (!conversationId) {
|
|
88
|
-
throw new Error("Conversation id null!");
|
|
89
|
-
}
|
|
90
|
-
if (!this.messagesMap) {
|
|
91
|
-
this.messagesMap = new Map();
|
|
92
|
-
}
|
|
93
|
-
const messagePayloads = yield ConversationService.getMessages(conversationId, this.getConfig());
|
|
94
|
-
for (const payload of messagePayloads) {
|
|
95
|
-
this.updateMessagesCache(new Message(this, payload));
|
|
96
|
-
}
|
|
97
|
-
return Array.from(this.messagesMap.values());
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
/** @internal */
|
|
101
|
-
updateMessagesCache(message) {
|
|
102
|
-
const messageId = message.getId();
|
|
103
|
-
if (messageId) {
|
|
104
|
-
if (!this.messagesMap) {
|
|
105
|
-
this.messagesMap = new Map();
|
|
106
|
-
}
|
|
107
|
-
this.messagesMap.set(messageId, message);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
/** @internal */
|
|
111
|
-
setUpdatedAt(updatedAtMs) {
|
|
112
|
-
this.payload.updatedAt = updatedAtMs;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Performs create Conversation.
|
|
116
|
-
*
|
|
117
|
-
* @returns The created Conversation object
|
|
118
|
-
*/
|
|
119
|
-
create() {
|
|
120
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
-
const agentId = this.agent.getId();
|
|
122
|
-
if (!agentId) {
|
|
123
|
-
throw new Error("Agent id null!");
|
|
124
|
-
}
|
|
125
|
-
this.payload = yield ConversationService.createConversation(agentId, this.payload, this.getConfig());
|
|
126
|
-
// Update agent
|
|
127
|
-
if (this.payload.agent) {
|
|
128
|
-
this.agent = new Agent(this.payload.agent);
|
|
129
|
-
}
|
|
130
|
-
return this;
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
//# sourceMappingURL=Conversation.js.map
|