@arrowsphere/api-client 3.28.0-rc.fdi.1 → 3.29.0-rc.bdj.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.
- package/CHANGELOG.md +2 -4
- package/README.md +12 -0
- package/build/AbstractHttpClient.d.ts +47 -0
- package/build/AbstractHttpClient.js +80 -0
- package/build/abstractClient.d.ts +3 -24
- package/build/abstractClient.js +9 -33
- package/build/abstractEntity.js +14 -16
- package/build/abstractGraphQLClient.d.ts +4 -14
- package/build/abstractGraphQLClient.js +32 -24
- package/build/axiosSingleton.js +2 -2
- package/build/campaign/entities/campaign/banners/banners.js +32 -34
- package/build/campaign/entities/campaign/campaign.js +51 -53
- package/build/campaign/entities/campaign/landingPage/landingPage.js +24 -26
- package/build/campaign/entities/campaign/landingPage/landingPageBody.js +35 -37
- package/build/campaign/entities/campaign/landingPage/landingPageFooter/landingPageFooter.js +29 -31
- package/build/campaign/entities/campaign/landingPage/landingPageFooter/landingPageFooterFeature.js +23 -25
- package/build/campaign/entities/campaign/landingPage/landingPageHeader.js +29 -31
- package/build/campaign/entities/campaign/rules/rules.js +29 -31
- package/build/campaign/entities/campaignAssets/assets/assets.js +17 -19
- package/build/campaign/entities/campaignAssets/campaignAssets.js +14 -16
- package/build/campaign/entities/v2/campaign/banner/banner.js +32 -34
- package/build/campaign/entities/v2/campaign/campaign.js +48 -50
- package/build/campaign/entities/v2/campaign/landingPage/landingPage.js +24 -26
- package/build/campaign/entities/v2/campaign/landingPage/landingPageFooter/landingPageFooter.js +34 -36
- package/build/campaign/entities/v2/campaign/landingPage/landingPageFooter/landingPageFooterFeature.js +20 -22
- package/build/campaign/entities/v2/campaign/landingPage/landingPageFooter/landingPageFooterFeatureItem.js +32 -34
- package/build/campaign/entities/v2/campaign/landingPage/landingPageHeader.js +32 -34
- package/build/campaign/entities/v2/campaignList.js +14 -16
- package/build/campaign/index.d.ts +0 -1
- package/build/campaign/index.js +5 -2
- package/build/cart/entities/index.js +5 -1
- package/build/cart/entities/item.js +26 -28
- package/build/cart/entities/itemList.js +14 -16
- package/build/cart/index.js +5 -1
- package/build/catalog/catalogClient.d.ts +12 -0
- package/build/catalog/catalogClient.js +26 -0
- package/build/catalog/catalogGraphQLClient.d.ts +2 -0
- package/build/catalog/catalogGraphQLClient.js +14 -1
- package/build/catalog/entities/program.d.ts +66 -0
- package/build/catalog/entities/program.js +100 -0
- package/build/catalog/entities/programs.d.ts +9 -0
- package/build/catalog/entities/programs.js +33 -0
- package/build/catalog/index.d.ts +5 -0
- package/build/catalog/index.js +10 -1
- package/build/catalog/types/catalogGraphQLQueries.d.ts +12 -0
- package/build/catalog/types/catalogGraphQLQueries.js +3 -0
- package/build/catalog/types/catalogGraphQLSchemas.d.ts +30 -0
- package/build/catalog/types/catalogGraphQLSchemas.js +4 -0
- package/build/catalog/types/catalogGraphQLTypes.d.ts +2 -2
- package/build/catalog/types/catalogGraphQLTypes.js +1 -0
- package/build/catalog/types/queryArguments.d.ts +41 -0
- package/build/catalog/types/queryArguments.js +10 -0
- package/build/consumption/entities/bi/consumptionBI.js +28 -30
- package/build/consumption/entities/bi/period/period.js +17 -19
- package/build/consumption/entities/bi/top/top.js +23 -25
- package/build/consumption/entities/consumption/consumption.js +17 -19
- package/build/consumption/index.js +5 -1
- package/build/contact/entities/contact.js +44 -46
- package/build/contact/entities/contactCreate.js +14 -16
- package/build/contact/entities/contactList.js +14 -16
- package/build/contact/index.js +5 -1
- package/build/customers/entities/customers/contact/contact.js +29 -31
- package/build/customers/entities/customers/customer.js +71 -73
- package/build/customers/entities/customers/customerContact/customerContact.js +38 -40
- package/build/customers/entities/customers/customerContact/customerContactList.js +14 -16
- package/build/customers/entities/customers/details/details.js +29 -31
- package/build/customers/entities/dataCustomers.js +14 -16
- package/build/customers/entities/dataInvitation.js +29 -31
- package/build/customers/entities/invitations/company/company.js +14 -16
- package/build/customers/entities/invitations/contact/invitationContact.js +26 -28
- package/build/customers/index.js +5 -1
- package/build/exception/exception-handlers/HandleHttpExceptionOutput.d.ts +3 -0
- package/build/exception/exception-handlers/HandleHttpExceptionOutput.js +3 -0
- package/build/exception/exception-handlers/Hooks.d.ts +3 -0
- package/build/exception/exception-handlers/Hooks.js +3 -0
- package/build/exception/exception-handlers/HttpExceptionHandler.d.ts +10 -0
- package/build/exception/exception-handlers/HttpExceptionHandler.js +3 -0
- package/build/exception/exception-handlers/index.d.ts +3 -0
- package/build/{notifications → exception/exception-handlers}/index.js +8 -6
- package/build/exception/index.js +5 -1
- package/build/exception/publicApiClientException.d.ts +2 -1
- package/build/exception/publicApiClientException.js +2 -1
- package/build/general/entities/whoAmI.js +59 -61
- package/build/general/index.js +5 -1
- package/build/getResult.js +21 -23
- package/build/index.d.ts +1 -1
- package/build/index.js +6 -2
- package/build/licenses/entities/filterFindResult.js +17 -19
- package/build/licenses/entities/findResult.d.ts +1 -1
- package/build/licenses/entities/findResult.js +37 -39
- package/build/licenses/entities/getLicense/actionMessagesGetResult.js +26 -28
- package/build/licenses/entities/getLicense/actionsGetResult.js +41 -43
- package/build/licenses/entities/getLicense/buySellFindResult.js +17 -19
- package/build/licenses/entities/getLicense/licenseGetResult.js +105 -107
- package/build/licenses/entities/getLicense/licensePriceGetResult.js +20 -22
- package/build/licenses/entities/getLicense/orderGetResult.js +17 -19
- package/build/licenses/entities/getResult/getLicenseResult.js +14 -16
- package/build/licenses/entities/history/actionHistoryResult.js +23 -25
- package/build/licenses/entities/history/licenceHistoryResult.js +14 -16
- package/build/licenses/entities/license/activeSeatsFindResult.js +17 -19
- package/build/licenses/entities/license/configFindResult.js +20 -22
- package/build/licenses/entities/license/licenseFindResult.js +134 -136
- package/build/licenses/entities/license/priceFindResult.js +26 -28
- package/build/licenses/entities/license/warningFindResult.js +17 -19
- package/build/licenses/entities/offer/actionFlagsFindResult.js +20 -22
- package/build/licenses/entities/offer/offerFindResult.js +32 -34
- package/build/licenses/entities/offer/priceBandFindResult.js +35 -37
- package/build/licenses/entities/offer/priceband/billingFindResult.js +20 -22
- package/build/licenses/entities/offer/priceband/identifiers/arrowsphereFindResult.js +14 -16
- package/build/licenses/entities/offer/priceband/identifiersFindResult.js +14 -16
- package/build/licenses/entities/offer/priceband/priceBandActionFlagsFindResult.js +26 -28
- package/build/licenses/entities/offer/priceband/priceBandPriceFindResult.js +20 -22
- package/build/licenses/entities/offer/priceband/saleConstraintsFindResult.js +17 -19
- package/build/licenses/index.js +5 -1
- package/build/orders/entities/dataListOrders.js +14 -16
- package/build/orders/entities/orders/order.js +39 -41
- package/build/orders/entities/orders/partner/partner.js +17 -19
- package/build/orders/entities/orders/products/identifiers/productIdentifiers.js +14 -16
- package/build/orders/entities/orders/products/identifiers/vendor/identifiersVendor.js +14 -16
- package/build/orders/entities/orders/products/prices/productPrices.js +32 -34
- package/build/orders/entities/orders/products/products.js +56 -58
- package/build/orders/entities/orders/products/program/productProgram.js +14 -16
- package/build/orders/entities/referenceLink.js +17 -19
- package/build/orders/index.js +5 -1
- package/build/pagination.js +29 -31
- package/build/publicApiClient.d.ts +2 -2
- package/build/publicApiClient.js +4 -4
- package/build/security/index.js +5 -1
- package/build/security/register/entity/registrationLink.js +14 -16
- package/build/security/register/index.js +5 -1
- package/build/security/standards/entities/checks/checks.js +17 -19
- package/build/security/standards/entities/checks/securityChecks.js +38 -40
- package/build/security/standards/entities/resources/resources.js +26 -28
- package/build/security/standards/entities/resources/securityResources.js +17 -19
- package/build/security/standards/entities/standards/securityStandards.js +29 -31
- package/build/security/standards/entities/standards/standards.js +17 -19
- package/build/security/standards/index.js +5 -1
- package/build/securityScore/entities/getCustomerAccountData.d.ts +48 -0
- package/build/securityScore/entities/getCustomerAccountData.js +111 -0
- package/build/securityScore/entities/getCustomerData.d.ts +51 -0
- package/build/securityScore/entities/getCustomerData.js +117 -0
- package/build/securityScore/entities/getPartnerData.d.ts +45 -0
- package/build/securityScore/entities/getPartnerData.js +102 -0
- package/build/securityScore/index.d.ts +7 -0
- package/build/securityScore/index.js +24 -0
- package/build/securityScore/securityScoreGraphQLClient.d.ts +19 -0
- package/build/securityScore/securityScoreGraphQLClient.js +61 -0
- package/build/securityScore/types/queryArguments.d.ts +108 -0
- package/build/securityScore/types/queryArguments.js +93 -0
- package/build/securityScore/types/securityScoreGraphQLQueries.d.ts +62 -0
- package/build/securityScore/types/securityScoreGraphQLQueries.js +7 -0
- package/build/securityScore/types/securityScoreGraphQLSchemas.d.ts +78 -0
- package/build/securityScore/types/securityScoreGraphQLSchemas.js +3 -0
- package/build/securityScore/types/securityScoreGraphQLTypes.d.ts +190 -0
- package/build/securityScore/types/securityScoreGraphQLTypes.js +3 -0
- package/build/shared/index.js +5 -1
- package/build/subscriptions/entities/subscription.js +56 -58
- package/build/subscriptions/entities/subscriptionsListResult.js +39 -41
- package/build/subscriptions/index.js +5 -1
- package/build/supportCenter/entities/issue/attachment.js +27 -29
- package/build/supportCenter/entities/issue/comment.js +29 -31
- package/build/supportCenter/entities/issue/issue.js +106 -108
- package/build/supportCenter/entities/topic.js +30 -32
- package/build/supportCenter/index.js +5 -1
- package/package.json +5 -3
- package/build/notifications/entities/details/notificationDetails.d.ts +0 -31
- package/build/notifications/entities/details/notificationDetails.js +0 -82
- package/build/notifications/entities/notification.d.ts +0 -14
- package/build/notifications/entities/notification.js +0 -41
- package/build/notifications/entities/notifications.d.ts +0 -14
- package/build/notifications/entities/notifications.js +0 -41
- package/build/notifications/entities/total.d.ts +0 -13
- package/build/notifications/entities/total.js +0 -40
- package/build/notifications/index.d.ts +0 -5
- package/build/notifications/notificationsClient.d.ts +0 -39
- package/build/notifications/notificationsClient.js +0 -60
package/CHANGELOG.md
CHANGED
|
@@ -3,16 +3,14 @@
|
|
|
3
3
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
4
4
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
5
5
|
|
|
6
|
-
## [3.28.0] - 2023-05-
|
|
6
|
+
## [3.28.0] - 2023-05-22
|
|
7
7
|
|
|
8
8
|
### Changed
|
|
9
9
|
|
|
10
|
-
-
|
|
10
|
+
- Add catalog programs endpoints
|
|
11
11
|
|
|
12
12
|
## [3.27.0] - 2023-05-10
|
|
13
13
|
|
|
14
|
-
### Changed
|
|
15
|
-
|
|
16
14
|
- update create order client to add attributes for injection scenario
|
|
17
15
|
|
|
18
16
|
## [3.26.0] - 2023-04-20
|
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,31 +38,15 @@ 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
|
*/
|
|
59
49
|
protected apiKey: string;
|
|
60
|
-
/**
|
|
61
|
-
* ArrowSphere token
|
|
62
|
-
*/
|
|
63
|
-
protected token: string;
|
|
64
50
|
/**
|
|
65
51
|
* Current pagination page number
|
|
66
52
|
*/
|
|
@@ -88,13 +74,6 @@ export declare abstract class AbstractClient {
|
|
|
88
74
|
* @returns this
|
|
89
75
|
*/
|
|
90
76
|
setApiKey(key: string): this;
|
|
91
|
-
setToken(apiKey: string): this;
|
|
92
|
-
/**
|
|
93
|
-
* Sets the client ArrowSphere API url
|
|
94
|
-
* @param url - API url
|
|
95
|
-
* @returns this
|
|
96
|
-
*/
|
|
97
|
-
setUrl(url: string): this;
|
|
98
77
|
/**
|
|
99
78
|
* Returns the API url.
|
|
100
79
|
* @returns string
|
package/build/abstractClient.js
CHANGED
|
@@ -6,15 +6,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.AbstractClient = exports.ExtraInformationFields = exports.ParameterKeys = void 0;
|
|
7
7
|
const exception_1 = require("./exception");
|
|
8
8
|
const querystring_1 = __importDefault(require("querystring"));
|
|
9
|
-
const url_1 = require("url");
|
|
10
9
|
const path_1 = __importDefault(require("path"));
|
|
11
10
|
const axiosSingleton_1 = require("./axiosSingleton");
|
|
11
|
+
const AbstractHttpClient_1 = require("./AbstractHttpClient");
|
|
12
12
|
/**
|
|
13
13
|
* Lists of available query parameters for the API call
|
|
14
14
|
*/
|
|
15
15
|
var ParameterKeys;
|
|
16
16
|
(function (ParameterKeys) {
|
|
17
17
|
ParameterKeys["API_KEY"] = "apiKey";
|
|
18
|
+
ParameterKeys["AUTHORIZATION"] = "Authorization";
|
|
18
19
|
ParameterKeys["HEADERS"] = "headers";
|
|
19
20
|
ParameterKeys["ORDER_BY"] = "order_by";
|
|
20
21
|
ParameterKeys["PAGE"] = "page";
|
|
@@ -27,33 +28,18 @@ 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
|
*/
|
|
52
42
|
this.apiKey = '';
|
|
53
|
-
/**
|
|
54
|
-
* ArrowSphere token
|
|
55
|
-
*/
|
|
56
|
-
this.token = '';
|
|
57
43
|
/**
|
|
58
44
|
* Current pagination page number
|
|
59
45
|
*/
|
|
@@ -84,19 +70,6 @@ class AbstractClient {
|
|
|
84
70
|
this.apiKey = key;
|
|
85
71
|
return this;
|
|
86
72
|
}
|
|
87
|
-
setToken(apiKey) {
|
|
88
|
-
this.token = apiKey;
|
|
89
|
-
return this;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Sets the client ArrowSphere API url
|
|
93
|
-
* @param url - API url
|
|
94
|
-
* @returns this
|
|
95
|
-
*/
|
|
96
|
-
setUrl(url) {
|
|
97
|
-
this.url = url;
|
|
98
|
-
return this;
|
|
99
|
-
}
|
|
100
73
|
/**
|
|
101
74
|
* Returns the API url.
|
|
102
75
|
* @returns string
|
|
@@ -165,9 +138,12 @@ class AbstractClient {
|
|
|
165
138
|
* @returns {@link Headers}
|
|
166
139
|
*/
|
|
167
140
|
prepareHeaders(headers) {
|
|
141
|
+
const securityHeader = this.security === AbstractHttpClient_1.HttpClientSecurity.API_KEY
|
|
142
|
+
? { [ParameterKeys.API_KEY]: this.apiKey }
|
|
143
|
+
: { [ParameterKeys.AUTHORIZATION]: this.token };
|
|
168
144
|
return {
|
|
169
145
|
...headers,
|
|
170
|
-
|
|
146
|
+
...securityHeader,
|
|
171
147
|
...this.headers,
|
|
172
148
|
};
|
|
173
149
|
}
|
|
@@ -235,7 +211,7 @@ class AbstractClient {
|
|
|
235
211
|
*/
|
|
236
212
|
generateUrl(parameters, options) {
|
|
237
213
|
const params = { ...parameters, ...this.generatePagination() };
|
|
238
|
-
const url = new
|
|
214
|
+
const url = new URL(`${options.isAdmin ? path_1.default.join('admin', this.basePath) : this.basePath}${this.path}`, this.url);
|
|
239
215
|
if (Object.values(params).length) {
|
|
240
216
|
url.search = querystring_1.default.stringify(params);
|
|
241
217
|
}
|
package/build/abstractEntity.js
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver,
|
|
3
|
-
if (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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,
|
|
10
|
-
if (!
|
|
11
|
-
|
|
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
|
|
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
|
-
|
|
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,
|
|
38
|
+
__classPrivateFieldSet(this, _AbstractEntity_entityDataInput, data, "f");
|
|
41
39
|
}
|
|
42
40
|
get entityDataInput() {
|
|
43
|
-
return __classPrivateFieldGet(this,
|
|
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
|
-
|
|
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
|
|
3
|
-
|
|
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
|
|
9
|
-
const
|
|
10
|
-
|
|
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
|
|
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
|
package/build/axiosSingleton.js
CHANGED
|
@@ -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,
|
|
3
|
-
if (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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,
|
|
10
|
-
if (!
|
|
11
|
-
|
|
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
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
__classPrivateFieldSet(this,
|
|
40
|
-
__classPrivateFieldSet(this,
|
|
41
|
-
__classPrivateFieldSet(this,
|
|
42
|
-
__classPrivateFieldSet(this,
|
|
43
|
-
__classPrivateFieldSet(this,
|
|
44
|
-
__classPrivateFieldSet(this,
|
|
45
|
-
__classPrivateFieldSet(this,
|
|
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,
|
|
46
|
+
return __classPrivateFieldGet(this, _Banners_backgroundImageUuid, "f");
|
|
49
47
|
}
|
|
50
48
|
get backgroundColor() {
|
|
51
|
-
return __classPrivateFieldGet(this,
|
|
49
|
+
return __classPrivateFieldGet(this, _Banners_backgroundColor, "f");
|
|
52
50
|
}
|
|
53
51
|
get type() {
|
|
54
|
-
return __classPrivateFieldGet(this,
|
|
52
|
+
return __classPrivateFieldGet(this, _Banners_type, "f");
|
|
55
53
|
}
|
|
56
54
|
get buttonPlacement() {
|
|
57
|
-
return __classPrivateFieldGet(this,
|
|
55
|
+
return __classPrivateFieldGet(this, _Banners_buttonPlacement, "f");
|
|
58
56
|
}
|
|
59
57
|
get buttonText() {
|
|
60
|
-
return __classPrivateFieldGet(this,
|
|
58
|
+
return __classPrivateFieldGet(this, _Banners_buttonText, "f");
|
|
61
59
|
}
|
|
62
60
|
get text() {
|
|
63
|
-
return __classPrivateFieldGet(this,
|
|
61
|
+
return __classPrivateFieldGet(this, _Banners_text, "f");
|
|
64
62
|
}
|
|
65
63
|
get textColor() {
|
|
66
|
-
return __classPrivateFieldGet(this,
|
|
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
|
-
|
|
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
|