@unito/integration-api 7.0.0 → 7.1.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.
@@ -30,6 +30,7 @@
30
30
  "createdAt",
31
31
  "description",
32
32
  "displayName",
33
+ "isPublic",
33
34
  "providerUrl",
34
35
  "updatedAt",
35
36
  "user",
@@ -49,7 +49,14 @@
49
49
  }
50
50
  },
51
51
  "reference": {
52
- "$ref": "https://unito.io/integration_api/referenceRelation.schema.json"
52
+ "oneOf": [
53
+ {
54
+ "$ref": "https://unito.io/integration_api/referenceRelation.schema.json"
55
+ },
56
+ {
57
+ "$ref": "https://unito.io/integration_api/relationPointer.schema.json"
58
+ }
59
+ ]
53
60
  },
54
61
  "info": {
55
62
  "type": "string"
@@ -0,0 +1,20 @@
1
+ {
2
+ "$id": "https://unito.io/integration_api/relationPointer.schema.json",
3
+ "title": "RelationPointer",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["itemPath", "relationName"],
7
+ "properties": {
8
+ "itemPath": {
9
+ "type": "string",
10
+ "format": "uri-reference",
11
+ "pattern": "^\/.*$"
12
+ },
13
+ "relationName": {
14
+ "type": "string",
15
+ "pattern": "^[a-zA-Z0-9_-]*$",
16
+ "minLength": 1,
17
+ "maxLength": 100
18
+ }
19
+ }
20
+ }
@@ -29,6 +29,12 @@ export declare function isItemSummary(potentialItemSummary: unknown): potentialI
29
29
  * @returns True if the value is an Item, false otherwise.
30
30
  */
31
31
  export declare function isItem(potentialItem: unknown): potentialItem is Api.Item;
32
+ /**
33
+ * Checks if the input is an Api.RelationPointer object.
34
+ * @param potentialRelationPointer - The value to check.
35
+ * @returns True if the value is a RelationPointer, false otherwise.
36
+ */
37
+ export declare function isRelationPointer(potentialRelationPointer: unknown): potentialRelationPointer is Api.RelationPointer;
32
38
  /**
33
39
  * Checks if the input is an Api.ReferenceRelation object.
34
40
  * @param potentialReferenceRelation - The value to check.
@@ -46,6 +46,16 @@ export function isItem(potentialItem) {
46
46
  Array.isArray(potentialItem['relations']) &&
47
47
  potentialItem['relations'].every(isRelation));
48
48
  }
49
+ /**
50
+ * Checks if the input is an Api.RelationPointer object.
51
+ * @param potentialRelationPointer - The value to check.
52
+ * @returns True if the value is a RelationPointer, false otherwise.
53
+ */
54
+ export function isRelationPointer(potentialRelationPointer) {
55
+ return (isObject(potentialRelationPointer) &&
56
+ isString(potentialRelationPointer['itemPath']) &&
57
+ isString(potentialRelationPointer['relationName']));
58
+ }
49
59
  /**
50
60
  * Checks if the input is an Api.ReferenceRelation object.
51
61
  * @param potentialReferenceRelation - The value to check.
@@ -32,6 +32,17 @@ const Semantics = {
32
32
  CREATED_AT: 'createdAt',
33
33
  DESCRIPTION: 'description',
34
34
  DISPLAY_NAME: 'displayName',
35
+ /**
36
+ * Indicates whether an item is publicly visible.
37
+ * For example, a comment marked as public is visible to external users.
38
+ *
39
+ * Expected field value to be of type FieldValueType.BOOLEAN.
40
+ * `true` means the item is public, `false` means it is private/internal.
41
+ *
42
+ * Integrations should map their provider's visibility field directly — e.g.,
43
+ * a Salesforce field named `Public` maps to `IS_PUBLIC` with the same polarity.
44
+ */
45
+ IS_PUBLIC: 'isPublic',
35
46
  PROVIDER_URL: 'providerUrl',
36
47
  UPDATED_AT: 'updatedAt',
37
48
  USER: 'user',
@@ -152,6 +163,16 @@ function isItem(potentialItem) {
152
163
  Array.isArray(potentialItem['relations']) &&
153
164
  potentialItem['relations'].every(isRelation));
154
165
  }
166
+ /**
167
+ * Checks if the input is an Api.RelationPointer object.
168
+ * @param potentialRelationPointer - The value to check.
169
+ * @returns True if the value is a RelationPointer, false otherwise.
170
+ */
171
+ function isRelationPointer(potentialRelationPointer) {
172
+ return (isObject(potentialRelationPointer) &&
173
+ isString(potentialRelationPointer['itemPath']) &&
174
+ isString(potentialRelationPointer['relationName']));
175
+ }
155
176
  /**
156
177
  * Checks if the input is an Api.ReferenceRelation object.
157
178
  * @param potentialReferenceRelation - The value to check.
@@ -817,6 +838,7 @@ exports.isItemSummary = isItemSummary;
817
838
  exports.isObject = isObject;
818
839
  exports.isReferenceRelation = isReferenceRelation;
819
840
  exports.isRelation = isRelation;
841
+ exports.isRelationPointer = isRelationPointer;
820
842
  exports.isRelationSchema = isRelationSchema;
821
843
  exports.isRelationSchemaOrSelf = isRelationSchemaOrSelf;
822
844
  exports.isRelationSummary = isRelationSummary;
@@ -124,11 +124,15 @@ interface DisplayNameFieldSchema extends AbstractFieldSchema {
124
124
  semantic: typeof Semantics.DISPLAY_NAME;
125
125
  type: typeof FieldValueTypes.STRING | typeof FieldValueTypes.EMAIL;
126
126
  }
127
+ interface IsPublicFieldSchema extends AbstractFieldSchema {
128
+ semantic: typeof Semantics.IS_PUBLIC;
129
+ type: typeof FieldValueTypes.BOOLEAN;
130
+ }
127
131
  interface UnconstrainedBasicFieldSchema extends AbstractFieldSchema {
128
132
  semantic?: never;
129
133
  type: BasicFieldValueType;
130
134
  }
131
- export type BasicFieldSchema = ProviderUrlFieldSchema | CreatedAtFieldSchema | UpdatedAtFieldSchema | DescriptionFieldSchema | DisplayNameFieldSchema | UnconstrainedBasicFieldSchema;
135
+ export type BasicFieldSchema = ProviderUrlFieldSchema | CreatedAtFieldSchema | UpdatedAtFieldSchema | DescriptionFieldSchema | DisplayNameFieldSchema | IsPublicFieldSchema | UnconstrainedBasicFieldSchema;
132
136
  export interface BlobFieldSchema extends AbstractFieldSchema {
133
137
  /**
134
138
  * The type of the field.
@@ -142,19 +146,33 @@ export interface BlobFieldSchema extends AbstractFieldSchema {
142
146
  interface UserReferenceFieldSchema extends AbstractFieldSchema {
143
147
  semantic: typeof Semantics.USER;
144
148
  type: typeof FieldValueTypes.REFERENCE;
145
- reference: ReferenceRelation;
149
+ reference: ReferenceRelation | RelationPointer;
146
150
  }
147
151
  interface ParentReferenceFieldSchema extends AbstractFieldSchema {
148
152
  semantic: typeof Semantics.PARENT;
149
153
  type: typeof FieldValueTypes.REFERENCE;
150
- reference: ReferenceRelation;
154
+ reference: ReferenceRelation | RelationPointer;
151
155
  }
152
156
  interface UnconstrainedReferenceFieldSchema extends AbstractFieldSchema {
153
157
  semantic?: never;
154
158
  type: typeof FieldValueTypes.REFERENCE;
155
- reference: ReferenceRelation;
159
+ reference: ReferenceRelation | RelationPointer;
156
160
  }
157
161
  export type ReferenceFieldSchema = UserReferenceFieldSchema | ParentReferenceFieldSchema | UnconstrainedReferenceFieldSchema;
162
+ /**
163
+ * A RelationPointer points to an existing relation elsewhere in the graph,
164
+ * avoiding the need to redeclare its schema inline.
165
+ */
166
+ export interface RelationPointer {
167
+ /**
168
+ * The path of the item that owns the target relation.
169
+ */
170
+ itemPath: string;
171
+ /**
172
+ * The name of the relation on that item.
173
+ */
174
+ relationName: string;
175
+ }
158
176
  /**
159
177
  * A ReferenceRelation describes a relation that can be used in a ReferenceFieldSchema.
160
178
  */
@@ -263,6 +281,17 @@ export declare const Semantics: {
263
281
  readonly CREATED_AT: "createdAt";
264
282
  readonly DESCRIPTION: "description";
265
283
  readonly DISPLAY_NAME: "displayName";
284
+ /**
285
+ * Indicates whether an item is publicly visible.
286
+ * For example, a comment marked as public is visible to external users.
287
+ *
288
+ * Expected field value to be of type FieldValueType.BOOLEAN.
289
+ * `true` means the item is public, `false` means it is private/internal.
290
+ *
291
+ * Integrations should map their provider's visibility field directly — e.g.,
292
+ * a Salesforce field named `Public` maps to `IS_PUBLIC` with the same polarity.
293
+ */
294
+ readonly IS_PUBLIC: "isPublic";
266
295
  readonly PROVIDER_URL: "providerUrl";
267
296
  readonly UPDATED_AT: "updatedAt";
268
297
  readonly USER: "user";
package/dist/src/types.js CHANGED
@@ -30,6 +30,17 @@ export const Semantics = {
30
30
  CREATED_AT: 'createdAt',
31
31
  DESCRIPTION: 'description',
32
32
  DISPLAY_NAME: 'displayName',
33
+ /**
34
+ * Indicates whether an item is publicly visible.
35
+ * For example, a comment marked as public is visible to external users.
36
+ *
37
+ * Expected field value to be of type FieldValueType.BOOLEAN.
38
+ * `true` means the item is public, `false` means it is private/internal.
39
+ *
40
+ * Integrations should map their provider's visibility field directly — e.g.,
41
+ * a Salesforce field named `Public` maps to `IS_PUBLIC` with the same polarity.
42
+ */
43
+ IS_PUBLIC: 'isPublic',
33
44
  PROVIDER_URL: 'providerUrl',
34
45
  UPDATED_AT: 'updatedAt',
35
46
  USER: 'user',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unito/integration-api",
3
- "version": "7.0.0",
3
+ "version": "7.1.0",
4
4
  "description": "The Unito Integration API",
5
5
  "type": "module",
6
6
  "types": "./dist/src/index.d.ts",