nesties 1.1.22 → 1.1.24
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/dist/index.cjs +234 -1126
- package/dist/index.cjs.map +4 -4
- package/dist/index.mjs +228 -1136
- package/dist/index.mjs.map +4 -4
- package/dist/src/i18n-module/i18n-factory.d.ts +6 -0
- package/dist/src/i18n-module/i18n-param-resolver.token.d.ts +2 -0
- package/dist/src/i18n-module/i18n.module.d.ts +2 -0
- package/dist/src/i18n-module/i18n.service.d.ts +3 -2
- package/dist/src/i18n-module/locale.context.d.ts +8 -0
- package/dist/src/resolver/index.d.ts +3 -0
- package/dist/src/resolver/lambda.d.ts +10 -0
- package/dist/src/{resolver.d.ts → resolver/resolver.d.ts} +3 -3
- package/dist/src/utility/create-mutate-inject.d.ts +0 -1
- package/dist/src/utility/index.d.ts +1 -0
- package/dist/src/utility/parse-bool.d.ts +1 -0
- package/package.json +1 -1
- package/dist/src/utility/parse-i18n.d.ts +0 -14
- /package/dist/src/{api-inject.d.ts → resolver/api-inject.d.ts} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,28 +1,5 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from2, except, desc) => {
|
|
11
|
-
if (from2 && typeof from2 === "object" || typeof from2 === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from2))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from2[key], enumerable: !(desc = __getOwnPropDesc(from2, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
-
mod
|
|
25
|
-
));
|
|
26
3
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
27
4
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
28
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
@@ -33,1091 +10,6 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
33
10
|
};
|
|
34
11
|
var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
35
12
|
|
|
36
|
-
// node_modules/reflect-metadata/Reflect.js
|
|
37
|
-
var require_Reflect = __commonJS({
|
|
38
|
-
"node_modules/reflect-metadata/Reflect.js"() {
|
|
39
|
-
var Reflect2;
|
|
40
|
-
(function(Reflect3) {
|
|
41
|
-
(function(factory) {
|
|
42
|
-
var root = typeof globalThis === "object" ? globalThis : typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : sloppyModeThis();
|
|
43
|
-
var exporter = makeExporter(Reflect3);
|
|
44
|
-
if (typeof root.Reflect !== "undefined") {
|
|
45
|
-
exporter = makeExporter(root.Reflect, exporter);
|
|
46
|
-
}
|
|
47
|
-
factory(exporter, root);
|
|
48
|
-
if (typeof root.Reflect === "undefined") {
|
|
49
|
-
root.Reflect = Reflect3;
|
|
50
|
-
}
|
|
51
|
-
function makeExporter(target, previous) {
|
|
52
|
-
return function(key, value) {
|
|
53
|
-
Object.defineProperty(target, key, { configurable: true, writable: true, value });
|
|
54
|
-
if (previous)
|
|
55
|
-
previous(key, value);
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
function functionThis() {
|
|
59
|
-
try {
|
|
60
|
-
return Function("return this;")();
|
|
61
|
-
} catch (_) {
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
function indirectEvalThis() {
|
|
65
|
-
try {
|
|
66
|
-
return (void 0, eval)("(function() { return this; })()");
|
|
67
|
-
} catch (_) {
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
function sloppyModeThis() {
|
|
71
|
-
return functionThis() || indirectEvalThis();
|
|
72
|
-
}
|
|
73
|
-
})(function(exporter, root) {
|
|
74
|
-
var hasOwn = Object.prototype.hasOwnProperty;
|
|
75
|
-
var supportsSymbol = typeof Symbol === "function";
|
|
76
|
-
var toPrimitiveSymbol = supportsSymbol && typeof Symbol.toPrimitive !== "undefined" ? Symbol.toPrimitive : "@@toPrimitive";
|
|
77
|
-
var iteratorSymbol = supportsSymbol && typeof Symbol.iterator !== "undefined" ? Symbol.iterator : "@@iterator";
|
|
78
|
-
var supportsCreate = typeof Object.create === "function";
|
|
79
|
-
var supportsProto = { __proto__: [] } instanceof Array;
|
|
80
|
-
var downLevel = !supportsCreate && !supportsProto;
|
|
81
|
-
var HashMap = {
|
|
82
|
-
// create an object in dictionary mode (a.k.a. "slow" mode in v8)
|
|
83
|
-
create: supportsCreate ? function() {
|
|
84
|
-
return MakeDictionary(/* @__PURE__ */ Object.create(null));
|
|
85
|
-
} : supportsProto ? function() {
|
|
86
|
-
return MakeDictionary({ __proto__: null });
|
|
87
|
-
} : function() {
|
|
88
|
-
return MakeDictionary({});
|
|
89
|
-
},
|
|
90
|
-
has: downLevel ? function(map, key) {
|
|
91
|
-
return hasOwn.call(map, key);
|
|
92
|
-
} : function(map, key) {
|
|
93
|
-
return key in map;
|
|
94
|
-
},
|
|
95
|
-
get: downLevel ? function(map, key) {
|
|
96
|
-
return hasOwn.call(map, key) ? map[key] : void 0;
|
|
97
|
-
} : function(map, key) {
|
|
98
|
-
return map[key];
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
var functionPrototype = Object.getPrototypeOf(Function);
|
|
102
|
-
var _Map = typeof Map === "function" && typeof Map.prototype.entries === "function" ? Map : CreateMapPolyfill();
|
|
103
|
-
var _Set = typeof Set === "function" && typeof Set.prototype.entries === "function" ? Set : CreateSetPolyfill();
|
|
104
|
-
var _WeakMap = typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill();
|
|
105
|
-
var registrySymbol = supportsSymbol ? Symbol.for("@reflect-metadata:registry") : void 0;
|
|
106
|
-
var metadataRegistry = GetOrCreateMetadataRegistry();
|
|
107
|
-
var metadataProvider = CreateMetadataProvider(metadataRegistry);
|
|
108
|
-
function decorate(decorators, target, propertyKey, attributes) {
|
|
109
|
-
if (!IsUndefined(propertyKey)) {
|
|
110
|
-
if (!IsArray(decorators))
|
|
111
|
-
throw new TypeError();
|
|
112
|
-
if (!IsObject(target))
|
|
113
|
-
throw new TypeError();
|
|
114
|
-
if (!IsObject(attributes) && !IsUndefined(attributes) && !IsNull(attributes))
|
|
115
|
-
throw new TypeError();
|
|
116
|
-
if (IsNull(attributes))
|
|
117
|
-
attributes = void 0;
|
|
118
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
119
|
-
return DecorateProperty(decorators, target, propertyKey, attributes);
|
|
120
|
-
} else {
|
|
121
|
-
if (!IsArray(decorators))
|
|
122
|
-
throw new TypeError();
|
|
123
|
-
if (!IsConstructor(target))
|
|
124
|
-
throw new TypeError();
|
|
125
|
-
return DecorateConstructor(decorators, target);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
exporter("decorate", decorate);
|
|
129
|
-
function metadata(metadataKey, metadataValue) {
|
|
130
|
-
function decorator(target, propertyKey) {
|
|
131
|
-
if (!IsObject(target))
|
|
132
|
-
throw new TypeError();
|
|
133
|
-
if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey))
|
|
134
|
-
throw new TypeError();
|
|
135
|
-
OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
|
|
136
|
-
}
|
|
137
|
-
return decorator;
|
|
138
|
-
}
|
|
139
|
-
exporter("metadata", metadata);
|
|
140
|
-
function defineMetadata(metadataKey, metadataValue, target, propertyKey) {
|
|
141
|
-
if (!IsObject(target))
|
|
142
|
-
throw new TypeError();
|
|
143
|
-
if (!IsUndefined(propertyKey))
|
|
144
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
145
|
-
return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
|
|
146
|
-
}
|
|
147
|
-
exporter("defineMetadata", defineMetadata);
|
|
148
|
-
function hasMetadata(metadataKey, target, propertyKey) {
|
|
149
|
-
if (!IsObject(target))
|
|
150
|
-
throw new TypeError();
|
|
151
|
-
if (!IsUndefined(propertyKey))
|
|
152
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
153
|
-
return OrdinaryHasMetadata(metadataKey, target, propertyKey);
|
|
154
|
-
}
|
|
155
|
-
exporter("hasMetadata", hasMetadata);
|
|
156
|
-
function hasOwnMetadata(metadataKey, target, propertyKey) {
|
|
157
|
-
if (!IsObject(target))
|
|
158
|
-
throw new TypeError();
|
|
159
|
-
if (!IsUndefined(propertyKey))
|
|
160
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
161
|
-
return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey);
|
|
162
|
-
}
|
|
163
|
-
exporter("hasOwnMetadata", hasOwnMetadata);
|
|
164
|
-
function getMetadata(metadataKey, target, propertyKey) {
|
|
165
|
-
if (!IsObject(target))
|
|
166
|
-
throw new TypeError();
|
|
167
|
-
if (!IsUndefined(propertyKey))
|
|
168
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
169
|
-
return OrdinaryGetMetadata(metadataKey, target, propertyKey);
|
|
170
|
-
}
|
|
171
|
-
exporter("getMetadata", getMetadata);
|
|
172
|
-
function getOwnMetadata(metadataKey, target, propertyKey) {
|
|
173
|
-
if (!IsObject(target))
|
|
174
|
-
throw new TypeError();
|
|
175
|
-
if (!IsUndefined(propertyKey))
|
|
176
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
177
|
-
return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey);
|
|
178
|
-
}
|
|
179
|
-
exporter("getOwnMetadata", getOwnMetadata);
|
|
180
|
-
function getMetadataKeys(target, propertyKey) {
|
|
181
|
-
if (!IsObject(target))
|
|
182
|
-
throw new TypeError();
|
|
183
|
-
if (!IsUndefined(propertyKey))
|
|
184
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
185
|
-
return OrdinaryMetadataKeys(target, propertyKey);
|
|
186
|
-
}
|
|
187
|
-
exporter("getMetadataKeys", getMetadataKeys);
|
|
188
|
-
function getOwnMetadataKeys(target, propertyKey) {
|
|
189
|
-
if (!IsObject(target))
|
|
190
|
-
throw new TypeError();
|
|
191
|
-
if (!IsUndefined(propertyKey))
|
|
192
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
193
|
-
return OrdinaryOwnMetadataKeys(target, propertyKey);
|
|
194
|
-
}
|
|
195
|
-
exporter("getOwnMetadataKeys", getOwnMetadataKeys);
|
|
196
|
-
function deleteMetadata(metadataKey, target, propertyKey) {
|
|
197
|
-
if (!IsObject(target))
|
|
198
|
-
throw new TypeError();
|
|
199
|
-
if (!IsUndefined(propertyKey))
|
|
200
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
201
|
-
if (!IsObject(target))
|
|
202
|
-
throw new TypeError();
|
|
203
|
-
if (!IsUndefined(propertyKey))
|
|
204
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
205
|
-
var provider = GetMetadataProvider(
|
|
206
|
-
target,
|
|
207
|
-
propertyKey,
|
|
208
|
-
/*Create*/
|
|
209
|
-
false
|
|
210
|
-
);
|
|
211
|
-
if (IsUndefined(provider))
|
|
212
|
-
return false;
|
|
213
|
-
return provider.OrdinaryDeleteMetadata(metadataKey, target, propertyKey);
|
|
214
|
-
}
|
|
215
|
-
exporter("deleteMetadata", deleteMetadata);
|
|
216
|
-
function DecorateConstructor(decorators, target) {
|
|
217
|
-
for (var i = decorators.length - 1; i >= 0; --i) {
|
|
218
|
-
var decorator = decorators[i];
|
|
219
|
-
var decorated = decorator(target);
|
|
220
|
-
if (!IsUndefined(decorated) && !IsNull(decorated)) {
|
|
221
|
-
if (!IsConstructor(decorated))
|
|
222
|
-
throw new TypeError();
|
|
223
|
-
target = decorated;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
return target;
|
|
227
|
-
}
|
|
228
|
-
function DecorateProperty(decorators, target, propertyKey, descriptor) {
|
|
229
|
-
for (var i = decorators.length - 1; i >= 0; --i) {
|
|
230
|
-
var decorator = decorators[i];
|
|
231
|
-
var decorated = decorator(target, propertyKey, descriptor);
|
|
232
|
-
if (!IsUndefined(decorated) && !IsNull(decorated)) {
|
|
233
|
-
if (!IsObject(decorated))
|
|
234
|
-
throw new TypeError();
|
|
235
|
-
descriptor = decorated;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
return descriptor;
|
|
239
|
-
}
|
|
240
|
-
function OrdinaryHasMetadata(MetadataKey, O, P) {
|
|
241
|
-
var hasOwn2 = OrdinaryHasOwnMetadata(MetadataKey, O, P);
|
|
242
|
-
if (hasOwn2)
|
|
243
|
-
return true;
|
|
244
|
-
var parent = OrdinaryGetPrototypeOf(O);
|
|
245
|
-
if (!IsNull(parent))
|
|
246
|
-
return OrdinaryHasMetadata(MetadataKey, parent, P);
|
|
247
|
-
return false;
|
|
248
|
-
}
|
|
249
|
-
function OrdinaryHasOwnMetadata(MetadataKey, O, P) {
|
|
250
|
-
var provider = GetMetadataProvider(
|
|
251
|
-
O,
|
|
252
|
-
P,
|
|
253
|
-
/*Create*/
|
|
254
|
-
false
|
|
255
|
-
);
|
|
256
|
-
if (IsUndefined(provider))
|
|
257
|
-
return false;
|
|
258
|
-
return ToBoolean(provider.OrdinaryHasOwnMetadata(MetadataKey, O, P));
|
|
259
|
-
}
|
|
260
|
-
function OrdinaryGetMetadata(MetadataKey, O, P) {
|
|
261
|
-
var hasOwn2 = OrdinaryHasOwnMetadata(MetadataKey, O, P);
|
|
262
|
-
if (hasOwn2)
|
|
263
|
-
return OrdinaryGetOwnMetadata(MetadataKey, O, P);
|
|
264
|
-
var parent = OrdinaryGetPrototypeOf(O);
|
|
265
|
-
if (!IsNull(parent))
|
|
266
|
-
return OrdinaryGetMetadata(MetadataKey, parent, P);
|
|
267
|
-
return void 0;
|
|
268
|
-
}
|
|
269
|
-
function OrdinaryGetOwnMetadata(MetadataKey, O, P) {
|
|
270
|
-
var provider = GetMetadataProvider(
|
|
271
|
-
O,
|
|
272
|
-
P,
|
|
273
|
-
/*Create*/
|
|
274
|
-
false
|
|
275
|
-
);
|
|
276
|
-
if (IsUndefined(provider))
|
|
277
|
-
return;
|
|
278
|
-
return provider.OrdinaryGetOwnMetadata(MetadataKey, O, P);
|
|
279
|
-
}
|
|
280
|
-
function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
|
|
281
|
-
var provider = GetMetadataProvider(
|
|
282
|
-
O,
|
|
283
|
-
P,
|
|
284
|
-
/*Create*/
|
|
285
|
-
true
|
|
286
|
-
);
|
|
287
|
-
provider.OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P);
|
|
288
|
-
}
|
|
289
|
-
function OrdinaryMetadataKeys(O, P) {
|
|
290
|
-
var ownKeys = OrdinaryOwnMetadataKeys(O, P);
|
|
291
|
-
var parent = OrdinaryGetPrototypeOf(O);
|
|
292
|
-
if (parent === null)
|
|
293
|
-
return ownKeys;
|
|
294
|
-
var parentKeys = OrdinaryMetadataKeys(parent, P);
|
|
295
|
-
if (parentKeys.length <= 0)
|
|
296
|
-
return ownKeys;
|
|
297
|
-
if (ownKeys.length <= 0)
|
|
298
|
-
return parentKeys;
|
|
299
|
-
var set = new _Set();
|
|
300
|
-
var keys = [];
|
|
301
|
-
for (var _i = 0, ownKeys_1 = ownKeys; _i < ownKeys_1.length; _i++) {
|
|
302
|
-
var key = ownKeys_1[_i];
|
|
303
|
-
var hasKey = set.has(key);
|
|
304
|
-
if (!hasKey) {
|
|
305
|
-
set.add(key);
|
|
306
|
-
keys.push(key);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) {
|
|
310
|
-
var key = parentKeys_1[_a];
|
|
311
|
-
var hasKey = set.has(key);
|
|
312
|
-
if (!hasKey) {
|
|
313
|
-
set.add(key);
|
|
314
|
-
keys.push(key);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
return keys;
|
|
318
|
-
}
|
|
319
|
-
function OrdinaryOwnMetadataKeys(O, P) {
|
|
320
|
-
var provider = GetMetadataProvider(
|
|
321
|
-
O,
|
|
322
|
-
P,
|
|
323
|
-
/*create*/
|
|
324
|
-
false
|
|
325
|
-
);
|
|
326
|
-
if (!provider) {
|
|
327
|
-
return [];
|
|
328
|
-
}
|
|
329
|
-
return provider.OrdinaryOwnMetadataKeys(O, P);
|
|
330
|
-
}
|
|
331
|
-
function Type3(x) {
|
|
332
|
-
if (x === null)
|
|
333
|
-
return 1;
|
|
334
|
-
switch (typeof x) {
|
|
335
|
-
case "undefined":
|
|
336
|
-
return 0;
|
|
337
|
-
case "boolean":
|
|
338
|
-
return 2;
|
|
339
|
-
case "string":
|
|
340
|
-
return 3;
|
|
341
|
-
case "symbol":
|
|
342
|
-
return 4;
|
|
343
|
-
case "number":
|
|
344
|
-
return 5;
|
|
345
|
-
case "object":
|
|
346
|
-
return x === null ? 1 : 6;
|
|
347
|
-
default:
|
|
348
|
-
return 6;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
function IsUndefined(x) {
|
|
352
|
-
return x === void 0;
|
|
353
|
-
}
|
|
354
|
-
function IsNull(x) {
|
|
355
|
-
return x === null;
|
|
356
|
-
}
|
|
357
|
-
function IsSymbol(x) {
|
|
358
|
-
return typeof x === "symbol";
|
|
359
|
-
}
|
|
360
|
-
function IsObject(x) {
|
|
361
|
-
return typeof x === "object" ? x !== null : typeof x === "function";
|
|
362
|
-
}
|
|
363
|
-
function ToPrimitive(input, PreferredType) {
|
|
364
|
-
switch (Type3(input)) {
|
|
365
|
-
case 0:
|
|
366
|
-
return input;
|
|
367
|
-
case 1:
|
|
368
|
-
return input;
|
|
369
|
-
case 2:
|
|
370
|
-
return input;
|
|
371
|
-
case 3:
|
|
372
|
-
return input;
|
|
373
|
-
case 4:
|
|
374
|
-
return input;
|
|
375
|
-
case 5:
|
|
376
|
-
return input;
|
|
377
|
-
}
|
|
378
|
-
var hint = PreferredType === 3 ? "string" : PreferredType === 5 ? "number" : "default";
|
|
379
|
-
var exoticToPrim = GetMethod(input, toPrimitiveSymbol);
|
|
380
|
-
if (exoticToPrim !== void 0) {
|
|
381
|
-
var result = exoticToPrim.call(input, hint);
|
|
382
|
-
if (IsObject(result))
|
|
383
|
-
throw new TypeError();
|
|
384
|
-
return result;
|
|
385
|
-
}
|
|
386
|
-
return OrdinaryToPrimitive(input, hint === "default" ? "number" : hint);
|
|
387
|
-
}
|
|
388
|
-
function OrdinaryToPrimitive(O, hint) {
|
|
389
|
-
if (hint === "string") {
|
|
390
|
-
var toString_1 = O.toString;
|
|
391
|
-
if (IsCallable(toString_1)) {
|
|
392
|
-
var result = toString_1.call(O);
|
|
393
|
-
if (!IsObject(result))
|
|
394
|
-
return result;
|
|
395
|
-
}
|
|
396
|
-
var valueOf = O.valueOf;
|
|
397
|
-
if (IsCallable(valueOf)) {
|
|
398
|
-
var result = valueOf.call(O);
|
|
399
|
-
if (!IsObject(result))
|
|
400
|
-
return result;
|
|
401
|
-
}
|
|
402
|
-
} else {
|
|
403
|
-
var valueOf = O.valueOf;
|
|
404
|
-
if (IsCallable(valueOf)) {
|
|
405
|
-
var result = valueOf.call(O);
|
|
406
|
-
if (!IsObject(result))
|
|
407
|
-
return result;
|
|
408
|
-
}
|
|
409
|
-
var toString_2 = O.toString;
|
|
410
|
-
if (IsCallable(toString_2)) {
|
|
411
|
-
var result = toString_2.call(O);
|
|
412
|
-
if (!IsObject(result))
|
|
413
|
-
return result;
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
throw new TypeError();
|
|
417
|
-
}
|
|
418
|
-
function ToBoolean(argument) {
|
|
419
|
-
return !!argument;
|
|
420
|
-
}
|
|
421
|
-
function ToString(argument) {
|
|
422
|
-
return "" + argument;
|
|
423
|
-
}
|
|
424
|
-
function ToPropertyKey(argument) {
|
|
425
|
-
var key = ToPrimitive(
|
|
426
|
-
argument,
|
|
427
|
-
3
|
|
428
|
-
/* String */
|
|
429
|
-
);
|
|
430
|
-
if (IsSymbol(key))
|
|
431
|
-
return key;
|
|
432
|
-
return ToString(key);
|
|
433
|
-
}
|
|
434
|
-
function IsArray(argument) {
|
|
435
|
-
return Array.isArray ? Array.isArray(argument) : argument instanceof Object ? argument instanceof Array : Object.prototype.toString.call(argument) === "[object Array]";
|
|
436
|
-
}
|
|
437
|
-
function IsCallable(argument) {
|
|
438
|
-
return typeof argument === "function";
|
|
439
|
-
}
|
|
440
|
-
function IsConstructor(argument) {
|
|
441
|
-
return typeof argument === "function";
|
|
442
|
-
}
|
|
443
|
-
function IsPropertyKey(argument) {
|
|
444
|
-
switch (Type3(argument)) {
|
|
445
|
-
case 3:
|
|
446
|
-
return true;
|
|
447
|
-
case 4:
|
|
448
|
-
return true;
|
|
449
|
-
default:
|
|
450
|
-
return false;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
function SameValueZero(x, y) {
|
|
454
|
-
return x === y || x !== x && y !== y;
|
|
455
|
-
}
|
|
456
|
-
function GetMethod(V, P) {
|
|
457
|
-
var func = V[P];
|
|
458
|
-
if (func === void 0 || func === null)
|
|
459
|
-
return void 0;
|
|
460
|
-
if (!IsCallable(func))
|
|
461
|
-
throw new TypeError();
|
|
462
|
-
return func;
|
|
463
|
-
}
|
|
464
|
-
function GetIterator(obj) {
|
|
465
|
-
var method = GetMethod(obj, iteratorSymbol);
|
|
466
|
-
if (!IsCallable(method))
|
|
467
|
-
throw new TypeError();
|
|
468
|
-
var iterator = method.call(obj);
|
|
469
|
-
if (!IsObject(iterator))
|
|
470
|
-
throw new TypeError();
|
|
471
|
-
return iterator;
|
|
472
|
-
}
|
|
473
|
-
function IteratorValue(iterResult) {
|
|
474
|
-
return iterResult.value;
|
|
475
|
-
}
|
|
476
|
-
function IteratorStep(iterator) {
|
|
477
|
-
var result = iterator.next();
|
|
478
|
-
return result.done ? false : result;
|
|
479
|
-
}
|
|
480
|
-
function IteratorClose(iterator) {
|
|
481
|
-
var f = iterator["return"];
|
|
482
|
-
if (f)
|
|
483
|
-
f.call(iterator);
|
|
484
|
-
}
|
|
485
|
-
function OrdinaryGetPrototypeOf(O) {
|
|
486
|
-
var proto = Object.getPrototypeOf(O);
|
|
487
|
-
if (typeof O !== "function" || O === functionPrototype)
|
|
488
|
-
return proto;
|
|
489
|
-
if (proto !== functionPrototype)
|
|
490
|
-
return proto;
|
|
491
|
-
var prototype = O.prototype;
|
|
492
|
-
var prototypeProto = prototype && Object.getPrototypeOf(prototype);
|
|
493
|
-
if (prototypeProto == null || prototypeProto === Object.prototype)
|
|
494
|
-
return proto;
|
|
495
|
-
var constructor = prototypeProto.constructor;
|
|
496
|
-
if (typeof constructor !== "function")
|
|
497
|
-
return proto;
|
|
498
|
-
if (constructor === O)
|
|
499
|
-
return proto;
|
|
500
|
-
return constructor;
|
|
501
|
-
}
|
|
502
|
-
function CreateMetadataRegistry() {
|
|
503
|
-
var fallback;
|
|
504
|
-
if (!IsUndefined(registrySymbol) && typeof root.Reflect !== "undefined" && !(registrySymbol in root.Reflect) && typeof root.Reflect.defineMetadata === "function") {
|
|
505
|
-
fallback = CreateFallbackProvider(root.Reflect);
|
|
506
|
-
}
|
|
507
|
-
var first;
|
|
508
|
-
var second;
|
|
509
|
-
var rest;
|
|
510
|
-
var targetProviderMap = new _WeakMap();
|
|
511
|
-
var registry = {
|
|
512
|
-
registerProvider,
|
|
513
|
-
getProvider,
|
|
514
|
-
setProvider
|
|
515
|
-
};
|
|
516
|
-
return registry;
|
|
517
|
-
function registerProvider(provider) {
|
|
518
|
-
if (!Object.isExtensible(registry)) {
|
|
519
|
-
throw new Error("Cannot add provider to a frozen registry.");
|
|
520
|
-
}
|
|
521
|
-
switch (true) {
|
|
522
|
-
case fallback === provider:
|
|
523
|
-
break;
|
|
524
|
-
case IsUndefined(first):
|
|
525
|
-
first = provider;
|
|
526
|
-
break;
|
|
527
|
-
case first === provider:
|
|
528
|
-
break;
|
|
529
|
-
case IsUndefined(second):
|
|
530
|
-
second = provider;
|
|
531
|
-
break;
|
|
532
|
-
case second === provider:
|
|
533
|
-
break;
|
|
534
|
-
default:
|
|
535
|
-
if (rest === void 0)
|
|
536
|
-
rest = new _Set();
|
|
537
|
-
rest.add(provider);
|
|
538
|
-
break;
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
function getProviderNoCache(O, P) {
|
|
542
|
-
if (!IsUndefined(first)) {
|
|
543
|
-
if (first.isProviderFor(O, P))
|
|
544
|
-
return first;
|
|
545
|
-
if (!IsUndefined(second)) {
|
|
546
|
-
if (second.isProviderFor(O, P))
|
|
547
|
-
return first;
|
|
548
|
-
if (!IsUndefined(rest)) {
|
|
549
|
-
var iterator = GetIterator(rest);
|
|
550
|
-
while (true) {
|
|
551
|
-
var next = IteratorStep(iterator);
|
|
552
|
-
if (!next) {
|
|
553
|
-
return void 0;
|
|
554
|
-
}
|
|
555
|
-
var provider = IteratorValue(next);
|
|
556
|
-
if (provider.isProviderFor(O, P)) {
|
|
557
|
-
IteratorClose(iterator);
|
|
558
|
-
return provider;
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
if (!IsUndefined(fallback) && fallback.isProviderFor(O, P)) {
|
|
565
|
-
return fallback;
|
|
566
|
-
}
|
|
567
|
-
return void 0;
|
|
568
|
-
}
|
|
569
|
-
function getProvider(O, P) {
|
|
570
|
-
var providerMap = targetProviderMap.get(O);
|
|
571
|
-
var provider;
|
|
572
|
-
if (!IsUndefined(providerMap)) {
|
|
573
|
-
provider = providerMap.get(P);
|
|
574
|
-
}
|
|
575
|
-
if (!IsUndefined(provider)) {
|
|
576
|
-
return provider;
|
|
577
|
-
}
|
|
578
|
-
provider = getProviderNoCache(O, P);
|
|
579
|
-
if (!IsUndefined(provider)) {
|
|
580
|
-
if (IsUndefined(providerMap)) {
|
|
581
|
-
providerMap = new _Map();
|
|
582
|
-
targetProviderMap.set(O, providerMap);
|
|
583
|
-
}
|
|
584
|
-
providerMap.set(P, provider);
|
|
585
|
-
}
|
|
586
|
-
return provider;
|
|
587
|
-
}
|
|
588
|
-
function hasProvider(provider) {
|
|
589
|
-
if (IsUndefined(provider))
|
|
590
|
-
throw new TypeError();
|
|
591
|
-
return first === provider || second === provider || !IsUndefined(rest) && rest.has(provider);
|
|
592
|
-
}
|
|
593
|
-
function setProvider(O, P, provider) {
|
|
594
|
-
if (!hasProvider(provider)) {
|
|
595
|
-
throw new Error("Metadata provider not registered.");
|
|
596
|
-
}
|
|
597
|
-
var existingProvider = getProvider(O, P);
|
|
598
|
-
if (existingProvider !== provider) {
|
|
599
|
-
if (!IsUndefined(existingProvider)) {
|
|
600
|
-
return false;
|
|
601
|
-
}
|
|
602
|
-
var providerMap = targetProviderMap.get(O);
|
|
603
|
-
if (IsUndefined(providerMap)) {
|
|
604
|
-
providerMap = new _Map();
|
|
605
|
-
targetProviderMap.set(O, providerMap);
|
|
606
|
-
}
|
|
607
|
-
providerMap.set(P, provider);
|
|
608
|
-
}
|
|
609
|
-
return true;
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
function GetOrCreateMetadataRegistry() {
|
|
613
|
-
var metadataRegistry2;
|
|
614
|
-
if (!IsUndefined(registrySymbol) && IsObject(root.Reflect) && Object.isExtensible(root.Reflect)) {
|
|
615
|
-
metadataRegistry2 = root.Reflect[registrySymbol];
|
|
616
|
-
}
|
|
617
|
-
if (IsUndefined(metadataRegistry2)) {
|
|
618
|
-
metadataRegistry2 = CreateMetadataRegistry();
|
|
619
|
-
}
|
|
620
|
-
if (!IsUndefined(registrySymbol) && IsObject(root.Reflect) && Object.isExtensible(root.Reflect)) {
|
|
621
|
-
Object.defineProperty(root.Reflect, registrySymbol, {
|
|
622
|
-
enumerable: false,
|
|
623
|
-
configurable: false,
|
|
624
|
-
writable: false,
|
|
625
|
-
value: metadataRegistry2
|
|
626
|
-
});
|
|
627
|
-
}
|
|
628
|
-
return metadataRegistry2;
|
|
629
|
-
}
|
|
630
|
-
function CreateMetadataProvider(registry) {
|
|
631
|
-
var metadata2 = new _WeakMap();
|
|
632
|
-
var provider = {
|
|
633
|
-
isProviderFor: function(O, P) {
|
|
634
|
-
var targetMetadata = metadata2.get(O);
|
|
635
|
-
if (IsUndefined(targetMetadata))
|
|
636
|
-
return false;
|
|
637
|
-
return targetMetadata.has(P);
|
|
638
|
-
},
|
|
639
|
-
OrdinaryDefineOwnMetadata: OrdinaryDefineOwnMetadata2,
|
|
640
|
-
OrdinaryHasOwnMetadata: OrdinaryHasOwnMetadata2,
|
|
641
|
-
OrdinaryGetOwnMetadata: OrdinaryGetOwnMetadata2,
|
|
642
|
-
OrdinaryOwnMetadataKeys: OrdinaryOwnMetadataKeys2,
|
|
643
|
-
OrdinaryDeleteMetadata
|
|
644
|
-
};
|
|
645
|
-
metadataRegistry.registerProvider(provider);
|
|
646
|
-
return provider;
|
|
647
|
-
function GetOrCreateMetadataMap(O, P, Create) {
|
|
648
|
-
var targetMetadata = metadata2.get(O);
|
|
649
|
-
var createdTargetMetadata = false;
|
|
650
|
-
if (IsUndefined(targetMetadata)) {
|
|
651
|
-
if (!Create)
|
|
652
|
-
return void 0;
|
|
653
|
-
targetMetadata = new _Map();
|
|
654
|
-
metadata2.set(O, targetMetadata);
|
|
655
|
-
createdTargetMetadata = true;
|
|
656
|
-
}
|
|
657
|
-
var metadataMap = targetMetadata.get(P);
|
|
658
|
-
if (IsUndefined(metadataMap)) {
|
|
659
|
-
if (!Create)
|
|
660
|
-
return void 0;
|
|
661
|
-
metadataMap = new _Map();
|
|
662
|
-
targetMetadata.set(P, metadataMap);
|
|
663
|
-
if (!registry.setProvider(O, P, provider)) {
|
|
664
|
-
targetMetadata.delete(P);
|
|
665
|
-
if (createdTargetMetadata) {
|
|
666
|
-
metadata2.delete(O);
|
|
667
|
-
}
|
|
668
|
-
throw new Error("Wrong provider for target.");
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
return metadataMap;
|
|
672
|
-
}
|
|
673
|
-
function OrdinaryHasOwnMetadata2(MetadataKey, O, P) {
|
|
674
|
-
var metadataMap = GetOrCreateMetadataMap(
|
|
675
|
-
O,
|
|
676
|
-
P,
|
|
677
|
-
/*Create*/
|
|
678
|
-
false
|
|
679
|
-
);
|
|
680
|
-
if (IsUndefined(metadataMap))
|
|
681
|
-
return false;
|
|
682
|
-
return ToBoolean(metadataMap.has(MetadataKey));
|
|
683
|
-
}
|
|
684
|
-
function OrdinaryGetOwnMetadata2(MetadataKey, O, P) {
|
|
685
|
-
var metadataMap = GetOrCreateMetadataMap(
|
|
686
|
-
O,
|
|
687
|
-
P,
|
|
688
|
-
/*Create*/
|
|
689
|
-
false
|
|
690
|
-
);
|
|
691
|
-
if (IsUndefined(metadataMap))
|
|
692
|
-
return void 0;
|
|
693
|
-
return metadataMap.get(MetadataKey);
|
|
694
|
-
}
|
|
695
|
-
function OrdinaryDefineOwnMetadata2(MetadataKey, MetadataValue, O, P) {
|
|
696
|
-
var metadataMap = GetOrCreateMetadataMap(
|
|
697
|
-
O,
|
|
698
|
-
P,
|
|
699
|
-
/*Create*/
|
|
700
|
-
true
|
|
701
|
-
);
|
|
702
|
-
metadataMap.set(MetadataKey, MetadataValue);
|
|
703
|
-
}
|
|
704
|
-
function OrdinaryOwnMetadataKeys2(O, P) {
|
|
705
|
-
var keys = [];
|
|
706
|
-
var metadataMap = GetOrCreateMetadataMap(
|
|
707
|
-
O,
|
|
708
|
-
P,
|
|
709
|
-
/*Create*/
|
|
710
|
-
false
|
|
711
|
-
);
|
|
712
|
-
if (IsUndefined(metadataMap))
|
|
713
|
-
return keys;
|
|
714
|
-
var keysObj = metadataMap.keys();
|
|
715
|
-
var iterator = GetIterator(keysObj);
|
|
716
|
-
var k = 0;
|
|
717
|
-
while (true) {
|
|
718
|
-
var next = IteratorStep(iterator);
|
|
719
|
-
if (!next) {
|
|
720
|
-
keys.length = k;
|
|
721
|
-
return keys;
|
|
722
|
-
}
|
|
723
|
-
var nextValue = IteratorValue(next);
|
|
724
|
-
try {
|
|
725
|
-
keys[k] = nextValue;
|
|
726
|
-
} catch (e) {
|
|
727
|
-
try {
|
|
728
|
-
IteratorClose(iterator);
|
|
729
|
-
} finally {
|
|
730
|
-
throw e;
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
k++;
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
function OrdinaryDeleteMetadata(MetadataKey, O, P) {
|
|
737
|
-
var metadataMap = GetOrCreateMetadataMap(
|
|
738
|
-
O,
|
|
739
|
-
P,
|
|
740
|
-
/*Create*/
|
|
741
|
-
false
|
|
742
|
-
);
|
|
743
|
-
if (IsUndefined(metadataMap))
|
|
744
|
-
return false;
|
|
745
|
-
if (!metadataMap.delete(MetadataKey))
|
|
746
|
-
return false;
|
|
747
|
-
if (metadataMap.size === 0) {
|
|
748
|
-
var targetMetadata = metadata2.get(O);
|
|
749
|
-
if (!IsUndefined(targetMetadata)) {
|
|
750
|
-
targetMetadata.delete(P);
|
|
751
|
-
if (targetMetadata.size === 0) {
|
|
752
|
-
metadata2.delete(targetMetadata);
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
return true;
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
function CreateFallbackProvider(reflect) {
|
|
760
|
-
var defineMetadata2 = reflect.defineMetadata, hasOwnMetadata2 = reflect.hasOwnMetadata, getOwnMetadata2 = reflect.getOwnMetadata, getOwnMetadataKeys2 = reflect.getOwnMetadataKeys, deleteMetadata2 = reflect.deleteMetadata;
|
|
761
|
-
var metadataOwner = new _WeakMap();
|
|
762
|
-
var provider = {
|
|
763
|
-
isProviderFor: function(O, P) {
|
|
764
|
-
var metadataPropertySet = metadataOwner.get(O);
|
|
765
|
-
if (!IsUndefined(metadataPropertySet) && metadataPropertySet.has(P)) {
|
|
766
|
-
return true;
|
|
767
|
-
}
|
|
768
|
-
if (getOwnMetadataKeys2(O, P).length) {
|
|
769
|
-
if (IsUndefined(metadataPropertySet)) {
|
|
770
|
-
metadataPropertySet = new _Set();
|
|
771
|
-
metadataOwner.set(O, metadataPropertySet);
|
|
772
|
-
}
|
|
773
|
-
metadataPropertySet.add(P);
|
|
774
|
-
return true;
|
|
775
|
-
}
|
|
776
|
-
return false;
|
|
777
|
-
},
|
|
778
|
-
OrdinaryDefineOwnMetadata: defineMetadata2,
|
|
779
|
-
OrdinaryHasOwnMetadata: hasOwnMetadata2,
|
|
780
|
-
OrdinaryGetOwnMetadata: getOwnMetadata2,
|
|
781
|
-
OrdinaryOwnMetadataKeys: getOwnMetadataKeys2,
|
|
782
|
-
OrdinaryDeleteMetadata: deleteMetadata2
|
|
783
|
-
};
|
|
784
|
-
return provider;
|
|
785
|
-
}
|
|
786
|
-
function GetMetadataProvider(O, P, Create) {
|
|
787
|
-
var registeredProvider = metadataRegistry.getProvider(O, P);
|
|
788
|
-
if (!IsUndefined(registeredProvider)) {
|
|
789
|
-
return registeredProvider;
|
|
790
|
-
}
|
|
791
|
-
if (Create) {
|
|
792
|
-
if (metadataRegistry.setProvider(O, P, metadataProvider)) {
|
|
793
|
-
return metadataProvider;
|
|
794
|
-
}
|
|
795
|
-
throw new Error("Illegal state.");
|
|
796
|
-
}
|
|
797
|
-
return void 0;
|
|
798
|
-
}
|
|
799
|
-
function CreateMapPolyfill() {
|
|
800
|
-
var cacheSentinel = {};
|
|
801
|
-
var arraySentinel = [];
|
|
802
|
-
var MapIterator = (
|
|
803
|
-
/** @class */
|
|
804
|
-
(function() {
|
|
805
|
-
function MapIterator2(keys, values, selector) {
|
|
806
|
-
this._index = 0;
|
|
807
|
-
this._keys = keys;
|
|
808
|
-
this._values = values;
|
|
809
|
-
this._selector = selector;
|
|
810
|
-
}
|
|
811
|
-
MapIterator2.prototype["@@iterator"] = function() {
|
|
812
|
-
return this;
|
|
813
|
-
};
|
|
814
|
-
MapIterator2.prototype[iteratorSymbol] = function() {
|
|
815
|
-
return this;
|
|
816
|
-
};
|
|
817
|
-
MapIterator2.prototype.next = function() {
|
|
818
|
-
var index = this._index;
|
|
819
|
-
if (index >= 0 && index < this._keys.length) {
|
|
820
|
-
var result = this._selector(this._keys[index], this._values[index]);
|
|
821
|
-
if (index + 1 >= this._keys.length) {
|
|
822
|
-
this._index = -1;
|
|
823
|
-
this._keys = arraySentinel;
|
|
824
|
-
this._values = arraySentinel;
|
|
825
|
-
} else {
|
|
826
|
-
this._index++;
|
|
827
|
-
}
|
|
828
|
-
return { value: result, done: false };
|
|
829
|
-
}
|
|
830
|
-
return { value: void 0, done: true };
|
|
831
|
-
};
|
|
832
|
-
MapIterator2.prototype.throw = function(error) {
|
|
833
|
-
if (this._index >= 0) {
|
|
834
|
-
this._index = -1;
|
|
835
|
-
this._keys = arraySentinel;
|
|
836
|
-
this._values = arraySentinel;
|
|
837
|
-
}
|
|
838
|
-
throw error;
|
|
839
|
-
};
|
|
840
|
-
MapIterator2.prototype.return = function(value) {
|
|
841
|
-
if (this._index >= 0) {
|
|
842
|
-
this._index = -1;
|
|
843
|
-
this._keys = arraySentinel;
|
|
844
|
-
this._values = arraySentinel;
|
|
845
|
-
}
|
|
846
|
-
return { value, done: true };
|
|
847
|
-
};
|
|
848
|
-
return MapIterator2;
|
|
849
|
-
})()
|
|
850
|
-
);
|
|
851
|
-
var Map2 = (
|
|
852
|
-
/** @class */
|
|
853
|
-
(function() {
|
|
854
|
-
function Map3() {
|
|
855
|
-
this._keys = [];
|
|
856
|
-
this._values = [];
|
|
857
|
-
this._cacheKey = cacheSentinel;
|
|
858
|
-
this._cacheIndex = -2;
|
|
859
|
-
}
|
|
860
|
-
Object.defineProperty(Map3.prototype, "size", {
|
|
861
|
-
get: function() {
|
|
862
|
-
return this._keys.length;
|
|
863
|
-
},
|
|
864
|
-
enumerable: true,
|
|
865
|
-
configurable: true
|
|
866
|
-
});
|
|
867
|
-
Map3.prototype.has = function(key) {
|
|
868
|
-
return this._find(
|
|
869
|
-
key,
|
|
870
|
-
/*insert*/
|
|
871
|
-
false
|
|
872
|
-
) >= 0;
|
|
873
|
-
};
|
|
874
|
-
Map3.prototype.get = function(key) {
|
|
875
|
-
var index = this._find(
|
|
876
|
-
key,
|
|
877
|
-
/*insert*/
|
|
878
|
-
false
|
|
879
|
-
);
|
|
880
|
-
return index >= 0 ? this._values[index] : void 0;
|
|
881
|
-
};
|
|
882
|
-
Map3.prototype.set = function(key, value) {
|
|
883
|
-
var index = this._find(
|
|
884
|
-
key,
|
|
885
|
-
/*insert*/
|
|
886
|
-
true
|
|
887
|
-
);
|
|
888
|
-
this._values[index] = value;
|
|
889
|
-
return this;
|
|
890
|
-
};
|
|
891
|
-
Map3.prototype.delete = function(key) {
|
|
892
|
-
var index = this._find(
|
|
893
|
-
key,
|
|
894
|
-
/*insert*/
|
|
895
|
-
false
|
|
896
|
-
);
|
|
897
|
-
if (index >= 0) {
|
|
898
|
-
var size = this._keys.length;
|
|
899
|
-
for (var i = index + 1; i < size; i++) {
|
|
900
|
-
this._keys[i - 1] = this._keys[i];
|
|
901
|
-
this._values[i - 1] = this._values[i];
|
|
902
|
-
}
|
|
903
|
-
this._keys.length--;
|
|
904
|
-
this._values.length--;
|
|
905
|
-
if (SameValueZero(key, this._cacheKey)) {
|
|
906
|
-
this._cacheKey = cacheSentinel;
|
|
907
|
-
this._cacheIndex = -2;
|
|
908
|
-
}
|
|
909
|
-
return true;
|
|
910
|
-
}
|
|
911
|
-
return false;
|
|
912
|
-
};
|
|
913
|
-
Map3.prototype.clear = function() {
|
|
914
|
-
this._keys.length = 0;
|
|
915
|
-
this._values.length = 0;
|
|
916
|
-
this._cacheKey = cacheSentinel;
|
|
917
|
-
this._cacheIndex = -2;
|
|
918
|
-
};
|
|
919
|
-
Map3.prototype.keys = function() {
|
|
920
|
-
return new MapIterator(this._keys, this._values, getKey);
|
|
921
|
-
};
|
|
922
|
-
Map3.prototype.values = function() {
|
|
923
|
-
return new MapIterator(this._keys, this._values, getValue);
|
|
924
|
-
};
|
|
925
|
-
Map3.prototype.entries = function() {
|
|
926
|
-
return new MapIterator(this._keys, this._values, getEntry);
|
|
927
|
-
};
|
|
928
|
-
Map3.prototype["@@iterator"] = function() {
|
|
929
|
-
return this.entries();
|
|
930
|
-
};
|
|
931
|
-
Map3.prototype[iteratorSymbol] = function() {
|
|
932
|
-
return this.entries();
|
|
933
|
-
};
|
|
934
|
-
Map3.prototype._find = function(key, insert) {
|
|
935
|
-
if (!SameValueZero(this._cacheKey, key)) {
|
|
936
|
-
this._cacheIndex = -1;
|
|
937
|
-
for (var i = 0; i < this._keys.length; i++) {
|
|
938
|
-
if (SameValueZero(this._keys[i], key)) {
|
|
939
|
-
this._cacheIndex = i;
|
|
940
|
-
break;
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
if (this._cacheIndex < 0 && insert) {
|
|
945
|
-
this._cacheIndex = this._keys.length;
|
|
946
|
-
this._keys.push(key);
|
|
947
|
-
this._values.push(void 0);
|
|
948
|
-
}
|
|
949
|
-
return this._cacheIndex;
|
|
950
|
-
};
|
|
951
|
-
return Map3;
|
|
952
|
-
})()
|
|
953
|
-
);
|
|
954
|
-
return Map2;
|
|
955
|
-
function getKey(key, _) {
|
|
956
|
-
return key;
|
|
957
|
-
}
|
|
958
|
-
function getValue(_, value) {
|
|
959
|
-
return value;
|
|
960
|
-
}
|
|
961
|
-
function getEntry(key, value) {
|
|
962
|
-
return [key, value];
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
function CreateSetPolyfill() {
|
|
966
|
-
var Set2 = (
|
|
967
|
-
/** @class */
|
|
968
|
-
(function() {
|
|
969
|
-
function Set3() {
|
|
970
|
-
this._map = new _Map();
|
|
971
|
-
}
|
|
972
|
-
Object.defineProperty(Set3.prototype, "size", {
|
|
973
|
-
get: function() {
|
|
974
|
-
return this._map.size;
|
|
975
|
-
},
|
|
976
|
-
enumerable: true,
|
|
977
|
-
configurable: true
|
|
978
|
-
});
|
|
979
|
-
Set3.prototype.has = function(value) {
|
|
980
|
-
return this._map.has(value);
|
|
981
|
-
};
|
|
982
|
-
Set3.prototype.add = function(value) {
|
|
983
|
-
return this._map.set(value, value), this;
|
|
984
|
-
};
|
|
985
|
-
Set3.prototype.delete = function(value) {
|
|
986
|
-
return this._map.delete(value);
|
|
987
|
-
};
|
|
988
|
-
Set3.prototype.clear = function() {
|
|
989
|
-
this._map.clear();
|
|
990
|
-
};
|
|
991
|
-
Set3.prototype.keys = function() {
|
|
992
|
-
return this._map.keys();
|
|
993
|
-
};
|
|
994
|
-
Set3.prototype.values = function() {
|
|
995
|
-
return this._map.keys();
|
|
996
|
-
};
|
|
997
|
-
Set3.prototype.entries = function() {
|
|
998
|
-
return this._map.entries();
|
|
999
|
-
};
|
|
1000
|
-
Set3.prototype["@@iterator"] = function() {
|
|
1001
|
-
return this.keys();
|
|
1002
|
-
};
|
|
1003
|
-
Set3.prototype[iteratorSymbol] = function() {
|
|
1004
|
-
return this.keys();
|
|
1005
|
-
};
|
|
1006
|
-
return Set3;
|
|
1007
|
-
})()
|
|
1008
|
-
);
|
|
1009
|
-
return Set2;
|
|
1010
|
-
}
|
|
1011
|
-
function CreateWeakMapPolyfill() {
|
|
1012
|
-
var UUID_SIZE = 16;
|
|
1013
|
-
var keys = HashMap.create();
|
|
1014
|
-
var rootKey = CreateUniqueKey();
|
|
1015
|
-
return (
|
|
1016
|
-
/** @class */
|
|
1017
|
-
(function() {
|
|
1018
|
-
function WeakMap2() {
|
|
1019
|
-
this._key = CreateUniqueKey();
|
|
1020
|
-
}
|
|
1021
|
-
WeakMap2.prototype.has = function(target) {
|
|
1022
|
-
var table = GetOrCreateWeakMapTable(
|
|
1023
|
-
target,
|
|
1024
|
-
/*create*/
|
|
1025
|
-
false
|
|
1026
|
-
);
|
|
1027
|
-
return table !== void 0 ? HashMap.has(table, this._key) : false;
|
|
1028
|
-
};
|
|
1029
|
-
WeakMap2.prototype.get = function(target) {
|
|
1030
|
-
var table = GetOrCreateWeakMapTable(
|
|
1031
|
-
target,
|
|
1032
|
-
/*create*/
|
|
1033
|
-
false
|
|
1034
|
-
);
|
|
1035
|
-
return table !== void 0 ? HashMap.get(table, this._key) : void 0;
|
|
1036
|
-
};
|
|
1037
|
-
WeakMap2.prototype.set = function(target, value) {
|
|
1038
|
-
var table = GetOrCreateWeakMapTable(
|
|
1039
|
-
target,
|
|
1040
|
-
/*create*/
|
|
1041
|
-
true
|
|
1042
|
-
);
|
|
1043
|
-
table[this._key] = value;
|
|
1044
|
-
return this;
|
|
1045
|
-
};
|
|
1046
|
-
WeakMap2.prototype.delete = function(target) {
|
|
1047
|
-
var table = GetOrCreateWeakMapTable(
|
|
1048
|
-
target,
|
|
1049
|
-
/*create*/
|
|
1050
|
-
false
|
|
1051
|
-
);
|
|
1052
|
-
return table !== void 0 ? delete table[this._key] : false;
|
|
1053
|
-
};
|
|
1054
|
-
WeakMap2.prototype.clear = function() {
|
|
1055
|
-
this._key = CreateUniqueKey();
|
|
1056
|
-
};
|
|
1057
|
-
return WeakMap2;
|
|
1058
|
-
})()
|
|
1059
|
-
);
|
|
1060
|
-
function CreateUniqueKey() {
|
|
1061
|
-
var key;
|
|
1062
|
-
do
|
|
1063
|
-
key = "@@WeakMap@@" + CreateUUID();
|
|
1064
|
-
while (HashMap.has(keys, key));
|
|
1065
|
-
keys[key] = true;
|
|
1066
|
-
return key;
|
|
1067
|
-
}
|
|
1068
|
-
function GetOrCreateWeakMapTable(target, create) {
|
|
1069
|
-
if (!hasOwn.call(target, rootKey)) {
|
|
1070
|
-
if (!create)
|
|
1071
|
-
return void 0;
|
|
1072
|
-
Object.defineProperty(target, rootKey, { value: HashMap.create() });
|
|
1073
|
-
}
|
|
1074
|
-
return target[rootKey];
|
|
1075
|
-
}
|
|
1076
|
-
function FillRandomBytes(buffer, size) {
|
|
1077
|
-
for (var i = 0; i < size; ++i)
|
|
1078
|
-
buffer[i] = Math.random() * 255 | 0;
|
|
1079
|
-
return buffer;
|
|
1080
|
-
}
|
|
1081
|
-
function GenRandomBytes(size) {
|
|
1082
|
-
if (typeof Uint8Array === "function") {
|
|
1083
|
-
var array = new Uint8Array(size);
|
|
1084
|
-
if (typeof crypto !== "undefined") {
|
|
1085
|
-
crypto.getRandomValues(array);
|
|
1086
|
-
} else if (typeof msCrypto !== "undefined") {
|
|
1087
|
-
msCrypto.getRandomValues(array);
|
|
1088
|
-
} else {
|
|
1089
|
-
FillRandomBytes(array, size);
|
|
1090
|
-
}
|
|
1091
|
-
return array;
|
|
1092
|
-
}
|
|
1093
|
-
return FillRandomBytes(new Array(size), size);
|
|
1094
|
-
}
|
|
1095
|
-
function CreateUUID() {
|
|
1096
|
-
var data = GenRandomBytes(UUID_SIZE);
|
|
1097
|
-
data[6] = data[6] & 79 | 64;
|
|
1098
|
-
data[8] = data[8] & 191 | 128;
|
|
1099
|
-
var result = "";
|
|
1100
|
-
for (var offset = 0; offset < UUID_SIZE; ++offset) {
|
|
1101
|
-
var byte = data[offset];
|
|
1102
|
-
if (offset === 4 || offset === 6 || offset === 8)
|
|
1103
|
-
result += "-";
|
|
1104
|
-
if (byte < 16)
|
|
1105
|
-
result += "0";
|
|
1106
|
-
result += byte.toString(16).toLowerCase();
|
|
1107
|
-
}
|
|
1108
|
-
return result;
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
function MakeDictionary(obj) {
|
|
1112
|
-
obj.__ = void 0;
|
|
1113
|
-
delete obj.__;
|
|
1114
|
-
return obj;
|
|
1115
|
-
}
|
|
1116
|
-
});
|
|
1117
|
-
})(Reflect2 || (Reflect2 = {}));
|
|
1118
|
-
}
|
|
1119
|
-
});
|
|
1120
|
-
|
|
1121
13
|
// src/insert-field.ts
|
|
1122
14
|
import { ApiProperty } from "@nestjs/swagger";
|
|
1123
15
|
|
|
@@ -1149,7 +41,6 @@ var getApiProperty = (cls, key) => {
|
|
|
1149
41
|
};
|
|
1150
42
|
|
|
1151
43
|
// src/utility/create-mutate-inject.ts
|
|
1152
|
-
var import_reflect_metadata = __toESM(require_Reflect());
|
|
1153
44
|
import { Inject } from "@nestjs/common";
|
|
1154
45
|
var createMutateInject = (tokenResolver) => (token) => (target, propertyKey, parameterIndex) => {
|
|
1155
46
|
const cls = typeof target === "function" ? target : target.constructor;
|
|
@@ -1176,6 +67,18 @@ var createMutateInject = (tokenResolver) => (token) => (target, propertyKey, par
|
|
|
1176
67
|
);
|
|
1177
68
|
};
|
|
1178
69
|
|
|
70
|
+
// src/utility/parse-bool.ts
|
|
71
|
+
var parseBool = (value) => {
|
|
72
|
+
const trueValues = ["true", "1", "yes", "on", true, 1];
|
|
73
|
+
const falseValues = ["false", "0", "no", "off", false, 0];
|
|
74
|
+
if (trueValues.indexOf(value) !== -1) return true;
|
|
75
|
+
if (falseValues.indexOf(value) !== -1) return false;
|
|
76
|
+
if (!!value) {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
return void 0;
|
|
80
|
+
};
|
|
81
|
+
|
|
1179
82
|
// src/insert-field.ts
|
|
1180
83
|
function InsertField(cl, map, newName) {
|
|
1181
84
|
const extendedCl = class extends cl {
|
|
@@ -1368,7 +271,7 @@ import {
|
|
|
1368
271
|
import { ConfigService } from "@nestjs/config";
|
|
1369
272
|
import { ApiHeader as ApiHeader2 } from "@nestjs/swagger";
|
|
1370
273
|
|
|
1371
|
-
// src/resolver.ts
|
|
274
|
+
// src/resolver/resolver.ts
|
|
1372
275
|
import {
|
|
1373
276
|
createParamDecorator,
|
|
1374
277
|
Inject as Inject2,
|
|
@@ -1412,7 +315,7 @@ var uniqBy = (arr, fn) => {
|
|
|
1412
315
|
return result;
|
|
1413
316
|
};
|
|
1414
317
|
|
|
1415
|
-
// src/resolver.ts
|
|
318
|
+
// src/resolver/resolver.ts
|
|
1416
319
|
var ParamResolverCopiedFieldsFromSwagger = [
|
|
1417
320
|
"required",
|
|
1418
321
|
"description",
|
|
@@ -1675,6 +578,145 @@ var ApiFromResolver = (_options, extras = {}) => {
|
|
|
1675
578
|
return getParamResolver(_options).toApiPropertyDecorator(extras)();
|
|
1676
579
|
};
|
|
1677
580
|
|
|
581
|
+
// src/resolver/lambda.ts
|
|
582
|
+
var createLambdaParamResolver = (cb) => (resolver) => new TransformParamResolver(resolver, cb);
|
|
583
|
+
var ParseIntParamResolver = createLambdaParamResolver((s) => {
|
|
584
|
+
if (s == null) {
|
|
585
|
+
return s;
|
|
586
|
+
}
|
|
587
|
+
const res = parseInt(s, 10);
|
|
588
|
+
if (isNaN(res)) {
|
|
589
|
+
throw new BlankReturnMessageDto(
|
|
590
|
+
400,
|
|
591
|
+
"Invalid integer parameter"
|
|
592
|
+
).toException();
|
|
593
|
+
}
|
|
594
|
+
return res;
|
|
595
|
+
});
|
|
596
|
+
var ParseFloatParamResolver = createLambdaParamResolver(
|
|
597
|
+
(s) => {
|
|
598
|
+
if (s == null) {
|
|
599
|
+
return s;
|
|
600
|
+
}
|
|
601
|
+
const res = parseFloat(s);
|
|
602
|
+
if (isNaN(res)) {
|
|
603
|
+
throw new BlankReturnMessageDto(
|
|
604
|
+
400,
|
|
605
|
+
"Invalid float parameter"
|
|
606
|
+
).toException();
|
|
607
|
+
}
|
|
608
|
+
return res;
|
|
609
|
+
}
|
|
610
|
+
);
|
|
611
|
+
var ParseBoolParamResolver = createLambdaParamResolver(parseBool);
|
|
612
|
+
var ParseDateParamResolver = createLambdaParamResolver(
|
|
613
|
+
(s) => {
|
|
614
|
+
if (s == null) {
|
|
615
|
+
return s;
|
|
616
|
+
}
|
|
617
|
+
const res = new Date(s);
|
|
618
|
+
if (isNaN(res.getTime())) {
|
|
619
|
+
throw new BlankReturnMessageDto(
|
|
620
|
+
400,
|
|
621
|
+
"Invalid date parameter"
|
|
622
|
+
).toException();
|
|
623
|
+
}
|
|
624
|
+
return res;
|
|
625
|
+
}
|
|
626
|
+
);
|
|
627
|
+
var ParseBase64ParamResolver = createLambdaParamResolver(
|
|
628
|
+
(s) => {
|
|
629
|
+
if (s == null) {
|
|
630
|
+
return s;
|
|
631
|
+
}
|
|
632
|
+
const normalized = s.replace(/-/g, "+").replace(/_/g, "/");
|
|
633
|
+
const padded = normalized + "=".repeat((4 - normalized.length % 4) % 4);
|
|
634
|
+
if (!/^[A-Za-z0-9+/]*={0,2}$/.test(padded)) {
|
|
635
|
+
throw new BlankReturnMessageDto(
|
|
636
|
+
400,
|
|
637
|
+
"Invalid base64 parameter"
|
|
638
|
+
).toException();
|
|
639
|
+
}
|
|
640
|
+
const buf = Buffer.from(padded, "base64");
|
|
641
|
+
const re = buf.toString("base64").replace(/=+$/g, "");
|
|
642
|
+
const in0 = padded.replace(/=+$/g, "");
|
|
643
|
+
if (re !== in0) {
|
|
644
|
+
throw new BlankReturnMessageDto(
|
|
645
|
+
400,
|
|
646
|
+
"Invalid base64 parameter"
|
|
647
|
+
).toException();
|
|
648
|
+
}
|
|
649
|
+
return buf;
|
|
650
|
+
}
|
|
651
|
+
);
|
|
652
|
+
var DefaultValueParamResolver = (r, defaultValue) => createLambdaParamResolver(
|
|
653
|
+
(value) => value === void 0 || value === null ? defaultValue : value
|
|
654
|
+
)(r);
|
|
655
|
+
|
|
656
|
+
// src/utility/collect-info-from-injection-token.ts
|
|
657
|
+
import {
|
|
658
|
+
PARAMTYPES_METADATA,
|
|
659
|
+
SELF_DECLARED_DEPS_METADATA
|
|
660
|
+
} from "@nestjs/common/constants";
|
|
661
|
+
function asArray(v) {
|
|
662
|
+
if (v == null) return [];
|
|
663
|
+
return Array.isArray(v) ? v : [v];
|
|
664
|
+
}
|
|
665
|
+
function getCtorDepsFromClass(cls) {
|
|
666
|
+
const paramTypes = Reflect.getMetadata(PARAMTYPES_METADATA, cls) ?? [];
|
|
667
|
+
const selfDeclared = Reflect.getMetadata(SELF_DECLARED_DEPS_METADATA, cls) ?? [];
|
|
668
|
+
const overrides = new Map(
|
|
669
|
+
selfDeclared.map((d) => [d.index, d.param])
|
|
670
|
+
);
|
|
671
|
+
return paramTypes.map((t, i) => overrides.get(i) ?? t).filter((t) => t != null && t !== Object);
|
|
672
|
+
}
|
|
673
|
+
var collectInfoFromInjectionToken = (map, token) => {
|
|
674
|
+
const visited = /* @__PURE__ */ new Set();
|
|
675
|
+
const out = /* @__PURE__ */ new Set();
|
|
676
|
+
const dfs = (t) => {
|
|
677
|
+
if (t == null) return;
|
|
678
|
+
if (visited.has(t)) return;
|
|
679
|
+
visited.add(t);
|
|
680
|
+
for (const v of asArray(map.get(t))) {
|
|
681
|
+
out.add(v);
|
|
682
|
+
}
|
|
683
|
+
const deps = InjectionTokenMap.get(t);
|
|
684
|
+
if (deps?.length) {
|
|
685
|
+
for (const d of deps) dfs(d);
|
|
686
|
+
}
|
|
687
|
+
if (typeof t === "function") {
|
|
688
|
+
const ctorDeps = getCtorDepsFromClass(t);
|
|
689
|
+
for (const d of ctorDeps) dfs(d);
|
|
690
|
+
}
|
|
691
|
+
};
|
|
692
|
+
dfs(token);
|
|
693
|
+
return Array.from(out);
|
|
694
|
+
};
|
|
695
|
+
var createCollectorFromInjectionToken = (map) => (token) => collectInfoFromInjectionToken(map, token);
|
|
696
|
+
|
|
697
|
+
// src/utility/swagger-injection-collector.ts
|
|
698
|
+
var swaggerInjectionCollector = createCollectorFromInjectionToken(ResolverSwaggerMap);
|
|
699
|
+
|
|
700
|
+
// src/resolver/api-inject.ts
|
|
701
|
+
var clsUsedMap = /* @__PURE__ */ new WeakMap();
|
|
702
|
+
var ApiInject = createMutateInject((token, cls) => {
|
|
703
|
+
const swaggers = swaggerInjectionCollector(token);
|
|
704
|
+
if (!swaggers.length) return token;
|
|
705
|
+
let usedSet = clsUsedMap.get(cls);
|
|
706
|
+
if (!usedSet) {
|
|
707
|
+
usedSet = /* @__PURE__ */ new Set();
|
|
708
|
+
clsUsedMap.set(cls, usedSet);
|
|
709
|
+
}
|
|
710
|
+
for (const swagger of swaggers) {
|
|
711
|
+
if (usedSet.has(swagger.token)) {
|
|
712
|
+
continue;
|
|
713
|
+
}
|
|
714
|
+
usedSet.add(swagger.token);
|
|
715
|
+
swagger.swagger()(cls);
|
|
716
|
+
}
|
|
717
|
+
return token;
|
|
718
|
+
});
|
|
719
|
+
|
|
1678
720
|
// src/token.guard.ts
|
|
1679
721
|
import { MetadataSetter, Reflector } from "typed-reflector";
|
|
1680
722
|
import { ModuleRef as ModuleRef2 } from "@nestjs/core";
|
|
@@ -1913,14 +955,20 @@ var I18nModuleOptionsToken = MODULE_OPTIONS_TOKEN;
|
|
|
1913
955
|
// src/i18n-module/i18n.service.ts
|
|
1914
956
|
import { ModuleRef as ModuleRef4 } from "@nestjs/core";
|
|
1915
957
|
import { I18n } from "nfkit";
|
|
958
|
+
|
|
959
|
+
// src/i18n-module/i18n-param-resolver.token.ts
|
|
960
|
+
var I18nParamResolverToken = "I18N_PARAM_RESOLVER";
|
|
961
|
+
var I18nParamResolverProviderToken = "I18N_PARAM_RESOLVER_PROVIDER";
|
|
962
|
+
|
|
963
|
+
// src/i18n-module/i18n.service.ts
|
|
1916
964
|
var I18nService = class extends I18n {
|
|
1917
|
-
constructor(i18nServiceOptions, moduleRef) {
|
|
965
|
+
constructor(i18nServiceOptions, moduleRef, resolver) {
|
|
1918
966
|
super(i18nServiceOptions);
|
|
1919
967
|
this.i18nServiceOptions = i18nServiceOptions;
|
|
1920
968
|
this.moduleRef = moduleRef;
|
|
969
|
+
this.resolver = resolver;
|
|
1921
970
|
this._shadowMiddlewareMap = /* @__PURE__ */ new Map();
|
|
1922
971
|
this.logger = new ConsoleLogger("I18nService");
|
|
1923
|
-
this.resolver = createResolver(this.i18nServiceOptions.resolver);
|
|
1924
972
|
}
|
|
1925
973
|
middleware(mw, prior = false) {
|
|
1926
974
|
const wrappedMw = async (locale, text, next, ctx) => {
|
|
@@ -1947,19 +995,20 @@ var I18nService = class extends I18n {
|
|
|
1947
995
|
}
|
|
1948
996
|
async getExactLocaleFromRequest(ctx) {
|
|
1949
997
|
const req = ctx.switchToHttp().getRequest();
|
|
1950
|
-
const locale = await this.resolver(req, this.moduleRef);
|
|
998
|
+
const locale = await this.resolver.resolve(req, this.moduleRef);
|
|
1951
999
|
return this.getExactLocale(locale);
|
|
1952
1000
|
}
|
|
1953
1001
|
async translateRequest(ctx, obj) {
|
|
1954
1002
|
const req = ctx.switchToHttp().getRequest();
|
|
1955
|
-
const locale = await this.resolver(req, this.moduleRef);
|
|
1003
|
+
const locale = await this.resolver.resolve(req, this.moduleRef);
|
|
1956
1004
|
return this.translate(locale, obj, ctx);
|
|
1957
1005
|
}
|
|
1958
1006
|
};
|
|
1959
1007
|
I18nService = __decorateClass([
|
|
1960
1008
|
Injectable3(),
|
|
1961
1009
|
__decorateParam(0, Inject6(I18nModuleOptionsToken)),
|
|
1962
|
-
__decorateParam(1, Inject6(ModuleRef4))
|
|
1010
|
+
__decorateParam(1, Inject6(ModuleRef4)),
|
|
1011
|
+
__decorateParam(2, Inject6(I18nParamResolverToken))
|
|
1963
1012
|
], I18nService);
|
|
1964
1013
|
|
|
1965
1014
|
// src/i18n-module/i18n.module.ts
|
|
@@ -2002,12 +1051,26 @@ var _dec = createParamDecorator3(
|
|
|
2002
1051
|
var PutLocale = (resolver) => _dec(resolver, LocalePipe);
|
|
2003
1052
|
|
|
2004
1053
|
// src/i18n-module/i18n.module.ts
|
|
1054
|
+
var providerFromOptions = createProvider(
|
|
1055
|
+
{
|
|
1056
|
+
provide: I18nParamResolverToken,
|
|
1057
|
+
inject: [I18nModuleOptionsToken]
|
|
1058
|
+
},
|
|
1059
|
+
(options) => getParamResolver(
|
|
1060
|
+
options.resolver || {
|
|
1061
|
+
paramType: "header",
|
|
1062
|
+
paramName: "x-client-language"
|
|
1063
|
+
}
|
|
1064
|
+
)
|
|
1065
|
+
);
|
|
2005
1066
|
var I18nModule = class extends ConfigurableModuleClass {
|
|
1067
|
+
static forRoot(options) {
|
|
1068
|
+
}
|
|
2006
1069
|
};
|
|
2007
1070
|
I18nModule = __decorateClass([
|
|
2008
1071
|
Global(),
|
|
2009
1072
|
Module2({
|
|
2010
|
-
providers: [I18nService, LocalePipe],
|
|
1073
|
+
providers: [I18nService, LocalePipe, providerFromOptions],
|
|
2011
1074
|
exports: [I18nService, LocalePipe]
|
|
2012
1075
|
})
|
|
2013
1076
|
], I18nModule);
|
|
@@ -2067,6 +1130,24 @@ var createI18nDecorator = (options) => {
|
|
|
2067
1130
|
]);
|
|
2068
1131
|
};
|
|
2069
1132
|
|
|
1133
|
+
// src/i18n-module/locale.context.ts
|
|
1134
|
+
import { Inject as Inject9, Injectable as Injectable6, Scope as Scope4 } from "@nestjs/common";
|
|
1135
|
+
var LocaleContext = class {
|
|
1136
|
+
constructor(localeInput, i18nService) {
|
|
1137
|
+
this.localeInput = localeInput;
|
|
1138
|
+
this.i18nService = i18nService;
|
|
1139
|
+
this.locale = this.i18nService.getExactLocale(this.localeInput);
|
|
1140
|
+
}
|
|
1141
|
+
translate(v) {
|
|
1142
|
+
return this.i18nService.translate(this.locale, v);
|
|
1143
|
+
}
|
|
1144
|
+
};
|
|
1145
|
+
LocaleContext = __decorateClass([
|
|
1146
|
+
Injectable6({ scope: Scope4.REQUEST }),
|
|
1147
|
+
__decorateParam(0, Inject9(I18nParamResolverProviderToken)),
|
|
1148
|
+
__decorateParam(1, Inject9(I18nService))
|
|
1149
|
+
], LocaleContext);
|
|
1150
|
+
|
|
2070
1151
|
// src/i18n-module/i18n-factory.ts
|
|
2071
1152
|
var createI18n = (options) => {
|
|
2072
1153
|
if (!options.resolver) {
|
|
@@ -2075,9 +1156,29 @@ var createI18n = (options) => {
|
|
|
2075
1156
|
paramName: "x-client-language"
|
|
2076
1157
|
};
|
|
2077
1158
|
}
|
|
1159
|
+
const resolver = getParamResolver(options.resolver);
|
|
1160
|
+
const paramProvider = resolver.toRequestScopedProvider();
|
|
1161
|
+
const module = I18nModule.register(options);
|
|
1162
|
+
module.providers ??= [];
|
|
1163
|
+
module.exports ??= [];
|
|
1164
|
+
module.providers.push(
|
|
1165
|
+
paramProvider.provider,
|
|
1166
|
+
LocaleContext,
|
|
1167
|
+
// re-exports the resolved param value for LocaleContext injection
|
|
1168
|
+
createProvider(
|
|
1169
|
+
{
|
|
1170
|
+
provide: I18nParamResolverProviderToken,
|
|
1171
|
+
inject: [paramProvider.token]
|
|
1172
|
+
},
|
|
1173
|
+
(s) => s
|
|
1174
|
+
)
|
|
1175
|
+
);
|
|
1176
|
+
module.exports.push(paramProvider.provider, LocaleContext);
|
|
2078
1177
|
return {
|
|
2079
1178
|
UseI18n: createI18nDecorator(options),
|
|
2080
|
-
I18nModule:
|
|
1179
|
+
I18nModule: module,
|
|
1180
|
+
I18nParamResolver: resolver,
|
|
1181
|
+
I18nParamResolverProvider: paramProvider
|
|
2081
1182
|
};
|
|
2082
1183
|
};
|
|
2083
1184
|
|
|
@@ -2092,6 +1193,7 @@ export {
|
|
|
2092
1193
|
ApiError,
|
|
2093
1194
|
ApiErrorTyped,
|
|
2094
1195
|
ApiFromResolver,
|
|
1196
|
+
ApiInject,
|
|
2095
1197
|
ApiTypeResponse,
|
|
2096
1198
|
As,
|
|
2097
1199
|
BlankPaginatedReturnMessageDto,
|
|
@@ -2100,6 +1202,7 @@ export {
|
|
|
2100
1202
|
DataBody,
|
|
2101
1203
|
DataPipe,
|
|
2102
1204
|
DataQuery,
|
|
1205
|
+
DefaultValueParamResolver,
|
|
2103
1206
|
GenericPaginatedReturnMessageDto,
|
|
2104
1207
|
GenericReturnMessageDto,
|
|
2105
1208
|
I18nInterceptor,
|
|
@@ -2119,6 +1222,11 @@ export {
|
|
|
2119
1222
|
ParamResolver,
|
|
2120
1223
|
ParamResolverBase,
|
|
2121
1224
|
ParamResolverPipe,
|
|
1225
|
+
ParseBase64ParamResolver,
|
|
1226
|
+
ParseBoolParamResolver,
|
|
1227
|
+
ParseDateParamResolver,
|
|
1228
|
+
ParseFloatParamResolver,
|
|
1229
|
+
ParseIntParamResolver,
|
|
2122
1230
|
PutLocale,
|
|
2123
1231
|
RenameClass,
|
|
2124
1232
|
RequireToken,
|
|
@@ -2130,6 +1238,7 @@ export {
|
|
|
2130
1238
|
createAbortableProvider,
|
|
2131
1239
|
createI18n,
|
|
2132
1240
|
createI18nDecorator,
|
|
1241
|
+
createLambdaParamResolver,
|
|
2133
1242
|
createMutateInject,
|
|
2134
1243
|
createProvider,
|
|
2135
1244
|
createResolver,
|
|
@@ -2137,24 +1246,7 @@ export {
|
|
|
2137
1246
|
getApiProperty,
|
|
2138
1247
|
getClassFromClassOrArray,
|
|
2139
1248
|
getParamResolver,
|
|
1249
|
+
parseBool,
|
|
2140
1250
|
takeUntilAbort
|
|
2141
1251
|
};
|
|
2142
|
-
/*! Bundled license information:
|
|
2143
|
-
|
|
2144
|
-
reflect-metadata/Reflect.js:
|
|
2145
|
-
(*! *****************************************************************************
|
|
2146
|
-
Copyright (C) Microsoft. All rights reserved.
|
|
2147
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
2148
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
2149
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
2150
|
-
|
|
2151
|
-
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
2152
|
-
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
2153
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
2154
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
2155
|
-
|
|
2156
|
-
See the Apache Version 2.0 License for specific language governing permissions
|
|
2157
|
-
and limitations under the License.
|
|
2158
|
-
***************************************************************************** *)
|
|
2159
|
-
*/
|
|
2160
1252
|
//# sourceMappingURL=index.mjs.map
|