@chili-publish/studio-connectors 1.38.0 → 1.40.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.
- package/dist/index.d.ts +53 -10
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,13 @@ declare global {
|
|
|
3
3
|
var StudioFormData: StudioFormDataConstructor;
|
|
4
4
|
var FilePointer: FilePointerConstructor;
|
|
5
5
|
}
|
|
6
|
+
export interface BaseConnector<C extends Record<string, boolean | undefined>> {
|
|
7
|
+
getCapabilities(): C;
|
|
8
|
+
getConfigurationOptions(): ConnectorConfigOptions$1 | null;
|
|
9
|
+
}
|
|
10
|
+
export interface BidirectionalNavigation extends OneDirectionalNavigation {
|
|
11
|
+
previousPageToken?: string | null;
|
|
12
|
+
}
|
|
6
13
|
export interface ChiliBody {
|
|
7
14
|
arrayBuffer: ArrayBufferPointer;
|
|
8
15
|
text: string;
|
|
@@ -73,11 +80,11 @@ export interface ConnectorRuntimeContext {
|
|
|
73
80
|
platform: ChiliPlatform;
|
|
74
81
|
sdkVersion: string;
|
|
75
82
|
}
|
|
76
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Default implementation that we use for Output Data Source use case
|
|
85
|
+
*/
|
|
86
|
+
export interface DataConnector extends BaseConnector<DataConnectorCapabilities> {
|
|
77
87
|
getPage(config: PageConfig, context: Dictionary): Promise<DataPage>;
|
|
78
|
-
getModel(context: Dictionary): Promise<DataModel>;
|
|
79
|
-
getConfigurationOptions(): ConnectorConfigOptions$1 | null;
|
|
80
|
-
getCapabilities(): DataConnectorCapabilities;
|
|
81
88
|
}
|
|
82
89
|
export interface DataFilter {
|
|
83
90
|
property: string;
|
|
@@ -88,6 +95,20 @@ export interface DataSorting {
|
|
|
88
95
|
property: string;
|
|
89
96
|
direction: "asc" | "desc";
|
|
90
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* @experimental This interface is still experimental and might change in future releases.
|
|
100
|
+
*
|
|
101
|
+
* Contract for connectors that set `DataConnectorCapabilities.dataSourceVariable = true`.
|
|
102
|
+
* All three methods are required for the Data Source Variable feature.
|
|
103
|
+
*/
|
|
104
|
+
export interface DataSourceVariableCapability extends ModelCapability {
|
|
105
|
+
/** Bidirectional paged data. */
|
|
106
|
+
getPage(config: BidirectionalPageConfig, context: Dictionary): Promise<BidirectionalDataPage>;
|
|
107
|
+
/** Single item by ID; pageOptions (sorting, limit) used to build navigation tokens. */
|
|
108
|
+
getPageItemById(id: string, pageOptions: PageItemOptions, context: Dictionary): Promise<BidirectionalDataPageItem>;
|
|
109
|
+
/** Get the data model for the data source variable. */
|
|
110
|
+
getModel(context: Dictionary): Promise<DataSourceVariableDataModel>;
|
|
111
|
+
}
|
|
91
112
|
export interface Dictionary {
|
|
92
113
|
[Key: string]: string | boolean;
|
|
93
114
|
}
|
|
@@ -136,10 +157,23 @@ export interface MediaConnector {
|
|
|
136
157
|
export interface MediaConnectorUpload {
|
|
137
158
|
upload(filePointers: FilePointer$1[], context: Dictionary): Promise<Media$2[]>;
|
|
138
159
|
}
|
|
139
|
-
|
|
160
|
+
/**
|
|
161
|
+
* Contract for connectors that set `DataConnectorCapabilities.model = true`.
|
|
162
|
+
*/
|
|
163
|
+
export interface ModelCapability {
|
|
164
|
+
getModel(context: Dictionary): Promise<DataModel>;
|
|
165
|
+
}
|
|
166
|
+
export interface OneDirectionalNavigation {
|
|
167
|
+
continuationToken?: string | null;
|
|
168
|
+
}
|
|
169
|
+
export interface PageConfigBase {
|
|
140
170
|
filters?: DataFilter[] | null;
|
|
141
171
|
sorting?: DataSorting[] | null;
|
|
142
|
-
|
|
172
|
+
limit: number;
|
|
173
|
+
}
|
|
174
|
+
/** Options for getPageItemById: sorting and limit used to build navigation tokens. */
|
|
175
|
+
export interface PageItemOptions {
|
|
176
|
+
sorting?: DataSorting[] | null;
|
|
143
177
|
limit: number;
|
|
144
178
|
}
|
|
145
179
|
export interface StudioFormDataConstructor {
|
|
@@ -153,6 +187,11 @@ export type ArrayBufferPointer = {
|
|
|
153
187
|
id: string;
|
|
154
188
|
bytes: number;
|
|
155
189
|
};
|
|
190
|
+
export type BidirectionalDataPage = WithNavigation<Pick<QueryPage<DataItem>, "data">, BidirectionalNavigation>;
|
|
191
|
+
export type BidirectionalDataPageItem = WithNavigation<{
|
|
192
|
+
data: DataItem;
|
|
193
|
+
}, BidirectionalNavigation>;
|
|
194
|
+
export type BidirectionalPageConfig = PageConfigBase & BidirectionalNavigation;
|
|
156
195
|
export type ChiliPlatform = "web" | "server";
|
|
157
196
|
export type ConnectorConfigContextType = "query" | "upload";
|
|
158
197
|
export type ConnectorConfigOptions<Type, ContextType> = ConnectorConfigValue<Type, ContextType>[];
|
|
@@ -161,6 +200,7 @@ export type DataConnectorCapabilities = {
|
|
|
161
200
|
filtering: boolean;
|
|
162
201
|
sorting: boolean;
|
|
163
202
|
model: boolean;
|
|
203
|
+
dataSourceVariable?: boolean;
|
|
164
204
|
};
|
|
165
205
|
export type DataConnectorRuntimeContext = ConnectorRuntimeContext;
|
|
166
206
|
export type DataItem = {
|
|
@@ -173,8 +213,9 @@ export type DataModelProperty = {
|
|
|
173
213
|
name: string;
|
|
174
214
|
type: string;
|
|
175
215
|
};
|
|
176
|
-
export type DataPage = Pick<QueryPage<DataItem>, "data"
|
|
177
|
-
|
|
216
|
+
export type DataPage = WithNavigation<Pick<QueryPage<DataItem>, "data">, OneDirectionalNavigation>;
|
|
217
|
+
export type DataSourceVariableDataModel = DataModel & {
|
|
218
|
+
itemIdPropertyName: string;
|
|
178
219
|
};
|
|
179
220
|
export type DownloadIntent = "web" | "print" | "animation";
|
|
180
221
|
export type DownloadType = "thumbnail" | "mediumres" | "highres" | "fullres" | "original";
|
|
@@ -201,6 +242,7 @@ export type MediaDetail<MediaType> = Media<MediaType> & {
|
|
|
201
242
|
};
|
|
202
243
|
export type MediaPage = QueryPage<Media$2>;
|
|
203
244
|
export type MediaType = FileType | FolderType;
|
|
245
|
+
export type PageConfig = PageConfigBase & OneDirectionalNavigation;
|
|
204
246
|
export type QueryOptions = {
|
|
205
247
|
filter?: string[] | null;
|
|
206
248
|
collection?: string | null;
|
|
@@ -218,6 +260,7 @@ export type QueryPage<T> = {
|
|
|
218
260
|
};
|
|
219
261
|
export type StudioFetchBody = string | FilePointer$1 | StudioFormData$1;
|
|
220
262
|
export type StudioFormDataValue = string | FilePointer$1;
|
|
263
|
+
export type WithNavigation<T, N extends OneDirectionalNavigation | BidirectionalNavigation> = T & N;
|
|
221
264
|
interface ConnectorHttpError$1 extends Error {
|
|
222
265
|
/**
|
|
223
266
|
* The HTTP status code associated with the error.
|
|
@@ -247,10 +290,10 @@ declare namespace Media$1 {
|
|
|
247
290
|
export { DownloadIntent, DownloadType, FilePointer$1 as FilePointer, FileType, FolderType, Media$2 as Media, MediaConnector, MediaConnectorCapabilities, MediaConnectorUpload, MediaDetail$1 as MediaDetail, MediaPage, MediaType };
|
|
248
291
|
}
|
|
249
292
|
declare namespace Connector {
|
|
250
|
-
export { ArrayBufferPointer, ChiliBody, ChiliPlatform, ChiliRequestInit, ChiliResponse, ConnectorConfigContextType, ConnectorConfigOptions$1 as ConnectorConfigOptions, ConnectorConfigValue$1 as ConnectorConfigValue, ConnectorConfigValueType, ConnectorHttpError$1 as ConnectorHttpError, ConnectorRuntimeContext, Dictionary, FilePointer$1 as FilePointer, QueryOptions, StudioFetchBody, StudioFormData$1 as StudioFormData, StudioFormDataValue };
|
|
293
|
+
export { ArrayBufferPointer, BaseConnector, ChiliBody, ChiliPlatform, ChiliRequestInit, ChiliResponse, ConnectorConfigContextType, ConnectorConfigOptions$1 as ConnectorConfigOptions, ConnectorConfigValue$1 as ConnectorConfigValue, ConnectorConfigValueType, ConnectorHttpError$1 as ConnectorHttpError, ConnectorRuntimeContext, Dictionary, FilePointer$1 as FilePointer, QueryOptions, StudioFetchBody, StudioFormData$1 as StudioFormData, StudioFormDataValue };
|
|
251
294
|
}
|
|
252
295
|
declare namespace Data {
|
|
253
|
-
export { DataConnector, DataConnectorCapabilities, DataConnectorRuntimeContext, DataItem, DataModel, DataModelProperty, DataPage, PageConfig };
|
|
296
|
+
export { BidirectionalDataPage, BidirectionalDataPageItem, BidirectionalPageConfig, DataConnector, DataConnectorCapabilities, DataConnectorRuntimeContext, DataItem, DataModel, DataModelProperty, DataPage, DataSourceVariableCapability, DataSourceVariableDataModel, ModelCapability, PageConfig, PageItemOptions };
|
|
254
297
|
}
|
|
255
298
|
declare namespace Font {
|
|
256
299
|
export { FontConnectorCapabilities, FontFamily, FontFamilyPage, FontPreviewFormat, FontStyle, GrafxFontConnector };
|