@droz-js/sdk 0.2.13 → 0.2.15

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@droz-js/sdk",
3
3
  "description": "Droz SDK",
4
- "version": "0.2.13",
4
+ "version": "0.2.15",
5
5
  "private": false,
6
6
  "exports": {
7
7
  ".": "./src/index.js",
@@ -3,6 +3,7 @@ export declare const ChatWidget: new (options?: import("./client/http").HttpClie
3
3
  readonly http: any;
4
4
  forTenant(tenant: string): any;
5
5
  withAuthorization(authorization: import("./client/helpers").AuthorizationProvider): any;
6
+ withCustomHeaders(headers: () => Record<string, string>): any;
6
7
  } & {
7
8
  getChatWidget(variables: import("./sdks/chatwidget").Exact<{
8
9
  id: string;
@@ -1,5 +1,5 @@
1
1
  import type { ExecutionResult } from 'graphql';
2
- export declare const serviceDiscoveryEndpoint = "https://th3xrek4rane2scfwwfoo7wemq0tvuzm.lambda-url.sa-east-1.on.aws";
2
+ export declare const serviceDiscoveryEndpoint = "https://root.droz.services";
3
3
  export type AuthorizationProvider = string | (() => Promise<string>) | (() => string);
4
4
  export type Requester<C = {}> = <R, V>(doc: string, vars?: V, options?: C) => Promise<R> | AsyncIterableIterator<R>;
5
5
  export type GetSdk<Sdk> = (requester: Requester<Sdk>) => Sdk;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.mapAsyncIterableGraphqlResponse = exports.mapGraphqlResponse = exports.resolveAuthorization = exports.toAuthorizationProvider = exports.serviceDiscoveryEndpoint = void 0;
4
- exports.serviceDiscoveryEndpoint = 'https://th3xrek4rane2scfwwfoo7wemq0tvuzm.lambda-url.sa-east-1.on.aws';
4
+ exports.serviceDiscoveryEndpoint = 'https://root.droz.services';
5
5
  function toAuthorizationProvider(type, ...values) {
6
6
  // this means it is unsetting the authorization token
7
7
  if (!type)
@@ -1,4 +1,5 @@
1
1
  import { AuthorizationProvider, GetSdk } from './helpers';
2
+ type HeadersProvider = () => Record<string, string>;
2
3
  export interface HttpClientOptions {
3
4
  debug?: boolean;
4
5
  }
@@ -6,4 +7,6 @@ export declare function HttpClientBuilder<Sdk>(serviceName: string, getSdk: GetS
6
7
  readonly http: any;
7
8
  forTenant(tenant: string): any;
8
9
  withAuthorization(authorization: AuthorizationProvider): any;
10
+ withCustomHeaders(headers: HeadersProvider): any;
9
11
  } & Sdk;
12
+ export {};
@@ -34,6 +34,7 @@ class HttpRequester {
34
34
  options;
35
35
  tenant;
36
36
  authorization;
37
+ customHeaders;
37
38
  constructor(serviceName, options) {
38
39
  this.serviceName = serviceName;
39
40
  this.options = options;
@@ -44,6 +45,9 @@ class HttpRequester {
44
45
  withAuthorization(authorization) {
45
46
  this.authorization = authorization;
46
47
  }
48
+ withCustomHeaders(headers) {
49
+ this.customHeaders = headers;
50
+ }
47
51
  build() {
48
52
  return this.requester.bind(this);
49
53
  }
@@ -69,6 +73,11 @@ class HttpRequester {
69
73
  heads.set('Authorization', authorization);
70
74
  heads.set('Content-Type', 'application/json');
71
75
  heads.set('Accept', 'application/json');
76
+ if (this.customHeaders) {
77
+ const custom = this.customHeaders();
78
+ for (const [key, value] of Object.entries(custom))
79
+ heads.set(key, value);
80
+ }
72
81
  const headers = Object.fromEntries(heads.entries());
73
82
  return { endpoint, headers };
74
83
  }
@@ -110,6 +119,10 @@ function HttpClientBuilder(serviceName, getSdk) {
110
119
  this.http.withAuthorization(authorization);
111
120
  return this;
112
121
  }
122
+ withCustomHeaders(headers) {
123
+ this.http.withCustomHeaders(headers);
124
+ return this;
125
+ }
113
126
  }
114
127
  return Client;
115
128
  }
@@ -0,0 +1,18 @@
1
+ export * from './sdks/drozcommons';
2
+ export declare const DrozAdmin: new (options?: import("./client/http").HttpClientOptions) => {
3
+ readonly http: any;
4
+ forTenant(tenant: string): any;
5
+ withAuthorization(authorization: import("./client/helpers").AuthorizationProvider): any;
6
+ withCustomHeaders(headers: () => Record<string, string>): any;
7
+ } & {
8
+ listServices(variables: import("./sdks/drozcommons").Exact<{
9
+ tenantId: string;
10
+ }>, options?: unknown): Promise<import("./sdks/drozcommons").ListServicesQuery>;
11
+ getTenant(variables: import("./sdks/drozcommons").Exact<{
12
+ tenantId: string;
13
+ withServices?: boolean;
14
+ }>, options?: unknown): Promise<import("./sdks/drozcommons").GetTenantQuery>;
15
+ listTenants(variables?: import("./sdks/drozcommons").Exact<{
16
+ withServices?: boolean;
17
+ }>, options?: unknown): Promise<import("./sdks/drozcommons").ListTenantsQuery>;
18
+ };
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.DrozAdmin = void 0;
18
+ const http_1 = require("./client/http");
19
+ const drozcommons_1 = require("./sdks/drozcommons");
20
+ __exportStar(require("./sdks/drozcommons"), exports);
21
+ exports.DrozAdmin = (0, http_1.HttpClientBuilder)(drozcommons_1.serviceName, drozcommons_1.getSdk);
package/src/drozbot.d.ts CHANGED
@@ -3,6 +3,7 @@ export declare const DrozBot: new (options?: import("./client/http").HttpClientO
3
3
  readonly http: any;
4
4
  forTenant(tenant: string): any;
5
5
  withAuthorization(authorization: import("./client/helpers").AuthorizationProvider): any;
6
+ withCustomHeaders(headers: () => Record<string, string>): any;
6
7
  } & {
7
8
  getDrozBotInstance(variables: import("./sdks/drozbot").Exact<{
8
9
  id: string;
@@ -12,18 +12,6 @@ export declare const DrozChatWs: new () => {
12
12
  getDrozChatAgent(variables: import("./sdks/drozchat").Exact<{
13
13
  id: string;
14
14
  }>, options?: unknown): Promise<import("./sdks/drozchat").GetDrozChatAgentQuery>;
15
- createCustomer(variables: import("./sdks/drozchat").Exact<{
16
- input: import("./sdks/drozchat").CreateCustomerInput;
17
- }>, options?: unknown): Promise<import("./sdks/drozchat").CreateCustomerMutation>;
18
- updateCustomer(variables: import("./sdks/drozchat").Exact<{
19
- input: import("./sdks/drozchat").UpdateCustomerInput;
20
- }>, options?: unknown): Promise<import("./sdks/drozchat").UpdateCustomerMutation>;
21
- listCustomers(variables?: import("./sdks/drozchat").Exact<{
22
- next?: object;
23
- }>, options?: unknown): Promise<import("./sdks/drozchat").ListCustomersQuery>;
24
- getCustomer(variables: import("./sdks/drozchat").Exact<{
25
- id: string;
26
- }>, options?: unknown): Promise<import("./sdks/drozchat").GetCustomerQuery>;
27
15
  getTicket(variables: import("./sdks/drozchat").Exact<{
28
16
  id: string;
29
17
  }>, options?: unknown): Promise<import("./sdks/drozchat").GetTicketQuery>;
package/src/drozchat.d.ts CHANGED
@@ -3,6 +3,7 @@ export declare const DrozChat: new (options?: import("./client/http").HttpClient
3
3
  readonly http: any;
4
4
  forTenant(tenant: string): any;
5
5
  withAuthorization(authorization: import("./client/helpers").AuthorizationProvider): any;
6
+ withCustomHeaders(headers: () => Record<string, string>): any;
6
7
  } & {
7
8
  createDrozChatAgent(variables: import("./sdks/drozchat").Exact<{
8
9
  input: import("./sdks/drozchat").CreateDrozChatAgentInput;
@@ -13,18 +14,6 @@ export declare const DrozChat: new (options?: import("./client/http").HttpClient
13
14
  getDrozChatAgent(variables: import("./sdks/drozchat").Exact<{
14
15
  id: string;
15
16
  }>, options?: unknown): Promise<import("./sdks/drozchat").GetDrozChatAgentQuery>;
16
- createCustomer(variables: import("./sdks/drozchat").Exact<{
17
- input: import("./sdks/drozchat").CreateCustomerInput;
18
- }>, options?: unknown): Promise<import("./sdks/drozchat").CreateCustomerMutation>;
19
- updateCustomer(variables: import("./sdks/drozchat").Exact<{
20
- input: import("./sdks/drozchat").UpdateCustomerInput;
21
- }>, options?: unknown): Promise<import("./sdks/drozchat").UpdateCustomerMutation>;
22
- listCustomers(variables?: import("./sdks/drozchat").Exact<{
23
- next?: object;
24
- }>, options?: unknown): Promise<import("./sdks/drozchat").ListCustomersQuery>;
25
- getCustomer(variables: import("./sdks/drozchat").Exact<{
26
- id: string;
27
- }>, options?: unknown): Promise<import("./sdks/drozchat").GetCustomerQuery>;
28
17
  getTicket(variables: import("./sdks/drozchat").Exact<{
29
18
  id: string;
30
19
  }>, options?: unknown): Promise<import("./sdks/drozchat").GetTicketQuery>;
package/src/droznexo.d.ts CHANGED
@@ -3,6 +3,7 @@ export declare const DrozNexo: new (options?: import("./client/http").HttpClient
3
3
  readonly http: any;
4
4
  forTenant(tenant: string): any;
5
5
  withAuthorization(authorization: import("./client/helpers").AuthorizationProvider): any;
6
+ withCustomHeaders(headers: () => Record<string, string>): any;
6
7
  } & {
7
8
  createDrozNexoAgent(variables: import("./sdks/droznexo").Exact<{
8
9
  input: import("./sdks/droznexo").CreateDrozNexoAgentInput;
@@ -3,6 +3,7 @@ export declare const MercadoLivre: new (options?: import("./client/http").HttpCl
3
3
  readonly http: any;
4
4
  forTenant(tenant: string): any;
5
5
  withAuthorization(authorization: import("./client/helpers").AuthorizationProvider): any;
6
+ withCustomHeaders(headers: () => Record<string, string>): any;
6
7
  } & {
7
8
  getMercadoLivreInstance(variables: import("./sdks/mercadolivre").Exact<{
8
9
  id: string;
package/src/nucleus.d.ts CHANGED
@@ -3,6 +3,7 @@ export declare const Nucleus: new (options?: import("./client/http").HttpClientO
3
3
  readonly http: any;
4
4
  forTenant(tenant: string): any;
5
5
  withAuthorization(authorization: import("./client/helpers").AuthorizationProvider): any;
6
+ withCustomHeaders(headers: () => Record<string, string>): any;
6
7
  } & {
7
8
  getAgent(variables: import("./sdks/nucleus").Exact<{
8
9
  id: string;
@@ -35,6 +36,12 @@ export declare const Nucleus: new (options?: import("./client/http").HttpClientO
35
36
  appType?: import("./sdks/nucleus").AppType;
36
37
  withApp?: boolean;
37
38
  }>, options?: unknown): Promise<import("./sdks/nucleus").ListAppInstancesQuery>;
39
+ registerAppInstance(variables: import("./sdks/nucleus").Exact<{
40
+ input: import("./sdks/nucleus").RegisterAppInstanceInput;
41
+ }>, options?: unknown): Promise<import("./sdks/nucleus").RegisterAppInstanceMutation>;
42
+ unregisterAppInstance(variables: import("./sdks/nucleus").Exact<{
43
+ input: import("./sdks/nucleus").UnregisterAppInstanceInput;
44
+ }>, options?: unknown): Promise<import("./sdks/nucleus").UnregisterAppInstanceMutation>;
38
45
  getAmplifyConfig(variables?: import("./sdks/nucleus").Exact<{
39
46
  [key: string]: never;
40
47
  }>, options?: unknown): Promise<import("./sdks/nucleus").GetAmplifyConfigQuery>;
@@ -59,6 +66,15 @@ export declare const Nucleus: new (options?: import("./client/http").HttpClientO
59
66
  removeCredentials(variables: import("./sdks/nucleus").Exact<{
60
67
  input: import("./sdks/nucleus").RemoveCredentialsInput;
61
68
  }>, options?: unknown): Promise<import("./sdks/nucleus").RemoveCredentialsMutation>;
69
+ getCustomer(variables: import("./sdks/nucleus").Exact<{
70
+ identifier: string;
71
+ }>, options?: unknown): Promise<import("./sdks/nucleus").GetCustomerQuery>;
72
+ listCustomers(variables?: import("./sdks/nucleus").Exact<{
73
+ next?: object;
74
+ }>, options?: unknown): Promise<import("./sdks/nucleus").ListCustomersQuery>;
75
+ getOrCreateCustomer(variables: import("./sdks/nucleus").Exact<{
76
+ input: import("./sdks/nucleus").GetOrCreateCustomerInput;
77
+ }>, options?: unknown): Promise<import("./sdks/nucleus").GetOrCreateCustomerMutation>;
62
78
  getCronJob(variables: import("./sdks/nucleus").Exact<{
63
79
  id: string;
64
80
  }>, options?: unknown): Promise<import("./sdks/nucleus").GetCronJobQuery>;
@@ -74,21 +90,21 @@ export declare const Nucleus: new (options?: import("./client/http").HttpClientO
74
90
  removeCronJob(variables: import("./sdks/nucleus").Exact<{
75
91
  input: import("./sdks/nucleus").RemoveCronJobInput;
76
92
  }>, options?: unknown): Promise<import("./sdks/nucleus").RemoveCronJobMutation>;
77
- resolveSession(variables: import("./sdks/nucleus").Exact<{
78
- sessionId?: string;
79
- userId?: string;
80
- triggerDrn: string;
81
- }>, options?: unknown): Promise<import("./sdks/nucleus").ResolveSessionQuery>;
82
- getSessionData(variables: import("./sdks/nucleus").Exact<{
93
+ startSession(variables: import("./sdks/nucleus").Exact<{
94
+ input: import("./sdks/nucleus").StartSessionInput;
95
+ withCustomer?: boolean;
96
+ }>, options?: unknown): Promise<import("./sdks/nucleus").StartSessionMutation>;
97
+ getSession(variables: import("./sdks/nucleus").Exact<{
83
98
  sessionId: string;
84
- namespace?: string;
85
- }>, options?: unknown): Promise<import("./sdks/nucleus").GetSessionDataQuery>;
86
- setSessionData(variables: import("./sdks/nucleus").Exact<{
87
- input: import("./sdks/nucleus").SetSessionDataInput;
88
- }>, options?: unknown): Promise<import("./sdks/nucleus").SetSessionDataMutation>;
89
- patchSessionData(variables: import("./sdks/nucleus").Exact<{
90
- input: import("./sdks/nucleus").PatchSessionDataInput;
91
- }>, options?: unknown): Promise<import("./sdks/nucleus").PatchSessionDataMutation>;
99
+ withCustomer?: boolean;
100
+ withAttributes?: boolean;
101
+ }>, options?: unknown): Promise<import("./sdks/nucleus").GetSessionQuery>;
102
+ setSessionAttribute(variables: import("./sdks/nucleus").Exact<{
103
+ input: import("./sdks/nucleus").SetSessionAttributeInput;
104
+ }>, options?: unknown): Promise<import("./sdks/nucleus").SetSessionAttributeMutation>;
105
+ patchSessionAttributes(variables: import("./sdks/nucleus").Exact<{
106
+ input: import("./sdks/nucleus").PatchSessionAttributesInput;
107
+ }>, options?: unknown): Promise<import("./sdks/nucleus").PatchSessionAttributesMutation>;
92
108
  getStateMachine(variables: import("./sdks/nucleus").Exact<{
93
109
  id: string;
94
110
  versionId: string;
@@ -3,6 +3,7 @@ export declare const Reclameaqui: new (options?: import("./client/http").HttpCli
3
3
  readonly http: any;
4
4
  forTenant(tenant: string): any;
5
5
  withAuthorization(authorization: import("./client/helpers").AuthorizationProvider): any;
6
+ withCustomHeaders(headers: () => Record<string, string>): any;
6
7
  } & {
7
8
  getReclameAquiInstance(variables: import("./sdks/reclameaqui").Exact<{
8
9
  id: string;
@@ -86,6 +86,11 @@ export type Scalars = {
86
86
  output: void;
87
87
  };
88
88
  };
89
+ export declare enum AppInstanceStatus {
90
+ Active = "Active",
91
+ Failing = "Failing",
92
+ Inactive = "Inactive"
93
+ }
89
94
  export type ChatWidget = {
90
95
  id: Scalars['ID']['output'];
91
96
  name: Scalars['String']['output'];
@@ -154,6 +159,7 @@ export type SendMessageToChatWidgetInput = {
154
159
  };
155
160
  export type StartChatWidgetSessionInput = {
156
161
  chatId: Scalars['ID']['input'];
162
+ userIdentifier: Scalars['ID']['input'];
157
163
  };
158
164
  export type Subscription = {
159
165
  onChatWidgetMessage: ChatWidgetMessage;
@@ -1,7 +1,13 @@
1
1
  "use strict";
2
2
  /* istanbul ignore file */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.serviceName = exports.getSdk = exports.OnChatWidgetMessageDocument = exports.SendMessageToChatWidgetDocument = exports.StartChatWidgetSessionDocument = exports.RemoveChatWidgetDocument = exports.UpdateChatWidgetDocument = exports.CreateChatWidgetDocument = exports.ListChatWidgetsDocument = exports.GetChatWidgetDocument = exports.ChatWidgetMessageFragmentDoc = exports.ChatWidgetFragmentDoc = exports.Typenames = exports.SubscriptionAction = void 0;
4
+ exports.serviceName = exports.getSdk = exports.OnChatWidgetMessageDocument = exports.SendMessageToChatWidgetDocument = exports.StartChatWidgetSessionDocument = exports.RemoveChatWidgetDocument = exports.UpdateChatWidgetDocument = exports.CreateChatWidgetDocument = exports.ListChatWidgetsDocument = exports.GetChatWidgetDocument = exports.ChatWidgetMessageFragmentDoc = exports.ChatWidgetFragmentDoc = exports.Typenames = exports.SubscriptionAction = exports.AppInstanceStatus = void 0;
5
+ var AppInstanceStatus;
6
+ (function (AppInstanceStatus) {
7
+ AppInstanceStatus["Active"] = "Active";
8
+ AppInstanceStatus["Failing"] = "Failing";
9
+ AppInstanceStatus["Inactive"] = "Inactive";
10
+ })(AppInstanceStatus || (exports.AppInstanceStatus = AppInstanceStatus = {}));
5
11
  var SubscriptionAction;
6
12
  (function (SubscriptionAction) {
7
13
  SubscriptionAction["Created"] = "CREATED";
@@ -86,6 +86,11 @@ export type Scalars = {
86
86
  output: void;
87
87
  };
88
88
  };
89
+ export declare enum AppInstanceStatus {
90
+ Active = "Active",
91
+ Failing = "Failing",
92
+ Inactive = "Inactive"
93
+ }
89
94
  export type CreateDrozBotInstanceInput = {
90
95
  credentialsId: Scalars['ID']['input'];
91
96
  isTest?: InputMaybe<Scalars['Boolean']['input']>;
@@ -1,7 +1,13 @@
1
1
  "use strict";
2
2
  /* istanbul ignore file */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.serviceName = exports.getSdk = exports.CreateDrozBotTicketCommentDocument = exports.CreateDrozBotTicketDocument = exports.RemoveDrozBotInstanceDocument = exports.UpdateDrozBotInstanceDocument = exports.CreateDrozBotInstanceDocument = exports.ListDrozBotInstancesDocument = exports.GetDrozBotInstanceDocument = exports.DrozbotFragmentDoc = exports.Typenames = void 0;
4
+ exports.serviceName = exports.getSdk = exports.CreateDrozBotTicketCommentDocument = exports.CreateDrozBotTicketDocument = exports.RemoveDrozBotInstanceDocument = exports.UpdateDrozBotInstanceDocument = exports.CreateDrozBotInstanceDocument = exports.ListDrozBotInstancesDocument = exports.GetDrozBotInstanceDocument = exports.DrozbotFragmentDoc = exports.Typenames = exports.AppInstanceStatus = void 0;
5
+ var AppInstanceStatus;
6
+ (function (AppInstanceStatus) {
7
+ AppInstanceStatus["Active"] = "Active";
8
+ AppInstanceStatus["Failing"] = "Failing";
9
+ AppInstanceStatus["Inactive"] = "Inactive";
10
+ })(AppInstanceStatus || (exports.AppInstanceStatus = AppInstanceStatus = {}));
5
11
  var Typenames;
6
12
  (function (Typenames) {
7
13
  Typenames["Any"] = "Any";