@wix/data 1.0.8 → 1.0.9
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/src/data-v1-external-database-connection.http.d.ts +1 -1
- package/build/cjs/src/data-v1-external-database-connection.http.js +1 -1
- package/build/cjs/src/data-v1-external-database-connection.universal.d.ts +6 -1
- package/build/cjs/src/data-v1-external-database-connection.universal.js +6 -1
- package/build/cjs/src/data-v1-external-database-connection.universal.js.map +1 -1
- package/build/cjs/src/data-v2-data-collection.universal.d.ts +5 -0
- package/build/cjs/src/data-v2-data-collection.universal.js +5 -0
- package/build/cjs/src/data-v2-data-collection.universal.js.map +1 -1
- package/build/cjs/src/data-v2-data-item.http.d.ts +15 -15
- package/build/cjs/src/data-v2-data-item.http.js +15 -15
- package/build/cjs/src/data-v2-data-item.universal.d.ts +38 -29
- package/build/cjs/src/data-v2-data-item.universal.js +36 -15
- package/build/cjs/src/data-v2-data-item.universal.js.map +1 -1
- package/build/cjs/src/data-v2-index.http.d.ts +3 -3
- package/build/cjs/src/data-v2-index.http.js +3 -3
- package/build/cjs/src/data-v2-index.universal.d.ts +12 -9
- package/build/cjs/src/data-v2-index.universal.js +6 -3
- package/build/cjs/src/data-v2-index.universal.js.map +1 -1
- package/build/es/src/data-v1-external-database-connection.http.d.ts +1 -1
- package/build/es/src/data-v1-external-database-connection.http.js +1 -1
- package/build/es/src/data-v1-external-database-connection.universal.d.ts +6 -1
- package/build/es/src/data-v1-external-database-connection.universal.js +6 -1
- package/build/es/src/data-v1-external-database-connection.universal.js.map +1 -1
- package/build/es/src/data-v2-data-collection.universal.d.ts +5 -0
- package/build/es/src/data-v2-data-collection.universal.js +5 -0
- package/build/es/src/data-v2-data-collection.universal.js.map +1 -1
- package/build/es/src/data-v2-data-item.http.d.ts +15 -15
- package/build/es/src/data-v2-data-item.http.js +15 -15
- package/build/es/src/data-v2-data-item.universal.d.ts +38 -29
- package/build/es/src/data-v2-data-item.universal.js +36 -15
- package/build/es/src/data-v2-data-item.universal.js.map +1 -1
- package/build/es/src/data-v2-index.http.d.ts +3 -3
- package/build/es/src/data-v2-index.http.js +3 -3
- package/build/es/src/data-v2-index.universal.d.ts +12 -9
- package/build/es/src/data-v2-index.universal.js +6 -3
- package/build/es/src/data-v2-index.universal.js.map +1 -1
- package/package.json +2 -2
|
@@ -78,7 +78,6 @@ export interface GetDataItemRequest {
|
|
|
78
78
|
/**
|
|
79
79
|
* Whether to retrieve data from the primary database instance.
|
|
80
80
|
* This decreases performance but ensures data retrieved is up to date even immediately after an update.
|
|
81
|
-
* Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/sdk/data/eventual-consistency).
|
|
82
81
|
*
|
|
83
82
|
* Default: `false`
|
|
84
83
|
*/
|
|
@@ -124,7 +123,6 @@ export interface QueryDataItemsRequest {
|
|
|
124
123
|
/**
|
|
125
124
|
* Whether to retrieve data from the primary database instance.
|
|
126
125
|
* This decreases performance but ensures data retrieved is up to date even immediately after an update.
|
|
127
|
-
* Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/sdk/data/eventual-consistency).
|
|
128
126
|
*
|
|
129
127
|
* Default: `false`
|
|
130
128
|
*/
|
|
@@ -241,7 +239,6 @@ export interface AggregateDataItemsRequest extends AggregateDataItemsRequestPagi
|
|
|
241
239
|
/**
|
|
242
240
|
* Whether to retrieve data from the primary database instance.
|
|
243
241
|
* This decreases performance but ensures data retrieved is up to date even immediately after an update.
|
|
244
|
-
* Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/sdk/data/eventual-consistency).
|
|
245
242
|
*
|
|
246
243
|
* Default: `false`
|
|
247
244
|
*/
|
|
@@ -328,7 +325,6 @@ export interface CountDataItemsRequest {
|
|
|
328
325
|
/**
|
|
329
326
|
* Whether to retrieve data from the primary database instance.
|
|
330
327
|
* This decreases performance but ensures data retrieved is up to date even immediately after an update.
|
|
331
|
-
* Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/sdk/data/eventual-consistency).
|
|
332
328
|
*
|
|
333
329
|
* Default: `false`
|
|
334
330
|
*/
|
|
@@ -370,7 +366,6 @@ export interface QueryDistinctValuesRequest extends QueryDistinctValuesRequestPa
|
|
|
370
366
|
/**
|
|
371
367
|
* Whether to retrieve data from the primary database instance.
|
|
372
368
|
* This decreases performance but ensures data retrieved is up to date even immediately after an update.
|
|
373
|
-
* Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/sdk/data/eventual-consistency).
|
|
374
369
|
*
|
|
375
370
|
* Default: `false`
|
|
376
371
|
*/
|
|
@@ -519,7 +514,6 @@ export interface QueryReferencedDataItemsRequest extends QueryReferencedDataItem
|
|
|
519
514
|
/**
|
|
520
515
|
* Whether to retrieve data from the primary database instance.
|
|
521
516
|
* This decreases performance but ensures data retrieved is up to date even immediately after an update.
|
|
522
|
-
* Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/sdk/data/eventual-consistency).
|
|
523
517
|
*
|
|
524
518
|
* Default: `false`
|
|
525
519
|
*/
|
|
@@ -569,7 +563,6 @@ export interface IsReferencedDataItemRequest {
|
|
|
569
563
|
/**
|
|
570
564
|
* Whether to retrieve data from the primary database instance.
|
|
571
565
|
* This decreases performance but ensures data retrieved is up to date even immediately after an update.
|
|
572
|
-
* Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/sdk/data/eventual-consistency).
|
|
573
566
|
*
|
|
574
567
|
* Default: `false`
|
|
575
568
|
*/
|
|
@@ -665,7 +658,7 @@ export interface ReplaceDataItemReferencesResponse {
|
|
|
665
658
|
*
|
|
666
659
|
*
|
|
667
660
|
* An item can only be inserted into an existing connection.
|
|
668
|
-
* You can create a new collection using the
|
|
661
|
+
* You can create a new collection using the Data Collections API.
|
|
669
662
|
*
|
|
670
663
|
* When an item is inserted into a collection, the item's ID is automatically assigned a random value.
|
|
671
664
|
* You can optionally provide a custom ID in `dataItem.id` when inserting the item.
|
|
@@ -678,6 +671,7 @@ export interface ReplaceDataItemReferencesResponse {
|
|
|
678
671
|
* @requiredField options.dataCollectionId
|
|
679
672
|
* @requiredField options.dataItem
|
|
680
673
|
* @param options - Options for adding an item to a collection.
|
|
674
|
+
* @permissionScope Write Data
|
|
681
675
|
*/
|
|
682
676
|
export declare function insertDataItem(options: InsertDataItemOptions): Promise<InsertDataItemResponse>;
|
|
683
677
|
export interface InsertDataItemOptions {
|
|
@@ -709,6 +703,7 @@ export interface InsertDataItemOptions {
|
|
|
709
703
|
* @requiredField options.dataCollectionId
|
|
710
704
|
* @requiredField options.dataItem
|
|
711
705
|
* @param options - Options for updating an item in a collection.
|
|
706
|
+
* @permissionScope Write Data
|
|
712
707
|
*/
|
|
713
708
|
export declare function updateDataItem(_id: string, options: UpdateDataItemOptions): Promise<UpdateDataItemResponse>;
|
|
714
709
|
export interface UpdateDataItemOptions {
|
|
@@ -751,6 +746,7 @@ export interface UpdateDataItemOptions {
|
|
|
751
746
|
* @requiredField options.dataCollectionId
|
|
752
747
|
* @requiredField options.dataItem
|
|
753
748
|
* @param options - Options for saving an item in a collection.
|
|
749
|
+
* @permissionScope Write Data
|
|
754
750
|
*/
|
|
755
751
|
export declare function saveDataItem(options: SaveDataItemOptions): Promise<SaveDataItemResponse>;
|
|
756
752
|
export interface SaveDataItemOptions {
|
|
@@ -763,7 +759,7 @@ export interface SaveDataItemOptions {
|
|
|
763
759
|
* Retrieves an item from a collection.
|
|
764
760
|
*
|
|
765
761
|
*
|
|
766
|
-
* > **Note**: When calling `getDataItem()` following an update to your collection, the data retrieved may not contain the most recent changes.
|
|
762
|
+
* > **Note**: When calling `getDataItem()` following an update to your collection, the data retrieved may not contain the most recent changes. If you need the most up-to-date data, set `options.consistentRead` to `true`.
|
|
767
763
|
* @param dataItemId - ID of the data item to retrieve.
|
|
768
764
|
* @public
|
|
769
765
|
* @documentationMaturity preview
|
|
@@ -771,6 +767,7 @@ export interface SaveDataItemOptions {
|
|
|
771
767
|
* @requiredField options
|
|
772
768
|
* @requiredField options.dataCollectionId
|
|
773
769
|
* @param options - Options for retrieving an item from a collection.
|
|
770
|
+
* @permissionScope Read Data
|
|
774
771
|
* @returns Retrieved item.
|
|
775
772
|
*/
|
|
776
773
|
export declare function getDataItem(dataItemId: string, options: GetDataItemOptions): Promise<DataItem>;
|
|
@@ -780,7 +777,6 @@ export interface GetDataItemOptions {
|
|
|
780
777
|
/**
|
|
781
778
|
* Whether to retrieve data from the primary database instance.
|
|
782
779
|
* This decreases performance but ensures data retrieved is up to date even immediately after an update.
|
|
783
|
-
* Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/sdk/data/eventual-consistency).
|
|
784
780
|
*
|
|
785
781
|
* Default: `false`
|
|
786
782
|
*/
|
|
@@ -801,6 +797,7 @@ export interface GetDataItemOptions {
|
|
|
801
797
|
* @requiredField options
|
|
802
798
|
* @requiredField options.dataCollectionId
|
|
803
799
|
* @param options - Options for removing an item from a collection.
|
|
800
|
+
* @permissionScope Write Data
|
|
804
801
|
*/
|
|
805
802
|
export declare function removeDataItem(dataItemId: string, options: RemoveDataItemOptions): Promise<RemoveDataItemResponse>;
|
|
806
803
|
export interface RemoveDataItemOptions {
|
|
@@ -820,6 +817,7 @@ export interface RemoveDataItemOptions {
|
|
|
820
817
|
* @requiredField options
|
|
821
818
|
* @requiredField options.dataCollectionId
|
|
822
819
|
* @param options - Options for truncating data items from a collection.
|
|
820
|
+
* @permissionScope Write Data
|
|
823
821
|
*/
|
|
824
822
|
export declare function truncateDataItems(options: TruncateDataItemsOptions): Promise<void>;
|
|
825
823
|
export interface TruncateDataItemsOptions {
|
|
@@ -829,23 +827,23 @@ export interface TruncateDataItemsOptions {
|
|
|
829
827
|
/**
|
|
830
828
|
* Creates a query to retrieve items from a database collection.
|
|
831
829
|
*
|
|
832
|
-
* The `queryDataItems()` function builds a query to retrieve data items from a collection and returns a
|
|
830
|
+
* The `queryDataItems()` function builds a query to retrieve data items from a collection and returns a `DataItemsQueryBuilder` object.
|
|
833
831
|
*
|
|
834
|
-
* The returned object contains the query definition which is typically used to run the query using the
|
|
832
|
+
* The returned object contains the query definition which is typically used to run the query using the `find()` function.
|
|
835
833
|
*
|
|
836
|
-
* You can refine the query by chaining
|
|
834
|
+
* You can refine the query by chaining `DataItemsQueryBuilder` functions onto the query. `DataItemsQueryBuilder` functions enable you to sort, filter, and control the results that `queryDataItems()` returns.
|
|
837
835
|
*
|
|
838
|
-
* The `queryDataItems()` function runs with the following
|
|
836
|
+
* The `queryDataItems()` function runs with the following `DataItemsQueryBuilder` defaults that you can override:
|
|
839
837
|
*
|
|
840
|
-
* +
|
|
841
|
-
* +
|
|
842
|
-
* +
|
|
838
|
+
* + `skip`: 0
|
|
839
|
+
* + `limit`: 50
|
|
840
|
+
* + `descending`: by `_createdDate`
|
|
843
841
|
*
|
|
844
842
|
* The functions that are chained to `queryDataItems()` are applied in the order they are called. For example, if you sort on an `age` field in ascending order and then on a `name` field in descending order, the results are sorted first by the age of the items and then, if there are multiple results with the same age, the items are sorted by name in descending order, per age value.
|
|
845
843
|
*
|
|
846
844
|
* If the collection that you are querying has references to other collections, by default the data from referenced collections is not retrieved. To get the data from referenced items, specify them in the `options.includeReferencedItems` parameter.
|
|
847
845
|
*
|
|
848
|
-
* > **Note**: When calling `queryDataItems()` following an update to your collection, the data retrieved may not contain the most recent changes.
|
|
846
|
+
* > **Note**: When calling `queryDataItems()` following an update to your collection, the data retrieved may not contain the most recent changes. If you need the most up-to-date data, set `options.consistentRead` to `true`.
|
|
849
847
|
*
|
|
850
848
|
*
|
|
851
849
|
* @public
|
|
@@ -853,6 +851,7 @@ export interface TruncateDataItemsOptions {
|
|
|
853
851
|
* @requiredField options.options
|
|
854
852
|
* @requiredField options.options.dataCollectionId
|
|
855
853
|
* @param options - Options for querying data items.
|
|
854
|
+
* @permissionScope Read Data
|
|
856
855
|
*/
|
|
857
856
|
export declare function queryDataItems(options: QueryDataItemsOptions): DataItemsQueryBuilder;
|
|
858
857
|
export interface QueryDataItemsOptions {
|
|
@@ -873,7 +872,6 @@ export interface QueryDataItemsOptions {
|
|
|
873
872
|
/**
|
|
874
873
|
* Whether to retrieve data from the primary database instance.
|
|
875
874
|
* This decreases performance but ensures data retrieved is up to date even immediately after an update.
|
|
876
|
-
* Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/sdk/data/eventual-consistency).
|
|
877
875
|
*
|
|
878
876
|
* Default: `false`
|
|
879
877
|
*/
|
|
@@ -949,6 +947,7 @@ export interface DataItemsQueryBuilder {
|
|
|
949
947
|
* @requiredField options
|
|
950
948
|
* @requiredField options.dataCollectionId
|
|
951
949
|
* @param options - Options for running an aggregation.
|
|
950
|
+
* @permissionScope Read Data
|
|
952
951
|
*/
|
|
953
952
|
export declare function aggregateDataItems(options: AggregateDataItemsOptions): Promise<AggregateDataItemsResponse>;
|
|
954
953
|
export interface AggregateDataItemsOptions extends AggregateDataItemsRequestPagingMethodOneOf {
|
|
@@ -979,7 +978,6 @@ export interface AggregateDataItemsOptions extends AggregateDataItemsRequestPagi
|
|
|
979
978
|
/**
|
|
980
979
|
* Whether to retrieve data from the primary database instance.
|
|
981
980
|
* This decreases performance but ensures data retrieved is up to date even immediately after an update.
|
|
982
|
-
* Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/sdk/data/eventual-consistency).
|
|
983
981
|
*
|
|
984
982
|
* Default: `false`
|
|
985
983
|
*/
|
|
@@ -988,12 +986,13 @@ export interface AggregateDataItemsOptions extends AggregateDataItemsRequestPagi
|
|
|
988
986
|
/**
|
|
989
987
|
* Counts the number of items in a data collection that match the provided filtering preferences.
|
|
990
988
|
*
|
|
991
|
-
* > **Note**: When calling `countDataItems()` following an update to your collection, the result returned may not reflect the most recent changes.
|
|
989
|
+
* > **Note**: When calling `countDataItems()` following an update to your collection, the result returned may not reflect the most recent changes. If you need the most up-to-date data, set `options.consistentRead` to `true`.
|
|
992
990
|
* @public
|
|
993
991
|
* @documentationMaturity preview
|
|
994
992
|
* @requiredField options
|
|
995
993
|
* @requiredField options.dataCollectionId
|
|
996
994
|
* @param options - Options for counting the number of items in a data collection.
|
|
995
|
+
* @permissionScope Read Data
|
|
997
996
|
*/
|
|
998
997
|
export declare function countDataItems(options: CountDataItemsOptions): Promise<CountDataItemsResponse>;
|
|
999
998
|
export interface CountDataItemsOptions {
|
|
@@ -1013,7 +1012,6 @@ export interface CountDataItemsOptions {
|
|
|
1013
1012
|
/**
|
|
1014
1013
|
* Whether to retrieve data from the primary database instance.
|
|
1015
1014
|
* This decreases performance but ensures data retrieved is up to date even immediately after an update.
|
|
1016
|
-
* Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/sdk/data/eventual-consistency).
|
|
1017
1015
|
*
|
|
1018
1016
|
* Default: `false`
|
|
1019
1017
|
*/
|
|
@@ -1023,19 +1021,20 @@ export interface CountDataItemsOptions {
|
|
|
1023
1021
|
* Retrieves a list of distinct values for a given field in all items that match a query, without duplicates.
|
|
1024
1022
|
*
|
|
1025
1023
|
*
|
|
1026
|
-
* As with
|
|
1024
|
+
* As with `queryDataItems()`, this endpoint retrieves items based on the filtering, sorting, and paging preferences you provide.
|
|
1027
1025
|
* However, `queryDistinctValues()` doesn't return all of the full items that match the query.
|
|
1028
1026
|
* Rather, it returns all unique values of the field you specify in `options.fieldName` for items that match the query.
|
|
1029
1027
|
* If more than one item has the same value for that field, that value appears only once.
|
|
1030
1028
|
*
|
|
1031
1029
|
* For more details on using queries, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language).
|
|
1032
1030
|
*
|
|
1033
|
-
* > **Note**: When calling `queryDistinctValues()` following an update to your collection, the data retrieved may not reflect the most recent changes.
|
|
1031
|
+
* > **Note**: When calling `queryDistinctValues()` following an update to your collection, the data retrieved may not reflect the most recent changes. If you need the most up-to-date data, set `options.consistentRead` to `true`.
|
|
1034
1032
|
* @public
|
|
1035
1033
|
* @documentationMaturity preview
|
|
1036
1034
|
* @requiredField options
|
|
1037
1035
|
* @requiredField options.dataCollectionId
|
|
1038
1036
|
* @param options - Options for querying distinct values.
|
|
1037
|
+
* @permissionScope Read Data
|
|
1039
1038
|
*/
|
|
1040
1039
|
export declare function queryDistinctValues(options: QueryDistinctValuesOptions): Promise<QueryDistinctValuesResponse>;
|
|
1041
1040
|
export interface QueryDistinctValuesOptions extends QueryDistinctValuesRequestPagingMethodOneOf {
|
|
@@ -1070,7 +1069,8 @@ export interface QueryDistinctValuesOptions extends QueryDistinctValuesRequestPa
|
|
|
1070
1069
|
/**
|
|
1071
1070
|
* Whether to retrieve data from the primary database instance.
|
|
1072
1071
|
* This decreases performance but ensures data retrieved is up to date even immediately after an update.
|
|
1073
|
-
*
|
|
1072
|
+
*
|
|
1073
|
+
* Default: `false`
|
|
1074
1074
|
*/
|
|
1075
1075
|
consistentRead?: boolean;
|
|
1076
1076
|
}
|
|
@@ -1086,6 +1086,7 @@ export interface QueryDistinctValuesOptions extends QueryDistinctValuesRequestPa
|
|
|
1086
1086
|
* @requiredField options.dataCollectionId
|
|
1087
1087
|
* @requiredField options.dataItems
|
|
1088
1088
|
* @param options - Options for adding multiple items to a collection.
|
|
1089
|
+
* @permissionScope Write Data
|
|
1089
1090
|
*/
|
|
1090
1091
|
export declare function bulkInsertDataItems(options: BulkInsertDataItemsOptions): Promise<BulkInsertDataItemsResponse>;
|
|
1091
1092
|
export interface BulkInsertDataItemsOptions {
|
|
@@ -1121,6 +1122,7 @@ export interface BulkInsertDataItemsOptions {
|
|
|
1121
1122
|
* @requiredField options.dataCollectionId
|
|
1122
1123
|
* @requiredField options.dataItems
|
|
1123
1124
|
* @param options - Options for updating multiple items in a collection.
|
|
1125
|
+
* @permissionScope Write Data
|
|
1124
1126
|
*/
|
|
1125
1127
|
export declare function bulkUpdateDataItems(options: BulkUpdateDataItemsOptions): Promise<BulkUpdateDataItemsResponse>;
|
|
1126
1128
|
export interface BulkUpdateDataItemsOptions {
|
|
@@ -1156,6 +1158,7 @@ export interface BulkUpdateDataItemsOptions {
|
|
|
1156
1158
|
* @requiredField options.dataCollectionId
|
|
1157
1159
|
* @requiredField options.dataItems
|
|
1158
1160
|
* @param options - Options for saving multiple items in a collection.
|
|
1161
|
+
* @permissionScope Write Data
|
|
1159
1162
|
*/
|
|
1160
1163
|
export declare function bulkSaveDataItems(options: BulkSaveDataItemsOptions): Promise<BulkSaveDataItemsResponse>;
|
|
1161
1164
|
export interface BulkSaveDataItemsOptions {
|
|
@@ -1184,6 +1187,7 @@ export interface BulkSaveDataItemsOptions {
|
|
|
1184
1187
|
* @requiredField options.dataCollectionId
|
|
1185
1188
|
* @requiredField options.dataItemIds
|
|
1186
1189
|
* @param options - Options for removing multiple items from a collection.
|
|
1190
|
+
* @permissionScope Write Data
|
|
1187
1191
|
*/
|
|
1188
1192
|
export declare function bulkRemoveDataItems(options: BulkRemoveDataItemsOptions): Promise<BulkRemoveDataItemsResponse>;
|
|
1189
1193
|
export interface BulkRemoveDataItemsOptions {
|
|
@@ -1203,12 +1207,13 @@ export interface BulkRemoveDataItemsOptions {
|
|
|
1203
1207
|
* Querying the **Movies** collection using `queryReferencedDataItems()` returns the relevant **People** items referenced in the **Actors** field of the specified **Movie** item.
|
|
1204
1208
|
* This gives you information from the **People** collection about each of the actors in the specified movie.
|
|
1205
1209
|
*
|
|
1206
|
-
* > **Note**: When calling `queryReferencedDataItems()` following an update to your collection, the data retrieved may not contain the most recent changes.
|
|
1210
|
+
* > **Note**: When calling `queryReferencedDataItems()` following an update to your collection, the data retrieved may not contain the most recent changes. If you need the most up-to-date data, set `options.consistentRead` to `true`.
|
|
1207
1211
|
* @public
|
|
1208
1212
|
* @documentationMaturity preview
|
|
1209
1213
|
* @requiredField options
|
|
1210
1214
|
* @requiredField options.dataCollectionId
|
|
1211
1215
|
* @param options - Options for querying referenced data items.
|
|
1216
|
+
* @permissionScope Read Data
|
|
1212
1217
|
*/
|
|
1213
1218
|
export declare function queryReferencedDataItems(options: QueryReferencedDataItemsOptions): Promise<QueryReferencedDataItemsResponse>;
|
|
1214
1219
|
export interface QueryReferencedDataItemsOptions extends QueryReferencedDataItemsRequestPagingMethodOneOf {
|
|
@@ -1234,7 +1239,6 @@ export interface QueryReferencedDataItemsOptions extends QueryReferencedDataItem
|
|
|
1234
1239
|
/**
|
|
1235
1240
|
* Whether to retrieve data from the primary database instance.
|
|
1236
1241
|
* This decreases performance but ensures data retrieved is up to date even immediately after an update.
|
|
1237
|
-
* Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/sdk/data/eventual-consistency).
|
|
1238
1242
|
*
|
|
1239
1243
|
* Default: `false`
|
|
1240
1244
|
*/
|
|
@@ -1243,7 +1247,7 @@ export interface QueryReferencedDataItemsOptions extends QueryReferencedDataItem
|
|
|
1243
1247
|
/**
|
|
1244
1248
|
* Checks whether a field in a referring item contains a reference to a specified item.
|
|
1245
1249
|
*
|
|
1246
|
-
* > **Note**: When calling `isReferencedDataItem()` following an update to your collection, the result returned may not reflect the most recent changes.
|
|
1250
|
+
* > **Note**: When calling `isReferencedDataItem()` following an update to your collection, the result returned may not reflect the most recent changes. If you need the most up-to-date data, set `options.consistentRead` to `true`.
|
|
1247
1251
|
* @public
|
|
1248
1252
|
* @documentationMaturity preview
|
|
1249
1253
|
* @requiredField options
|
|
@@ -1252,6 +1256,7 @@ export interface QueryReferencedDataItemsOptions extends QueryReferencedDataItem
|
|
|
1252
1256
|
* @requiredField options.referringItemFieldName
|
|
1253
1257
|
* @requiredField options.referringItemId
|
|
1254
1258
|
* @param options - Options for checking whether a field contains a reference to an item.
|
|
1259
|
+
* @permissionScope Read Data
|
|
1255
1260
|
*/
|
|
1256
1261
|
export declare function isReferencedDataItem(options: IsReferencedDataItemOptions): Promise<IsReferencedDataItemResponse>;
|
|
1257
1262
|
export interface IsReferencedDataItemOptions {
|
|
@@ -1266,7 +1271,6 @@ export interface IsReferencedDataItemOptions {
|
|
|
1266
1271
|
/**
|
|
1267
1272
|
* Whether to retrieve data from the primary database instance.
|
|
1268
1273
|
* This decreases performance but ensures data retrieved is up to date even immediately after an update.
|
|
1269
|
-
* Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/sdk/data/eventual-consistency).
|
|
1270
1274
|
*
|
|
1271
1275
|
* Default: `false`
|
|
1272
1276
|
*/
|
|
@@ -1285,6 +1289,7 @@ export interface IsReferencedDataItemOptions {
|
|
|
1285
1289
|
* @requiredField options.dataItemReference.referringItemFieldName
|
|
1286
1290
|
* @requiredField options.dataItemReference.referringItemId
|
|
1287
1291
|
* @param options - Options for inserting a reference.
|
|
1292
|
+
* @permissionScope Write Data
|
|
1288
1293
|
*/
|
|
1289
1294
|
export declare function insertDataItemReference(options: InsertDataItemReferenceOptions): Promise<InsertDataItemReferenceResponse>;
|
|
1290
1295
|
export interface InsertDataItemReferenceOptions {
|
|
@@ -1304,6 +1309,7 @@ export interface InsertDataItemReferenceOptions {
|
|
|
1304
1309
|
* @requiredField options.dataItemReference.referringItemFieldName
|
|
1305
1310
|
* @requiredField options.dataItemReference.referringItemId
|
|
1306
1311
|
* @param options - Options for removing a reference.
|
|
1312
|
+
* @permissionScope Write Data
|
|
1307
1313
|
*/
|
|
1308
1314
|
export declare function removeDataItemReference(options: RemoveDataItemReferenceOptions): Promise<RemoveDataItemReferenceResponse>;
|
|
1309
1315
|
export interface RemoveDataItemReferenceOptions {
|
|
@@ -1327,6 +1333,7 @@ export interface RemoveDataItemReferenceOptions {
|
|
|
1327
1333
|
* @requiredField options.dataItemReferences.referringItemFieldName
|
|
1328
1334
|
* @requiredField options.dataItemReferences.referringItemId
|
|
1329
1335
|
* @param options - Options for inserting one or more references.
|
|
1336
|
+
* @permissionScope Write Data
|
|
1330
1337
|
*/
|
|
1331
1338
|
export declare function bulkInsertDataItemReferences(options: BulkInsertDataItemReferencesOptions): Promise<BulkInsertDataItemReferencesResponse>;
|
|
1332
1339
|
export interface BulkInsertDataItemReferencesOptions {
|
|
@@ -1353,6 +1360,7 @@ export interface BulkInsertDataItemReferencesOptions {
|
|
|
1353
1360
|
* @requiredField options.dataItemReferences.referringItemFieldName
|
|
1354
1361
|
* @requiredField options.dataItemReferences.referringItemId
|
|
1355
1362
|
* @param options - Options for removing one or more references.
|
|
1363
|
+
* @permissionScope Write Data
|
|
1356
1364
|
*/
|
|
1357
1365
|
export declare function bulkRemoveDataItemReferences(options: BulkRemoveDataItemReferencesOptions): Promise<BulkRemoveDataItemReferencesResponse>;
|
|
1358
1366
|
export interface BulkRemoveDataItemReferencesOptions {
|
|
@@ -1376,6 +1384,7 @@ export interface BulkRemoveDataItemReferencesOptions {
|
|
|
1376
1384
|
* @requiredField options.referringItemFieldName
|
|
1377
1385
|
* @requiredField options.referringItemId
|
|
1378
1386
|
* @param options - Options for replacing references.
|
|
1387
|
+
* @permissionScope Write Data
|
|
1379
1388
|
*/
|
|
1380
1389
|
export declare function replaceDataItemReferences(options: ReplaceDataItemReferencesOptions): Promise<ReplaceDataItemReferencesResponse>;
|
|
1381
1390
|
export interface ReplaceDataItemReferencesOptions {
|
|
@@ -118,7 +118,7 @@ const _updateDataItemResponse = {};
|
|
|
118
118
|
*
|
|
119
119
|
*
|
|
120
120
|
* An item can only be inserted into an existing connection.
|
|
121
|
-
* You can create a new collection using the
|
|
121
|
+
* You can create a new collection using the Data Collections API.
|
|
122
122
|
*
|
|
123
123
|
* When an item is inserted into a collection, the item's ID is automatically assigned a random value.
|
|
124
124
|
* You can optionally provide a custom ID in `dataItem.id` when inserting the item.
|
|
@@ -131,6 +131,7 @@ const _updateDataItemResponse = {};
|
|
|
131
131
|
* @requiredField options.dataCollectionId
|
|
132
132
|
* @requiredField options.dataItem
|
|
133
133
|
* @param options - Options for adding an item to a collection.
|
|
134
|
+
* @permissionScope Write Data
|
|
134
135
|
*/
|
|
135
136
|
function insertDataItem(options) {
|
|
136
137
|
var _a, _b, _c;
|
|
@@ -202,6 +203,7 @@ exports.insertDataItem = insertDataItem;
|
|
|
202
203
|
* @requiredField options.dataCollectionId
|
|
203
204
|
* @requiredField options.dataItem
|
|
204
205
|
* @param options - Options for updating an item in a collection.
|
|
206
|
+
* @permissionScope Write Data
|
|
205
207
|
*/
|
|
206
208
|
function updateDataItem(_id, options) {
|
|
207
209
|
var _a, _b, _c;
|
|
@@ -271,6 +273,7 @@ exports.updateDataItem = updateDataItem;
|
|
|
271
273
|
* @requiredField options.dataCollectionId
|
|
272
274
|
* @requiredField options.dataItem
|
|
273
275
|
* @param options - Options for saving an item in a collection.
|
|
276
|
+
* @permissionScope Write Data
|
|
274
277
|
*/
|
|
275
278
|
function saveDataItem(options) {
|
|
276
279
|
var _a, _b, _c;
|
|
@@ -323,7 +326,7 @@ exports.saveDataItem = saveDataItem;
|
|
|
323
326
|
* Retrieves an item from a collection.
|
|
324
327
|
*
|
|
325
328
|
*
|
|
326
|
-
* > **Note**: When calling `getDataItem()` following an update to your collection, the data retrieved may not contain the most recent changes.
|
|
329
|
+
* > **Note**: When calling `getDataItem()` following an update to your collection, the data retrieved may not contain the most recent changes. If you need the most up-to-date data, set `options.consistentRead` to `true`.
|
|
327
330
|
* @param dataItemId - ID of the data item to retrieve.
|
|
328
331
|
* @public
|
|
329
332
|
* @documentationMaturity preview
|
|
@@ -331,6 +334,7 @@ exports.saveDataItem = saveDataItem;
|
|
|
331
334
|
* @requiredField options
|
|
332
335
|
* @requiredField options.dataCollectionId
|
|
333
336
|
* @param options - Options for retrieving an item from a collection.
|
|
337
|
+
* @permissionScope Read Data
|
|
334
338
|
* @returns Retrieved item.
|
|
335
339
|
*/
|
|
336
340
|
function getDataItem(dataItemId, options) {
|
|
@@ -397,6 +401,7 @@ exports.getDataItem = getDataItem;
|
|
|
397
401
|
* @requiredField options
|
|
398
402
|
* @requiredField options.dataCollectionId
|
|
399
403
|
* @param options - Options for removing an item from a collection.
|
|
404
|
+
* @permissionScope Write Data
|
|
400
405
|
*/
|
|
401
406
|
function removeDataItem(dataItemId, options) {
|
|
402
407
|
var _a, _b, _c;
|
|
@@ -459,6 +464,7 @@ exports.removeDataItem = removeDataItem;
|
|
|
459
464
|
* @requiredField options
|
|
460
465
|
* @requiredField options.dataCollectionId
|
|
461
466
|
* @param options - Options for truncating data items from a collection.
|
|
467
|
+
* @permissionScope Write Data
|
|
462
468
|
*/
|
|
463
469
|
function truncateDataItems(options) {
|
|
464
470
|
var _a, _b, _c;
|
|
@@ -507,23 +513,23 @@ exports.truncateDataItems = truncateDataItems;
|
|
|
507
513
|
/**
|
|
508
514
|
* Creates a query to retrieve items from a database collection.
|
|
509
515
|
*
|
|
510
|
-
* The `queryDataItems()` function builds a query to retrieve data items from a collection and returns a
|
|
516
|
+
* The `queryDataItems()` function builds a query to retrieve data items from a collection and returns a `DataItemsQueryBuilder` object.
|
|
511
517
|
*
|
|
512
|
-
* The returned object contains the query definition which is typically used to run the query using the
|
|
518
|
+
* The returned object contains the query definition which is typically used to run the query using the `find()` function.
|
|
513
519
|
*
|
|
514
|
-
* You can refine the query by chaining
|
|
520
|
+
* You can refine the query by chaining `DataItemsQueryBuilder` functions onto the query. `DataItemsQueryBuilder` functions enable you to sort, filter, and control the results that `queryDataItems()` returns.
|
|
515
521
|
*
|
|
516
|
-
* The `queryDataItems()` function runs with the following
|
|
522
|
+
* The `queryDataItems()` function runs with the following `DataItemsQueryBuilder` defaults that you can override:
|
|
517
523
|
*
|
|
518
|
-
* +
|
|
519
|
-
* +
|
|
520
|
-
* +
|
|
524
|
+
* + `skip`: 0
|
|
525
|
+
* + `limit`: 50
|
|
526
|
+
* + `descending`: by `_createdDate`
|
|
521
527
|
*
|
|
522
528
|
* The functions that are chained to `queryDataItems()` are applied in the order they are called. For example, if you sort on an `age` field in ascending order and then on a `name` field in descending order, the results are sorted first by the age of the items and then, if there are multiple results with the same age, the items are sorted by name in descending order, per age value.
|
|
523
529
|
*
|
|
524
530
|
* If the collection that you are querying has references to other collections, by default the data from referenced collections is not retrieved. To get the data from referenced items, specify them in the `options.includeReferencedItems` parameter.
|
|
525
531
|
*
|
|
526
|
-
* > **Note**: When calling `queryDataItems()` following an update to your collection, the data retrieved may not contain the most recent changes.
|
|
532
|
+
* > **Note**: When calling `queryDataItems()` following an update to your collection, the data retrieved may not contain the most recent changes. If you need the most up-to-date data, set `options.consistentRead` to `true`.
|
|
527
533
|
*
|
|
528
534
|
*
|
|
529
535
|
* @public
|
|
@@ -531,6 +537,7 @@ exports.truncateDataItems = truncateDataItems;
|
|
|
531
537
|
* @requiredField options.options
|
|
532
538
|
* @requiredField options.options.dataCollectionId
|
|
533
539
|
* @param options - Options for querying data items.
|
|
540
|
+
* @permissionScope Read Data
|
|
534
541
|
*/
|
|
535
542
|
function queryDataItems(options) {
|
|
536
543
|
const requestTransformation = { '*': '$[1]', query: '$[0]' };
|
|
@@ -595,6 +602,7 @@ exports.queryDataItems = queryDataItems;
|
|
|
595
602
|
* @requiredField options
|
|
596
603
|
* @requiredField options.dataCollectionId
|
|
597
604
|
* @param options - Options for running an aggregation.
|
|
605
|
+
* @permissionScope Read Data
|
|
598
606
|
*/
|
|
599
607
|
function aggregateDataItems(options) {
|
|
600
608
|
var _a, _b, _c;
|
|
@@ -653,12 +661,13 @@ exports.aggregateDataItems = aggregateDataItems;
|
|
|
653
661
|
/**
|
|
654
662
|
* Counts the number of items in a data collection that match the provided filtering preferences.
|
|
655
663
|
*
|
|
656
|
-
* > **Note**: When calling `countDataItems()` following an update to your collection, the result returned may not reflect the most recent changes.
|
|
664
|
+
* > **Note**: When calling `countDataItems()` following an update to your collection, the result returned may not reflect the most recent changes. If you need the most up-to-date data, set `options.consistentRead` to `true`.
|
|
657
665
|
* @public
|
|
658
666
|
* @documentationMaturity preview
|
|
659
667
|
* @requiredField options
|
|
660
668
|
* @requiredField options.dataCollectionId
|
|
661
669
|
* @param options - Options for counting the number of items in a data collection.
|
|
670
|
+
* @permissionScope Read Data
|
|
662
671
|
*/
|
|
663
672
|
function countDataItems(options) {
|
|
664
673
|
var _a, _b, _c;
|
|
@@ -712,19 +721,20 @@ exports.countDataItems = countDataItems;
|
|
|
712
721
|
* Retrieves a list of distinct values for a given field in all items that match a query, without duplicates.
|
|
713
722
|
*
|
|
714
723
|
*
|
|
715
|
-
* As with
|
|
724
|
+
* As with `queryDataItems()`, this endpoint retrieves items based on the filtering, sorting, and paging preferences you provide.
|
|
716
725
|
* However, `queryDistinctValues()` doesn't return all of the full items that match the query.
|
|
717
726
|
* Rather, it returns all unique values of the field you specify in `options.fieldName` for items that match the query.
|
|
718
727
|
* If more than one item has the same value for that field, that value appears only once.
|
|
719
728
|
*
|
|
720
729
|
* For more details on using queries, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language).
|
|
721
730
|
*
|
|
722
|
-
* > **Note**: When calling `queryDistinctValues()` following an update to your collection, the data retrieved may not reflect the most recent changes.
|
|
731
|
+
* > **Note**: When calling `queryDistinctValues()` following an update to your collection, the data retrieved may not reflect the most recent changes. If you need the most up-to-date data, set `options.consistentRead` to `true`.
|
|
723
732
|
* @public
|
|
724
733
|
* @documentationMaturity preview
|
|
725
734
|
* @requiredField options
|
|
726
735
|
* @requiredField options.dataCollectionId
|
|
727
736
|
* @param options - Options for querying distinct values.
|
|
737
|
+
* @permissionScope Read Data
|
|
728
738
|
*/
|
|
729
739
|
function queryDistinctValues(options) {
|
|
730
740
|
var _a, _b, _c;
|
|
@@ -791,6 +801,7 @@ exports.queryDistinctValues = queryDistinctValues;
|
|
|
791
801
|
* @requiredField options.dataCollectionId
|
|
792
802
|
* @requiredField options.dataItems
|
|
793
803
|
* @param options - Options for adding multiple items to a collection.
|
|
804
|
+
* @permissionScope Write Data
|
|
794
805
|
*/
|
|
795
806
|
function bulkInsertDataItems(options) {
|
|
796
807
|
var _a, _b, _c;
|
|
@@ -860,6 +871,7 @@ exports.bulkInsertDataItems = bulkInsertDataItems;
|
|
|
860
871
|
* @requiredField options.dataCollectionId
|
|
861
872
|
* @requiredField options.dataItems
|
|
862
873
|
* @param options - Options for updating multiple items in a collection.
|
|
874
|
+
* @permissionScope Write Data
|
|
863
875
|
*/
|
|
864
876
|
function bulkUpdateDataItems(options) {
|
|
865
877
|
var _a, _b, _c;
|
|
@@ -929,6 +941,7 @@ exports.bulkUpdateDataItems = bulkUpdateDataItems;
|
|
|
929
941
|
* @requiredField options.dataCollectionId
|
|
930
942
|
* @requiredField options.dataItems
|
|
931
943
|
* @param options - Options for saving multiple items in a collection.
|
|
944
|
+
* @permissionScope Write Data
|
|
932
945
|
*/
|
|
933
946
|
function bulkSaveDataItems(options) {
|
|
934
947
|
var _a, _b, _c;
|
|
@@ -991,6 +1004,7 @@ exports.bulkSaveDataItems = bulkSaveDataItems;
|
|
|
991
1004
|
* @requiredField options.dataCollectionId
|
|
992
1005
|
* @requiredField options.dataItemIds
|
|
993
1006
|
* @param options - Options for removing multiple items from a collection.
|
|
1007
|
+
* @permissionScope Write Data
|
|
994
1008
|
*/
|
|
995
1009
|
function bulkRemoveDataItems(options) {
|
|
996
1010
|
var _a, _b, _c;
|
|
@@ -1050,12 +1064,13 @@ exports.bulkRemoveDataItems = bulkRemoveDataItems;
|
|
|
1050
1064
|
* Querying the **Movies** collection using `queryReferencedDataItems()` returns the relevant **People** items referenced in the **Actors** field of the specified **Movie** item.
|
|
1051
1065
|
* This gives you information from the **People** collection about each of the actors in the specified movie.
|
|
1052
1066
|
*
|
|
1053
|
-
* > **Note**: When calling `queryReferencedDataItems()` following an update to your collection, the data retrieved may not contain the most recent changes.
|
|
1067
|
+
* > **Note**: When calling `queryReferencedDataItems()` following an update to your collection, the data retrieved may not contain the most recent changes. If you need the most up-to-date data, set `options.consistentRead` to `true`.
|
|
1054
1068
|
* @public
|
|
1055
1069
|
* @documentationMaturity preview
|
|
1056
1070
|
* @requiredField options
|
|
1057
1071
|
* @requiredField options.dataCollectionId
|
|
1058
1072
|
* @param options - Options for querying referenced data items.
|
|
1073
|
+
* @permissionScope Read Data
|
|
1059
1074
|
*/
|
|
1060
1075
|
function queryReferencedDataItems(options) {
|
|
1061
1076
|
var _a, _b, _c;
|
|
@@ -1113,7 +1128,7 @@ exports.queryReferencedDataItems = queryReferencedDataItems;
|
|
|
1113
1128
|
/**
|
|
1114
1129
|
* Checks whether a field in a referring item contains a reference to a specified item.
|
|
1115
1130
|
*
|
|
1116
|
-
* > **Note**: When calling `isReferencedDataItem()` following an update to your collection, the result returned may not reflect the most recent changes.
|
|
1131
|
+
* > **Note**: When calling `isReferencedDataItem()` following an update to your collection, the result returned may not reflect the most recent changes. If you need the most up-to-date data, set `options.consistentRead` to `true`.
|
|
1117
1132
|
* @public
|
|
1118
1133
|
* @documentationMaturity preview
|
|
1119
1134
|
* @requiredField options
|
|
@@ -1122,6 +1137,7 @@ exports.queryReferencedDataItems = queryReferencedDataItems;
|
|
|
1122
1137
|
* @requiredField options.referringItemFieldName
|
|
1123
1138
|
* @requiredField options.referringItemId
|
|
1124
1139
|
* @param options - Options for checking whether a field contains a reference to an item.
|
|
1140
|
+
* @permissionScope Read Data
|
|
1125
1141
|
*/
|
|
1126
1142
|
function isReferencedDataItem(options) {
|
|
1127
1143
|
var _a, _b, _c;
|
|
@@ -1186,6 +1202,7 @@ exports.isReferencedDataItem = isReferencedDataItem;
|
|
|
1186
1202
|
* @requiredField options.dataItemReference.referringItemFieldName
|
|
1187
1203
|
* @requiredField options.dataItemReference.referringItemId
|
|
1188
1204
|
* @param options - Options for inserting a reference.
|
|
1205
|
+
* @permissionScope Write Data
|
|
1189
1206
|
*/
|
|
1190
1207
|
function insertDataItemReference(options) {
|
|
1191
1208
|
var _a, _b, _c;
|
|
@@ -1245,6 +1262,7 @@ exports.insertDataItemReference = insertDataItemReference;
|
|
|
1245
1262
|
* @requiredField options.dataItemReference.referringItemFieldName
|
|
1246
1263
|
* @requiredField options.dataItemReference.referringItemId
|
|
1247
1264
|
* @param options - Options for removing a reference.
|
|
1265
|
+
* @permissionScope Write Data
|
|
1248
1266
|
*/
|
|
1249
1267
|
function removeDataItemReference(options) {
|
|
1250
1268
|
var _a, _b, _c;
|
|
@@ -1308,6 +1326,7 @@ exports.removeDataItemReference = removeDataItemReference;
|
|
|
1308
1326
|
* @requiredField options.dataItemReferences.referringItemFieldName
|
|
1309
1327
|
* @requiredField options.dataItemReferences.referringItemId
|
|
1310
1328
|
* @param options - Options for inserting one or more references.
|
|
1329
|
+
* @permissionScope Write Data
|
|
1311
1330
|
*/
|
|
1312
1331
|
function bulkInsertDataItemReferences(options) {
|
|
1313
1332
|
var _a, _b, _c;
|
|
@@ -1368,6 +1387,7 @@ exports.bulkInsertDataItemReferences = bulkInsertDataItemReferences;
|
|
|
1368
1387
|
* @requiredField options.dataItemReferences.referringItemFieldName
|
|
1369
1388
|
* @requiredField options.dataItemReferences.referringItemId
|
|
1370
1389
|
* @param options - Options for removing one or more references.
|
|
1390
|
+
* @permissionScope Write Data
|
|
1371
1391
|
*/
|
|
1372
1392
|
function bulkRemoveDataItemReferences(options) {
|
|
1373
1393
|
var _a, _b, _c;
|
|
@@ -1431,6 +1451,7 @@ exports.bulkRemoveDataItemReferences = bulkRemoveDataItemReferences;
|
|
|
1431
1451
|
* @requiredField options.referringItemFieldName
|
|
1432
1452
|
* @requiredField options.referringItemId
|
|
1433
1453
|
* @param options - Options for replacing references.
|
|
1454
|
+
* @permissionScope Write Data
|
|
1434
1455
|
*/
|
|
1435
1456
|
function replaceDataItemReferences(options) {
|
|
1436
1457
|
var _a, _b, _c;
|