@wix/data 1.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.
- package/build/cjs/index.d.ts +4 -0
- package/build/cjs/index.js +27 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/src/data-v1-external-database-connection.http.d.ts +29 -0
- package/build/cjs/src/data-v1-external-database-connection.http.js +397 -0
- package/build/cjs/src/data-v1-external-database-connection.http.js.map +1 -0
- package/build/cjs/src/data-v1-external-database-connection.public.d.ts +11 -0
- package/build/cjs/src/data-v1-external-database-connection.public.js +36 -0
- package/build/cjs/src/data-v1-external-database-connection.public.js.map +1 -0
- package/build/cjs/src/data-v1-external-database-connection.types.d.ts +53 -0
- package/build/cjs/src/data-v1-external-database-connection.types.js +3 -0
- package/build/cjs/src/data-v1-external-database-connection.types.js.map +1 -0
- package/build/cjs/src/data-v1-external-database-connection.universal.d.ts +129 -0
- package/build/cjs/src/data-v1-external-database-connection.universal.js +334 -0
- package/build/cjs/src/data-v1-external-database-connection.universal.js.map +1 -0
- package/build/cjs/src/data-v2-data-collection.http.d.ts +37 -0
- package/build/cjs/src/data-v2-data-collection.http.js +458 -0
- package/build/cjs/src/data-v2-data-collection.http.js.map +1 -0
- package/build/cjs/src/data-v2-data-collection.public.d.ts +12 -0
- package/build/cjs/src/data-v2-data-collection.public.js +48 -0
- package/build/cjs/src/data-v2-data-collection.public.js.map +1 -0
- package/build/cjs/src/data-v2-data-collection.types.d.ts +638 -0
- package/build/cjs/src/data-v2-data-collection.types.js +143 -0
- package/build/cjs/src/data-v2-data-collection.types.js.map +1 -0
- package/build/cjs/src/data-v2-data-collection.universal.d.ts +732 -0
- package/build/cjs/src/data-v2-data-collection.universal.js +532 -0
- package/build/cjs/src/data-v2-data-collection.universal.js.map +1 -0
- package/build/cjs/src/data-v2-data-item.http.d.ts +192 -0
- package/build/cjs/src/data-v2-data-item.http.js +944 -0
- package/build/cjs/src/data-v2-data-item.http.js.map +1 -0
- package/build/cjs/src/data-v2-data-item.public.d.ts +28 -0
- package/build/cjs/src/data-v2-data-item.public.js +137 -0
- package/build/cjs/src/data-v2-data-item.public.js.map +1 -0
- package/build/cjs/src/data-v2-data-item.types.d.ts +656 -0
- package/build/cjs/src/data-v2-data-item.types.js +27 -0
- package/build/cjs/src/data-v2-data-item.types.js.map +1 -0
- package/build/cjs/src/data-v2-data-item.universal.d.ts +1343 -0
- package/build/cjs/src/data-v2-data-item.universal.js +1435 -0
- package/build/cjs/src/data-v2-data-item.universal.js.map +1 -0
- package/build/cjs/src/data-v2-index.http.d.ts +29 -0
- package/build/cjs/src/data-v2-index.http.js +349 -0
- package/build/cjs/src/data-v2-index.http.js.map +1 -0
- package/build/cjs/src/data-v2-index.public.d.ts +10 -0
- package/build/cjs/src/data-v2-index.public.js +28 -0
- package/build/cjs/src/data-v2-index.public.js.map +1 -0
- package/build/cjs/src/data-v2-index.types.d.ts +120 -0
- package/build/cjs/src/data-v2-index.types.js +35 -0
- package/build/cjs/src/data-v2-index.types.js.map +1 -0
- package/build/cjs/src/data-v2-index.universal.d.ts +182 -0
- package/build/cjs/src/data-v2-index.universal.js +261 -0
- package/build/cjs/src/data-v2-index.universal.js.map +1 -0
- package/build/es/index.d.ts +4 -0
- package/build/es/index.js +5 -0
- package/build/es/index.js.map +1 -0
- package/build/es/src/data-v1-external-database-connection.http.d.ts +29 -0
- package/build/es/src/data-v1-external-database-connection.http.js +389 -0
- package/build/es/src/data-v1-external-database-connection.http.js.map +1 -0
- package/build/es/src/data-v1-external-database-connection.public.d.ts +11 -0
- package/build/es/src/data-v1-external-database-connection.public.js +28 -0
- package/build/es/src/data-v1-external-database-connection.public.js.map +1 -0
- package/build/es/src/data-v1-external-database-connection.types.d.ts +53 -0
- package/build/es/src/data-v1-external-database-connection.types.js +2 -0
- package/build/es/src/data-v1-external-database-connection.types.js.map +1 -0
- package/build/es/src/data-v1-external-database-connection.universal.d.ts +129 -0
- package/build/es/src/data-v1-external-database-connection.universal.js +307 -0
- package/build/es/src/data-v1-external-database-connection.universal.js.map +1 -0
- package/build/es/src/data-v2-data-collection.http.d.ts +37 -0
- package/build/es/src/data-v2-data-collection.http.js +450 -0
- package/build/es/src/data-v2-data-collection.http.js.map +1 -0
- package/build/es/src/data-v2-data-collection.public.d.ts +12 -0
- package/build/es/src/data-v2-data-collection.public.js +29 -0
- package/build/es/src/data-v2-data-collection.public.js.map +1 -0
- package/build/es/src/data-v2-data-collection.types.d.ts +638 -0
- package/build/es/src/data-v2-data-collection.types.js +140 -0
- package/build/es/src/data-v2-data-collection.types.js.map +1 -0
- package/build/es/src/data-v2-data-collection.universal.d.ts +732 -0
- package/build/es/src/data-v2-data-collection.universal.js +505 -0
- package/build/es/src/data-v2-data-collection.universal.js.map +1 -0
- package/build/es/src/data-v2-data-item.http.d.ts +192 -0
- package/build/es/src/data-v2-data-item.http.js +920 -0
- package/build/es/src/data-v2-data-item.http.js.map +1 -0
- package/build/es/src/data-v2-data-item.public.d.ts +28 -0
- package/build/es/src/data-v2-data-item.public.js +109 -0
- package/build/es/src/data-v2-data-item.public.js.map +1 -0
- package/build/es/src/data-v2-data-item.types.d.ts +656 -0
- package/build/es/src/data-v2-data-item.types.js +24 -0
- package/build/es/src/data-v2-data-item.types.js.map +1 -0
- package/build/es/src/data-v2-data-item.universal.d.ts +1343 -0
- package/build/es/src/data-v2-data-item.universal.js +1392 -0
- package/build/es/src/data-v2-data-item.universal.js.map +1 -0
- package/build/es/src/data-v2-index.http.d.ts +29 -0
- package/build/es/src/data-v2-index.http.js +343 -0
- package/build/es/src/data-v2-index.http.js.map +1 -0
- package/build/es/src/data-v2-index.public.d.ts +10 -0
- package/build/es/src/data-v2-index.public.js +19 -0
- package/build/es/src/data-v2-index.public.js.map +1 -0
- package/build/es/src/data-v2-index.types.d.ts +120 -0
- package/build/es/src/data-v2-index.types.js +32 -0
- package/build/es/src/data-v2-index.types.js.map +1 -0
- package/build/es/src/data-v2-index.universal.d.ts +182 -0
- package/build/es/src/data-v2-index.universal.js +236 -0
- package/build/es/src/data-v2-index.universal.js.map +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1,656 @@
|
|
|
1
|
+
export interface DataItem {
|
|
2
|
+
/** Data item ID. */
|
|
3
|
+
id?: string;
|
|
4
|
+
/**
|
|
5
|
+
* Data item contents.
|
|
6
|
+
*
|
|
7
|
+
* Property-value pairs representing the data item's payload. When retrieving a data item, it also includes the following read-only fields:
|
|
8
|
+
*
|
|
9
|
+
* + `_id`: Item ID.
|
|
10
|
+
* + `_createdDate`: Date and time the item was added to the collection.
|
|
11
|
+
* + `_updatedDate`: Date and time the item was last modified. When the item is first inserted, `_createdDate` and `_updatedDate` have the same value.
|
|
12
|
+
* + `_ownerId`: ID of the user who created the item. Can be modified with site owner permissions.
|
|
13
|
+
*/
|
|
14
|
+
data?: Record<string, any> | null;
|
|
15
|
+
}
|
|
16
|
+
export interface InsertDataItemRequest {
|
|
17
|
+
/** ID of the collection in which to insert the item. */
|
|
18
|
+
dataCollectionId: string;
|
|
19
|
+
/** Item to insert. */
|
|
20
|
+
dataItem: DataItem;
|
|
21
|
+
}
|
|
22
|
+
export declare enum Environment {
|
|
23
|
+
LIVE = "LIVE",
|
|
24
|
+
SANDBOX = "SANDBOX"
|
|
25
|
+
}
|
|
26
|
+
export interface Options {
|
|
27
|
+
}
|
|
28
|
+
export interface PublishPluginOptions {
|
|
29
|
+
showDraftItems?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface InsertDataItemResponse {
|
|
32
|
+
/** Inserted data item. */
|
|
33
|
+
dataItem?: DataItem;
|
|
34
|
+
}
|
|
35
|
+
export interface UpdateDataItemRequest {
|
|
36
|
+
/** ID of the collection containing the existing item. */
|
|
37
|
+
dataCollectionId: string;
|
|
38
|
+
/** Updated data item content. The existing data item's content is replaced entirely. */
|
|
39
|
+
dataItem: DataItem;
|
|
40
|
+
}
|
|
41
|
+
export interface UpdateDataItemResponse {
|
|
42
|
+
/** Updated data item. */
|
|
43
|
+
dataItem?: DataItem;
|
|
44
|
+
}
|
|
45
|
+
export interface SaveDataItemRequest {
|
|
46
|
+
/** ID of the collection in which to insert or update the item. */
|
|
47
|
+
dataCollectionId: string;
|
|
48
|
+
/** Data item to insert or update. */
|
|
49
|
+
dataItem: DataItem;
|
|
50
|
+
}
|
|
51
|
+
export interface SaveDataItemResponse {
|
|
52
|
+
/**
|
|
53
|
+
* The action carried out for the item.
|
|
54
|
+
*
|
|
55
|
+
* + `INSERTED`: A new item was added to the collection.
|
|
56
|
+
* + `UPDATED`: An existing item in the collection was updated.
|
|
57
|
+
*/
|
|
58
|
+
action?: Action;
|
|
59
|
+
/** Inserted or updated data item. */
|
|
60
|
+
dataItem?: DataItem;
|
|
61
|
+
}
|
|
62
|
+
export declare enum Action {
|
|
63
|
+
UNKNOWN_ACTION = "UNKNOWN_ACTION",
|
|
64
|
+
INSERTED = "INSERTED",
|
|
65
|
+
UPDATED = "UPDATED"
|
|
66
|
+
}
|
|
67
|
+
export interface GetDataItemRequest {
|
|
68
|
+
/** ID of the collection from which to retrieve the data item. */
|
|
69
|
+
dataCollectionId: string;
|
|
70
|
+
/** ID of the data item to retrieve. */
|
|
71
|
+
dataItemId: string;
|
|
72
|
+
/**
|
|
73
|
+
* Whether to retrieve data from the primary database instance.
|
|
74
|
+
* This decreases performance but ensures data retrieved is up to date even immediately after an update.
|
|
75
|
+
* Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
|
|
76
|
+
*
|
|
77
|
+
* Default: `false`
|
|
78
|
+
*/
|
|
79
|
+
consistentRead?: boolean;
|
|
80
|
+
}
|
|
81
|
+
export interface GetDataItemResponse {
|
|
82
|
+
/** Retrieved item. */
|
|
83
|
+
dataItem?: DataItem;
|
|
84
|
+
}
|
|
85
|
+
export interface RemoveDataItemRequest {
|
|
86
|
+
/** ID of the collection from which to remove the item. */
|
|
87
|
+
dataCollectionId: string;
|
|
88
|
+
/** ID of the item to remove. */
|
|
89
|
+
dataItemId: string;
|
|
90
|
+
}
|
|
91
|
+
export interface RemoveDataItemResponse {
|
|
92
|
+
/** Removed item. */
|
|
93
|
+
dataItem?: DataItem;
|
|
94
|
+
}
|
|
95
|
+
export interface TruncateDataItemsRequest {
|
|
96
|
+
/** ID of the collection to truncate. */
|
|
97
|
+
dataCollectionId: string;
|
|
98
|
+
}
|
|
99
|
+
export interface TruncateDataItemsResponse {
|
|
100
|
+
}
|
|
101
|
+
export interface QueryDataItemsRequest {
|
|
102
|
+
/** ID of the collection in which to insert the item. */
|
|
103
|
+
dataCollectionId: string;
|
|
104
|
+
/** Query preferences. For more details on using queries, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language). */
|
|
105
|
+
query?: QueryV2;
|
|
106
|
+
/**
|
|
107
|
+
* Whether to return the total count in the response for a query with offset paging.
|
|
108
|
+
* When `true`, the `pagingMetadata` object in the response contains a `total` field.
|
|
109
|
+
*
|
|
110
|
+
* Default: `false`
|
|
111
|
+
*/
|
|
112
|
+
returnTotalCount?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Properties for which to include referenced items in the query's results.
|
|
115
|
+
* Up to 50 referenced items can be included for each item that matches the query.
|
|
116
|
+
*/
|
|
117
|
+
includeReferencedItems?: string[];
|
|
118
|
+
/**
|
|
119
|
+
* Whether to retrieve data from the primary database instance.
|
|
120
|
+
* This decreases performance but ensures data retrieved is up to date even immediately after an update.
|
|
121
|
+
* Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
|
|
122
|
+
*
|
|
123
|
+
* Default: `false`
|
|
124
|
+
*/
|
|
125
|
+
consistentRead?: boolean;
|
|
126
|
+
}
|
|
127
|
+
export interface QueryV2 extends QueryV2PagingMethodOneOf {
|
|
128
|
+
/** Paging options to limit and skip the number of items. */
|
|
129
|
+
paging?: Paging;
|
|
130
|
+
/** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
|
|
131
|
+
cursorPaging?: CursorPaging;
|
|
132
|
+
/**
|
|
133
|
+
* Filter object in the following format:
|
|
134
|
+
*
|
|
135
|
+
* `"filter" : {
|
|
136
|
+
* "fieldName1": "value1",
|
|
137
|
+
* "fieldName2":{"$operator":"value2"}
|
|
138
|
+
* }`
|
|
139
|
+
*
|
|
140
|
+
* Examples of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`
|
|
141
|
+
*/
|
|
142
|
+
filter?: Record<string, any> | null;
|
|
143
|
+
/**
|
|
144
|
+
* Sort object in the following format:
|
|
145
|
+
* `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
|
|
146
|
+
*/
|
|
147
|
+
sort?: Sorting[];
|
|
148
|
+
/** Array of projected fields. A list of specific field names to return. If `fieldsets` are also specified, the union of `fieldsets` and `fields` is returned. */
|
|
149
|
+
fields?: string[];
|
|
150
|
+
}
|
|
151
|
+
/** @oneof */
|
|
152
|
+
export interface QueryV2PagingMethodOneOf {
|
|
153
|
+
/** Paging options to limit and skip the number of items. */
|
|
154
|
+
paging?: Paging;
|
|
155
|
+
/** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
|
|
156
|
+
cursorPaging?: CursorPaging;
|
|
157
|
+
}
|
|
158
|
+
export interface Sorting {
|
|
159
|
+
/** Name of the field to sort by. */
|
|
160
|
+
fieldName?: string;
|
|
161
|
+
/** Sort order. */
|
|
162
|
+
order?: SortOrder;
|
|
163
|
+
}
|
|
164
|
+
export declare enum SortOrder {
|
|
165
|
+
ASC = "ASC",
|
|
166
|
+
DESC = "DESC"
|
|
167
|
+
}
|
|
168
|
+
export interface Paging {
|
|
169
|
+
/** Number of items to load. */
|
|
170
|
+
limit?: number | null;
|
|
171
|
+
/** Number of items to skip in the current sort order. */
|
|
172
|
+
offset?: number | null;
|
|
173
|
+
}
|
|
174
|
+
export interface CursorPaging {
|
|
175
|
+
/** Number of items to load. */
|
|
176
|
+
limit?: number | null;
|
|
177
|
+
/**
|
|
178
|
+
* Pointer to the next or previous page in the list of results.
|
|
179
|
+
*
|
|
180
|
+
* You can get the relevant cursor token
|
|
181
|
+
* from the `pagingMetadata` object in the previous call's response.
|
|
182
|
+
* Not relevant for the first request.
|
|
183
|
+
*/
|
|
184
|
+
cursor?: string | null;
|
|
185
|
+
}
|
|
186
|
+
export interface QueryDataItemsResponse {
|
|
187
|
+
/** Retrieved items. */
|
|
188
|
+
dataItems?: DataItem[];
|
|
189
|
+
/** Paging information. */
|
|
190
|
+
pagingMetadata?: PagingMetadataV2;
|
|
191
|
+
}
|
|
192
|
+
export interface PagingMetadataV2 {
|
|
193
|
+
/** Number of items returned in the response. */
|
|
194
|
+
count?: number | null;
|
|
195
|
+
/** Offset that was requested. */
|
|
196
|
+
offset?: number | null;
|
|
197
|
+
/** Total number of items that match the query. Returned if offset paging is used, `returnTotalCount` is `true` in the request, and `tooManyToCount` is false. */
|
|
198
|
+
total?: number | null;
|
|
199
|
+
/** Whether the server failed to calculate the `total` field. */
|
|
200
|
+
tooManyToCount?: boolean | null;
|
|
201
|
+
/** Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. */
|
|
202
|
+
cursors?: Cursors;
|
|
203
|
+
}
|
|
204
|
+
export interface Cursors {
|
|
205
|
+
/** Cursor pointing to next page in the list of results. */
|
|
206
|
+
next?: string | null;
|
|
207
|
+
/** Cursor pointing to previous page in the list of results. */
|
|
208
|
+
prev?: string | null;
|
|
209
|
+
}
|
|
210
|
+
export interface AggregateDataItemsRequest extends AggregateDataItemsRequestPagingMethodOneOf {
|
|
211
|
+
/** Paging options to limit and skip the number of items. */
|
|
212
|
+
paging?: Paging;
|
|
213
|
+
/** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
|
|
214
|
+
cursorPaging?: CursorPaging;
|
|
215
|
+
/** ID of the collection on which to run the aggregation. */
|
|
216
|
+
dataCollectionId: string;
|
|
217
|
+
/** Filter applied to the collection's data prior to running the aggregation. See [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_the-filter-section) for information on how to structure a filter object. */
|
|
218
|
+
initialFilter?: Record<string, any> | null;
|
|
219
|
+
/** Aggregation applied to the data. */
|
|
220
|
+
aggregation?: Aggregation;
|
|
221
|
+
/** Filter applied to the processed data following the aggregation. See [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_the-filter-section) for information on how to structure a filter object. */
|
|
222
|
+
finalFilter?: Record<string, any> | null;
|
|
223
|
+
/**
|
|
224
|
+
* Sort object in the following format:
|
|
225
|
+
* `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
|
|
226
|
+
*/
|
|
227
|
+
sort?: Sorting[];
|
|
228
|
+
/**
|
|
229
|
+
* Whether to return the total count in the response for a query with offset paging.
|
|
230
|
+
* When `true`, the `pagingMetadata` object in the response contains a `total` field.
|
|
231
|
+
*
|
|
232
|
+
* Default: `false`
|
|
233
|
+
*/
|
|
234
|
+
returnTotalCount?: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* Whether to retrieve data from the primary database instance.
|
|
237
|
+
* This decreases performance but ensures data retrieved is up to date even immediately after an update.
|
|
238
|
+
* Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
|
|
239
|
+
*
|
|
240
|
+
* Default: `false`
|
|
241
|
+
*/
|
|
242
|
+
consistentRead?: boolean;
|
|
243
|
+
}
|
|
244
|
+
/** @oneof */
|
|
245
|
+
export interface AggregateDataItemsRequestPagingMethodOneOf {
|
|
246
|
+
/** Paging options to limit and skip the number of items. */
|
|
247
|
+
paging?: Paging;
|
|
248
|
+
/** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
|
|
249
|
+
cursorPaging?: CursorPaging;
|
|
250
|
+
}
|
|
251
|
+
export interface Average {
|
|
252
|
+
/** Name of the field for which to calculate the average value. */
|
|
253
|
+
itemFieldName?: string;
|
|
254
|
+
}
|
|
255
|
+
export interface Min {
|
|
256
|
+
/** Name of the field for which to calculate the minimum value. */
|
|
257
|
+
itemFieldName?: string;
|
|
258
|
+
}
|
|
259
|
+
export interface Max {
|
|
260
|
+
/** Name of the field for which to calculate the maximum value. */
|
|
261
|
+
itemFieldName?: string;
|
|
262
|
+
}
|
|
263
|
+
export interface Sum {
|
|
264
|
+
/** Name of the field for which to calculate the sum. */
|
|
265
|
+
itemFieldName?: string;
|
|
266
|
+
}
|
|
267
|
+
export interface Count {
|
|
268
|
+
}
|
|
269
|
+
export interface Operation extends OperationCalculateOneOf {
|
|
270
|
+
/** Calculate the average value of a specified field for all items in the grouping. */
|
|
271
|
+
average?: Average;
|
|
272
|
+
/** Calculate the minimum value of a specified field for all items in the grouping. */
|
|
273
|
+
min?: Min;
|
|
274
|
+
/** Calculate the maximum value of a specified field for all items in the grouping. */
|
|
275
|
+
max?: Max;
|
|
276
|
+
/** Calculate the sum of values of a specified field for all items in the grouping. */
|
|
277
|
+
sum?: Sum;
|
|
278
|
+
/** Calculate the number of items in the grouping. */
|
|
279
|
+
itemCount?: Count;
|
|
280
|
+
/** Name of the field containing results of the operation. */
|
|
281
|
+
resultFieldName?: string;
|
|
282
|
+
}
|
|
283
|
+
/** @oneof */
|
|
284
|
+
export interface OperationCalculateOneOf {
|
|
285
|
+
/** Calculate the average value of a specified field for all items in the grouping. */
|
|
286
|
+
average?: Average;
|
|
287
|
+
/** Calculate the minimum value of a specified field for all items in the grouping. */
|
|
288
|
+
min?: Min;
|
|
289
|
+
/** Calculate the maximum value of a specified field for all items in the grouping. */
|
|
290
|
+
max?: Max;
|
|
291
|
+
/** Calculate the sum of values of a specified field for all items in the grouping. */
|
|
292
|
+
sum?: Sum;
|
|
293
|
+
/** Calculate the number of items in the grouping. */
|
|
294
|
+
itemCount?: Count;
|
|
295
|
+
}
|
|
296
|
+
export interface Aggregation {
|
|
297
|
+
/** Fields by which to group items for the aggregation. If empty, the aggregation is carried out on all items in the collection. */
|
|
298
|
+
groupingFields?: string[];
|
|
299
|
+
/** Operations to carry out on the data in each grouping. */
|
|
300
|
+
operations?: Operation[];
|
|
301
|
+
}
|
|
302
|
+
export interface AggregateDataItemsResponse {
|
|
303
|
+
/** Aggregation results. */
|
|
304
|
+
results?: Record<string, any>[] | null;
|
|
305
|
+
/** Paging information. */
|
|
306
|
+
pagingMetadata?: PagingMetadataV2;
|
|
307
|
+
}
|
|
308
|
+
export interface CountDataItemsRequest {
|
|
309
|
+
/** ID of the collection for which to count query results. */
|
|
310
|
+
dataCollectionId: string;
|
|
311
|
+
/**
|
|
312
|
+
* Filter object in the following format:
|
|
313
|
+
*
|
|
314
|
+
* `"filter" : {
|
|
315
|
+
* "fieldName1": "value1",
|
|
316
|
+
* "fieldName2":{"$operator":"value2"}
|
|
317
|
+
* }`.
|
|
318
|
+
*
|
|
319
|
+
* Examples of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`.
|
|
320
|
+
*/
|
|
321
|
+
filter?: Record<string, any> | null;
|
|
322
|
+
/**
|
|
323
|
+
* Whether to retrieve data from the primary database instance.
|
|
324
|
+
* This decreases performance but ensures data retrieved is up to date even immediately after an update.
|
|
325
|
+
* Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
|
|
326
|
+
*
|
|
327
|
+
* Default: `false`
|
|
328
|
+
*/
|
|
329
|
+
consistentRead?: boolean;
|
|
330
|
+
}
|
|
331
|
+
export interface CountDataItemsResponse {
|
|
332
|
+
/** Number of items matching the query. */
|
|
333
|
+
totalCount?: number;
|
|
334
|
+
}
|
|
335
|
+
export interface QueryDistinctValuesRequest extends QueryDistinctValuesRequestPagingMethodOneOf {
|
|
336
|
+
/** Paging options to limit and skip the number of items. */
|
|
337
|
+
paging?: Paging;
|
|
338
|
+
/** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
|
|
339
|
+
cursorPaging?: CursorPaging;
|
|
340
|
+
/** ID of the collection to query. */
|
|
341
|
+
dataCollectionId: string;
|
|
342
|
+
/** Item field name for which to return all distinct values. */
|
|
343
|
+
fieldName?: string;
|
|
344
|
+
/**
|
|
345
|
+
* Filter object in the following format:
|
|
346
|
+
*
|
|
347
|
+
* `"filter" : {
|
|
348
|
+
* "fieldName1": "value1",
|
|
349
|
+
* "fieldName2":{"$operator":"value2"}
|
|
350
|
+
* }`.
|
|
351
|
+
*
|
|
352
|
+
* Examples of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`.
|
|
353
|
+
*/
|
|
354
|
+
filter?: Record<string, any> | null;
|
|
355
|
+
/** Sort order. */
|
|
356
|
+
order?: SortOrder;
|
|
357
|
+
/**
|
|
358
|
+
* Whether to return the total count in the response for a query with offset paging.
|
|
359
|
+
* When `true`, the `pagingMetadata` object in the response contains a `total` field.
|
|
360
|
+
*
|
|
361
|
+
* Default: `false`
|
|
362
|
+
*/
|
|
363
|
+
returnTotalCount?: boolean;
|
|
364
|
+
/**
|
|
365
|
+
* Whether to retrieve data from the primary database instance.
|
|
366
|
+
* This decreases performance but ensures data retrieved is up to date even immediately after an update.
|
|
367
|
+
* Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
|
|
368
|
+
*
|
|
369
|
+
* Default: `false`
|
|
370
|
+
*/
|
|
371
|
+
consistentRead?: boolean;
|
|
372
|
+
}
|
|
373
|
+
/** @oneof */
|
|
374
|
+
export interface QueryDistinctValuesRequestPagingMethodOneOf {
|
|
375
|
+
/** Paging options to limit and skip the number of items. */
|
|
376
|
+
paging?: Paging;
|
|
377
|
+
/** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
|
|
378
|
+
cursorPaging?: CursorPaging;
|
|
379
|
+
}
|
|
380
|
+
export interface QueryDistinctValuesResponse {
|
|
381
|
+
/** List of distinct values contained in the field specified in `fieldName`. */
|
|
382
|
+
distinctValues?: any[];
|
|
383
|
+
/** Paging information. */
|
|
384
|
+
pagingMetadata?: PagingMetadataV2;
|
|
385
|
+
}
|
|
386
|
+
export interface BulkInsertDataItemsRequest {
|
|
387
|
+
/** ID of the collection in which to insert the items. */
|
|
388
|
+
dataCollectionId: string;
|
|
389
|
+
/** Data items to insert. */
|
|
390
|
+
dataItems: DataItem[];
|
|
391
|
+
/**
|
|
392
|
+
* Whether to return the inserted data items.
|
|
393
|
+
* When `true`, the `results` objects contain a `dataItem` field.
|
|
394
|
+
*
|
|
395
|
+
* Default: `false`
|
|
396
|
+
*/
|
|
397
|
+
returnEntity?: boolean;
|
|
398
|
+
}
|
|
399
|
+
export interface BulkInsertDataItemsResponse {
|
|
400
|
+
/** Information about the inserted items. */
|
|
401
|
+
results?: BulkDataItemResult[];
|
|
402
|
+
/** Bulk action metadata. */
|
|
403
|
+
bulkActionMetadata?: BulkActionMetadata;
|
|
404
|
+
}
|
|
405
|
+
export interface BulkDataItemResult {
|
|
406
|
+
/** The action attempted for the data item. */
|
|
407
|
+
action?: BulkActionType;
|
|
408
|
+
/** Metadata related to the data item for which the action was attempted. */
|
|
409
|
+
itemMetadata?: ItemMetadata;
|
|
410
|
+
/** The data item for which the action was attempted. Only returned if `returnEntity` is `true` in the request and the action is successful. */
|
|
411
|
+
dataItem?: DataItem;
|
|
412
|
+
}
|
|
413
|
+
export declare enum BulkActionType {
|
|
414
|
+
UNKNOWN_ACTION_TYPE = "UNKNOWN_ACTION_TYPE",
|
|
415
|
+
INSERT = "INSERT",
|
|
416
|
+
UPDATE = "UPDATE",
|
|
417
|
+
DELETE = "DELETE"
|
|
418
|
+
}
|
|
419
|
+
export interface ItemMetadata {
|
|
420
|
+
/** Item ID. This field doesn't appear if there is no item ID, for example, when item creation fails. */
|
|
421
|
+
id?: string | null;
|
|
422
|
+
/** Index of the item within the request array. Allows for correlation between request and response items. */
|
|
423
|
+
originalIndex?: number;
|
|
424
|
+
/** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */
|
|
425
|
+
success?: boolean;
|
|
426
|
+
/** Details about the error in case of failure. */
|
|
427
|
+
error?: ApplicationError;
|
|
428
|
+
}
|
|
429
|
+
export interface ApplicationError {
|
|
430
|
+
/** Error code. */
|
|
431
|
+
code?: string;
|
|
432
|
+
/** Description of the error. */
|
|
433
|
+
description?: string;
|
|
434
|
+
/** Data related to the error. */
|
|
435
|
+
data?: Record<string, any> | null;
|
|
436
|
+
}
|
|
437
|
+
export interface BulkActionMetadata {
|
|
438
|
+
/** Number of items successfully processed. */
|
|
439
|
+
totalSuccesses?: number;
|
|
440
|
+
/** Number of items that couldn't be processed. */
|
|
441
|
+
totalFailures?: number;
|
|
442
|
+
}
|
|
443
|
+
export interface BulkUpdateDataItemsRequest {
|
|
444
|
+
/** ID of the collection in which to update items. */
|
|
445
|
+
dataCollectionId: string;
|
|
446
|
+
/** Data items to update. */
|
|
447
|
+
dataItems: DataItem[];
|
|
448
|
+
/**
|
|
449
|
+
* Whether to return the updated data items.
|
|
450
|
+
* When `true`, the `results` objects contain a `dataItem` field.
|
|
451
|
+
*
|
|
452
|
+
* Default: `false`
|
|
453
|
+
*/
|
|
454
|
+
returnEntity?: boolean;
|
|
455
|
+
}
|
|
456
|
+
export interface BulkUpdateDataItemsResponse {
|
|
457
|
+
/** Information about the updated items. */
|
|
458
|
+
results?: BulkDataItemResult[];
|
|
459
|
+
/** Bulk action metadata. */
|
|
460
|
+
bulkActionMetadata?: BulkActionMetadata;
|
|
461
|
+
}
|
|
462
|
+
export interface BulkSaveDataItemsRequest {
|
|
463
|
+
/** ID of the collection in which to insert or update the items. */
|
|
464
|
+
dataCollectionId: string;
|
|
465
|
+
/** Data items to insert or update. */
|
|
466
|
+
dataItems: DataItem[];
|
|
467
|
+
/**
|
|
468
|
+
* Whether to return the saved data item.
|
|
469
|
+
* When `true`, the `results` objects contain a `dataItem` field.
|
|
470
|
+
*
|
|
471
|
+
* Default: `false`
|
|
472
|
+
*/
|
|
473
|
+
returnEntity?: boolean;
|
|
474
|
+
}
|
|
475
|
+
export interface BulkSaveDataItemsResponse {
|
|
476
|
+
/** Information about the saved items. */
|
|
477
|
+
results?: BulkDataItemResult[];
|
|
478
|
+
/** Bulk action metadata. */
|
|
479
|
+
bulkActionMetadata?: BulkActionMetadata;
|
|
480
|
+
}
|
|
481
|
+
export interface BulkRemoveDataItemsRequest {
|
|
482
|
+
/** ID of the collection from which to remove the item. */
|
|
483
|
+
dataCollectionId: string;
|
|
484
|
+
/** IDs of data items to remove. */
|
|
485
|
+
dataItemIds: string[];
|
|
486
|
+
}
|
|
487
|
+
export interface BulkRemoveDataItemsResponse {
|
|
488
|
+
/** Information about the removed data items. */
|
|
489
|
+
results?: BulkDataItemResult[];
|
|
490
|
+
/** Bulk action metadata. */
|
|
491
|
+
bulkActionMetadata?: BulkActionMetadata;
|
|
492
|
+
}
|
|
493
|
+
export interface QueryReferencedDataItemsRequest extends QueryReferencedDataItemsRequestPagingMethodOneOf {
|
|
494
|
+
/** Paging options to limit and skip the number of items. */
|
|
495
|
+
paging?: Paging;
|
|
496
|
+
/** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
|
|
497
|
+
cursorPaging?: CursorPaging;
|
|
498
|
+
/** ID of the collection containing the referring item. */
|
|
499
|
+
dataCollectionId: string;
|
|
500
|
+
/** ID of the referring item. */
|
|
501
|
+
referringItemId?: string;
|
|
502
|
+
/** Field containing references in the referring item. */
|
|
503
|
+
referringItemFieldName?: string;
|
|
504
|
+
/** Order of the returned referenced items. Sorted by the date each item was referenced. */
|
|
505
|
+
order?: SortOrder;
|
|
506
|
+
/**
|
|
507
|
+
* Whether to return the total count in the response.
|
|
508
|
+
* When `true`, the `pagingMetadata` object in the response contains a `total` field.
|
|
509
|
+
*
|
|
510
|
+
* Default: `false`
|
|
511
|
+
*/
|
|
512
|
+
returnTotalCount?: boolean;
|
|
513
|
+
/**
|
|
514
|
+
* Whether to retrieve data from the primary database instance.
|
|
515
|
+
* This decreases performance but ensures data retrieved is up to date even immediately after an update.
|
|
516
|
+
* Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
|
|
517
|
+
*
|
|
518
|
+
* Default: `false`
|
|
519
|
+
*/
|
|
520
|
+
consistentRead?: boolean;
|
|
521
|
+
}
|
|
522
|
+
/** @oneof */
|
|
523
|
+
export interface QueryReferencedDataItemsRequestPagingMethodOneOf {
|
|
524
|
+
/** Paging options to limit and skip the number of items. */
|
|
525
|
+
paging?: Paging;
|
|
526
|
+
/** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
|
|
527
|
+
cursorPaging?: CursorPaging;
|
|
528
|
+
}
|
|
529
|
+
export interface QueryReferencedDataItemsResponse {
|
|
530
|
+
/** Referenced items and/or IDs. For successfully resolved references, the referenced data item is returned. For references that can't be resolved, the ID is returned. */
|
|
531
|
+
results?: ReferencedResult[];
|
|
532
|
+
/** Paging information. */
|
|
533
|
+
pagingMetadata?: PagingMetadataV2;
|
|
534
|
+
}
|
|
535
|
+
export interface UnresolvedReference {
|
|
536
|
+
/** ID of the referring item. */
|
|
537
|
+
referringItemId?: string;
|
|
538
|
+
/** Field specified to query for references. */
|
|
539
|
+
referringItemFieldName?: string;
|
|
540
|
+
}
|
|
541
|
+
export interface ReferencedResult extends ReferencedResultEntityOneOf {
|
|
542
|
+
/** Data item referenced. */
|
|
543
|
+
dataItem?: DataItem;
|
|
544
|
+
/** Unresolved reference. Appears instead of the data item when the reference doesn't resolve, for example, when an ID isn't found or if an item is in draft state. */
|
|
545
|
+
unresolvedReference?: UnresolvedReference;
|
|
546
|
+
}
|
|
547
|
+
/** @oneof */
|
|
548
|
+
export interface ReferencedResultEntityOneOf {
|
|
549
|
+
/** Data item referenced. */
|
|
550
|
+
dataItem?: DataItem;
|
|
551
|
+
/** Unresolved reference. Appears instead of the data item when the reference doesn't resolve, for example, when an ID isn't found or if an item is in draft state. */
|
|
552
|
+
unresolvedReference?: UnresolvedReference;
|
|
553
|
+
}
|
|
554
|
+
export interface IsReferencedDataItemRequest {
|
|
555
|
+
/** ID of the collection containing the referring data item. */
|
|
556
|
+
dataCollectionId: string;
|
|
557
|
+
/** Field to check for a reference to the item that may be referenced. */
|
|
558
|
+
referringItemFieldName: string;
|
|
559
|
+
/** ID of the referring item. */
|
|
560
|
+
referringItemId: string;
|
|
561
|
+
/** ID of the item that may be referenced. */
|
|
562
|
+
referencedItemId: string;
|
|
563
|
+
/**
|
|
564
|
+
* Whether to retrieve data from the primary database instance.
|
|
565
|
+
* This decreases performance but ensures data retrieved is up to date even immediately after an update.
|
|
566
|
+
* Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
|
|
567
|
+
*
|
|
568
|
+
* Default: `false`
|
|
569
|
+
*/
|
|
570
|
+
consistentRead?: boolean;
|
|
571
|
+
}
|
|
572
|
+
export interface IsReferencedDataItemResponse {
|
|
573
|
+
/** Whether the specified reference exists. */
|
|
574
|
+
isReferenced?: boolean;
|
|
575
|
+
}
|
|
576
|
+
export interface InsertDataItemReferenceRequest {
|
|
577
|
+
/** ID of the collection in which to insert the reference. */
|
|
578
|
+
dataCollectionId: string;
|
|
579
|
+
/** Reference to insert */
|
|
580
|
+
dataItemReference?: DataItemReference;
|
|
581
|
+
}
|
|
582
|
+
export interface DataItemReference {
|
|
583
|
+
/** Referring item field containing the references to the referenced items. */
|
|
584
|
+
referringItemFieldName?: string;
|
|
585
|
+
/** ID of the referring item. */
|
|
586
|
+
referringItemId?: string;
|
|
587
|
+
/** ID of the referenced item. */
|
|
588
|
+
referencedItemId?: string;
|
|
589
|
+
}
|
|
590
|
+
export interface InsertDataItemReferenceResponse {
|
|
591
|
+
/** Inserted reference. */
|
|
592
|
+
dataItemReference?: DataItemReference;
|
|
593
|
+
}
|
|
594
|
+
export interface RemoveDataItemReferenceRequest {
|
|
595
|
+
/** ID of the collection containing the referring item. */
|
|
596
|
+
dataCollectionId: string;
|
|
597
|
+
/** Reference to remove. */
|
|
598
|
+
dataItemReference: DataItemReference;
|
|
599
|
+
}
|
|
600
|
+
export interface RemoveDataItemReferenceResponse {
|
|
601
|
+
/** Removed reference. */
|
|
602
|
+
dataItemReference?: DataItemReference;
|
|
603
|
+
}
|
|
604
|
+
export interface BulkInsertDataItemReferencesRequest {
|
|
605
|
+
/** ID of the collection containing the referring items. */
|
|
606
|
+
dataCollectionId: string;
|
|
607
|
+
/** References to insert. */
|
|
608
|
+
dataItemReferences: DataItemReference[];
|
|
609
|
+
/**
|
|
610
|
+
* Whether to return the inserted data item references.
|
|
611
|
+
* When `true`, the `results` objects contain a `dataItemReference` field.
|
|
612
|
+
*
|
|
613
|
+
* Default: `false`
|
|
614
|
+
*/
|
|
615
|
+
returnEntity?: boolean;
|
|
616
|
+
}
|
|
617
|
+
export interface BulkInsertDataItemReferencesResponse {
|
|
618
|
+
/** Information about the inserted references. */
|
|
619
|
+
results?: BulkDataItemReferenceResult[];
|
|
620
|
+
/** Bulk action metadata. */
|
|
621
|
+
bulkActionMetadata?: BulkActionMetadata;
|
|
622
|
+
}
|
|
623
|
+
export interface BulkDataItemReferenceResult {
|
|
624
|
+
/** The action attempted for the reference. */
|
|
625
|
+
action?: BulkActionType;
|
|
626
|
+
/** Metadata related to the reference for which the action was attempted. */
|
|
627
|
+
referenceMetadata?: ItemMetadata;
|
|
628
|
+
/** The reference for which the action was attempted. Only returned if `returnEntity` is `true` in the request and the action is successful. */
|
|
629
|
+
dataItemReference?: DataItemReference;
|
|
630
|
+
}
|
|
631
|
+
export interface BulkRemoveDataItemReferencesRequest {
|
|
632
|
+
/** ID of the collection containing the referring items. */
|
|
633
|
+
dataCollectionId: string;
|
|
634
|
+
/** References to remove. */
|
|
635
|
+
dataItemReferences: DataItemReference[];
|
|
636
|
+
}
|
|
637
|
+
export interface BulkRemoveDataItemReferencesResponse {
|
|
638
|
+
/** Information about the removed references. */
|
|
639
|
+
results?: BulkDataItemReferenceResult[];
|
|
640
|
+
/** Bulk action metadata. */
|
|
641
|
+
bulkActionMetadata?: BulkActionMetadata;
|
|
642
|
+
}
|
|
643
|
+
export interface ReplaceDataItemReferencesRequest {
|
|
644
|
+
/** ID of the collection containing the referring item. */
|
|
645
|
+
dataCollectionId: string;
|
|
646
|
+
/** Field containing references in the referring item. */
|
|
647
|
+
referringItemFieldName: string;
|
|
648
|
+
/** ID of the referring item. */
|
|
649
|
+
referringItemId: string;
|
|
650
|
+
/** List of new referenced item IDs to replace the existing ones. */
|
|
651
|
+
newReferencedItemIds?: string[];
|
|
652
|
+
}
|
|
653
|
+
export interface ReplaceDataItemReferencesResponse {
|
|
654
|
+
/** Updated references. */
|
|
655
|
+
dataItemReferences?: DataItemReference[];
|
|
656
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export var Environment;
|
|
2
|
+
(function (Environment) {
|
|
3
|
+
Environment["LIVE"] = "LIVE";
|
|
4
|
+
Environment["SANDBOX"] = "SANDBOX";
|
|
5
|
+
})(Environment || (Environment = {}));
|
|
6
|
+
export var Action;
|
|
7
|
+
(function (Action) {
|
|
8
|
+
Action["UNKNOWN_ACTION"] = "UNKNOWN_ACTION";
|
|
9
|
+
Action["INSERTED"] = "INSERTED";
|
|
10
|
+
Action["UPDATED"] = "UPDATED";
|
|
11
|
+
})(Action || (Action = {}));
|
|
12
|
+
export var SortOrder;
|
|
13
|
+
(function (SortOrder) {
|
|
14
|
+
SortOrder["ASC"] = "ASC";
|
|
15
|
+
SortOrder["DESC"] = "DESC";
|
|
16
|
+
})(SortOrder || (SortOrder = {}));
|
|
17
|
+
export var BulkActionType;
|
|
18
|
+
(function (BulkActionType) {
|
|
19
|
+
BulkActionType["UNKNOWN_ACTION_TYPE"] = "UNKNOWN_ACTION_TYPE";
|
|
20
|
+
BulkActionType["INSERT"] = "INSERT";
|
|
21
|
+
BulkActionType["UPDATE"] = "UPDATE";
|
|
22
|
+
BulkActionType["DELETE"] = "DELETE";
|
|
23
|
+
})(BulkActionType || (BulkActionType = {}));
|
|
24
|
+
//# sourceMappingURL=data-v2-data-item.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-v2-data-item.types.js","sourceRoot":"","sources":["../../../src/data-v2-data-item.types.ts"],"names":[],"mappings":"AAuBA,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,kCAAmB,CAAA;AACrB,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB;AA4CD,MAAM,CAAN,IAAY,MAIX;AAJD,WAAY,MAAM;IAChB,2CAAiC,CAAA;IACjC,+BAAqB,CAAA;IACrB,6BAAmB,CAAA;AACrB,CAAC,EAJW,MAAM,KAAN,MAAM,QAIjB;AA4GD,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,0BAAa,CAAA;AACf,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAgRD,MAAM,CAAN,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,6DAA2C,CAAA;IAC3C,mCAAiB,CAAA;IACjB,mCAAiB,CAAA;IACjB,mCAAiB,CAAA;AACnB,CAAC,EALW,cAAc,KAAd,cAAc,QAKzB"}
|