@rxap/config 12.3.0 → 13.0.0-next.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/esm2020/index.mjs +4 -0
- package/esm2020/lib/config-loader.service.mjs +33 -0
- package/esm2020/lib/config.service.mjs +156 -0
- package/esm2020/lib/tokens.mjs +3 -0
- package/esm2020/lib/types.mjs +2 -0
- package/esm2020/rxap-config.mjs +5 -0
- package/fesm2015/{rxap-config.js → rxap-config.mjs} +21 -17
- package/fesm2015/rxap-config.mjs.map +1 -0
- package/{esm2015/lib/config.service.js → fesm2020/rxap-config.mjs} +88 -55
- package/fesm2020/rxap-config.mjs.map +1 -0
- package/package.json +28 -13
- package/src/schematics/ng-add/index.js +9 -9
- package/src/schematics/ng-add/index.js.map +1 -1
- package/src/schematics/side-load/index.js +6 -6
- package/src/schematics/side-load/index.js.map +1 -1
- package/bundles/rxap-config.umd.js +0 -632
- package/bundles/rxap-config.umd.js.map +0 -1
- package/esm2015/index.js +0 -4
- package/esm2015/index.js.map +0 -1
- package/esm2015/lib/config-loader.service.js +0 -36
- package/esm2015/lib/config-loader.service.js.map +0 -1
- package/esm2015/lib/config.service.js.map +0 -1
- package/esm2015/lib/tokens.js +0 -3
- package/esm2015/lib/tokens.js.map +0 -1
- package/esm2015/lib/types.js +0 -2
- package/esm2015/lib/types.js.map +0 -1
- package/esm2015/rxap-config.js +0 -5
- package/esm2015/rxap-config.js.map +0 -1
- package/fesm2015/rxap-config.js.map +0 -1
|
@@ -1,632 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@rxap/utilities'), require('@angular/common/http'), require('rxjs/operators')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@rxap/config', ['exports', '@angular/core', '@rxap/utilities', '@angular/common/http', 'rxjs/operators'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.rxap = global.rxap || {}, global.rxap.config = {}), global.ng.core, global.utilities, global.ng.common.http, global.rxjs.operators));
|
|
5
|
-
}(this, (function (exports, i0, utilities, i1, operators) { 'use strict';
|
|
6
|
-
|
|
7
|
-
function _interopNamespace(e) {
|
|
8
|
-
if (e && e.__esModule) return e;
|
|
9
|
-
var n = Object.create(null);
|
|
10
|
-
if (e) {
|
|
11
|
-
Object.keys(e).forEach(function (k) {
|
|
12
|
-
if (k !== 'default') {
|
|
13
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function () {
|
|
17
|
-
return e[k];
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
n['default'] = e;
|
|
24
|
-
return Object.freeze(n);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
28
|
-
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
29
|
-
|
|
30
|
-
/*! *****************************************************************************
|
|
31
|
-
Copyright (c) Microsoft Corporation.
|
|
32
|
-
|
|
33
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
34
|
-
purpose with or without fee is hereby granted.
|
|
35
|
-
|
|
36
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
37
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
38
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
39
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
40
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
41
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
42
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
43
|
-
***************************************************************************** */
|
|
44
|
-
/* global Reflect, Promise */
|
|
45
|
-
var extendStatics = function (d, b) {
|
|
46
|
-
extendStatics = Object.setPrototypeOf ||
|
|
47
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
48
|
-
function (d, b) { for (var p in b)
|
|
49
|
-
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
50
|
-
d[p] = b[p]; };
|
|
51
|
-
return extendStatics(d, b);
|
|
52
|
-
};
|
|
53
|
-
function __extends(d, b) {
|
|
54
|
-
if (typeof b !== "function" && b !== null)
|
|
55
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
56
|
-
extendStatics(d, b);
|
|
57
|
-
function __() { this.constructor = d; }
|
|
58
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
59
|
-
}
|
|
60
|
-
var __assign = function () {
|
|
61
|
-
__assign = Object.assign || function __assign(t) {
|
|
62
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
63
|
-
s = arguments[i];
|
|
64
|
-
for (var p in s)
|
|
65
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
66
|
-
t[p] = s[p];
|
|
67
|
-
}
|
|
68
|
-
return t;
|
|
69
|
-
};
|
|
70
|
-
return __assign.apply(this, arguments);
|
|
71
|
-
};
|
|
72
|
-
function __rest(s, e) {
|
|
73
|
-
var t = {};
|
|
74
|
-
for (var p in s)
|
|
75
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
76
|
-
t[p] = s[p];
|
|
77
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
78
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
79
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
80
|
-
t[p[i]] = s[p[i]];
|
|
81
|
-
}
|
|
82
|
-
return t;
|
|
83
|
-
}
|
|
84
|
-
function __decorate(decorators, target, key, desc) {
|
|
85
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
86
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
87
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
88
|
-
else
|
|
89
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
90
|
-
if (d = decorators[i])
|
|
91
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
92
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
93
|
-
}
|
|
94
|
-
function __param(paramIndex, decorator) {
|
|
95
|
-
return function (target, key) { decorator(target, key, paramIndex); };
|
|
96
|
-
}
|
|
97
|
-
function __metadata(metadataKey, metadataValue) {
|
|
98
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
99
|
-
return Reflect.metadata(metadataKey, metadataValue);
|
|
100
|
-
}
|
|
101
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
102
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
103
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
104
|
-
function fulfilled(value) { try {
|
|
105
|
-
step(generator.next(value));
|
|
106
|
-
}
|
|
107
|
-
catch (e) {
|
|
108
|
-
reject(e);
|
|
109
|
-
} }
|
|
110
|
-
function rejected(value) { try {
|
|
111
|
-
step(generator["throw"](value));
|
|
112
|
-
}
|
|
113
|
-
catch (e) {
|
|
114
|
-
reject(e);
|
|
115
|
-
} }
|
|
116
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
117
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
function __generator(thisArg, body) {
|
|
121
|
-
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
122
|
-
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
123
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
124
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
125
|
-
function step(op) {
|
|
126
|
-
if (f)
|
|
127
|
-
throw new TypeError("Generator is already executing.");
|
|
128
|
-
while (_)
|
|
129
|
-
try {
|
|
130
|
-
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)
|
|
131
|
-
return t;
|
|
132
|
-
if (y = 0, t)
|
|
133
|
-
op = [op[0] & 2, t.value];
|
|
134
|
-
switch (op[0]) {
|
|
135
|
-
case 0:
|
|
136
|
-
case 1:
|
|
137
|
-
t = op;
|
|
138
|
-
break;
|
|
139
|
-
case 4:
|
|
140
|
-
_.label++;
|
|
141
|
-
return { value: op[1], done: false };
|
|
142
|
-
case 5:
|
|
143
|
-
_.label++;
|
|
144
|
-
y = op[1];
|
|
145
|
-
op = [0];
|
|
146
|
-
continue;
|
|
147
|
-
case 7:
|
|
148
|
-
op = _.ops.pop();
|
|
149
|
-
_.trys.pop();
|
|
150
|
-
continue;
|
|
151
|
-
default:
|
|
152
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
153
|
-
_ = 0;
|
|
154
|
-
continue;
|
|
155
|
-
}
|
|
156
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
157
|
-
_.label = op[1];
|
|
158
|
-
break;
|
|
159
|
-
}
|
|
160
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
161
|
-
_.label = t[1];
|
|
162
|
-
t = op;
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
if (t && _.label < t[2]) {
|
|
166
|
-
_.label = t[2];
|
|
167
|
-
_.ops.push(op);
|
|
168
|
-
break;
|
|
169
|
-
}
|
|
170
|
-
if (t[2])
|
|
171
|
-
_.ops.pop();
|
|
172
|
-
_.trys.pop();
|
|
173
|
-
continue;
|
|
174
|
-
}
|
|
175
|
-
op = body.call(thisArg, _);
|
|
176
|
-
}
|
|
177
|
-
catch (e) {
|
|
178
|
-
op = [6, e];
|
|
179
|
-
y = 0;
|
|
180
|
-
}
|
|
181
|
-
finally {
|
|
182
|
-
f = t = 0;
|
|
183
|
-
}
|
|
184
|
-
if (op[0] & 5)
|
|
185
|
-
throw op[1];
|
|
186
|
-
return { value: op[0] ? op[1] : void 0, done: true };
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
190
|
-
if (k2 === undefined)
|
|
191
|
-
k2 = k;
|
|
192
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
|
193
|
-
}) : (function (o, m, k, k2) {
|
|
194
|
-
if (k2 === undefined)
|
|
195
|
-
k2 = k;
|
|
196
|
-
o[k2] = m[k];
|
|
197
|
-
});
|
|
198
|
-
function __exportStar(m, o) {
|
|
199
|
-
for (var p in m)
|
|
200
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
201
|
-
__createBinding(o, m, p);
|
|
202
|
-
}
|
|
203
|
-
function __values(o) {
|
|
204
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
205
|
-
if (m)
|
|
206
|
-
return m.call(o);
|
|
207
|
-
if (o && typeof o.length === "number")
|
|
208
|
-
return {
|
|
209
|
-
next: function () {
|
|
210
|
-
if (o && i >= o.length)
|
|
211
|
-
o = void 0;
|
|
212
|
-
return { value: o && o[i++], done: !o };
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
216
|
-
}
|
|
217
|
-
function __read(o, n) {
|
|
218
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
219
|
-
if (!m)
|
|
220
|
-
return o;
|
|
221
|
-
var i = m.call(o), r, ar = [], e;
|
|
222
|
-
try {
|
|
223
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
224
|
-
ar.push(r.value);
|
|
225
|
-
}
|
|
226
|
-
catch (error) {
|
|
227
|
-
e = { error: error };
|
|
228
|
-
}
|
|
229
|
-
finally {
|
|
230
|
-
try {
|
|
231
|
-
if (r && !r.done && (m = i["return"]))
|
|
232
|
-
m.call(i);
|
|
233
|
-
}
|
|
234
|
-
finally {
|
|
235
|
-
if (e)
|
|
236
|
-
throw e.error;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
return ar;
|
|
240
|
-
}
|
|
241
|
-
/** @deprecated */
|
|
242
|
-
function __spread() {
|
|
243
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
244
|
-
ar = ar.concat(__read(arguments[i]));
|
|
245
|
-
return ar;
|
|
246
|
-
}
|
|
247
|
-
/** @deprecated */
|
|
248
|
-
function __spreadArrays() {
|
|
249
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
250
|
-
s += arguments[i].length;
|
|
251
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
252
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
253
|
-
r[k] = a[j];
|
|
254
|
-
return r;
|
|
255
|
-
}
|
|
256
|
-
function __spreadArray(to, from) {
|
|
257
|
-
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
258
|
-
to[j] = from[i];
|
|
259
|
-
return to;
|
|
260
|
-
}
|
|
261
|
-
function __await(v) {
|
|
262
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
263
|
-
}
|
|
264
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
265
|
-
if (!Symbol.asyncIterator)
|
|
266
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
267
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
268
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
269
|
-
function verb(n) { if (g[n])
|
|
270
|
-
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
271
|
-
function resume(n, v) { try {
|
|
272
|
-
step(g[n](v));
|
|
273
|
-
}
|
|
274
|
-
catch (e) {
|
|
275
|
-
settle(q[0][3], e);
|
|
276
|
-
} }
|
|
277
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
278
|
-
function fulfill(value) { resume("next", value); }
|
|
279
|
-
function reject(value) { resume("throw", value); }
|
|
280
|
-
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
281
|
-
resume(q[0][0], q[0][1]); }
|
|
282
|
-
}
|
|
283
|
-
function __asyncDelegator(o) {
|
|
284
|
-
var i, p;
|
|
285
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
286
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
287
|
-
}
|
|
288
|
-
function __asyncValues(o) {
|
|
289
|
-
if (!Symbol.asyncIterator)
|
|
290
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
291
|
-
var m = o[Symbol.asyncIterator], i;
|
|
292
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
293
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
294
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
295
|
-
}
|
|
296
|
-
function __makeTemplateObject(cooked, raw) {
|
|
297
|
-
if (Object.defineProperty) {
|
|
298
|
-
Object.defineProperty(cooked, "raw", { value: raw });
|
|
299
|
-
}
|
|
300
|
-
else {
|
|
301
|
-
cooked.raw = raw;
|
|
302
|
-
}
|
|
303
|
-
return cooked;
|
|
304
|
-
}
|
|
305
|
-
;
|
|
306
|
-
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
307
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
308
|
-
}) : function (o, v) {
|
|
309
|
-
o["default"] = v;
|
|
310
|
-
};
|
|
311
|
-
function __importStar(mod) {
|
|
312
|
-
if (mod && mod.__esModule)
|
|
313
|
-
return mod;
|
|
314
|
-
var result = {};
|
|
315
|
-
if (mod != null)
|
|
316
|
-
for (var k in mod)
|
|
317
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
318
|
-
__createBinding(result, mod, k);
|
|
319
|
-
__setModuleDefault(result, mod);
|
|
320
|
-
return result;
|
|
321
|
-
}
|
|
322
|
-
function __importDefault(mod) {
|
|
323
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
324
|
-
}
|
|
325
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
326
|
-
if (kind === "a" && !f)
|
|
327
|
-
throw new TypeError("Private accessor was defined without a getter");
|
|
328
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
329
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
330
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
331
|
-
}
|
|
332
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
333
|
-
if (kind === "m")
|
|
334
|
-
throw new TypeError("Private method is not writable");
|
|
335
|
-
if (kind === "a" && !f)
|
|
336
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
337
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
338
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
339
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
var RXAP_CONFIG = new i0.InjectionToken('rxap/config');
|
|
343
|
-
|
|
344
|
-
var ConfigService = /** @class */ (function () {
|
|
345
|
-
function ConfigService(config) {
|
|
346
|
-
if (config === void 0) { config = null; }
|
|
347
|
-
var _a;
|
|
348
|
-
this.config = ConfigService.Config;
|
|
349
|
-
if (config) {
|
|
350
|
-
this.config = utilities.deepMerge((_a = this.config) !== null && _a !== void 0 ? _a : {}, config);
|
|
351
|
-
}
|
|
352
|
-
if (!this.config) {
|
|
353
|
-
throw new Error('config not available');
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
ConfigService.SideLoad = function (url, propertyPath, required) {
|
|
357
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
358
|
-
var response, _b, _c, error_1;
|
|
359
|
-
return __generator(this, function (_d) {
|
|
360
|
-
switch (_d.label) {
|
|
361
|
-
case 0:
|
|
362
|
-
if (!this.Config) {
|
|
363
|
-
throw new Error('Config side load is only possible after the initial config load.');
|
|
364
|
-
}
|
|
365
|
-
_d.label = 1;
|
|
366
|
-
case 1:
|
|
367
|
-
_d.trys.push([1, 4, , 5]);
|
|
368
|
-
return [4 /*yield*/, fetch(url)];
|
|
369
|
-
case 2:
|
|
370
|
-
response = _d.sent();
|
|
371
|
-
_b = utilities.SetObjectValue;
|
|
372
|
-
_c = [this.Config, propertyPath];
|
|
373
|
-
return [4 /*yield*/, response.json()];
|
|
374
|
-
case 3:
|
|
375
|
-
_b.apply(void 0, _c.concat([_d.sent()]));
|
|
376
|
-
return [3 /*break*/, 5];
|
|
377
|
-
case 4:
|
|
378
|
-
error_1 = _d.sent();
|
|
379
|
-
if (required) {
|
|
380
|
-
throw new Error("Could not side load config '" + url + "': " + error_1.message);
|
|
381
|
-
}
|
|
382
|
-
else {
|
|
383
|
-
console.warn(url, error_1.message);
|
|
384
|
-
}
|
|
385
|
-
return [3 /*break*/, 5];
|
|
386
|
-
case 5:
|
|
387
|
-
console.debug("app config side load '" + propertyPath + "'", this.Config);
|
|
388
|
-
return [2 /*return*/];
|
|
389
|
-
}
|
|
390
|
-
});
|
|
391
|
-
});
|
|
392
|
-
};
|
|
393
|
-
/**
|
|
394
|
-
* Used to load the app config from a remote resource.
|
|
395
|
-
*
|
|
396
|
-
* Promise.all([ ConfigService.Load() ])
|
|
397
|
-
* .then(() => platformBrowserDynamic().bootstrapModule(AppModule))
|
|
398
|
-
* .catch(err => console.error(err))
|
|
399
|
-
*
|
|
400
|
-
*/
|
|
401
|
-
ConfigService.Load = function (options) {
|
|
402
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
403
|
-
var config, _b, _c, url, response, _d, _e, error_2, e_1_1, localConfig, param;
|
|
404
|
-
var e_1, _f;
|
|
405
|
-
return __generator(this, function (_g) {
|
|
406
|
-
switch (_g.label) {
|
|
407
|
-
case 0:
|
|
408
|
-
config = this.Defaults;
|
|
409
|
-
_g.label = 1;
|
|
410
|
-
case 1:
|
|
411
|
-
_g.trys.push([1, 9, 10, 11]);
|
|
412
|
-
_b = __values(ConfigService.Urls), _c = _b.next();
|
|
413
|
-
_g.label = 2;
|
|
414
|
-
case 2:
|
|
415
|
-
if (!!_c.done) return [3 /*break*/, 8];
|
|
416
|
-
url = _c.value;
|
|
417
|
-
_g.label = 3;
|
|
418
|
-
case 3:
|
|
419
|
-
_g.trys.push([3, 6, , 7]);
|
|
420
|
-
return [4 /*yield*/, fetch(url)];
|
|
421
|
-
case 4:
|
|
422
|
-
response = _g.sent();
|
|
423
|
-
_d = utilities.deepMerge;
|
|
424
|
-
_e = [config];
|
|
425
|
-
return [4 /*yield*/, response.json()];
|
|
426
|
-
case 5:
|
|
427
|
-
config = _d.apply(void 0, _e.concat([_g.sent()]));
|
|
428
|
-
return [3 /*break*/, 7];
|
|
429
|
-
case 6:
|
|
430
|
-
error_2 = _g.sent();
|
|
431
|
-
console.error(url, error_2.message);
|
|
432
|
-
return [3 /*break*/, 7];
|
|
433
|
-
case 7:
|
|
434
|
-
_c = _b.next();
|
|
435
|
-
return [3 /*break*/, 2];
|
|
436
|
-
case 8: return [3 /*break*/, 11];
|
|
437
|
-
case 9:
|
|
438
|
-
e_1_1 = _g.sent();
|
|
439
|
-
e_1 = { error: e_1_1 };
|
|
440
|
-
return [3 /*break*/, 11];
|
|
441
|
-
case 10:
|
|
442
|
-
try {
|
|
443
|
-
if (_c && !_c.done && (_f = _b.return)) _f.call(_b);
|
|
444
|
-
}
|
|
445
|
-
finally { if (e_1) throw e_1.error; }
|
|
446
|
-
return [7 /*endfinally*/];
|
|
447
|
-
case 11:
|
|
448
|
-
config = utilities.deepMerge(config, this.Overwrites);
|
|
449
|
-
if ((options === null || options === void 0 ? void 0 : options.fromLocalStorage) !== false) {
|
|
450
|
-
localConfig = localStorage.getItem(ConfigService.LocalStorageKey);
|
|
451
|
-
if (localConfig) {
|
|
452
|
-
try {
|
|
453
|
-
config = utilities.deepMerge(config, JSON.parse(localConfig));
|
|
454
|
-
}
|
|
455
|
-
catch (e) {
|
|
456
|
-
console.error('local config could not be parsed');
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
if (options === null || options === void 0 ? void 0 : options.fromUrlParam) {
|
|
461
|
-
param = typeof options.fromUrlParam === 'string' ? options.fromUrlParam : 'config';
|
|
462
|
-
config = utilities.deepMerge(config, this.LoadConfigDefaultFromUrlParam(param));
|
|
463
|
-
}
|
|
464
|
-
console.debug('app config', config);
|
|
465
|
-
ConfigService.Config = config;
|
|
466
|
-
return [2 /*return*/];
|
|
467
|
-
}
|
|
468
|
-
});
|
|
469
|
-
});
|
|
470
|
-
};
|
|
471
|
-
ConfigService.LoadConfigDefaultFromUrlParam = function (param) {
|
|
472
|
-
var e_2, _b;
|
|
473
|
-
if (param === void 0) { param = 'config'; }
|
|
474
|
-
var queryString = window.location.search;
|
|
475
|
-
var urlParams = new URLSearchParams(queryString);
|
|
476
|
-
var configFromParams = {};
|
|
477
|
-
try {
|
|
478
|
-
for (var _c = __values(urlParams.getAll('config')), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
479
|
-
var configParam = _d.value;
|
|
480
|
-
try {
|
|
481
|
-
var split = configParam.split(';');
|
|
482
|
-
if (split.length === 2) {
|
|
483
|
-
var keyPath = split[0];
|
|
484
|
-
var value = split[1];
|
|
485
|
-
utilities.SetObjectValue(configFromParams, keyPath, value);
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
catch (e) {
|
|
489
|
-
console.warn("Parsing of url config param failed for '" + configParam + "': " + e.message);
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
494
|
-
finally {
|
|
495
|
-
try {
|
|
496
|
-
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
497
|
-
}
|
|
498
|
-
finally { if (e_2) throw e_2.error; }
|
|
499
|
-
}
|
|
500
|
-
return configFromParams;
|
|
501
|
-
};
|
|
502
|
-
ConfigService.Get = function (path, defaultValue, config) {
|
|
503
|
-
var e_3, _b;
|
|
504
|
-
if (config === void 0) { config = this.Config; }
|
|
505
|
-
if (!config) {
|
|
506
|
-
throw new Error('config not loaded');
|
|
507
|
-
}
|
|
508
|
-
var configValue = config;
|
|
509
|
-
if (typeof path !== 'string') {
|
|
510
|
-
throw new Error('The config property path is not a string');
|
|
511
|
-
}
|
|
512
|
-
try {
|
|
513
|
-
for (var _c = __values(path.split('.')), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
514
|
-
var fragment = _d.value;
|
|
515
|
-
if (configValue.hasOwnProperty(fragment)) {
|
|
516
|
-
configValue = configValue[fragment];
|
|
517
|
-
}
|
|
518
|
-
else {
|
|
519
|
-
if (defaultValue !== undefined) {
|
|
520
|
-
return defaultValue;
|
|
521
|
-
}
|
|
522
|
-
console.warn("Config with path '" + path + "' not found");
|
|
523
|
-
return undefined;
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
528
|
-
finally {
|
|
529
|
-
try {
|
|
530
|
-
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
531
|
-
}
|
|
532
|
-
finally { if (e_3) throw e_3.error; }
|
|
533
|
-
}
|
|
534
|
-
return configValue;
|
|
535
|
-
};
|
|
536
|
-
ConfigService.prototype.setLocalConfig = function (config) {
|
|
537
|
-
localStorage.setItem(ConfigService.LocalStorageKey, JSON.stringify(config));
|
|
538
|
-
};
|
|
539
|
-
ConfigService.prototype.clearLocalConfig = function () {
|
|
540
|
-
localStorage.removeItem(ConfigService.LocalStorageKey);
|
|
541
|
-
};
|
|
542
|
-
ConfigService.prototype.get = function (propertyPath, defaultValue) {
|
|
543
|
-
return ConfigService.Get(propertyPath, defaultValue, this.config);
|
|
544
|
-
};
|
|
545
|
-
ConfigService.prototype.getOrThrow = function (propertyPath, defaultValue) {
|
|
546
|
-
var value = ConfigService.Get(propertyPath, defaultValue, this.config);
|
|
547
|
-
if (value === undefined) {
|
|
548
|
-
throw new Error("Could not find config in path '" + propertyPath + "'");
|
|
549
|
-
}
|
|
550
|
-
return value;
|
|
551
|
-
};
|
|
552
|
-
return ConfigService;
|
|
553
|
-
}());
|
|
554
|
-
ConfigService.Config = null;
|
|
555
|
-
/**
|
|
556
|
-
* Static default values for the config object.
|
|
557
|
-
* Will be overwritten by an dynamic config file specified in
|
|
558
|
-
* the Urls array.
|
|
559
|
-
*/
|
|
560
|
-
ConfigService.Defaults = {};
|
|
561
|
-
/**
|
|
562
|
-
* Any value definition in the Overwrites object will overwrite any
|
|
563
|
-
* value form the Defaults values or dynamic config files
|
|
564
|
-
*/
|
|
565
|
-
ConfigService.Overwrites = {};
|
|
566
|
-
ConfigService.LocalStorageKey = 'rxap/config/local-config';
|
|
567
|
-
ConfigService.Urls = ['config.json'];
|
|
568
|
-
ConfigService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ConfigService, deps: [{ token: RXAP_CONFIG, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
569
|
-
ConfigService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ConfigService, providedIn: 'root' });
|
|
570
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ConfigService, decorators: [{
|
|
571
|
-
type: i0.Injectable,
|
|
572
|
-
args: [{
|
|
573
|
-
providedIn: 'root'
|
|
574
|
-
}]
|
|
575
|
-
}], ctorParameters: function () {
|
|
576
|
-
return [{ type: undefined, decorators: [{
|
|
577
|
-
type: i0.Optional
|
|
578
|
-
}, {
|
|
579
|
-
type: i0.Inject,
|
|
580
|
-
args: [RXAP_CONFIG]
|
|
581
|
-
}] }];
|
|
582
|
-
} });
|
|
583
|
-
|
|
584
|
-
var ConfigLoaderService = /** @class */ (function () {
|
|
585
|
-
function ConfigLoaderService(http) {
|
|
586
|
-
this.http = http;
|
|
587
|
-
this.configs = new Map();
|
|
588
|
-
this.configLoading = new Map();
|
|
589
|
-
}
|
|
590
|
-
ConfigLoaderService.prototype.load$ = function (url) {
|
|
591
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
592
|
-
var loading$;
|
|
593
|
-
var _this = this;
|
|
594
|
-
return __generator(this, function (_a) {
|
|
595
|
-
if (this.configs.has(url)) {
|
|
596
|
-
return [2 /*return*/, this.configs.get(url)];
|
|
597
|
-
}
|
|
598
|
-
if (this.configLoading.has(url)) {
|
|
599
|
-
return [2 /*return*/, this.configLoading.get(url).toPromise()];
|
|
600
|
-
}
|
|
601
|
-
loading$ = this.http.get(url).pipe(operators.finalize(function () { return _this.configLoading.delete(url); }), operators.share());
|
|
602
|
-
this.configLoading.set(url, loading$);
|
|
603
|
-
return [2 /*return*/, loading$.toPromise()];
|
|
604
|
-
});
|
|
605
|
-
});
|
|
606
|
-
};
|
|
607
|
-
return ConfigLoaderService;
|
|
608
|
-
}());
|
|
609
|
-
ConfigLoaderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ConfigLoaderService, deps: [{ token: i1.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
610
|
-
ConfigLoaderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ConfigLoaderService, providedIn: 'root' });
|
|
611
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ConfigLoaderService, decorators: [{
|
|
612
|
-
type: i0.Injectable,
|
|
613
|
-
args: [{ providedIn: 'root' }]
|
|
614
|
-
}], ctorParameters: function () {
|
|
615
|
-
return [{ type: i1__namespace.HttpClient, decorators: [{
|
|
616
|
-
type: i0.Inject,
|
|
617
|
-
args: [i1.HttpClient]
|
|
618
|
-
}] }];
|
|
619
|
-
} });
|
|
620
|
-
|
|
621
|
-
/**
|
|
622
|
-
* Generated bundle index. Do not edit.
|
|
623
|
-
*/
|
|
624
|
-
|
|
625
|
-
exports.ConfigLoaderService = ConfigLoaderService;
|
|
626
|
-
exports.ConfigService = ConfigService;
|
|
627
|
-
exports.RXAP_CONFIG = RXAP_CONFIG;
|
|
628
|
-
|
|
629
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
630
|
-
|
|
631
|
-
})));
|
|
632
|
-
//# sourceMappingURL=rxap-config.umd.js.map
|