@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,182 @@
|
|
|
1
|
+
export declare const __debug: {
|
|
2
|
+
verboseLogging: {
|
|
3
|
+
on: () => boolean;
|
|
4
|
+
off: () => boolean;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
/** An index is a map of a collection's data, organized according to specific fields to increase query speed. */
|
|
8
|
+
export interface Index {
|
|
9
|
+
/** Name of the index. */
|
|
10
|
+
name?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Fields for which the index is defined.
|
|
13
|
+
*
|
|
14
|
+
* Max: 3 fields (for a unique index: 1 field)
|
|
15
|
+
*/
|
|
16
|
+
fields?: Field[];
|
|
17
|
+
/**
|
|
18
|
+
* Current status of the index.
|
|
19
|
+
* - `BUILDING`: Index creation is in progress.
|
|
20
|
+
* - `ACTIVE`: Index has been successfully created and can be used in queries.
|
|
21
|
+
* - `DROPPING`: Index is in the process of being dropped.
|
|
22
|
+
* - `DROPPED`: Index has been dropped successfully.
|
|
23
|
+
* - `FAILED`: Index creation has failed.
|
|
24
|
+
* - `INVALID`: Index contains incorrectly indexed data.
|
|
25
|
+
* @readonly
|
|
26
|
+
*/
|
|
27
|
+
status?: Status;
|
|
28
|
+
/**
|
|
29
|
+
* Contains details about the reasons for failure when `status` is `FAILED`.
|
|
30
|
+
* @readonly
|
|
31
|
+
*/
|
|
32
|
+
failure?: Failure;
|
|
33
|
+
/**
|
|
34
|
+
* Whether the index enforces uniqueness of values in the field for which it is defined.
|
|
35
|
+
* If `true`, the index can have only one field.
|
|
36
|
+
*
|
|
37
|
+
* Default: `false`
|
|
38
|
+
*/
|
|
39
|
+
unique?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the index ignores case.
|
|
42
|
+
*
|
|
43
|
+
* Default: `false`
|
|
44
|
+
*/
|
|
45
|
+
caseInsensitive?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Order determines how values are ordered in the index. This is important when
|
|
49
|
+
* ordering and/or range querying by indexed fields.
|
|
50
|
+
*/
|
|
51
|
+
export declare enum Order {
|
|
52
|
+
ASC = "ASC",
|
|
53
|
+
DESC = "DESC"
|
|
54
|
+
}
|
|
55
|
+
export interface Field {
|
|
56
|
+
/** Path of the field to index. For example: `title` or `options.price`. */
|
|
57
|
+
path?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Sort order for the index. Base on how the data is regularly queried.
|
|
60
|
+
*
|
|
61
|
+
* Default: `ASC`
|
|
62
|
+
*/
|
|
63
|
+
order?: Order;
|
|
64
|
+
}
|
|
65
|
+
export declare enum Status {
|
|
66
|
+
/** Place holder. Never returned by the service. */
|
|
67
|
+
UNKNOWN = "UNKNOWN",
|
|
68
|
+
/** Index creation is in progress. */
|
|
69
|
+
BUILDING = "BUILDING",
|
|
70
|
+
/** Index has been successfully created and can be used in queries. */
|
|
71
|
+
ACTIVE = "ACTIVE",
|
|
72
|
+
/** Index is in the process of being dropped. */
|
|
73
|
+
DROPPING = "DROPPING",
|
|
74
|
+
/** Index has been dropped successfully. */
|
|
75
|
+
DROPPED = "DROPPED",
|
|
76
|
+
/** Index creation has failed. */
|
|
77
|
+
FAILED = "FAILED",
|
|
78
|
+
/** Index contains incorrectly indexed data. */
|
|
79
|
+
INVALID = "INVALID"
|
|
80
|
+
}
|
|
81
|
+
export interface Failure {
|
|
82
|
+
/**
|
|
83
|
+
* Error code.
|
|
84
|
+
* - `WDE0112`: Unknown error while building collection index.
|
|
85
|
+
* - `WDE0113`: Duplicate key error while building collection index.
|
|
86
|
+
* - `WDE0114`: Document too large while building collection index.
|
|
87
|
+
*/
|
|
88
|
+
code?: string;
|
|
89
|
+
/** Description of the failure. */
|
|
90
|
+
description?: string;
|
|
91
|
+
/**
|
|
92
|
+
* ID of the data item that caused the failure.
|
|
93
|
+
* For example, if `unique` is `true`, the ID of an item containing a duplicate value.
|
|
94
|
+
*/
|
|
95
|
+
itemId?: string | null;
|
|
96
|
+
}
|
|
97
|
+
export interface CreateIndexRequest {
|
|
98
|
+
/** Details of the index to be created. */
|
|
99
|
+
index: Index;
|
|
100
|
+
/** ID of the [data collection](https://dev.wix.com/api/rest/wix-data/wix-data/data-collections) for which to generate the index. */
|
|
101
|
+
dataCollectionId?: string;
|
|
102
|
+
}
|
|
103
|
+
export declare enum Environment {
|
|
104
|
+
LIVE = "LIVE",
|
|
105
|
+
SANDBOX = "SANDBOX"
|
|
106
|
+
}
|
|
107
|
+
export interface CreateIndexResponse {
|
|
108
|
+
/** Details of the index being generated. */
|
|
109
|
+
index?: Index;
|
|
110
|
+
}
|
|
111
|
+
export interface DropIndexRequest {
|
|
112
|
+
/** Name of the index to drop. */
|
|
113
|
+
indexName: string;
|
|
114
|
+
/** ID of the [data collection](https://dev.wix.com/api/rest/wix-data/wix-data/data-collections) for which the index to be dropped is defined. */
|
|
115
|
+
dataCollectionId?: string;
|
|
116
|
+
}
|
|
117
|
+
export interface DropIndexResponse {
|
|
118
|
+
}
|
|
119
|
+
export interface ListIndexesRequest {
|
|
120
|
+
/** ID of the [data collection](https://dev.wix.com/api/rest/wix-data/wix-data/data-collections) for which to list indexes. */
|
|
121
|
+
dataCollectionId?: string;
|
|
122
|
+
}
|
|
123
|
+
export interface ListIndexesResponse {
|
|
124
|
+
/** List of all indexes for the requested data collection. */
|
|
125
|
+
indexes?: Index[];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Creates an index for a data collection.
|
|
129
|
+
*
|
|
130
|
+
* The index can't be used immediately, as the process of generating the index takes time.
|
|
131
|
+
* You can check whether your index is ready using the [List Indexes](https://dev.wix.com/api/rest/wix-data/wix-data/indexes/list-indexes) endpoint.
|
|
132
|
+
*
|
|
133
|
+
* Note that when an index fails to create, the failed index still occupies a slot.
|
|
134
|
+
* To remove the failed index and free up the slot for a new index, use the Drop Index endpoint.
|
|
135
|
+
* @public
|
|
136
|
+
* @documentationMaturity preview
|
|
137
|
+
* @requiredField options
|
|
138
|
+
* @requiredField options.index
|
|
139
|
+
* @requiredField options.index.fields
|
|
140
|
+
* @requiredField options.index.fields.path
|
|
141
|
+
* @requiredField options.index.name
|
|
142
|
+
*/
|
|
143
|
+
export declare function createIndex(options: CreateIndexOptions): Promise<CreateIndexResponse>;
|
|
144
|
+
export interface CreateIndexOptions {
|
|
145
|
+
/** Details of the index to be created. */
|
|
146
|
+
index: Index;
|
|
147
|
+
/** ID of the [data collection](https://dev.wix.com/api/rest/wix-data/wix-data/data-collections) for which to generate the index. */
|
|
148
|
+
dataCollectionId?: string;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Removes an index from a data collection.
|
|
152
|
+
*
|
|
153
|
+
* The process of dropping an index from a collection takes time.
|
|
154
|
+
* You can check whether your index has been dropped by using the [List Indexes](https://dev.wix.com/api/rest/wix-data/wix-data/indexes/list-indexes) endpoint.
|
|
155
|
+
* @public
|
|
156
|
+
* @documentationMaturity preview
|
|
157
|
+
* @requiredField options
|
|
158
|
+
* @requiredField options.indexName
|
|
159
|
+
*/
|
|
160
|
+
export declare function dropIndex(options: DropIndexOptions): Promise<void>;
|
|
161
|
+
export interface DropIndexOptions {
|
|
162
|
+
/** Name of the index to drop. */
|
|
163
|
+
indexName: string;
|
|
164
|
+
/** ID of the [data collection](https://dev.wix.com/api/rest/wix-data/wix-data/data-collections) for which the index to be dropped is defined. */
|
|
165
|
+
dataCollectionId?: string;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Lists all indexes defined for a data collection.
|
|
169
|
+
*
|
|
170
|
+
* When an index's status is `ACTIVE`, it is ready to use.
|
|
171
|
+
* While it is still being created, its status is `BUILDING`.
|
|
172
|
+
*
|
|
173
|
+
* When an index's status is `DROPPED`, it has been dropped successfully.
|
|
174
|
+
* While it is still in the process of being removed, its status is `DROPPING`.
|
|
175
|
+
* @public
|
|
176
|
+
* @documentationMaturity preview
|
|
177
|
+
*/
|
|
178
|
+
export declare function listIndexes(options?: ListIndexesOptions): Promise<ListIndexesResponse>;
|
|
179
|
+
export interface ListIndexesOptions {
|
|
180
|
+
/** ID of the [data collection](https://dev.wix.com/api/rest/wix-data/wix-data/data-collections) for which to list indexes. */
|
|
181
|
+
dataCollectionId?: string;
|
|
182
|
+
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { serializer, transformError } from '@wix/metro-runtime/velo';
|
|
11
|
+
import * as ambassadorWixDataV2Index from './data-v2-index.http';
|
|
12
|
+
let __verbose = false;
|
|
13
|
+
function __log(...args) {
|
|
14
|
+
__verbose && console.log(...args);
|
|
15
|
+
}
|
|
16
|
+
function __inspect(obj) {
|
|
17
|
+
return obj;
|
|
18
|
+
}
|
|
19
|
+
export const __debug = {
|
|
20
|
+
verboseLogging: {
|
|
21
|
+
on: () => (__verbose = true),
|
|
22
|
+
off: () => (__verbose = false),
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
const _toVeloEntity = '$';
|
|
26
|
+
const _fromVeloEntity = '$';
|
|
27
|
+
/**
|
|
28
|
+
* Order determines how values are ordered in the index. This is important when
|
|
29
|
+
* ordering and/or range querying by indexed fields.
|
|
30
|
+
*/
|
|
31
|
+
export var Order;
|
|
32
|
+
(function (Order) {
|
|
33
|
+
Order["ASC"] = "ASC";
|
|
34
|
+
Order["DESC"] = "DESC";
|
|
35
|
+
})(Order || (Order = {}));
|
|
36
|
+
export var Status;
|
|
37
|
+
(function (Status) {
|
|
38
|
+
/** Place holder. Never returned by the service. */
|
|
39
|
+
Status["UNKNOWN"] = "UNKNOWN";
|
|
40
|
+
/** Index creation is in progress. */
|
|
41
|
+
Status["BUILDING"] = "BUILDING";
|
|
42
|
+
/** Index has been successfully created and can be used in queries. */
|
|
43
|
+
Status["ACTIVE"] = "ACTIVE";
|
|
44
|
+
/** Index is in the process of being dropped. */
|
|
45
|
+
Status["DROPPING"] = "DROPPING";
|
|
46
|
+
/** Index has been dropped successfully. */
|
|
47
|
+
Status["DROPPED"] = "DROPPED";
|
|
48
|
+
/** Index creation has failed. */
|
|
49
|
+
Status["FAILED"] = "FAILED";
|
|
50
|
+
/** Index contains incorrectly indexed data. */
|
|
51
|
+
Status["INVALID"] = "INVALID";
|
|
52
|
+
})(Status || (Status = {}));
|
|
53
|
+
export var Environment;
|
|
54
|
+
(function (Environment) {
|
|
55
|
+
Environment["LIVE"] = "LIVE";
|
|
56
|
+
Environment["SANDBOX"] = "SANDBOX";
|
|
57
|
+
})(Environment || (Environment = {}));
|
|
58
|
+
const _createIndexRequest = {};
|
|
59
|
+
const _createIndexResponse = {};
|
|
60
|
+
const _dropIndexRequest = {};
|
|
61
|
+
const _dropIndexResponse = {};
|
|
62
|
+
const _listIndexesRequest = {};
|
|
63
|
+
const _listIndexesResponse = {};
|
|
64
|
+
/**
|
|
65
|
+
* Creates an index for a data collection.
|
|
66
|
+
*
|
|
67
|
+
* The index can't be used immediately, as the process of generating the index takes time.
|
|
68
|
+
* You can check whether your index is ready using the [List Indexes](https://dev.wix.com/api/rest/wix-data/wix-data/indexes/list-indexes) endpoint.
|
|
69
|
+
*
|
|
70
|
+
* Note that when an index fails to create, the failed index still occupies a slot.
|
|
71
|
+
* To remove the failed index and free up the slot for a new index, use the Drop Index endpoint.
|
|
72
|
+
* @public
|
|
73
|
+
* @documentationMaturity preview
|
|
74
|
+
* @requiredField options
|
|
75
|
+
* @requiredField options.index
|
|
76
|
+
* @requiredField options.index.fields
|
|
77
|
+
* @requiredField options.index.fields.path
|
|
78
|
+
* @requiredField options.index.name
|
|
79
|
+
*/
|
|
80
|
+
export function createIndex(options) {
|
|
81
|
+
var _a, _b, _c;
|
|
82
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
83
|
+
const requestTransformation = {
|
|
84
|
+
index: '$[0].index',
|
|
85
|
+
dataCollectionId: '$[0].dataCollectionId',
|
|
86
|
+
};
|
|
87
|
+
const responseTransformation = '$';
|
|
88
|
+
// @ts-ignore
|
|
89
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
90
|
+
const { toAmbassadorRequest } = serializer({
|
|
91
|
+
rootSchema: _createIndexRequest,
|
|
92
|
+
depSchemas: {},
|
|
93
|
+
fqdnTransformation: {
|
|
94
|
+
paths: [...['index']],
|
|
95
|
+
transformation: _fromVeloEntity,
|
|
96
|
+
},
|
|
97
|
+
customTransformation: requestTransformation,
|
|
98
|
+
});
|
|
99
|
+
const { fromJSON } = serializer({
|
|
100
|
+
rootSchema: _createIndexResponse,
|
|
101
|
+
depSchemas: {},
|
|
102
|
+
fqdnTransformation: {
|
|
103
|
+
paths: [...['index']],
|
|
104
|
+
transformation: _toVeloEntity,
|
|
105
|
+
},
|
|
106
|
+
customTransformation: responseTransformation,
|
|
107
|
+
});
|
|
108
|
+
const payload = toAmbassadorRequest([options]);
|
|
109
|
+
const reqOpts = ambassadorWixDataV2Index.createIndex(payload);
|
|
110
|
+
__log(`"CreateIndex" sending request with: ${__inspect(reqOpts)}`);
|
|
111
|
+
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
112
|
+
try {
|
|
113
|
+
const result = yield httpClient.request(reqOpts);
|
|
114
|
+
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
115
|
+
return fromJSON(result.data);
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
const transformedError = transformError(err, requestTransformation, [
|
|
119
|
+
'options',
|
|
120
|
+
]);
|
|
121
|
+
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
122
|
+
throw transformedError;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Removes an index from a data collection.
|
|
128
|
+
*
|
|
129
|
+
* The process of dropping an index from a collection takes time.
|
|
130
|
+
* You can check whether your index has been dropped by using the [List Indexes](https://dev.wix.com/api/rest/wix-data/wix-data/indexes/list-indexes) endpoint.
|
|
131
|
+
* @public
|
|
132
|
+
* @documentationMaturity preview
|
|
133
|
+
* @requiredField options
|
|
134
|
+
* @requiredField options.indexName
|
|
135
|
+
*/
|
|
136
|
+
export function dropIndex(options) {
|
|
137
|
+
var _a, _b, _c;
|
|
138
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
139
|
+
const requestTransformation = {
|
|
140
|
+
indexName: '$[0].indexName',
|
|
141
|
+
dataCollectionId: '$[0].dataCollectionId',
|
|
142
|
+
};
|
|
143
|
+
const responseTransformation = '$';
|
|
144
|
+
// @ts-ignore
|
|
145
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
146
|
+
const { toAmbassadorRequest } = serializer({
|
|
147
|
+
rootSchema: _dropIndexRequest,
|
|
148
|
+
depSchemas: {},
|
|
149
|
+
fqdnTransformation: {
|
|
150
|
+
paths: [],
|
|
151
|
+
transformation: _fromVeloEntity,
|
|
152
|
+
},
|
|
153
|
+
customTransformation: requestTransformation,
|
|
154
|
+
});
|
|
155
|
+
const { fromJSON } = serializer({
|
|
156
|
+
rootSchema: _dropIndexResponse,
|
|
157
|
+
depSchemas: {},
|
|
158
|
+
fqdnTransformation: {
|
|
159
|
+
paths: [],
|
|
160
|
+
transformation: _toVeloEntity,
|
|
161
|
+
},
|
|
162
|
+
customTransformation: responseTransformation,
|
|
163
|
+
});
|
|
164
|
+
const payload = toAmbassadorRequest([options]);
|
|
165
|
+
const reqOpts = ambassadorWixDataV2Index.dropIndex(payload);
|
|
166
|
+
__log(`"DropIndex" sending request with: ${__inspect(reqOpts)}`);
|
|
167
|
+
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
168
|
+
try {
|
|
169
|
+
const result = yield httpClient.request(reqOpts);
|
|
170
|
+
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
171
|
+
return fromJSON(result.data);
|
|
172
|
+
}
|
|
173
|
+
catch (err) {
|
|
174
|
+
const transformedError = transformError(err, requestTransformation, [
|
|
175
|
+
'options',
|
|
176
|
+
]);
|
|
177
|
+
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
178
|
+
throw transformedError;
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Lists all indexes defined for a data collection.
|
|
184
|
+
*
|
|
185
|
+
* When an index's status is `ACTIVE`, it is ready to use.
|
|
186
|
+
* While it is still being created, its status is `BUILDING`.
|
|
187
|
+
*
|
|
188
|
+
* When an index's status is `DROPPED`, it has been dropped successfully.
|
|
189
|
+
* While it is still in the process of being removed, its status is `DROPPING`.
|
|
190
|
+
* @public
|
|
191
|
+
* @documentationMaturity preview
|
|
192
|
+
*/
|
|
193
|
+
export function listIndexes(options) {
|
|
194
|
+
var _a, _b, _c;
|
|
195
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
196
|
+
const requestTransformation = { dataCollectionId: '$[0].dataCollectionId' };
|
|
197
|
+
const responseTransformation = '$';
|
|
198
|
+
// @ts-ignore
|
|
199
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
200
|
+
const { toAmbassadorRequest } = serializer({
|
|
201
|
+
rootSchema: _listIndexesRequest,
|
|
202
|
+
depSchemas: {},
|
|
203
|
+
fqdnTransformation: {
|
|
204
|
+
paths: [],
|
|
205
|
+
transformation: _fromVeloEntity,
|
|
206
|
+
},
|
|
207
|
+
customTransformation: requestTransformation,
|
|
208
|
+
});
|
|
209
|
+
const { fromJSON } = serializer({
|
|
210
|
+
rootSchema: _listIndexesResponse,
|
|
211
|
+
depSchemas: {},
|
|
212
|
+
fqdnTransformation: {
|
|
213
|
+
paths: [...['Array#indexes']],
|
|
214
|
+
transformation: _toVeloEntity,
|
|
215
|
+
},
|
|
216
|
+
customTransformation: responseTransformation,
|
|
217
|
+
});
|
|
218
|
+
const payload = toAmbassadorRequest([options]);
|
|
219
|
+
const reqOpts = ambassadorWixDataV2Index.listIndexes(payload);
|
|
220
|
+
__log(`"ListIndexes" sending request with: ${__inspect(reqOpts)}`);
|
|
221
|
+
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
222
|
+
try {
|
|
223
|
+
const result = yield httpClient.request(reqOpts);
|
|
224
|
+
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
225
|
+
return fromJSON(result.data);
|
|
226
|
+
}
|
|
227
|
+
catch (err) {
|
|
228
|
+
const transformedError = transformError(err, requestTransformation, [
|
|
229
|
+
'options',
|
|
230
|
+
]);
|
|
231
|
+
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
232
|
+
throw transformedError;
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
//# sourceMappingURL=data-v2-index.universal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-v2-index.universal.js","sourceRoot":"","sources":["../../../src/data-v2-index.universal.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,KAAK,wBAAwB,MAAM,sBAAsB,CAAC;AAEjE,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB,SAAS,KAAK,CAAC,GAAG,IAAW;IAC3B,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,SAAS,CAAC,GAAQ;IACzB,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,cAAc,EAAE;QACd,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC;QAC5B,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,GAAG,KAAK,CAAC;KAC/B;CACF,CAAC;AACF,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,eAAe,GAAG,GAAG,CAAC;AA2C5B;;;GAGG;AACH,MAAM,CAAN,IAAY,KAGX;AAHD,WAAY,KAAK;IACf,oBAAW,CAAA;IACX,sBAAa,CAAA;AACf,CAAC,EAHW,KAAK,KAAL,KAAK,QAGhB;AAaD,MAAM,CAAN,IAAY,MAeX;AAfD,WAAY,MAAM;IAChB,mDAAmD;IACnD,6BAAmB,CAAA;IACnB,qCAAqC;IACrC,+BAAqB,CAAA;IACrB,sEAAsE;IACtE,2BAAiB,CAAA;IACjB,gDAAgD;IAChD,+BAAqB,CAAA;IACrB,2CAA2C;IAC3C,6BAAmB,CAAA;IACnB,iCAAiC;IACjC,2BAAiB,CAAA;IACjB,+CAA+C;IAC/C,6BAAmB,CAAA;AACrB,CAAC,EAfW,MAAM,KAAN,MAAM,QAejB;AA0BD,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,4BAA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CAAC;SACxB;;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wix/data",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"registry": "https://registry.npmjs.org/",
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"module": "build/es/index.js",
|
|
10
|
+
"main": "build/cjs/index.js",
|
|
11
|
+
"typings": "./build/cjs/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"build",
|
|
14
|
+
"frontend/package.json"
|
|
15
|
+
],
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@wix/metro-runtime": "^1.0.0",
|
|
18
|
+
"@wix/sdk-types": "^1.0.0",
|
|
19
|
+
"@wix/motion-edm-autogen-query-wrapper": "^1.0.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@wix/typescript-to-service-json": "^1.0.0"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsc -b tsconfig.json tsconfig.esm.json",
|
|
26
|
+
"autodocs": "ts-to-sj",
|
|
27
|
+
"posttest": "npm run autodocs",
|
|
28
|
+
"test": ":"
|
|
29
|
+
},
|
|
30
|
+
"wix": {
|
|
31
|
+
"artifact": {
|
|
32
|
+
"artifactId": "data-public-sdk-autogen",
|
|
33
|
+
"groupId": "com.wixpress.public-sdk-autogen"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"falconPackageHash": "87cdb9521acfad66e7c491956c8e1e46f5b821608ac260d8a78b65f1"
|
|
37
|
+
}
|