@tsed/json-mapper 7.83.3 → 8.0.0-alpha.10
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/lib/browser/json-mapper.umd.min.js +1 -1
- package/lib/browser/json-mapper.umd.min.js.map +1 -1
- package/lib/esm/components/DateMapper.js.map +1 -1
- package/lib/esm/components/PrimitiveMapper.js.map +1 -1
- package/lib/esm/components/SymbolMapper.js.map +1 -1
- package/lib/esm/decorators/jsonMapper.js.map +1 -1
- package/lib/esm/decorators/onDeserialize.js.map +1 -1
- package/lib/esm/domain/JsonDeserializer.js.map +1 -1
- package/lib/esm/domain/JsonMapperCompiler.js.map +1 -1
- package/lib/esm/domain/JsonMapperTypesContainer.js.map +1 -1
- package/lib/esm/domain/JsonSerializer.js.map +1 -1
- package/lib/esm/domain/Writer.js +1 -2
- package/lib/esm/domain/Writer.js.map +1 -1
- package/lib/esm/utils/deserialize.js.map +1 -1
- package/lib/esm/utils/serialize.js.map +1 -1
- package/lib/types/utils/deserialize.d.ts +3 -3
- package/lib/types/utils/serialize.d.ts +3 -3
- package/package.json +19 -16
- package/lib/cjs/components/DateMapper.js +0 -30
- package/lib/cjs/components/DateMapper.js.map +0 -1
- package/lib/cjs/components/PrimitiveMapper.js +0 -64
- package/lib/cjs/components/PrimitiveMapper.js.map +0 -1
- package/lib/cjs/components/SymbolMapper.js +0 -24
- package/lib/cjs/components/SymbolMapper.js.map +0 -1
- package/lib/cjs/decorators/afterDeserialize.js +0 -39
- package/lib/cjs/decorators/afterDeserialize.js.map +0 -1
- package/lib/cjs/decorators/beforeDeserialize.js +0 -39
- package/lib/cjs/decorators/beforeDeserialize.js.map +0 -1
- package/lib/cjs/decorators/jsonMapper.js +0 -18
- package/lib/cjs/decorators/jsonMapper.js.map +0 -1
- package/lib/cjs/decorators/onDeserialize.js +0 -29
- package/lib/cjs/decorators/onDeserialize.js.map +0 -1
- package/lib/cjs/decorators/onSerialize.js +0 -29
- package/lib/cjs/decorators/onSerialize.js.map +0 -1
- package/lib/cjs/domain/JsonDeserializer.js +0 -295
- package/lib/cjs/domain/JsonDeserializer.js.map +0 -1
- package/lib/cjs/domain/JsonDeserializerOptions.js +0 -3
- package/lib/cjs/domain/JsonDeserializerOptions.js.map +0 -1
- package/lib/cjs/domain/JsonMapperCompiler.js +0 -167
- package/lib/cjs/domain/JsonMapperCompiler.js.map +0 -1
- package/lib/cjs/domain/JsonMapperGlobalOptions.js +0 -3
- package/lib/cjs/domain/JsonMapperGlobalOptions.js.map +0 -1
- package/lib/cjs/domain/JsonMapperSettings.js +0 -9
- package/lib/cjs/domain/JsonMapperSettings.js.map +0 -1
- package/lib/cjs/domain/JsonMapperTypesContainer.js +0 -23
- package/lib/cjs/domain/JsonMapperTypesContainer.js.map +0 -1
- package/lib/cjs/domain/JsonSerializer.js +0 -273
- package/lib/cjs/domain/JsonSerializer.js.map +0 -1
- package/lib/cjs/domain/JsonSerializerOptions.js +0 -3
- package/lib/cjs/domain/JsonSerializerOptions.js.map +0 -1
- package/lib/cjs/domain/Writer.js +0 -137
- package/lib/cjs/domain/Writer.js.map +0 -1
- package/lib/cjs/hooks/alterAfterDeserialize.js +0 -8
- package/lib/cjs/hooks/alterAfterDeserialize.js.map +0 -1
- package/lib/cjs/hooks/alterBeforeDeserialize.js +0 -8
- package/lib/cjs/hooks/alterBeforeDeserialize.js.map +0 -1
- package/lib/cjs/hooks/alterOnDeserialize.js +0 -8
- package/lib/cjs/hooks/alterOnDeserialize.js.map +0 -1
- package/lib/cjs/hooks/alterOnSerialize.js +0 -8
- package/lib/cjs/hooks/alterOnSerialize.js.map +0 -1
- package/lib/cjs/index.js +0 -32
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/interfaces/JsonMapperMethods.js +0 -3
- package/lib/cjs/interfaces/JsonMapperMethods.js.map +0 -1
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/utils/deserialize.js +0 -13
- package/lib/cjs/utils/deserialize.js.map +0 -1
- package/lib/cjs/utils/getObjectProperties.js +0 -9
- package/lib/cjs/utils/getObjectProperties.js.map +0 -1
- package/lib/cjs/utils/serialize.js +0 -13
- package/lib/cjs/utils/serialize.js.map +0 -1
- package/lib/esm/package.json +0 -3
- package/lib/types-esm/components/DateMapper.d.ts +0 -11
- package/lib/types-esm/components/PrimitiveMapper.d.ts +0 -18
- package/lib/types-esm/components/SymbolMapper.d.ts +0 -11
- package/lib/types-esm/decorators/afterDeserialize.d.ts +0 -33
- package/lib/types-esm/decorators/beforeDeserialize.d.ts +0 -33
- package/lib/types-esm/decorators/jsonMapper.d.ts +0 -7
- package/lib/types-esm/decorators/onDeserialize.d.ts +0 -23
- package/lib/types-esm/decorators/onSerialize.d.ts +0 -23
- package/lib/types-esm/domain/JsonDeserializer.d.ts +0 -33
- package/lib/types-esm/domain/JsonDeserializerOptions.d.ts +0 -28
- package/lib/types-esm/domain/JsonMapperCompiler.d.ts +0 -60
- package/lib/types-esm/domain/JsonMapperGlobalOptions.d.ts +0 -14
- package/lib/types-esm/domain/JsonMapperSettings.d.ts +0 -2
- package/lib/types-esm/domain/JsonMapperTypesContainer.d.ts +0 -10
- package/lib/types-esm/domain/JsonSerializer.d.ts +0 -22
- package/lib/types-esm/domain/JsonSerializerOptions.d.ts +0 -14
- package/lib/types-esm/domain/Writer.d.ts +0 -43
- package/lib/types-esm/hooks/alterAfterDeserialize.d.ts +0 -4
- package/lib/types-esm/hooks/alterBeforeDeserialize.d.ts +0 -4
- package/lib/types-esm/hooks/alterOnDeserialize.d.ts +0 -2
- package/lib/types-esm/hooks/alterOnSerialize.d.ts +0 -2
- package/lib/types-esm/index.d.ts +0 -28
- package/lib/types-esm/interfaces/JsonMapperMethods.d.ts +0 -28
- package/lib/types-esm/utils/deserialize.d.ts +0 -5
- package/lib/types-esm/utils/getObjectProperties.d.ts +0 -1
- package/lib/types-esm/utils/serialize.d.ts +0 -5
- /package/{webpack.config.js → webpack.config.cjs} +0 -0
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JsonDeserializer = void 0;
|
|
4
|
-
const core_1 = require("@tsed/core");
|
|
5
|
-
const schema_1 = require("@tsed/schema");
|
|
6
|
-
const alterAfterDeserialize_js_1 = require("../hooks/alterAfterDeserialize.js");
|
|
7
|
-
const alterBeforeDeserialize_js_1 = require("../hooks/alterBeforeDeserialize.js");
|
|
8
|
-
const alterOnDeserialize_js_1 = require("../hooks/alterOnDeserialize.js");
|
|
9
|
-
const JsonMapperCompiler_js_1 = require("./JsonMapperCompiler.js");
|
|
10
|
-
const JsonMapperSettings_js_1 = require("./JsonMapperSettings.js");
|
|
11
|
-
const JsonMapperTypesContainer_js_1 = require("./JsonMapperTypesContainer.js");
|
|
12
|
-
const Writer_js_1 = require("./Writer.js");
|
|
13
|
-
function isDeserializable(obj, options) {
|
|
14
|
-
if ((!!options.collectionType && (0, core_1.isNil)(obj)) || obj === undefined) {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
return !((0, core_1.isEmpty)(options.type) || (options.type === Object && !options.collectionType));
|
|
18
|
-
}
|
|
19
|
-
function varKey(k) {
|
|
20
|
-
return `__${k}`;
|
|
21
|
-
}
|
|
22
|
-
function mapParamStoreOptions(store, options) {
|
|
23
|
-
return {
|
|
24
|
-
...options,
|
|
25
|
-
store: undefined,
|
|
26
|
-
type: store.getBestType(),
|
|
27
|
-
collectionType: store.collectionType,
|
|
28
|
-
groups: store.parameter.groups,
|
|
29
|
-
// genericTypes: store.nestedGenerics[0],
|
|
30
|
-
generics: store.nestedGenerics
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function getGenericIndex(propertyStore) {
|
|
34
|
-
return propertyStore.parent.schema.genericLabels.indexOf(propertyStore.itemSchema.genericType);
|
|
35
|
-
}
|
|
36
|
-
class JsonDeserializer extends JsonMapperCompiler_js_1.JsonMapperCompiler {
|
|
37
|
-
constructor() {
|
|
38
|
-
super();
|
|
39
|
-
/**
|
|
40
|
-
* Cached classes by his id
|
|
41
|
-
* @protected
|
|
42
|
-
*/
|
|
43
|
-
this.constructors = {};
|
|
44
|
-
this.addGlobal("newInstanceOf", this.newInstanceOf.bind(this));
|
|
45
|
-
this.addGlobal("alterBeforeDeserialize", this.alterBeforeDeserialize.bind(this));
|
|
46
|
-
this.addGlobal("alterAfterDeserialize", this.alterAfterDeserialize.bind(this));
|
|
47
|
-
this.addTypeMapper(Object, this.mapObject.bind(this));
|
|
48
|
-
this.addTypeMapper(Array, this.mapArray.bind(this));
|
|
49
|
-
this.addTypeMapper(Map, this.mapMap.bind(this));
|
|
50
|
-
this.addTypeMapper(Set, this.mapSet.bind(this));
|
|
51
|
-
this.addTypeMapper("ObjectId", (value) => String(value));
|
|
52
|
-
}
|
|
53
|
-
map(input, options = {}) {
|
|
54
|
-
options = this.mapOptions(options);
|
|
55
|
-
if (!isDeserializable(input, options)) {
|
|
56
|
-
return input;
|
|
57
|
-
}
|
|
58
|
-
if (!options.collectionType && (0, core_1.isArray)(input)) {
|
|
59
|
-
options.collectionType = Array;
|
|
60
|
-
}
|
|
61
|
-
const model = options.type || (0, core_1.classOf)(input);
|
|
62
|
-
const mapper = this.compile(model, options.groups);
|
|
63
|
-
if (options.collectionType) {
|
|
64
|
-
const collectionMapper = this.compile(options.collectionType, options.groups);
|
|
65
|
-
return collectionMapper.fn(input, { ...options, id: mapper.id });
|
|
66
|
-
}
|
|
67
|
-
return mapper.fn(input, this.createContext(options));
|
|
68
|
-
}
|
|
69
|
-
compile(model, groups) {
|
|
70
|
-
if ([WeakMap, WeakSet].includes(model)) {
|
|
71
|
-
throw new Error(`${(0, core_1.nameOf)(model)} is not supported by JsonMapper.`);
|
|
72
|
-
}
|
|
73
|
-
return super.compile(model, groups);
|
|
74
|
-
}
|
|
75
|
-
eval(mapper, { id, groupsId, model }) {
|
|
76
|
-
this.constructors[id] = model;
|
|
77
|
-
return super.eval(mapper, { id, groupsId, model });
|
|
78
|
-
}
|
|
79
|
-
newInstanceOf(id, obj, options) {
|
|
80
|
-
try {
|
|
81
|
-
return new this.constructors[id](options.disableUnsecureConstructor ? {} : obj);
|
|
82
|
-
}
|
|
83
|
-
catch (er) {
|
|
84
|
-
return obj;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
createMapper(model, id, groups) {
|
|
88
|
-
const entity = schema_1.JsonEntityStore.from(model);
|
|
89
|
-
const properties = new Set();
|
|
90
|
-
const schemaProperties = [...(0, schema_1.getPropertiesStores)(entity).values()];
|
|
91
|
-
const writer = new Writer_js_1.Writer().arrow("input", "options");
|
|
92
|
-
writer.if("isNil(input)").return("input");
|
|
93
|
-
if (entity.schema.hasDiscriminator) {
|
|
94
|
-
writer.add(this.mapDiscriminator(entity, groups));
|
|
95
|
-
}
|
|
96
|
-
// pre hook
|
|
97
|
-
if (entity.schema.$hooks?.has("beforeDeserialize")) {
|
|
98
|
-
this.schemes[id] = entity.schema;
|
|
99
|
-
writer.set("input", `alterBeforeDeserialize('${id}', input, options)`);
|
|
100
|
-
}
|
|
101
|
-
// generics and options
|
|
102
|
-
writer.const("generics", "options.generics[0]");
|
|
103
|
-
if (entity.schema.genericLabels?.length) {
|
|
104
|
-
writer.set("options", "{...options, self: input, generics: [...options.generics].slice(1)}");
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
writer.set("options", "{...options, self: input}");
|
|
108
|
-
}
|
|
109
|
-
writer.const("obj", `newInstanceOf('${id}', input, options)`);
|
|
110
|
-
// properties
|
|
111
|
-
writer.add(...schemaProperties.flatMap((propertyStore) => {
|
|
112
|
-
const key = propertyStore.propertyName;
|
|
113
|
-
// TODO V8 add this line: properties.add(key as string);
|
|
114
|
-
properties.add(String(propertyStore.parent.schema.getAliasOf(key) || key));
|
|
115
|
-
if ((propertyStore.schema?.$ignore && (0, core_1.isBoolean)(propertyStore.schema?.$ignore)) ||
|
|
116
|
-
propertyStore.isGetterOnly() ||
|
|
117
|
-
(propertyStore.schema?.$hooks?.has("groups") && this.alterGroups(propertyStore.schema, groups))) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
return this.mapProperty(propertyStore, id, groups);
|
|
121
|
-
}));
|
|
122
|
-
// additional properties
|
|
123
|
-
writer.add(this.mapAdditionalProperties(entity, properties, groups));
|
|
124
|
-
// post hook
|
|
125
|
-
if (entity.schema.$hooks?.has("afterDeserialize")) {
|
|
126
|
-
this.schemes[id] = entity.schema;
|
|
127
|
-
return writer.return(`alterAfterDeserialize('${id}', obj, options)`).root().toString();
|
|
128
|
-
}
|
|
129
|
-
return writer.return("obj").root().toString();
|
|
130
|
-
}
|
|
131
|
-
alterValue(schemaId, value, options) {
|
|
132
|
-
return (0, alterOnDeserialize_js_1.alterOnDeserialize)(this.schemes[schemaId], value, options);
|
|
133
|
-
}
|
|
134
|
-
mapDiscriminator(entity, groups) {
|
|
135
|
-
const writer = new Writer_js_1.Writer();
|
|
136
|
-
const discriminator = entity.schema.discriminator();
|
|
137
|
-
const sw = writer.switch(`input['${discriminator.propertyName}']`);
|
|
138
|
-
discriminator.values.forEach((value, kind) => {
|
|
139
|
-
const nestedMapper = this.compile(value, groups);
|
|
140
|
-
sw.case(`'${kind}'`).returnCallMapper(nestedMapper.id, "input");
|
|
141
|
-
});
|
|
142
|
-
return writer;
|
|
143
|
-
}
|
|
144
|
-
mapProperty(propertyStore, id, groups) {
|
|
145
|
-
const key = String(propertyStore.propertyKey);
|
|
146
|
-
const aliasKey = String(propertyStore.parent.schema.getAliasOf(key) || key);
|
|
147
|
-
const schemaId = this.getSchemaId(id, key);
|
|
148
|
-
const format = propertyStore.itemSchema.get("format");
|
|
149
|
-
const formatOpts = format && `options: {format: '${format}'}`;
|
|
150
|
-
let writer = new Writer_js_1.Writer().add(`// Map ${key} ${id} ${groups || ""}`);
|
|
151
|
-
const pick = key !== aliasKey ? `options.useAlias ? '${aliasKey}' : '${key}'` : `'${key}'`;
|
|
152
|
-
// ignore hook (deprecated)
|
|
153
|
-
if (propertyStore.schema?.$hooks?.has("ignore")) {
|
|
154
|
-
this.schemes[schemaId] = propertyStore.schema;
|
|
155
|
-
writer = writer.if(`!alterIgnore('${schemaId}', {...options, self: input})`);
|
|
156
|
-
}
|
|
157
|
-
// pre hook
|
|
158
|
-
const hasDeserializer = propertyStore.schema?.$hooks?.has("onDeserialize");
|
|
159
|
-
let getter = `input[${pick}]`;
|
|
160
|
-
if (hasDeserializer) {
|
|
161
|
-
this.schemes[schemaId] = propertyStore.schema;
|
|
162
|
-
const opts = Writer_js_1.Writer.options(formatOpts);
|
|
163
|
-
getter = `alterValue('${schemaId}', input[${pick}], ${opts})`;
|
|
164
|
-
}
|
|
165
|
-
const ifWriter = writer.set(`let ${varKey(key)}`, getter).if(`${varKey(key)} !== undefined`);
|
|
166
|
-
const fill = this.getPropertyFiller(propertyStore, id, groups, formatOpts);
|
|
167
|
-
if (hasDeserializer) {
|
|
168
|
-
fill(ifWriter.if(`${varKey(key)} === input.${key}`));
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
fill(ifWriter);
|
|
172
|
-
}
|
|
173
|
-
ifWriter.set(`obj.${key}`, varKey(key));
|
|
174
|
-
if (groups && groups.includes("partial")) {
|
|
175
|
-
ifWriter.else().add(`delete obj.${key}`);
|
|
176
|
-
}
|
|
177
|
-
return writer.root();
|
|
178
|
-
}
|
|
179
|
-
getPropertyFiller(propertyStore, id, groups, formatOpts) {
|
|
180
|
-
const key = String(propertyStore.propertyKey);
|
|
181
|
-
const schemaId = this.getSchemaId(id, key);
|
|
182
|
-
const generics = propertyStore.itemSchema.nestedGenerics;
|
|
183
|
-
const isGeneric = propertyStore.itemSchema.isGeneric && !generics?.length;
|
|
184
|
-
if (isGeneric) {
|
|
185
|
-
const index = getGenericIndex(propertyStore);
|
|
186
|
-
const opts = Writer_js_1.Writer.options(formatOpts, `type: generics[${index}]`);
|
|
187
|
-
return (writer) => writer.set(varKey(key), `compileAndMap(${varKey(key)}, ${opts})`);
|
|
188
|
-
}
|
|
189
|
-
const type = propertyStore.itemSchema.hasDiscriminator ? propertyStore.itemSchema.discriminator().base : propertyStore.getBestType();
|
|
190
|
-
const nestedMapper = this.compile(type, groups);
|
|
191
|
-
if (propertyStore.isCollection) {
|
|
192
|
-
return (writer) => writer.callMapper((0, core_1.nameOf)(propertyStore.collectionType), varKey(key), `id: '${nestedMapper.id}'`, formatOpts);
|
|
193
|
-
}
|
|
194
|
-
if (generics?.length) {
|
|
195
|
-
this.schemes[schemaId] = propertyStore.schema;
|
|
196
|
-
return (writer) => writer.callMapper(nestedMapper.id, varKey(key), formatOpts, `generics: schemes['${schemaId}'].nestedGenerics`);
|
|
197
|
-
}
|
|
198
|
-
return (writer) => writer.callMapper(nestedMapper.id, varKey(key), formatOpts);
|
|
199
|
-
}
|
|
200
|
-
mapOptions({ groups, useAlias = true, types, ...options }) {
|
|
201
|
-
if (options.store instanceof schema_1.JsonParameterStore) {
|
|
202
|
-
return this.mapOptions(mapParamStoreOptions(options.store, options));
|
|
203
|
-
}
|
|
204
|
-
const customMappers = {};
|
|
205
|
-
types = types || (0, JsonMapperTypesContainer_js_1.getJsonMapperTypes)();
|
|
206
|
-
types.forEach((mapper, model) => {
|
|
207
|
-
if (![Array, Set, Map].includes(model)) {
|
|
208
|
-
const typeName = (0, core_1.nameOf)(model);
|
|
209
|
-
if ((0, core_1.nameOf)(model) in mapper) {
|
|
210
|
-
this.addTypeMapper(model, mapper[typeName].bind(mapper));
|
|
211
|
-
}
|
|
212
|
-
else {
|
|
213
|
-
this.addTypeMapper(model, (value, options) => mapper.deserialize(value, {
|
|
214
|
-
...options,
|
|
215
|
-
type: model
|
|
216
|
-
}));
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
const strictGroups = options.strictGroups ?? JsonMapperSettings_js_1.JsonMapperSettings.strictGroups;
|
|
221
|
-
return {
|
|
222
|
-
...options,
|
|
223
|
-
additionalProperties: options.additionalProperties ?? JsonMapperSettings_js_1.JsonMapperSettings.additionalProperties,
|
|
224
|
-
disableUnsecureConstructor: options.disableUnsecureConstructor ?? JsonMapperSettings_js_1.JsonMapperSettings.disableUnsecureConstructor,
|
|
225
|
-
groups: groups === undefined ? (strictGroups ? [] : false) : groups || false,
|
|
226
|
-
useAlias,
|
|
227
|
-
customMappers,
|
|
228
|
-
generics: options.generics || []
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
mapAdditionalProperties(entity, properties, groups) {
|
|
232
|
-
const additionalProperties = entity.schema.get("additionalProperties");
|
|
233
|
-
const exclude = [...properties.values()].map((key) => `'${key}'`).join(", ");
|
|
234
|
-
const writer = new Writer_js_1.Writer();
|
|
235
|
-
writer.add("// add additional properties");
|
|
236
|
-
let each = writer.each("objectKeys(input)", ["key"]);
|
|
237
|
-
if (exclude.length) {
|
|
238
|
-
each = each.if(`![${exclude}].includes(key)`);
|
|
239
|
-
}
|
|
240
|
-
if ((0, core_1.isClass)(additionalProperties)) {
|
|
241
|
-
const nestedMapper = this.compile(additionalProperties.getComputedType(), groups);
|
|
242
|
-
each.set("obj[key]", Writer_js_1.Writer.mapper(nestedMapper.id, "input[key]", "options"));
|
|
243
|
-
return writer;
|
|
244
|
-
}
|
|
245
|
-
if (additionalProperties) {
|
|
246
|
-
each.set("obj[key]", "input[key]");
|
|
247
|
-
return writer;
|
|
248
|
-
}
|
|
249
|
-
// dynamic additional properties options
|
|
250
|
-
each.if(`options.additionalProperties && obj[key] === undefined`).set("obj[key]", "input[key]");
|
|
251
|
-
return writer;
|
|
252
|
-
}
|
|
253
|
-
mapObject(input, options) {
|
|
254
|
-
return input;
|
|
255
|
-
}
|
|
256
|
-
mapSet(input, options) {
|
|
257
|
-
if ((0, core_1.isNil)(input)) {
|
|
258
|
-
return input;
|
|
259
|
-
}
|
|
260
|
-
const obj = new Set();
|
|
261
|
-
(0, core_1.objectKeys)(input).forEach((key) => {
|
|
262
|
-
obj.add(this.mapItem(input[key], options));
|
|
263
|
-
});
|
|
264
|
-
return obj;
|
|
265
|
-
}
|
|
266
|
-
mapArray(input, options) {
|
|
267
|
-
if ((0, core_1.isNil)(input)) {
|
|
268
|
-
return input;
|
|
269
|
-
}
|
|
270
|
-
return [].concat(input).map((item) => {
|
|
271
|
-
return this.mapItem(item, options);
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
mapMap(input, options) {
|
|
275
|
-
if ((0, core_1.isNil)(input)) {
|
|
276
|
-
return input;
|
|
277
|
-
}
|
|
278
|
-
const obj = new Map();
|
|
279
|
-
(0, core_1.objectKeys)(input).forEach((key) => {
|
|
280
|
-
obj.set(key, this.mapItem(input[key], options));
|
|
281
|
-
});
|
|
282
|
-
return obj;
|
|
283
|
-
}
|
|
284
|
-
mapItem(input, { id, ...options }) {
|
|
285
|
-
return this.execMapper(id, input, options);
|
|
286
|
-
}
|
|
287
|
-
alterBeforeDeserialize(schemaId, value, options) {
|
|
288
|
-
return (0, alterBeforeDeserialize_js_1.alterBeforeDeserialize)(value, this.schemes[schemaId], options);
|
|
289
|
-
}
|
|
290
|
-
alterAfterDeserialize(schemaId, value, options) {
|
|
291
|
-
return (0, alterAfterDeserialize_js_1.alterAfterDeserialize)(value, this.schemes[schemaId], options);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
exports.JsonDeserializer = JsonDeserializer;
|
|
295
|
-
//# sourceMappingURL=JsonDeserializer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JsonDeserializer.js","sourceRoot":"","sources":["../../../src/domain/JsonDeserializer.ts"],"names":[],"mappings":";;;AAAA,qCAA0G;AAC1G,yCAAyH;AACzH,gFAAwE;AACxE,kFAA0E;AAC1E,0EAAkE;AAElE,mEAA6E;AAC7E,mEAA2D;AAC3D,+EAAiE;AACjE,2CAAmC;AAEnC,SAAS,gBAAgB,CAAC,GAAQ,EAAE,OAAgC;IAClE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,IAAI,IAAA,YAA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|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JsonDeserializerOptions.js","sourceRoot":"","sources":["../../../src/domain/JsonDeserializerOptions.ts"],"names":[],"mappings":""}
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JsonMapperCompiler = void 0;
|
|
4
|
-
const core_1 = require("@tsed/core");
|
|
5
|
-
class JsonMapperCompiler {
|
|
6
|
-
constructor() {
|
|
7
|
-
/**
|
|
8
|
-
* Cached mappers metadata
|
|
9
|
-
* @protected
|
|
10
|
-
*/
|
|
11
|
-
this.cache = new Map();
|
|
12
|
-
/**
|
|
13
|
-
* Cached executable mappers by his id
|
|
14
|
-
* @protected
|
|
15
|
-
*/
|
|
16
|
-
this.mappers = {};
|
|
17
|
-
/**
|
|
18
|
-
* Cached schemas
|
|
19
|
-
* @protected
|
|
20
|
-
*/
|
|
21
|
-
this.schemes = {};
|
|
22
|
-
/**
|
|
23
|
-
* Cached classes by his id
|
|
24
|
-
* @protected
|
|
25
|
-
*/
|
|
26
|
-
this.constructors = {};
|
|
27
|
-
/**
|
|
28
|
-
* Global variables available in the mapper
|
|
29
|
-
* @protected
|
|
30
|
-
*/
|
|
31
|
-
this.globals = {
|
|
32
|
-
isCollection: core_1.isCollection,
|
|
33
|
-
isClass: core_1.isClass,
|
|
34
|
-
isObject: core_1.isObject,
|
|
35
|
-
classOf: core_1.classOf,
|
|
36
|
-
nameOf: core_1.nameOf,
|
|
37
|
-
hasJsonMethod: core_1.hasJsonMethod,
|
|
38
|
-
isMongooseObject: core_1.isMongooseObject,
|
|
39
|
-
isNil: core_1.isNil,
|
|
40
|
-
isDate: core_1.isDate,
|
|
41
|
-
objectKeys: core_1.objectKeys,
|
|
42
|
-
isMomentObject: core_1.isMomentObject
|
|
43
|
-
};
|
|
44
|
-
this.addGlobal("alterIgnore", this.alterIgnore.bind(this));
|
|
45
|
-
this.addGlobal("alterValue", this.alterValue.bind(this));
|
|
46
|
-
this.addGlobal("execMapper", this.execMapper.bind(this));
|
|
47
|
-
this.addGlobal("compileAndMap", this.map.bind(this));
|
|
48
|
-
}
|
|
49
|
-
addTypeMapper(model, fn) {
|
|
50
|
-
const id = (0, core_1.nameOf)(model);
|
|
51
|
-
this.cache.set(model, new Map().set("typeMapper", {
|
|
52
|
-
id,
|
|
53
|
-
fn
|
|
54
|
-
}));
|
|
55
|
-
this.mappers[id] = fn;
|
|
56
|
-
return this;
|
|
57
|
-
}
|
|
58
|
-
removeTypeMapper(model) {
|
|
59
|
-
const store = this.cache.get(model);
|
|
60
|
-
if (store) {
|
|
61
|
-
const { id } = store.get("typeMapper");
|
|
62
|
-
delete this.mappers[id];
|
|
63
|
-
this.cache.delete(model);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
addGlobal(key, value) {
|
|
67
|
-
this.globals[key] = value;
|
|
68
|
-
return this;
|
|
69
|
-
}
|
|
70
|
-
eval(mapper, { id, groupsId, model }) {
|
|
71
|
-
this.addGlobal("cache", this.cache);
|
|
72
|
-
const { globals, schemes } = this;
|
|
73
|
-
const injectGlobals = Object.keys(globals)
|
|
74
|
-
.map((name) => {
|
|
75
|
-
return `const ${name} = globals.${name};`;
|
|
76
|
-
})
|
|
77
|
-
.join("\n");
|
|
78
|
-
eval(`${injectGlobals};
|
|
79
|
-
|
|
80
|
-
cache.get(model).set(groupsId, { id: '${id}', fn: ${mapper} })`);
|
|
81
|
-
const store = this.cache.get(model).get(groupsId);
|
|
82
|
-
this.mappers[id] = store.fn;
|
|
83
|
-
return store;
|
|
84
|
-
}
|
|
85
|
-
createContext(options) {
|
|
86
|
-
const { cache } = this;
|
|
87
|
-
return {
|
|
88
|
-
...options,
|
|
89
|
-
cache
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
compile(model, groups, opts = {}) {
|
|
93
|
-
const token = (0, core_1.isString)(model) ? model : this.getType(model);
|
|
94
|
-
const groupsId = this.getGroupsId(groups);
|
|
95
|
-
let storeGroups = this.cache.get(token) || this.cache.get((0, core_1.nameOf)(token));
|
|
96
|
-
if (!storeGroups) {
|
|
97
|
-
storeGroups = new Map();
|
|
98
|
-
this.cache.set(token, storeGroups);
|
|
99
|
-
}
|
|
100
|
-
if (storeGroups.has("typeMapper")) {
|
|
101
|
-
return storeGroups.get("typeMapper");
|
|
102
|
-
}
|
|
103
|
-
// generate mapper for the given groups
|
|
104
|
-
if (!storeGroups.has(groupsId)) {
|
|
105
|
-
const id = this.getId(token, groupsId);
|
|
106
|
-
// prevent circular dependencies
|
|
107
|
-
storeGroups.set(groupsId, {
|
|
108
|
-
id
|
|
109
|
-
});
|
|
110
|
-
const mapper = opts.mapper ? opts.mapper(id, groups) : this.createMapper(token, id, groups);
|
|
111
|
-
try {
|
|
112
|
-
return this.eval(mapper, { id, model: token, groupsId });
|
|
113
|
-
}
|
|
114
|
-
catch (err) {
|
|
115
|
-
throw new Error(`Fail to compile mapper for ${(0, core_1.nameOf)(model)}. See the error above: ${err.message}.\n${mapper}`);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return storeGroups.get(groupsId);
|
|
119
|
-
}
|
|
120
|
-
execMapper(id, value, options) {
|
|
121
|
-
if ((0, core_1.isObjectID)(value)) {
|
|
122
|
-
return value.toString();
|
|
123
|
-
}
|
|
124
|
-
return this.mappers[id || (0, core_1.nameOf)((0, core_1.classOf)(value))](value, options);
|
|
125
|
-
}
|
|
126
|
-
getType(model) {
|
|
127
|
-
if (!model) {
|
|
128
|
-
return Object;
|
|
129
|
-
}
|
|
130
|
-
if ((0, core_1.isClass)(model) && !(0, core_1.isCollection)(model)) {
|
|
131
|
-
const type = [Array, Map, Set].find((t) => (0, core_1.ancestorsOf)(model).includes(t));
|
|
132
|
-
if (type) {
|
|
133
|
-
return type;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
return model;
|
|
137
|
-
}
|
|
138
|
-
alterIgnore(id, options) {
|
|
139
|
-
let result = this.schemes[id]?.$hooks?.alter("ignore", false, [options]);
|
|
140
|
-
if (result) {
|
|
141
|
-
return result;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
alterGroups(schema, groups) {
|
|
145
|
-
if (groups !== false) {
|
|
146
|
-
return schema.$hooks.alter("groups", false, [groups]);
|
|
147
|
-
}
|
|
148
|
-
return false;
|
|
149
|
-
}
|
|
150
|
-
getGroupsId(groups) {
|
|
151
|
-
if (groups === false) {
|
|
152
|
-
return "default";
|
|
153
|
-
}
|
|
154
|
-
if (groups.length === 0) {
|
|
155
|
-
return "-";
|
|
156
|
-
}
|
|
157
|
-
return groups.join(",");
|
|
158
|
-
}
|
|
159
|
-
getId(model, groupsId) {
|
|
160
|
-
return `${(0, core_1.isString)(model) ? model : (0, core_1.nameOf)(model)}:${(0, core_1.getRandomId)()}:${groupsId}`;
|
|
161
|
-
}
|
|
162
|
-
getSchemaId(id, propertyKey) {
|
|
163
|
-
return `${id}:${propertyKey}`;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
exports.JsonMapperCompiler = JsonMapperCompiler;
|
|
167
|
-
//# sourceMappingURL=JsonMapperCompiler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JsonMapperCompiler.js","sourceRoot":"","sources":["../../../src/domain/JsonMapperCompiler.ts"],"names":[],"mappings":";;;AAAA,qCAiBoB;AAWpB,MAAsB,kBAAkB;IAwCtC;QAvCA;;;WAGG;QACO,UAAK,GAAG,IAAI,GAAG,EAAuD,CAAC;QACjF;;;WAGG;QACO,YAAO,GAAgD,EAAE,CAAC;QACpE;;;WAGG;QACO,YAAO,GAAwB,EAAE,CAAC;QAE5C;;;WAGG;QACO,iBAAY,GAA8B,EAAE,CAAC;QACvD;;;WAGG;QACO,YAAO,GAAwB;YACvC,YAAY,EAAZ,mBAAY;YACZ,OAAO,EAAP,cAAO;YACP,QAAQ,EAAR,eAAQ;YACR,OAAO,EAAP,cAAO;YACP,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D;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAES,WAAW,CAAC,MAAwB;QAC5C,IAAI,MAAM,KAAK,KAAK,EAAE;YACpB,OAAO,SAAS,CAAC;SAClB;QAED,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YACvB,OAAO,GAAG,CAAC;SACZ;QAED,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IAES,KAAK,CAAC,KAAyB,EAAE,QAAgB;QACzD,OAAO,GAAG,IAAA,eAAQ,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAA,aAAM,EAAC,KAAK,CAAC,IAAI,IAAA,kBAAW,GAAE,IAAI,QAAQ,EAAE,CAAC;IACnF,CAAC;IAES,WAAW,CAAC,EAAU,EAAE,WAAmB;QACnD,OAAO,GAAG,EAAE,IAAI,WAAW,EAAE,CAAC;IAChC,CAAC;CACF;AA1ND,gDA0NC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JsonMapperGlobalOptions.js","sourceRoot":"","sources":["../../../src/domain/JsonMapperGlobalOptions.ts"],"names":[],"mappings":""}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JsonMapperSettings = void 0;
|
|
4
|
-
exports.JsonMapperSettings = {
|
|
5
|
-
disableUnsecureConstructor: true,
|
|
6
|
-
additionalProperties: false,
|
|
7
|
-
strictGroups: false
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=JsonMapperSettings.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JsonMapperSettings.js","sourceRoot":"","sources":["../../../src/domain/JsonMapperSettings.ts"],"names":[],"mappings":";;;AAEa,QAAA,kBAAkB,GAA4B;IACzD,0BAA0B,EAAE,IAAI;IAChC,oBAAoB,EAAE,KAAK;IAC3B,YAAY,EAAE,KAAK;CACpB,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getJsonMapperTypes = exports.registerJsonTypeMapper = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @ignore
|
|
6
|
-
*/
|
|
7
|
-
// tslint:disable-next-line:variable-name
|
|
8
|
-
const JsonMapperTypesContainer = new Map();
|
|
9
|
-
/**
|
|
10
|
-
* @ignore
|
|
11
|
-
*/
|
|
12
|
-
function registerJsonTypeMapper(type, token) {
|
|
13
|
-
JsonMapperTypesContainer.set(type, new token());
|
|
14
|
-
}
|
|
15
|
-
exports.registerJsonTypeMapper = registerJsonTypeMapper;
|
|
16
|
-
/**
|
|
17
|
-
* @ignore
|
|
18
|
-
*/
|
|
19
|
-
function getJsonMapperTypes() {
|
|
20
|
-
return JsonMapperTypesContainer;
|
|
21
|
-
}
|
|
22
|
-
exports.getJsonMapperTypes = getJsonMapperTypes;
|
|
23
|
-
//# sourceMappingURL=JsonMapperTypesContainer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JsonMapperTypesContainer.js","sourceRoot":"","sources":["../../../src/domain/JsonMapperTypesContainer.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,yCAAyC;AACzC,MAAM,wBAAwB,GAAwD,IAAI,GAAG,EAAE,CAAC;AAChG;;GAEG;AACH,SAAgB,sBAAsB,CAAC,IAAiC,EAAE,KAA8B;IACtG,wBAAwB,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,KAAK,EAAE,CAAC,CAAC;AAClD,CAAC;AAFD,wDAEC;AACD;;GAEG;AACH,SAAgB,kBAAkB;IAChC,OAAO,wBAAwB,CAAC;AAClC,CAAC;AAFD,gDAEC"}
|