@zohoim/client-sdk 1.0.0-poc41 → 1.0.0-poc43

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.
Files changed (78) hide show
  1. package/es/application/services/bots/BotService.js +21 -0
  2. package/es/application/services/channels/ChannelAgentService.js +21 -0
  3. package/es/application/services/channels/ChannelService.js +21 -0
  4. package/es/{domain → application}/services/channels/index.js +1 -1
  5. package/es/application/services/sessions/SessionService.js +21 -0
  6. package/es/{infrastructure/interfaces/api → domain/dto}/bots/getBotsRequest.js +2 -6
  7. package/es/domain/dto/channels/agents/getChannelAgentsRequest.js +13 -0
  8. package/es/{infrastructure/interfaces/api → domain/dto}/channels/getChannelsRequest.js +2 -6
  9. package/es/domain/dto/sessions/updateSessionAssigneeRequest.js +12 -0
  10. package/es/domain/interfaces/index.js +1 -3
  11. package/es/domain/interfaces/{bots/IBot.js → repositories/bots/IBotRepository.js} +2 -3
  12. package/es/domain/interfaces/repositories/bots/index.js +2 -0
  13. package/es/domain/interfaces/{channels/IChannelAgent.js → repositories/channels/IChannelAgentRepository.js} +2 -3
  14. package/es/domain/interfaces/{channels/IChannel.js → repositories/channels/IChannelRepository.js} +2 -3
  15. package/es/domain/interfaces/repositories/channels/index.js +3 -0
  16. package/es/domain/interfaces/repositories/index.js +3 -0
  17. package/es/domain/interfaces/{sessions/ISession.js → repositories/sessions/ISessionRepository.js} +2 -3
  18. package/es/domain/interfaces/repositories/sessions/index.js +2 -0
  19. package/es/{infrastructure → frameworks}/sdk/IMSDK.js +1 -1
  20. package/es/frameworks/sdk/bots/BotSDK.js +30 -0
  21. package/es/{infrastructure → frameworks}/sdk/channels/ChannelSDK.js +10 -3
  22. package/es/frameworks/sdk/sessions/SessionSDK.js +30 -0
  23. package/es/index.js +6 -6
  24. package/es/{domain/interfaces → infrastructure/api}/BaseAPI.js +24 -18
  25. package/es/infrastructure/api/bots/BotAPI.js +3 -3
  26. package/es/infrastructure/api/channels/ChannelAPI.js +3 -3
  27. package/es/infrastructure/api/channels/ChannelAgentAPI.js +3 -3
  28. package/es/{config → infrastructure/api}/registry/bots/botAPIRegistry.js +2 -2
  29. package/es/{config → infrastructure/api}/registry/channels/channelAPIRegistry.js +2 -2
  30. package/es/{config → infrastructure/api}/registry/channels/channelAgentAPIRegistry.js +2 -2
  31. package/es/{config → infrastructure/api}/registry/getRegistryConfig.js +1 -1
  32. package/es/{config → infrastructure/api}/registry/sessions/sessionAPIRegistry.js +2 -2
  33. package/es/infrastructure/api/sessions/SessionAPI.js +3 -3
  34. package/es/{domain/services/bots/BotService.js → infrastructure/repositories/bots/BotRepository.js} +4 -4
  35. package/es/infrastructure/repositories/bots/index.js +2 -0
  36. package/es/{domain/services/channels/ChannelAgentService.js → infrastructure/repositories/channels/ChannelAgentRepository.js} +4 -4
  37. package/es/{domain/services/channels/ChannelService.js → infrastructure/repositories/channels/ChannelRepository.js} +4 -4
  38. package/es/infrastructure/repositories/channels/index.js +3 -0
  39. package/es/infrastructure/repositories/index.js +3 -0
  40. package/es/{domain/services/sessions/SessionService.js → infrastructure/repositories/sessions/SessionRepository.js} +4 -4
  41. package/es/infrastructure/repositories/sessions/index.js +2 -0
  42. package/package.json +1 -1
  43. package/es/domain/interfaces/bots/index.js +0 -2
  44. package/es/domain/interfaces/channels/index.js +0 -3
  45. package/es/domain/interfaces/sessions/index.js +0 -2
  46. package/es/infrastructure/interfaces/api/base/index.js +0 -2
  47. package/es/infrastructure/interfaces/api/channels/agents/getChannelAgentsRequest.js +0 -19
  48. package/es/infrastructure/interfaces/api/sessions/updateSessionAssigneeRequest.js +0 -18
  49. package/es/infrastructure/interfaces/index.js +0 -1
  50. package/es/infrastructure/sdk/bots/BotSDK.js +0 -20
  51. package/es/infrastructure/sdk/sessions/SessionSDK.js +0 -20
  52. /package/es/{domain → application}/services/bots/index.js +0 -0
  53. /package/es/{domain → application}/services/index.js +0 -0
  54. /package/es/{domain → application}/services/sessions/index.js +0 -0
  55. /package/es/{infrastructure/interfaces/api/base → domain/dto}/RequestBuilder.js +0 -0
  56. /package/es/{infrastructure/interfaces/api → domain/dto}/bots/index.js +0 -0
  57. /package/es/{infrastructure/interfaces/api → domain/dto}/channels/agents/index.js +0 -0
  58. /package/es/{infrastructure/interfaces/api → domain/dto}/channels/index.js +0 -0
  59. /package/es/{infrastructure/interfaces/api → domain/dto}/index.js +0 -0
  60. /package/es/{infrastructure/interfaces/api → domain/dto}/sessions/index.js +0 -0
  61. /package/es/{infrastructure → frameworks}/managers/ModuleFactory.js +0 -0
  62. /package/es/{infrastructure → frameworks}/managers/ModuleManager.js +0 -0
  63. /package/es/{infrastructure → frameworks}/managers/index.js +0 -0
  64. /package/es/{infrastructure → frameworks}/sdk/bots/index.js +0 -0
  65. /package/es/{infrastructure → frameworks}/sdk/channels/index.js +0 -0
  66. /package/es/{infrastructure → frameworks}/sdk/index.js +0 -0
  67. /package/es/{infrastructure → frameworks}/sdk/sessions/index.js +0 -0
  68. /package/es/{config → infrastructure/api}/registry/bots/constructBotEndPoint.js +0 -0
  69. /package/es/{config → infrastructure/api}/registry/bots/index.js +0 -0
  70. /package/es/{config → infrastructure/api}/registry/channels/constructChannelEndPoint.js +0 -0
  71. /package/es/{config → infrastructure/api}/registry/channels/index.js +0 -0
  72. /package/es/{config → infrastructure/api}/registry/createAPIRegistry.js +0 -0
  73. /package/es/{config → infrastructure/api}/registry/createBaseUrl.js +0 -0
  74. /package/es/{config → infrastructure/api}/registry/index.js +0 -0
  75. /package/es/{config → infrastructure/api}/registry/sessions/constructSessionEndPoint.js +0 -0
  76. /package/es/{config → infrastructure/api}/registry/sessions/index.js +0 -0
  77. /package/es/infrastructure/{sdk/config → config}/configRegistry.js +0 -0
  78. /package/es/infrastructure/{sdk/config → config}/index.js +0 -0
@@ -0,0 +1,21 @@
1
+ import { IBotRepository } from "../../../domain/interfaces/repositories";
2
+ export default class BotService extends IBotRepository {
3
+ constructor(_ref) {
4
+ let {
5
+ botRepository
6
+ } = _ref;
7
+ super();
8
+ this.botRepository = botRepository;
9
+ }
10
+
11
+ async getBots(request) {
12
+ return this.botRepository.getBots(request);
13
+ }
14
+
15
+ toJSON() {
16
+ return {
17
+ getBots: this.getBots.bind(this)
18
+ };
19
+ }
20
+
21
+ }
@@ -0,0 +1,21 @@
1
+ import { IChannelAgentRepository } from "../../../domain/interfaces/repositories";
2
+ export default class ChannelAgentService extends IChannelAgentRepository {
3
+ constructor(_ref) {
4
+ let {
5
+ channelAgentRepository
6
+ } = _ref;
7
+ super();
8
+ this.channelAgentRepository = channelAgentRepository;
9
+ }
10
+
11
+ async getAgents(request) {
12
+ return this.channelAgentRepository.getAgents(request);
13
+ }
14
+
15
+ toJSON() {
16
+ return {
17
+ getAgents: this.getAgents.bind(this)
18
+ };
19
+ }
20
+
21
+ }
@@ -0,0 +1,21 @@
1
+ import { IChannelRepository } from "../../../domain/interfaces/repositories";
2
+ export default class ChannelService extends IChannelRepository {
3
+ constructor(_ref) {
4
+ let {
5
+ channelRepository
6
+ } = _ref;
7
+ super();
8
+ this.channelRepository = channelRepository;
9
+ }
10
+
11
+ async getChannels(request) {
12
+ return this.channelRepository.getChannels(request);
13
+ }
14
+
15
+ toJSON() {
16
+ return {
17
+ getChannels: this.getChannels.bind(this)
18
+ };
19
+ }
20
+
21
+ }
@@ -1,3 +1,3 @@
1
1
  import ChannelAgentService from "./ChannelAgentService";
2
2
  import ChannelService from "./ChannelService";
3
- export { ChannelAgentService, ChannelService };
3
+ export { ChannelService, ChannelAgentService };
@@ -0,0 +1,21 @@
1
+ import { ISessionRepository } from "../../../domain/interfaces/repositories";
2
+ export default class SessionService extends ISessionRepository {
3
+ constructor(_ref) {
4
+ let {
5
+ sessionRepository
6
+ } = _ref;
7
+ super();
8
+ this.sessionRepository = sessionRepository;
9
+ }
10
+
11
+ async updateAssignee(request) {
12
+ return this.sessionRepository.updateAssignee(request);
13
+ }
14
+
15
+ toJSON() {
16
+ return {
17
+ updateAssignee: this.updateAssignee.bind(this)
18
+ };
19
+ }
20
+
21
+ }
@@ -1,9 +1,6 @@
1
- import { RequestBuilder } from "../base";
1
+ import RequestBuilder from "../RequestBuilder";
2
2
 
3
3
  function getBotsRequest() {
4
- let {
5
- query = {}
6
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
4
  return new RequestBuilder().withQuery({
8
5
  from: 0,
9
6
  limit: 10,
@@ -11,8 +8,7 @@ function getBotsRequest() {
11
8
  botServiceId: null,
12
9
  externalAccountId: null,
13
10
  searchStr: null,
14
- isActive: false,
15
- ...query
11
+ isActive: false
16
12
  }).build();
17
13
  }
18
14
 
@@ -0,0 +1,13 @@
1
+ import RequestBuilder from "../../RequestBuilder";
2
+
3
+ function getChannelAgentsRequest() {
4
+ return new RequestBuilder().withQuery({
5
+ from: 0,
6
+ limit: 10,
7
+ searchStr: null
8
+ }).withParams({
9
+ channelId: null
10
+ }).build();
11
+ }
12
+
13
+ export default getChannelAgentsRequest;
@@ -1,9 +1,6 @@
1
- import { RequestBuilder } from "../base";
1
+ import RequestBuilder from "../RequestBuilder";
2
2
 
3
3
  function getChannelsRequest() {
4
- let {
5
- query = {}
6
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
4
  return new RequestBuilder().withQuery({
8
5
  from: null,
9
6
  limit: null,
@@ -19,8 +16,7 @@ function getChannelsRequest() {
19
16
  channelIds: null,
20
17
  include: null,
21
18
  // meta|configParams
22
- includeUnsubscribed: null,
23
- ...query
19
+ includeUnsubscribed: null
24
20
  }).build();
25
21
  }
26
22
 
@@ -0,0 +1,12 @@
1
+ import RequestBuilder from "../RequestBuilder";
2
+
3
+ function updateSessionAssigneeRequest() {
4
+ return new RequestBuilder().withParams({
5
+ sessionId: null
6
+ }).withBody({
7
+ agentId: null,
8
+ botId: null
9
+ }).build();
10
+ }
11
+
12
+ export default updateSessionAssigneeRequest;
@@ -1,5 +1,3 @@
1
1
  import IAdapter from "./IAdapter";
2
- export * from "./channels";
3
- export * from "./sessions";
4
- export * from "./bots";
2
+ export * from "./repositories";
5
3
  export { IAdapter };
@@ -1,6 +1,5 @@
1
- import { getBotsRequest } from "../../../infrastructure/interfaces/api";
2
- import BaseAPI from "../BaseAPI";
3
- export default class IBot extends BaseAPI {
1
+ import { getBotsRequest } from "../../../dto";
2
+ export default class IBotRepository {
4
3
  // eslint-disable-next-line no-unused-vars
5
4
  async getBots() {
6
5
  let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getBotsRequest();
@@ -0,0 +1,2 @@
1
+ import IBotRepository from "./IBotRepository";
2
+ export { IBotRepository };
@@ -1,6 +1,5 @@
1
- import { getChannelAgentsRequest } from "../../../infrastructure/interfaces/api";
2
- import BaseAPI from "../BaseAPI";
3
- export default class IChannelAgent extends BaseAPI {
1
+ import { getChannelAgentsRequest } from "../../../dto";
2
+ export default class IChannelAgentRepository {
4
3
  // eslint-disable-next-line no-unused-vars
5
4
  getAgents() {
6
5
  let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getChannelAgentsRequest();
@@ -1,6 +1,5 @@
1
- import { getChannelsRequest } from "../../../infrastructure/interfaces/api";
2
- import BaseAPI from "../BaseAPI";
3
- export default class IChannel extends BaseAPI {
1
+ import { getChannelsRequest } from "../../../dto";
2
+ export default class IChannelRepository {
4
3
  // eslint-disable-next-line no-unused-vars
5
4
  getChannels() {
6
5
  let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getChannelsRequest();
@@ -0,0 +1,3 @@
1
+ import IChannelAgentRepository from "./IChannelAgentRepository";
2
+ import IChannelRepository from "./IChannelRepository";
3
+ export { IChannelRepository, IChannelAgentRepository };
@@ -0,0 +1,3 @@
1
+ export * from "./channels";
2
+ export * from "./sessions";
3
+ export * from "./bots";
@@ -1,6 +1,5 @@
1
- import { updateSessionAssigneeRequest } from "../../../infrastructure/interfaces/api";
2
- import BaseAPI from "../BaseAPI";
3
- export default class ISession extends BaseAPI {
1
+ import { updateSessionAssigneeRequest } from "../../../dto";
2
+ export default class ISessionRepository {
4
3
  // eslint-disable-next-line no-unused-vars
5
4
  updateAssignee() {
6
5
  let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : updateSessionAssigneeRequest();
@@ -0,0 +1,2 @@
1
+ import ISessionRepository from "./ISessionRepository";
2
+ export { ISessionRepository };
@@ -1,6 +1,6 @@
1
1
  import { ModuleNames } from "../../core/constants";
2
+ import configRegistry from "../../infrastructure/config/configRegistry";
2
3
  import { ModuleManager } from "../managers";
3
- import { configRegistry } from "./config";
4
4
  export default class IMSDK {
5
5
  constructor(_ref) {
6
6
  let {
@@ -0,0 +1,30 @@
1
+ import { BotService } from "../../../application/services";
2
+ import { BotRepository } from "../../../infrastructure/repositories";
3
+
4
+ class BotSDK {
5
+ constructor(_ref) {
6
+ let {
7
+ config
8
+ } = _ref;
9
+ const {
10
+ botAPI,
11
+ botAdapter
12
+ } = config;
13
+ const botRepository = new BotRepository({
14
+ botAPI,
15
+ botAdapter
16
+ }).toJSON();
17
+ const botService = new BotService({
18
+ botRepository
19
+ }).toJSON();
20
+ this.services = { ...botService
21
+ };
22
+ }
23
+
24
+ toJSON() {
25
+ return this.services;
26
+ }
27
+
28
+ }
29
+
30
+ export default BotSDK;
@@ -1,4 +1,5 @@
1
- import { ChannelAgentService, ChannelService } from "../../../domain/services";
1
+ import { ChannelAgentService, ChannelService } from "../../../application/services";
2
+ import { ChannelAgentRepository, ChannelRepository } from "../../../infrastructure/repositories";
2
3
  export default class ChannelSDK {
3
4
  constructor(_ref) {
4
5
  let {
@@ -10,14 +11,20 @@ export default class ChannelSDK {
10
11
  channelAgentAPI,
11
12
  channelAgentAdapter
12
13
  } = config;
13
- const channelAgentService = new ChannelAgentService({
14
+ const channelAgentRepository = new ChannelAgentRepository({
14
15
  channelAgentAPI,
15
16
  channelAgentAdapter
16
17
  }).toJSON();
17
- const channelService = new ChannelService({
18
+ const channelRepository = new ChannelRepository({
18
19
  channelAPI,
19
20
  channelAdapter
20
21
  }).toJSON();
22
+ const channelService = new ChannelService({
23
+ channelRepository
24
+ }).toJSON();
25
+ const channelAgentService = new ChannelAgentService({
26
+ channelAgentRepository
27
+ }).toJSON();
21
28
  this.services = { ...channelService,
22
29
  agents: channelAgentService
23
30
  };
@@ -0,0 +1,30 @@
1
+ import { SessionService } from "../../../application/services";
2
+ import { SessionRepository } from "../../../infrastructure/repositories";
3
+
4
+ class SessionSDK {
5
+ constructor(_ref) {
6
+ let {
7
+ config
8
+ } = _ref;
9
+ const {
10
+ sessionAPI,
11
+ sessionAdapter
12
+ } = config;
13
+ const sessionRepository = new SessionRepository({
14
+ sessionAPI,
15
+ sessionAdapter
16
+ }).toJSON();
17
+ const sessionService = new SessionService({
18
+ sessionRepository
19
+ }).toJSON();
20
+ this.services = { ...sessionService
21
+ };
22
+ }
23
+
24
+ toJSON() {
25
+ return this.services;
26
+ }
27
+
28
+ }
29
+
30
+ export default SessionSDK;
package/es/index.js CHANGED
@@ -1,9 +1,9 @@
1
+ // domain
2
+ export * from "./domain/dto";
1
3
  export * from "./domain/entities";
2
4
  export * from "./domain/enum";
3
- export * from "./domain/interfaces";
4
- export * from "./domain/services";
5
- export * from "./infrastructure/sdk";
6
- export * from "./infrastructure/adapters";
7
- export * from "./infrastructure/api";
8
- export * from "./infrastructure/interfaces/api";
5
+ export * from "./domain/interfaces"; // frameworks
6
+
7
+ export * from "./frameworks/sdk"; // core
8
+
9
9
  export * from "./core/constants";
@@ -1,30 +1,36 @@
1
- import { getRegistryConfig } from "../../config/registry";
2
- import { configRegistry } from "../../infrastructure/sdk/config";
1
+ import configRegistry from "../config/configRegistry";
2
+ import { getRegistryConfig } from "./registry";
3
3
  export default class BaseAPI {
4
- constructor(_ref) {
4
+ constructor() {
5
5
  let {
6
- module
7
- } = _ref;
8
- this.httpClient = configRegistry.getHttpClient();
9
- this.baseURL = configRegistry.getBaseURL();
6
+ module,
7
+ configProvider = configRegistry,
8
+ registryProvider = {
9
+ getRegistryConfig
10
+ }
11
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
12
+ this.configProvider = configProvider;
13
+ this.registryProvider = registryProvider;
14
+ this.httpClient = this.configProvider.getHttpClient();
15
+ this.baseURL = this.configProvider.getBaseURL();
10
16
  this.module = module;
11
17
  }
12
18
 
13
19
  replacePathParams(url, params) {
14
20
  let _url = url;
15
- Object.entries(params).forEach(_ref2 => {
16
- let [key, value] = _ref2;
21
+ Object.entries(params).forEach(_ref => {
22
+ let [key, value] = _ref;
17
23
  _url = url.replace(`:${key}`, value);
18
24
  });
19
25
  return _url;
20
26
  }
21
27
 
22
- buildUrl(_ref3) {
28
+ buildUrl(_ref2) {
23
29
  let {
24
30
  url,
25
31
  params,
26
32
  query
27
- } = _ref3;
33
+ } = _ref2;
28
34
 
29
35
  const _params = params || {};
30
36
 
@@ -46,24 +52,24 @@ export default class BaseAPI {
46
52
  }
47
53
 
48
54
  buildQuery(query) {
49
- const filteredQuery = Object.entries(query).filter(_ref4 => {
50
- let [, value] = _ref4;
55
+ const filteredQuery = Object.entries(query).filter(_ref3 => {
56
+ let [, value] = _ref3;
51
57
  return value !== undefined && value !== null && value !== '';
52
- }).reduce((acc, _ref5) => {
53
- let [key, value] = _ref5;
58
+ }).reduce((acc, _ref4) => {
59
+ let [key, value] = _ref4;
54
60
  acc[key] = value;
55
61
  return acc;
56
62
  }, {});
57
63
  return new URLSearchParams(filteredQuery).toString();
58
64
  }
59
65
 
60
- async request(_ref6) {
66
+ async request(_ref5) {
61
67
  let {
62
68
  request,
63
69
  operation,
64
70
  header
65
- } = _ref6;
66
- const config = getRegistryConfig(this.module, operation);
71
+ } = _ref5;
72
+ const config = this.registryProvider.getRegistryConfig(this.module, operation);
67
73
 
68
74
  if (!config) {
69
75
  throw new Error(`Operation "${operation}" not found in registry for module "${this.module}"`);
@@ -1,7 +1,7 @@
1
1
  import { ModuleNames } from "../../../core/constants";
2
- import { IBot } from "../../../domain/interfaces";
3
- import { getBotsRequest } from "../../interfaces/api";
4
- export default class BotAPI extends IBot {
2
+ import { getBotsRequest } from "../../../domain/dto";
3
+ import BaseAPI from "../BaseAPI";
4
+ export default class BotAPI extends BaseAPI {
5
5
  constructor() {
6
6
  super({
7
7
  module: ModuleNames.BOTS
@@ -1,7 +1,7 @@
1
1
  import { ModuleNames } from "../../../core/constants";
2
- import { IChannel } from "../../../domain/interfaces";
3
- import { getChannelsRequest } from "../../interfaces/api";
4
- export default class ChannelAPI extends IChannel {
2
+ import { getChannelsRequest } from "../../../domain/dto";
3
+ import BaseAPI from "../BaseAPI";
4
+ export default class ChannelAPI extends BaseAPI {
5
5
  constructor() {
6
6
  super({
7
7
  module: ModuleNames.CHANNELS
@@ -1,7 +1,7 @@
1
1
  import { ModuleNames } from "../../../core/constants";
2
- import IChannelAgent from "../../../domain/interfaces/channels/IChannelAgent";
3
- import { getChannelAgentsRequest } from "../../interfaces/api";
4
- export default class ChannelAgentAPI extends IChannelAgent {
2
+ import { getChannelAgentsRequest } from "../../../domain/dto";
3
+ import BaseAPI from "../BaseAPI";
4
+ export default class ChannelAgentAPI extends BaseAPI {
5
5
  constructor() {
6
6
  super({
7
7
  module: `${ModuleNames.CHANNELS}.agents`
@@ -1,5 +1,5 @@
1
- import { HTTP_METHODS } from "../../../core/constants";
2
- import { getBotsRequest } from "../../../infrastructure/interfaces/api/bots";
1
+ import { HTTP_METHODS } from "../../../../core/constants";
2
+ import { getBotsRequest } from "../../../../domain/dto";
3
3
  import createAPIRegistry from "../createAPIRegistry";
4
4
  import constructBotEndPoint from "./constructBotEndPoint";
5
5
 
@@ -1,5 +1,5 @@
1
- import { HTTP_METHODS } from "../../../core/constants";
2
- import { getChannelsRequest } from "../../../infrastructure/interfaces/api/channels";
1
+ import { HTTP_METHODS } from "../../../../core/constants";
2
+ import { getChannelsRequest } from "../../../../domain/dto";
3
3
  import createAPIRegistry from "../createAPIRegistry";
4
4
  import channelAgentAPIRegistry from "./channelAgentAPIRegistry";
5
5
  import constructChannelEndPoint from "./constructChannelEndPoint";
@@ -1,5 +1,5 @@
1
- import { HTTP_METHODS } from "../../../core/constants";
2
- import { getChannelAgentsRequest } from "../../../infrastructure/interfaces/api/channels";
1
+ import { HTTP_METHODS } from "../../../../core/constants";
2
+ import { getChannelAgentsRequest } from "../../../../domain/dto";
3
3
  import createAPIRegistry from "../createAPIRegistry";
4
4
  import constructChannelEndPoint from "./constructChannelEndPoint";
5
5
 
@@ -1,8 +1,8 @@
1
1
  import selectn from 'selectn';
2
2
  import { channelAPIRegistry } from "./channels";
3
- import { ModuleNames } from "../../core/constants";
4
3
  import { sessionAPIRegistry } from "./sessions";
5
4
  import { botAPIRegistry } from "./bots";
5
+ import { ModuleNames } from "../../../core/constants";
6
6
  const APIRegistry = {
7
7
  [ModuleNames.CHANNELS]: channelAPIRegistry,
8
8
  [ModuleNames.SESSIONS]: sessionAPIRegistry,
@@ -1,5 +1,5 @@
1
- import { HTTP_METHODS } from "../../../core/constants";
2
- import { updateSessionAssigneeRequest } from "../../../infrastructure/interfaces/api/sessions";
1
+ import { HTTP_METHODS } from "../../../../core/constants";
2
+ import { updateSessionAssigneeRequest } from "../../../../domain/dto";
3
3
  import createAPIRegistry from "../createAPIRegistry";
4
4
  import constructSessionEndPoint from "./constructSessionEndPoint";
5
5
 
@@ -1,7 +1,7 @@
1
1
  import { ModuleNames } from "../../../core/constants";
2
- import { ISession } from "../../../domain/interfaces";
3
- import { updateSessionAssigneeRequest } from "../../interfaces/api";
4
- export default class SessionAPI extends ISession {
2
+ import { updateSessionAssigneeRequest } from "../../../domain/dto";
3
+ import BaseAPI from "../BaseAPI";
4
+ export default class SessionAPI extends BaseAPI {
5
5
  constructor() {
6
6
  super({
7
7
  module: ModuleNames.SESSIONS
@@ -1,8 +1,8 @@
1
1
  import { ResponseUtils } from "../../../core/utils";
2
- import { BotAdapter } from "../../../infrastructure/adapters";
3
- import { BotAPI } from "../../../infrastructure/api";
4
- import { IBot } from "../../interfaces";
5
- export default class BotService extends IBot {
2
+ import { IBotRepository } from "../../../domain/interfaces/repositories";
3
+ import { BotAdapter } from "../../adapters";
4
+ import { BotAPI } from "../../api";
5
+ export default class BotRepository extends IBotRepository {
6
6
  constructor(_ref) {
7
7
  let {
8
8
  botAPI,
@@ -0,0 +1,2 @@
1
+ import BotRepository from "./BotRepository";
2
+ export { BotRepository };
@@ -1,8 +1,8 @@
1
1
  import { ResponseUtils } from "../../../core/utils";
2
- import { ChannelAgentAdapter } from "../../../infrastructure/adapters";
3
- import { ChannelAgentAPI } from "../../../infrastructure/api";
4
- import { IChannelAgent } from "../../interfaces";
5
- export default class ChannelAgentService extends IChannelAgent {
2
+ import { IChannelAgentRepository } from "../../../domain/interfaces/repositories";
3
+ import { ChannelAgentAdapter } from "../../adapters";
4
+ import { ChannelAgentAPI } from "../../api";
5
+ export default class ChannelAgentRepository extends IChannelAgentRepository {
6
6
  constructor(_ref) {
7
7
  let {
8
8
  channelAgentAPI,
@@ -1,8 +1,8 @@
1
1
  import { ResponseUtils } from "../../../core/utils";
2
- import { ChannelAdapter } from "../../../infrastructure/adapters";
3
- import { ChannelAPI } from "../../../infrastructure/api";
4
- import { IChannel } from "../../interfaces";
5
- export default class ChannelService extends IChannel {
2
+ import { IChannelRepository } from "../../../domain/interfaces/repositories";
3
+ import { ChannelAdapter } from "../../adapters";
4
+ import { ChannelAPI } from "../../api";
5
+ export default class ChannelRepository extends IChannelRepository {
6
6
  constructor() {
7
7
  let {
8
8
  channelAPI,
@@ -0,0 +1,3 @@
1
+ import ChannelAgentRepository from "./ChannelAgentRepository";
2
+ import ChannelRepository from "./ChannelRepository";
3
+ export { ChannelAgentRepository, ChannelRepository };
@@ -0,0 +1,3 @@
1
+ export * from "./channels";
2
+ export * from "./sessions";
3
+ export * from "./bots";
@@ -1,8 +1,8 @@
1
1
  import { ResponseUtils } from "../../../core/utils";
2
- import { SessionAdapter } from "../../../infrastructure/adapters";
3
- import { SessionAPI } from "../../../infrastructure/api";
4
- import { ISession } from "../../interfaces";
5
- export default class SessionService extends ISession {
2
+ import { ISessionRepository } from "../../../domain/interfaces/repositories";
3
+ import { SessionAdapter } from "../../adapters";
4
+ import { SessionAPI } from "../../api";
5
+ export default class SessionRepository extends ISessionRepository {
6
6
  constructor(_ref) {
7
7
  let {
8
8
  sessionAPI,
@@ -0,0 +1,2 @@
1
+ import SessionRepository from "./SessionRepository";
2
+ export { SessionRepository };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohoim/client-sdk",
3
- "version": "1.0.0-poc41",
3
+ "version": "1.0.0-poc43",
4
4
  "description": "To have the client sdk for the IM",
5
5
  "main": "es/index.js",
6
6
  "module": "es/index.js",
@@ -1,2 +0,0 @@
1
- import IBot from "./IBot";
2
- export { IBot };
@@ -1,3 +0,0 @@
1
- import IChannel from "./IChannel";
2
- import IChannelAgent from "./IChannelAgent";
3
- export { IChannel, IChannelAgent };
@@ -1,2 +0,0 @@
1
- import ISession from "./ISession";
2
- export { ISession };
@@ -1,2 +0,0 @@
1
- import RequestBuilder from "./RequestBuilder";
2
- export { RequestBuilder };
@@ -1,19 +0,0 @@
1
- import { RequestBuilder } from "../../base";
2
-
3
- function getChannelAgentsRequest() {
4
- let {
5
- query = {},
6
- params = {}
7
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8
- return new RequestBuilder().withQuery({
9
- from: 0,
10
- limit: 10,
11
- searchStr: null,
12
- ...query
13
- }).withParams({
14
- channelId: null,
15
- ...params
16
- }).build();
17
- }
18
-
19
- export default getChannelAgentsRequest;
@@ -1,18 +0,0 @@
1
- import { RequestBuilder } from "../base";
2
-
3
- function updateSessionAssigneeRequest() {
4
- let {
5
- params = {},
6
- body = {}
7
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8
- return new RequestBuilder().withParams({
9
- sessionId: null,
10
- ...params
11
- }).withBody({
12
- agentId: null,
13
- botId: null,
14
- ...body
15
- }).build();
16
- }
17
-
18
- export default updateSessionAssigneeRequest;
@@ -1 +0,0 @@
1
- export * from "./api";
@@ -1,20 +0,0 @@
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;
@@ -1,20 +0,0 @@
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;
File without changes
File without changes