@ama-sdk/core 11.3.0-prerelease.2 → 11.3.0-prerelease.21
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/cjs/clients/api-angular-client.js +63 -3
- package/cjs/clients/api-fetch-client.js +2 -1
- package/cjs/fwk/date.js +12 -33
- package/cjs/fwk/errors.js +39 -43
- package/cjs/fwk/mocks/random-mock-adapter.js +10 -24
- package/cjs/fwk/mocks/sequential-mock-adapter.js +10 -24
- package/cjs/plugins/core/angular-plugin.js +4 -0
- package/cjs/plugins/mock-intercept/index.js +1 -0
- package/cjs/plugins/mock-intercept/mock-intercept.angular.js +347 -0
- package/cjs/plugins/si-token/si-token.request.js +21 -34
- package/esm2015/clients/api-angular-client.js +63 -3
- package/esm2015/clients/api-fetch-client.js +2 -1
- package/esm2015/fwk/date.js +12 -33
- package/esm2015/fwk/errors.js +39 -43
- package/esm2015/fwk/mocks/random-mock-adapter.js +10 -24
- package/esm2015/fwk/mocks/sequential-mock-adapter.js +10 -24
- package/esm2015/plugins/core/angular-plugin.js +4 -0
- package/esm2015/plugins/mock-intercept/index.js +1 -0
- package/esm2015/plugins/mock-intercept/mock-intercept.angular.js +342 -0
- package/esm2015/plugins/si-token/si-token.request.js +21 -34
- package/package.json +16 -5
- package/src/clients/api-angular-client.d.ts +4 -0
- package/src/clients/api-angular-client.d.ts.map +1 -1
- package/src/clients/api-angular-client.js +18 -3
- package/src/clients/api-angular-client.js.map +1 -1
- package/src/clients/api-fetch-client.d.ts.map +1 -1
- package/src/clients/api-fetch-client.js +9 -1
- package/src/clients/api-fetch-client.js.map +1 -1
- package/src/plugins/core/angular-plugin.d.ts +40 -0
- package/src/plugins/core/angular-plugin.d.ts.map +1 -0
- package/src/plugins/core/angular-plugin.js +2 -0
- package/src/plugins/core/angular-plugin.js.map +1 -0
- package/src/plugins/core/fetch-plugin.d.ts +1 -0
- package/src/plugins/core/fetch-plugin.d.ts.map +1 -1
- package/src/plugins/mock-intercept/index.d.ts +1 -0
- package/src/plugins/mock-intercept/index.d.ts.map +1 -1
- package/src/plugins/mock-intercept/index.js +1 -0
- package/src/plugins/mock-intercept/index.js.map +1 -1
- 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 +63 -0
- package/src/plugins/mock-intercept/mock-intercept.angular.js.map +1 -0
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "MockInterceptAngular", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return MockInterceptAngular;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _rxjs = require("rxjs");
|
|
12
|
+
var _mockinterceptinterface = require("./mock-intercept.interface");
|
|
13
|
+
var _mockinterceptrequest = require("./mock-intercept.request");
|
|
14
|
+
var _http = require("@angular/common/http");
|
|
15
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
16
|
+
try {
|
|
17
|
+
var info = gen[key](arg);
|
|
18
|
+
var value = info.value;
|
|
19
|
+
} catch (error) {
|
|
20
|
+
reject(error);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (info.done) {
|
|
24
|
+
resolve(value);
|
|
25
|
+
} else {
|
|
26
|
+
Promise.resolve(value).then(_next, _throw);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function _async_to_generator(fn) {
|
|
30
|
+
return function() {
|
|
31
|
+
var self = this, args = arguments;
|
|
32
|
+
return new Promise(function(resolve, reject) {
|
|
33
|
+
var gen = fn.apply(self, args);
|
|
34
|
+
function _next(value) {
|
|
35
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
36
|
+
}
|
|
37
|
+
function _throw(err) {
|
|
38
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
39
|
+
}
|
|
40
|
+
_next(undefined);
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function _class_call_check(instance, Constructor) {
|
|
45
|
+
if (!(instance instanceof Constructor)) {
|
|
46
|
+
throw new TypeError("Cannot call a class as a function");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function _defineProperties(target, props) {
|
|
50
|
+
for(var i = 0; i < props.length; i++){
|
|
51
|
+
var descriptor = props[i];
|
|
52
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
53
|
+
descriptor.configurable = true;
|
|
54
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
55
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
59
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
60
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
61
|
+
return Constructor;
|
|
62
|
+
}
|
|
63
|
+
function _define_property(obj, key, value) {
|
|
64
|
+
if (key in obj) {
|
|
65
|
+
Object.defineProperty(obj, key, {
|
|
66
|
+
value: value,
|
|
67
|
+
enumerable: true,
|
|
68
|
+
configurable: true,
|
|
69
|
+
writable: true
|
|
70
|
+
});
|
|
71
|
+
} else {
|
|
72
|
+
obj[key] = value;
|
|
73
|
+
}
|
|
74
|
+
return obj;
|
|
75
|
+
}
|
|
76
|
+
function _instanceof(left, right) {
|
|
77
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
78
|
+
return !!right[Symbol.hasInstance](left);
|
|
79
|
+
} else {
|
|
80
|
+
return left instanceof right;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function _object_spread(target) {
|
|
84
|
+
for(var i = 1; i < arguments.length; i++){
|
|
85
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
86
|
+
var ownKeys = Object.keys(source);
|
|
87
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
88
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
89
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
ownKeys.forEach(function(key) {
|
|
93
|
+
_define_property(target, key, source[key]);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
return target;
|
|
97
|
+
}
|
|
98
|
+
function ownKeys(object, enumerableOnly) {
|
|
99
|
+
var keys = Object.keys(object);
|
|
100
|
+
if (Object.getOwnPropertySymbols) {
|
|
101
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
102
|
+
if (enumerableOnly) {
|
|
103
|
+
symbols = symbols.filter(function(sym) {
|
|
104
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
keys.push.apply(keys, symbols);
|
|
108
|
+
}
|
|
109
|
+
return keys;
|
|
110
|
+
}
|
|
111
|
+
function _object_spread_props(target, source) {
|
|
112
|
+
source = source != null ? source : {};
|
|
113
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
114
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
115
|
+
} else {
|
|
116
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
117
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return target;
|
|
121
|
+
}
|
|
122
|
+
function _ts_generator(thisArg, body) {
|
|
123
|
+
var f, y, t, g, _ = {
|
|
124
|
+
label: 0,
|
|
125
|
+
sent: function() {
|
|
126
|
+
if (t[0] & 1) throw t[1];
|
|
127
|
+
return t[1];
|
|
128
|
+
},
|
|
129
|
+
trys: [],
|
|
130
|
+
ops: []
|
|
131
|
+
};
|
|
132
|
+
return g = {
|
|
133
|
+
next: verb(0),
|
|
134
|
+
"throw": verb(1),
|
|
135
|
+
"return": verb(2)
|
|
136
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
137
|
+
return this;
|
|
138
|
+
}), g;
|
|
139
|
+
function verb(n) {
|
|
140
|
+
return function(v) {
|
|
141
|
+
return step([
|
|
142
|
+
n,
|
|
143
|
+
v
|
|
144
|
+
]);
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function step(op) {
|
|
148
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
149
|
+
while(_)try {
|
|
150
|
+
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;
|
|
151
|
+
if (y = 0, t) op = [
|
|
152
|
+
op[0] & 2,
|
|
153
|
+
t.value
|
|
154
|
+
];
|
|
155
|
+
switch(op[0]){
|
|
156
|
+
case 0:
|
|
157
|
+
case 1:
|
|
158
|
+
t = op;
|
|
159
|
+
break;
|
|
160
|
+
case 4:
|
|
161
|
+
_.label++;
|
|
162
|
+
return {
|
|
163
|
+
value: op[1],
|
|
164
|
+
done: false
|
|
165
|
+
};
|
|
166
|
+
case 5:
|
|
167
|
+
_.label++;
|
|
168
|
+
y = op[1];
|
|
169
|
+
op = [
|
|
170
|
+
0
|
|
171
|
+
];
|
|
172
|
+
continue;
|
|
173
|
+
case 7:
|
|
174
|
+
op = _.ops.pop();
|
|
175
|
+
_.trys.pop();
|
|
176
|
+
continue;
|
|
177
|
+
default:
|
|
178
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
179
|
+
_ = 0;
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
183
|
+
_.label = op[1];
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
187
|
+
_.label = t[1];
|
|
188
|
+
t = op;
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
if (t && _.label < t[2]) {
|
|
192
|
+
_.label = t[2];
|
|
193
|
+
_.ops.push(op);
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
if (t[2]) _.ops.pop();
|
|
197
|
+
_.trys.pop();
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
op = body.call(thisArg, _);
|
|
201
|
+
} catch (e) {
|
|
202
|
+
op = [
|
|
203
|
+
6,
|
|
204
|
+
e
|
|
205
|
+
];
|
|
206
|
+
y = 0;
|
|
207
|
+
} finally{
|
|
208
|
+
f = t = 0;
|
|
209
|
+
}
|
|
210
|
+
if (op[0] & 5) throw op[1];
|
|
211
|
+
return {
|
|
212
|
+
value: op[0] ? op[1] : void 0,
|
|
213
|
+
done: true
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
var MockInterceptAngular = /*#__PURE__*/ function() {
|
|
218
|
+
"use strict";
|
|
219
|
+
function MockInterceptAngular(options) {
|
|
220
|
+
_class_call_check(this, MockInterceptAngular);
|
|
221
|
+
_define_property(this, "options", void 0);
|
|
222
|
+
this.options = options;
|
|
223
|
+
}
|
|
224
|
+
_create_class(MockInterceptAngular, [
|
|
225
|
+
{
|
|
226
|
+
key: "load",
|
|
227
|
+
value: function load(context) {
|
|
228
|
+
var _this = this;
|
|
229
|
+
if (!context.apiClient.options.requestPlugins.some(function(plugin) {
|
|
230
|
+
return _instanceof(plugin, _mockinterceptrequest.MockInterceptRequest);
|
|
231
|
+
})) {
|
|
232
|
+
throw new Error('MockInterceptAngular plugin should be used only with the MockInterceptRequest plugin');
|
|
233
|
+
}
|
|
234
|
+
return {
|
|
235
|
+
transform: function(call) {
|
|
236
|
+
var _this1 = _this;
|
|
237
|
+
return (0, _rxjs.from)(_async_to_generator(function() {
|
|
238
|
+
var originalCall, delayTime, _tmp, operationId, mock, response;
|
|
239
|
+
return _ts_generator(this, function(_state) {
|
|
240
|
+
switch(_state.label){
|
|
241
|
+
case 0:
|
|
242
|
+
return [
|
|
243
|
+
4,
|
|
244
|
+
_this1.options.adapter.initialize()
|
|
245
|
+
];
|
|
246
|
+
case 1:
|
|
247
|
+
_state.sent();
|
|
248
|
+
originalCall = call;
|
|
249
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
250
|
+
if (!context.options.headers || !_instanceof(context.options.headers, Headers) || !context.options.headers.has(_mockinterceptinterface.CUSTOM_MOCK_OPERATION_ID_HEADER)) {
|
|
251
|
+
return [
|
|
252
|
+
2,
|
|
253
|
+
originalCall
|
|
254
|
+
];
|
|
255
|
+
}
|
|
256
|
+
if (!(typeof _this1.options.delayTiming !== 'undefined')) return [
|
|
257
|
+
3,
|
|
258
|
+
5
|
|
259
|
+
];
|
|
260
|
+
if (!(typeof _this1.options.delayTiming === 'number')) return [
|
|
261
|
+
3,
|
|
262
|
+
2
|
|
263
|
+
];
|
|
264
|
+
_tmp = _this1.options.delayTiming;
|
|
265
|
+
return [
|
|
266
|
+
3,
|
|
267
|
+
4
|
|
268
|
+
];
|
|
269
|
+
case 2:
|
|
270
|
+
return [
|
|
271
|
+
4,
|
|
272
|
+
_this1.options.delayTiming(_object_spread_props(_object_spread({}, context), {
|
|
273
|
+
fetchPlugins: [],
|
|
274
|
+
options: context.requestOptions
|
|
275
|
+
}))
|
|
276
|
+
];
|
|
277
|
+
case 3:
|
|
278
|
+
_tmp = _state.sent();
|
|
279
|
+
_state.label = 4;
|
|
280
|
+
case 4:
|
|
281
|
+
delayTime = _tmp;
|
|
282
|
+
originalCall = originalCall.pipe((0, _rxjs.delay)(delayTime));
|
|
283
|
+
_state.label = 5;
|
|
284
|
+
case 5:
|
|
285
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
286
|
+
operationId = context.options.headers.get(_mockinterceptinterface.CUSTOM_MOCK_OPERATION_ID_HEADER);
|
|
287
|
+
try {
|
|
288
|
+
mock = _this1.options.adapter.getLatestMock(operationId);
|
|
289
|
+
if (!mock.getResponse) {
|
|
290
|
+
return [
|
|
291
|
+
2,
|
|
292
|
+
originalCall
|
|
293
|
+
];
|
|
294
|
+
}
|
|
295
|
+
response = mock.getResponse();
|
|
296
|
+
return [
|
|
297
|
+
2,
|
|
298
|
+
originalCall.pipe((0, _rxjs.mergeMap)(function() {
|
|
299
|
+
var _ref = _async_to_generator(function(res) {
|
|
300
|
+
var body, responseCloned;
|
|
301
|
+
return _ts_generator(this, function(_state) {
|
|
302
|
+
switch(_state.label){
|
|
303
|
+
case 0:
|
|
304
|
+
return [
|
|
305
|
+
4,
|
|
306
|
+
response.json()
|
|
307
|
+
];
|
|
308
|
+
case 1:
|
|
309
|
+
body = _state.sent();
|
|
310
|
+
responseCloned = res.clone();
|
|
311
|
+
return [
|
|
312
|
+
2,
|
|
313
|
+
new _http.HttpResponse(_object_spread_props(_object_spread({}, responseCloned), {
|
|
314
|
+
body: body,
|
|
315
|
+
url: responseCloned.url || undefined
|
|
316
|
+
}))
|
|
317
|
+
];
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
return function(res) {
|
|
322
|
+
return _ref.apply(this, arguments);
|
|
323
|
+
};
|
|
324
|
+
}()))
|
|
325
|
+
];
|
|
326
|
+
} catch (e) {
|
|
327
|
+
(context.logger || console).error("Failed to retrieve the latest mock for Operation ID ".concat(operationId, ", fallback to default mock"));
|
|
328
|
+
return [
|
|
329
|
+
2,
|
|
330
|
+
originalCall
|
|
331
|
+
];
|
|
332
|
+
}
|
|
333
|
+
return [
|
|
334
|
+
2
|
|
335
|
+
];
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
})()).pipe((0, _rxjs.mergeMap)(function(res) {
|
|
339
|
+
return res;
|
|
340
|
+
}));
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
]);
|
|
346
|
+
return MockInterceptAngular;
|
|
347
|
+
}();
|
|
@@ -15,6 +15,10 @@ function _assert_this_initialized(self) {
|
|
|
15
15
|
}
|
|
16
16
|
return self;
|
|
17
17
|
}
|
|
18
|
+
function _call_super(_this, derived, args) {
|
|
19
|
+
derived = _get_prototype_of(derived);
|
|
20
|
+
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
21
|
+
}
|
|
18
22
|
function _class_call_check(instance, Constructor) {
|
|
19
23
|
if (!(instance instanceof Constructor)) {
|
|
20
24
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -70,50 +74,33 @@ function _type_of(obj) {
|
|
|
70
74
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
71
75
|
}
|
|
72
76
|
function _is_native_reflect_construct() {
|
|
73
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
74
|
-
if (Reflect.construct.sham) return false;
|
|
75
|
-
if (typeof Proxy === "function") return true;
|
|
76
77
|
try {
|
|
77
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function _create_super(Derived) {
|
|
84
|
-
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
85
|
-
return function _createSuperInternal() {
|
|
86
|
-
var Super = _get_prototype_of(Derived), result;
|
|
87
|
-
if (hasNativeReflectConstruct) {
|
|
88
|
-
var NewTarget = _get_prototype_of(this).constructor;
|
|
89
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
90
|
-
} else {
|
|
91
|
-
result = Super.apply(this, arguments);
|
|
92
|
-
}
|
|
93
|
-
return _possible_constructor_return(this, result);
|
|
94
|
-
};
|
|
78
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
79
|
+
} catch (_) {}
|
|
80
|
+
return (_is_native_reflect_construct = function() {
|
|
81
|
+
return !!result;
|
|
82
|
+
})();
|
|
95
83
|
}
|
|
96
84
|
var SiTokenRequest = /*#__PURE__*/ function(AdditionalParamsRequest) {
|
|
97
85
|
"use strict";
|
|
98
86
|
_inherits(SiTokenRequest, AdditionalParamsRequest);
|
|
99
|
-
var _super = _create_super(SiTokenRequest);
|
|
100
87
|
function SiTokenRequest(siToken, siToken2) {
|
|
101
88
|
_class_call_check(this, SiTokenRequest);
|
|
102
89
|
var _this;
|
|
103
|
-
_this =
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
90
|
+
_this = _call_super(this, SiTokenRequest, [
|
|
91
|
+
{
|
|
92
|
+
queryParams: function(queryParams) {
|
|
93
|
+
var ret = queryParams || {};
|
|
94
|
+
if (_assert_this_initialized(_this).siToken) {
|
|
95
|
+
ret.SITK = _assert_this_initialized(_this).siToken;
|
|
96
|
+
}
|
|
97
|
+
if (_assert_this_initialized(_this).siToken2) {
|
|
98
|
+
ret.SITK2 = _assert_this_initialized(_this).siToken2;
|
|
99
|
+
}
|
|
100
|
+
return ret;
|
|
111
101
|
}
|
|
112
|
-
return ret;
|
|
113
102
|
}
|
|
114
|
-
|
|
115
|
-
/** SI Token */ _define_property(_assert_this_initialized(_this), "siToken", void 0);
|
|
116
|
-
/** SI Token 2 */ _define_property(_assert_this_initialized(_this), "siToken2", void 0);
|
|
103
|
+
]), /** SI Token */ _define_property(_this, "siToken", void 0), /** SI Token 2 */ _define_property(_this, "siToken2", void 0);
|
|
117
104
|
_this.siToken = siToken;
|
|
118
105
|
_this.siToken2 = siToken2;
|
|
119
106
|
return _this;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
5
|
+
}
|
|
6
|
+
function _array_without_holes(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
8
|
+
}
|
|
1
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
10
|
try {
|
|
3
11
|
var info = gen[key](arg);
|
|
@@ -59,6 +67,12 @@ function _define_property(obj, key, value) {
|
|
|
59
67
|
}
|
|
60
68
|
return obj;
|
|
61
69
|
}
|
|
70
|
+
function _iterable_to_array(iter) {
|
|
71
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
72
|
+
}
|
|
73
|
+
function _non_iterable_spread() {
|
|
74
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
75
|
+
}
|
|
62
76
|
function _object_spread(target) {
|
|
63
77
|
for(var i = 1; i < arguments.length; i++){
|
|
64
78
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -98,6 +112,17 @@ function _object_spread_props(target, source) {
|
|
|
98
112
|
}
|
|
99
113
|
return target;
|
|
100
114
|
}
|
|
115
|
+
function _to_consumable_array(arr) {
|
|
116
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
117
|
+
}
|
|
118
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
119
|
+
if (!o) return;
|
|
120
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
121
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
122
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
123
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
124
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
125
|
+
}
|
|
101
126
|
function _ts_generator(thisArg, body) {
|
|
102
127
|
var f, y, t, g, _ = {
|
|
103
128
|
label: 0,
|
|
@@ -202,7 +227,7 @@ var DEFAULT_OPTIONS = {
|
|
|
202
227
|
new ReviverReply(),
|
|
203
228
|
new ExceptionReply()
|
|
204
229
|
],
|
|
205
|
-
|
|
230
|
+
angularPlugins: [],
|
|
206
231
|
requestPlugins: [],
|
|
207
232
|
enableTokenization: false,
|
|
208
233
|
disableFallback: false
|
|
@@ -350,10 +375,45 @@ var DEFAULT_OPTIONS = {
|
|
|
350
375
|
var data;
|
|
351
376
|
var metadataSignal = (_options_metadata = options.metadata) === null || _options_metadata === void 0 ? void 0 : _options_metadata.signal;
|
|
352
377
|
metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.throwIfAborted();
|
|
353
|
-
var
|
|
378
|
+
var loadedPlugins = [];
|
|
379
|
+
if (_this.options.angularPlugins) {
|
|
380
|
+
var _loadedPlugins;
|
|
381
|
+
(_loadedPlugins = loadedPlugins).push.apply(_loadedPlugins, _to_consumable_array(_this.options.angularPlugins.map(function(plugin) {
|
|
382
|
+
return plugin.load({
|
|
383
|
+
angularPlugins: loadedPlugins,
|
|
384
|
+
apiClient: _this,
|
|
385
|
+
url: url,
|
|
386
|
+
apiName: apiName,
|
|
387
|
+
requestOptions: options,
|
|
388
|
+
logger: _this.options.logger
|
|
389
|
+
});
|
|
390
|
+
})));
|
|
391
|
+
}
|
|
392
|
+
var httpRequest = _this.options.httpClient.request(options.method, url, _object_spread_props(_object_spread({}, options), {
|
|
354
393
|
observe: 'response',
|
|
355
394
|
headers: headers
|
|
356
|
-
}))
|
|
395
|
+
}));
|
|
396
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
397
|
+
try {
|
|
398
|
+
for(var _iterator = loadedPlugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
399
|
+
var plugin = _step.value;
|
|
400
|
+
httpRequest = plugin.transform(httpRequest);
|
|
401
|
+
}
|
|
402
|
+
} catch (err) {
|
|
403
|
+
_didIteratorError = true;
|
|
404
|
+
_iteratorError = err;
|
|
405
|
+
} finally{
|
|
406
|
+
try {
|
|
407
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
408
|
+
_iterator.return();
|
|
409
|
+
}
|
|
410
|
+
} finally{
|
|
411
|
+
if (_didIteratorError) {
|
|
412
|
+
throw _iteratorError;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
var subscription = httpRequest.subscribe({
|
|
357
417
|
next: function(res) {
|
|
358
418
|
return data = res;
|
|
359
419
|
},
|
package/esm2015/fwk/date.js
CHANGED
|
@@ -12,6 +12,10 @@ function _assert_this_initialized(self) {
|
|
|
12
12
|
}
|
|
13
13
|
return self;
|
|
14
14
|
}
|
|
15
|
+
function _call_super(_this, derived, args) {
|
|
16
|
+
derived = _get_prototype_of(derived);
|
|
17
|
+
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
18
|
+
}
|
|
15
19
|
function _class_call_check(instance, Constructor) {
|
|
16
20
|
if (!(instance instanceof Constructor)) {
|
|
17
21
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -138,28 +142,12 @@ function _wrap_native_super(Class) {
|
|
|
138
142
|
return _wrap_native_super(Class);
|
|
139
143
|
}
|
|
140
144
|
function _is_native_reflect_construct() {
|
|
141
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
142
|
-
if (Reflect.construct.sham) return false;
|
|
143
|
-
if (typeof Proxy === "function") return true;
|
|
144
145
|
try {
|
|
145
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
return
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
function _create_super(Derived) {
|
|
152
|
-
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
153
|
-
return function _createSuperInternal() {
|
|
154
|
-
var Super = _get_prototype_of(Derived), result;
|
|
155
|
-
if (hasNativeReflectConstruct) {
|
|
156
|
-
var NewTarget = _get_prototype_of(this).constructor;
|
|
157
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
158
|
-
} else {
|
|
159
|
-
result = Super.apply(this, arguments);
|
|
160
|
-
}
|
|
161
|
-
return _possible_constructor_return(this, result);
|
|
162
|
-
};
|
|
146
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
147
|
+
} catch (_) {}
|
|
148
|
+
return (_is_native_reflect_construct = function() {
|
|
149
|
+
return !!result;
|
|
150
|
+
})();
|
|
163
151
|
}
|
|
164
152
|
export var _NativeDateClass = Date;
|
|
165
153
|
/**
|
|
@@ -175,7 +163,6 @@ export var _NativeDateClass = Date;
|
|
|
175
163
|
export var CommonDate = /*#__PURE__*/ function(Date1) {
|
|
176
164
|
"use strict";
|
|
177
165
|
_inherits(CommonDate, Date1);
|
|
178
|
-
var _super = _create_super(CommonDate);
|
|
179
166
|
function CommonDate() {
|
|
180
167
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
181
168
|
args[_key] = arguments[_key];
|
|
@@ -204,9 +191,7 @@ export var CommonDate = /*#__PURE__*/ function(Date1) {
|
|
|
204
191
|
args[0] = args[0];
|
|
205
192
|
}
|
|
206
193
|
}
|
|
207
|
-
return
|
|
208
|
-
this
|
|
209
|
-
].concat(_to_consumable_array(args)));
|
|
194
|
+
return _call_super(this, CommonDate, _to_consumable_array(args));
|
|
210
195
|
}
|
|
211
196
|
_create_class(CommonDate, [
|
|
212
197
|
{
|
|
@@ -225,7 +210,6 @@ export var utils;
|
|
|
225
210
|
'use strict';
|
|
226
211
|
var _$Date = /*#__PURE__*/ function(CommonDate) {
|
|
227
212
|
_inherits(Date1, CommonDate);
|
|
228
|
-
var _super = _create_super(Date1);
|
|
229
213
|
function Date1() {
|
|
230
214
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
231
215
|
args[_key] = arguments[_key];
|
|
@@ -236,9 +220,7 @@ export var utils;
|
|
|
236
220
|
} else if (_instanceof(args[0], _NativeDateClass)) {
|
|
237
221
|
args[0] = "".concat(args[0].getFullYear(), "-").concat(pad(args[0].getMonth() + 1), "-").concat(pad(args[0].getDate()), "T00:00:00Z");
|
|
238
222
|
}
|
|
239
|
-
return
|
|
240
|
-
this
|
|
241
|
-
].concat(_to_consumable_array(args)));
|
|
223
|
+
return _call_super(this, Date1, _to_consumable_array(args));
|
|
242
224
|
}
|
|
243
225
|
_create_class(Date1, [
|
|
244
226
|
{
|
|
@@ -275,15 +257,12 @@ export var utils;
|
|
|
275
257
|
utils.Date = _$Date;
|
|
276
258
|
var DateTime = /*#__PURE__*/ function(CommonDate) {
|
|
277
259
|
_inherits(DateTime, CommonDate);
|
|
278
|
-
var _super = _create_super(DateTime);
|
|
279
260
|
function DateTime() {
|
|
280
261
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
281
262
|
args[_key] = arguments[_key];
|
|
282
263
|
}
|
|
283
264
|
_class_call_check(this, DateTime);
|
|
284
|
-
return
|
|
285
|
-
this
|
|
286
|
-
].concat(_to_consumable_array(args)));
|
|
265
|
+
return _call_super(this, DateTime, _to_consumable_array(args));
|
|
287
266
|
}
|
|
288
267
|
_create_class(DateTime, [
|
|
289
268
|
{
|