@unito/integration-api 5.0.1 → 7.0.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.
@@ -3,7 +3,7 @@
3
3
  "title": "Relation",
4
4
  "type": "object",
5
5
  "additionalProperties": false,
6
- "required": ["path", "schema", "label"],
6
+ "required": ["path", "schema", "label", "name"],
7
7
  "properties": {
8
8
  "path": {
9
9
  "type": "string",
@@ -25,8 +25,7 @@
25
25
  "type": "string",
26
26
  "pattern": "^[a-zA-Z0-9_-]*$",
27
27
  "minLength": 1,
28
- "maxLength": 100,
29
- "deprecated": true
28
+ "maxLength": 100
30
29
  },
31
30
  "schema": {
32
31
  "oneOf": [
@@ -53,6 +53,7 @@ export function isItem(potentialItem) {
53
53
  */
54
54
  export function isReferenceRelation(potentialReferenceRelation) {
55
55
  return (isObject(potentialReferenceRelation) &&
56
+ isString(potentialReferenceRelation['name']) &&
56
57
  isString(potentialReferenceRelation['path']) &&
57
58
  isString(potentialReferenceRelation['label']) &&
58
59
  isRelationSchemaOrSelf(potentialReferenceRelation['schema']));
@@ -159,6 +159,7 @@ function isItem(potentialItem) {
159
159
  */
160
160
  function isReferenceRelation(potentialReferenceRelation) {
161
161
  return (isObject(potentialReferenceRelation) &&
162
+ isString(potentialReferenceRelation['name']) &&
162
163
  isString(potentialReferenceRelation['path']) &&
163
164
  isString(potentialReferenceRelation['label']) &&
164
165
  isRelationSchemaOrSelf(potentialReferenceRelation['schema']));
@@ -98,28 +98,63 @@ interface AbstractFieldSchema {
98
98
  */
99
99
  nullable?: boolean;
100
100
  }
101
- export interface BasicFieldSchema extends AbstractFieldSchema {
102
- /**
103
- * The type of the field.
104
- */
105
- type: Exclude<FieldValueType, typeof FieldValueTypes.BLOB | typeof FieldValueTypes.REFERENCE | typeof FieldValueTypes.OBJECT | typeof FieldValueTypes.DATETIME_RANGE | typeof FieldValueTypes.DATE_RANGE>;
101
+ type BasicFieldValueType = Exclude<FieldValueType, typeof FieldValueTypes.BLOB | typeof FieldValueTypes.REFERENCE | typeof FieldValueTypes.OBJECT | typeof FieldValueTypes.DATETIME_RANGE | typeof FieldValueTypes.DATE_RANGE>;
102
+ /**
103
+ * Semantic-constrained BasicFieldSchema variants.
104
+ * Each semantic restricts which field types are valid, matching the runtime
105
+ * validation in integrationDebugger's getSemanticSupportedFieldTypes().
106
+ */
107
+ interface ProviderUrlFieldSchema extends AbstractFieldSchema {
108
+ semantic: typeof Semantics.PROVIDER_URL;
109
+ type: typeof FieldValueTypes.URL;
110
+ }
111
+ interface CreatedAtFieldSchema extends AbstractFieldSchema {
112
+ semantic: typeof Semantics.CREATED_AT;
113
+ type: typeof FieldValueTypes.DATETIME;
106
114
  }
115
+ interface UpdatedAtFieldSchema extends AbstractFieldSchema {
116
+ semantic: typeof Semantics.UPDATED_AT;
117
+ type: typeof FieldValueTypes.DATETIME;
118
+ }
119
+ interface DescriptionFieldSchema extends AbstractFieldSchema {
120
+ semantic: typeof Semantics.DESCRIPTION;
121
+ type: typeof FieldValueTypes.RICH_TEXT_HTML | typeof FieldValueTypes.RICH_TEXT_MARKDOWN | typeof FieldValueTypes.STRING;
122
+ }
123
+ interface DisplayNameFieldSchema extends AbstractFieldSchema {
124
+ semantic: typeof Semantics.DISPLAY_NAME;
125
+ type: typeof FieldValueTypes.STRING | typeof FieldValueTypes.EMAIL;
126
+ }
127
+ interface UnconstrainedBasicFieldSchema extends AbstractFieldSchema {
128
+ semantic?: never;
129
+ type: BasicFieldValueType;
130
+ }
131
+ export type BasicFieldSchema = ProviderUrlFieldSchema | CreatedAtFieldSchema | UpdatedAtFieldSchema | DescriptionFieldSchema | DisplayNameFieldSchema | UnconstrainedBasicFieldSchema;
107
132
  export interface BlobFieldSchema extends AbstractFieldSchema {
108
133
  /**
109
134
  * The type of the field.
110
135
  */
111
136
  type: typeof FieldValueTypes.BLOB;
112
137
  }
113
- export interface ReferenceFieldSchema extends AbstractFieldSchema {
114
- /**
115
- * The type of the field.
116
- */
138
+ /**
139
+ * Semantic-constrained ReferenceFieldSchema variants.
140
+ * USER and PARENT semantics must use REFERENCE type.
141
+ */
142
+ interface UserReferenceFieldSchema extends AbstractFieldSchema {
143
+ semantic: typeof Semantics.USER;
144
+ type: typeof FieldValueTypes.REFERENCE;
145
+ reference: ReferenceRelation;
146
+ }
147
+ interface ParentReferenceFieldSchema extends AbstractFieldSchema {
148
+ semantic: typeof Semantics.PARENT;
149
+ type: typeof FieldValueTypes.REFERENCE;
150
+ reference: ReferenceRelation;
151
+ }
152
+ interface UnconstrainedReferenceFieldSchema extends AbstractFieldSchema {
153
+ semantic?: never;
117
154
  type: typeof FieldValueTypes.REFERENCE;
118
- /**
119
- * Describe the referenced collection.
120
- */
121
155
  reference: ReferenceRelation;
122
156
  }
157
+ export type ReferenceFieldSchema = UserReferenceFieldSchema | ParentReferenceFieldSchema | UnconstrainedReferenceFieldSchema;
123
158
  /**
124
159
  * A ReferenceRelation describes a relation that can be used in a ReferenceFieldSchema.
125
160
  */
@@ -141,10 +176,9 @@ export interface ReferenceRelation {
141
176
  */
142
177
  semantic?: RelationSemantic;
143
178
  /**
144
- * The name for the reference relation.
145
- * @deprecated Will be removed in a future version.
179
+ * The main identifier of the reference relation.
146
180
  */
147
- name?: string;
181
+ name: string;
148
182
  /**
149
183
  * The shape of the relation.
150
184
  */
@@ -573,7 +607,16 @@ export interface WebhookParsedItem {
573
607
  }
574
608
  export interface WebhookItem {
575
609
  /**
576
- * The canonical path of the parent item, if applicable.
610
+ * The canonical path of the parent item for this webhook event.
611
+ *
612
+ * Used as a fallback when the item's canonicalPath is not yet known to the platform
613
+ * (e.g., newly created items). In that case, sync-platform enqueues a sync job for
614
+ * the parent, which will discover the new child item during its scan.
615
+ *
616
+ * - If the exact parent is unknown without an extra API call, setting a grandparent
617
+ * (e.g., a sheet or project) is acceptable — it triggers a broader scan that will
618
+ * still pick up the new item.
619
+ * - If undefined and the item is not found, the webhook event is skipped entirely.
577
620
  */
578
621
  parentCanonicalPath?: string;
579
622
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unito/integration-api",
3
- "version": "5.0.1",
3
+ "version": "7.0.0",
4
4
  "description": "The Unito Integration API",
5
5
  "type": "module",
6
6
  "types": "./dist/src/index.d.ts",