@acodeninja/persist 3.2.0-next.1 → 3.2.0
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/Model.js +6 -3
package/package.json
CHANGED
package/src/data/Model.js
CHANGED
@@ -199,14 +199,17 @@ class Model {
|
|
199
199
|
.filter(([name, type]) => {
|
200
200
|
if (['indexedProperties', 'searchProperties'].includes(name)) return false;
|
201
201
|
|
202
|
+
/**
|
203
|
+
* Detect a one-to-one linked model
|
204
|
+
* @param maybeIncludesSingleModel
|
205
|
+
* @return {boolean}
|
206
|
+
*/
|
202
207
|
const includesSingleModel = (maybeIncludesSingleModel) => {
|
203
208
|
if (maybeIncludesSingleModel._type === 'array') return false;
|
204
209
|
|
205
210
|
if (Model.isModel(maybeIncludesSingleModel)) return true;
|
206
211
|
|
207
|
-
|
208
|
-
|
209
|
-
return false;
|
212
|
+
return Boolean(maybeIncludesSingleModel._items?.some?.(i => ModelClass.isModel(i)));
|
210
213
|
};
|
211
214
|
|
212
215
|
if (includesSingleModel(type)) return true;
|