@arrowsphere/api-client 3.41.0 → 3.42.0
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 +6 -0
- package/build/abstractGraphQLClient.js +5 -1
- package/build/abstractRestfulClient.js +5 -1
- package/build/catalog/catalogGraphQLClient.js +2 -2
- package/build/licenses/licensesClient.js +13 -13
- package/build/orders/ordersClient.js +1 -1
- package/build/securityScore/securityScoreGraphQLClient.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ 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
6
|
|
|
7
|
+
## [3.42.0] - 2023-06-27
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Refactor url generation to allow complex origin url
|
|
12
|
+
|
|
7
13
|
## [3.41.0] - 2023-06-23
|
|
8
14
|
|
|
9
15
|
### Changed
|
|
@@ -50,7 +50,11 @@ class AbstractGraphQLClient extends AbstractHttpClient_1.AbstractHttpClient {
|
|
|
50
50
|
return await this.getClientInstance().request(query);
|
|
51
51
|
}
|
|
52
52
|
generateUrl() {
|
|
53
|
-
const
|
|
53
|
+
const baseUrl = this.url.replace(new RegExp('/$'), '');
|
|
54
|
+
const basePath = this.options.isAdmin
|
|
55
|
+
? path.join('/admin', this.basePath)
|
|
56
|
+
: this.basePath;
|
|
57
|
+
const url = new URL(`${baseUrl}${basePath}${this.path}`);
|
|
54
58
|
return url.toString();
|
|
55
59
|
}
|
|
56
60
|
stringifyQuery(query) {
|
|
@@ -203,7 +203,11 @@ class AbstractRestfulClient extends AbstractHttpClient_1.AbstractHttpClient {
|
|
|
203
203
|
*/
|
|
204
204
|
generateUrl(parameters, options) {
|
|
205
205
|
const params = { ...parameters, ...this.generatePagination() };
|
|
206
|
-
const
|
|
206
|
+
const baseUrl = this.url.replace(new RegExp('/$'), '');
|
|
207
|
+
const basePath = options.isAdmin
|
|
208
|
+
? path_1.default.join('/admin', this.basePath)
|
|
209
|
+
: this.basePath;
|
|
210
|
+
const url = new URL(`${baseUrl}${basePath}${this.path}`);
|
|
207
211
|
if (Object.values(params).length) {
|
|
208
212
|
url.search = querystring_1.default.stringify(params);
|
|
209
213
|
}
|
|
@@ -8,11 +8,11 @@ class CatalogGraphQLClient extends abstractGraphQLClient_1.AbstractGraphQLClient
|
|
|
8
8
|
/**
|
|
9
9
|
* The base path of the API
|
|
10
10
|
*/
|
|
11
|
-
this.basePath = 'catalog
|
|
11
|
+
this.basePath = '/catalog';
|
|
12
12
|
/**
|
|
13
13
|
* The Path of graphql catalog API
|
|
14
14
|
*/
|
|
15
|
-
this.GRAPHQL = 'graphql';
|
|
15
|
+
this.GRAPHQL = '/graphql';
|
|
16
16
|
}
|
|
17
17
|
async find(request) {
|
|
18
18
|
this.path = this.GRAPHQL;
|
|
@@ -115,11 +115,11 @@ class LicensesClient extends abstractRestfulClient_1.AbstractRestfulClient {
|
|
|
115
115
|
/**
|
|
116
116
|
* The base path of the API
|
|
117
117
|
*/
|
|
118
|
-
this.basePath = '/licenses
|
|
118
|
+
this.basePath = '/licenses';
|
|
119
119
|
/**
|
|
120
120
|
* The path of the Find endpoint
|
|
121
121
|
*/
|
|
122
|
-
this.FIND_PATH = 'v2/find';
|
|
122
|
+
this.FIND_PATH = '/v2/find';
|
|
123
123
|
/**
|
|
124
124
|
* The path of the Configs endpoint
|
|
125
125
|
*/
|
|
@@ -244,7 +244,7 @@ class LicensesClient extends abstractRestfulClient_1.AbstractRestfulClient {
|
|
|
244
244
|
return new findResult_1.FindResult(response, this, rawLicensePayload, parameters);
|
|
245
245
|
}
|
|
246
246
|
getConfigsRaw(reference) {
|
|
247
|
-
this.path = reference
|
|
247
|
+
this.path = `/${reference}${this.CONFIGS_PATH}`;
|
|
248
248
|
return this.get();
|
|
249
249
|
}
|
|
250
250
|
async *getConfigs(reference) {
|
|
@@ -254,7 +254,7 @@ class LicensesClient extends abstractRestfulClient_1.AbstractRestfulClient {
|
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
async updateConfigRaw(reference, config) {
|
|
257
|
-
this.path = reference
|
|
257
|
+
this.path = `/${reference}${this.CONFIGS_PATH}`;
|
|
258
258
|
const postData = {
|
|
259
259
|
[configFindResult_1.ConfigFindResultFields.COLUMN_NAME]: config.name,
|
|
260
260
|
[configFindResult_1.ConfigFindResultFields.COLUMN_SCOPE]: config.scope,
|
|
@@ -267,39 +267,39 @@ class LicensesClient extends abstractRestfulClient_1.AbstractRestfulClient {
|
|
|
267
267
|
return new configFindResult_1.ConfigFindResult(rawResponse);
|
|
268
268
|
}
|
|
269
269
|
async getLicense(licenseReference, parameters = {}) {
|
|
270
|
-
this.path = licenseReference
|
|
270
|
+
this.path = `/${licenseReference}`;
|
|
271
271
|
return new getResult_1.GetResult(getLicenseResult_1.GetLicenseResult, await this.get(parameters));
|
|
272
272
|
}
|
|
273
273
|
updateSeats(licenseReference, putData, parameters = {}) {
|
|
274
|
-
this.path = licenseReference
|
|
274
|
+
this.path = `/${licenseReference}${this.SEATS_PATH}`;
|
|
275
275
|
return this.put(putData, parameters);
|
|
276
276
|
}
|
|
277
277
|
suspendLicense(licenseReference, payload, parameters = {}) {
|
|
278
|
-
this.path = licenseReference
|
|
278
|
+
this.path = `/${licenseReference}${this.SUSPEND_PATH}`;
|
|
279
279
|
return this.put(payload, parameters);
|
|
280
280
|
}
|
|
281
281
|
reactivateLicense(licenseReference, payload, parameters = {}) {
|
|
282
|
-
this.path = licenseReference
|
|
282
|
+
this.path = `/${licenseReference}${this.REACTIVATE_PATH}`;
|
|
283
283
|
return this.put(payload, parameters);
|
|
284
284
|
}
|
|
285
285
|
cancelLicense(licenseReference, payload, parameters = {}) {
|
|
286
|
-
this.path = licenseReference
|
|
286
|
+
this.path = `/${licenseReference}${this.CANCEL_PATH}`;
|
|
287
287
|
return this.put(payload, parameters);
|
|
288
288
|
}
|
|
289
289
|
async updateFriendlyName(licenseReference, putData, parameters = {}) {
|
|
290
|
-
this.path = licenseReference
|
|
290
|
+
this.path = `/${licenseReference}${this.UPDATE_FRIENDLYNAME_PATH}`;
|
|
291
291
|
return await this.put(putData, parameters);
|
|
292
292
|
}
|
|
293
293
|
async getHistory(licenseReference, parameters = {}) {
|
|
294
|
-
this.path = licenseReference
|
|
294
|
+
this.path = `/${licenseReference}${this.GET_LICENSE_HISTORY_PATH}`;
|
|
295
295
|
return new getResult_1.GetResult(licenceHistoryResult_1.LicenceHistoryResult, await this.get(parameters));
|
|
296
296
|
}
|
|
297
297
|
async cancelAutoRenew(licenseReference, payload, parameters = {}) {
|
|
298
|
-
this.path = licenseReference
|
|
298
|
+
this.path = `/${licenseReference}${this.CANCEL_AUTO_RENEW_PATH}`;
|
|
299
299
|
return await this.put(payload, parameters);
|
|
300
300
|
}
|
|
301
301
|
async reactivateAutoRenew(licenseReference, payload, parameters = {}) {
|
|
302
|
-
this.path = licenseReference
|
|
302
|
+
this.path = `/${licenseReference}${this.REACTIVATE_AUTO_RENEW_PATH}`;
|
|
303
303
|
return await this.put(payload, parameters);
|
|
304
304
|
}
|
|
305
305
|
}
|
|
@@ -52,7 +52,7 @@ class OrdersClient extends abstractRestfulClient_1.AbstractRestfulClient {
|
|
|
52
52
|
/**
|
|
53
53
|
* The base path of the API
|
|
54
54
|
*/
|
|
55
|
-
this.basePath = '/
|
|
55
|
+
this.basePath = '/orders';
|
|
56
56
|
}
|
|
57
57
|
async create(postData, parameters = {}) {
|
|
58
58
|
return new getResult_1.GetResult(referenceLink_1.ReferenceLink, await this.post(postData, parameters));
|
|
@@ -13,11 +13,11 @@ class SecurityScoreGraphQLClient extends abstractGraphQLClient_1.AbstractGraphQL
|
|
|
13
13
|
/**
|
|
14
14
|
* The base path of the API
|
|
15
15
|
*/
|
|
16
|
-
this.basePath = 'security
|
|
16
|
+
this.basePath = '/security';
|
|
17
17
|
/**
|
|
18
18
|
* The Path of graphql catalog API
|
|
19
19
|
*/
|
|
20
|
-
this.GRAPHQL = 'graphql/score';
|
|
20
|
+
this.GRAPHQL = '/graphql/score';
|
|
21
21
|
}
|
|
22
22
|
async find(request) {
|
|
23
23
|
this.path = this.GRAPHQL;
|
package/package.json
CHANGED