@zohoim/client-sdk 1.0.0-poc29 → 1.0.0-poc30
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/es/domain/interfaces/IAdapter.js +6 -0
- package/es/infrastructure/adapters/bots/BotAdapter.js +2 -2
- package/es/infrastructure/adapters/channels/ChannelAgentAdapter.js +2 -7
- package/es/infrastructure/adapters/sessions/SessionAdapter.js +2 -2
- package/package.json +1 -1
- package/es/infrastructure/adapters/BaseAdapter.js +0 -23
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AdapterError } from "../../../core/errors";
|
|
2
2
|
import { Bot } from "../../../domain/entities";
|
|
3
|
-
import
|
|
4
|
-
export default class BotAdapter extends
|
|
3
|
+
import IAdapter from "../../../domain/interfaces/IAdapter";
|
|
4
|
+
export default class BotAdapter extends IAdapter {
|
|
5
5
|
static adapt(botData) {
|
|
6
6
|
if (!botData) {
|
|
7
7
|
throw new AdapterError('Bot data is required');
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import BaseAdapter from "../BaseAdapter";
|
|
2
1
|
import { AdapterError } from "../../../core/errors";
|
|
3
2
|
import { Agent } from "../../../domain/entities";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* @extends BaseAdapter
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export default class ChannelAgentAdapter extends BaseAdapter {
|
|
3
|
+
import IAdapter from "../../../domain/interfaces/IAdapter";
|
|
4
|
+
export default class ChannelAgentAdapter extends IAdapter {
|
|
10
5
|
/**
|
|
11
6
|
* Adapts channel agent data to Agent entity
|
|
12
7
|
* @param {Object} channelAgent - Channel agent data to adapt
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import BaseAdapter from "../BaseAdapter";
|
|
2
1
|
import { AdapterError } from "../../../core/errors";
|
|
3
2
|
import { Session } from "../../../domain/entities";
|
|
4
|
-
|
|
3
|
+
import IAdapter from "../../../domain/interfaces/IAdapter";
|
|
4
|
+
export default class SessionAdapter extends IAdapter {
|
|
5
5
|
static adapt(sessionData) {
|
|
6
6
|
if (!sessionData) {
|
|
7
7
|
throw new AdapterError('Session data is required');
|
package/package.json
CHANGED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { AdapterError } from "../../core/errors";
|
|
2
|
-
/**
|
|
3
|
-
* Base adapter class that defines the contract for all adapters
|
|
4
|
-
* @abstract
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export default class BaseAdapter {
|
|
8
|
-
/**
|
|
9
|
-
* Adapts the input data to required format
|
|
10
|
-
* @param {*} data - Data to adapt
|
|
11
|
-
* @throws {AdapterError} When method is not implemented
|
|
12
|
-
*/
|
|
13
|
-
adapt(data) {
|
|
14
|
-
if (this.constructor === BaseAdapter) {
|
|
15
|
-
throw new AdapterError(`${this.constructor.name}: adapt() must be implemented by subclass`);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (!data) {
|
|
19
|
-
throw new AdapterError(`${this.constructor.name}: data parameter is required`);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
}
|