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