@ama-sdk/client-angular 11.3.0-prerelease.47
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/LICENSE +26 -0
- package/README.md +26 -0
- package/cjs/angular-plugin.js +4 -0
- package/cjs/api-angular-client.js +562 -0
- package/cjs/index.spec.js +5 -0
- package/cjs/plugins/index.js +18 -0
- package/cjs/plugins/mock-intercept/index.js +19 -0
- package/cjs/plugins/mock-intercept/mock-intercept.angular.js +346 -0
- package/cjs/plugins/mock-intercept/mock-intercept.interface.js +4 -0
- package/cjs/public_api.js +20 -0
- package/collection.json +11 -0
- package/esm2015/angular-plugin.js +4 -0
- package/esm2015/api-angular-client.js +552 -0
- package/esm2015/index.spec.js +4 -0
- package/esm2015/plugins/index.js +1 -0
- package/esm2015/plugins/mock-intercept/index.js +2 -0
- package/esm2015/plugins/mock-intercept/mock-intercept.angular.js +341 -0
- package/esm2015/plugins/mock-intercept/mock-intercept.interface.js +3 -0
- package/esm2015/public_api.js +3 -0
- package/package.json +192 -0
- package/schematics/ng-add/index.d.ts +8 -0
- package/schematics/ng-add/index.d.ts.map +1 -0
- package/schematics/ng-add/index.js +67 -0
- package/schematics/ng-add/migration/import-map.d.ts +6 -0
- package/schematics/ng-add/migration/import-map.d.ts.map +1 -0
- package/schematics/ng-add/migration/import-map.js +17 -0
- package/schematics/ng-add/schema.d.ts +6 -0
- package/schematics/ng-add/schema.d.ts.map +1 -0
- package/schematics/ng-add/schema.js +3 -0
- package/schematics/ng-add/schema.json +18 -0
- package/schematics/package.json +3 -0
- package/src/angular-plugin.d.ts +38 -0
- package/src/angular-plugin.d.ts.map +1 -0
- package/src/angular-plugin.js +2 -0
- package/src/angular-plugin.js.map +1 -0
- package/src/api-angular-client.d.ts +49 -0
- package/src/api-angular-client.d.ts.map +1 -0
- package/src/api-angular-client.js +131 -0
- package/src/api-angular-client.js.map +1 -0
- package/src/plugins/index.d.ts +2 -0
- package/src/plugins/index.d.ts.map +1 -0
- package/src/plugins/index.js +2 -0
- package/src/plugins/index.js.map +1 -0
- package/src/plugins/mock-intercept/index.d.ts +3 -0
- package/src/plugins/mock-intercept/index.d.ts.map +1 -0
- package/src/plugins/mock-intercept/index.js +3 -0
- package/src/plugins/mock-intercept/index.js.map +1 -0
- package/src/plugins/mock-intercept/mock-intercept.angular.d.ts +15 -0
- package/src/plugins/mock-intercept/mock-intercept.angular.d.ts.map +1 -0
- package/src/plugins/mock-intercept/mock-intercept.angular.js +62 -0
- package/src/plugins/mock-intercept/mock-intercept.angular.js.map +1 -0
- package/src/plugins/mock-intercept/mock-intercept.interface.d.ts +12 -0
- package/src/plugins/mock-intercept/mock-intercept.interface.d.ts.map +1 -0
- package/src/plugins/mock-intercept/mock-intercept.interface.js +2 -0
- package/src/plugins/mock-intercept/mock-intercept.interface.js.map +1 -0
- package/src/public_api.d.ts +4 -0
- package/src/public_api.d.ts.map +1 -0
- package/src/public_api.js +4 -0
- package/src/public_api.js.map +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Copyright Amadeus SAS
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
4
|
+
are permitted provided that the following conditions are met:
|
|
5
|
+
|
|
6
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
7
|
+
list of conditions and the following disclaimer.
|
|
8
|
+
|
|
9
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
10
|
+
this list of conditions and the following disclaimer in the documentation and/or
|
|
11
|
+
other materials provided with the distribution.
|
|
12
|
+
|
|
13
|
+
3. Neither the name of the copyright holder nor the names of its contributors
|
|
14
|
+
may be used to endorse or promote products derived from this software without
|
|
15
|
+
specific prior written permission.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
18
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
19
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
20
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
21
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
22
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
23
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
24
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
25
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
26
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Ama SDK Angular Client
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@ama-sdk/client-angular)
|
|
4
|
+
[](https://www.npmjs.com/package/@ama-sdk/client-angular)
|
|
5
|
+
|
|
6
|
+
This package exposes the **Api Angular Client** from an SDK based on [@ama-sdk/core](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core).
|
|
7
|
+
|
|
8
|
+
This package contains all the [Angular Plugins](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/client-angular/src/plugins), helpers and object definitions to dialog with an API following the `ama-sdk` architecture.
|
|
9
|
+
|
|
10
|
+
> [!TIP]
|
|
11
|
+
> Please refer to the [SDK initializer](https://www.npmjs.com/package/@ama-sdk/create) package for getting started with an API client SDK based on `ama-sdk` architecture.
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
14
|
+
|
|
15
|
+
The **Api Angular Client** can be added to your project via the following command:
|
|
16
|
+
|
|
17
|
+
```shell
|
|
18
|
+
ng add @ama-sdk/client-angular
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
> [!NOTE]
|
|
22
|
+
> In case of migration from deprecated `ApiAngularClient` imported from `@ama-sdk/core`, the `ng add` command will replace, in your existing code, the import from `@ama-sdk/core` to `@ama-sdk/client-angular` for the deprecated dependencies.
|
|
23
|
+
|
|
24
|
+
## Available plugins
|
|
25
|
+
|
|
26
|
+
- [mock-intercept](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/client-angular/src/plugins/mock-intercept)
|
|
@@ -0,0 +1,562 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "ApiAngularClient", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return ApiAngularClient;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _core = require("@ama-sdk/core");
|
|
12
|
+
function _array_like_to_array(arr, len) {
|
|
13
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
14
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
15
|
+
return arr2;
|
|
16
|
+
}
|
|
17
|
+
function _array_without_holes(arr) {
|
|
18
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
19
|
+
}
|
|
20
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
21
|
+
try {
|
|
22
|
+
var info = gen[key](arg);
|
|
23
|
+
var value = info.value;
|
|
24
|
+
} catch (error) {
|
|
25
|
+
reject(error);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (info.done) {
|
|
29
|
+
resolve(value);
|
|
30
|
+
} else {
|
|
31
|
+
Promise.resolve(value).then(_next, _throw);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function _async_to_generator(fn) {
|
|
35
|
+
return function() {
|
|
36
|
+
var self = this, args = arguments;
|
|
37
|
+
return new Promise(function(resolve, reject) {
|
|
38
|
+
var gen = fn.apply(self, args);
|
|
39
|
+
function _next(value) {
|
|
40
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
41
|
+
}
|
|
42
|
+
function _throw(err) {
|
|
43
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
44
|
+
}
|
|
45
|
+
_next(undefined);
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function _class_call_check(instance, Constructor) {
|
|
50
|
+
if (!(instance instanceof Constructor)) {
|
|
51
|
+
throw new TypeError("Cannot call a class as a function");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function _defineProperties(target, props) {
|
|
55
|
+
for(var i = 0; i < props.length; i++){
|
|
56
|
+
var descriptor = props[i];
|
|
57
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
58
|
+
descriptor.configurable = true;
|
|
59
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
60
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
64
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
65
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
66
|
+
return Constructor;
|
|
67
|
+
}
|
|
68
|
+
function _define_property(obj, key, value) {
|
|
69
|
+
if (key in obj) {
|
|
70
|
+
Object.defineProperty(obj, key, {
|
|
71
|
+
value: value,
|
|
72
|
+
enumerable: true,
|
|
73
|
+
configurable: true,
|
|
74
|
+
writable: true
|
|
75
|
+
});
|
|
76
|
+
} else {
|
|
77
|
+
obj[key] = value;
|
|
78
|
+
}
|
|
79
|
+
return obj;
|
|
80
|
+
}
|
|
81
|
+
function _iterable_to_array(iter) {
|
|
82
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
83
|
+
}
|
|
84
|
+
function _non_iterable_spread() {
|
|
85
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
86
|
+
}
|
|
87
|
+
function _object_spread(target) {
|
|
88
|
+
for(var i = 1; i < arguments.length; i++){
|
|
89
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
90
|
+
var ownKeys = Object.keys(source);
|
|
91
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
92
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
93
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
ownKeys.forEach(function(key) {
|
|
97
|
+
_define_property(target, key, source[key]);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return target;
|
|
101
|
+
}
|
|
102
|
+
function ownKeys(object, enumerableOnly) {
|
|
103
|
+
var keys = Object.keys(object);
|
|
104
|
+
if (Object.getOwnPropertySymbols) {
|
|
105
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
106
|
+
if (enumerableOnly) {
|
|
107
|
+
symbols = symbols.filter(function(sym) {
|
|
108
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
keys.push.apply(keys, symbols);
|
|
112
|
+
}
|
|
113
|
+
return keys;
|
|
114
|
+
}
|
|
115
|
+
function _object_spread_props(target, source) {
|
|
116
|
+
source = source != null ? source : {};
|
|
117
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
118
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
119
|
+
} else {
|
|
120
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
121
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return target;
|
|
125
|
+
}
|
|
126
|
+
function _to_consumable_array(arr) {
|
|
127
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
128
|
+
}
|
|
129
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
130
|
+
if (!o) return;
|
|
131
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
132
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
133
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
134
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
135
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
136
|
+
}
|
|
137
|
+
function _ts_generator(thisArg, body) {
|
|
138
|
+
var f, y, t, g, _ = {
|
|
139
|
+
label: 0,
|
|
140
|
+
sent: function() {
|
|
141
|
+
if (t[0] & 1) throw t[1];
|
|
142
|
+
return t[1];
|
|
143
|
+
},
|
|
144
|
+
trys: [],
|
|
145
|
+
ops: []
|
|
146
|
+
};
|
|
147
|
+
return g = {
|
|
148
|
+
next: verb(0),
|
|
149
|
+
"throw": verb(1),
|
|
150
|
+
"return": verb(2)
|
|
151
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
152
|
+
return this;
|
|
153
|
+
}), g;
|
|
154
|
+
function verb(n) {
|
|
155
|
+
return function(v) {
|
|
156
|
+
return step([
|
|
157
|
+
n,
|
|
158
|
+
v
|
|
159
|
+
]);
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function step(op) {
|
|
163
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
164
|
+
while(_)try {
|
|
165
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
166
|
+
if (y = 0, t) op = [
|
|
167
|
+
op[0] & 2,
|
|
168
|
+
t.value
|
|
169
|
+
];
|
|
170
|
+
switch(op[0]){
|
|
171
|
+
case 0:
|
|
172
|
+
case 1:
|
|
173
|
+
t = op;
|
|
174
|
+
break;
|
|
175
|
+
case 4:
|
|
176
|
+
_.label++;
|
|
177
|
+
return {
|
|
178
|
+
value: op[1],
|
|
179
|
+
done: false
|
|
180
|
+
};
|
|
181
|
+
case 5:
|
|
182
|
+
_.label++;
|
|
183
|
+
y = op[1];
|
|
184
|
+
op = [
|
|
185
|
+
0
|
|
186
|
+
];
|
|
187
|
+
continue;
|
|
188
|
+
case 7:
|
|
189
|
+
op = _.ops.pop();
|
|
190
|
+
_.trys.pop();
|
|
191
|
+
continue;
|
|
192
|
+
default:
|
|
193
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
194
|
+
_ = 0;
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
198
|
+
_.label = op[1];
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
202
|
+
_.label = t[1];
|
|
203
|
+
t = op;
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
if (t && _.label < t[2]) {
|
|
207
|
+
_.label = t[2];
|
|
208
|
+
_.ops.push(op);
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
if (t[2]) _.ops.pop();
|
|
212
|
+
_.trys.pop();
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
op = body.call(thisArg, _);
|
|
216
|
+
} catch (e) {
|
|
217
|
+
op = [
|
|
218
|
+
6,
|
|
219
|
+
e
|
|
220
|
+
];
|
|
221
|
+
y = 0;
|
|
222
|
+
} finally{
|
|
223
|
+
f = t = 0;
|
|
224
|
+
}
|
|
225
|
+
if (op[0] & 5) throw op[1];
|
|
226
|
+
return {
|
|
227
|
+
value: op[0] ? op[1] : void 0,
|
|
228
|
+
done: true
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
var DEFAULT_OPTIONS = {
|
|
233
|
+
replyPlugins: [
|
|
234
|
+
new _core.ReviverReply(),
|
|
235
|
+
new _core.ExceptionReply()
|
|
236
|
+
],
|
|
237
|
+
angularPlugins: [],
|
|
238
|
+
requestPlugins: [],
|
|
239
|
+
enableTokenization: false,
|
|
240
|
+
disableFallback: false
|
|
241
|
+
};
|
|
242
|
+
var ApiAngularClient = /*#__PURE__*/ function() {
|
|
243
|
+
"use strict";
|
|
244
|
+
function ApiAngularClient(options) {
|
|
245
|
+
_class_call_check(this, ApiAngularClient);
|
|
246
|
+
/** @inheritdoc */ _define_property(this, "options", void 0);
|
|
247
|
+
this.options = _object_spread({}, DEFAULT_OPTIONS, options);
|
|
248
|
+
}
|
|
249
|
+
_create_class(ApiAngularClient, [
|
|
250
|
+
{
|
|
251
|
+
key: "extractQueryParams",
|
|
252
|
+
value: /** @inheritdoc */ function extractQueryParams(data, names) {
|
|
253
|
+
return (0, _core.extractQueryParams)(data, names);
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
key: "getRequestOptions",
|
|
258
|
+
value: /** @inheritdoc */ function getRequestOptions(requestOptionsParameters) {
|
|
259
|
+
var _this = this;
|
|
260
|
+
return _async_to_generator(function() {
|
|
261
|
+
var opts, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, plugin, _requestOptionsParameters_api, err;
|
|
262
|
+
return _ts_generator(this, function(_state) {
|
|
263
|
+
switch(_state.label){
|
|
264
|
+
case 0:
|
|
265
|
+
opts = _object_spread_props(_object_spread({}, requestOptionsParameters), {
|
|
266
|
+
headers: new Headers((0, _core.filterUndefinedValues)(requestOptionsParameters.headers)),
|
|
267
|
+
queryParams: (0, _core.filterUndefinedValues)(requestOptionsParameters.queryParams)
|
|
268
|
+
});
|
|
269
|
+
if (!_this.options.requestPlugins) return [
|
|
270
|
+
3,
|
|
271
|
+
8
|
|
272
|
+
];
|
|
273
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
274
|
+
_state.label = 1;
|
|
275
|
+
case 1:
|
|
276
|
+
_state.trys.push([
|
|
277
|
+
1,
|
|
278
|
+
6,
|
|
279
|
+
7,
|
|
280
|
+
8
|
|
281
|
+
]);
|
|
282
|
+
_iterator = _this.options.requestPlugins[Symbol.iterator]();
|
|
283
|
+
_state.label = 2;
|
|
284
|
+
case 2:
|
|
285
|
+
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
|
|
286
|
+
3,
|
|
287
|
+
5
|
|
288
|
+
];
|
|
289
|
+
plugin = _step.value;
|
|
290
|
+
return [
|
|
291
|
+
4,
|
|
292
|
+
plugin.load({
|
|
293
|
+
logger: _this.options.logger,
|
|
294
|
+
apiName: (_requestOptionsParameters_api = requestOptionsParameters.api) === null || _requestOptionsParameters_api === void 0 ? void 0 : _requestOptionsParameters_api.apiName
|
|
295
|
+
}).transform(opts)
|
|
296
|
+
];
|
|
297
|
+
case 3:
|
|
298
|
+
opts = _state.sent();
|
|
299
|
+
_state.label = 4;
|
|
300
|
+
case 4:
|
|
301
|
+
_iteratorNormalCompletion = true;
|
|
302
|
+
return [
|
|
303
|
+
3,
|
|
304
|
+
2
|
|
305
|
+
];
|
|
306
|
+
case 5:
|
|
307
|
+
return [
|
|
308
|
+
3,
|
|
309
|
+
8
|
|
310
|
+
];
|
|
311
|
+
case 6:
|
|
312
|
+
err = _state.sent();
|
|
313
|
+
_didIteratorError = true;
|
|
314
|
+
_iteratorError = err;
|
|
315
|
+
return [
|
|
316
|
+
3,
|
|
317
|
+
8
|
|
318
|
+
];
|
|
319
|
+
case 7:
|
|
320
|
+
try {
|
|
321
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
322
|
+
_iterator.return();
|
|
323
|
+
}
|
|
324
|
+
} finally{
|
|
325
|
+
if (_didIteratorError) {
|
|
326
|
+
throw _iteratorError;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return [
|
|
330
|
+
7
|
|
331
|
+
];
|
|
332
|
+
case 8:
|
|
333
|
+
return [
|
|
334
|
+
2,
|
|
335
|
+
opts
|
|
336
|
+
];
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
})();
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
key: "prepareUrl",
|
|
344
|
+
value: /** @inheritdoc */ function prepareUrl(url) {
|
|
345
|
+
var queryParameters = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
346
|
+
return (0, _core.prepareUrl)(url, queryParameters);
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
key: "processFormData",
|
|
351
|
+
value: /** @inheritdoc */ function processFormData(data, type) {
|
|
352
|
+
return (0, _core.processFormData)(data, type);
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
key: "tokenizeRequestOptions",
|
|
357
|
+
value: /** @inheritdoc */ function tokenizeRequestOptions(url, queryParameters, piiParamTokens, data) {
|
|
358
|
+
return this.options.enableTokenization ? (0, _core.tokenizeRequestOptions)(url, queryParameters, piiParamTokens, data) : undefined;
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
key: "processCall",
|
|
363
|
+
value: function processCall(url, options, apiType, apiName, revivers, operationId) {
|
|
364
|
+
var _this = this;
|
|
365
|
+
return _async_to_generator(function() {
|
|
366
|
+
var response, root, exception, origin, headers, asyncResponse, e, reviver, replyPlugins, parsedData, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, pluginRunner, err;
|
|
367
|
+
return _ts_generator(this, function(_state) {
|
|
368
|
+
switch(_state.label){
|
|
369
|
+
case 0:
|
|
370
|
+
origin = options.headers.get('Origin');
|
|
371
|
+
_state.label = 1;
|
|
372
|
+
case 1:
|
|
373
|
+
_state.trys.push([
|
|
374
|
+
1,
|
|
375
|
+
3,
|
|
376
|
+
,
|
|
377
|
+
4
|
|
378
|
+
]);
|
|
379
|
+
headers = Object.fromEntries(options.headers.entries());
|
|
380
|
+
asyncResponse = new Promise(function(resolve, reject) {
|
|
381
|
+
var _options_metadata;
|
|
382
|
+
var data;
|
|
383
|
+
var metadataSignal = (_options_metadata = options.metadata) === null || _options_metadata === void 0 ? void 0 : _options_metadata.signal;
|
|
384
|
+
metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.throwIfAborted();
|
|
385
|
+
var loadedPlugins = [];
|
|
386
|
+
if (_this.options.angularPlugins) {
|
|
387
|
+
var _loadedPlugins;
|
|
388
|
+
(_loadedPlugins = loadedPlugins).push.apply(_loadedPlugins, _to_consumable_array(_this.options.angularPlugins.map(function(plugin) {
|
|
389
|
+
return plugin.load({
|
|
390
|
+
angularPlugins: loadedPlugins,
|
|
391
|
+
apiClient: _this,
|
|
392
|
+
url: url,
|
|
393
|
+
apiName: apiName,
|
|
394
|
+
requestOptions: options,
|
|
395
|
+
logger: _this.options.logger
|
|
396
|
+
});
|
|
397
|
+
})));
|
|
398
|
+
}
|
|
399
|
+
var httpRequest = _this.options.httpClient.request(options.method, url, _object_spread_props(_object_spread({}, options), {
|
|
400
|
+
observe: 'response',
|
|
401
|
+
headers: headers
|
|
402
|
+
}));
|
|
403
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
404
|
+
try {
|
|
405
|
+
for(var _iterator = loadedPlugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
406
|
+
var plugin = _step.value;
|
|
407
|
+
httpRequest = plugin.transform(httpRequest);
|
|
408
|
+
}
|
|
409
|
+
} catch (err) {
|
|
410
|
+
_didIteratorError = true;
|
|
411
|
+
_iteratorError = err;
|
|
412
|
+
} finally{
|
|
413
|
+
try {
|
|
414
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
415
|
+
_iterator.return();
|
|
416
|
+
}
|
|
417
|
+
} finally{
|
|
418
|
+
if (_didIteratorError) {
|
|
419
|
+
throw _iteratorError;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
var subscription = httpRequest.subscribe({
|
|
424
|
+
next: function(res) {
|
|
425
|
+
return data = res;
|
|
426
|
+
},
|
|
427
|
+
error: function(err) {
|
|
428
|
+
return reject(err);
|
|
429
|
+
},
|
|
430
|
+
complete: function() {
|
|
431
|
+
return resolve(data);
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.throwIfAborted();
|
|
435
|
+
metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.addEventListener('abort', function() {
|
|
436
|
+
subscription.unsubscribe();
|
|
437
|
+
reject(metadataSignal.reason);
|
|
438
|
+
});
|
|
439
|
+
});
|
|
440
|
+
return [
|
|
441
|
+
4,
|
|
442
|
+
asyncResponse
|
|
443
|
+
];
|
|
444
|
+
case 2:
|
|
445
|
+
response = _state.sent();
|
|
446
|
+
root = response.body;
|
|
447
|
+
return [
|
|
448
|
+
3,
|
|
449
|
+
4
|
|
450
|
+
];
|
|
451
|
+
case 3:
|
|
452
|
+
e = _state.sent();
|
|
453
|
+
exception = new _core.EmptyResponseError(e.message || 'Fail to Fetch', undefined, {
|
|
454
|
+
apiName: apiName,
|
|
455
|
+
operationId: operationId,
|
|
456
|
+
url: url,
|
|
457
|
+
origin: origin
|
|
458
|
+
});
|
|
459
|
+
return [
|
|
460
|
+
3,
|
|
461
|
+
4
|
|
462
|
+
];
|
|
463
|
+
case 4:
|
|
464
|
+
// eslint-disable-next-line no-console
|
|
465
|
+
reviver = (0, _core.getResponseReviver)(revivers, response, operationId, {
|
|
466
|
+
disableFallback: _this.options.disableFallback,
|
|
467
|
+
log: console.error
|
|
468
|
+
});
|
|
469
|
+
replyPlugins = _this.options.replyPlugins ? _this.options.replyPlugins.map(function(plugin) {
|
|
470
|
+
return plugin.load({
|
|
471
|
+
dictionaries: root && root.dictionaries,
|
|
472
|
+
response: response && _object_spread_props(_object_spread({}, response), {
|
|
473
|
+
headers: new Headers(response.headers.keys().map(function(key) {
|
|
474
|
+
return [
|
|
475
|
+
key,
|
|
476
|
+
response.headers.get(key)
|
|
477
|
+
];
|
|
478
|
+
}))
|
|
479
|
+
}),
|
|
480
|
+
reviver: reviver,
|
|
481
|
+
apiType: apiType,
|
|
482
|
+
apiName: apiName,
|
|
483
|
+
exception: exception,
|
|
484
|
+
operationId: operationId,
|
|
485
|
+
url: url,
|
|
486
|
+
origin: origin,
|
|
487
|
+
logger: _this.options.logger
|
|
488
|
+
});
|
|
489
|
+
}) : [];
|
|
490
|
+
parsedData = root;
|
|
491
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
492
|
+
_state.label = 5;
|
|
493
|
+
case 5:
|
|
494
|
+
_state.trys.push([
|
|
495
|
+
5,
|
|
496
|
+
10,
|
|
497
|
+
11,
|
|
498
|
+
12
|
|
499
|
+
]);
|
|
500
|
+
_iterator = replyPlugins[Symbol.iterator]();
|
|
501
|
+
_state.label = 6;
|
|
502
|
+
case 6:
|
|
503
|
+
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
|
|
504
|
+
3,
|
|
505
|
+
9
|
|
506
|
+
];
|
|
507
|
+
pluginRunner = _step.value;
|
|
508
|
+
return [
|
|
509
|
+
4,
|
|
510
|
+
pluginRunner.transform(parsedData)
|
|
511
|
+
];
|
|
512
|
+
case 7:
|
|
513
|
+
parsedData = _state.sent();
|
|
514
|
+
_state.label = 8;
|
|
515
|
+
case 8:
|
|
516
|
+
_iteratorNormalCompletion = true;
|
|
517
|
+
return [
|
|
518
|
+
3,
|
|
519
|
+
6
|
|
520
|
+
];
|
|
521
|
+
case 9:
|
|
522
|
+
return [
|
|
523
|
+
3,
|
|
524
|
+
12
|
|
525
|
+
];
|
|
526
|
+
case 10:
|
|
527
|
+
err = _state.sent();
|
|
528
|
+
_didIteratorError = true;
|
|
529
|
+
_iteratorError = err;
|
|
530
|
+
return [
|
|
531
|
+
3,
|
|
532
|
+
12
|
|
533
|
+
];
|
|
534
|
+
case 11:
|
|
535
|
+
try {
|
|
536
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
537
|
+
_iterator.return();
|
|
538
|
+
}
|
|
539
|
+
} finally{
|
|
540
|
+
if (_didIteratorError) {
|
|
541
|
+
throw _iteratorError;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
return [
|
|
545
|
+
7
|
|
546
|
+
];
|
|
547
|
+
case 12:
|
|
548
|
+
if (exception) {
|
|
549
|
+
throw exception;
|
|
550
|
+
}
|
|
551
|
+
return [
|
|
552
|
+
2,
|
|
553
|
+
parsedData
|
|
554
|
+
];
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
|
+
})();
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
]);
|
|
561
|
+
return ApiAngularClient;
|
|
562
|
+
}();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./mock-intercept/index"), exports);
|
|
6
|
+
function _export_star(from, to) {
|
|
7
|
+
Object.keys(from).forEach(function(k) {
|
|
8
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
9
|
+
Object.defineProperty(to, k, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function() {
|
|
12
|
+
return from[k];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return from;
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./mock-intercept.angular"), exports);
|
|
6
|
+
_export_star(require("./mock-intercept.interface"), exports);
|
|
7
|
+
function _export_star(from, to) {
|
|
8
|
+
Object.keys(from).forEach(function(k) {
|
|
9
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
10
|
+
Object.defineProperty(to, k, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function() {
|
|
13
|
+
return from[k];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return from;
|
|
19
|
+
}
|