@bedrockio/model 0.1.32 → 0.1.33

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.
@@ -243,7 +243,16 @@ function setNodePath(node, options) {
243
243
  node[key] = null;
244
244
  }
245
245
  } else if (type === 'virtual') {
246
- node[key] = {};
246
+ node[key] ||= {};
247
+ const virtual = schema.virtual(key);
248
+ setNodePath(node[key], {
249
+ // @ts-ignore
250
+ modelName: virtual.options.ref,
251
+ path: path.slice(parts.length),
252
+ depth: depth + 1,
253
+ exclude
254
+ });
255
+ halt = true;
247
256
  } else if (type !== 'nested') {
248
257
  throw new Error(`Unknown path on ${modelName}: ${key}.`);
249
258
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrockio/model",
3
- "version": "0.1.32",
3
+ "version": "0.1.33",
4
4
  "description": "Bedrock utilities for model creation.",
5
5
  "type": "module",
6
6
  "scripts": {
package/src/include.js CHANGED
@@ -228,7 +228,16 @@ function setNodePath(node, options) {
228
228
  node[key] = null;
229
229
  }
230
230
  } else if (type === 'virtual') {
231
- node[key] = {};
231
+ node[key] ||= {};
232
+ const virtual = schema.virtual(key);
233
+ setNodePath(node[key], {
234
+ // @ts-ignore
235
+ modelName: virtual.options.ref,
236
+ path: path.slice(parts.length),
237
+ depth: depth + 1,
238
+ exclude,
239
+ });
240
+ halt = true;
232
241
  } else if (type !== 'nested') {
233
242
  throw new Error(`Unknown path on ${modelName}: ${key}.`);
234
243
  }