@unito/integration-api 7.1.1 → 7.1.2
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/dist/src/guards.js +12 -1
- package/dist/src/index.cjs +12 -1
- package/package.json +1 -1
package/dist/src/guards.js
CHANGED
|
@@ -62,8 +62,19 @@ export function isRelationPointer(potentialRelationPointer) {
|
|
|
62
62
|
* @returns True if the value is a ReferenceRelation, false otherwise.
|
|
63
63
|
*/
|
|
64
64
|
export function isReferenceRelation(potentialReferenceRelation, options) {
|
|
65
|
+
if (!isObject(potentialReferenceRelation)) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
// breaking change introducing the name in the reference.
|
|
69
|
+
if ('name' in potentialReferenceRelation) {
|
|
70
|
+
return (isObject(potentialReferenceRelation) &&
|
|
71
|
+
isString(potentialReferenceRelation['name']) &&
|
|
72
|
+
isString(potentialReferenceRelation['path']) &&
|
|
73
|
+
isString(potentialReferenceRelation['label']) &&
|
|
74
|
+
isRelationSchemaOrSelf(potentialReferenceRelation['schema'], options));
|
|
75
|
+
}
|
|
76
|
+
// backward compatible check
|
|
65
77
|
return (isObject(potentialReferenceRelation) &&
|
|
66
|
-
isString(potentialReferenceRelation['name']) &&
|
|
67
78
|
isString(potentialReferenceRelation['path']) &&
|
|
68
79
|
isString(potentialReferenceRelation['label']) &&
|
|
69
80
|
isRelationSchemaOrSelf(potentialReferenceRelation['schema'], options));
|
package/dist/src/index.cjs
CHANGED
|
@@ -179,8 +179,19 @@ function isRelationPointer(potentialRelationPointer) {
|
|
|
179
179
|
* @returns True if the value is a ReferenceRelation, false otherwise.
|
|
180
180
|
*/
|
|
181
181
|
function isReferenceRelation(potentialReferenceRelation, options) {
|
|
182
|
+
if (!isObject(potentialReferenceRelation)) {
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
// breaking change introducing the name in the reference.
|
|
186
|
+
if ('name' in potentialReferenceRelation) {
|
|
187
|
+
return (isObject(potentialReferenceRelation) &&
|
|
188
|
+
isString(potentialReferenceRelation['name']) &&
|
|
189
|
+
isString(potentialReferenceRelation['path']) &&
|
|
190
|
+
isString(potentialReferenceRelation['label']) &&
|
|
191
|
+
isRelationSchemaOrSelf(potentialReferenceRelation['schema'], options));
|
|
192
|
+
}
|
|
193
|
+
// backward compatible check
|
|
182
194
|
return (isObject(potentialReferenceRelation) &&
|
|
183
|
-
isString(potentialReferenceRelation['name']) &&
|
|
184
195
|
isString(potentialReferenceRelation['path']) &&
|
|
185
196
|
isString(potentialReferenceRelation['label']) &&
|
|
186
197
|
isRelationSchemaOrSelf(potentialReferenceRelation['schema'], options));
|