@droz-js/sdk 0.1.4 → 0.2.1

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/README.md CHANGED
@@ -23,22 +23,65 @@ DrozSdk.forTenant('dev');
23
23
  DrozSdk.withAuthentication('Basic', 'username', 'password');
24
24
  ```
25
25
 
26
- ## Sample Sdks
26
+ ## Websocket
27
+
28
+ For websockets we use `graphql-ws` protocol with `AsyncIterator` to handle the subscriptions. The sdk will automatically
29
+ handle the connection and reconnection for you,
30
+ see https://the-guild.dev/graphql/ws/recipes#client-usage-with-asynciterator
31
+ on how to use the `AsyncIterator`.
32
+
33
+ ### Example with `AsyncIterator`
34
+
35
+ ```typescript
36
+ import { DrozSdk } from '@droz-js/sdk';
37
+ import { DrozChat } from '@droz-js/sdk/drozchat';
38
+
39
+ DrozSdk.forTenant('dev');
40
+
41
+ const chat = new DrozChat();
42
+ const iterable = chat.onTicketInQueue();
43
+ for await (const result of iterable) {
44
+ console.log(result);
45
+ }
46
+ ```
47
+
48
+ #### For the React developers
49
+
50
+ ```typescript
51
+ import { DrozSdk } from '@droz-js/sdk';
52
+ import { DrozChat } from '@droz-js/sdk/drozchat';
53
+
54
+ DrozSdk.forTenant('dev');
55
+
56
+ function useOnTicketInQueue() {
57
+ const chat = new DrozChat();
58
+ const [tickets, setTickets] = useState<Ticket[]>([]);
59
+
60
+ useEffect(() => {
61
+ const subscription = chat.onTicketInQueue();
62
+
63
+ // YES I KNOW, REACT SUCKS
64
+ (async () => {
65
+ // attention! this is just an example what you do with the result is up to you
66
+ for await (const each of subscription) setTickets(tickets => [...tickets, each]);
67
+ })();
68
+
69
+ // this is required to close the subscription when the component unmounts
70
+ return () => subscription.return();
71
+ }, []);
72
+ }
73
+ ```
74
+
75
+ ## Available Sdks
27
76
 
28
77
  ### Droz Nexo
29
78
 
30
79
  ```typescript
31
80
  import { DrozNexo } from '@droz-js/sdk/droznexo';
32
-
33
- const nexo = new DrozNexo();
34
- const res = await nexo.getAgent({ id: 'agentId' });
35
81
  ```
36
82
 
37
83
  ### Droz Chat
38
84
 
39
85
  ```typescript
40
86
  import { DrozChat } from '@droz-js/sdk/drozchat';
41
-
42
- const chat = new DrozChat();
43
- const res = await chat.listTicketsMine();
44
87
  ```
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@droz-js/sdk",
3
3
  "description": "Droz SDK",
4
- "version": "0.1.4",
4
+ "version": "0.2.1",
5
5
  "private": false,
6
6
  "exports": {
7
7
  ".": "./src/index.js",
@@ -20,8 +20,10 @@
20
20
  "graphql": "^16.8.1",
21
21
  "graphql-tag": "^2.12.6",
22
22
  "graphql-ws": "^5.14.1",
23
- "inbatches": "^0.0.10",
24
- "zen-observable": "^0.10.0"
23
+ "inbatches": "^0.0.10"
24
+ },
25
+ "devDependencies": {
26
+ "mock-socket": "^9.3.1"
25
27
  },
26
28
  "files": [
27
29
  "package.json",
@@ -52,9 +52,14 @@ class DrozSdkConfig {
52
52
  }
53
53
  async initialize() {
54
54
  this.initialized = true;
55
+ // fetch instances from discovery service
55
56
  const data = await fetch(`${discoveryEndpoint}/discover/${this.tenant}`);
56
57
  const json = await data.json();
57
- this.instances = json.instances;
58
+ this.instances = json.instances ?? [];
59
+ // validate it's a valid tenant
60
+ if (this.instances.length === 0) {
61
+ throw new Error(`Invalid tenant '${this.tenant}', no instances found`);
62
+ }
58
63
  return this;
59
64
  }
60
65
  }
@@ -1,4 +1,6 @@
1
- import Observable from 'zen-observable';
2
- type Requester<C = {}> = <R, V>(doc: string, vars?: V, options?: C) => Promise<R> | Observable<R>;
1
+ export declare const emptyAsyncIterator: <R>() => {
2
+ [Symbol.asyncIterator](): AsyncIterator<R, any, undefined>;
3
+ };
4
+ type Requester<C = {}> = <R, V>(doc: string, vars?: V, options?: C) => Promise<R> | AsyncIterable<R>;
3
5
  export declare function HttpClientBuilder<Sdk>(serviceName: string, getSdk: (requester: Requester<Sdk>) => Sdk): new () => Sdk;
4
6
  export {};
@@ -1,24 +1,26 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HttpClientBuilder = void 0;
4
- const zen_observable_1 = require("zen-observable");
12
+ exports.HttpClientBuilder = exports.emptyAsyncIterator = void 0;
13
+ const inbatches_1 = require("inbatches");
5
14
  const config_1 = require("./config");
15
+ const utils_1 = require("./utils");
16
+ const emptyAsyncIterator = () => ({
17
+ async *[Symbol.asyncIterator]() { }
18
+ });
19
+ exports.emptyAsyncIterator = emptyAsyncIterator;
6
20
  function buildRequestInfo(req) {
7
21
  const operationNames = Array.isArray(req) ? req.map(r => r.operationName) : [req.operationName];
8
22
  return [...new Set(operationNames)].join(',');
9
23
  }
10
- function onResponse(response) {
11
- if (response && 'stack' in response && 'message' in response)
12
- throw response;
13
- function intercept(r) {
14
- if (r.errors)
15
- console.error(JSON.stringify(r.errors));
16
- return r.data;
17
- }
18
- if (Array.isArray(response))
19
- return response.map(intercept);
20
- return intercept(response);
21
- }
22
24
  class HttpSdkRequesterBuilder {
23
25
  serviceName;
24
26
  constructor(serviceName) {
@@ -30,12 +32,11 @@ class HttpSdkRequesterBuilder {
30
32
  requester(query, variables) {
31
33
  // subscriptions are not executable with the http sdk
32
34
  if (query.match(/subscription .*{/))
33
- return zen_observable_1.default.of();
35
+ return (0, exports.emptyAsyncIterator)();
34
36
  // extract operation name and enqueue the request to be executed in batches
35
37
  const operationName = /(?:query|mutation) ([^({ ]*)/.exec(query)?.[1];
36
- return this.inbatches({ query, variables, operationName }).then(onResponse);
38
+ return this.inbatches({ query, variables, operationName }).then(utils_1.mapGraphqlResponse);
37
39
  }
38
- // @InBatches({ maxBatchSize: 12 })
39
40
  async inbatches(request) {
40
41
  const config = await config_1.DrozSdk.config();
41
42
  const endpoint = config.getEndpoint(this.serviceName, 'http');
@@ -54,6 +55,12 @@ class HttpSdkRequesterBuilder {
54
55
  return await response.json();
55
56
  }
56
57
  }
58
+ __decorate([
59
+ (0, inbatches_1.InBatches)({ maxBatchSize: 12 }),
60
+ __metadata("design:type", Function),
61
+ __metadata("design:paramtypes", [Object]),
62
+ __metadata("design:returntype", Promise)
63
+ ], HttpSdkRequesterBuilder.prototype, "inbatches", null);
57
64
  function HttpClientBuilder(serviceName, getSdk) {
58
65
  class Client {
59
66
  constructor() {
@@ -0,0 +1,3 @@
1
+ import { ExecutionResult } from 'graphql/index';
2
+ export declare function mapGraphqlResponse<T>(response: ExecutionResult<T> | Error): T;
3
+ export declare function mapAsyncIterableGraphqlResponse<T>(iterable: AsyncIterableIterator<ExecutionResult<T, any>>): AsyncGenerator<Awaited<T>, void, unknown>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapAsyncIterableGraphqlResponse = exports.mapGraphqlResponse = void 0;
4
+ function mapGraphqlResponse(response) {
5
+ if (response && 'stack' in response && 'message' in response)
6
+ throw response;
7
+ if ('errors' in response)
8
+ console.error(JSON.stringify(response.errors));
9
+ if ('data' in response)
10
+ return response.data;
11
+ }
12
+ exports.mapGraphqlResponse = mapGraphqlResponse;
13
+ async function* mapAsyncIterableGraphqlResponse(iterable) {
14
+ for await (const each of iterable) {
15
+ yield mapGraphqlResponse(each);
16
+ }
17
+ }
18
+ exports.mapAsyncIterableGraphqlResponse = mapAsyncIterableGraphqlResponse;
@@ -1,4 +1,7 @@
1
- import Observable from 'zen-observable';
2
- type Requester<C = {}> = <R, V>(doc: string, vars?: V, options?: C) => Promise<R> | Observable<R>;
3
- export declare function WsClientBuilder<Sdk>(serviceName: string, getSdk: (requester: Requester<Sdk>) => Sdk): new () => Sdk;
1
+ import { Client } from 'graphql-ws';
2
+ type Requester<C = {}> = <R, V>(doc: string, vars?: V, options?: C) => Promise<R> | AsyncIterable<R>;
3
+ type Connect = {
4
+ connect(): Promise<Client>;
5
+ };
6
+ export declare function WsClientBuilder<Sdk>(serviceName: string, getSdk: (requester: Requester<Sdk>) => Sdk): new () => Sdk & Connect;
4
7
  export {};
package/src/client/ws.js CHANGED
@@ -2,52 +2,20 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WsClientBuilder = void 0;
4
4
  const graphql_ws_1 = require("graphql-ws");
5
- const zen_observable_1 = require("zen-observable");
6
5
  const config_1 = require("./config");
6
+ const utils_1 = require("./utils");
7
7
  class WsSdkRequesterBuilder {
8
8
  serviceName;
9
- _client;
9
+ client;
10
10
  constructor(serviceName) {
11
11
  this.serviceName = serviceName;
12
12
  }
13
- build() {
14
- return this.requester.bind(this);
15
- }
16
- async requester(query, variables) {
17
- const client = await this.getClient();
18
- const isSubscription = query.trim().startsWith('subscription ');
19
- const operation = { query, variables };
20
- if (isSubscription) {
21
- return new zen_observable_1.default((observer) => {
22
- return client.subscribe(operation, {
23
- next: response => {
24
- if (response.errors)
25
- console.error(response.errors);
26
- observer.next(response.data);
27
- },
28
- error: error => observer.error(error),
29
- complete: () => observer.complete()
30
- });
31
- });
32
- }
33
- return new Promise((resolve, reject) => {
34
- client.subscribe(operation, {
35
- next: response => {
36
- if (response.errors)
37
- console.error(response.errors);
38
- resolve(response.data);
39
- },
40
- error: error => reject(error),
41
- complete: () => void 0
42
- });
43
- });
44
- }
45
- async getClient() {
46
- if (this._client)
47
- return this._client;
13
+ async connect() {
14
+ if (this.client)
15
+ return this.client;
48
16
  const config = await config_1.DrozSdk.config();
49
17
  const endpoint = config.getEndpoint(this.serviceName, 'ws');
50
- this._client = (0, graphql_ws_1.createClient)({
18
+ this.client = (0, graphql_ws_1.createClient)({
51
19
  url: endpoint,
52
20
  lazy: true,
53
21
  retryAttempts: 128,
@@ -56,16 +24,39 @@ class WsSdkRequesterBuilder {
56
24
  authorization: config.authentication
57
25
  }
58
26
  });
59
- return this._client;
27
+ return this.client;
28
+ }
29
+ build() {
30
+ return this.requester.bind(this);
31
+ }
32
+ requester(query, variables) {
33
+ if (!this.client)
34
+ throw new Error('Client not connected, you must call await client.connect(); first');
35
+ const isSubscription = query.trim().startsWith('subscription ');
36
+ const operation = { query, variables };
37
+ const iterable = this.client.iterate(operation);
38
+ // subscription
39
+ if (isSubscription) {
40
+ return (0, utils_1.mapAsyncIterableGraphqlResponse)(iterable);
41
+ }
42
+ // single query or mutation
43
+ return iterable
44
+ .next()
45
+ .then(one => one.value)
46
+ .then(res => (0, utils_1.mapGraphqlResponse)(res));
60
47
  }
61
48
  }
62
49
  function WsClientBuilder(serviceName, getSdk) {
63
50
  class Client {
51
+ ws;
64
52
  constructor() {
65
- const http = new WsSdkRequesterBuilder(serviceName);
66
- const sdk = getSdk(http.build());
53
+ this.ws = new WsSdkRequesterBuilder(serviceName);
54
+ const sdk = getSdk(this.ws.build());
67
55
  Object.assign(this, sdk);
68
56
  }
57
+ async connect() {
58
+ return this.ws.connect();
59
+ }
69
60
  }
70
61
  return Client;
71
62
  }
@@ -1,18 +1,71 @@
1
1
  export * from './sdks/drozchat';
2
2
  export declare const DrozChatWs: new () => {
3
- getDrozBotInstance(variables: import("./sdks/drozbot").Exact<{
3
+ createCustomer(variables: import("./sdks/drozchat").Exact<{
4
+ input: import("./sdks/drozchat").CreateCustomerInput;
5
+ }>, options?: unknown): Promise<import("./sdks/drozchat").CreateCustomerMutation>;
6
+ updateCustomer(variables: import("./sdks/drozchat").Exact<{
7
+ input: import("./sdks/drozchat").UpdateCustomerInput;
8
+ }>, options?: unknown): Promise<import("./sdks/drozchat").UpdateCustomerMutation>;
9
+ listCustomers(variables?: import("./sdks/drozchat").Exact<{
10
+ next?: object;
11
+ }>, options?: unknown): Promise<import("./sdks/drozchat").ListCustomersQuery>;
12
+ getCustomer(variables: import("./sdks/drozchat").Exact<{
4
13
  id: string;
5
- }>, options?: unknown): Promise<import("./sdks/drozbot").GetDrozBotInstanceQuery>;
6
- listDrozBotInstances(variables?: import("./sdks/drozbot").Exact<{
14
+ }>, options?: unknown): Promise<import("./sdks/drozchat").GetCustomerQuery>;
15
+ getTicket(variables: import("./sdks/drozchat").Exact<{
16
+ id: string;
17
+ }>, options?: unknown): Promise<import("./sdks/drozchat").GetTicketQuery>;
18
+ listTickets(variables: import("./sdks/drozchat").Exact<{
19
+ state: import("./sdks/drozchat").TicketState;
20
+ assigneeId?: string;
21
+ next?: object;
22
+ }>, options?: unknown): Promise<import("./sdks/drozchat").ListTicketsQuery>;
23
+ listTicketsInQueue(variables?: import("./sdks/drozchat").Exact<{
24
+ next?: object;
25
+ }>, options?: unknown): Promise<import("./sdks/drozchat").ListTicketsInQueueQuery>;
26
+ listTicketsInProgressMine(variables?: import("./sdks/drozchat").Exact<{
27
+ next?: object;
28
+ }>, options?: unknown): Promise<import("./sdks/drozchat").ListTicketsInProgressMineQuery>;
29
+ listTicketsClosed(variables?: import("./sdks/drozchat").Exact<{
30
+ next?: object;
31
+ }>, options?: unknown): Promise<import("./sdks/drozchat").ListTicketsClosedQuery>;
32
+ listTicketMessages(variables: import("./sdks/drozchat").Exact<{
33
+ ticketId: string;
34
+ next?: object;
35
+ }>, options?: unknown): Promise<import("./sdks/drozchat").ListTicketMessagesQuery>;
36
+ createTicket(variables: import("./sdks/drozchat").Exact<{
37
+ input: import("./sdks/drozchat").CreateTicketInput;
38
+ }>, options?: unknown): Promise<import("./sdks/drozchat").CreateTicketMutation>;
39
+ markTicketMessagesAsRead(variables: import("./sdks/drozchat").Exact<{
40
+ input: import("./sdks/drozchat").MarkTicketMessagesAsReadInput;
41
+ }>, options?: unknown): Promise<import("./sdks/drozchat").MarkTicketMessagesAsReadMutation>;
42
+ createTicketMessage(variables: import("./sdks/drozchat").Exact<{
43
+ input: import("./sdks/drozchat").CreateTicketMessageInput;
44
+ }>, options?: unknown): Promise<import("./sdks/drozchat").CreateTicketMessageMutation>;
45
+ assignTicket(variables: import("./sdks/drozchat").Exact<{
46
+ input: import("./sdks/drozchat").AssignTicketInput;
47
+ }>, options?: unknown): Promise<import("./sdks/drozchat").AssignTicketMutation>;
48
+ assignTicketMyself(variables: import("./sdks/drozchat").Exact<{
49
+ input: import("./sdks/drozchat").AssignTicketMyselfInput;
50
+ }>, options?: unknown): Promise<import("./sdks/drozchat").AssignTicketMyselfMutation>;
51
+ unassignTicket(variables: import("./sdks/drozchat").Exact<{
52
+ input: import("./sdks/drozchat").UnassignTicketInput;
53
+ }>, options?: unknown): Promise<import("./sdks/drozchat").UnassignTicketMutation>;
54
+ closeTicket(variables: import("./sdks/drozchat").Exact<{
55
+ input: import("./sdks/drozchat").CloseTicketInput;
56
+ }>, options?: unknown): Promise<import("./sdks/drozchat").CloseTicketMutation>;
57
+ onTicketInQueue(variables?: import("./sdks/drozchat").Exact<{
58
+ [key: string]: never;
59
+ }>, options?: unknown): AsyncIterable<import("./sdks/drozchat").OnTicketInQueueSubscription>;
60
+ onTicketInProgressMine(variables?: import("./sdks/drozchat").Exact<{
61
+ [key: string]: never;
62
+ }>, options?: unknown): AsyncIterable<import("./sdks/drozchat").OnTicketInProgressMineSubscription>;
63
+ onTicketClosed(variables?: import("./sdks/drozchat").Exact<{
7
64
  [key: string]: never;
8
- }>, options?: unknown): Promise<import("./sdks/drozbot").ListDrozBotInstancesQuery>;
9
- createDrozBotInstance(variables: import("./sdks/drozbot").Exact<{
10
- input: import("./sdks/drozbot").CreateDrozBotInstanceInput;
11
- }>, options?: unknown): Promise<import("./sdks/drozbot").CreateDrozBotInstanceMutation>;
12
- updateDrozBotInstance(variables: import("./sdks/drozbot").Exact<{
13
- input: import("./sdks/drozbot").UpdateDrozBotInstanceInput;
14
- }>, options?: unknown): Promise<import("./sdks/drozbot").UpdateDrozBotInstanceMutation>;
15
- removeDrozBotInstance(variables: import("./sdks/drozbot").Exact<{
16
- input: import("./sdks/drozbot").RemoveDrozBotInstanceInput;
17
- }>, options?: unknown): Promise<import("./sdks/drozbot").RemoveDrozBotInstanceMutation>;
65
+ }>, options?: unknown): AsyncIterable<import("./sdks/drozchat").OnTicketClosedSubscription>;
66
+ onTicketMessage(variables: import("./sdks/drozchat").Exact<{
67
+ ticketId: string;
68
+ }>, options?: unknown): AsyncIterable<import("./sdks/drozchat").OnTicketMessageSubscription>;
69
+ } & {
70
+ connect(): Promise<import("graphql-ws").Client>;
18
71
  };
@@ -16,6 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.DrozChatWs = void 0;
18
18
  const ws_1 = require("./client/ws");
19
- const drozbot_1 = require("./sdks/drozbot");
19
+ const drozchat_1 = require("./sdks/drozchat");
20
20
  __exportStar(require("./sdks/drozchat"), exports);
21
- exports.DrozChatWs = (0, ws_1.WsClientBuilder)(drozbot_1.serviceName, drozbot_1.getSdk);
21
+ exports.DrozChatWs = (0, ws_1.WsClientBuilder)(drozchat_1.serviceName, drozchat_1.getSdk);
package/src/drozchat.d.ts CHANGED
@@ -1,18 +1,69 @@
1
1
  export * from './sdks/drozchat';
2
2
  export declare const DrozChat: new () => {
3
- getDrozBotInstance(variables: import("./sdks/drozbot").Exact<{
3
+ createCustomer(variables: import("./sdks/drozchat").Exact<{
4
+ input: import("./sdks/drozchat").CreateCustomerInput;
5
+ }>, options?: unknown): Promise<import("./sdks/drozchat").CreateCustomerMutation>;
6
+ updateCustomer(variables: import("./sdks/drozchat").Exact<{
7
+ input: import("./sdks/drozchat").UpdateCustomerInput;
8
+ }>, options?: unknown): Promise<import("./sdks/drozchat").UpdateCustomerMutation>;
9
+ listCustomers(variables?: import("./sdks/drozchat").Exact<{
10
+ next?: object;
11
+ }>, options?: unknown): Promise<import("./sdks/drozchat").ListCustomersQuery>;
12
+ getCustomer(variables: import("./sdks/drozchat").Exact<{
4
13
  id: string;
5
- }>, options?: unknown): Promise<import("./sdks/drozbot").GetDrozBotInstanceQuery>;
6
- listDrozBotInstances(variables?: import("./sdks/drozbot").Exact<{
14
+ }>, options?: unknown): Promise<import("./sdks/drozchat").GetCustomerQuery>;
15
+ getTicket(variables: import("./sdks/drozchat").Exact<{
16
+ id: string;
17
+ }>, options?: unknown): Promise<import("./sdks/drozchat").GetTicketQuery>;
18
+ listTickets(variables: import("./sdks/drozchat").Exact<{
19
+ state: import("./sdks/drozchat").TicketState;
20
+ assigneeId?: string;
21
+ next?: object;
22
+ }>, options?: unknown): Promise<import("./sdks/drozchat").ListTicketsQuery>;
23
+ listTicketsInQueue(variables?: import("./sdks/drozchat").Exact<{
24
+ next?: object;
25
+ }>, options?: unknown): Promise<import("./sdks/drozchat").ListTicketsInQueueQuery>;
26
+ listTicketsInProgressMine(variables?: import("./sdks/drozchat").Exact<{
27
+ next?: object;
28
+ }>, options?: unknown): Promise<import("./sdks/drozchat").ListTicketsInProgressMineQuery>;
29
+ listTicketsClosed(variables?: import("./sdks/drozchat").Exact<{
30
+ next?: object;
31
+ }>, options?: unknown): Promise<import("./sdks/drozchat").ListTicketsClosedQuery>;
32
+ listTicketMessages(variables: import("./sdks/drozchat").Exact<{
33
+ ticketId: string;
34
+ next?: object;
35
+ }>, options?: unknown): Promise<import("./sdks/drozchat").ListTicketMessagesQuery>;
36
+ createTicket(variables: import("./sdks/drozchat").Exact<{
37
+ input: import("./sdks/drozchat").CreateTicketInput;
38
+ }>, options?: unknown): Promise<import("./sdks/drozchat").CreateTicketMutation>;
39
+ markTicketMessagesAsRead(variables: import("./sdks/drozchat").Exact<{
40
+ input: import("./sdks/drozchat").MarkTicketMessagesAsReadInput;
41
+ }>, options?: unknown): Promise<import("./sdks/drozchat").MarkTicketMessagesAsReadMutation>;
42
+ createTicketMessage(variables: import("./sdks/drozchat").Exact<{
43
+ input: import("./sdks/drozchat").CreateTicketMessageInput;
44
+ }>, options?: unknown): Promise<import("./sdks/drozchat").CreateTicketMessageMutation>;
45
+ assignTicket(variables: import("./sdks/drozchat").Exact<{
46
+ input: import("./sdks/drozchat").AssignTicketInput;
47
+ }>, options?: unknown): Promise<import("./sdks/drozchat").AssignTicketMutation>;
48
+ assignTicketMyself(variables: import("./sdks/drozchat").Exact<{
49
+ input: import("./sdks/drozchat").AssignTicketMyselfInput;
50
+ }>, options?: unknown): Promise<import("./sdks/drozchat").AssignTicketMyselfMutation>;
51
+ unassignTicket(variables: import("./sdks/drozchat").Exact<{
52
+ input: import("./sdks/drozchat").UnassignTicketInput;
53
+ }>, options?: unknown): Promise<import("./sdks/drozchat").UnassignTicketMutation>;
54
+ closeTicket(variables: import("./sdks/drozchat").Exact<{
55
+ input: import("./sdks/drozchat").CloseTicketInput;
56
+ }>, options?: unknown): Promise<import("./sdks/drozchat").CloseTicketMutation>;
57
+ onTicketInQueue(variables?: import("./sdks/drozchat").Exact<{
58
+ [key: string]: never;
59
+ }>, options?: unknown): AsyncIterable<import("./sdks/drozchat").OnTicketInQueueSubscription>;
60
+ onTicketInProgressMine(variables?: import("./sdks/drozchat").Exact<{
61
+ [key: string]: never;
62
+ }>, options?: unknown): AsyncIterable<import("./sdks/drozchat").OnTicketInProgressMineSubscription>;
63
+ onTicketClosed(variables?: import("./sdks/drozchat").Exact<{
7
64
  [key: string]: never;
8
- }>, options?: unknown): Promise<import("./sdks/drozbot").ListDrozBotInstancesQuery>;
9
- createDrozBotInstance(variables: import("./sdks/drozbot").Exact<{
10
- input: import("./sdks/drozbot").CreateDrozBotInstanceInput;
11
- }>, options?: unknown): Promise<import("./sdks/drozbot").CreateDrozBotInstanceMutation>;
12
- updateDrozBotInstance(variables: import("./sdks/drozbot").Exact<{
13
- input: import("./sdks/drozbot").UpdateDrozBotInstanceInput;
14
- }>, options?: unknown): Promise<import("./sdks/drozbot").UpdateDrozBotInstanceMutation>;
15
- removeDrozBotInstance(variables: import("./sdks/drozbot").Exact<{
16
- input: import("./sdks/drozbot").RemoveDrozBotInstanceInput;
17
- }>, options?: unknown): Promise<import("./sdks/drozbot").RemoveDrozBotInstanceMutation>;
65
+ }>, options?: unknown): AsyncIterable<import("./sdks/drozchat").OnTicketClosedSubscription>;
66
+ onTicketMessage(variables: import("./sdks/drozchat").Exact<{
67
+ ticketId: string;
68
+ }>, options?: unknown): AsyncIterable<import("./sdks/drozchat").OnTicketMessageSubscription>;
18
69
  };
package/src/drozchat.js CHANGED
@@ -16,6 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.DrozChat = void 0;
18
18
  const http_1 = require("./client/http");
19
- const drozbot_1 = require("./sdks/drozbot");
19
+ const drozchat_1 = require("./sdks/drozchat");
20
20
  __exportStar(require("./sdks/drozchat"), exports);
21
- exports.DrozChat = (0, http_1.HttpClientBuilder)(drozbot_1.serviceName, drozbot_1.getSdk);
21
+ exports.DrozChat = (0, http_1.HttpClientBuilder)(drozchat_1.serviceName, drozchat_1.getSdk);
@@ -0,0 +1,18 @@
1
+ export * from './sdks/mercadolivre';
2
+ export declare const MercadoLivre: new () => {
3
+ getMercadoLivreInstance(variables: import("./sdks/mercadolivre").Exact<{
4
+ id: string;
5
+ }>, options?: unknown): Promise<import("./sdks/mercadolivre").GetMercadoLivreInstanceQuery>;
6
+ listMercadoLivreInstances(variables?: import("./sdks/mercadolivre").Exact<{
7
+ [key: string]: never;
8
+ }>, options?: unknown): Promise<import("./sdks/mercadolivre").ListMercadoLivreInstancesQuery>;
9
+ createMercadoLivreInstance(variables: import("./sdks/mercadolivre").Exact<{
10
+ input: import("./sdks/mercadolivre").CreateMercadoLivreInstanceInput;
11
+ }>, options?: unknown): Promise<import("./sdks/mercadolivre").CreateMercadoLivreInstanceMutation>;
12
+ updateMercadoLivreInstance(variables: import("./sdks/mercadolivre").Exact<{
13
+ input: import("./sdks/mercadolivre").UpdateMercadoLivreInstanceInput;
14
+ }>, options?: unknown): Promise<import("./sdks/mercadolivre").UpdateMercadoLivreInstanceMutation>;
15
+ removeMercadoLivreInstance(variables: import("./sdks/mercadolivre").Exact<{
16
+ input: import("./sdks/mercadolivre").RemoveMercadoLivreInstanceInput;
17
+ }>, options?: unknown): Promise<import("./sdks/mercadolivre").RemoveMercadoLivreInstanceMutation>;
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.MercadoLivre = void 0;
18
+ const http_1 = require("./client/http");
19
+ const mercadolivre_1 = require("./sdks/mercadolivre");
20
+ __exportStar(require("./sdks/mercadolivre"), exports);
21
+ exports.MercadoLivre = (0, http_1.HttpClientBuilder)(mercadolivre_1.serviceName, mercadolivre_1.getSdk);
@@ -1,4 +1,3 @@
1
- import Observable from 'zen-observable';
2
1
  export type Maybe<T> = T;
3
2
  export type InputMaybe<T> = T;
4
3
  export type Exact<T extends {
@@ -178,7 +177,7 @@ export declare const ListDrozBotInstancesDocument = "\n query listDrozBotInst
178
177
  export declare const CreateDrozBotInstanceDocument = "\n mutation createDrozBotInstance($input: CreateDrozBotInstanceInput!) {\n createDrozBotInstance(input: $input) {\n ...drozbot\n }\n}\n \n fragment drozbot on DrozBotInstance {\n id\n name\n credentialsId\n isTest\n}\n ";
179
178
  export declare const UpdateDrozBotInstanceDocument = "\n mutation updateDrozBotInstance($input: UpdateDrozBotInstanceInput!) {\n updateDrozBotInstance(input: $input) {\n ...drozbot\n }\n}\n \n fragment drozbot on DrozBotInstance {\n id\n name\n credentialsId\n isTest\n}\n ";
180
179
  export declare const RemoveDrozBotInstanceDocument = "\n mutation removeDrozBotInstance($input: RemoveDrozBotInstanceInput!) {\n removeDrozBotInstance(input: $input) {\n ...drozbot\n }\n}\n \n fragment drozbot on DrozBotInstance {\n id\n name\n credentialsId\n isTest\n}\n ";
181
- export type Requester<C = {}, E = unknown> = <R, V>(doc: string, vars?: V, options?: C) => Promise<R> | Observable<R>;
180
+ export type Requester<C = {}, E = unknown> = <R, V>(doc: string, vars?: V, options?: C) => Promise<R> | AsyncIterable<R>;
182
181
  export declare function getSdk<C, E>(requester: Requester<C, E>): {
183
182
  getDrozBotInstance(variables: GetDrozBotInstanceQueryVariables, options?: C): Promise<GetDrozBotInstanceQuery>;
184
183
  listDrozBotInstances(variables?: ListDrozBotInstancesQueryVariables, options?: C): Promise<ListDrozBotInstancesQuery>;
@@ -1,4 +1,3 @@
1
- import Observable from 'zen-observable';
2
1
  export type Maybe<T> = T;
3
2
  export type InputMaybe<T> = T;
4
3
  export type Exact<T extends {
@@ -496,7 +495,7 @@ export declare const OnTicketInQueueDocument = "\n subscription onTicketInQue
496
495
  export declare const OnTicketInProgressMineDocument = "\n subscription onTicketInProgressMine {\n onTicketInProgressMine {\n ticket {\n ...ticket\n }\n action\n }\n}\n \n fragment ticket on Ticket {\n id\n state\n status\n priority\n assignee {\n ...agent\n }\n customer {\n ...customer\n }\n messagesCount\n lastMessage\n lastMessageAt\n unreadMessagesCount\n createdAt\n updatedAt\n}\n \n\n fragment agent on Agent {\n id\n name\n email\n}\n \n\n fragment customer on Customer {\n id\n name\n email\n createdAt\n updatedAt\n}\n ";
497
496
  export declare const OnTicketClosedDocument = "\n subscription onTicketClosed {\n onTicketClosed {\n ticket {\n ...ticket\n }\n action\n }\n}\n \n fragment ticket on Ticket {\n id\n state\n status\n priority\n assignee {\n ...agent\n }\n customer {\n ...customer\n }\n messagesCount\n lastMessage\n lastMessageAt\n unreadMessagesCount\n createdAt\n updatedAt\n}\n \n\n fragment agent on Agent {\n id\n name\n email\n}\n \n\n fragment customer on Customer {\n id\n name\n email\n createdAt\n updatedAt\n}\n ";
498
497
  export declare const OnTicketMessageDocument = "\n subscription onTicketMessage($ticketId: ID!) {\n onTicketMessage(ticketId: $ticketId) {\n message {\n ...ticketMessage\n }\n action\n }\n}\n \n fragment ticketMessage on TicketMessage {\n id\n ticketId\n sentBy\n type\n contentType\n body\n createdAt\n updatedAt\n}\n ";
499
- export type Requester<C = {}, E = unknown> = <R, V>(doc: string, vars?: V, options?: C) => Promise<R> | Observable<R>;
498
+ export type Requester<C = {}, E = unknown> = <R, V>(doc: string, vars?: V, options?: C) => Promise<R> | AsyncIterable<R>;
500
499
  export declare function getSdk<C, E>(requester: Requester<C, E>): {
501
500
  createCustomer(variables: CreateCustomerMutationVariables, options?: C): Promise<CreateCustomerMutation>;
502
501
  updateCustomer(variables: UpdateCustomerMutationVariables, options?: C): Promise<UpdateCustomerMutation>;
@@ -515,10 +514,10 @@ export declare function getSdk<C, E>(requester: Requester<C, E>): {
515
514
  assignTicketMyself(variables: AssignTicketMyselfMutationVariables, options?: C): Promise<AssignTicketMyselfMutation>;
516
515
  unassignTicket(variables: UnassignTicketMutationVariables, options?: C): Promise<UnassignTicketMutation>;
517
516
  closeTicket(variables: CloseTicketMutationVariables, options?: C): Promise<CloseTicketMutation>;
518
- onTicketInQueue(variables?: OnTicketInQueueSubscriptionVariables, options?: C): Observable<OnTicketInQueueSubscription>;
519
- onTicketInProgressMine(variables?: OnTicketInProgressMineSubscriptionVariables, options?: C): Observable<OnTicketInProgressMineSubscription>;
520
- onTicketClosed(variables?: OnTicketClosedSubscriptionVariables, options?: C): Observable<OnTicketClosedSubscription>;
521
- onTicketMessage(variables: OnTicketMessageSubscriptionVariables, options?: C): Observable<OnTicketMessageSubscription>;
517
+ onTicketInQueue(variables?: OnTicketInQueueSubscriptionVariables, options?: C): AsyncIterable<OnTicketInQueueSubscription>;
518
+ onTicketInProgressMine(variables?: OnTicketInProgressMineSubscriptionVariables, options?: C): AsyncIterable<OnTicketInProgressMineSubscription>;
519
+ onTicketClosed(variables?: OnTicketClosedSubscriptionVariables, options?: C): AsyncIterable<OnTicketClosedSubscription>;
520
+ onTicketMessage(variables: OnTicketMessageSubscriptionVariables, options?: C): AsyncIterable<OnTicketMessageSubscription>;
522
521
  };
523
522
  export type Sdk = ReturnType<typeof getSdk>;
524
523
  export declare const serviceName = "@droz/drozchat";
@@ -1,4 +1,3 @@
1
- import Observable from 'zen-observable';
2
1
  export type Maybe<T> = T;
3
2
  export type InputMaybe<T> = T;
4
3
  export type Exact<T extends {
@@ -206,7 +205,7 @@ export declare const ListAgentsDocument = "\n query listAgents($next: Base64)
206
205
  export declare const GetAgentDocument = "\n query getAgent($id: ID!) {\n getAgent(id: $id) {\n ...agent\n }\n}\n \n fragment agent on Agent {\n id\n name\n groupIds\n createdAt\n updatedAt\n groups {\n ...agentGroup\n }\n}\n \n\n fragment agentGroup on AgentGroup {\n id\n name\n createdAt\n updatedAt\n}\n ";
207
206
  export declare const CreateAgentGroupDocument = "\n mutation createAgentGroup($input: CreateAgentGroupInput!) {\n createAgentGroup(input: $input) {\n ...agentGroup\n }\n}\n \n fragment agentGroup on AgentGroup {\n id\n name\n createdAt\n updatedAt\n}\n ";
208
207
  export declare const ListAgentGroupsDocument = "\n query listAgentGroups($next: Base64) {\n listAgentGroups(next: $next) {\n pageInfo {\n hasNext\n next\n }\n nodes {\n ...agentGroup\n }\n }\n}\n \n fragment agentGroup on AgentGroup {\n id\n name\n createdAt\n updatedAt\n}\n ";
209
- export type Requester<C = {}, E = unknown> = <R, V>(doc: string, vars?: V, options?: C) => Promise<R> | Observable<R>;
208
+ export type Requester<C = {}, E = unknown> = <R, V>(doc: string, vars?: V, options?: C) => Promise<R> | AsyncIterable<R>;
210
209
  export declare function getSdk<C, E>(requester: Requester<C, E>): {
211
210
  createAgent(variables: CreateAgentMutationVariables, options?: C): Promise<CreateAgentMutation>;
212
211
  listAgents(variables?: ListAgentsQueryVariables, options?: C): Promise<ListAgentsQuery>;
@@ -0,0 +1,193 @@
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: 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 CreateMercadoLivreInstanceInput = {
86
+ credentialId?: InputMaybe<Scalars['ID']['input']>;
87
+ name: Scalars['String']['input'];
88
+ type: MercadoLivreInstanceType;
89
+ };
90
+ export type MercadoLivreInstance = {
91
+ credentialId?: Maybe<Scalars['ID']['output']>;
92
+ cronJobId?: Maybe<Scalars['ID']['output']>;
93
+ id: Scalars['ID']['output'];
94
+ name: Scalars['String']['output'];
95
+ type: MercadoLivreInstanceType;
96
+ };
97
+ export declare enum MercadoLivreInstanceType {
98
+ PosVenda = "POS_VENDA",
99
+ PreVenda = "PRE_VENDA",
100
+ Reclamacao = "RECLAMACAO"
101
+ }
102
+ export type Mutation = {
103
+ createMercadoLivreInstance?: Maybe<MercadoLivreInstance>;
104
+ removeMercadoLivreInstance?: Maybe<MercadoLivreInstance>;
105
+ updateMercadoLivreInstance?: Maybe<MercadoLivreInstance>;
106
+ version?: Maybe<Scalars['String']['output']>;
107
+ };
108
+ export type MutationCreateMercadoLivreInstanceArgs = {
109
+ input: CreateMercadoLivreInstanceInput;
110
+ };
111
+ export type MutationRemoveMercadoLivreInstanceArgs = {
112
+ input: RemoveMercadoLivreInstanceInput;
113
+ };
114
+ export type MutationUpdateMercadoLivreInstanceArgs = {
115
+ input: UpdateMercadoLivreInstanceInput;
116
+ };
117
+ export type PageInfo = {
118
+ hasNext: Scalars['Boolean']['output'];
119
+ next?: Maybe<Scalars['Base64']['output']>;
120
+ };
121
+ export type Query = {
122
+ app?: Maybe<Scalars['DRN']['output']>;
123
+ getMercadoLivreInstance?: Maybe<MercadoLivreInstance>;
124
+ listMercadoLivreInstances: Array<MercadoLivreInstance>;
125
+ version?: Maybe<Scalars['String']['output']>;
126
+ };
127
+ export type QueryGetMercadoLivreInstanceArgs = {
128
+ id: Scalars['ID']['input'];
129
+ };
130
+ export type RemoveMercadoLivreInstanceInput = {
131
+ id: Scalars['ID']['input'];
132
+ };
133
+ export type Subscription = {
134
+ version?: Maybe<Scalars['String']['output']>;
135
+ };
136
+ export declare enum Typenames {
137
+ Any = "Any",
138
+ GraphqlConnections = "GraphqlConnections",
139
+ GraphqlSubscriptions = "GraphqlSubscriptions",
140
+ MercadoLivreInstance = "MercadoLivreInstance"
141
+ }
142
+ export type UpdateMercadoLivreInstanceInput = {
143
+ credentialId?: InputMaybe<Scalars['ID']['input']>;
144
+ id: Scalars['ID']['input'];
145
+ name?: InputMaybe<Scalars['String']['input']>;
146
+ };
147
+ export type ReclameAquiInstanceFragment = Pick<MercadoLivreInstance, 'id' | 'name' | 'credentialId' | 'cronJobId'>;
148
+ export type GetMercadoLivreInstanceQueryVariables = Exact<{
149
+ id: Scalars['ID']['input'];
150
+ }>;
151
+ export type GetMercadoLivreInstanceQuery = {
152
+ getMercadoLivreInstance?: Maybe<ReclameAquiInstanceFragment>;
153
+ };
154
+ export type ListMercadoLivreInstancesQueryVariables = Exact<{
155
+ [key: string]: never;
156
+ }>;
157
+ export type ListMercadoLivreInstancesQuery = {
158
+ listMercadoLivreInstances: Array<ReclameAquiInstanceFragment>;
159
+ };
160
+ export type CreateMercadoLivreInstanceMutationVariables = Exact<{
161
+ input: CreateMercadoLivreInstanceInput;
162
+ }>;
163
+ export type CreateMercadoLivreInstanceMutation = {
164
+ createMercadoLivreInstance?: Maybe<ReclameAquiInstanceFragment>;
165
+ };
166
+ export type UpdateMercadoLivreInstanceMutationVariables = Exact<{
167
+ input: UpdateMercadoLivreInstanceInput;
168
+ }>;
169
+ export type UpdateMercadoLivreInstanceMutation = {
170
+ updateMercadoLivreInstance?: Maybe<ReclameAquiInstanceFragment>;
171
+ };
172
+ export type RemoveMercadoLivreInstanceMutationVariables = Exact<{
173
+ input: RemoveMercadoLivreInstanceInput;
174
+ }>;
175
+ export type RemoveMercadoLivreInstanceMutation = {
176
+ removeMercadoLivreInstance?: Maybe<ReclameAquiInstanceFragment>;
177
+ };
178
+ export declare const ReclameAquiInstanceFragmentDoc = "\n fragment reclameAquiInstance on MercadoLivreInstance {\n id\n name\n credentialId\n cronJobId\n}\n ";
179
+ export declare const GetMercadoLivreInstanceDocument = "\n query getMercadoLivreInstance($id: ID!) {\n getMercadoLivreInstance(id: $id) {\n ...reclameAquiInstance\n }\n}\n \n fragment reclameAquiInstance on MercadoLivreInstance {\n id\n name\n credentialId\n cronJobId\n}\n ";
180
+ export declare const ListMercadoLivreInstancesDocument = "\n query listMercadoLivreInstances {\n listMercadoLivreInstances {\n ...reclameAquiInstance\n }\n}\n \n fragment reclameAquiInstance on MercadoLivreInstance {\n id\n name\n credentialId\n cronJobId\n}\n ";
181
+ export declare const CreateMercadoLivreInstanceDocument = "\n mutation createMercadoLivreInstance($input: CreateMercadoLivreInstanceInput!) {\n createMercadoLivreInstance(input: $input) {\n ...reclameAquiInstance\n }\n}\n \n fragment reclameAquiInstance on MercadoLivreInstance {\n id\n name\n credentialId\n cronJobId\n}\n ";
182
+ export declare const UpdateMercadoLivreInstanceDocument = "\n mutation updateMercadoLivreInstance($input: UpdateMercadoLivreInstanceInput!) {\n updateMercadoLivreInstance(input: $input) {\n ...reclameAquiInstance\n }\n}\n \n fragment reclameAquiInstance on MercadoLivreInstance {\n id\n name\n credentialId\n cronJobId\n}\n ";
183
+ export declare const RemoveMercadoLivreInstanceDocument = "\n mutation removeMercadoLivreInstance($input: RemoveMercadoLivreInstanceInput!) {\n removeMercadoLivreInstance(input: $input) {\n ...reclameAquiInstance\n }\n}\n \n fragment reclameAquiInstance on MercadoLivreInstance {\n id\n name\n credentialId\n cronJobId\n}\n ";
184
+ export type Requester<C = {}, E = unknown> = <R, V>(doc: string, vars?: V, options?: C) => Promise<R> | AsyncIterable<R>;
185
+ export declare function getSdk<C, E>(requester: Requester<C, E>): {
186
+ getMercadoLivreInstance(variables: GetMercadoLivreInstanceQueryVariables, options?: C): Promise<GetMercadoLivreInstanceQuery>;
187
+ listMercadoLivreInstances(variables?: ListMercadoLivreInstancesQueryVariables, options?: C): Promise<ListMercadoLivreInstancesQuery>;
188
+ createMercadoLivreInstance(variables: CreateMercadoLivreInstanceMutationVariables, options?: C): Promise<CreateMercadoLivreInstanceMutation>;
189
+ updateMercadoLivreInstance(variables: UpdateMercadoLivreInstanceMutationVariables, options?: C): Promise<UpdateMercadoLivreInstanceMutation>;
190
+ removeMercadoLivreInstance(variables: RemoveMercadoLivreInstanceMutationVariables, options?: C): Promise<RemoveMercadoLivreInstanceMutation>;
191
+ };
192
+ export type Sdk = ReturnType<typeof getSdk>;
193
+ export declare const serviceName = "@droz/mercadolivre";
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ /* istanbul ignore file */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.serviceName = exports.getSdk = exports.RemoveMercadoLivreInstanceDocument = exports.UpdateMercadoLivreInstanceDocument = exports.CreateMercadoLivreInstanceDocument = exports.ListMercadoLivreInstancesDocument = exports.GetMercadoLivreInstanceDocument = exports.ReclameAquiInstanceFragmentDoc = exports.Typenames = exports.MercadoLivreInstanceType = void 0;
5
+ var MercadoLivreInstanceType;
6
+ (function (MercadoLivreInstanceType) {
7
+ MercadoLivreInstanceType["PosVenda"] = "POS_VENDA";
8
+ MercadoLivreInstanceType["PreVenda"] = "PRE_VENDA";
9
+ MercadoLivreInstanceType["Reclamacao"] = "RECLAMACAO";
10
+ })(MercadoLivreInstanceType || (exports.MercadoLivreInstanceType = MercadoLivreInstanceType = {}));
11
+ var Typenames;
12
+ (function (Typenames) {
13
+ Typenames["Any"] = "Any";
14
+ Typenames["GraphqlConnections"] = "GraphqlConnections";
15
+ Typenames["GraphqlSubscriptions"] = "GraphqlSubscriptions";
16
+ Typenames["MercadoLivreInstance"] = "MercadoLivreInstance";
17
+ })(Typenames || (exports.Typenames = Typenames = {}));
18
+ exports.ReclameAquiInstanceFragmentDoc = `
19
+ fragment reclameAquiInstance on MercadoLivreInstance {
20
+ id
21
+ name
22
+ credentialId
23
+ cronJobId
24
+ }
25
+ `;
26
+ exports.GetMercadoLivreInstanceDocument = `
27
+ query getMercadoLivreInstance($id: ID!) {
28
+ getMercadoLivreInstance(id: $id) {
29
+ ...reclameAquiInstance
30
+ }
31
+ }
32
+ ${exports.ReclameAquiInstanceFragmentDoc}`;
33
+ exports.ListMercadoLivreInstancesDocument = `
34
+ query listMercadoLivreInstances {
35
+ listMercadoLivreInstances {
36
+ ...reclameAquiInstance
37
+ }
38
+ }
39
+ ${exports.ReclameAquiInstanceFragmentDoc}`;
40
+ exports.CreateMercadoLivreInstanceDocument = `
41
+ mutation createMercadoLivreInstance($input: CreateMercadoLivreInstanceInput!) {
42
+ createMercadoLivreInstance(input: $input) {
43
+ ...reclameAquiInstance
44
+ }
45
+ }
46
+ ${exports.ReclameAquiInstanceFragmentDoc}`;
47
+ exports.UpdateMercadoLivreInstanceDocument = `
48
+ mutation updateMercadoLivreInstance($input: UpdateMercadoLivreInstanceInput!) {
49
+ updateMercadoLivreInstance(input: $input) {
50
+ ...reclameAquiInstance
51
+ }
52
+ }
53
+ ${exports.ReclameAquiInstanceFragmentDoc}`;
54
+ exports.RemoveMercadoLivreInstanceDocument = `
55
+ mutation removeMercadoLivreInstance($input: RemoveMercadoLivreInstanceInput!) {
56
+ removeMercadoLivreInstance(input: $input) {
57
+ ...reclameAquiInstance
58
+ }
59
+ }
60
+ ${exports.ReclameAquiInstanceFragmentDoc}`;
61
+ function getSdk(requester) {
62
+ return {
63
+ getMercadoLivreInstance(variables, options) {
64
+ return requester(exports.GetMercadoLivreInstanceDocument, variables, options);
65
+ },
66
+ listMercadoLivreInstances(variables, options) {
67
+ return requester(exports.ListMercadoLivreInstancesDocument, variables, options);
68
+ },
69
+ createMercadoLivreInstance(variables, options) {
70
+ return requester(exports.CreateMercadoLivreInstanceDocument, variables, options);
71
+ },
72
+ updateMercadoLivreInstance(variables, options) {
73
+ return requester(exports.UpdateMercadoLivreInstanceDocument, variables, options);
74
+ },
75
+ removeMercadoLivreInstance(variables, options) {
76
+ return requester(exports.RemoveMercadoLivreInstanceDocument, variables, options);
77
+ }
78
+ };
79
+ }
80
+ exports.getSdk = getSdk;
81
+ exports.serviceName = '@droz/mercadolivre';
@@ -1,4 +1,3 @@
1
- import Observable from 'zen-observable';
2
1
  export type Maybe<T> = T;
3
2
  export type InputMaybe<T> = T;
4
3
  export type Exact<T extends {
@@ -632,7 +631,7 @@ export declare const GetSessionDataDocument = "\n query getSessionData($sessi
632
631
  export declare const SetSessionDataDocument = "\n mutation setSessionData($input: SetSessionDataInput!) {\n setSessionData(input: $input)\n}\n ";
633
632
  export declare const PatchSessionDataDocument = "\n mutation patchSessionData($input: PatchSessionDataInput!) {\n patchSessionData(input: $input)\n}\n ";
634
633
  export declare const GetStateMachineDocument = "\n query getStateMachine($id: ID!, $versionId: ID!) {\n getStateMachineConfig(id: $id, versionId: $versionId) {\n id\n versionId\n stateMachineId\n title\n description\n status\n states {\n stateId\n on {\n event\n target\n }\n meta\n }\n }\n}\n ";
635
- export type Requester<C = {}, E = unknown> = <R, V>(doc: string, vars?: V, options?: C) => Promise<R> | Observable<R>;
634
+ export type Requester<C = {}, E = unknown> = <R, V>(doc: string, vars?: V, options?: C) => Promise<R> | AsyncIterable<R>;
636
635
  export declare function getSdk<C, E>(requester: Requester<C, E>): {
637
636
  getApp(variables: GetAppQueryVariables, options?: C): Promise<GetAppQuery>;
638
637
  listApps(variables?: ListAppsQueryVariables, options?: C): Promise<ListAppsQuery>;
@@ -1,4 +1,3 @@
1
- import Observable from 'zen-observable';
2
1
  export type Maybe<T> = T;
3
2
  export type InputMaybe<T> = T;
4
3
  export type Exact<T extends {
@@ -176,7 +175,7 @@ export declare const ListReclameAquiInstancesDocument = "\n query listReclame
176
175
  export declare const CreateReclameAquiInstanceDocument = "\n mutation createReclameAquiInstance($input: CreateReclameAquiInstanceInput!) {\n createReclameAquiInstance(input: $input) {\n ...reclameAquiInstance\n }\n}\n \n fragment reclameAquiInstance on ReclameAquiInstance {\n id\n name\n credentialId\n cronJobId\n}\n ";
177
176
  export declare const UpdateReclameAquiInstanceDocument = "\n mutation updateReclameAquiInstance($input: UpdateReclameAquiInstanceInput!) {\n updateReclameAquiInstance(input: $input) {\n ...reclameAquiInstance\n }\n}\n \n fragment reclameAquiInstance on ReclameAquiInstance {\n id\n name\n credentialId\n cronJobId\n}\n ";
178
177
  export declare const RemoveReclameAquiInstanceDocument = "\n mutation removeReclameAquiInstance($input: RemoveReclameAquiInstanceInput!) {\n removeReclameAquiInstance(input: $input) {\n ...reclameAquiInstance\n }\n}\n \n fragment reclameAquiInstance on ReclameAquiInstance {\n id\n name\n credentialId\n cronJobId\n}\n ";
179
- export type Requester<C = {}, E = unknown> = <R, V>(doc: string, vars?: V, options?: C) => Promise<R> | Observable<R>;
178
+ export type Requester<C = {}, E = unknown> = <R, V>(doc: string, vars?: V, options?: C) => Promise<R> | AsyncIterable<R>;
180
179
  export declare function getSdk<C, E>(requester: Requester<C, E>): {
181
180
  getReclameAquiInstance(variables: GetReclameAquiInstanceQueryVariables, options?: C): Promise<GetReclameAquiInstanceQuery>;
182
181
  listReclameAquiInstances(variables?: ListReclameAquiInstancesQueryVariables, options?: C): Promise<ListReclameAquiInstancesQuery>;
@@ -1,4 +1,3 @@
1
- import Observable from 'zen-observable';
2
1
  export type Maybe<T> = T;
3
2
  export type InputMaybe<T> = T;
4
3
  export type Exact<T extends {
@@ -193,7 +192,7 @@ export declare const ListZendeskInstancesDocument = "\n query listZendeskInst
193
192
  export declare const CreateZendeskInstanceDocument = "\n mutation createZendeskInstance($input: CreateZendeskInstanceInput!) {\n createZendeskInstance(input: $input) {\n ...zendeskInstance\n }\n}\n \n fragment zendeskInstance on ZendeskInstance {\n id\n name\n domain\n credentialId\n}\n ";
194
193
  export declare const UpdateZendeskInstanceDocument = "\n mutation updateZendeskInstance($input: UpdateZendeskInstanceInput!) {\n updateZendeskInstance(input: $input) {\n ...zendeskInstance\n }\n}\n \n fragment zendeskInstance on ZendeskInstance {\n id\n name\n domain\n credentialId\n}\n ";
195
194
  export declare const RemoveZendeskInstanceDocument = "\n mutation removeZendeskInstance($input: RemoveZendeskInstanceInput!) {\n removeZendeskInstance(input: $input) {\n ...zendeskInstance\n }\n}\n \n fragment zendeskInstance on ZendeskInstance {\n id\n name\n domain\n credentialId\n}\n ";
196
- export type Requester<C = {}, E = unknown> = <R, V>(doc: string, vars?: V, options?: C) => Promise<R> | Observable<R>;
195
+ export type Requester<C = {}, E = unknown> = <R, V>(doc: string, vars?: V, options?: C) => Promise<R> | AsyncIterable<R>;
197
196
  export declare function getSdk<C, E>(requester: Requester<C, E>): {
198
197
  getZendeskInstance(variables: GetZendeskInstanceQueryVariables, options?: C): Promise<GetZendeskInstanceQuery>;
199
198
  listZendeskInstances(variables?: ListZendeskInstancesQueryVariables, options?: C): Promise<ListZendeskInstancesQuery>;