@droz-js/sdk 0.1.2 → 0.1.4

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.1.2",
4
+ "version": "0.1.4",
5
5
  "private": false,
6
6
  "exports": {
7
7
  ".": "./src/index.js",
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DrozSdk = void 0;
4
- const discoveryEndpoint = `https://th3xrek4rane2scfwwfoo7wemq0tvuzm.lambda-url.sa-east-1.on.aws`;
4
+ const discoveryEndpoint = 'https://th3xrek4rane2scfwwfoo7wemq0tvuzm.lambda-url.sa-east-1.on.aws';
5
5
  class DrozSdkConfig {
6
6
  authentication;
7
7
  tenant;
@@ -36,8 +36,14 @@ class DrozSdkConfig {
36
36
  const instance = this.instances.find(instance => {
37
37
  return instance.serviceId == serviceId && instance.type == type;
38
38
  });
39
- if (instance)
39
+ if (instance) {
40
+ if (type === 'http') {
41
+ const endpoint = new URL(instance.endpoint);
42
+ endpoint.pathname = '/graphql';
43
+ return endpoint.toString();
44
+ }
40
45
  return instance.endpoint;
46
+ }
41
47
  throw new Error(`Endpoint for ${serviceId} and type ${type} not found`);
42
48
  }
43
49
  reset() {
@@ -1,4 +1,4 @@
1
1
  import Observable from 'zen-observable';
2
- type Requester<C = {}, E = unknown> = <R, V>(doc: string, vars?: V, options?: C) => Promise<R> | Observable<R>;
3
- export declare function HttpClientBuilder<Sdk>(serviceName: string, getSdk: (requester: Requester<Sdk, any>) => Sdk): new () => Sdk;
2
+ type Requester<C = {}> = <R, V>(doc: string, vars?: V, options?: C) => Promise<R> | Observable<R>;
3
+ export declare function HttpClientBuilder<Sdk>(serviceName: string, getSdk: (requester: Requester<Sdk>) => Sdk): new () => Sdk;
4
4
  export {};
@@ -1,4 +1,4 @@
1
1
  import Observable from 'zen-observable';
2
- type Requester<C = {}, E = unknown> = <R, V>(doc: string, vars?: V, options?: C) => Promise<R> | Observable<R>;
3
- export declare function WsClientBuilder<Sdk>(serviceName: string, getSdk: (requester: Requester<Sdk, any>) => Sdk): new () => Sdk;
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;
4
4
  export {};
package/src/drozbot.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './sdks/drozbot';
2
- declare const DrozBot_base: new () => {
2
+ export declare const DrozBot: new () => {
3
3
  getDrozBotInstance(variables: import("./sdks/drozbot").Exact<{
4
4
  id: string;
5
5
  }>, options?: unknown): Promise<import("./sdks/drozbot").GetDrozBotInstanceQuery>;
@@ -16,5 +16,3 @@ declare const DrozBot_base: new () => {
16
16
  input: import("./sdks/drozbot").RemoveDrozBotInstanceInput;
17
17
  }>, options?: unknown): Promise<import("./sdks/drozbot").RemoveDrozBotInstanceMutation>;
18
18
  };
19
- export declare class DrozBot extends DrozBot_base {
20
- }
package/src/drozbot.js CHANGED
@@ -18,6 +18,4 @@ exports.DrozBot = void 0;
18
18
  const http_1 = require("./client/http");
19
19
  const drozbot_1 = require("./sdks/drozbot");
20
20
  __exportStar(require("./sdks/drozbot"), exports);
21
- class DrozBot extends (0, http_1.HttpClientBuilder)(drozbot_1.serviceName, drozbot_1.getSdk) {
22
- }
23
- exports.DrozBot = DrozBot;
21
+ exports.DrozBot = (0, http_1.HttpClientBuilder)(drozbot_1.serviceName, drozbot_1.getSdk);
package/src/drozchat.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './sdks/drozchat';
2
- declare const DrozChat_base: new () => {
2
+ export declare const DrozChat: new () => {
3
3
  getDrozBotInstance(variables: import("./sdks/drozbot").Exact<{
4
4
  id: string;
5
5
  }>, options?: unknown): Promise<import("./sdks/drozbot").GetDrozBotInstanceQuery>;
@@ -16,5 +16,3 @@ declare const DrozChat_base: new () => {
16
16
  input: import("./sdks/drozbot").RemoveDrozBotInstanceInput;
17
17
  }>, options?: unknown): Promise<import("./sdks/drozbot").RemoveDrozBotInstanceMutation>;
18
18
  };
19
- export declare class DrozChat extends DrozChat_base {
20
- }
package/src/drozchat.js CHANGED
@@ -18,6 +18,4 @@ exports.DrozChat = void 0;
18
18
  const http_1 = require("./client/http");
19
19
  const drozbot_1 = require("./sdks/drozbot");
20
20
  __exportStar(require("./sdks/drozchat"), exports);
21
- class DrozChat extends (0, http_1.HttpClientBuilder)(drozbot_1.serviceName, drozbot_1.getSdk) {
22
- }
23
- exports.DrozChat = DrozChat;
21
+ exports.DrozChat = (0, http_1.HttpClientBuilder)(drozbot_1.serviceName, drozbot_1.getSdk);
package/src/nucleus.d.ts CHANGED
@@ -4,10 +4,10 @@ export declare const Nucleus: new () => {
4
4
  appId: string;
5
5
  withInstances?: boolean;
6
6
  }>, options?: unknown): Promise<import("./sdks/nucleus").GetAppQuery>;
7
- getApps(variables?: import("./sdks/nucleus").Exact<{
7
+ listApps(variables?: import("./sdks/nucleus").Exact<{
8
8
  type?: import("./sdks/nucleus").AppType;
9
9
  withInstances?: boolean;
10
- }>, options?: unknown): Promise<import("./sdks/nucleus").GetAppsQuery>;
10
+ }>, options?: unknown): Promise<import("./sdks/nucleus").ListAppsQuery>;
11
11
  listAppInstances(variables?: import("./sdks/nucleus").Exact<{
12
12
  appId?: string;
13
13
  appType?: import("./sdks/nucleus").AppType;
@@ -1,5 +1,5 @@
1
1
  export * from './sdks/reclameaqui';
2
- declare const Reclameaqui_base: new () => {
2
+ export declare const Reclameaqui: new () => {
3
3
  getReclameAquiInstance(variables: import("./sdks/reclameaqui").Exact<{
4
4
  id: string;
5
5
  }>, options?: unknown): Promise<import("./sdks/reclameaqui").GetReclameAquiInstanceQuery>;
@@ -16,5 +16,3 @@ declare const Reclameaqui_base: new () => {
16
16
  input: import("./sdks/reclameaqui").RemoveReclameAquiInstanceInput;
17
17
  }>, options?: unknown): Promise<import("./sdks/reclameaqui").RemoveReclameAquiInstanceMutation>;
18
18
  };
19
- export declare class Reclameaqui extends Reclameaqui_base {
20
- }
@@ -18,6 +18,4 @@ exports.Reclameaqui = void 0;
18
18
  const http_1 = require("./client/http");
19
19
  const reclameaqui_1 = require("./sdks/reclameaqui");
20
20
  __exportStar(require("./sdks/reclameaqui"), exports);
21
- class Reclameaqui extends (0, http_1.HttpClientBuilder)(reclameaqui_1.serviceName, reclameaqui_1.getSdk) {
22
- }
23
- exports.Reclameaqui = Reclameaqui;
21
+ exports.Reclameaqui = (0, http_1.HttpClientBuilder)(reclameaqui_1.serviceName, reclameaqui_1.getSdk);
@@ -483,11 +483,11 @@ export type GetAppQuery = {
483
483
  instances?: Array<AppInstanceFragment>;
484
484
  } & AppFragment)>;
485
485
  };
486
- export type GetAppsQueryVariables = Exact<{
486
+ export type ListAppsQueryVariables = Exact<{
487
487
  type?: InputMaybe<AppType>;
488
488
  withInstances?: InputMaybe<Scalars['Boolean']['input']>;
489
489
  }>;
490
- export type GetAppsQuery = {
490
+ export type ListAppsQuery = {
491
491
  listApps: Array<({
492
492
  instances?: Array<AppInstanceFragment>;
493
493
  } & AppFragment)>;
@@ -614,7 +614,7 @@ export declare const AppWithInstancesFragmentDoc = "\n fragment appWithInstan
614
614
  export declare const SafeCredentialsFragmentDoc = "\n fragment safeCredentials on SafeCredentials {\n id\n type\n description\n}\n ";
615
615
  export declare const CronJobFragmentDoc = "\n fragment cronJob on CronJob {\n appId\n id\n description\n expression\n event\n payload\n status\n timestamp\n runs\n}\n ";
616
616
  export declare const GetAppDocument = "\n query getApp($appId: ID!, $withInstances: Boolean = false) {\n getApp(appId: $appId) {\n ...app\n instances @include(if: $withInstances) {\n ...appInstance\n }\n }\n}\n \n fragment app on App {\n id\n type\n name\n description\n}\n \n\n fragment appInstance on AppInstance {\n appId\n appType\n drn\n name\n transitions\n}\n ";
617
- export declare const GetAppsDocument = "\n query getApps($type: AppType, $withInstances: Boolean = false) {\n listApps(type: $type) {\n ...app\n instances @include(if: $withInstances) {\n ...appInstance\n }\n }\n}\n \n fragment app on App {\n id\n type\n name\n description\n}\n \n\n fragment appInstance on AppInstance {\n appId\n appType\n drn\n name\n transitions\n}\n ";
617
+ export declare const ListAppsDocument = "\n query listApps($type: AppType, $withInstances: Boolean = false) {\n listApps(type: $type) {\n ...app\n instances @include(if: $withInstances) {\n ...appInstance\n }\n }\n}\n \n fragment app on App {\n id\n type\n name\n description\n}\n \n\n fragment appInstance on AppInstance {\n appId\n appType\n drn\n name\n transitions\n}\n ";
618
618
  export declare const ListAppInstancesDocument = "\n query listAppInstances($appId: ID, $appType: AppType, $withApp: Boolean = false) {\n listAppInstances(appId: $appId, appType: $appType) {\n ...appInstance\n app @include(if: $withApp) {\n ...app\n }\n }\n}\n \n fragment appInstance on AppInstance {\n appId\n appType\n drn\n name\n transitions\n}\n \n\n fragment app on App {\n id\n type\n name\n description\n}\n ";
619
619
  export declare const GetCredentialsDocument = "\n query getCredentials($id: ID!) {\n getCredentials(id: $id) {\n ...safeCredentials\n }\n}\n \n fragment safeCredentials on SafeCredentials {\n id\n type\n description\n}\n ";
620
620
  export declare const GetCredentialsSecretDocument = "\n query getCredentialsSecret($id: ID!) {\n getCredentialsSecret(id: $id) {\n ... on ICredentials {\n id\n type\n description\n }\n ... on BasicCredentialsType {\n credentials {\n username\n password\n }\n }\n ... on ApiKeyCredentialsType {\n credentials {\n apiKey\n }\n }\n ... on OAuth2CredentialsType {\n credentials {\n clientId\n clientSecret\n }\n }\n }\n}\n ";
@@ -635,7 +635,7 @@ export declare const GetStateMachineDocument = "\n query getStateMachine($id:
635
635
  export type Requester<C = {}, E = unknown> = <R, V>(doc: string, vars?: V, options?: C) => Promise<R> | Observable<R>;
636
636
  export declare function getSdk<C, E>(requester: Requester<C, E>): {
637
637
  getApp(variables: GetAppQueryVariables, options?: C): Promise<GetAppQuery>;
638
- getApps(variables?: GetAppsQueryVariables, options?: C): Promise<GetAppsQuery>;
638
+ listApps(variables?: ListAppsQueryVariables, options?: C): Promise<ListAppsQuery>;
639
639
  listAppInstances(variables?: ListAppInstancesQueryVariables, options?: C): Promise<ListAppInstancesQuery>;
640
640
  getCredentials(variables: GetCredentialsQueryVariables, options?: C): Promise<GetCredentialsQuery>;
641
641
  getCredentialsSecret(variables: GetCredentialsSecretQueryVariables, options?: C): Promise<GetCredentialsSecretQuery>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /* istanbul ignore file */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.serviceName = exports.getSdk = exports.GetStateMachineDocument = exports.PatchSessionDataDocument = exports.SetSessionDataDocument = exports.GetSessionDataDocument = exports.ResolveSessionDocument = exports.RemoveCronJobDocument = exports.UpdateCronJobDocument = exports.CreateCronJobDocument = exports.ListCronJobsDocument = exports.GetCronJobDocument = exports.RemoveCredentialsDocument = exports.UpdateCredentialsDocument = exports.CreateCredentialsDocument = exports.ListCredentialsDocument = exports.GetCredentialsSecretDocument = exports.GetCredentialsDocument = exports.ListAppInstancesDocument = exports.GetAppsDocument = exports.GetAppDocument = exports.CronJobFragmentDoc = exports.SafeCredentialsFragmentDoc = exports.AppWithInstancesFragmentDoc = exports.AppInstanceFragmentDoc = exports.AppFragmentDoc = exports.Typenames = exports.StateMachineConfigStatus = exports.PatchOperation = exports.CredentialsType = exports.AppType = void 0;
4
+ exports.serviceName = exports.getSdk = exports.GetStateMachineDocument = exports.PatchSessionDataDocument = exports.SetSessionDataDocument = exports.GetSessionDataDocument = exports.ResolveSessionDocument = exports.RemoveCronJobDocument = exports.UpdateCronJobDocument = exports.CreateCronJobDocument = exports.ListCronJobsDocument = exports.GetCronJobDocument = exports.RemoveCredentialsDocument = exports.UpdateCredentialsDocument = exports.CreateCredentialsDocument = exports.ListCredentialsDocument = exports.GetCredentialsSecretDocument = exports.GetCredentialsDocument = exports.ListAppInstancesDocument = exports.ListAppsDocument = exports.GetAppDocument = exports.CronJobFragmentDoc = exports.SafeCredentialsFragmentDoc = exports.AppWithInstancesFragmentDoc = exports.AppInstanceFragmentDoc = exports.AppFragmentDoc = exports.Typenames = exports.StateMachineConfigStatus = exports.PatchOperation = exports.CredentialsType = exports.AppType = void 0;
5
5
  var AppType;
6
6
  (function (AppType) {
7
7
  AppType["Regular"] = "Regular";
@@ -100,8 +100,8 @@ exports.GetAppDocument = `
100
100
  }
101
101
  ${exports.AppFragmentDoc}
102
102
  ${exports.AppInstanceFragmentDoc}`;
103
- exports.GetAppsDocument = `
104
- query getApps($type: AppType, $withInstances: Boolean = false) {
103
+ exports.ListAppsDocument = `
104
+ query listApps($type: AppType, $withInstances: Boolean = false) {
105
105
  listApps(type: $type) {
106
106
  ...app
107
107
  instances @include(if: $withInstances) {
@@ -270,8 +270,8 @@ function getSdk(requester) {
270
270
  getApp(variables, options) {
271
271
  return requester(exports.GetAppDocument, variables, options);
272
272
  },
273
- getApps(variables, options) {
274
- return requester(exports.GetAppsDocument, variables, options);
273
+ listApps(variables, options) {
274
+ return requester(exports.ListAppsDocument, variables, options);
275
275
  },
276
276
  listAppInstances(variables, options) {
277
277
  return requester(exports.ListAppInstancesDocument, variables, options);
package/src/zendesk.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './sdks/zendesk';
2
- declare const Zendesk_base: new () => {
2
+ export declare const Zendesk: new () => {
3
3
  getZendeskInstance(variables: import("./sdks/zendesk").Exact<{
4
4
  id: string;
5
5
  }>, options?: unknown): Promise<import("./sdks/zendesk").GetZendeskInstanceQuery>;
@@ -16,5 +16,3 @@ declare const Zendesk_base: new () => {
16
16
  input: import("./sdks/zendesk").RemoveZendeskInstanceInput;
17
17
  }>, options?: unknown): Promise<import("./sdks/zendesk").RemoveZendeskInstanceMutation>;
18
18
  };
19
- export declare class Zendesk extends Zendesk_base {
20
- }
package/src/zendesk.js CHANGED
@@ -18,6 +18,4 @@ exports.Zendesk = void 0;
18
18
  const http_1 = require("./client/http");
19
19
  const zendesk_1 = require("./sdks/zendesk");
20
20
  __exportStar(require("./sdks/zendesk"), exports);
21
- class Zendesk extends (0, http_1.HttpClientBuilder)(zendesk_1.serviceName, zendesk_1.getSdk) {
22
- }
23
- exports.Zendesk = Zendesk;
21
+ exports.Zendesk = (0, http_1.HttpClientBuilder)(zendesk_1.serviceName, zendesk_1.getSdk);