@arrowsphere/api-client 3.27.0 → 3.28.0-rc.bjp.2

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 (145) hide show
  1. package/README.md +12 -0
  2. package/build/AbstractHttpClient.d.ts +36 -0
  3. package/build/AbstractHttpClient.js +65 -0
  4. package/build/abstractClient.d.ts +2 -19
  5. package/build/abstractClient.js +3 -22
  6. package/build/abstractEntity.js +14 -16
  7. package/build/abstractGraphQLClient.d.ts +4 -14
  8. package/build/abstractGraphQLClient.js +32 -24
  9. package/build/axiosSingleton.js +2 -2
  10. package/build/campaign/entities/campaign/banners/banners.js +32 -34
  11. package/build/campaign/entities/campaign/campaign.js +51 -53
  12. package/build/campaign/entities/campaign/landingPage/landingPage.js +24 -26
  13. package/build/campaign/entities/campaign/landingPage/landingPageBody.js +35 -37
  14. package/build/campaign/entities/campaign/landingPage/landingPageFooter/landingPageFooter.js +29 -31
  15. package/build/campaign/entities/campaign/landingPage/landingPageFooter/landingPageFooterFeature.js +23 -25
  16. package/build/campaign/entities/campaign/landingPage/landingPageHeader.js +29 -31
  17. package/build/campaign/entities/campaign/rules/rules.js +29 -31
  18. package/build/campaign/entities/campaignAssets/assets/assets.js +17 -19
  19. package/build/campaign/entities/campaignAssets/campaignAssets.js +14 -16
  20. package/build/campaign/entities/v2/campaign/banner/banner.js +32 -34
  21. package/build/campaign/entities/v2/campaign/campaign.js +48 -50
  22. package/build/campaign/entities/v2/campaign/landingPage/landingPage.js +24 -26
  23. package/build/campaign/entities/v2/campaign/landingPage/landingPageFooter/landingPageFooter.js +34 -36
  24. package/build/campaign/entities/v2/campaign/landingPage/landingPageFooter/landingPageFooterFeature.js +20 -22
  25. package/build/campaign/entities/v2/campaign/landingPage/landingPageFooter/landingPageFooterFeatureItem.js +32 -34
  26. package/build/campaign/entities/v2/campaign/landingPage/landingPageHeader.js +32 -34
  27. package/build/campaign/entities/v2/campaignList.js +14 -16
  28. package/build/campaign/index.js +5 -1
  29. package/build/cart/entities/index.js +5 -1
  30. package/build/cart/entities/item.js +26 -28
  31. package/build/cart/entities/itemList.js +14 -16
  32. package/build/cart/index.js +5 -1
  33. package/build/catalog/catalogGraphQLClient.d.ts +2 -0
  34. package/build/catalog/catalogGraphQLClient.js +14 -1
  35. package/build/catalog/index.d.ts +2 -0
  36. package/build/catalog/index.js +7 -1
  37. package/build/catalog/types/catalogGraphQLQueries.d.ts +12 -0
  38. package/build/catalog/types/catalogGraphQLQueries.js +3 -0
  39. package/build/catalog/types/catalogGraphQLSchemas.d.ts +30 -0
  40. package/build/catalog/types/catalogGraphQLSchemas.js +4 -0
  41. package/build/catalog/types/catalogGraphQLTypes.js +1 -0
  42. package/build/catalog/types/queryArguments.d.ts +41 -0
  43. package/build/catalog/types/queryArguments.js +10 -0
  44. package/build/consumption/entities/bi/consumptionBI.js +28 -30
  45. package/build/consumption/entities/bi/period/period.js +17 -19
  46. package/build/consumption/entities/bi/top/top.js +23 -25
  47. package/build/consumption/entities/consumption/consumption.js +17 -19
  48. package/build/consumption/index.js +5 -1
  49. package/build/contact/entities/contact.js +44 -46
  50. package/build/contact/entities/contactCreate.js +14 -16
  51. package/build/contact/entities/contactList.js +14 -16
  52. package/build/contact/index.js +5 -1
  53. package/build/customers/entities/customers/contact/contact.js +29 -31
  54. package/build/customers/entities/customers/customer.js +71 -73
  55. package/build/customers/entities/customers/customerContact/customerContact.js +38 -40
  56. package/build/customers/entities/customers/customerContact/customerContactList.js +14 -16
  57. package/build/customers/entities/customers/details/details.js +29 -31
  58. package/build/customers/entities/dataCustomers.js +14 -16
  59. package/build/customers/entities/dataInvitation.js +29 -31
  60. package/build/customers/entities/invitations/company/company.js +14 -16
  61. package/build/customers/entities/invitations/contact/invitationContact.js +26 -28
  62. package/build/customers/index.js +5 -1
  63. package/build/exception/exception-handlers/HandleHttpExceptionOutput.d.ts +3 -0
  64. package/build/exception/exception-handlers/HandleHttpExceptionOutput.js +3 -0
  65. package/build/exception/exception-handlers/Hooks.d.ts +3 -0
  66. package/build/exception/exception-handlers/Hooks.js +3 -0
  67. package/build/exception/exception-handlers/HttpExceptionHandler.d.ts +10 -0
  68. package/build/exception/exception-handlers/HttpExceptionHandler.js +3 -0
  69. package/build/exception/exception-handlers/index.d.ts +3 -0
  70. package/build/exception/exception-handlers/index.js +20 -0
  71. package/build/exception/index.js +5 -1
  72. package/build/exception/publicApiClientException.d.ts +2 -1
  73. package/build/exception/publicApiClientException.js +2 -1
  74. package/build/general/entities/whoAmI.js +59 -61
  75. package/build/general/index.js +5 -1
  76. package/build/getResult.js +21 -23
  77. package/build/index.d.ts +1 -0
  78. package/build/index.js +6 -1
  79. package/build/licenses/entities/filterFindResult.js +17 -19
  80. package/build/licenses/entities/findResult.js +36 -38
  81. package/build/licenses/entities/getLicense/actionMessagesGetResult.js +26 -28
  82. package/build/licenses/entities/getLicense/actionsGetResult.js +41 -43
  83. package/build/licenses/entities/getLicense/buySellFindResult.js +17 -19
  84. package/build/licenses/entities/getLicense/licenseGetResult.js +105 -107
  85. package/build/licenses/entities/getLicense/licensePriceGetResult.js +20 -22
  86. package/build/licenses/entities/getLicense/orderGetResult.js +17 -19
  87. package/build/licenses/entities/getResult/getLicenseResult.js +14 -16
  88. package/build/licenses/entities/history/actionHistoryResult.js +23 -25
  89. package/build/licenses/entities/history/licenceHistoryResult.js +14 -16
  90. package/build/licenses/entities/license/activeSeatsFindResult.js +17 -19
  91. package/build/licenses/entities/license/configFindResult.js +20 -22
  92. package/build/licenses/entities/license/licenseFindResult.js +134 -136
  93. package/build/licenses/entities/license/priceFindResult.js +26 -28
  94. package/build/licenses/entities/license/warningFindResult.js +17 -19
  95. package/build/licenses/entities/offer/actionFlagsFindResult.js +20 -22
  96. package/build/licenses/entities/offer/offerFindResult.js +32 -34
  97. package/build/licenses/entities/offer/priceBandFindResult.js +35 -37
  98. package/build/licenses/entities/offer/priceband/billingFindResult.js +20 -22
  99. package/build/licenses/entities/offer/priceband/identifiers/arrowsphereFindResult.js +14 -16
  100. package/build/licenses/entities/offer/priceband/identifiersFindResult.js +14 -16
  101. package/build/licenses/entities/offer/priceband/priceBandActionFlagsFindResult.js +26 -28
  102. package/build/licenses/entities/offer/priceband/priceBandPriceFindResult.js +20 -22
  103. package/build/licenses/entities/offer/priceband/saleConstraintsFindResult.js +17 -19
  104. package/build/licenses/index.js +5 -1
  105. package/build/orders/entities/dataListOrders.js +14 -16
  106. package/build/orders/entities/orders/order.js +39 -41
  107. package/build/orders/entities/orders/partner/partner.js +17 -19
  108. package/build/orders/entities/orders/products/identifiers/productIdentifiers.js +14 -16
  109. package/build/orders/entities/orders/products/identifiers/vendor/identifiersVendor.js +14 -16
  110. package/build/orders/entities/orders/products/prices/productPrices.js +32 -34
  111. package/build/orders/entities/orders/products/products.js +56 -58
  112. package/build/orders/entities/orders/products/program/productProgram.js +14 -16
  113. package/build/orders/entities/referenceLink.js +17 -19
  114. package/build/orders/index.js +5 -1
  115. package/build/pagination.js +29 -31
  116. package/build/security/index.js +5 -1
  117. package/build/security/register/entity/registrationLink.js +14 -16
  118. package/build/security/register/index.js +5 -1
  119. package/build/security/standards/entities/checks/checks.js +17 -19
  120. package/build/security/standards/entities/checks/securityChecks.js +38 -40
  121. package/build/security/standards/entities/resources/resources.js +26 -28
  122. package/build/security/standards/entities/resources/securityResources.js +17 -19
  123. package/build/security/standards/entities/standards/securityStandards.js +29 -31
  124. package/build/security/standards/entities/standards/standards.js +17 -19
  125. package/build/security/standards/index.js +5 -1
  126. package/build/securityScore/index.d.ts +2 -0
  127. package/build/securityScore/index.js +19 -0
  128. package/build/securityScore/securityScoreGraphQLClient.d.ts +17 -0
  129. package/build/securityScore/securityScoreGraphQLClient.js +35 -0
  130. package/build/securityScore/types/queryArguments.d.ts +72 -0
  131. package/build/securityScore/types/queryArguments.js +57 -0
  132. package/build/securityScore/types/securityScoreGraphQLQueries.d.ts +43 -0
  133. package/build/securityScore/types/securityScoreGraphQLQueries.js +3 -0
  134. package/build/securityScore/types/securityScoreGraphQLTypes.d.ts +144 -0
  135. package/build/securityScore/types/securityScoreGraphQLTypes.js +3 -0
  136. package/build/shared/index.js +5 -1
  137. package/build/subscriptions/entities/subscription.js +56 -58
  138. package/build/subscriptions/entities/subscriptionsListResult.js +39 -41
  139. package/build/subscriptions/index.js +5 -1
  140. package/build/supportCenter/entities/issue/attachment.js +27 -29
  141. package/build/supportCenter/entities/issue/comment.js +29 -31
  142. package/build/supportCenter/entities/issue/issue.js +106 -108
  143. package/build/supportCenter/entities/topic.js +30 -32
  144. package/build/supportCenter/index.js +5 -1
  145. package/package.json +5 -3
package/README.md CHANGED
@@ -50,6 +50,18 @@ 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)
53
65
 
54
66
  ### Licenses
55
67
 
@@ -0,0 +1,36 @@
1
+ import { HttpExceptionHandler, HandleHttpExceptionOutput } from './exception/exception-handlers';
2
+ import { PublicApiClientException } from './exception';
3
+ export declare abstract class AbstractHttpClient {
4
+ /**
5
+ * Base path for HTTP calls
6
+ */
7
+ protected basePath: string;
8
+ /**
9
+ * Current path for HTTP calls
10
+ */
11
+ protected path: string;
12
+ /**
13
+ * Token to authenticate the user
14
+ */
15
+ protected token: string;
16
+ /**
17
+ * ArrowSphere API URL
18
+ */
19
+ protected url: string;
20
+ /**
21
+ * Http Exceptions Handlers
22
+ */
23
+ protected httpExceptionHandlers: HttpExceptionHandler[];
24
+ setToken(token: string): this;
25
+ setUrl(url: string): this;
26
+ /**
27
+ * Allow to register error/exception handler.
28
+ * Handlers can be developed in another projects as long as they respect the interface HttpExceptionHandler.
29
+ */
30
+ registerHttpExceptionHandler(handler: HttpExceptionHandler): this;
31
+ /**
32
+ * Will find appropriate ErrorHandlers and apply them to the error in order of registering.
33
+ */
34
+ protected handleError(error: PublicApiClientException): Promise<HandleHttpExceptionOutput>;
35
+ protected mapToPublicApiException(error: any): PublicApiClientException;
36
+ }
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AbstractHttpClient = void 0;
4
+ const exception_1 = require("./exception");
5
+ class AbstractHttpClient {
6
+ constructor() {
7
+ /**
8
+ * Base path for HTTP calls
9
+ */
10
+ this.basePath = '';
11
+ /**
12
+ * Current path for HTTP calls
13
+ */
14
+ this.path = '';
15
+ /**
16
+ * Token to authenticate the user
17
+ */
18
+ this.token = '';
19
+ /**
20
+ * ArrowSphere API URL
21
+ */
22
+ this.url = '';
23
+ /**
24
+ * Http Exceptions Handlers
25
+ */
26
+ this.httpExceptionHandlers = [];
27
+ }
28
+ setToken(token) {
29
+ this.token = token;
30
+ return this;
31
+ }
32
+ setUrl(url) {
33
+ this.url = url;
34
+ return this;
35
+ }
36
+ /**
37
+ * Allow to register error/exception handler.
38
+ * Handlers can be developed in another projects as long as they respect the interface HttpExceptionHandler.
39
+ */
40
+ registerHttpExceptionHandler(handler) {
41
+ this.httpExceptionHandlers.push(handler);
42
+ return this;
43
+ }
44
+ /**
45
+ * Will find appropriate ErrorHandlers and apply them to the error in order of registering.
46
+ */
47
+ async handleError(error) {
48
+ const appropriateHandlers = this.httpExceptionHandlers.filter((handler) => handler.getHandledHttpStatuses().includes(error.httpCode));
49
+ // handle retry
50
+ const output = { mustRetry: false };
51
+ for (const handler of appropriateHandlers) {
52
+ const res = await handler.handle(error, {
53
+ setToken: this.setToken,
54
+ });
55
+ output.mustRetry = res.mustRetry;
56
+ }
57
+ return output;
58
+ }
59
+ mapToPublicApiException(error) {
60
+ var _a, _b;
61
+ 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);
62
+ }
63
+ }
64
+ exports.AbstractHttpClient = AbstractHttpClient;
65
+ //# sourceMappingURL=AbstractHttpClient.js.map
@@ -1,4 +1,5 @@
1
1
  import { AxiosInstance, AxiosResponse } from 'axios';
2
+ import { AbstractHttpClient } from './AbstractHttpClient';
2
3
  /**
3
4
  * Lists of available query parameters for the API call
4
5
  */
@@ -36,23 +37,11 @@ export declare type ConfigurationsClient = {
36
37
  export declare type ExtraInformationType = {
37
38
  [ExtraInformationFields.COLUMN_EXTRA_INFORMATION]?: Record<string, unknown>;
38
39
  };
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;
40
+ export declare abstract class AbstractClient extends AbstractHttpClient {
48
41
  /**
49
42
  * Axios instance for client
50
43
  */
51
44
  protected client: AxiosInstance;
52
- /**
53
- * ArrowSphere API URL
54
- */
55
- protected url: string;
56
45
  /**
57
46
  * ArrowSphere API key
58
47
  */
@@ -84,12 +73,6 @@ export declare abstract class AbstractClient {
84
73
  * @returns this
85
74
  */
86
75
  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;
93
76
  /**
94
77
  * Returns the API url.
95
78
  * @returns string
@@ -9,6 +9,7 @@ const querystring_1 = __importDefault(require("querystring"));
9
9
  const url_1 = require("url");
10
10
  const path_1 = __importDefault(require("path"));
11
11
  const axiosSingleton_1 = require("./axiosSingleton");
12
+ const AbstractHttpClient_1 = require("./AbstractHttpClient");
12
13
  /**
13
14
  * Lists of available query parameters for the API call
14
15
  */
@@ -27,25 +28,14 @@ var ExtraInformationFields;
27
28
  (function (ExtraInformationFields) {
28
29
  ExtraInformationFields["COLUMN_EXTRA_INFORMATION"] = "extraInformation";
29
30
  })(ExtraInformationFields = exports.ExtraInformationFields || (exports.ExtraInformationFields = {}));
30
- class AbstractClient {
31
+ class AbstractClient extends AbstractHttpClient_1.AbstractHttpClient {
31
32
  /**
32
33
  * AbstractClient constructor.
33
34
  * @returns AbstractClient
34
35
  */
35
36
  constructor(configuration) {
36
37
  var _a, _b, _c;
37
- /**
38
- * Base path for HTTP calls
39
- */
40
- this.basePath = '';
41
- /**
42
- * Current path for HTTP calls
43
- */
44
- this.path = '';
45
- /**
46
- * ArrowSphere API URL
47
- */
48
- this.url = '';
38
+ super();
49
39
  /**
50
40
  * ArrowSphere API key
51
41
  */
@@ -80,15 +70,6 @@ class AbstractClient {
80
70
  this.apiKey = key;
81
71
  return this;
82
72
  }
83
- /**
84
- * Sets the client ArrowSphere API url
85
- * @param url - API url
86
- * @returns this
87
- */
88
- setUrl(url) {
89
- this.url = url;
90
- return this;
91
- }
92
73
  /**
93
74
  * Returns the API url.
94
75
  * @returns string
@@ -1,21 +1,19 @@
1
1
  "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
3
- if (!privateMap.has(receiver)) {
4
- throw new TypeError("attempted to set private field on non-instance");
5
- }
6
- privateMap.set(receiver, value);
7
- return value;
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
8
7
  };
9
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
10
- if (!privateMap.has(receiver)) {
11
- throw new TypeError("attempted to get private field on non-instance");
12
- }
13
- return privateMap.get(receiver);
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
14
12
  };
15
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
16
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
17
15
  };
18
- var _entityDataInput;
16
+ var _AbstractEntity_entityDataInput;
19
17
  Object.defineProperty(exports, "__esModule", { value: true });
20
18
  exports.AbstractEntity = void 0;
21
19
  const validatorjs_1 = __importDefault(require("validatorjs"));
@@ -29,7 +27,7 @@ class AbstractEntity {
29
27
  * @param data - Data that will be used in the Entity
30
28
  */
31
29
  constructor(data) {
32
- _entityDataInput.set(this, void 0);
30
+ _AbstractEntity_entityDataInput.set(this, void 0);
33
31
  this.VALIDATION_RULES = {};
34
32
  this.VALIDATION_MESSAGES = {};
35
33
  /**
@@ -37,10 +35,10 @@ class AbstractEntity {
37
35
  */
38
36
  this.enableValidation = false;
39
37
  this.validate(data);
40
- __classPrivateFieldSet(this, _entityDataInput, data);
38
+ __classPrivateFieldSet(this, _AbstractEntity_entityDataInput, data, "f");
41
39
  }
42
40
  get entityDataInput() {
43
- return __classPrivateFieldGet(this, _entityDataInput);
41
+ return __classPrivateFieldGet(this, _AbstractEntity_entityDataInput, "f");
44
42
  }
45
43
  /**
46
44
  * Checks whether or not the entity data passes the validation rules
@@ -68,5 +66,5 @@ class AbstractEntity {
68
66
  }
69
67
  }
70
68
  exports.AbstractEntity = AbstractEntity;
71
- _entityDataInput = new WeakMap();
69
+ _AbstractEntity_entityDataInput = new WeakMap();
72
70
  //# sourceMappingURL=abstractEntity.js.map
@@ -2,26 +2,16 @@ 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';
5
6
  export declare type GraphQLResponseTypes = GetProductsType;
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;
7
+ export declare abstract class AbstractGraphQLClient extends AbstractHttpClient {
15
8
  protected client: GraphQLClient;
16
- protected url: string;
17
- protected token: string;
18
9
  protected optionsHeader?: Dom.RequestInit['headers'];
19
10
  protected options: Options;
20
11
  private getClient;
21
- setToken(apiKey: string): this;
22
- setUrl(url: string): this;
23
12
  setOptionsHeader(options: Dom.RequestInit['headers']): this;
24
13
  setOptions(options: Options): this;
25
- protected post(query: string): Promise<GraphQLResponseTypes>;
14
+ protected post<GraphQLResponseTypes>(query: string): Promise<GraphQLResponseTypes>;
26
15
  protected generateUrl(): string;
16
+ protected stringifyQuery(query: any): string;
27
17
  }
@@ -1,38 +1,42 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
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;
4
24
  };
5
25
  Object.defineProperty(exports, "__esModule", { value: true });
6
26
  exports.AbstractGraphQLClient = void 0;
7
27
  const graphql_request_1 = require("graphql-request");
8
- const url_1 = require("url");
9
- const path_1 = __importDefault(require("path"));
10
- class AbstractGraphQLClient {
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 {
11
32
  constructor() {
12
- /**
13
- * Base path for HTTP calls
14
- */
15
- this.basePath = '';
16
- /**
17
- * Current path for HTTP calls
18
- */
19
- this.path = '';
20
- this.url = '';
21
- this.token = '';
33
+ super(...arguments);
22
34
  this.options = {};
23
35
  }
24
36
  getClient() {
25
37
  this.client = new graphql_request_1.GraphQLClient(this.generateUrl());
26
38
  return this;
27
39
  }
28
- setToken(apiKey) {
29
- this.token = apiKey;
30
- return this;
31
- }
32
- setUrl(url) {
33
- this.url = url;
34
- return this;
35
- }
36
40
  setOptionsHeader(options) {
37
41
  this.optionsHeader = options;
38
42
  return this;
@@ -49,9 +53,13 @@ class AbstractGraphQLClient {
49
53
  return await this.client.request(query);
50
54
  }
51
55
  generateUrl() {
52
- const url = new url_1.URL(`${this.options.isAdmin ? path_1.default.join('admin', this.basePath) : this.basePath}${this.path}`, this.url);
56
+ const url = new URL(`${this.options.isAdmin ? path.join('admin', this.basePath) : this.basePath}${this.path}`, this.url);
53
57
  return url.toString();
54
58
  }
59
+ stringifyQuery(query) {
60
+ const graphqlQuery = (0, json_to_graphql_query_1.jsonToGraphQLQuery)(query);
61
+ return `{${graphqlQuery}}`;
62
+ }
55
63
  }
56
64
  exports.AbstractGraphQLClient = AbstractGraphQLClient;
57
65
  //# sourceMappingURL=abstractGraphQLClient.js.map
@@ -41,7 +41,7 @@ class AxiosSingleton {
41
41
  */
42
42
  static cleanRequestLog(request) {
43
43
  var _a;
44
- const tempRequest = lodash_1.cloneDeep(request);
44
+ const tempRequest = (0, lodash_1.cloneDeep)(request);
45
45
  // coverage bug delete undefined element
46
46
  /* istanbul ignore next */
47
47
  (_a = tempRequest.headers) === null || _a === void 0 ? true : delete _a.apiKey;
@@ -52,7 +52,7 @@ class AxiosSingleton {
52
52
  */
53
53
  static cleanResponseLog(response) {
54
54
  var _a;
55
- const tempResponse = lodash_1.cloneDeep(response);
55
+ const tempResponse = (0, lodash_1.cloneDeep)(response);
56
56
  // coverage bug delete undefined element
57
57
  /* istanbul ignore next */
58
58
  (_a = tempResponse.config.headers) === null || _a === void 0 ? true : delete _a.apiKey;
@@ -1,18 +1,16 @@
1
1
  "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
3
- if (!privateMap.has(receiver)) {
4
- throw new TypeError("attempted to set private field on non-instance");
5
- }
6
- privateMap.set(receiver, value);
7
- return value;
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
8
7
  };
9
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
10
- if (!privateMap.has(receiver)) {
11
- throw new TypeError("attempted to get private field on non-instance");
12
- }
13
- return privateMap.get(receiver);
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
14
12
  };
15
- var _backgroundImageUuid, _type, _buttonPlacement, _buttonText, _text, _textColor, _backgroundColor;
13
+ var _Banners_backgroundImageUuid, _Banners_type, _Banners_buttonPlacement, _Banners_buttonText, _Banners_text, _Banners_textColor, _Banners_backgroundColor;
16
14
  Object.defineProperty(exports, "__esModule", { value: true });
17
15
  exports.Banners = exports.BannersFields = void 0;
18
16
  const abstractEntity_1 = require("../../../../abstractEntity");
@@ -29,41 +27,41 @@ var BannersFields;
29
27
  class Banners extends abstractEntity_1.AbstractEntity {
30
28
  constructor(bannerInput) {
31
29
  super(bannerInput);
32
- _backgroundImageUuid.set(this, void 0);
33
- _type.set(this, void 0);
34
- _buttonPlacement.set(this, void 0);
35
- _buttonText.set(this, void 0);
36
- _text.set(this, void 0);
37
- _textColor.set(this, void 0);
38
- _backgroundColor.set(this, void 0);
39
- __classPrivateFieldSet(this, _backgroundImageUuid, bannerInput[BannersFields.COLUMN_BACKGROUND_IMAGE_UUID]);
40
- __classPrivateFieldSet(this, _type, bannerInput[BannersFields.COLUMN_TYPE]);
41
- __classPrivateFieldSet(this, _buttonPlacement, bannerInput[BannersFields.COLUMN_BUTTON_PLACEMENT]);
42
- __classPrivateFieldSet(this, _buttonText, bannerInput[BannersFields.COLUMN_BUTTON_TEXT]);
43
- __classPrivateFieldSet(this, _text, bannerInput[BannersFields.COLUMN_TEXT]);
44
- __classPrivateFieldSet(this, _textColor, bannerInput[BannersFields.COLUMN_TEXT_COLOR]);
45
- __classPrivateFieldSet(this, _backgroundColor, bannerInput[BannersFields.COLUMN_BACKGROUND_COLOR]);
30
+ _Banners_backgroundImageUuid.set(this, void 0);
31
+ _Banners_type.set(this, void 0);
32
+ _Banners_buttonPlacement.set(this, void 0);
33
+ _Banners_buttonText.set(this, void 0);
34
+ _Banners_text.set(this, void 0);
35
+ _Banners_textColor.set(this, void 0);
36
+ _Banners_backgroundColor.set(this, void 0);
37
+ __classPrivateFieldSet(this, _Banners_backgroundImageUuid, bannerInput[BannersFields.COLUMN_BACKGROUND_IMAGE_UUID], "f");
38
+ __classPrivateFieldSet(this, _Banners_type, bannerInput[BannersFields.COLUMN_TYPE], "f");
39
+ __classPrivateFieldSet(this, _Banners_buttonPlacement, bannerInput[BannersFields.COLUMN_BUTTON_PLACEMENT], "f");
40
+ __classPrivateFieldSet(this, _Banners_buttonText, bannerInput[BannersFields.COLUMN_BUTTON_TEXT], "f");
41
+ __classPrivateFieldSet(this, _Banners_text, bannerInput[BannersFields.COLUMN_TEXT], "f");
42
+ __classPrivateFieldSet(this, _Banners_textColor, bannerInput[BannersFields.COLUMN_TEXT_COLOR], "f");
43
+ __classPrivateFieldSet(this, _Banners_backgroundColor, bannerInput[BannersFields.COLUMN_BACKGROUND_COLOR], "f");
46
44
  }
47
45
  get backgroundImageUuid() {
48
- return __classPrivateFieldGet(this, _backgroundImageUuid);
46
+ return __classPrivateFieldGet(this, _Banners_backgroundImageUuid, "f");
49
47
  }
50
48
  get backgroundColor() {
51
- return __classPrivateFieldGet(this, _backgroundColor);
49
+ return __classPrivateFieldGet(this, _Banners_backgroundColor, "f");
52
50
  }
53
51
  get type() {
54
- return __classPrivateFieldGet(this, _type);
52
+ return __classPrivateFieldGet(this, _Banners_type, "f");
55
53
  }
56
54
  get buttonPlacement() {
57
- return __classPrivateFieldGet(this, _buttonPlacement);
55
+ return __classPrivateFieldGet(this, _Banners_buttonPlacement, "f");
58
56
  }
59
57
  get buttonText() {
60
- return __classPrivateFieldGet(this, _buttonText);
58
+ return __classPrivateFieldGet(this, _Banners_buttonText, "f");
61
59
  }
62
60
  get text() {
63
- return __classPrivateFieldGet(this, _text);
61
+ return __classPrivateFieldGet(this, _Banners_text, "f");
64
62
  }
65
63
  get textColor() {
66
- return __classPrivateFieldGet(this, _textColor);
64
+ return __classPrivateFieldGet(this, _Banners_textColor, "f");
67
65
  }
68
66
  toJSON() {
69
67
  return {
@@ -78,5 +76,5 @@ class Banners extends abstractEntity_1.AbstractEntity {
78
76
  }
79
77
  }
80
78
  exports.Banners = Banners;
81
- _backgroundImageUuid = new WeakMap(), _type = new WeakMap(), _buttonPlacement = new WeakMap(), _buttonText = new WeakMap(), _text = new WeakMap(), _textColor = new WeakMap(), _backgroundColor = new WeakMap();
79
+ _Banners_backgroundImageUuid = new WeakMap(), _Banners_type = new WeakMap(), _Banners_buttonPlacement = new WeakMap(), _Banners_buttonText = new WeakMap(), _Banners_text = new WeakMap(), _Banners_textColor = new WeakMap(), _Banners_backgroundColor = new WeakMap();
82
80
  //# sourceMappingURL=banners.js.map