@pristine-ts/data-mapping-common 2.0.8 → 2.0.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/dist/lib/cjs/builders/auto-data-mapping.builder.js +36 -1
- package/dist/lib/cjs/builders/auto-data-mapping.builder.js.map +1 -1
- package/dist/lib/cjs/builders/data-mapping.builder.js +7 -6
- package/dist/lib/cjs/builders/data-mapping.builder.js.map +1 -1
- package/dist/lib/cjs/data-mapping-common.js +1 -0
- package/dist/lib/cjs/data-mapping-common.js.map +1 -1
- package/dist/lib/cjs/errors/data-normalizer-not-found.error.js +15 -0
- package/dist/lib/cjs/errors/data-normalizer-not-found.error.js.map +1 -0
- package/dist/lib/cjs/errors/errors.js +3 -0
- package/dist/lib/cjs/errors/errors.js.map +1 -1
- package/dist/lib/cjs/errors/undefined-destination-property.error.js +14 -0
- package/dist/lib/cjs/errors/undefined-destination-property.error.js.map +1 -0
- package/dist/lib/cjs/mappers/data.mapper.js +15 -7
- package/dist/lib/cjs/mappers/data.mapper.js.map +1 -1
- package/dist/lib/cjs/nodes/base-data-mapping.node.js +4 -0
- package/dist/lib/cjs/nodes/base-data-mapping.node.js.map +1 -1
- package/dist/lib/cjs/nodes/data-mapping.leaf.js +36 -11
- package/dist/lib/cjs/nodes/data-mapping.leaf.js.map +1 -1
- package/dist/lib/cjs/nodes/data-mapping.node.js +119 -49
- package/dist/lib/cjs/nodes/data-mapping.node.js.map +1 -1
- package/dist/lib/cjs/options/auto-data-mapping-builder.options.js +2 -1
- package/dist/lib/cjs/options/auto-data-mapping-builder.options.js.map +1 -1
- package/dist/lib/cjs/reporters/console-error.reporter.js +23 -0
- package/dist/lib/cjs/reporters/console-error.reporter.js.map +1 -0
- package/dist/lib/cjs/reporters/reporters.js +18 -0
- package/dist/lib/cjs/reporters/reporters.js.map +1 -0
- package/dist/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/lib/cjs/types/data-mapper-error-reporter.type.js +3 -0
- package/dist/lib/cjs/types/data-mapper-error-reporter.type.js.map +1 -0
- package/dist/lib/cjs/types/types.js +1 -0
- package/dist/lib/cjs/types/types.js.map +1 -1
- package/dist/lib/esm/builders/auto-data-mapping.builder.js +36 -1
- package/dist/lib/esm/builders/auto-data-mapping.builder.js.map +1 -1
- package/dist/lib/esm/builders/data-mapping.builder.js +7 -6
- package/dist/lib/esm/builders/data-mapping.builder.js.map +1 -1
- package/dist/lib/esm/data-mapping-common.js +1 -0
- package/dist/lib/esm/data-mapping-common.js.map +1 -1
- package/dist/lib/esm/errors/data-normalizer-not-found.error.js +11 -0
- package/dist/lib/esm/errors/data-normalizer-not-found.error.js.map +1 -0
- package/dist/lib/esm/errors/errors.js +3 -0
- package/dist/lib/esm/errors/errors.js.map +1 -1
- package/dist/lib/esm/errors/undefined-destination-property.error.js +10 -0
- package/dist/lib/esm/errors/undefined-destination-property.error.js.map +1 -0
- package/dist/lib/esm/mappers/data.mapper.js +15 -7
- package/dist/lib/esm/mappers/data.mapper.js.map +1 -1
- package/dist/lib/esm/nodes/base-data-mapping.node.js +4 -0
- package/dist/lib/esm/nodes/base-data-mapping.node.js.map +1 -1
- package/dist/lib/esm/nodes/data-mapping.leaf.js +36 -11
- package/dist/lib/esm/nodes/data-mapping.leaf.js.map +1 -1
- package/dist/lib/esm/nodes/data-mapping.node.js +119 -49
- package/dist/lib/esm/nodes/data-mapping.node.js.map +1 -1
- package/dist/lib/esm/options/auto-data-mapping-builder.options.js +2 -1
- package/dist/lib/esm/options/auto-data-mapping-builder.options.js.map +1 -1
- package/dist/lib/esm/reporters/console-error.reporter.js +19 -0
- package/dist/lib/esm/reporters/console-error.reporter.js.map +1 -0
- package/dist/lib/esm/reporters/reporters.js +2 -0
- package/dist/lib/esm/reporters/reporters.js.map +1 -0
- package/dist/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/lib/esm/types/data-mapper-error-reporter.type.js +2 -0
- package/dist/lib/esm/types/data-mapper-error-reporter.type.js.map +1 -0
- package/dist/lib/esm/types/types.js +1 -0
- package/dist/lib/esm/types/types.js.map +1 -1
- package/dist/types/builders/auto-data-mapping.builder.d.ts +16 -0
- package/dist/types/builders/data-mapping.builder.d.ts +3 -2
- package/dist/types/data-mapping-common.d.ts +1 -0
- package/dist/types/errors/data-normalizer-not-found.error.d.ts +8 -0
- package/dist/types/errors/errors.d.ts +3 -0
- package/dist/types/errors/undefined-destination-property.error.d.ts +8 -0
- package/dist/types/interfaces/data-mapping-interceptor.interface.d.ts +6 -2
- package/dist/types/mappers/data.mapper.d.ts +15 -1
- package/dist/types/nodes/data-mapping.leaf.d.ts +11 -0
- package/dist/types/nodes/data-mapping.node.d.ts +54 -2
- package/dist/types/options/auto-data-mapping-builder.options.d.ts +12 -0
- package/dist/types/reporters/console-error.reporter.d.ts +16 -0
- package/dist/types/reporters/reporters.d.ts +1 -0
- package/dist/types/types/data-mapper-error-reporter.type.d.ts +21 -0
- package/dist/types/types/types.d.ts +1 -0
- package/package.json +3 -3
|
@@ -117,61 +117,125 @@ class DataMappingNode extends base_data_mapping_node_1.BaseDataMappingNode {
|
|
|
117
117
|
if (sourceElement === undefined) {
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
|
+
// Whether source-keyed properties should be carried through to the destination.
|
|
121
|
+
// When `excludeExtraneousValues === true`, only renamed destination keys (written by
|
|
122
|
+
// sub-nodes below) end up on the destination — source keys are dropped.
|
|
123
|
+
const includeSourceKeys = (options === null || options === void 0 ? void 0 : options.excludeExtraneousValues) === false;
|
|
120
124
|
if (this.type === data_mapping_node_type_enum_1.DataMappingNodeTypeEnum.ObjectArray) {
|
|
125
|
+
// Array case: handled below in its own loop. Just pre-allocate the array here.
|
|
121
126
|
destination[this.destinationProperty] = [];
|
|
122
127
|
}
|
|
123
128
|
else {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
else {
|
|
128
|
-
destination[this.destinationProperty] = {};
|
|
129
|
-
}
|
|
130
|
-
if ((options === null || options === void 0 ? void 0 : options.excludeExtraneousValues) === false) {
|
|
131
|
-
if (typeof sourceElement === "object" || Array.isArray(sourceElement)) {
|
|
132
|
-
Object.keys(sourceElement).forEach(property => {
|
|
133
|
-
destination[this.destinationProperty][property] = sourceElement[property];
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
}
|
|
129
|
+
// Single-object case: build the destination value once, then let sub-nodes overlay
|
|
130
|
+
// renamed keys onto it.
|
|
131
|
+
destination[this.destinationProperty] = this.buildDestinationObject(sourceElement, includeSourceKeys);
|
|
137
132
|
}
|
|
138
133
|
const destinationElement = destination[this.destinationProperty];
|
|
139
134
|
if (this.type === data_mapping_node_type_enum_1.DataMappingNodeTypeEnum.ObjectArray) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
throw new array_data_mapping_node_invalid_source_property_type_error_1.ArrayDataMappingNodeInvalidSourcePropertyTypeError(`According to your schema, the property '${this.sourceProperty}' in the source object must contain an Array of objects. Instead, it contains: '${typeof array}'.`, this.sourceProperty);
|
|
135
|
+
const sourceArray = source[this.sourceProperty];
|
|
136
|
+
if (Array.isArray(sourceArray) === false) {
|
|
137
|
+
throw new array_data_mapping_node_invalid_source_property_type_error_1.ArrayDataMappingNodeInvalidSourcePropertyTypeError(`According to your schema, the property '${this.sourceProperty}' in the source object must contain an Array of objects. Instead, it contains: '${typeof sourceArray}'.`, this.sourceProperty);
|
|
144
138
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
else if (this.destinationType.prototype) {
|
|
154
|
-
dest = (0, class_transformer_1.plainToInstance)(this.destinationType, {});
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
if ((options === null || options === void 0 ? void 0 : options.excludeExtraneousValues) === false) {
|
|
158
|
-
Object.keys(element).forEach(property => {
|
|
159
|
-
dest[property] = element[property];
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
for (const key in this.nodes) {
|
|
163
|
-
if (this.nodes.hasOwnProperty(key) === false) {
|
|
164
|
-
continue;
|
|
165
|
-
}
|
|
166
|
-
const node = this.nodes[key];
|
|
167
|
-
yield node.map(element, dest, normalizersMap, options);
|
|
168
|
-
}
|
|
139
|
+
// For each source element: build the destination object (whose concrete class may
|
|
140
|
+
// depend on the element index when `destinationType` is a factory callback), let the
|
|
141
|
+
// sub-nodes overlay their renamed keys, then push.
|
|
142
|
+
for (let index = 0; index < sourceArray.length; index++) {
|
|
143
|
+
const element = sourceArray[index];
|
|
144
|
+
const dest = this.buildArrayMemberDestination(source, element, index, includeSourceKeys);
|
|
145
|
+
yield this.runSubNodes(element, dest, normalizersMap, options);
|
|
169
146
|
destinationElement.push(dest);
|
|
170
147
|
}
|
|
171
|
-
index++;
|
|
172
148
|
return;
|
|
173
149
|
}
|
|
174
|
-
//
|
|
150
|
+
// Single-object case: sub-nodes write into the destination we just built above.
|
|
151
|
+
yield this.runSubNodes(sourceElement, destinationElement, normalizersMap, options);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Build the destination object for the single-object case.
|
|
156
|
+
*
|
|
157
|
+
* If a `destinationType` (class constructor) is set, instantiate the class. Otherwise return
|
|
158
|
+
* a plain object. When `includeSourceKeys` is true, the source's own enumerable properties are
|
|
159
|
+
* seeded onto the result so they survive the mapping; sub-nodes then overlay renamed keys on top.
|
|
160
|
+
*
|
|
161
|
+
* Note: the single-object case treats `destinationType` strictly as a class constructor.
|
|
162
|
+
* Factory callbacks only make sense for the per-element ObjectArray case below.
|
|
163
|
+
*/
|
|
164
|
+
buildDestinationObject(sourceElement, includeSourceKeys) {
|
|
165
|
+
const seedFromSource = includeSourceKeys
|
|
166
|
+
&& sourceElement !== null
|
|
167
|
+
&& (typeof sourceElement === "object" || Array.isArray(sourceElement));
|
|
168
|
+
if (this.destinationType !== undefined) {
|
|
169
|
+
return (0, class_transformer_1.plainToInstance)(this.destinationType, seedFromSource ? sourceElement : {});
|
|
170
|
+
}
|
|
171
|
+
const result = {};
|
|
172
|
+
if (seedFromSource) {
|
|
173
|
+
Object.keys(sourceElement).forEach(property => {
|
|
174
|
+
result[property] = sourceElement[property];
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
return result;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Build the destination object for a single element of an ObjectArray. Mirrors
|
|
181
|
+
* `buildDestinationObject`, with two extra wrinkles unique to arrays:
|
|
182
|
+
*
|
|
183
|
+
* 1. `destinationType` can be a *factory callback* instead of a fixed class. The callback
|
|
184
|
+
* receives the source array's parent + the element's index and returns an instance of
|
|
185
|
+
* the concrete class to use. This is how polymorphic arrays work (e.g. some elements
|
|
186
|
+
* become `Cat`, others `Dog`).
|
|
187
|
+
* 2. The seed value is the per-element object, not the whole array.
|
|
188
|
+
*/
|
|
189
|
+
buildArrayMemberDestination(source, element, index, includeSourceKeys) {
|
|
190
|
+
const seedFromSource = includeSourceKeys && element !== null && typeof element === "object";
|
|
191
|
+
if (this.destinationType === undefined) {
|
|
192
|
+
// Untyped array — produce a plain object, optionally seeded with the element's own keys.
|
|
193
|
+
const result = {};
|
|
194
|
+
if (seedFromSource) {
|
|
195
|
+
Object.keys(element).forEach(property => {
|
|
196
|
+
result[property] = element[property];
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
return result;
|
|
200
|
+
}
|
|
201
|
+
const memberConstructor = this.resolveArrayMemberConstructor(source, index);
|
|
202
|
+
return (0, class_transformer_1.plainToInstance)(memberConstructor, seedFromSource ? element : {});
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Resolve the concrete class constructor for a single element of an ObjectArray.
|
|
206
|
+
*
|
|
207
|
+
* `destinationType` here is one of two things:
|
|
208
|
+
*
|
|
209
|
+
* - a **class constructor** (uniform array — every element maps to the same class), or
|
|
210
|
+
* - a **factory callback** of shape `(source, sourceProperty, index) => instance`
|
|
211
|
+
* (polymorphic array — class is chosen per element).
|
|
212
|
+
*
|
|
213
|
+
* JavaScript gives us no clean way to distinguish a class constructor from a callback —
|
|
214
|
+
* both are `typeof === "function"`. The conventional discriminant: a class constructor has
|
|
215
|
+
* a `.prototype` object (where its instance methods live); an arrow function does not.
|
|
216
|
+
*
|
|
217
|
+
* Caveat: a regular `function() { ... }` expression used as a callback would also have a
|
|
218
|
+
* `.prototype` and would be mis-classified as a class. The public type only documents the
|
|
219
|
+
* arrow-function form (`ArrayMemberTypeFactoryCallbackType = (...) => any`), and in practice
|
|
220
|
+
* callers use arrow functions, so this is safe for documented usage.
|
|
221
|
+
*/
|
|
222
|
+
resolveArrayMemberConstructor(source, index) {
|
|
223
|
+
const destinationType = this.destinationType;
|
|
224
|
+
const isFactoryCallback = typeof destinationType === "function"
|
|
225
|
+
&& destinationType.prototype === undefined;
|
|
226
|
+
if (isFactoryCallback) {
|
|
227
|
+
const factory = destinationType;
|
|
228
|
+
const sampleInstance = factory(source, this.sourceProperty, index);
|
|
229
|
+
return sampleInstance.constructor;
|
|
230
|
+
}
|
|
231
|
+
return destinationType;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Run every direct child node against `(sourceElement, destinationElement)`. Each child
|
|
235
|
+
* writes its mapped destination property onto `destinationElement`.
|
|
236
|
+
*/
|
|
237
|
+
runSubNodes(sourceElement, destinationElement, normalizersMap, options) {
|
|
238
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
175
239
|
for (const key in this.nodes) {
|
|
176
240
|
if (this.nodes.hasOwnProperty(key) === false) {
|
|
177
241
|
continue;
|
|
@@ -215,22 +279,28 @@ class DataMappingNode extends base_data_mapping_node_1.BaseDataMappingNode {
|
|
|
215
279
|
}
|
|
216
280
|
}
|
|
217
281
|
/**
|
|
218
|
-
* This method exports this node.
|
|
282
|
+
* This method exports this node. The exported representation is a plain object — it does not mutate
|
|
283
|
+
* the live tree, so the same builder can continue to be used for mapping after `export()` is called.
|
|
284
|
+
*
|
|
285
|
+
* `destinationType` is intentionally not serialized: class constructors aren't transferable, and
|
|
286
|
+
* factory callbacks (`ArrayMemberTypeFactoryCallbackType`) hold closures. To rehydrate a schema with
|
|
287
|
+
* the same destination instantiation behavior, decorate the destination class with class-transformer's
|
|
288
|
+
* `@Type()` and pass the destination class to `DataMapper.map()`.
|
|
219
289
|
*/
|
|
220
290
|
export() {
|
|
221
|
-
const
|
|
222
|
-
for (const key in nodes) {
|
|
223
|
-
if (nodes.hasOwnProperty(key) === false) {
|
|
291
|
+
const exportedNodes = {};
|
|
292
|
+
for (const key in this.nodes) {
|
|
293
|
+
if (this.nodes.hasOwnProperty(key) === false) {
|
|
224
294
|
continue;
|
|
225
295
|
}
|
|
226
|
-
|
|
296
|
+
exportedNodes[key] = this.nodes[key].export();
|
|
227
297
|
}
|
|
228
298
|
return {
|
|
229
299
|
"_type": this.type,
|
|
230
300
|
"sourceProperty": this.sourceProperty,
|
|
231
301
|
"destinationProperty": this.destinationProperty,
|
|
232
302
|
"isOptional": this.isOptional,
|
|
233
|
-
"nodes":
|
|
303
|
+
"nodes": exportedNodes,
|
|
234
304
|
};
|
|
235
305
|
}
|
|
236
306
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-mapping.node.js","sourceRoot":"","sources":["../../../../src/nodes/data-mapping.node.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sFAA6E;AAC7E,2DAAoD;AAEpD,qEAA6D;AAC7D,yHAA8G;AAG9G,qJAAwI;AACxI,yDAAoE;AAIpE,MAAa,eAAgB,SAAQ,4CAAmB;IAqBtD,YAA4B,IAAwB,EACxB,MAA4C,EAC5C,OAAgC,qDAAuB,CAAC,IAAI;QAEtF,KAAK,EAAE,CAAC;QAJkB,SAAI,GAAJ,IAAI,CAAoB;QACxB,WAAM,GAAN,MAAM,CAAsC;QAC5C,SAAI,GAAJ,IAAI,CAAwD;QAZxF;;WAEG;QACI,eAAU,GAAY,KAAK,CAA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;gBAEX,KAAK,qDAAuB,CAAC,IAAI,CAAC;gBAClC,KAAK,qDAAuB,CAAC,WAAW;oBACtC,MAAM,IAAI,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;oBACxD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;oBACtB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;oBACvC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM;QACX,MAAM,aAAa,GAA2B,EAAE,CAAC;QAEjD,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC7B,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE,CAAC;gBAC7C,SAAS;YACX,CAAC;YAED,aAAa,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;QAChD,CAAC;QAED,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,IAAI;YAClB,gBAAgB,EAAE,IAAI,CAAC,cAAc;YACrC,qBAAqB,EAAE,IAAI,CAAC,mBAAmB;YAC/C,YAAY,EAAE,IAAI,CAAC,UAAU;YAC7B,OAAO,EAAE,aAAa;SACvB,CAAA;IACH,CAAC;CACF;AA7VD,0CA6VC"}
|
|
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AutoDataMappingBuilderOptions = void 0;
|
|
4
4
|
class AutoDataMappingBuilderOptions {
|
|
5
5
|
constructor(options) {
|
|
6
|
-
var _a, _b, _c, _d;
|
|
6
|
+
var _a, _b, _c, _d, _e;
|
|
7
7
|
this.isOptionalDefaultValue = (_a = options === null || options === void 0 ? void 0 : options.isOptionalDefaultValue) !== null && _a !== void 0 ? _a : true;
|
|
8
8
|
this.excludeExtraneousValues = (_b = options === null || options === void 0 ? void 0 : options.excludeExtraneousValues) !== null && _b !== void 0 ? _b : false;
|
|
9
9
|
this.throwOnErrors = (_c = options === null || options === void 0 ? void 0 : options.throwOnErrors) !== null && _c !== void 0 ? _c : false;
|
|
10
10
|
this.logErrors = (_d = options === null || options === void 0 ? void 0 : options.logErrors) !== null && _d !== void 0 ? _d : false;
|
|
11
|
+
this.disableCache = (_e = options === null || options === void 0 ? void 0 : options.disableCache) !== null && _e !== void 0 ? _e : false;
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
exports.AutoDataMappingBuilderOptions = AutoDataMappingBuilderOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-data-mapping-builder.options.js","sourceRoot":"","sources":["../../../../src/options/auto-data-mapping-builder.options.ts"],"names":[],"mappings":";;;AAAA,MAAa,6BAA6B;
|
|
1
|
+
{"version":3,"file":"auto-data-mapping-builder.options.js","sourceRoot":"","sources":["../../../../src/options/auto-data-mapping-builder.options.ts"],"names":[],"mappings":";;;AAAA,MAAa,6BAA6B;IAwCxC,YAAY,OAAgD;;QAC1D,IAAI,CAAC,sBAAsB,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,sBAAsB,mCAAI,IAAI,CAAC;QACtE,IAAI,CAAC,uBAAuB,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,uBAAuB,mCAAI,KAAK,CAAC;QACzE,IAAI,CAAC,aAAa,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,mCAAI,KAAK,CAAC;QACrD,IAAI,CAAC,SAAS,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,mCAAI,KAAK,CAAC;QAC7C,IAAI,CAAC,YAAY,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,mCAAI,KAAK,CAAC;IACrD,CAAC;CACF;AA/CD,sEA+CC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConsoleErrorReporter = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Built-in default reporter. Writes a header line + the error + a structured context payload
|
|
6
|
+
* to `console.error`. Used when no custom reporter is supplied to DataMapper — gives the
|
|
7
|
+
* frontend (and any non-DI caller) useful output out of the box.
|
|
8
|
+
*
|
|
9
|
+
* Exposed as a class-with-static-method so callers can compose it from their own reporters,
|
|
10
|
+
* e.g. `(err, ctx) => { sendToSentry(err); ConsoleErrorReporter.report(err, ctx); }`.
|
|
11
|
+
*/
|
|
12
|
+
class ConsoleErrorReporter {
|
|
13
|
+
}
|
|
14
|
+
exports.ConsoleErrorReporter = ConsoleErrorReporter;
|
|
15
|
+
/**
|
|
16
|
+
* Matches the `DataMapperErrorReporter` shape so a method reference (`ConsoleErrorReporter.report`)
|
|
17
|
+
* can be passed wherever the callback type is expected.
|
|
18
|
+
*/
|
|
19
|
+
ConsoleErrorReporter.report = (error, context) => {
|
|
20
|
+
// eslint-disable-next-line no-console
|
|
21
|
+
console.error("[DataMapper] autoMap caught an error.", error, context);
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=console-error.reporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console-error.reporter.js","sourceRoot":"","sources":["../../../../src/reporters/console-error.reporter.ts"],"names":[],"mappings":";;;AAEA;;;;;;;GAOG;AACH,MAAa,oBAAoB;;AAAjC,oDASC;AARC;;;GAGG;AACoB,2BAAM,GAA4B,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IAC1E,sCAAsC;IACtC,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACzE,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./console-error.reporter"), exports);
|
|
18
|
+
//# sourceMappingURL=reporters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reporters.js","sourceRoot":"","sources":["../../../../src/reporters/reporters.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC"}
|