@targetprocess/local-yaft-client 0.4.0-alpha.4 → 0.4.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 +27 -0
- package/bin/src/index.d.ts +0 -118
- package/bin/src/index.d.ts.map +1 -1
- package/bin/src/index.js +1 -381
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.4.2](https://gitlab.tpondemand.net/infrastructure/yaft/compare/@targetprocess/local-yaft-client@0.4.1...@targetprocess/local-yaft-client@0.4.2) (2021-11-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **api:** remove write endpoints from local-yaft ([32ed437](https://gitlab.tpondemand.net/infrastructure/yaft/commit/32ed4377fe46f5aeb01ee40982421e274c72e71e))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.4.1](https://gitlab.tpondemand.net/infrastructure/yaft/compare/@targetprocess/local-yaft-client@0.4.1-alpha.0...@targetprocess/local-yaft-client@0.4.1) (2021-08-25)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @targetprocess/local-yaft-client
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# [0.4.0](https://gitlab.tpondemand.net/infrastructure/yaft/compare/@targetprocess/local-yaft-client@0.4.0-alpha.4...@targetprocess/local-yaft-client@0.4.0) (2021-08-23)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @targetprocess/local-yaft-client
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
6
33
|
# [0.3.0](https://gitlab.tpondemand.net/infrastructure/yaft/compare/@targetprocess/local-yaft-client@0.3.0-alpha.0...@targetprocess/local-yaft-client@0.3.0) (2021-08-12)
|
|
7
34
|
|
|
8
35
|
**Note:** Version bump only for package @targetprocess/local-yaft-client
|
package/bin/src/index.d.ts
CHANGED
|
@@ -7,14 +7,6 @@ export interface ILocalYaftClient {
|
|
|
7
7
|
getAccountFeatureToggles(accountHost: string): Promise<{
|
|
8
8
|
[key: string]: boolean;
|
|
9
9
|
}>;
|
|
10
|
-
/**
|
|
11
|
-
* Patch account feature toggle
|
|
12
|
-
* @param accountHost Account host
|
|
13
|
-
* @return Successful response
|
|
14
|
-
*/
|
|
15
|
-
patchAccountFeatureToggles(payload: PatchDocument[], accountHost: string): Promise<{
|
|
16
|
-
[key: string]: boolean;
|
|
17
|
-
}>;
|
|
18
10
|
/**
|
|
19
11
|
* Get feature toggle overrides for account
|
|
20
12
|
* @param accountHost Account host
|
|
@@ -23,24 +15,6 @@ export interface ILocalYaftClient {
|
|
|
23
15
|
getAccountFeatureToggleOverrides(accountHost: string): Promise<{
|
|
24
16
|
[key: string]: boolean;
|
|
25
17
|
}>;
|
|
26
|
-
/**
|
|
27
|
-
* Set account feature toggle overrides
|
|
28
|
-
* @param accountHost Account host
|
|
29
|
-
* @return Successful response
|
|
30
|
-
*/
|
|
31
|
-
setAccountFeatureToggles(payload: {
|
|
32
|
-
[key: string]: boolean;
|
|
33
|
-
}, accountHost: string): Promise<{
|
|
34
|
-
[key: string]: boolean;
|
|
35
|
-
}>;
|
|
36
|
-
/**
|
|
37
|
-
* Patch account feature toggle overrides
|
|
38
|
-
* @param accountHost Account host
|
|
39
|
-
* @return Successful response
|
|
40
|
-
*/
|
|
41
|
-
patchAccountFeatureToggleOverrides(payload: PatchDocument[], accountHost: string): Promise<{
|
|
42
|
-
[key: string]: boolean;
|
|
43
|
-
}>;
|
|
44
18
|
/**
|
|
45
19
|
* Get cluster feature toggles
|
|
46
20
|
* @return Successful response
|
|
@@ -48,22 +22,6 @@ export interface ILocalYaftClient {
|
|
|
48
22
|
getClusterFeatureToggles(): Promise<{
|
|
49
23
|
[key: string]: boolean;
|
|
50
24
|
}>;
|
|
51
|
-
/**
|
|
52
|
-
* Set feature toggles
|
|
53
|
-
* @return Successful response
|
|
54
|
-
*/
|
|
55
|
-
setClusterFeatureToggles(payload: {
|
|
56
|
-
[key: string]: boolean;
|
|
57
|
-
}): Promise<{
|
|
58
|
-
[key: string]: boolean;
|
|
59
|
-
}>;
|
|
60
|
-
/**
|
|
61
|
-
* Patch cluster feature toggles
|
|
62
|
-
* @return Successful response
|
|
63
|
-
*/
|
|
64
|
-
patchClusterFeatureToggles(payload: PatchDocument[]): Promise<{
|
|
65
|
-
[key: string]: boolean;
|
|
66
|
-
}>;
|
|
67
25
|
/**
|
|
68
26
|
* Get cluster and all cluster accounts feature toggles
|
|
69
27
|
* @return Successful response
|
|
@@ -107,17 +65,6 @@ export declare class LocalYaftClient implements ILocalYaftClient {
|
|
|
107
65
|
protected processGetAccountFeatureToggles(response: Response): Promise<{
|
|
108
66
|
[key: string]: boolean;
|
|
109
67
|
}>;
|
|
110
|
-
/**
|
|
111
|
-
* Patch account feature toggle
|
|
112
|
-
* @param accountHost Account host
|
|
113
|
-
* @return Successful response
|
|
114
|
-
*/
|
|
115
|
-
patchAccountFeatureToggles(payload: PatchDocument[], accountHost: string): Promise<{
|
|
116
|
-
[key: string]: boolean;
|
|
117
|
-
}>;
|
|
118
|
-
protected processPatchAccountFeatureToggles(response: Response): Promise<{
|
|
119
|
-
[key: string]: boolean;
|
|
120
|
-
}>;
|
|
121
68
|
/**
|
|
122
69
|
* Get feature toggle overrides for account
|
|
123
70
|
* @param accountHost Account host
|
|
@@ -129,30 +76,6 @@ export declare class LocalYaftClient implements ILocalYaftClient {
|
|
|
129
76
|
protected processGetAccountFeatureToggleOverrides(response: Response): Promise<{
|
|
130
77
|
[key: string]: boolean;
|
|
131
78
|
}>;
|
|
132
|
-
/**
|
|
133
|
-
* Set account feature toggle overrides
|
|
134
|
-
* @param accountHost Account host
|
|
135
|
-
* @return Successful response
|
|
136
|
-
*/
|
|
137
|
-
setAccountFeatureToggles(payload: {
|
|
138
|
-
[key: string]: boolean;
|
|
139
|
-
}, accountHost: string): Promise<{
|
|
140
|
-
[key: string]: boolean;
|
|
141
|
-
}>;
|
|
142
|
-
protected processSetAccountFeatureToggles(response: Response): Promise<{
|
|
143
|
-
[key: string]: boolean;
|
|
144
|
-
}>;
|
|
145
|
-
/**
|
|
146
|
-
* Patch account feature toggle overrides
|
|
147
|
-
* @param accountHost Account host
|
|
148
|
-
* @return Successful response
|
|
149
|
-
*/
|
|
150
|
-
patchAccountFeatureToggleOverrides(payload: PatchDocument[], accountHost: string): Promise<{
|
|
151
|
-
[key: string]: boolean;
|
|
152
|
-
}>;
|
|
153
|
-
protected processPatchAccountFeatureToggleOverrides(response: Response): Promise<{
|
|
154
|
-
[key: string]: boolean;
|
|
155
|
-
}>;
|
|
156
79
|
/**
|
|
157
80
|
* Get cluster feature toggles
|
|
158
81
|
* @return Successful response
|
|
@@ -163,28 +86,6 @@ export declare class LocalYaftClient implements ILocalYaftClient {
|
|
|
163
86
|
protected processGetClusterFeatureToggles(response: Response): Promise<{
|
|
164
87
|
[key: string]: boolean;
|
|
165
88
|
}>;
|
|
166
|
-
/**
|
|
167
|
-
* Set feature toggles
|
|
168
|
-
* @return Successful response
|
|
169
|
-
*/
|
|
170
|
-
setClusterFeatureToggles(payload: {
|
|
171
|
-
[key: string]: boolean;
|
|
172
|
-
}): Promise<{
|
|
173
|
-
[key: string]: boolean;
|
|
174
|
-
}>;
|
|
175
|
-
protected processSetClusterFeatureToggles(response: Response): Promise<{
|
|
176
|
-
[key: string]: boolean;
|
|
177
|
-
}>;
|
|
178
|
-
/**
|
|
179
|
-
* Patch cluster feature toggles
|
|
180
|
-
* @return Successful response
|
|
181
|
-
*/
|
|
182
|
-
patchClusterFeatureToggles(payload: PatchDocument[]): Promise<{
|
|
183
|
-
[key: string]: boolean;
|
|
184
|
-
}>;
|
|
185
|
-
protected processPatchClusterFeatureToggles(response: Response): Promise<{
|
|
186
|
-
[key: string]: boolean;
|
|
187
|
-
}>;
|
|
188
89
|
/**
|
|
189
90
|
* Get cluster and all cluster accounts feature toggles
|
|
190
91
|
* @return Successful response
|
|
@@ -242,25 +143,6 @@ export interface ErrorDto {
|
|
|
242
143
|
/** Error message */
|
|
243
144
|
message: string;
|
|
244
145
|
}
|
|
245
|
-
/** A JSONPatch document as defined by RFC 6902 */
|
|
246
|
-
export interface PatchDocument {
|
|
247
|
-
/** The operation to be performed */
|
|
248
|
-
op: PatchDocumentOp;
|
|
249
|
-
/** A JSON-Pointer */
|
|
250
|
-
path: string;
|
|
251
|
-
/** The value to be used within the operations. */
|
|
252
|
-
value?: boolean | undefined;
|
|
253
|
-
/** A string containing a JSON Pointer value. */
|
|
254
|
-
from?: string | undefined;
|
|
255
|
-
}
|
|
256
|
-
export declare enum PatchDocumentOp {
|
|
257
|
-
Add = "add",
|
|
258
|
-
Remove = "remove",
|
|
259
|
-
Replace = "replace",
|
|
260
|
-
Move = "move",
|
|
261
|
-
Copy = "copy",
|
|
262
|
-
Test = "test"
|
|
263
|
-
}
|
|
264
146
|
export declare class ApiException extends Error {
|
|
265
147
|
message: string;
|
|
266
148
|
status: number;
|
package/bin/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,gBAAgB;IAC7B;;;;OAIG;IACH,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KAAE,CAAC,CAAC;IACpF;;;;OAIG;IACH,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,gBAAgB;IAC7B;;;;OAIG;IACH,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GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,YAAY;CAGvD"}
|
package/bin/src/index.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
//----------------------
|
|
9
9
|
// ReSharper disable InconsistentNaming
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.ApiException = exports.
|
|
11
|
+
exports.ApiException = exports.LocalYaftClient = void 0;
|
|
12
12
|
class LocalYaftClient {
|
|
13
13
|
constructor(baseUrl, http) {
|
|
14
14
|
this.jsonParseReviver = undefined;
|
|
@@ -92,86 +92,6 @@ class LocalYaftClient {
|
|
|
92
92
|
}
|
|
93
93
|
return Promise.resolve(null);
|
|
94
94
|
}
|
|
95
|
-
/**
|
|
96
|
-
* Patch account feature toggle
|
|
97
|
-
* @param accountHost Account host
|
|
98
|
-
* @return Successful response
|
|
99
|
-
*/
|
|
100
|
-
patchAccountFeatureToggles(payload, accountHost) {
|
|
101
|
-
let url_ = this.baseUrl + "/accounts/{accountHost}/feature-toggles";
|
|
102
|
-
if (accountHost === undefined || accountHost === null)
|
|
103
|
-
throw new Error("The parameter 'accountHost' must be defined.");
|
|
104
|
-
url_ = url_.replace("{accountHost}", encodeURIComponent("" + accountHost));
|
|
105
|
-
url_ = url_.replace(/[?&]$/, "");
|
|
106
|
-
const content_ = JSON.stringify(payload);
|
|
107
|
-
let options_ = {
|
|
108
|
-
body: content_,
|
|
109
|
-
method: "PATCH",
|
|
110
|
-
headers: {
|
|
111
|
-
"Content-Type": "application/json",
|
|
112
|
-
"Accept": "application/json"
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
return this.http.fetch(url_, options_).then((_response) => {
|
|
116
|
-
return this.processPatchAccountFeatureToggles(_response);
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
processPatchAccountFeatureToggles(response) {
|
|
120
|
-
const status = response.status;
|
|
121
|
-
let _headers = {};
|
|
122
|
-
if (response.headers && response.headers.forEach) {
|
|
123
|
-
response.headers.forEach((v, k) => _headers[k] = v);
|
|
124
|
-
}
|
|
125
|
-
;
|
|
126
|
-
if (status === 200) {
|
|
127
|
-
return response.text().then((_responseText) => {
|
|
128
|
-
let result200 = null;
|
|
129
|
-
result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
130
|
-
return result200;
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
else if (status === 400) {
|
|
134
|
-
return response.text().then((_responseText) => {
|
|
135
|
-
let result400 = null;
|
|
136
|
-
result400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
137
|
-
return throwException("Bad request", status, _responseText, _headers, result400);
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
else if (status === 401) {
|
|
141
|
-
return response.text().then((_responseText) => {
|
|
142
|
-
let result401 = null;
|
|
143
|
-
result401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
144
|
-
return throwException("Unauthorized", status, _responseText, _headers, result401);
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
else if (status === 403) {
|
|
148
|
-
return response.text().then((_responseText) => {
|
|
149
|
-
let result403 = null;
|
|
150
|
-
result403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
151
|
-
return throwException("Forbidden", status, _responseText, _headers, result403);
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
else if (status === 404) {
|
|
155
|
-
return response.text().then((_responseText) => {
|
|
156
|
-
let result404 = null;
|
|
157
|
-
result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
158
|
-
return throwException("Not found", status, _responseText, _headers, result404);
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
else if (status === 500) {
|
|
162
|
-
return response.text().then((_responseText) => {
|
|
163
|
-
let result500 = null;
|
|
164
|
-
result500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
165
|
-
return throwException("General error", status, _responseText, _headers, result500);
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
else if (status !== 200 && status !== 204) {
|
|
169
|
-
return response.text().then((_responseText) => {
|
|
170
|
-
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
return Promise.resolve(null);
|
|
174
|
-
}
|
|
175
95
|
/**
|
|
176
96
|
* Get feature toggle overrides for account
|
|
177
97
|
* @param accountHost Account host
|
|
@@ -242,159 +162,6 @@ class LocalYaftClient {
|
|
|
242
162
|
}
|
|
243
163
|
return Promise.resolve(null);
|
|
244
164
|
}
|
|
245
|
-
/**
|
|
246
|
-
* Set account feature toggle overrides
|
|
247
|
-
* @param accountHost Account host
|
|
248
|
-
* @return Successful response
|
|
249
|
-
*/
|
|
250
|
-
setAccountFeatureToggles(payload, accountHost) {
|
|
251
|
-
let url_ = this.baseUrl + "/accounts/{accountHost}/feature-toggles/overrides";
|
|
252
|
-
if (accountHost === undefined || accountHost === null)
|
|
253
|
-
throw new Error("The parameter 'accountHost' must be defined.");
|
|
254
|
-
url_ = url_.replace("{accountHost}", encodeURIComponent("" + accountHost));
|
|
255
|
-
url_ = url_.replace(/[?&]$/, "");
|
|
256
|
-
const content_ = JSON.stringify(payload);
|
|
257
|
-
let options_ = {
|
|
258
|
-
body: content_,
|
|
259
|
-
method: "POST",
|
|
260
|
-
headers: {
|
|
261
|
-
"Content-Type": "application/json",
|
|
262
|
-
"Accept": "application/json"
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
return this.http.fetch(url_, options_).then((_response) => {
|
|
266
|
-
return this.processSetAccountFeatureToggles(_response);
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
processSetAccountFeatureToggles(response) {
|
|
270
|
-
const status = response.status;
|
|
271
|
-
let _headers = {};
|
|
272
|
-
if (response.headers && response.headers.forEach) {
|
|
273
|
-
response.headers.forEach((v, k) => _headers[k] = v);
|
|
274
|
-
}
|
|
275
|
-
;
|
|
276
|
-
if (status === 200) {
|
|
277
|
-
return response.text().then((_responseText) => {
|
|
278
|
-
let result200 = null;
|
|
279
|
-
result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
280
|
-
return result200;
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
else if (status === 400) {
|
|
284
|
-
return response.text().then((_responseText) => {
|
|
285
|
-
let result400 = null;
|
|
286
|
-
result400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
287
|
-
return throwException("Bad request", status, _responseText, _headers, result400);
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
else if (status === 401) {
|
|
291
|
-
return response.text().then((_responseText) => {
|
|
292
|
-
let result401 = null;
|
|
293
|
-
result401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
294
|
-
return throwException("Unauthorized", status, _responseText, _headers, result401);
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
else if (status === 403) {
|
|
298
|
-
return response.text().then((_responseText) => {
|
|
299
|
-
let result403 = null;
|
|
300
|
-
result403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
301
|
-
return throwException("Forbidden", status, _responseText, _headers, result403);
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
else if (status === 404) {
|
|
305
|
-
return response.text().then((_responseText) => {
|
|
306
|
-
let result404 = null;
|
|
307
|
-
result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
308
|
-
return throwException("Not found", status, _responseText, _headers, result404);
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
else if (status === 500) {
|
|
312
|
-
return response.text().then((_responseText) => {
|
|
313
|
-
let result500 = null;
|
|
314
|
-
result500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
315
|
-
return throwException("General error", status, _responseText, _headers, result500);
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
else if (status !== 200 && status !== 204) {
|
|
319
|
-
return response.text().then((_responseText) => {
|
|
320
|
-
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
return Promise.resolve(null);
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* Patch account feature toggle overrides
|
|
327
|
-
* @param accountHost Account host
|
|
328
|
-
* @return Successful response
|
|
329
|
-
*/
|
|
330
|
-
patchAccountFeatureToggleOverrides(payload, accountHost) {
|
|
331
|
-
let url_ = this.baseUrl + "/accounts/{accountHost}/feature-toggles/overrides";
|
|
332
|
-
if (accountHost === undefined || accountHost === null)
|
|
333
|
-
throw new Error("The parameter 'accountHost' must be defined.");
|
|
334
|
-
url_ = url_.replace("{accountHost}", encodeURIComponent("" + accountHost));
|
|
335
|
-
url_ = url_.replace(/[?&]$/, "");
|
|
336
|
-
const content_ = JSON.stringify(payload);
|
|
337
|
-
let options_ = {
|
|
338
|
-
body: content_,
|
|
339
|
-
method: "PATCH",
|
|
340
|
-
headers: {
|
|
341
|
-
"Content-Type": "application/json",
|
|
342
|
-
"Accept": "application/json"
|
|
343
|
-
}
|
|
344
|
-
};
|
|
345
|
-
return this.http.fetch(url_, options_).then((_response) => {
|
|
346
|
-
return this.processPatchAccountFeatureToggleOverrides(_response);
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
processPatchAccountFeatureToggleOverrides(response) {
|
|
350
|
-
const status = response.status;
|
|
351
|
-
let _headers = {};
|
|
352
|
-
if (response.headers && response.headers.forEach) {
|
|
353
|
-
response.headers.forEach((v, k) => _headers[k] = v);
|
|
354
|
-
}
|
|
355
|
-
;
|
|
356
|
-
if (status === 200) {
|
|
357
|
-
return response.text().then((_responseText) => {
|
|
358
|
-
let result200 = null;
|
|
359
|
-
result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
360
|
-
return result200;
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
else if (status === 400) {
|
|
364
|
-
return response.text().then((_responseText) => {
|
|
365
|
-
let result400 = null;
|
|
366
|
-
result400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
367
|
-
return throwException("Bad request", status, _responseText, _headers, result400);
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
else if (status === 401) {
|
|
371
|
-
return response.text().then((_responseText) => {
|
|
372
|
-
let result401 = null;
|
|
373
|
-
result401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
374
|
-
return throwException("Unauthorized", status, _responseText, _headers, result401);
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
else if (status === 403) {
|
|
378
|
-
return response.text().then((_responseText) => {
|
|
379
|
-
let result403 = null;
|
|
380
|
-
result403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
381
|
-
return throwException("Forbidden", status, _responseText, _headers, result403);
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
else if (status === 500) {
|
|
385
|
-
return response.text().then((_responseText) => {
|
|
386
|
-
let result500 = null;
|
|
387
|
-
result500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
388
|
-
return throwException("General error", status, _responseText, _headers, result500);
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
else if (status !== 200 && status !== 204) {
|
|
392
|
-
return response.text().then((_responseText) => {
|
|
393
|
-
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
return Promise.resolve(null);
|
|
397
|
-
}
|
|
398
165
|
/**
|
|
399
166
|
* Get cluster feature toggles
|
|
400
167
|
* @return Successful response
|
|
@@ -454,144 +221,6 @@ class LocalYaftClient {
|
|
|
454
221
|
}
|
|
455
222
|
return Promise.resolve(null);
|
|
456
223
|
}
|
|
457
|
-
/**
|
|
458
|
-
* Set feature toggles
|
|
459
|
-
* @return Successful response
|
|
460
|
-
*/
|
|
461
|
-
setClusterFeatureToggles(payload) {
|
|
462
|
-
let url_ = this.baseUrl + "/feature-toggles";
|
|
463
|
-
url_ = url_.replace(/[?&]$/, "");
|
|
464
|
-
const content_ = JSON.stringify(payload);
|
|
465
|
-
let options_ = {
|
|
466
|
-
body: content_,
|
|
467
|
-
method: "POST",
|
|
468
|
-
headers: {
|
|
469
|
-
"Content-Type": "application/json",
|
|
470
|
-
"Accept": "application/json"
|
|
471
|
-
}
|
|
472
|
-
};
|
|
473
|
-
return this.http.fetch(url_, options_).then((_response) => {
|
|
474
|
-
return this.processSetClusterFeatureToggles(_response);
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
processSetClusterFeatureToggles(response) {
|
|
478
|
-
const status = response.status;
|
|
479
|
-
let _headers = {};
|
|
480
|
-
if (response.headers && response.headers.forEach) {
|
|
481
|
-
response.headers.forEach((v, k) => _headers[k] = v);
|
|
482
|
-
}
|
|
483
|
-
;
|
|
484
|
-
if (status === 200) {
|
|
485
|
-
return response.text().then((_responseText) => {
|
|
486
|
-
let result200 = null;
|
|
487
|
-
result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
488
|
-
return result200;
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
else if (status === 401) {
|
|
492
|
-
return response.text().then((_responseText) => {
|
|
493
|
-
let result401 = null;
|
|
494
|
-
result401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
495
|
-
return throwException("Unauthorized", status, _responseText, _headers, result401);
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
else if (status === 403) {
|
|
499
|
-
return response.text().then((_responseText) => {
|
|
500
|
-
let result403 = null;
|
|
501
|
-
result403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
502
|
-
return throwException("Forbidden", status, _responseText, _headers, result403);
|
|
503
|
-
});
|
|
504
|
-
}
|
|
505
|
-
else if (status === 500) {
|
|
506
|
-
return response.text().then((_responseText) => {
|
|
507
|
-
let result500 = null;
|
|
508
|
-
result500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
509
|
-
return throwException("General error", status, _responseText, _headers, result500);
|
|
510
|
-
});
|
|
511
|
-
}
|
|
512
|
-
else if (status !== 200 && status !== 204) {
|
|
513
|
-
return response.text().then((_responseText) => {
|
|
514
|
-
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
515
|
-
});
|
|
516
|
-
}
|
|
517
|
-
return Promise.resolve(null);
|
|
518
|
-
}
|
|
519
|
-
/**
|
|
520
|
-
* Patch cluster feature toggles
|
|
521
|
-
* @return Successful response
|
|
522
|
-
*/
|
|
523
|
-
patchClusterFeatureToggles(payload) {
|
|
524
|
-
let url_ = this.baseUrl + "/feature-toggles";
|
|
525
|
-
url_ = url_.replace(/[?&]$/, "");
|
|
526
|
-
const content_ = JSON.stringify(payload);
|
|
527
|
-
let options_ = {
|
|
528
|
-
body: content_,
|
|
529
|
-
method: "PATCH",
|
|
530
|
-
headers: {
|
|
531
|
-
"Content-Type": "application/json",
|
|
532
|
-
"Accept": "application/json"
|
|
533
|
-
}
|
|
534
|
-
};
|
|
535
|
-
return this.http.fetch(url_, options_).then((_response) => {
|
|
536
|
-
return this.processPatchClusterFeatureToggles(_response);
|
|
537
|
-
});
|
|
538
|
-
}
|
|
539
|
-
processPatchClusterFeatureToggles(response) {
|
|
540
|
-
const status = response.status;
|
|
541
|
-
let _headers = {};
|
|
542
|
-
if (response.headers && response.headers.forEach) {
|
|
543
|
-
response.headers.forEach((v, k) => _headers[k] = v);
|
|
544
|
-
}
|
|
545
|
-
;
|
|
546
|
-
if (status === 200) {
|
|
547
|
-
return response.text().then((_responseText) => {
|
|
548
|
-
let result200 = null;
|
|
549
|
-
result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
550
|
-
return result200;
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
else if (status === 400) {
|
|
554
|
-
return response.text().then((_responseText) => {
|
|
555
|
-
let result400 = null;
|
|
556
|
-
result400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
557
|
-
return throwException("Bad request", status, _responseText, _headers, result400);
|
|
558
|
-
});
|
|
559
|
-
}
|
|
560
|
-
else if (status === 401) {
|
|
561
|
-
return response.text().then((_responseText) => {
|
|
562
|
-
let result401 = null;
|
|
563
|
-
result401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
564
|
-
return throwException("Unauthorized", status, _responseText, _headers, result401);
|
|
565
|
-
});
|
|
566
|
-
}
|
|
567
|
-
else if (status === 403) {
|
|
568
|
-
return response.text().then((_responseText) => {
|
|
569
|
-
let result403 = null;
|
|
570
|
-
result403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
571
|
-
return throwException("Forbidden", status, _responseText, _headers, result403);
|
|
572
|
-
});
|
|
573
|
-
}
|
|
574
|
-
else if (status === 404) {
|
|
575
|
-
return response.text().then((_responseText) => {
|
|
576
|
-
let result404 = null;
|
|
577
|
-
result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
578
|
-
return throwException("Not found", status, _responseText, _headers, result404);
|
|
579
|
-
});
|
|
580
|
-
}
|
|
581
|
-
else if (status === 500) {
|
|
582
|
-
return response.text().then((_responseText) => {
|
|
583
|
-
let result500 = null;
|
|
584
|
-
result500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
585
|
-
return throwException("General error", status, _responseText, _headers, result500);
|
|
586
|
-
});
|
|
587
|
-
}
|
|
588
|
-
else if (status !== 200 && status !== 204) {
|
|
589
|
-
return response.text().then((_responseText) => {
|
|
590
|
-
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
591
|
-
});
|
|
592
|
-
}
|
|
593
|
-
return Promise.resolve(null);
|
|
594
|
-
}
|
|
595
224
|
/**
|
|
596
225
|
* Get cluster and all cluster accounts feature toggles
|
|
597
226
|
* @return Successful response
|
|
@@ -844,15 +473,6 @@ class LocalYaftClient {
|
|
|
844
473
|
}
|
|
845
474
|
}
|
|
846
475
|
exports.LocalYaftClient = LocalYaftClient;
|
|
847
|
-
var PatchDocumentOp;
|
|
848
|
-
(function (PatchDocumentOp) {
|
|
849
|
-
PatchDocumentOp["Add"] = "add";
|
|
850
|
-
PatchDocumentOp["Remove"] = "remove";
|
|
851
|
-
PatchDocumentOp["Replace"] = "replace";
|
|
852
|
-
PatchDocumentOp["Move"] = "move";
|
|
853
|
-
PatchDocumentOp["Copy"] = "copy";
|
|
854
|
-
PatchDocumentOp["Test"] = "test";
|
|
855
|
-
})(PatchDocumentOp = exports.PatchDocumentOp || (exports.PatchDocumentOp = {}));
|
|
856
476
|
class ApiException extends Error {
|
|
857
477
|
constructor(message, status, response, headers, result) {
|
|
858
478
|
super();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@targetprocess/local-yaft-client",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Client for local-yaft service",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"yaft"
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "9dc471607b30ab15c2b6e935220e79b39171ab2f"
|
|
37
37
|
}
|