@bedrockio/model 0.2.8 → 0.2.9

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.
@@ -173,18 +173,19 @@ async function errorOnForeignReferences(doc, options) {
173
173
  }
174
174
  function referenceIsAllowed(model, options) {
175
175
  const {
176
- cleanForeign
176
+ cleanForeign = {}
177
177
  } = options;
178
178
  const {
179
179
  only,
180
180
  except
181
181
  } = options?.errorHook || {};
182
+ if (model.modelName in cleanForeign) {
183
+ return true;
184
+ }
182
185
  if (only) {
183
186
  return !only.includes(model.modelName);
184
187
  } else if (except) {
185
188
  return except.includes(model.modelName);
186
- } else if (cleanForeign) {
187
- return model.modelName in cleanForeign;
188
189
  } else {
189
190
  return false;
190
191
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrockio/model",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Bedrock utilities for model creation.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -170,14 +170,15 @@ async function errorOnForeignReferences(doc, options) {
170
170
  }
171
171
 
172
172
  function referenceIsAllowed(model, options) {
173
- const { cleanForeign } = options;
173
+ const { cleanForeign = {} } = options;
174
174
  const { only, except } = options?.errorHook || {};
175
+ if (model.modelName in cleanForeign) {
176
+ return true;
177
+ }
175
178
  if (only) {
176
179
  return !only.includes(model.modelName);
177
180
  } else if (except) {
178
181
  return except.includes(model.modelName);
179
- } else if (cleanForeign) {
180
- return model.modelName in cleanForeign;
181
182
  } else {
182
183
  return false;
183
184
  }