@coderich/autograph 0.13.43 → 0.13.45
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/package.json +1 -1
- package/src/data/Resolver.js +1 -1
- package/src/schema/Schema.js +8 -1
package/package.json
CHANGED
package/src/data/Resolver.js
CHANGED
|
@@ -238,7 +238,7 @@ module.exports = class Resolver {
|
|
|
238
238
|
model = this.#schema.models[model];
|
|
239
239
|
|
|
240
240
|
return Object.defineProperties(Util.map(result, (doc) => {
|
|
241
|
-
const $doc = model.transformers.doc.transform(doc);
|
|
241
|
+
const $doc = model.transformers.doc.transform(doc, { resolver: this, context: this.#context });
|
|
242
242
|
|
|
243
243
|
// Assign useful/needed meta data
|
|
244
244
|
return Object.defineProperties($doc, {
|
package/src/schema/Schema.js
CHANGED
|
@@ -425,7 +425,14 @@ module.exports = class Schema {
|
|
|
425
425
|
a => Pipeline.$deserialize({ ...a, ...args, path: a.path.concat(curr.name) }),
|
|
426
426
|
];
|
|
427
427
|
if (curr.isArray) rules.unshift(({ value }) => (value == null ? value : Util.ensureArray(value)));
|
|
428
|
-
if (curr.isEmbedded) rules.unshift(({ value }) => Util.map(value, v => curr.model.transformers.doc.transform(v)));
|
|
428
|
+
// if (curr.isEmbedded) rules.unshift(({ value }) => Util.map(value, v => curr.model.transformers.doc.transform(v)));
|
|
429
|
+
if (curr.isEmbedded) {
|
|
430
|
+
rules.unshift(a => Util.map(a.value, (value, i) => {
|
|
431
|
+
const path = a.path.concat(curr.name);
|
|
432
|
+
if (curr.isArray) path.push(i);
|
|
433
|
+
return curr.model.transformers.doc.transform(value, { ...args, query: a.query, context: a.context, path });
|
|
434
|
+
}));
|
|
435
|
+
}
|
|
429
436
|
return Object.assign(prev, { [curr.key]: rules });
|
|
430
437
|
}, {}),
|
|
431
438
|
defaults: Object.values($model.fields).reduce((prev, curr) => {
|