@arrowsphere/api-client 3.29.0-rc.jpb.2 → 3.29.0-rc.uts.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.
Files changed (51) hide show
  1. package/README.md +0 -12
  2. package/build/abstractClient.d.ts +19 -3
  3. package/build/abstractClient.js +23 -8
  4. package/build/abstractGraphQLClient.d.ts +14 -4
  5. package/build/abstractGraphQLClient.js +23 -32
  6. package/build/catalog/catalogGraphQLClient.d.ts +0 -2
  7. package/build/catalog/catalogGraphQLClient.js +1 -14
  8. package/build/catalog/index.d.ts +0 -2
  9. package/build/catalog/index.js +0 -2
  10. package/build/catalog/types/catalogGraphQLTypes.js +0 -1
  11. package/build/exception/publicApiClientException.d.ts +1 -2
  12. package/build/exception/publicApiClientException.js +1 -2
  13. package/build/index.d.ts +0 -1
  14. package/build/index.js +0 -1
  15. package/build/licenses/entities/findResult.d.ts +1 -1
  16. package/build/licenses/entities/findResult.js +1 -1
  17. package/package.json +1 -3
  18. package/build/AbstractHttpClient.d.ts +0 -47
  19. package/build/AbstractHttpClient.js +0 -80
  20. package/build/catalog/types/catalogGraphQLQueries.d.ts +0 -12
  21. package/build/catalog/types/catalogGraphQLQueries.js +0 -3
  22. package/build/catalog/types/catalogGraphQLSchemas.d.ts +0 -30
  23. package/build/catalog/types/catalogGraphQLSchemas.js +0 -4
  24. package/build/catalog/types/queryArguments.d.ts +0 -41
  25. package/build/catalog/types/queryArguments.js +0 -10
  26. package/build/exception/exception-handlers/HandleHttpExceptionOutput.d.ts +0 -3
  27. package/build/exception/exception-handlers/HandleHttpExceptionOutput.js +0 -3
  28. package/build/exception/exception-handlers/Hooks.d.ts +0 -3
  29. package/build/exception/exception-handlers/Hooks.js +0 -3
  30. package/build/exception/exception-handlers/HttpExceptionHandler.d.ts +0 -10
  31. package/build/exception/exception-handlers/HttpExceptionHandler.js +0 -3
  32. package/build/exception/exception-handlers/index.d.ts +0 -3
  33. package/build/exception/exception-handlers/index.js +0 -20
  34. package/build/securityScore/entities/getCustomerAccountData.d.ts +0 -48
  35. package/build/securityScore/entities/getCustomerAccountData.js +0 -111
  36. package/build/securityScore/entities/getCustomerData.d.ts +0 -51
  37. package/build/securityScore/entities/getCustomerData.js +0 -117
  38. package/build/securityScore/entities/getPartnerData.d.ts +0 -45
  39. package/build/securityScore/entities/getPartnerData.js +0 -102
  40. package/build/securityScore/index.d.ts +0 -7
  41. package/build/securityScore/index.js +0 -24
  42. package/build/securityScore/securityScoreGraphQLClient.d.ts +0 -19
  43. package/build/securityScore/securityScoreGraphQLClient.js +0 -61
  44. package/build/securityScore/types/queryArguments.d.ts +0 -108
  45. package/build/securityScore/types/queryArguments.js +0 -93
  46. package/build/securityScore/types/securityScoreGraphQLQueries.d.ts +0 -62
  47. package/build/securityScore/types/securityScoreGraphQLQueries.js +0 -7
  48. package/build/securityScore/types/securityScoreGraphQLSchemas.d.ts +0 -78
  49. package/build/securityScore/types/securityScoreGraphQLSchemas.js +0 -3
  50. package/build/securityScore/types/securityScoreGraphQLTypes.d.ts +0 -190
  51. package/build/securityScore/types/securityScoreGraphQLTypes.js +0 -3
package/README.md CHANGED
@@ -50,18 +50,6 @@ The output documentation should be located in the `docs/` folder, just open the
50
50
 
51
51
  - [CheckDomain](./src/general/CHECKDOMAIN.md)
52
52
  - [WhoAmI](./src/general/WHOAMI.md)
53
- - [Campaign](./src/campaign/README.md)
54
- - [Cart](./src/cart/README.md)
55
- - [Catalog](./src/catalog/README.md)
56
- - [Consumption](./src/consumption/README.md)
57
- - [Contact](./src/contact/README.md)
58
- - [Customers](./src/customers/README.md)
59
- - [Licenses](./src/licenses/README.md)
60
- - [Orders](./src/orders/README.md)
61
- - [Subscriptions](./src/subscriptions/README.md)
62
- - [Support Center](./src/supportCenter/README.md)
63
-
64
- - [SecurityScore](./src/securityScore/README.md)
65
53
 
66
54
  ### Licenses
67
55
 
@@ -1,11 +1,9 @@
1
1
  import { AxiosInstance, AxiosResponse } from 'axios';
2
- import { AbstractHttpClient } from './AbstractHttpClient';
3
2
  /**
4
3
  * Lists of available query parameters for the API call
5
4
  */
6
5
  export declare enum ParameterKeys {
7
6
  API_KEY = "apiKey",
8
- AUTHORIZATION = "Authorization",
9
7
  HEADERS = "headers",
10
8
  ORDER_BY = "order_by",
11
9
  PAGE = "page",
@@ -38,11 +36,23 @@ export declare type ConfigurationsClient = {
38
36
  export declare type ExtraInformationType = {
39
37
  [ExtraInformationFields.COLUMN_EXTRA_INFORMATION]?: Record<string, unknown>;
40
38
  };
41
- export declare abstract class AbstractClient extends AbstractHttpClient {
39
+ export declare abstract class AbstractClient {
40
+ /**
41
+ * Base path for HTTP calls
42
+ */
43
+ protected basePath: string;
44
+ /**
45
+ * Current path for HTTP calls
46
+ */
47
+ protected path: string;
42
48
  /**
43
49
  * Axios instance for client
44
50
  */
45
51
  protected client: AxiosInstance;
52
+ /**
53
+ * ArrowSphere API URL
54
+ */
55
+ protected url: string;
46
56
  /**
47
57
  * ArrowSphere API key
48
58
  */
@@ -74,6 +84,12 @@ export declare abstract class AbstractClient extends AbstractHttpClient {
74
84
  * @returns this
75
85
  */
76
86
  setApiKey(key: string): this;
87
+ /**
88
+ * Sets the client ArrowSphere API url
89
+ * @param url - API url
90
+ * @returns this
91
+ */
92
+ setUrl(url: string): this;
77
93
  /**
78
94
  * Returns the API url.
79
95
  * @returns string
@@ -8,14 +8,12 @@ const exception_1 = require("./exception");
8
8
  const querystring_1 = __importDefault(require("querystring"));
9
9
  const path_1 = __importDefault(require("path"));
10
10
  const axiosSingleton_1 = require("./axiosSingleton");
11
- const AbstractHttpClient_1 = require("./AbstractHttpClient");
12
11
  /**
13
12
  * Lists of available query parameters for the API call
14
13
  */
15
14
  var ParameterKeys;
16
15
  (function (ParameterKeys) {
17
16
  ParameterKeys["API_KEY"] = "apiKey";
18
- ParameterKeys["AUTHORIZATION"] = "Authorization";
19
17
  ParameterKeys["HEADERS"] = "headers";
20
18
  ParameterKeys["ORDER_BY"] = "order_by";
21
19
  ParameterKeys["PAGE"] = "page";
@@ -28,14 +26,25 @@ var ExtraInformationFields;
28
26
  (function (ExtraInformationFields) {
29
27
  ExtraInformationFields["COLUMN_EXTRA_INFORMATION"] = "extraInformation";
30
28
  })(ExtraInformationFields = exports.ExtraInformationFields || (exports.ExtraInformationFields = {}));
31
- class AbstractClient extends AbstractHttpClient_1.AbstractHttpClient {
29
+ class AbstractClient {
32
30
  /**
33
31
  * AbstractClient constructor.
34
32
  * @returns AbstractClient
35
33
  */
36
34
  constructor(configuration) {
37
35
  var _a, _b, _c;
38
- super();
36
+ /**
37
+ * Base path for HTTP calls
38
+ */
39
+ this.basePath = '';
40
+ /**
41
+ * Current path for HTTP calls
42
+ */
43
+ this.path = '';
44
+ /**
45
+ * ArrowSphere API URL
46
+ */
47
+ this.url = '';
39
48
  /**
40
49
  * ArrowSphere API key
41
50
  */
@@ -70,6 +79,15 @@ class AbstractClient extends AbstractHttpClient_1.AbstractHttpClient {
70
79
  this.apiKey = key;
71
80
  return this;
72
81
  }
82
+ /**
83
+ * Sets the client ArrowSphere API url
84
+ * @param url - API url
85
+ * @returns this
86
+ */
87
+ setUrl(url) {
88
+ this.url = url;
89
+ return this;
90
+ }
73
91
  /**
74
92
  * Returns the API url.
75
93
  * @returns string
@@ -138,12 +156,9 @@ class AbstractClient extends AbstractHttpClient_1.AbstractHttpClient {
138
156
  * @returns {@link Headers}
139
157
  */
140
158
  prepareHeaders(headers) {
141
- const securityHeader = this.security === AbstractHttpClient_1.HttpClientSecurity.API_KEY
142
- ? { [ParameterKeys.API_KEY]: this.apiKey }
143
- : { [ParameterKeys.AUTHORIZATION]: this.token };
144
159
  return {
145
160
  ...headers,
146
- ...securityHeader,
161
+ [ParameterKeys.API_KEY]: this.apiKey,
147
162
  ...this.headers,
148
163
  };
149
164
  }
@@ -2,16 +2,26 @@ import { GraphQLClient } from 'graphql-request';
2
2
  import * as Dom from 'graphql-request/dist/types.dom';
3
3
  import { Options } from './abstractClient';
4
4
  import { GetProductsType } from './catalog';
5
- import { AbstractHttpClient } from './AbstractHttpClient';
6
5
  export declare type GraphQLResponseTypes = GetProductsType;
7
- export declare abstract class AbstractGraphQLClient extends AbstractHttpClient {
6
+ export declare abstract class AbstractGraphQLClient {
7
+ /**
8
+ * Base path for HTTP calls
9
+ */
10
+ protected basePath: string;
11
+ /**
12
+ * Current path for HTTP calls
13
+ */
14
+ protected path: string;
8
15
  protected client: GraphQLClient;
16
+ protected url: string;
17
+ protected token: string;
9
18
  protected optionsHeader?: Dom.RequestInit['headers'];
10
19
  protected options: Options;
11
20
  private getClient;
21
+ setToken(apiKey: string): this;
22
+ setUrl(url: string): this;
12
23
  setOptionsHeader(options: Dom.RequestInit['headers']): this;
13
24
  setOptions(options: Options): this;
14
- protected post<GraphQLResponseTypes>(query: string): Promise<GraphQLResponseTypes>;
25
+ protected post(query: string): Promise<GraphQLResponseTypes>;
15
26
  protected generateUrl(): string;
16
- protected stringifyQuery(query: any): string;
17
27
  }
@@ -1,42 +1,37 @@
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
4
  };
25
5
  Object.defineProperty(exports, "__esModule", { value: true });
26
6
  exports.AbstractGraphQLClient = void 0;
27
7
  const graphql_request_1 = require("graphql-request");
28
- const path = __importStar(require("path"));
29
- const json_to_graphql_query_1 = require("json-to-graphql-query");
30
- const AbstractHttpClient_1 = require("./AbstractHttpClient");
31
- class AbstractGraphQLClient extends AbstractHttpClient_1.AbstractHttpClient {
8
+ const path_1 = __importDefault(require("path"));
9
+ class AbstractGraphQLClient {
32
10
  constructor() {
33
- super(...arguments);
11
+ /**
12
+ * Base path for HTTP calls
13
+ */
14
+ this.basePath = '';
15
+ /**
16
+ * Current path for HTTP calls
17
+ */
18
+ this.path = '';
19
+ this.url = '';
20
+ this.token = '';
34
21
  this.options = {};
35
22
  }
36
23
  getClient() {
37
24
  this.client = new graphql_request_1.GraphQLClient(this.generateUrl());
38
25
  return this;
39
26
  }
27
+ setToken(apiKey) {
28
+ this.token = apiKey;
29
+ return this;
30
+ }
31
+ setUrl(url) {
32
+ this.url = url;
33
+ return this;
34
+ }
40
35
  setOptionsHeader(options) {
41
36
  this.optionsHeader = options;
42
37
  return this;
@@ -53,13 +48,9 @@ class AbstractGraphQLClient extends AbstractHttpClient_1.AbstractHttpClient {
53
48
  return await this.client.request(query);
54
49
  }
55
50
  generateUrl() {
56
- const url = new URL(`${this.options.isAdmin ? path.join('admin', this.basePath) : this.basePath}${this.path}`, this.url);
51
+ const url = new URL(`${this.options.isAdmin ? path_1.default.join('admin', this.basePath) : this.basePath}${this.path}`, this.url);
57
52
  return url.toString();
58
53
  }
59
- stringifyQuery(query) {
60
- const graphqlQuery = (0, json_to_graphql_query_1.jsonToGraphQLQuery)(query);
61
- return `{${graphqlQuery}}`;
62
- }
63
54
  }
64
55
  exports.AbstractGraphQLClient = AbstractGraphQLClient;
65
56
  //# sourceMappingURL=abstractGraphQLClient.js.map
@@ -1,6 +1,5 @@
1
1
  import { AbstractGraphQLClient } from '../abstractGraphQLClient';
2
2
  import { GetProductsType } from './types/catalogGraphQLTypes';
3
- import { CatalogQuery } from './types/catalogGraphQLQueries';
4
3
  export declare class CatalogGraphQLClient extends AbstractGraphQLClient {
5
4
  /**
6
5
  * The base path of the API
@@ -11,5 +10,4 @@ export declare class CatalogGraphQLClient extends AbstractGraphQLClient {
11
10
  */
12
11
  private GRAPHQL;
13
12
  find(request: string): Promise<GetProductsType>;
14
- findByQuery(query: CatalogQuery): Promise<GetProductsType | null>;
15
13
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CatalogGraphQLClient = void 0;
4
4
  const abstractGraphQLClient_1 = require("../abstractGraphQLClient");
5
+ // import { inspect } from 'util';
5
6
  class CatalogGraphQLClient extends abstractGraphQLClient_1.AbstractGraphQLClient {
6
7
  constructor() {
7
8
  super(...arguments);
@@ -18,20 +19,6 @@ class CatalogGraphQLClient extends abstractGraphQLClient_1.AbstractGraphQLClient
18
19
  this.path = this.GRAPHQL;
19
20
  return await this.post(request);
20
21
  }
21
- async findByQuery(query) {
22
- const queryStr = this.stringifyQuery(query);
23
- try {
24
- return await this.find(queryStr);
25
- }
26
- catch (error) {
27
- const exception = this.mapToPublicApiException(error);
28
- const { mustRetry } = await this.handleError(exception);
29
- if (mustRetry) {
30
- return await this.find(queryStr);
31
- }
32
- }
33
- return null;
34
- }
35
22
  }
36
23
  exports.CatalogGraphQLClient = CatalogGraphQLClient;
37
24
  //# sourceMappingURL=catalogGraphQLClient.js.map
@@ -3,5 +3,3 @@ export * from './catalogClient';
3
3
  export * from './types/catalogGraphQLTypes';
4
4
  export * from './entities/program';
5
5
  export * from './entities/programs';
6
- export * from './types/catalogGraphQLQueries';
7
- export * from './types/catalogGraphQLSchemas';
@@ -19,6 +19,4 @@ __exportStar(require("./catalogClient"), exports);
19
19
  __exportStar(require("./types/catalogGraphQLTypes"), exports);
20
20
  __exportStar(require("./entities/program"), exports);
21
21
  __exportStar(require("./entities/programs"), exports);
22
- __exportStar(require("./types/catalogGraphQLQueries"), exports);
23
- __exportStar(require("./types/catalogGraphQLSchemas"), exports);
24
22
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,3 @@
1
1
  "use strict";
2
- // Here are the types, they are useful to have exact types of the responses
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  //# sourceMappingURL=catalogGraphQLTypes.js.map
@@ -1,6 +1,5 @@
1
1
  export declare class PublicApiClientException extends Error {
2
2
  httpCode: number;
3
3
  httpError: string;
4
- config: any;
5
- constructor(message: string, httpError?: string, httpCode?: number, config?: {});
4
+ constructor(message: string, httpError?: string, httpCode?: number);
6
5
  }
@@ -2,11 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PublicApiClientException = void 0;
4
4
  class PublicApiClientException extends Error {
5
- constructor(message, httpError = '', httpCode = 0, config = {}) {
5
+ constructor(message, httpError = '', httpCode = 0) {
6
6
  super(message);
7
7
  this.httpCode = httpCode;
8
8
  this.httpError = httpError;
9
- this.config = config;
10
9
  }
11
10
  }
12
11
  exports.PublicApiClientException = PublicApiClientException;
package/build/index.d.ts CHANGED
@@ -19,6 +19,5 @@ export * from './shared/';
19
19
  export * from './security/';
20
20
  export * from './subscriptions/';
21
21
  export * from './supportCenter/';
22
- export * from './securityScore/';
23
22
  export { ContactInformation };
24
23
  import * as ContactInformation from './contact';
package/build/index.js CHANGED
@@ -48,7 +48,6 @@ __exportStar(require("./shared/"), exports);
48
48
  __exportStar(require("./security/"), exports);
49
49
  __exportStar(require("./subscriptions/"), exports);
50
50
  __exportStar(require("./supportCenter/"), exports);
51
- __exportStar(require("./securityScore/"), exports);
52
51
  const ContactInformation = __importStar(require("./contact"));
53
52
  exports.ContactInformation = ContactInformation;
54
53
  //# sourceMappingURL=index.js.map
@@ -54,7 +54,7 @@ export declare class FindResult extends AbstractEntity<FindData> {
54
54
  }, void, undefined>;
55
55
  /**
56
56
  * Gets all the licenses from the result, page per page.
57
- * Follows the async interator implementation through the generator pattern.
57
+ * Follows the asybc interator implementation through the generator pattern.
58
58
  * @returns Generator|{@link LicenseFindResult}[]
59
59
  */
60
60
  getResults(): AsyncGenerator<{
@@ -59,7 +59,7 @@ class FindResult extends abstractEntity_1.AbstractEntity {
59
59
  }
60
60
  /**
61
61
  * Gets all the licenses from the result, page per page.
62
- * Follows the async interator implementation through the generator pattern.
62
+ * Follows the asybc interator implementation through the generator pattern.
63
63
  * @returns Generator|{@link LicenseFindResult}[]
64
64
  */
65
65
  async *getResults() {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/ArrowSphere/nodejs-api-client.git"
6
6
  },
7
- "version": "3.29.0-rc.jpb.2",
7
+ "version": "3.29.0-rc.uts.1",
8
8
  "description": "Node.js client for ArrowSphere's public API",
9
9
  "main": "build/index.js",
10
10
  "types": "build/index.d.ts",
@@ -84,9 +84,7 @@
84
84
  "axios": "1.1.3",
85
85
  "graphql": "^16.3.0",
86
86
  "graphql-request": "4.2.0",
87
- "json-to-graphql-query": "^2.2.5",
88
87
  "lodash": "^4.17.21",
89
- "type-fest": "^3.9.0",
90
88
  "validatorjs": "3.22.1"
91
89
  }
92
90
  }
@@ -1,47 +0,0 @@
1
- import { HttpExceptionHandler, HandleHttpExceptionOutput } from './exception/exception-handlers';
2
- import { PublicApiClientException } from './exception';
3
- export declare enum HttpClientSecurity {
4
- TOKEN = "token",
5
- API_KEY = "apikey"
6
- }
7
- export declare abstract class AbstractHttpClient {
8
- /**
9
- * Base path for HTTP calls
10
- */
11
- protected basePath: string;
12
- /**
13
- * Current path for HTTP calls
14
- */
15
- protected path: string;
16
- /**
17
- * Token to authenticate the user
18
- */
19
- protected token: string;
20
- /**
21
- * ArrowSphere API URL
22
- */
23
- protected url: string;
24
- /**
25
- * Http Exceptions Handlers
26
- */
27
- protected httpExceptionHandlers: HttpExceptionHandler[];
28
- /**
29
- * Security used to auth on server
30
- * Default to API_KEY to handle
31
- * the existing codebase
32
- */
33
- protected security: HttpClientSecurity;
34
- setToken(token: string): this;
35
- setUrl(url: string): this;
36
- setSecurity(security: HttpClientSecurity): this;
37
- /**
38
- * Allow to register error/exception handler.
39
- * Handlers can be developed in another projects as long as they respect the interface HttpExceptionHandler.
40
- */
41
- registerHttpExceptionHandler(handler: HttpExceptionHandler): this;
42
- /**
43
- * Will find appropriate ErrorHandlers and apply them to the error in order of registering.
44
- */
45
- protected handleError(error: PublicApiClientException): Promise<HandleHttpExceptionOutput>;
46
- protected mapToPublicApiException(error: any): PublicApiClientException;
47
- }
@@ -1,80 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AbstractHttpClient = exports.HttpClientSecurity = void 0;
4
- const exception_1 = require("./exception");
5
- var HttpClientSecurity;
6
- (function (HttpClientSecurity) {
7
- HttpClientSecurity["TOKEN"] = "token";
8
- HttpClientSecurity["API_KEY"] = "apikey";
9
- })(HttpClientSecurity = exports.HttpClientSecurity || (exports.HttpClientSecurity = {}));
10
- class AbstractHttpClient {
11
- constructor() {
12
- /**
13
- * Base path for HTTP calls
14
- */
15
- this.basePath = '';
16
- /**
17
- * Current path for HTTP calls
18
- */
19
- this.path = '';
20
- /**
21
- * Token to authenticate the user
22
- */
23
- this.token = '';
24
- /**
25
- * ArrowSphere API URL
26
- */
27
- this.url = '';
28
- /**
29
- * Http Exceptions Handlers
30
- */
31
- this.httpExceptionHandlers = [];
32
- /**
33
- * Security used to auth on server
34
- * Default to API_KEY to handle
35
- * the existing codebase
36
- */
37
- this.security = HttpClientSecurity.API_KEY;
38
- }
39
- setToken(token) {
40
- this.token = token;
41
- return this;
42
- }
43
- setUrl(url) {
44
- this.url = url;
45
- return this;
46
- }
47
- setSecurity(security) {
48
- this.security = security;
49
- return this;
50
- }
51
- /**
52
- * Allow to register error/exception handler.
53
- * Handlers can be developed in another projects as long as they respect the interface HttpExceptionHandler.
54
- */
55
- registerHttpExceptionHandler(handler) {
56
- this.httpExceptionHandlers.push(handler);
57
- return this;
58
- }
59
- /**
60
- * Will find appropriate ErrorHandlers and apply them to the error in order of registering.
61
- */
62
- async handleError(error) {
63
- const appropriateHandlers = this.httpExceptionHandlers.filter((handler) => handler.getHandledHttpStatuses().includes(error.httpCode));
64
- // handle retry
65
- const output = { mustRetry: false };
66
- for (const handler of appropriateHandlers) {
67
- const res = await handler.handle(error, {
68
- setToken: this.setToken,
69
- });
70
- output.mustRetry = res.mustRetry;
71
- }
72
- return output;
73
- }
74
- mapToPublicApiException(error) {
75
- var _a, _b;
76
- return new exception_1.PublicApiClientException(error === null || error === void 0 ? void 0 : error.message, String(error), (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.status, (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.config);
77
- }
78
- }
79
- exports.AbstractHttpClient = AbstractHttpClient;
80
- //# sourceMappingURL=AbstractHttpClient.js.map
@@ -1,12 +0,0 @@
1
- import { QueryArguments } from './queryArguments';
2
- import { FiltersSchema, PaginationSchema, ProductSchema } from './catalogGraphQLSchemas';
3
- export declare type CatalogQuery = {
4
- getProducts: GetPaginatedProductsQuery;
5
- };
6
- export declare type GetPaginatedProductsQuery = {
7
- __args: QueryArguments;
8
- filters?: FiltersSchema;
9
- pagination?: PaginationSchema;
10
- products?: ProductSchema;
11
- topOffers?: ProductSchema;
12
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=catalogGraphQLQueries.js.map
@@ -1,30 +0,0 @@
1
- import { AttributeType, FiltersType, IdentifiersType, PaginationType, PriceBandType, PricesType, ProductType, RelatedOfferType } from './catalogGraphQLTypes';
2
- import { Merge, Schema } from 'type-fest';
3
- export declare type PaginationSchema = Schema<PaginationType, boolean>;
4
- export declare type FiltersSchema = Schema<FiltersType, boolean>;
5
- declare type IdentifiersSchema = Schema<IdentifiersType, boolean>;
6
- declare type RelatedOfferSchema = Schema<RelatedOfferType, boolean>;
7
- /**
8
- * Field of type array are not handled by Schema, they must be overwritten
9
- */
10
- declare type MissingFieldsOfProductSchema = {
11
- addonPrimaries?: IdentifiersSchema;
12
- baseOfferPrimaries?: IdentifiersSchema;
13
- conversionOfferPrimaries?: IdentifiersSchema;
14
- relatedOffers?: RelatedOfferSchema;
15
- priceBand?: PriceBandSchema;
16
- };
17
- export declare type ProductSchema = Merge<Schema<ProductType, boolean>, MissingFieldsOfProductSchema>;
18
- declare type AttributeSchema = Schema<AttributeType, boolean>;
19
- /**
20
- * Field of type array are not handled by Schema, they must be overwritten
21
- */
22
- declare type MissingFieldsOfPriceBandSchema = {
23
- attributes?: Array<AttributeSchema>;
24
- };
25
- /**
26
- * No type corresponding
27
- */
28
- export declare type PriceBandSchema = Merge<Schema<PriceBandType, boolean>, MissingFieldsOfPriceBandSchema>;
29
- export declare type PriceBandPriceSchema = Schema<PricesType, boolean>;
30
- export {};
@@ -1,4 +0,0 @@
1
- "use strict";
2
- // Here are the schemas, they are useful to build the graphql requests
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- //# sourceMappingURL=catalogGraphQLSchemas.js.map
@@ -1,41 +0,0 @@
1
- /**
2
- * For field __args
3
- */
4
- export declare type QueryArguments = {
5
- paginate?: PaginateArgument;
6
- searchBody: SearchBodyArgument;
7
- };
8
- export declare type PaginateArgument = {
9
- page: number;
10
- perPage: number;
11
- };
12
- export declare type SearchBodyArgument = {
13
- aggregatorFilter?: string[];
14
- endCustomerRef?: string;
15
- exclusionFilters?: SearchFilterArgument[];
16
- filters?: SearchFilterArgument[];
17
- getFamilies?: boolean;
18
- highlight?: boolean;
19
- keywords?: string;
20
- marketplace?: string;
21
- quantity?: number;
22
- resellerRef?: string;
23
- restricted?: boolean;
24
- sort?: SortArgument;
25
- topOffers?: boolean;
26
- };
27
- export declare type SearchFilterArgument = {
28
- name: string;
29
- value: string | string[];
30
- operator?: OperatorArgument;
31
- filters?: SearchFilterArgument[];
32
- };
33
- export declare enum OperatorArgument {
34
- OR = "OR",
35
- AND = "AND",
36
- BETWEEN = "BETWEEN"
37
- }
38
- export declare type SortArgument = {
39
- name?: string;
40
- order?: string;
41
- };
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OperatorArgument = void 0;
4
- var OperatorArgument;
5
- (function (OperatorArgument) {
6
- OperatorArgument["OR"] = "OR";
7
- OperatorArgument["AND"] = "AND";
8
- OperatorArgument["BETWEEN"] = "BETWEEN";
9
- })(OperatorArgument = exports.OperatorArgument || (exports.OperatorArgument = {}));
10
- //# sourceMappingURL=queryArguments.js.map
@@ -1,3 +0,0 @@
1
- export interface HandleHttpExceptionOutput {
2
- mustRetry: boolean;
3
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=HandleHttpExceptionOutput.js.map
@@ -1,3 +0,0 @@
1
- export interface Hooks {
2
- setToken: (token: string) => void;
3
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=Hooks.js.map