@droz-js/sdk 0.2.10 → 0.2.12

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.10",
4
+ "version": "0.2.12",
5
5
  "private": false,
6
6
  "exports": {
7
7
  ".": "./src/index.js",
@@ -0,0 +1,30 @@
1
+ export * from './sdks/chatwidget';
2
+ export declare const ChatwidgetWs: new () => {
3
+ readonly ws: any;
4
+ connect(): Promise<void>;
5
+ } & {
6
+ getChatWidget(variables: import("./sdks/chatwidget").Exact<{
7
+ id: string;
8
+ }>, options?: unknown): Promise<import("./sdks/chatwidget").GetChatWidgetQuery>;
9
+ listChatWidgets(variables?: import("./sdks/chatwidget").Exact<{
10
+ [key: string]: never;
11
+ }>, options?: unknown): Promise<import("./sdks/chatwidget").ListChatWidgetsQuery>;
12
+ createChatWidget(variables: import("./sdks/chatwidget").Exact<{
13
+ input: import("./sdks/chatwidget").CreateChatWidgetInput;
14
+ }>, options?: unknown): Promise<import("./sdks/chatwidget").CreateChatWidgetMutation>;
15
+ updateChatWidget(variables: import("./sdks/chatwidget").Exact<{
16
+ input: import("./sdks/chatwidget").UpdateChatWidgetInput;
17
+ }>, options?: unknown): Promise<import("./sdks/chatwidget").UpdateChatWidgetMutation>;
18
+ removeChatWidget(variables: import("./sdks/chatwidget").Exact<{
19
+ input: import("./sdks/chatwidget").RemoveChatWidgetInput;
20
+ }>, options?: unknown): Promise<import("./sdks/chatwidget").RemoveChatWidgetMutation>;
21
+ startChatWidgetSession(variables: import("./sdks/chatwidget").Exact<{
22
+ input: import("./sdks/chatwidget").StartChatWidgetSessionInput;
23
+ }>, options?: unknown): Promise<import("./sdks/chatwidget").StartChatWidgetSessionMutation>;
24
+ sendMessageToChatWidget(variables: import("./sdks/chatwidget").Exact<{
25
+ input: import("./sdks/chatwidget").SendMessageToChatWidgetInput;
26
+ }>, options?: unknown): Promise<import("./sdks/chatwidget").SendMessageToChatWidgetMutation>;
27
+ onChatWidgetMessage(variables: import("./sdks/chatwidget").Exact<{
28
+ sessionId: string;
29
+ }>, options?: unknown): AsyncIterableIterator<import("./sdks/chatwidget").OnChatWidgetMessageSubscription>;
30
+ };
@@ -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.ChatwidgetWs = void 0;
18
+ const ws_1 = require("./client/ws");
19
+ const chatwidget_1 = require("./sdks/chatwidget");
20
+ __exportStar(require("./sdks/chatwidget"), exports);
21
+ exports.ChatwidgetWs = (0, ws_1.WsClientBuilder)(chatwidget_1.serviceName, chatwidget_1.getSdk);
@@ -0,0 +1,31 @@
1
+ export * from './sdks/chatwidget';
2
+ export declare const ChatWidget: new (options?: import("./client/http").HttpClientOptions) => {
3
+ readonly http: any;
4
+ forTenant(tenant: string): any;
5
+ withAuthorization(authorization: import("./client/helpers").AuthorizationProvider): any;
6
+ } & {
7
+ getChatWidget(variables: import("./sdks/chatwidget").Exact<{
8
+ id: string;
9
+ }>, options?: unknown): Promise<import("./sdks/chatwidget").GetChatWidgetQuery>;
10
+ listChatWidgets(variables?: import("./sdks/chatwidget").Exact<{
11
+ [key: string]: never;
12
+ }>, options?: unknown): Promise<import("./sdks/chatwidget").ListChatWidgetsQuery>;
13
+ createChatWidget(variables: import("./sdks/chatwidget").Exact<{
14
+ input: import("./sdks/chatwidget").CreateChatWidgetInput;
15
+ }>, options?: unknown): Promise<import("./sdks/chatwidget").CreateChatWidgetMutation>;
16
+ updateChatWidget(variables: import("./sdks/chatwidget").Exact<{
17
+ input: import("./sdks/chatwidget").UpdateChatWidgetInput;
18
+ }>, options?: unknown): Promise<import("./sdks/chatwidget").UpdateChatWidgetMutation>;
19
+ removeChatWidget(variables: import("./sdks/chatwidget").Exact<{
20
+ input: import("./sdks/chatwidget").RemoveChatWidgetInput;
21
+ }>, options?: unknown): Promise<import("./sdks/chatwidget").RemoveChatWidgetMutation>;
22
+ startChatWidgetSession(variables: import("./sdks/chatwidget").Exact<{
23
+ input: import("./sdks/chatwidget").StartChatWidgetSessionInput;
24
+ }>, options?: unknown): Promise<import("./sdks/chatwidget").StartChatWidgetSessionMutation>;
25
+ sendMessageToChatWidget(variables: import("./sdks/chatwidget").Exact<{
26
+ input: import("./sdks/chatwidget").SendMessageToChatWidgetInput;
27
+ }>, options?: unknown): Promise<import("./sdks/chatwidget").SendMessageToChatWidgetMutation>;
28
+ onChatWidgetMessage(variables: import("./sdks/chatwidget").Exact<{
29
+ sessionId: string;
30
+ }>, options?: unknown): AsyncIterableIterator<import("./sdks/chatwidget").OnChatWidgetMessageSubscription>;
31
+ };
@@ -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.ChatWidget = void 0;
18
+ const http_1 = require("./client/http");
19
+ const chatwidget_1 = require("./sdks/chatwidget");
20
+ __exportStar(require("./sdks/chatwidget"), exports);
21
+ exports.ChatWidget = (0, http_1.HttpClientBuilder)(chatwidget_1.serviceName, chatwidget_1.getSdk);
@@ -1,5 +1,8 @@
1
1
  import { AuthorizationProvider, GetSdk } from './helpers';
2
- export declare function HttpClientBuilder<Sdk>(serviceName: string, getSdk: GetSdk<Sdk>): new () => {
2
+ export interface HttpClientOptions {
3
+ debug?: boolean;
4
+ }
5
+ export declare function HttpClientBuilder<Sdk>(serviceName: string, getSdk: GetSdk<Sdk>): new (options?: HttpClientOptions) => {
3
6
  readonly http: any;
4
7
  forTenant(tenant: string): any;
5
8
  withAuthorization(authorization: AuthorizationProvider): any;
@@ -31,10 +31,12 @@ function buildArgs(req) {
31
31
  }
32
32
  class HttpRequester {
33
33
  serviceName;
34
+ options;
34
35
  tenant;
35
36
  authorization;
36
- constructor(serviceName) {
37
+ constructor(serviceName, options) {
37
38
  this.serviceName = serviceName;
39
+ this.options = options;
38
40
  }
39
41
  forTenant(tenant) {
40
42
  this.tenant = tenant;
@@ -46,6 +48,9 @@ class HttpRequester {
46
48
  return this.requester.bind(this);
47
49
  }
48
50
  requester(query, variables) {
51
+ if (this.options?.debug) {
52
+ console.log('[Droz SDK]:request', { query, variables });
53
+ }
49
54
  // subscriptions are not executable with the http sdk
50
55
  if (query.match(/subscription .*{/))
51
56
  return emptyAsyncIterator();
@@ -60,7 +65,8 @@ class HttpRequester {
60
65
  ]);
61
66
  const endpoint = tenant.getEndpoint(this.serviceName);
62
67
  const heads = new Headers();
63
- heads.set('Authorization', authorization);
68
+ if (authorization)
69
+ heads.set('Authorization', authorization);
64
70
  heads.set('Content-Type', 'application/json');
65
71
  heads.set('Accept', 'application/json');
66
72
  const headers = Object.fromEntries(heads.entries());
@@ -70,6 +76,9 @@ class HttpRequester {
70
76
  const { endpoint, headers } = await this.buildRequest();
71
77
  const body = JSON.stringify(request);
72
78
  const args = buildArgs(request);
79
+ if (this.options?.debug) {
80
+ console.log('[Droz SDK]:batch', { args, endpoint, headers, body });
81
+ }
73
82
  // make POST request
74
83
  const response = await fetch(`${endpoint}?${args}`, {
75
84
  method: 'POST',
@@ -88,8 +97,8 @@ __decorate([
88
97
  function HttpClientBuilder(serviceName, getSdk) {
89
98
  class Client {
90
99
  http; // cannot type as HttpSdkRequesterBuilder because it is an anonymous class
91
- constructor() {
92
- this.http = new HttpRequester(serviceName);
100
+ constructor(options) {
101
+ this.http = new HttpRequester(serviceName, options);
93
102
  const sdk = getSdk(this.http.build());
94
103
  Object.assign(this, sdk);
95
104
  }
package/src/client/ws.js CHANGED
@@ -18,12 +18,13 @@ class WsRequester {
18
18
  config_1.DrozSdk.getAuthorization()
19
19
  ]);
20
20
  const endpoint = tenant.getEndpoint(this.serviceName, 'ws');
21
+ const connectionParams = authorization ? { authorization } : {};
21
22
  this.client = (0, graphql_ws_1.createClient)({
22
23
  url: endpoint,
23
24
  lazy: true,
24
25
  retryAttempts: 128,
25
26
  keepAlive: 25000,
26
- connectionParams: { authorization }
27
+ connectionParams
27
28
  });
28
29
  return this.client;
29
30
  }
package/src/drozbot.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './sdks/drozbot';
2
- export declare const DrozBot: new () => {
2
+ export declare const DrozBot: new (options?: import("./client/http").HttpClientOptions) => {
3
3
  readonly http: any;
4
4
  forTenant(tenant: string): any;
5
5
  withAuthorization(authorization: import("./client/helpers").AuthorizationProvider): any;
package/src/drozchat.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './sdks/drozchat';
2
- export declare const DrozChat: new () => {
2
+ export declare const DrozChat: new (options?: import("./client/http").HttpClientOptions) => {
3
3
  readonly http: any;
4
4
  forTenant(tenant: string): any;
5
5
  withAuthorization(authorization: import("./client/helpers").AuthorizationProvider): any;
package/src/droznexo.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './sdks/droznexo';
2
- export declare const DrozNexo: new () => {
2
+ export declare const DrozNexo: new (options?: import("./client/http").HttpClientOptions) => {
3
3
  readonly http: any;
4
4
  forTenant(tenant: string): any;
5
5
  withAuthorization(authorization: import("./client/helpers").AuthorizationProvider): any;
@@ -1,5 +1,5 @@
1
1
  export * from './sdks/mercadolivre';
2
- export declare const MercadoLivre: new () => {
2
+ export declare const MercadoLivre: new (options?: import("./client/http").HttpClientOptions) => {
3
3
  readonly http: any;
4
4
  forTenant(tenant: string): any;
5
5
  withAuthorization(authorization: import("./client/helpers").AuthorizationProvider): any;
package/src/nucleus.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './sdks/nucleus';
2
- export declare const Nucleus: new () => {
2
+ export declare const Nucleus: new (options?: import("./client/http").HttpClientOptions) => {
3
3
  readonly http: any;
4
4
  forTenant(tenant: string): any;
5
5
  withAuthorization(authorization: import("./client/helpers").AuthorizationProvider): any;
@@ -27,6 +27,9 @@ export declare const Nucleus: new () => {
27
27
  type?: import("./sdks/nucleus").AppType;
28
28
  withInstances?: boolean;
29
29
  }>, options?: unknown): Promise<import("./sdks/nucleus").ListAppsQuery>;
30
+ getAppInstance(variables: import("./sdks/nucleus").Exact<{
31
+ drn: string;
32
+ }>, options?: unknown): Promise<import("./sdks/nucleus").GetAppInstanceQuery>;
30
33
  listAppInstances(variables?: import("./sdks/nucleus").Exact<{
31
34
  appId?: string;
32
35
  appType?: import("./sdks/nucleus").AppType;
@@ -1,5 +1,5 @@
1
1
  export * from './sdks/reclameaqui';
2
- export declare const Reclameaqui: new () => {
2
+ export declare const Reclameaqui: new (options?: import("./client/http").HttpClientOptions) => {
3
3
  readonly http: any;
4
4
  forTenant(tenant: string): any;
5
5
  withAuthorization(authorization: import("./client/helpers").AuthorizationProvider): any;
@@ -0,0 +1,248 @@
1
+ export type Maybe<T> = T;
2
+ export type InputMaybe<T> = T;
3
+ export type Exact<T extends {
4
+ [key: string]: unknown;
5
+ }> = {
6
+ [K in keyof T]: T[K];
7
+ };
8
+ export type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
9
+ [SubKey in K]?: Maybe<T[SubKey]>;
10
+ };
11
+ export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
12
+ [SubKey in K]: Maybe<T[SubKey]>;
13
+ };
14
+ export type MakeEmpty<T extends {
15
+ [key: string]: unknown;
16
+ }, K extends keyof T> = {
17
+ [_ in K]?: never;
18
+ };
19
+ export type Incremental<T> = T | {
20
+ [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never;
21
+ };
22
+ /** All built-in and custom scalars, mapped to their actual values */
23
+ export type Scalars = {
24
+ ID: {
25
+ input: string;
26
+ output: string;
27
+ };
28
+ String: {
29
+ input: string;
30
+ output: string;
31
+ };
32
+ Boolean: {
33
+ input: boolean;
34
+ output: boolean;
35
+ };
36
+ Int: {
37
+ input: number;
38
+ output: number;
39
+ };
40
+ Float: {
41
+ input: number;
42
+ output: number;
43
+ };
44
+ Base64: {
45
+ input: object;
46
+ output: string;
47
+ };
48
+ DRN: {
49
+ input: string;
50
+ output: string;
51
+ };
52
+ Date: {
53
+ input: Date;
54
+ output: Date;
55
+ };
56
+ DateTime: {
57
+ input: Date;
58
+ output: Date;
59
+ };
60
+ EmailAddress: {
61
+ input: string;
62
+ output: string;
63
+ };
64
+ JSON: {
65
+ input: any;
66
+ output: any;
67
+ };
68
+ JSONObject: {
69
+ input: any;
70
+ output: any;
71
+ };
72
+ Set: {
73
+ input: Set<any>;
74
+ output: any[];
75
+ };
76
+ URL: {
77
+ input: string;
78
+ output: string;
79
+ };
80
+ Void: {
81
+ input: void;
82
+ output: void;
83
+ };
84
+ };
85
+ export type ChatWidget = {
86
+ id: Scalars['ID']['output'];
87
+ name: Scalars['String']['output'];
88
+ };
89
+ export type ChatWidgetMessage = {
90
+ id: Scalars['ID']['output'];
91
+ payload: Array<ChatWidgetMessagePayload>;
92
+ };
93
+ export type ChatWidgetMessagePayload = {
94
+ content: Scalars['String']['output'];
95
+ contentType: Scalars['String']['output'];
96
+ filename?: Maybe<Scalars['String']['output']>;
97
+ };
98
+ export type ChatWidgetSession = {
99
+ id: Scalars['ID']['output'];
100
+ };
101
+ export type CreateChatWidgetInput = {
102
+ name: Scalars['String']['input'];
103
+ };
104
+ export type Mutation = {
105
+ createChatWidget?: Maybe<ChatWidget>;
106
+ removeChatWidget?: Maybe<ChatWidget>;
107
+ sendMessageToChatWidget?: Maybe<Scalars['Void']['output']>;
108
+ startChatWidgetSession?: Maybe<ChatWidgetSession>;
109
+ updateChatWidget?: Maybe<ChatWidget>;
110
+ version?: Maybe<Scalars['String']['output']>;
111
+ };
112
+ export type MutationCreateChatWidgetArgs = {
113
+ input: CreateChatWidgetInput;
114
+ };
115
+ export type MutationRemoveChatWidgetArgs = {
116
+ input: RemoveChatWidgetInput;
117
+ };
118
+ export type MutationSendMessageToChatWidgetArgs = {
119
+ input: SendMessageToChatWidgetInput;
120
+ };
121
+ export type MutationStartChatWidgetSessionArgs = {
122
+ input: StartChatWidgetSessionInput;
123
+ };
124
+ export type MutationUpdateChatWidgetArgs = {
125
+ input: UpdateChatWidgetInput;
126
+ };
127
+ export type PageInfo = {
128
+ hasNext: Scalars['Boolean']['output'];
129
+ next?: Maybe<Scalars['Base64']['output']>;
130
+ };
131
+ export type Query = {
132
+ app?: Maybe<Scalars['DRN']['output']>;
133
+ getChatWidget?: Maybe<ChatWidget>;
134
+ getHttpEndpoint?: Maybe<Scalars['String']['output']>;
135
+ getWsEndpoint?: Maybe<Scalars['String']['output']>;
136
+ listChatWidgets: Array<ChatWidget>;
137
+ version?: Maybe<Scalars['String']['output']>;
138
+ };
139
+ export type QueryGetChatWidgetArgs = {
140
+ id: Scalars['ID']['input'];
141
+ };
142
+ export type RemoveChatWidgetInput = {
143
+ id: Scalars['ID']['input'];
144
+ };
145
+ export type SendMessageToChatWidgetInput = {
146
+ content: Scalars['String']['input'];
147
+ contentType: Scalars['String']['input'];
148
+ sessionId: Scalars['ID']['input'];
149
+ };
150
+ export type StartChatWidgetSessionInput = {
151
+ chatId: Scalars['ID']['input'];
152
+ };
153
+ export type Subscription = {
154
+ onChatWidgetMessage: ChatWidgetMessage;
155
+ version?: Maybe<Scalars['String']['output']>;
156
+ };
157
+ export type SubscriptionOnChatWidgetMessageArgs = {
158
+ sessionId: Scalars['ID']['input'];
159
+ };
160
+ export declare enum SubscriptionAction {
161
+ Created = "CREATED",
162
+ Removed = "REMOVED",
163
+ Updated = "UPDATED"
164
+ }
165
+ export declare enum Typenames {
166
+ Any = "Any",
167
+ ChatWidgetSessions = "ChatWidgetSessions",
168
+ ChatWidgets = "ChatWidgets",
169
+ GraphqlConnections = "GraphqlConnections",
170
+ GraphqlSubscriptions = "GraphqlSubscriptions"
171
+ }
172
+ export type UpdateChatWidgetInput = {
173
+ id: Scalars['ID']['input'];
174
+ name: Scalars['String']['input'];
175
+ };
176
+ export type ChatWidgetFragment = Pick<ChatWidget, 'id' | 'name'>;
177
+ export type ChatWidgetMessageFragment = (Pick<ChatWidgetMessage, 'id'> & {
178
+ payload: Array<Pick<ChatWidgetMessagePayload, 'contentType' | 'content' | 'filename'>>;
179
+ });
180
+ export type GetChatWidgetQueryVariables = Exact<{
181
+ id: Scalars['ID']['input'];
182
+ }>;
183
+ export type GetChatWidgetQuery = {
184
+ getChatWidget?: Maybe<ChatWidgetFragment>;
185
+ };
186
+ export type ListChatWidgetsQueryVariables = Exact<{
187
+ [key: string]: never;
188
+ }>;
189
+ export type ListChatWidgetsQuery = {
190
+ listChatWidgets: Array<ChatWidgetFragment>;
191
+ };
192
+ export type CreateChatWidgetMutationVariables = Exact<{
193
+ input: CreateChatWidgetInput;
194
+ }>;
195
+ export type CreateChatWidgetMutation = {
196
+ createChatWidget?: Maybe<ChatWidgetFragment>;
197
+ };
198
+ export type UpdateChatWidgetMutationVariables = Exact<{
199
+ input: UpdateChatWidgetInput;
200
+ }>;
201
+ export type UpdateChatWidgetMutation = {
202
+ updateChatWidget?: Maybe<ChatWidgetFragment>;
203
+ };
204
+ export type RemoveChatWidgetMutationVariables = Exact<{
205
+ input: RemoveChatWidgetInput;
206
+ }>;
207
+ export type RemoveChatWidgetMutation = {
208
+ removeChatWidget?: Maybe<ChatWidgetFragment>;
209
+ };
210
+ export type StartChatWidgetSessionMutationVariables = Exact<{
211
+ input: StartChatWidgetSessionInput;
212
+ }>;
213
+ export type StartChatWidgetSessionMutation = {
214
+ startChatWidgetSession?: Maybe<Pick<ChatWidgetSession, 'id'>>;
215
+ };
216
+ export type SendMessageToChatWidgetMutationVariables = Exact<{
217
+ input: SendMessageToChatWidgetInput;
218
+ }>;
219
+ export type SendMessageToChatWidgetMutation = Pick<Mutation, 'sendMessageToChatWidget'>;
220
+ export type OnChatWidgetMessageSubscriptionVariables = Exact<{
221
+ sessionId: Scalars['ID']['input'];
222
+ }>;
223
+ export type OnChatWidgetMessageSubscription = {
224
+ onChatWidgetMessage: ChatWidgetMessageFragment;
225
+ };
226
+ export declare const ChatWidgetFragmentDoc = "\n fragment chatWidget on ChatWidget {\n id\n name\n}\n ";
227
+ export declare const ChatWidgetMessageFragmentDoc = "\n fragment chatWidgetMessage on ChatWidgetMessage {\n id\n payload {\n contentType\n content\n filename\n }\n}\n ";
228
+ export declare const GetChatWidgetDocument = "\n query getChatWidget($id: ID!) {\n getChatWidget(id: $id) {\n ...chatWidget\n }\n}\n \n fragment chatWidget on ChatWidget {\n id\n name\n}\n ";
229
+ export declare const ListChatWidgetsDocument = "\n query listChatWidgets {\n listChatWidgets {\n ...chatWidget\n }\n}\n \n fragment chatWidget on ChatWidget {\n id\n name\n}\n ";
230
+ export declare const CreateChatWidgetDocument = "\n mutation createChatWidget($input: CreateChatWidgetInput!) {\n createChatWidget(input: $input) {\n ...chatWidget\n }\n}\n \n fragment chatWidget on ChatWidget {\n id\n name\n}\n ";
231
+ export declare const UpdateChatWidgetDocument = "\n mutation updateChatWidget($input: UpdateChatWidgetInput!) {\n updateChatWidget(input: $input) {\n ...chatWidget\n }\n}\n \n fragment chatWidget on ChatWidget {\n id\n name\n}\n ";
232
+ export declare const RemoveChatWidgetDocument = "\n mutation removeChatWidget($input: RemoveChatWidgetInput!) {\n removeChatWidget(input: $input) {\n ...chatWidget\n }\n}\n \n fragment chatWidget on ChatWidget {\n id\n name\n}\n ";
233
+ export declare const StartChatWidgetSessionDocument = "\n mutation startChatWidgetSession($input: StartChatWidgetSessionInput!) {\n startChatWidgetSession(input: $input) {\n id\n }\n}\n ";
234
+ export declare const SendMessageToChatWidgetDocument = "\n mutation sendMessageToChatWidget($input: SendMessageToChatWidgetInput!) {\n sendMessageToChatWidget(input: $input)\n}\n ";
235
+ export declare const OnChatWidgetMessageDocument = "\n subscription onChatWidgetMessage($sessionId: ID!) {\n onChatWidgetMessage(sessionId: $sessionId) {\n ...chatWidgetMessage\n }\n}\n \n fragment chatWidgetMessage on ChatWidgetMessage {\n id\n payload {\n contentType\n content\n filename\n }\n}\n ";
236
+ export type Requester<C = {}, E = unknown> = <R, V>(doc: string, vars?: V, options?: C) => Promise<R> | AsyncIterableIterator<R>;
237
+ export declare function getSdk<C, E>(requester: Requester<C, E>): {
238
+ getChatWidget(variables: GetChatWidgetQueryVariables, options?: C): Promise<GetChatWidgetQuery>;
239
+ listChatWidgets(variables?: ListChatWidgetsQueryVariables, options?: C): Promise<ListChatWidgetsQuery>;
240
+ createChatWidget(variables: CreateChatWidgetMutationVariables, options?: C): Promise<CreateChatWidgetMutation>;
241
+ updateChatWidget(variables: UpdateChatWidgetMutationVariables, options?: C): Promise<UpdateChatWidgetMutation>;
242
+ removeChatWidget(variables: RemoveChatWidgetMutationVariables, options?: C): Promise<RemoveChatWidgetMutation>;
243
+ startChatWidgetSession(variables: StartChatWidgetSessionMutationVariables, options?: C): Promise<StartChatWidgetSessionMutation>;
244
+ sendMessageToChatWidget(variables: SendMessageToChatWidgetMutationVariables, options?: C): Promise<SendMessageToChatWidgetMutation>;
245
+ onChatWidgetMessage(variables: OnChatWidgetMessageSubscriptionVariables, options?: C): AsyncIterableIterator<OnChatWidgetMessageSubscription>;
246
+ };
247
+ export type Sdk = ReturnType<typeof getSdk>;
248
+ export declare const serviceName = "@droz/chatwidget";
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ /* istanbul ignore file */
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;
5
+ var SubscriptionAction;
6
+ (function (SubscriptionAction) {
7
+ SubscriptionAction["Created"] = "CREATED";
8
+ SubscriptionAction["Removed"] = "REMOVED";
9
+ SubscriptionAction["Updated"] = "UPDATED";
10
+ })(SubscriptionAction || (exports.SubscriptionAction = SubscriptionAction = {}));
11
+ var Typenames;
12
+ (function (Typenames) {
13
+ Typenames["Any"] = "Any";
14
+ Typenames["ChatWidgetSessions"] = "ChatWidgetSessions";
15
+ Typenames["ChatWidgets"] = "ChatWidgets";
16
+ Typenames["GraphqlConnections"] = "GraphqlConnections";
17
+ Typenames["GraphqlSubscriptions"] = "GraphqlSubscriptions";
18
+ })(Typenames || (exports.Typenames = Typenames = {}));
19
+ exports.ChatWidgetFragmentDoc = `
20
+ fragment chatWidget on ChatWidget {
21
+ id
22
+ name
23
+ }
24
+ `;
25
+ exports.ChatWidgetMessageFragmentDoc = `
26
+ fragment chatWidgetMessage on ChatWidgetMessage {
27
+ id
28
+ payload {
29
+ contentType
30
+ content
31
+ filename
32
+ }
33
+ }
34
+ `;
35
+ exports.GetChatWidgetDocument = `
36
+ query getChatWidget($id: ID!) {
37
+ getChatWidget(id: $id) {
38
+ ...chatWidget
39
+ }
40
+ }
41
+ ${exports.ChatWidgetFragmentDoc}`;
42
+ exports.ListChatWidgetsDocument = `
43
+ query listChatWidgets {
44
+ listChatWidgets {
45
+ ...chatWidget
46
+ }
47
+ }
48
+ ${exports.ChatWidgetFragmentDoc}`;
49
+ exports.CreateChatWidgetDocument = `
50
+ mutation createChatWidget($input: CreateChatWidgetInput!) {
51
+ createChatWidget(input: $input) {
52
+ ...chatWidget
53
+ }
54
+ }
55
+ ${exports.ChatWidgetFragmentDoc}`;
56
+ exports.UpdateChatWidgetDocument = `
57
+ mutation updateChatWidget($input: UpdateChatWidgetInput!) {
58
+ updateChatWidget(input: $input) {
59
+ ...chatWidget
60
+ }
61
+ }
62
+ ${exports.ChatWidgetFragmentDoc}`;
63
+ exports.RemoveChatWidgetDocument = `
64
+ mutation removeChatWidget($input: RemoveChatWidgetInput!) {
65
+ removeChatWidget(input: $input) {
66
+ ...chatWidget
67
+ }
68
+ }
69
+ ${exports.ChatWidgetFragmentDoc}`;
70
+ exports.StartChatWidgetSessionDocument = `
71
+ mutation startChatWidgetSession($input: StartChatWidgetSessionInput!) {
72
+ startChatWidgetSession(input: $input) {
73
+ id
74
+ }
75
+ }
76
+ `;
77
+ exports.SendMessageToChatWidgetDocument = `
78
+ mutation sendMessageToChatWidget($input: SendMessageToChatWidgetInput!) {
79
+ sendMessageToChatWidget(input: $input)
80
+ }
81
+ `;
82
+ exports.OnChatWidgetMessageDocument = `
83
+ subscription onChatWidgetMessage($sessionId: ID!) {
84
+ onChatWidgetMessage(sessionId: $sessionId) {
85
+ ...chatWidgetMessage
86
+ }
87
+ }
88
+ ${exports.ChatWidgetMessageFragmentDoc}`;
89
+ function getSdk(requester) {
90
+ return {
91
+ getChatWidget(variables, options) {
92
+ return requester(exports.GetChatWidgetDocument, variables, options);
93
+ },
94
+ listChatWidgets(variables, options) {
95
+ return requester(exports.ListChatWidgetsDocument, variables, options);
96
+ },
97
+ createChatWidget(variables, options) {
98
+ return requester(exports.CreateChatWidgetDocument, variables, options);
99
+ },
100
+ updateChatWidget(variables, options) {
101
+ return requester(exports.UpdateChatWidgetDocument, variables, options);
102
+ },
103
+ removeChatWidget(variables, options) {
104
+ return requester(exports.RemoveChatWidgetDocument, variables, options);
105
+ },
106
+ startChatWidgetSession(variables, options) {
107
+ return requester(exports.StartChatWidgetSessionDocument, variables, options);
108
+ },
109
+ sendMessageToChatWidget(variables, options) {
110
+ return requester(exports.SendMessageToChatWidgetDocument, variables, options);
111
+ },
112
+ onChatWidgetMessage(variables, options) {
113
+ return requester(exports.OnChatWidgetMessageDocument, variables, options);
114
+ }
115
+ };
116
+ }
117
+ exports.getSdk = getSdk;
118
+ exports.serviceName = '@droz/chatwidget';
@@ -92,10 +92,17 @@ export type CreateDrozBotTicketCommentInput = {
92
92
  ticketId: Scalars['ID']['input'];
93
93
  };
94
94
  export type CreateDrozBotTicketInput = {
95
- comment: Scalars['String']['input'];
95
+ comment?: InputMaybe<Scalars['String']['input']>;
96
96
  instanceId: Scalars['ID']['input'];
97
- subject: Scalars['String']['input'];
98
- tags: Array<InputMaybe<Scalars['String']['input']>>;
97
+ profile?: InputMaybe<CreateDrozBotTicketProfileInput>;
98
+ summary?: InputMaybe<Scalars['String']['input']>;
99
+ tags?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
100
+ };
101
+ export type CreateDrozBotTicketProfileInput = {
102
+ email?: InputMaybe<Scalars['String']['input']>;
103
+ identifier?: InputMaybe<Scalars['ID']['input']>;
104
+ name?: InputMaybe<Scalars['String']['input']>;
105
+ phone?: InputMaybe<Scalars['String']['input']>;
99
106
  };
100
107
  export type DrozBotInstance = {
101
108
  credentialsId: Scalars['ID']['output'];