@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.
@@ -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));
@@ -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));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unito/integration-api",
3
- "version": "7.1.1",
3
+ "version": "7.1.2",
4
4
  "description": "The Unito Integration API",
5
5
  "type": "module",
6
6
  "types": "./dist/src/index.d.ts",