@bedrockio/model 0.1.29 → 0.1.31

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.
@@ -29,7 +29,7 @@ function applyReferences(schema) {
29
29
  return e === model || e === model.modelName;
30
30
  });
31
31
  if (isAllowed) {
32
- return;
32
+ continue;
33
33
  }
34
34
  const query = {
35
35
  $or: paths.map(path => {
@@ -258,7 +258,11 @@ function applyDateExtension(typedef) {
258
258
  default: defaultValue
259
259
  } = typedef;
260
260
  if (type === 'Date' && defaultValue === 'now') {
261
- typedef.default = Date.now;
261
+ // Allow mocking which would modify the global
262
+ // Date after the schema has been set up.
263
+ typedef.default = () => {
264
+ return Date.now();
265
+ };
262
266
  }
263
267
  }
264
268
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrockio/model",
3
- "version": "0.1.29",
3
+ "version": "0.1.31",
4
4
  "description": "Bedrock utilities for model creation.",
5
5
  "type": "module",
6
6
  "scripts": {
package/src/references.js CHANGED
@@ -21,7 +21,7 @@ export function applyReferences(schema) {
21
21
  return e === model || e === model.modelName;
22
22
  });
23
23
  if (isAllowed) {
24
- return;
24
+ continue;
25
25
  }
26
26
 
27
27
  const query = {
package/src/schema.js CHANGED
@@ -262,7 +262,11 @@ function applyTupleExtension(typedef) {
262
262
  function applyDateExtension(typedef) {
263
263
  const { type, default: defaultValue } = typedef;
264
264
  if (type === 'Date' && defaultValue === 'now') {
265
- typedef.default = Date.now;
265
+ // Allow mocking which would modify the global
266
+ // Date after the schema has been set up.
267
+ typedef.default = () => {
268
+ return Date.now();
269
+ };
266
270
  }
267
271
  }
268
272