@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
|
@@ -114,61 +114,125 @@ export class DataMappingNode extends BaseDataMappingNode {
|
|
|
114
114
|
if (sourceElement === undefined) {
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
|
+
// Whether source-keyed properties should be carried through to the destination.
|
|
118
|
+
// When `excludeExtraneousValues === true`, only renamed destination keys (written by
|
|
119
|
+
// sub-nodes below) end up on the destination — source keys are dropped.
|
|
120
|
+
const includeSourceKeys = (options === null || options === void 0 ? void 0 : options.excludeExtraneousValues) === false;
|
|
117
121
|
if (this.type === DataMappingNodeTypeEnum.ObjectArray) {
|
|
122
|
+
// Array case: handled below in its own loop. Just pre-allocate the array here.
|
|
118
123
|
destination[this.destinationProperty] = [];
|
|
119
124
|
}
|
|
120
125
|
else {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
else {
|
|
125
|
-
destination[this.destinationProperty] = {};
|
|
126
|
-
}
|
|
127
|
-
if ((options === null || options === void 0 ? void 0 : options.excludeExtraneousValues) === false) {
|
|
128
|
-
if (typeof sourceElement === "object" || Array.isArray(sourceElement)) {
|
|
129
|
-
Object.keys(sourceElement).forEach(property => {
|
|
130
|
-
destination[this.destinationProperty][property] = sourceElement[property];
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
}
|
|
126
|
+
// Single-object case: build the destination value once, then let sub-nodes overlay
|
|
127
|
+
// renamed keys onto it.
|
|
128
|
+
destination[this.destinationProperty] = this.buildDestinationObject(sourceElement, includeSourceKeys);
|
|
134
129
|
}
|
|
135
130
|
const destinationElement = destination[this.destinationProperty];
|
|
136
131
|
if (this.type === DataMappingNodeTypeEnum.ObjectArray) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
throw new 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);
|
|
132
|
+
const sourceArray = source[this.sourceProperty];
|
|
133
|
+
if (Array.isArray(sourceArray) === false) {
|
|
134
|
+
throw new 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);
|
|
141
135
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
else if (this.destinationType.prototype) {
|
|
151
|
-
dest = plainToInstance(this.destinationType, {});
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
if ((options === null || options === void 0 ? void 0 : options.excludeExtraneousValues) === false) {
|
|
155
|
-
Object.keys(element).forEach(property => {
|
|
156
|
-
dest[property] = element[property];
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
for (const key in this.nodes) {
|
|
160
|
-
if (this.nodes.hasOwnProperty(key) === false) {
|
|
161
|
-
continue;
|
|
162
|
-
}
|
|
163
|
-
const node = this.nodes[key];
|
|
164
|
-
yield node.map(element, dest, normalizersMap, options);
|
|
165
|
-
}
|
|
136
|
+
// For each source element: build the destination object (whose concrete class may
|
|
137
|
+
// depend on the element index when `destinationType` is a factory callback), let the
|
|
138
|
+
// sub-nodes overlay their renamed keys, then push.
|
|
139
|
+
for (let index = 0; index < sourceArray.length; index++) {
|
|
140
|
+
const element = sourceArray[index];
|
|
141
|
+
const dest = this.buildArrayMemberDestination(source, element, index, includeSourceKeys);
|
|
142
|
+
yield this.runSubNodes(element, dest, normalizersMap, options);
|
|
166
143
|
destinationElement.push(dest);
|
|
167
144
|
}
|
|
168
|
-
index++;
|
|
169
145
|
return;
|
|
170
146
|
}
|
|
171
|
-
//
|
|
147
|
+
// Single-object case: sub-nodes write into the destination we just built above.
|
|
148
|
+
yield this.runSubNodes(sourceElement, destinationElement, normalizersMap, options);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Build the destination object for the single-object case.
|
|
153
|
+
*
|
|
154
|
+
* If a `destinationType` (class constructor) is set, instantiate the class. Otherwise return
|
|
155
|
+
* a plain object. When `includeSourceKeys` is true, the source's own enumerable properties are
|
|
156
|
+
* seeded onto the result so they survive the mapping; sub-nodes then overlay renamed keys on top.
|
|
157
|
+
*
|
|
158
|
+
* Note: the single-object case treats `destinationType` strictly as a class constructor.
|
|
159
|
+
* Factory callbacks only make sense for the per-element ObjectArray case below.
|
|
160
|
+
*/
|
|
161
|
+
buildDestinationObject(sourceElement, includeSourceKeys) {
|
|
162
|
+
const seedFromSource = includeSourceKeys
|
|
163
|
+
&& sourceElement !== null
|
|
164
|
+
&& (typeof sourceElement === "object" || Array.isArray(sourceElement));
|
|
165
|
+
if (this.destinationType !== undefined) {
|
|
166
|
+
return plainToInstance(this.destinationType, seedFromSource ? sourceElement : {});
|
|
167
|
+
}
|
|
168
|
+
const result = {};
|
|
169
|
+
if (seedFromSource) {
|
|
170
|
+
Object.keys(sourceElement).forEach(property => {
|
|
171
|
+
result[property] = sourceElement[property];
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
return result;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Build the destination object for a single element of an ObjectArray. Mirrors
|
|
178
|
+
* `buildDestinationObject`, with two extra wrinkles unique to arrays:
|
|
179
|
+
*
|
|
180
|
+
* 1. `destinationType` can be a *factory callback* instead of a fixed class. The callback
|
|
181
|
+
* receives the source array's parent + the element's index and returns an instance of
|
|
182
|
+
* the concrete class to use. This is how polymorphic arrays work (e.g. some elements
|
|
183
|
+
* become `Cat`, others `Dog`).
|
|
184
|
+
* 2. The seed value is the per-element object, not the whole array.
|
|
185
|
+
*/
|
|
186
|
+
buildArrayMemberDestination(source, element, index, includeSourceKeys) {
|
|
187
|
+
const seedFromSource = includeSourceKeys && element !== null && typeof element === "object";
|
|
188
|
+
if (this.destinationType === undefined) {
|
|
189
|
+
// Untyped array — produce a plain object, optionally seeded with the element's own keys.
|
|
190
|
+
const result = {};
|
|
191
|
+
if (seedFromSource) {
|
|
192
|
+
Object.keys(element).forEach(property => {
|
|
193
|
+
result[property] = element[property];
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
const memberConstructor = this.resolveArrayMemberConstructor(source, index);
|
|
199
|
+
return plainToInstance(memberConstructor, seedFromSource ? element : {});
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Resolve the concrete class constructor for a single element of an ObjectArray.
|
|
203
|
+
*
|
|
204
|
+
* `destinationType` here is one of two things:
|
|
205
|
+
*
|
|
206
|
+
* - a **class constructor** (uniform array — every element maps to the same class), or
|
|
207
|
+
* - a **factory callback** of shape `(source, sourceProperty, index) => instance`
|
|
208
|
+
* (polymorphic array — class is chosen per element).
|
|
209
|
+
*
|
|
210
|
+
* JavaScript gives us no clean way to distinguish a class constructor from a callback —
|
|
211
|
+
* both are `typeof === "function"`. The conventional discriminant: a class constructor has
|
|
212
|
+
* a `.prototype` object (where its instance methods live); an arrow function does not.
|
|
213
|
+
*
|
|
214
|
+
* Caveat: a regular `function() { ... }` expression used as a callback would also have a
|
|
215
|
+
* `.prototype` and would be mis-classified as a class. The public type only documents the
|
|
216
|
+
* arrow-function form (`ArrayMemberTypeFactoryCallbackType = (...) => any`), and in practice
|
|
217
|
+
* callers use arrow functions, so this is safe for documented usage.
|
|
218
|
+
*/
|
|
219
|
+
resolveArrayMemberConstructor(source, index) {
|
|
220
|
+
const destinationType = this.destinationType;
|
|
221
|
+
const isFactoryCallback = typeof destinationType === "function"
|
|
222
|
+
&& destinationType.prototype === undefined;
|
|
223
|
+
if (isFactoryCallback) {
|
|
224
|
+
const factory = destinationType;
|
|
225
|
+
const sampleInstance = factory(source, this.sourceProperty, index);
|
|
226
|
+
return sampleInstance.constructor;
|
|
227
|
+
}
|
|
228
|
+
return destinationType;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Run every direct child node against `(sourceElement, destinationElement)`. Each child
|
|
232
|
+
* writes its mapped destination property onto `destinationElement`.
|
|
233
|
+
*/
|
|
234
|
+
runSubNodes(sourceElement, destinationElement, normalizersMap, options) {
|
|
235
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
172
236
|
for (const key in this.nodes) {
|
|
173
237
|
if (this.nodes.hasOwnProperty(key) === false) {
|
|
174
238
|
continue;
|
|
@@ -212,22 +276,28 @@ export class DataMappingNode extends BaseDataMappingNode {
|
|
|
212
276
|
}
|
|
213
277
|
}
|
|
214
278
|
/**
|
|
215
|
-
* This method exports this node.
|
|
279
|
+
* This method exports this node. The exported representation is a plain object — it does not mutate
|
|
280
|
+
* the live tree, so the same builder can continue to be used for mapping after `export()` is called.
|
|
281
|
+
*
|
|
282
|
+
* `destinationType` is intentionally not serialized: class constructors aren't transferable, and
|
|
283
|
+
* factory callbacks (`ArrayMemberTypeFactoryCallbackType`) hold closures. To rehydrate a schema with
|
|
284
|
+
* the same destination instantiation behavior, decorate the destination class with class-transformer's
|
|
285
|
+
* `@Type()` and pass the destination class to `DataMapper.map()`.
|
|
216
286
|
*/
|
|
217
287
|
export() {
|
|
218
|
-
const
|
|
219
|
-
for (const key in nodes) {
|
|
220
|
-
if (nodes.hasOwnProperty(key) === false) {
|
|
288
|
+
const exportedNodes = {};
|
|
289
|
+
for (const key in this.nodes) {
|
|
290
|
+
if (this.nodes.hasOwnProperty(key) === false) {
|
|
221
291
|
continue;
|
|
222
292
|
}
|
|
223
|
-
|
|
293
|
+
exportedNodes[key] = this.nodes[key].export();
|
|
224
294
|
}
|
|
225
295
|
return {
|
|
226
296
|
"_type": this.type,
|
|
227
297
|
"sourceProperty": this.sourceProperty,
|
|
228
298
|
"destinationProperty": this.destinationProperty,
|
|
229
299
|
"isOptional": this.isOptional,
|
|
230
|
-
"nodes":
|
|
300
|
+
"nodes": exportedNodes,
|
|
231
301
|
};
|
|
232
302
|
}
|
|
233
303
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-mapping.node.js","sourceRoot":"","sources":["../../../../src/nodes/data-mapping.node.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAC,uBAAuB,EAAC,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAC,eAAe,EAAC,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAC,mBAAmB,EAAC,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAC,sCAAsC,EAAC,MAAM,wDAAwD,CAAC;AAG9G,OAAO,EAAC,kDAAkD,EAAC,MAAM,sEAAsE,CAAC;AACxI,OAAO,EAAmB,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAIpE,MAAM,OAAO,eAAgB,SAAQ,mBAAmB;IAqBtD,YAA4B,IAAwB,EACxB,MAA4C,EAC5C,OAAgC,uBAAuB,CAAC,IAAI;QAEtF,KAAK,EAAE,CAAC;QAJkB,SAAI,GAAJ,IAAI,CAAoB;QACxB,WAAM,GAAN,MAAM,CAAsC;QAC5C,S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uilderOptions {
|
|
2
2
|
constructor(options) {
|
|
3
|
-
var _a, _b, _c, _d;
|
|
3
|
+
var _a, _b, _c, _d, _e;
|
|
4
4
|
this.isOptionalDefaultValue = (_a = options === null || options === void 0 ? void 0 : options.isOptionalDefaultValue) !== null && _a !== void 0 ? _a : true;
|
|
5
5
|
this.excludeExtraneousValues = (_b = options === null || options === void 0 ? void 0 : options.excludeExtraneousValues) !== null && _b !== void 0 ? _b : false;
|
|
6
6
|
this.throwOnErrors = (_c = options === null || options === void 0 ? void 0 : options.throwOnErrors) !== null && _c !== void 0 ? _c : false;
|
|
7
7
|
this.logErrors = (_d = options === null || options === void 0 ? void 0 : options.logErrors) !== null && _d !== void 0 ? _d : false;
|
|
8
|
+
this.disableCache = (_e = options === null || options === void 0 ? void 0 : options.disableCache) !== null && _e !== void 0 ? _e : false;
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
11
|
//# sourceMappingURL=auto-data-mapping-builder.options.js.map
|
|
@@ -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,MAAM,OAAO,6BAA6B;
|
|
1
|
+
{"version":3,"file":"auto-data-mapping-builder.options.js","sourceRoot":"","sources":["../../../../src/options/auto-data-mapping-builder.options.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in default reporter. Writes a header line + the error + a structured context payload
|
|
3
|
+
* to `console.error`. Used when no custom reporter is supplied to DataMapper — gives the
|
|
4
|
+
* frontend (and any non-DI caller) useful output out of the box.
|
|
5
|
+
*
|
|
6
|
+
* Exposed as a class-with-static-method so callers can compose it from their own reporters,
|
|
7
|
+
* e.g. `(err, ctx) => { sendToSentry(err); ConsoleErrorReporter.report(err, ctx); }`.
|
|
8
|
+
*/
|
|
9
|
+
export class ConsoleErrorReporter {
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Matches the `DataMapperErrorReporter` shape so a method reference (`ConsoleErrorReporter.report`)
|
|
13
|
+
* can be passed wherever the callback type is expected.
|
|
14
|
+
*/
|
|
15
|
+
ConsoleErrorReporter.report = (error, context) => {
|
|
16
|
+
// eslint-disable-next-line no-console
|
|
17
|
+
console.error("[DataMapper] autoMap caught an error.", error, context);
|
|
18
|
+
};
|
|
19
|
+
//# 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,MAAM,OAAO,oBAAoB;;AAC/B;;;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 @@
|
|
|
1
|
+
{"version":3,"file":"reporters.js","sourceRoot":"","sources":["../../../../src/reporters/reporters.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|