@unito/integration-api 5.0.1 → 6.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.
Files changed (2) hide show
  1. package/dist/src/types.d.ts +47 -12
  2. package/package.json +1 -1
@@ -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
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unito/integration-api",
3
- "version": "5.0.1",
3
+ "version": "6.0.0",
4
4
  "description": "The Unito Integration API",
5
5
  "type": "module",
6
6
  "types": "./dist/src/index.d.ts",