@zohoim/client-sdk 1.0.0-poc2 → 1.0.0-poc21
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/config/urls/bots/bots-api-url.js +11 -0
- package/es/config/urls/bots/index.js +2 -0
- package/es/config/urls/channels/channel-agents-api-url.js +11 -0
- package/es/config/urls/channels/index.js +2 -0
- package/es/config/urls/sessions/index.js +2 -0
- package/es/config/urls/sessions/sessions-api-url.js +12 -0
- package/es/core/constants/HttpMethods.js +8 -0
- package/es/core/constants/ModuleNames.js +6 -0
- package/es/core/constants/index.js +4 -0
- package/es/core/errors/AdapterError.js +7 -0
- package/es/core/errors/index.js +3 -0
- package/es/core/utils/index.js +2 -0
- package/es/core/utils/validateSchema.js +68 -0
- package/es/domain/entities/Actor/Actor.js +23 -0
- package/es/domain/entities/Actor/index.js +2 -2
- package/es/domain/entities/Agent/Agent.js +13 -102
- package/es/domain/entities/Agent/index.js +1 -1
- package/es/domain/entities/Bot/Bot.js +23 -0
- package/es/domain/entities/Bot/index.js +2 -0
- package/es/domain/entities/Session/Session.js +36 -0
- package/es/domain/entities/Session/index.js +2 -0
- package/es/domain/entities/index.js +3 -1
- package/es/domain/enum/actor/index.js +2 -0
- package/es/domain/enum/bot/BotServiceType.js +5 -0
- package/es/domain/enum/bot/index.js +2 -0
- package/es/domain/enum/index.js +4 -0
- package/es/domain/enum/integrationServices/IntegrationServices.js +11 -0
- package/es/domain/enum/integrationServices/index.js +2 -0
- package/es/domain/enum/session/SessionReplyStatus.js +20 -0
- package/es/domain/enum/session/SessionStatus.js +9 -0
- package/es/domain/enum/session/index.js +3 -0
- package/es/domain/interfaces/BaseAPI.js +63 -0
- package/es/domain/interfaces/bots/IBot.js +10 -0
- package/es/domain/interfaces/bots/index.js +2 -0
- package/es/domain/interfaces/channels/IChannelAgent.js +6 -2
- package/es/domain/interfaces/index.js +3 -1
- package/es/domain/interfaces/sessions/ISession.js +10 -0
- package/es/domain/interfaces/sessions/index.js +2 -0
- package/es/domain/schema/actor/ActorSchema.js +33 -0
- package/es/domain/schema/actor/AgentSchema.js +29 -0
- package/es/domain/schema/actor/index.js +3 -0
- package/es/domain/schema/bot/BotSchema.js +33 -0
- package/es/domain/schema/bot/index.js +2 -0
- package/es/domain/schema/index.js +3 -0
- package/es/domain/schema/session/SessionSchema.js +86 -0
- package/es/domain/schema/session/index.js +2 -0
- package/es/domain/services/bots/BotService.js +31 -0
- package/es/domain/services/bots/index.js +2 -0
- package/es/domain/services/channels/ChannelAgentService.js +23 -6
- package/es/domain/services/index.js +3 -1
- package/es/domain/services/sessions/SessionService.js +31 -0
- package/es/domain/services/sessions/index.js +2 -0
- package/es/index.js +8 -1
- package/es/infrastructure/adapters/BaseAdapter.js +23 -0
- package/es/infrastructure/adapters/bots/BotAdapter.js +25 -0
- package/es/infrastructure/adapters/bots/index.js +2 -0
- package/es/infrastructure/adapters/channels/ChannelAgentAdapter.js +35 -0
- package/es/infrastructure/adapters/channels/index.js +2 -0
- package/es/infrastructure/adapters/index.js +3 -0
- package/es/infrastructure/adapters/sessions/SessionAdapter.js +37 -0
- package/es/infrastructure/adapters/sessions/index.js +2 -0
- package/es/infrastructure/api/bots/BotAPI.js +22 -0
- package/es/infrastructure/api/bots/index.js +2 -0
- package/es/infrastructure/api/channels/ChannelAgentAPI.js +22 -0
- package/es/infrastructure/api/channels/index.js +2 -0
- package/es/infrastructure/api/index.js +3 -0
- package/es/infrastructure/api/sessions/SessionAPI.js +22 -0
- package/es/infrastructure/api/sessions/index.js +2 -0
- package/es/infrastructure/interfaces/api/bots/GetBotsRequest.js +14 -0
- package/es/infrastructure/interfaces/api/bots/index.js +2 -0
- package/es/infrastructure/interfaces/api/channels/agents/GetChannelAgentsRequest.js +13 -0
- package/es/infrastructure/interfaces/api/channels/agents/index.js +2 -0
- package/es/infrastructure/interfaces/api/channels/index.js +1 -0
- package/es/infrastructure/interfaces/api/index.js +3 -0
- package/es/infrastructure/interfaces/api/sessions/UpdateSessionAssigneeRequest.js +12 -0
- package/es/infrastructure/interfaces/api/sessions/index.js +2 -0
- package/es/infrastructure/interfaces/index.js +1 -0
- package/es/infrastructure/managers/ModuleFactory.js +31 -0
- package/es/infrastructure/managers/ModuleManager.js +44 -0
- package/es/infrastructure/managers/index.js +2 -0
- package/es/infrastructure/sdk/IMSDK.js +47 -0
- package/es/infrastructure/sdk/bots/BotSDK.js +20 -0
- package/es/infrastructure/sdk/bots/index.js +2 -0
- package/es/infrastructure/sdk/channels/ChannelSDK.js +23 -0
- package/es/infrastructure/sdk/channels/index.js +2 -0
- package/es/infrastructure/sdk/config/configRegistry.js +27 -0
- package/es/infrastructure/sdk/config/index.js +2 -0
- package/es/infrastructure/sdk/index.js +2 -0
- package/es/infrastructure/sdk/sessions/SessionSDK.js +20 -0
- package/es/infrastructure/sdk/sessions/index.js +2 -0
- package/package.json +1 -7
- package/es/domain/index.js +0 -3
- /package/es/{domain → core}/errors/ValidationError.js +0 -0
- /package/es/domain/{entities/Actor → enum/actor}/ActorType.js +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ModuleNames } from '../../core/constants';
|
|
2
|
+
import { ModuleManager } from '../managers';
|
|
3
|
+
import { configRegistry } from './config';
|
|
4
|
+
export default class IMSDK {
|
|
5
|
+
constructor(_ref) {
|
|
6
|
+
let {
|
|
7
|
+
baseURL,
|
|
8
|
+
apiConfig = {},
|
|
9
|
+
httpClient
|
|
10
|
+
} = _ref;
|
|
11
|
+
configRegistry.setConfig({
|
|
12
|
+
baseURL,
|
|
13
|
+
httpClient
|
|
14
|
+
});
|
|
15
|
+
this._moduleManager = new ModuleManager();
|
|
16
|
+
|
|
17
|
+
this._moduleManager.initialize({
|
|
18
|
+
apiConfig
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
get channels() {
|
|
23
|
+
return this._moduleManager.getModule(ModuleNames.CHANNELS);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
get sessions() {
|
|
27
|
+
return this._moduleManager.getModule(ModuleNames.SESSIONS);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
get bots() {
|
|
31
|
+
return this._moduleManager.getModule(ModuleNames.BOTS);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
hasModule(moduleName) {
|
|
35
|
+
return this._modules.has(moduleName);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
toJSON() {
|
|
39
|
+
return {
|
|
40
|
+
channels: this.channels,
|
|
41
|
+
sessions: this.sessions,
|
|
42
|
+
bots: this.bots,
|
|
43
|
+
hasModule: this.hasModule.bind(this)
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BotService } from '../../../domain/services';
|
|
2
|
+
|
|
3
|
+
class BotSDK extends BotService {
|
|
4
|
+
constructor(_ref) {
|
|
5
|
+
let {
|
|
6
|
+
config
|
|
7
|
+
} = _ref;
|
|
8
|
+
const {
|
|
9
|
+
botAPI,
|
|
10
|
+
botAdapter
|
|
11
|
+
} = config;
|
|
12
|
+
super({
|
|
13
|
+
botAPI,
|
|
14
|
+
botAdapter
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default BotSDK;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ChannelAgentService } from '../../../domain/services';
|
|
2
|
+
export default class ChannelSDK {
|
|
3
|
+
constructor(_ref) {
|
|
4
|
+
let {
|
|
5
|
+
config
|
|
6
|
+
} = _ref;
|
|
7
|
+
const {
|
|
8
|
+
channelAgentAPI,
|
|
9
|
+
channelAgentAdapter
|
|
10
|
+
} = config;
|
|
11
|
+
this.agents = new ChannelAgentService({
|
|
12
|
+
channelAgentAPI,
|
|
13
|
+
channelAgentAdapter
|
|
14
|
+
}).toJSON();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
toJSON() {
|
|
18
|
+
return {
|
|
19
|
+
agents: this.agents
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
class ConfigRegistry {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.baseURL = null;
|
|
4
|
+
this.httpClient = null;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
setConfig(_ref) {
|
|
8
|
+
let {
|
|
9
|
+
baseURL,
|
|
10
|
+
httpClient
|
|
11
|
+
} = _ref;
|
|
12
|
+
this.baseURL = baseURL;
|
|
13
|
+
this.httpClient = httpClient;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
getBaseURL() {
|
|
17
|
+
return this.baseURL;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getHttpClient() {
|
|
21
|
+
return this.httpClient;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const configRegistry = new ConfigRegistry();
|
|
27
|
+
export default configRegistry;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SessionService } from '../../../domain/services';
|
|
2
|
+
|
|
3
|
+
class SessionSDK extends SessionService {
|
|
4
|
+
constructor(_ref) {
|
|
5
|
+
let {
|
|
6
|
+
config
|
|
7
|
+
} = _ref;
|
|
8
|
+
const {
|
|
9
|
+
sessionAPI,
|
|
10
|
+
sessionAdapter
|
|
11
|
+
} = config;
|
|
12
|
+
super({
|
|
13
|
+
sessionAPI,
|
|
14
|
+
sessionAdapter
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default SessionSDK;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohoim/client-sdk",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-poc21",
|
|
4
4
|
"description": "To have the client sdk for the IM",
|
|
5
5
|
"main": "es/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -10,12 +10,6 @@
|
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
13
|
-
"exports": {
|
|
14
|
-
".": "./es/index.js",
|
|
15
|
-
"./interfaces": "./es/domain/interfaces/index.js",
|
|
16
|
-
"./entities": "./es/domain/entities/index.js",
|
|
17
|
-
"./services": "./es/domain/services/index.js"
|
|
18
|
-
},
|
|
19
13
|
"files": [
|
|
20
14
|
"es",
|
|
21
15
|
"!**/__tests__"
|
package/es/domain/index.js
DELETED
|
File without changes
|
|
File without changes
|