@arrowsphere/api-client 3.28.0 → 3.29.0-rc.jpb.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 (156) hide show
  1. package/README.md +12 -0
  2. package/build/AbstractHttpClient.d.ts +47 -0
  3. package/build/AbstractHttpClient.js +80 -0
  4. package/build/abstractClient.d.ts +3 -19
  5. package/build/abstractClient.js +8 -23
  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/entities/program.js +32 -34
  36. package/build/catalog/entities/programs.js +14 -16
  37. package/build/catalog/index.d.ts +2 -0
  38. package/build/catalog/index.js +7 -1
  39. package/build/catalog/types/catalogGraphQLQueries.d.ts +12 -0
  40. package/build/catalog/types/catalogGraphQLQueries.js +3 -0
  41. package/build/catalog/types/catalogGraphQLSchemas.d.ts +30 -0
  42. package/build/catalog/types/catalogGraphQLSchemas.js +4 -0
  43. package/build/catalog/types/catalogGraphQLTypes.js +1 -0
  44. package/build/catalog/types/queryArguments.d.ts +41 -0
  45. package/build/catalog/types/queryArguments.js +10 -0
  46. package/build/consumption/entities/bi/consumptionBI.js +28 -30
  47. package/build/consumption/entities/bi/period/period.js +17 -19
  48. package/build/consumption/entities/bi/top/top.js +23 -25
  49. package/build/consumption/entities/consumption/consumption.js +17 -19
  50. package/build/consumption/index.js +5 -1
  51. package/build/contact/entities/contact.js +44 -46
  52. package/build/contact/entities/contactCreate.js +14 -16
  53. package/build/contact/entities/contactList.js +14 -16
  54. package/build/contact/index.js +5 -1
  55. package/build/customers/entities/customers/contact/contact.js +29 -31
  56. package/build/customers/entities/customers/customer.js +71 -73
  57. package/build/customers/entities/customers/customerContact/customerContact.js +38 -40
  58. package/build/customers/entities/customers/customerContact/customerContactList.js +14 -16
  59. package/build/customers/entities/customers/details/details.js +29 -31
  60. package/build/customers/entities/dataCustomers.js +14 -16
  61. package/build/customers/entities/dataInvitation.js +29 -31
  62. package/build/customers/entities/invitations/company/company.js +14 -16
  63. package/build/customers/entities/invitations/contact/invitationContact.js +26 -28
  64. package/build/customers/index.js +5 -1
  65. package/build/exception/exception-handlers/HandleHttpExceptionOutput.d.ts +3 -0
  66. package/build/exception/exception-handlers/HandleHttpExceptionOutput.js +3 -0
  67. package/build/exception/exception-handlers/Hooks.d.ts +3 -0
  68. package/build/exception/exception-handlers/Hooks.js +3 -0
  69. package/build/exception/exception-handlers/HttpExceptionHandler.d.ts +10 -0
  70. package/build/exception/exception-handlers/HttpExceptionHandler.js +3 -0
  71. package/build/exception/exception-handlers/index.d.ts +3 -0
  72. package/build/exception/exception-handlers/index.js +20 -0
  73. package/build/exception/index.js +5 -1
  74. package/build/exception/publicApiClientException.d.ts +2 -1
  75. package/build/exception/publicApiClientException.js +2 -1
  76. package/build/general/entities/whoAmI.js +59 -61
  77. package/build/general/index.js +5 -1
  78. package/build/getResult.js +21 -23
  79. package/build/index.d.ts +1 -0
  80. package/build/index.js +6 -1
  81. package/build/licenses/entities/filterFindResult.js +17 -19
  82. package/build/licenses/entities/findResult.d.ts +1 -1
  83. package/build/licenses/entities/findResult.js +37 -39
  84. package/build/licenses/entities/getLicense/actionMessagesGetResult.js +26 -28
  85. package/build/licenses/entities/getLicense/actionsGetResult.js +41 -43
  86. package/build/licenses/entities/getLicense/buySellFindResult.js +17 -19
  87. package/build/licenses/entities/getLicense/licenseGetResult.js +105 -107
  88. package/build/licenses/entities/getLicense/licensePriceGetResult.js +20 -22
  89. package/build/licenses/entities/getLicense/orderGetResult.js +17 -19
  90. package/build/licenses/entities/getResult/getLicenseResult.js +14 -16
  91. package/build/licenses/entities/history/actionHistoryResult.js +23 -25
  92. package/build/licenses/entities/history/licenceHistoryResult.js +14 -16
  93. package/build/licenses/entities/license/activeSeatsFindResult.js +17 -19
  94. package/build/licenses/entities/license/configFindResult.js +20 -22
  95. package/build/licenses/entities/license/licenseFindResult.js +134 -136
  96. package/build/licenses/entities/license/priceFindResult.js +26 -28
  97. package/build/licenses/entities/license/warningFindResult.js +17 -19
  98. package/build/licenses/entities/offer/actionFlagsFindResult.js +20 -22
  99. package/build/licenses/entities/offer/offerFindResult.js +32 -34
  100. package/build/licenses/entities/offer/priceBandFindResult.js +35 -37
  101. package/build/licenses/entities/offer/priceband/billingFindResult.js +20 -22
  102. package/build/licenses/entities/offer/priceband/identifiers/arrowsphereFindResult.js +14 -16
  103. package/build/licenses/entities/offer/priceband/identifiersFindResult.js +14 -16
  104. package/build/licenses/entities/offer/priceband/priceBandActionFlagsFindResult.js +26 -28
  105. package/build/licenses/entities/offer/priceband/priceBandPriceFindResult.js +20 -22
  106. package/build/licenses/entities/offer/priceband/saleConstraintsFindResult.js +17 -19
  107. package/build/licenses/index.js +5 -1
  108. package/build/orders/entities/dataListOrders.js +14 -16
  109. package/build/orders/entities/orders/order.js +39 -41
  110. package/build/orders/entities/orders/partner/partner.js +17 -19
  111. package/build/orders/entities/orders/products/identifiers/productIdentifiers.js +14 -16
  112. package/build/orders/entities/orders/products/identifiers/vendor/identifiersVendor.js +14 -16
  113. package/build/orders/entities/orders/products/prices/productPrices.js +32 -34
  114. package/build/orders/entities/orders/products/products.js +56 -58
  115. package/build/orders/entities/orders/products/program/productProgram.js +14 -16
  116. package/build/orders/entities/referenceLink.js +17 -19
  117. package/build/orders/index.js +5 -1
  118. package/build/pagination.js +29 -31
  119. package/build/security/index.js +5 -1
  120. package/build/security/register/entity/registrationLink.js +14 -16
  121. package/build/security/register/index.js +5 -1
  122. package/build/security/standards/entities/checks/checks.js +17 -19
  123. package/build/security/standards/entities/checks/securityChecks.js +38 -40
  124. package/build/security/standards/entities/resources/resources.js +26 -28
  125. package/build/security/standards/entities/resources/securityResources.js +17 -19
  126. package/build/security/standards/entities/standards/securityStandards.js +29 -31
  127. package/build/security/standards/entities/standards/standards.js +17 -19
  128. package/build/security/standards/index.js +5 -1
  129. package/build/securityScore/entities/getCustomerAccountData.d.ts +44 -0
  130. package/build/securityScore/entities/getCustomerAccountData.js +99 -0
  131. package/build/securityScore/entities/getCustomerData.d.ts +44 -0
  132. package/build/securityScore/entities/getCustomerData.js +99 -0
  133. package/build/securityScore/entities/getPartnerData.d.ts +39 -0
  134. package/build/securityScore/entities/getPartnerData.js +88 -0
  135. package/build/securityScore/index.d.ts +7 -0
  136. package/build/securityScore/index.js +24 -0
  137. package/build/securityScore/securityScoreGraphQLClient.d.ts +19 -0
  138. package/build/securityScore/securityScoreGraphQLClient.js +61 -0
  139. package/build/securityScore/types/queryArguments.d.ts +108 -0
  140. package/build/securityScore/types/queryArguments.js +93 -0
  141. package/build/securityScore/types/securityScoreGraphQLQueries.d.ts +55 -0
  142. package/build/securityScore/types/securityScoreGraphQLQueries.js +7 -0
  143. package/build/securityScore/types/securityScoreGraphQLSchemas.d.ts +71 -0
  144. package/build/securityScore/types/securityScoreGraphQLSchemas.js +3 -0
  145. package/build/securityScore/types/securityScoreGraphQLTypes.d.ts +165 -0
  146. package/build/securityScore/types/securityScoreGraphQLTypes.js +3 -0
  147. package/build/shared/index.js +5 -1
  148. package/build/subscriptions/entities/subscription.js +56 -58
  149. package/build/subscriptions/entities/subscriptionsListResult.js +39 -41
  150. package/build/subscriptions/index.js +5 -1
  151. package/build/supportCenter/entities/issue/attachment.js +27 -29
  152. package/build/supportCenter/entities/issue/comment.js +29 -31
  153. package/build/supportCenter/entities/issue/issue.js +106 -108
  154. package/build/supportCenter/entities/topic.js +30 -32
  155. package/build/supportCenter/index.js +5 -1
  156. 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,47 @@
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
+ }
@@ -0,0 +1,80 @@
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,9 +1,11 @@
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
  */
5
6
  export declare enum ParameterKeys {
6
7
  API_KEY = "apiKey",
8
+ AUTHORIZATION = "Authorization",
7
9
  HEADERS = "headers",
8
10
  ORDER_BY = "order_by",
9
11
  PAGE = "page",
@@ -36,23 +38,11 @@ export declare type ConfigurationsClient = {
36
38
  export declare type ExtraInformationType = {
37
39
  [ExtraInformationFields.COLUMN_EXTRA_INFORMATION]?: Record<string, unknown>;
38
40
  };
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;
41
+ export declare abstract class AbstractClient extends AbstractHttpClient {
48
42
  /**
49
43
  * Axios instance for client
50
44
  */
51
45
  protected client: AxiosInstance;
52
- /**
53
- * ArrowSphere API URL
54
- */
55
- protected url: string;
56
46
  /**
57
47
  * ArrowSphere API key
58
48
  */
@@ -84,12 +74,6 @@ export declare abstract class AbstractClient {
84
74
  * @returns this
85
75
  */
86
76
  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
77
  /**
94
78
  * Returns the API url.
95
79
  * @returns string
@@ -9,12 +9,14 @@ 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
  */
15
16
  var ParameterKeys;
16
17
  (function (ParameterKeys) {
17
18
  ParameterKeys["API_KEY"] = "apiKey";
19
+ ParameterKeys["AUTHORIZATION"] = "Authorization";
18
20
  ParameterKeys["HEADERS"] = "headers";
19
21
  ParameterKeys["ORDER_BY"] = "order_by";
20
22
  ParameterKeys["PAGE"] = "page";
@@ -27,25 +29,14 @@ var ExtraInformationFields;
27
29
  (function (ExtraInformationFields) {
28
30
  ExtraInformationFields["COLUMN_EXTRA_INFORMATION"] = "extraInformation";
29
31
  })(ExtraInformationFields = exports.ExtraInformationFields || (exports.ExtraInformationFields = {}));
30
- class AbstractClient {
32
+ class AbstractClient extends AbstractHttpClient_1.AbstractHttpClient {
31
33
  /**
32
34
  * AbstractClient constructor.
33
35
  * @returns AbstractClient
34
36
  */
35
37
  constructor(configuration) {
36
38
  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 = '';
39
+ super();
49
40
  /**
50
41
  * ArrowSphere API key
51
42
  */
@@ -80,15 +71,6 @@ class AbstractClient {
80
71
  this.apiKey = key;
81
72
  return this;
82
73
  }
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
74
  /**
93
75
  * Returns the API url.
94
76
  * @returns string
@@ -157,9 +139,12 @@ class AbstractClient {
157
139
  * @returns {@link Headers}
158
140
  */
159
141
  prepareHeaders(headers) {
142
+ const securityHeader = this.security === AbstractHttpClient_1.HttpClientSecurity.API_KEY
143
+ ? { [ParameterKeys.API_KEY]: this.apiKey }
144
+ : { [ParameterKeys.AUTHORIZATION]: this.token };
160
145
  return {
161
146
  ...headers,
162
- [ParameterKeys.API_KEY]: this.apiKey,
147
+ ...securityHeader,
163
148
  ...this.headers,
164
149
  };
165
150
  }
@@ -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