@xata.io/client 0.8.0 → 0.8.3
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/.eslintrc.cjs +1 -1
- package/CHANGELOG.md +21 -0
- package/dist/index.cjs +1762 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +2731 -6
- package/dist/index.mjs +1667 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +9 -5
- package/rollup.config.js +33 -0
- package/tsconfig.json +2 -2
- package/dist/api/client.d.ts +0 -95
- package/dist/api/client.js +0 -251
- package/dist/api/components.d.ts +0 -1437
- package/dist/api/components.js +0 -998
- package/dist/api/fetcher.d.ts +0 -40
- package/dist/api/fetcher.js +0 -79
- package/dist/api/index.d.ts +0 -7
- package/dist/api/index.js +0 -21
- package/dist/api/parameters.d.ts +0 -16
- package/dist/api/parameters.js +0 -2
- package/dist/api/providers.d.ts +0 -8
- package/dist/api/providers.js +0 -30
- package/dist/api/responses.d.ts +0 -50
- package/dist/api/responses.js +0 -2
- package/dist/api/schemas.d.ts +0 -311
- package/dist/api/schemas.js +0 -2
- package/dist/client.d.ts +0 -39
- package/dist/client.js +0 -124
- package/dist/index.js +0 -29
- package/dist/namespace.d.ts +0 -7
- package/dist/namespace.js +0 -6
- package/dist/schema/filters.d.ts +0 -96
- package/dist/schema/filters.js +0 -2
- package/dist/schema/filters.spec.d.ts +0 -1
- package/dist/schema/filters.spec.js +0 -177
- package/dist/schema/index.d.ts +0 -21
- package/dist/schema/index.js +0 -49
- package/dist/schema/operators.d.ts +0 -74
- package/dist/schema/operators.js +0 -93
- package/dist/schema/pagination.d.ts +0 -83
- package/dist/schema/pagination.js +0 -93
- package/dist/schema/query.d.ts +0 -118
- package/dist/schema/query.js +0 -242
- package/dist/schema/record.d.ts +0 -66
- package/dist/schema/record.js +0 -13
- package/dist/schema/repository.d.ts +0 -134
- package/dist/schema/repository.js +0 -284
- package/dist/schema/selection.d.ts +0 -25
- package/dist/schema/selection.js +0 -2
- package/dist/schema/selection.spec.d.ts +0 -1
- package/dist/schema/selection.spec.js +0 -204
- package/dist/schema/sorting.d.ts +0 -17
- package/dist/schema/sorting.js +0 -28
- package/dist/schema/sorting.spec.d.ts +0 -1
- package/dist/schema/sorting.spec.js +0 -11
- package/dist/search/index.d.ts +0 -20
- package/dist/search/index.js +0 -30
- package/dist/util/branches.d.ts +0 -5
- package/dist/util/branches.js +0 -7
- package/dist/util/config.d.ts +0 -11
- package/dist/util/config.js +0 -121
- package/dist/util/environment.d.ts +0 -5
- package/dist/util/environment.js +0 -68
- package/dist/util/fetch.d.ts +0 -2
- package/dist/util/fetch.js +0 -13
- package/dist/util/lang.d.ts +0 -5
- package/dist/util/lang.js +0 -22
- package/dist/util/types.d.ts +0 -25
- package/dist/util/types.js +0 -2
package/dist/api/components.js
DELETED
@@ -1,998 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.searchBranch = exports.queryTable = exports.bulkInsertTableRecords = exports.getRecord = exports.deleteRecord = exports.upsertRecordWithID = exports.updateRecordWithID = exports.insertRecordWithID = exports.insertRecord = exports.updateColumn = exports.deleteColumn = exports.getColumn = exports.addTableColumn = exports.getTableColumns = exports.setTableSchema = exports.getTableSchema = exports.updateTable = exports.deleteTable = exports.createTable = exports.getBranchStats = exports.getBranchMigrationPlan = exports.executeBranchMigrationPlan = exports.getBranchMigrationHistory = exports.getBranchMetadata = exports.updateBranchMetadata = exports.deleteBranch = exports.createBranch = exports.getBranchDetails = exports.deleteDatabase = exports.createDatabase = exports.getBranchList = exports.getDatabaseList = exports.acceptWorkspaceMemberInvite = exports.resendWorkspaceMemberInvite = exports.cancelWorkspaceMemberInvite = exports.inviteWorkspaceMember = exports.removeWorkspaceMember = exports.updateWorkspaceMemberRole = exports.getWorkspaceMembersList = exports.deleteWorkspace = exports.updateWorkspace = exports.getWorkspace = exports.getWorkspacesList = exports.createWorkspace = exports.deleteUserAPIKey = exports.createUserAPIKey = exports.getUserAPIKeys = exports.deleteUser = exports.updateUser = exports.getUser = void 0;
|
4
|
-
exports.operationsByTag = void 0;
|
5
|
-
/**
|
6
|
-
* Generated by @openapi-codegen
|
7
|
-
*
|
8
|
-
* @version 1.0
|
9
|
-
*/
|
10
|
-
const fetcher_1 = require("./fetcher");
|
11
|
-
/**
|
12
|
-
* Return details of the user making the request
|
13
|
-
*/
|
14
|
-
const getUser = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/user', method: 'get' }, variables));
|
15
|
-
exports.getUser = getUser;
|
16
|
-
/**
|
17
|
-
* Update user info
|
18
|
-
*/
|
19
|
-
const updateUser = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/user', method: 'put' }, variables));
|
20
|
-
exports.updateUser = updateUser;
|
21
|
-
/**
|
22
|
-
* Delete the user making the request
|
23
|
-
*/
|
24
|
-
const deleteUser = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/user', method: 'delete' }, variables));
|
25
|
-
exports.deleteUser = deleteUser;
|
26
|
-
/**
|
27
|
-
* Retrieve a list of existing user API keys
|
28
|
-
*/
|
29
|
-
const getUserAPIKeys = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/user/keys', method: 'get' }, variables));
|
30
|
-
exports.getUserAPIKeys = getUserAPIKeys;
|
31
|
-
/**
|
32
|
-
* Create and return new API key
|
33
|
-
*/
|
34
|
-
const createUserAPIKey = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/user/keys/{keyName}', method: 'post' }, variables));
|
35
|
-
exports.createUserAPIKey = createUserAPIKey;
|
36
|
-
/**
|
37
|
-
* Delete an existing API key
|
38
|
-
*/
|
39
|
-
const deleteUserAPIKey = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/user/keys/{keyName}', method: 'delete' }, variables));
|
40
|
-
exports.deleteUserAPIKey = deleteUserAPIKey;
|
41
|
-
/**
|
42
|
-
* Creates a new workspace with the user requesting it as its single owner.
|
43
|
-
*/
|
44
|
-
const createWorkspace = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/workspaces', method: 'post' }, variables));
|
45
|
-
exports.createWorkspace = createWorkspace;
|
46
|
-
/**
|
47
|
-
* Retrieve the list of workspaces the user belongs to
|
48
|
-
*/
|
49
|
-
const getWorkspacesList = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/workspaces', method: 'get' }, variables));
|
50
|
-
exports.getWorkspacesList = getWorkspacesList;
|
51
|
-
/**
|
52
|
-
* Retrieve workspace info from a workspace ID
|
53
|
-
*/
|
54
|
-
const getWorkspace = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/workspaces/{workspaceId}', method: 'get' }, variables));
|
55
|
-
exports.getWorkspace = getWorkspace;
|
56
|
-
/**
|
57
|
-
* Update workspace info
|
58
|
-
*/
|
59
|
-
const updateWorkspace = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/workspaces/{workspaceId}', method: 'put' }, variables));
|
60
|
-
exports.updateWorkspace = updateWorkspace;
|
61
|
-
/**
|
62
|
-
* Delete the workspace with the provided ID
|
63
|
-
*/
|
64
|
-
const deleteWorkspace = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/workspaces/{workspaceId}', method: 'delete' }, variables));
|
65
|
-
exports.deleteWorkspace = deleteWorkspace;
|
66
|
-
/**
|
67
|
-
* Retrieve the list of members of the given workspace
|
68
|
-
*/
|
69
|
-
const getWorkspaceMembersList = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/workspaces/{workspaceId}/members', method: 'get' }, variables));
|
70
|
-
exports.getWorkspaceMembersList = getWorkspaceMembersList;
|
71
|
-
/**
|
72
|
-
* Update a workspace member role. Workspaces must always have at least one owner, so this operation will fail if trying to remove owner role from the last owner in the workspace.
|
73
|
-
*/
|
74
|
-
const updateWorkspaceMemberRole = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/workspaces/{workspaceId}/members/{userId}', method: 'put' }, variables));
|
75
|
-
exports.updateWorkspaceMemberRole = updateWorkspaceMemberRole;
|
76
|
-
/**
|
77
|
-
* Remove the member from the workspace
|
78
|
-
*/
|
79
|
-
const removeWorkspaceMember = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/workspaces/{workspaceId}/members/{userId}', method: 'delete' }, variables));
|
80
|
-
exports.removeWorkspaceMember = removeWorkspaceMember;
|
81
|
-
/**
|
82
|
-
* Invite some user to join the workspace with the given role
|
83
|
-
*/
|
84
|
-
const inviteWorkspaceMember = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/workspaces/{workspaceId}/invites', method: 'post' }, variables));
|
85
|
-
exports.inviteWorkspaceMember = inviteWorkspaceMember;
|
86
|
-
/**
|
87
|
-
* This operation provides a way to cancel invites by deleting them. Already accepted invites cannot be deleted.
|
88
|
-
*/
|
89
|
-
const cancelWorkspaceMemberInvite = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/workspaces/{workspaceId}/invites/{inviteId}', method: 'delete' }, variables));
|
90
|
-
exports.cancelWorkspaceMemberInvite = cancelWorkspaceMemberInvite;
|
91
|
-
/**
|
92
|
-
* This operation provides a way to resend an Invite notification. Invite notifications can only be sent for Invites not yet accepted.
|
93
|
-
*/
|
94
|
-
const resendWorkspaceMemberInvite = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/workspaces/{workspaceId}/invites/{inviteId}/resend', method: 'post' }, variables));
|
95
|
-
exports.resendWorkspaceMemberInvite = resendWorkspaceMemberInvite;
|
96
|
-
/**
|
97
|
-
* Accept the invitation to join a workspace. If the operation succeeds the user will be a member of the workspace
|
98
|
-
*/
|
99
|
-
const acceptWorkspaceMemberInvite = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/workspaces/{workspaceId}/invites/{inviteKey}/accept', method: 'post' }, variables));
|
100
|
-
exports.acceptWorkspaceMemberInvite = acceptWorkspaceMemberInvite;
|
101
|
-
/**
|
102
|
-
* List all databases available in your Workspace.
|
103
|
-
*/
|
104
|
-
const getDatabaseList = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/dbs', method: 'get' }, variables));
|
105
|
-
exports.getDatabaseList = getDatabaseList;
|
106
|
-
/**
|
107
|
-
* List all available Branches
|
108
|
-
*/
|
109
|
-
const getBranchList = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/dbs/{dbName}', method: 'get' }, variables));
|
110
|
-
exports.getBranchList = getBranchList;
|
111
|
-
/**
|
112
|
-
* Create Database with identifier name
|
113
|
-
*/
|
114
|
-
const createDatabase = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/dbs/{dbName}', method: 'put' }, variables));
|
115
|
-
exports.createDatabase = createDatabase;
|
116
|
-
/**
|
117
|
-
* Delete a database and all of its branches and tables permanently.
|
118
|
-
*/
|
119
|
-
const deleteDatabase = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/dbs/{dbName}', method: 'delete' }, variables));
|
120
|
-
exports.deleteDatabase = deleteDatabase;
|
121
|
-
const getBranchDetails = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}', method: 'get' }, variables));
|
122
|
-
exports.getBranchDetails = getBranchDetails;
|
123
|
-
const createBranch = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}', method: 'put' }, variables));
|
124
|
-
exports.createBranch = createBranch;
|
125
|
-
/**
|
126
|
-
* Delete the branch in the database and all its resources
|
127
|
-
*/
|
128
|
-
const deleteBranch = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}', method: 'delete' }, variables));
|
129
|
-
exports.deleteBranch = deleteBranch;
|
130
|
-
/**
|
131
|
-
* Update the branch metadata
|
132
|
-
*/
|
133
|
-
const updateBranchMetadata = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/metadata', method: 'put' }, variables));
|
134
|
-
exports.updateBranchMetadata = updateBranchMetadata;
|
135
|
-
const getBranchMetadata = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/metadata', method: 'get' }, variables));
|
136
|
-
exports.getBranchMetadata = getBranchMetadata;
|
137
|
-
const getBranchMigrationHistory = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/migrations', method: 'get' }, variables));
|
138
|
-
exports.getBranchMigrationHistory = getBranchMigrationHistory;
|
139
|
-
/**
|
140
|
-
* Apply a migration plan to the branch
|
141
|
-
*/
|
142
|
-
const executeBranchMigrationPlan = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/migrations/execute', method: 'post' }, variables));
|
143
|
-
exports.executeBranchMigrationPlan = executeBranchMigrationPlan;
|
144
|
-
/**
|
145
|
-
* Compute a migration plan from a target schema the branch should be migrated too.
|
146
|
-
*/
|
147
|
-
const getBranchMigrationPlan = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/migrations/plan', method: 'post' }, variables));
|
148
|
-
exports.getBranchMigrationPlan = getBranchMigrationPlan;
|
149
|
-
/**
|
150
|
-
* Get branch usage metrics.
|
151
|
-
*/
|
152
|
-
const getBranchStats = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/stats', method: 'get' }, variables));
|
153
|
-
exports.getBranchStats = getBranchStats;
|
154
|
-
/**
|
155
|
-
* Creates a new table with the given name. Returns 422 if a table with the same name already exists.
|
156
|
-
*/
|
157
|
-
const createTable = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}', method: 'put' }, variables));
|
158
|
-
exports.createTable = createTable;
|
159
|
-
/**
|
160
|
-
* Deletes the table with the given name.
|
161
|
-
*/
|
162
|
-
const deleteTable = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}', method: 'delete' }, variables));
|
163
|
-
exports.deleteTable = deleteTable;
|
164
|
-
/**
|
165
|
-
* Update table. Currently there is only one update operation supported: renaming the table by providing a new name.
|
166
|
-
*
|
167
|
-
* In the example below, we rename a table from “users” to “people”:
|
168
|
-
*
|
169
|
-
* ```jsx
|
170
|
-
* PATCH /db/test:main/tables/users
|
171
|
-
* {
|
172
|
-
* "name": "people"
|
173
|
-
* }
|
174
|
-
* ```
|
175
|
-
*/
|
176
|
-
const updateTable = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}', method: 'patch' }, variables));
|
177
|
-
exports.updateTable = updateTable;
|
178
|
-
const getTableSchema = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/schema', method: 'get' }, variables));
|
179
|
-
exports.getTableSchema = getTableSchema;
|
180
|
-
const setTableSchema = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/schema', method: 'put' }, variables));
|
181
|
-
exports.setTableSchema = setTableSchema;
|
182
|
-
/**
|
183
|
-
* Retrieves the list of table columns and their definition. This endpoint returns the column list with object columns being reported with their
|
184
|
-
* full dot-separated path (flattened).
|
185
|
-
*/
|
186
|
-
const getTableColumns = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/columns', method: 'get' }, variables));
|
187
|
-
exports.getTableColumns = getTableColumns;
|
188
|
-
/**
|
189
|
-
* Adds a new column to the table. The body of the request should contain the column definition. In the column definition, the 'name' field should
|
190
|
-
* contain the full path separated by dots. If the parent objects do not exists, they will be automatically created. For example,
|
191
|
-
* passing `"name": "address.city"` will auto-create the `address` object if it doesn't exist.
|
192
|
-
*/
|
193
|
-
const addTableColumn = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/columns', method: 'post' }, variables));
|
194
|
-
exports.addTableColumn = addTableColumn;
|
195
|
-
/**
|
196
|
-
* Get the definition of a single column. To refer to sub-objects, the column name can contain dots. For example `address.country`.
|
197
|
-
*/
|
198
|
-
const getColumn = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/columns/{columnName}', method: 'get' }, variables));
|
199
|
-
exports.getColumn = getColumn;
|
200
|
-
/**
|
201
|
-
* Deletes the specified column. To refer to sub-objects, the column name can contain dots. For example `address.country`.
|
202
|
-
*/
|
203
|
-
const deleteColumn = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/columns/{columnName}', method: 'delete' }, variables));
|
204
|
-
exports.deleteColumn = deleteColumn;
|
205
|
-
/**
|
206
|
-
* Update column with partial data. Can be used for renaming the column by providing a new "name" field. To refer to sub-objects, the column name can contain dots. For example `address.country`.
|
207
|
-
*/
|
208
|
-
const updateColumn = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/columns/{columnName}', method: 'patch' }, variables));
|
209
|
-
exports.updateColumn = updateColumn;
|
210
|
-
/**
|
211
|
-
* Insert a new Record into the Table
|
212
|
-
*/
|
213
|
-
const insertRecord = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/data', method: 'post' }, variables));
|
214
|
-
exports.insertRecord = insertRecord;
|
215
|
-
/**
|
216
|
-
* By default, IDs are auto-generated when data is insterted into Xata. Sending a request to this endpoint allows us to insert a record with a pre-existing ID, bypassing the default automatic ID generation.
|
217
|
-
*/
|
218
|
-
const insertRecordWithID = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/data/{recordId}', method: 'put' }, variables));
|
219
|
-
exports.insertRecordWithID = insertRecordWithID;
|
220
|
-
const updateRecordWithID = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/data/{recordId}', method: 'patch' }, variables));
|
221
|
-
exports.updateRecordWithID = updateRecordWithID;
|
222
|
-
const upsertRecordWithID = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/data/{recordId}', method: 'post' }, variables));
|
223
|
-
exports.upsertRecordWithID = upsertRecordWithID;
|
224
|
-
const deleteRecord = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/data/{recordId}', method: 'delete' }, variables));
|
225
|
-
exports.deleteRecord = deleteRecord;
|
226
|
-
/**
|
227
|
-
* Retrieve record by ID
|
228
|
-
*/
|
229
|
-
const getRecord = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/data/{recordId}', method: 'get' }, variables));
|
230
|
-
exports.getRecord = getRecord;
|
231
|
-
/**
|
232
|
-
* Bulk insert records
|
233
|
-
*/
|
234
|
-
const bulkInsertTableRecords = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/bulk', method: 'post' }, variables));
|
235
|
-
exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
236
|
-
/**
|
237
|
-
* The Query Table API can be used to retrieve all records in a table.
|
238
|
-
* The API support filtering, sorting, selecting a subset of columns, and pagination.
|
239
|
-
*
|
240
|
-
* The overall structure of the request looks like this:
|
241
|
-
*
|
242
|
-
* ```json
|
243
|
-
* // POST /db/<dbname>:<branch>/tables/<table>/query
|
244
|
-
* {
|
245
|
-
* "columns": [...],
|
246
|
-
* "filter": {
|
247
|
-
* "$all": [...]
|
248
|
-
* "$any": [...]
|
249
|
-
* ...
|
250
|
-
* },
|
251
|
-
* "sort": {
|
252
|
-
* "multiple": [...]
|
253
|
-
* ...
|
254
|
-
* },
|
255
|
-
* "page": {
|
256
|
-
* ...
|
257
|
-
* }
|
258
|
-
* }
|
259
|
-
* ```
|
260
|
-
*
|
261
|
-
* ### Column selection
|
262
|
-
*
|
263
|
-
* If the `columns` array is not specified, all columns are included. For link
|
264
|
-
* fields, only the ID column of the linked records is included in the response.
|
265
|
-
*
|
266
|
-
* If the `columns` array is specified, only the selected columns are included.
|
267
|
-
* The `*` wildcard can be used to select all columns of the given array
|
268
|
-
*
|
269
|
-
* For objects and link fields, if the column name of the object is specified, we
|
270
|
-
* include all of its sub-keys. If only some sub-keys are specified (via dotted
|
271
|
-
* notation, e.g. `"settings.plan"` ), then only those sub-keys from the object
|
272
|
-
* are included.
|
273
|
-
*
|
274
|
-
* By the way of example, assuming two tables like this:
|
275
|
-
*
|
276
|
-
* ```json {"truncate": true}
|
277
|
-
* {
|
278
|
-
* "formatVersion": "1.0",
|
279
|
-
* "tables": [
|
280
|
-
* {
|
281
|
-
* "name": "teams",
|
282
|
-
* "columns": [
|
283
|
-
* {
|
284
|
-
* "name": "name",
|
285
|
-
* "type": "string"
|
286
|
-
* },
|
287
|
-
* {
|
288
|
-
* "name": "owner",
|
289
|
-
* "type": "link",
|
290
|
-
* "link": {
|
291
|
-
* "table": "users"
|
292
|
-
* }
|
293
|
-
* }
|
294
|
-
* ]
|
295
|
-
* },
|
296
|
-
* {
|
297
|
-
* "name": "users",
|
298
|
-
* "columns": [
|
299
|
-
* {
|
300
|
-
* "name": "email",
|
301
|
-
* "type": "email"
|
302
|
-
* },
|
303
|
-
* {
|
304
|
-
* "name": "full_name",
|
305
|
-
* "type": "string"
|
306
|
-
* },
|
307
|
-
* {
|
308
|
-
* "name": "address",
|
309
|
-
* "type": "object",
|
310
|
-
* "columns": [
|
311
|
-
* {
|
312
|
-
* "name": "street",
|
313
|
-
* "type": "string"
|
314
|
-
* },
|
315
|
-
* {
|
316
|
-
* "name": "number",
|
317
|
-
* "type": "int"
|
318
|
-
* },
|
319
|
-
* {
|
320
|
-
* "name": "zipcode",
|
321
|
-
* "type": "int"
|
322
|
-
* }
|
323
|
-
* ]
|
324
|
-
* },
|
325
|
-
* {
|
326
|
-
* "name": "team",
|
327
|
-
* "type": "link",
|
328
|
-
* "link": {
|
329
|
-
* "table": "teams"
|
330
|
-
* }
|
331
|
-
* }
|
332
|
-
* ]
|
333
|
-
* }
|
334
|
-
* ]
|
335
|
-
* }
|
336
|
-
* ```
|
337
|
-
*
|
338
|
-
* A query like this:
|
339
|
-
*
|
340
|
-
* ```json
|
341
|
-
* POST /db/<dbname>:<branch>/tables/<table>/query
|
342
|
-
* {
|
343
|
-
* "columns": [
|
344
|
-
* "name",
|
345
|
-
* "address.*"
|
346
|
-
* ]
|
347
|
-
* }
|
348
|
-
* ```
|
349
|
-
*
|
350
|
-
* returns objects like:
|
351
|
-
*
|
352
|
-
* ```json
|
353
|
-
* {
|
354
|
-
* "name": "Kilian",
|
355
|
-
* "address": {
|
356
|
-
* "street": "New street",
|
357
|
-
* "number": 41,
|
358
|
-
* "zipcode": 10407
|
359
|
-
* }
|
360
|
-
* }
|
361
|
-
* ```
|
362
|
-
*
|
363
|
-
* while a query like this:
|
364
|
-
*
|
365
|
-
* ```json
|
366
|
-
* POST /db/<dbname>:<branch>/tables/<table>/query
|
367
|
-
* {
|
368
|
-
* "columns": [
|
369
|
-
* "name",
|
370
|
-
* "address.street"
|
371
|
-
* ]
|
372
|
-
* }
|
373
|
-
* ```
|
374
|
-
*
|
375
|
-
* returns objects like:
|
376
|
-
*
|
377
|
-
* ```json
|
378
|
-
* {
|
379
|
-
* "name": "Kilian",
|
380
|
-
* "address": {
|
381
|
-
* "street": "New street",
|
382
|
-
* }
|
383
|
-
* }
|
384
|
-
* ```
|
385
|
-
*
|
386
|
-
* If you want to return all columns from the main table and selected columns from the linked table, you can do it like this:
|
387
|
-
*
|
388
|
-
* ```json
|
389
|
-
* {
|
390
|
-
* "columns": [
|
391
|
-
* "*",
|
392
|
-
* "team.name"
|
393
|
-
* ]
|
394
|
-
* }
|
395
|
-
* ```
|
396
|
-
*
|
397
|
-
* The `"*"` in the above means all columns, including columns of objects. This returns data like:
|
398
|
-
*
|
399
|
-
* ```json
|
400
|
-
* {
|
401
|
-
* "name": "Kilian",
|
402
|
-
* "email": "kilian@gmail.com",
|
403
|
-
* "address": {
|
404
|
-
* "street": "New street",
|
405
|
-
* "number": 41,
|
406
|
-
* "zipcode": 10407
|
407
|
-
* },
|
408
|
-
* "team": {
|
409
|
-
* "id": "XX",
|
410
|
-
* "xata": {
|
411
|
-
* "version": 0,
|
412
|
-
* },
|
413
|
-
* "name": "first team"
|
414
|
-
* }
|
415
|
-
* }
|
416
|
-
* ```
|
417
|
-
*
|
418
|
-
* If you want all columns of the linked table, you can do:
|
419
|
-
*
|
420
|
-
* ```json
|
421
|
-
* {
|
422
|
-
* "columns": [
|
423
|
-
* "*",
|
424
|
-
* "team.*"
|
425
|
-
* ]
|
426
|
-
* }
|
427
|
-
* ```
|
428
|
-
*
|
429
|
-
* This returns, for example:
|
430
|
-
*
|
431
|
-
* ```json
|
432
|
-
* {
|
433
|
-
* "name": "Kilian",
|
434
|
-
* "email": "kilian@gmail.com",
|
435
|
-
* "address": {
|
436
|
-
* "street": "New street",
|
437
|
-
* "number": 41,
|
438
|
-
* "zipcode": 10407
|
439
|
-
* },
|
440
|
-
* "team": {
|
441
|
-
* "id": "XX",
|
442
|
-
* "xata": {
|
443
|
-
* "version": 0,
|
444
|
-
* },
|
445
|
-
* "name": "first team",
|
446
|
-
* "code": "A1"
|
447
|
-
* }
|
448
|
-
* }
|
449
|
-
* ```
|
450
|
-
*
|
451
|
-
* ### Filtering
|
452
|
-
*
|
453
|
-
* There are two types of operators:
|
454
|
-
*
|
455
|
-
* - Operators that work on a single column: `$is`, `$contains`, `$pattern`,
|
456
|
-
* `$includes`, `$gt`, etc.
|
457
|
-
* - Control operators that combine multiple conditions: `$any`, `$all`, `$not` ,
|
458
|
-
* `$none`, etc.
|
459
|
-
*
|
460
|
-
* All operators start with an `$` to differentiate them from column names
|
461
|
-
* (which are not allowed to start with an dollar sign).
|
462
|
-
*
|
463
|
-
* #### Exact matching and control operators
|
464
|
-
*
|
465
|
-
* Filter by one column:
|
466
|
-
*
|
467
|
-
* ```json
|
468
|
-
* {
|
469
|
-
* "filter": {
|
470
|
-
* "<column_name>": "value"
|
471
|
-
* }
|
472
|
-
* }
|
473
|
-
* ```
|
474
|
-
*
|
475
|
-
* This is equivalent to using the `$is` operator:
|
476
|
-
*
|
477
|
-
* ```json
|
478
|
-
* {
|
479
|
-
* "filter": {
|
480
|
-
* "<column_name>": {
|
481
|
-
* "$is": "value"
|
482
|
-
* }
|
483
|
-
* }
|
484
|
-
* }
|
485
|
-
* ```
|
486
|
-
*
|
487
|
-
* For example:
|
488
|
-
*
|
489
|
-
* ```json
|
490
|
-
* {
|
491
|
-
* "filter": {
|
492
|
-
* "name": "r2",
|
493
|
-
* }
|
494
|
-
* }
|
495
|
-
* ```
|
496
|
-
*
|
497
|
-
* Or:
|
498
|
-
*
|
499
|
-
* ```json
|
500
|
-
* {
|
501
|
-
* "filter": {
|
502
|
-
* "name": {
|
503
|
-
* "$is": "r2"
|
504
|
-
* }
|
505
|
-
* }
|
506
|
-
* }
|
507
|
-
* ```
|
508
|
-
*
|
509
|
-
* For objects, both dots and nested versions work:
|
510
|
-
*
|
511
|
-
* ```json
|
512
|
-
* {
|
513
|
-
* "filter": {
|
514
|
-
* "settings.plan": "free",
|
515
|
-
* }
|
516
|
-
* }
|
517
|
-
* ```
|
518
|
-
*
|
519
|
-
* ```json
|
520
|
-
* {
|
521
|
-
* "filter": {
|
522
|
-
* "settings": {
|
523
|
-
* "plan": "free"
|
524
|
-
* },
|
525
|
-
* },
|
526
|
-
* }
|
527
|
-
* ```
|
528
|
-
*
|
529
|
-
* If you want to OR together multiple values, you can use the `$any` operator with an array of values:
|
530
|
-
*
|
531
|
-
* ```json
|
532
|
-
* {
|
533
|
-
* "filter": {
|
534
|
-
* "settings.plan": {"$any": ["free", "paid"]}
|
535
|
-
* },
|
536
|
-
* }
|
537
|
-
* ```
|
538
|
-
*
|
539
|
-
* If you specify multiple columns in the same filter, they are logically AND'ed together:
|
540
|
-
*
|
541
|
-
* ```json
|
542
|
-
* {
|
543
|
-
* "filter": {
|
544
|
-
* "settings.dark": true,
|
545
|
-
* "settings.plan": "free",
|
546
|
-
* },
|
547
|
-
* }
|
548
|
-
* ```
|
549
|
-
*
|
550
|
-
* The above matches if both conditions are met.
|
551
|
-
*
|
552
|
-
* To be more explicit about it, you can use `$all` or `$any`:
|
553
|
-
*
|
554
|
-
* ```json
|
555
|
-
* {
|
556
|
-
* "filter": {
|
557
|
-
* "$any": {
|
558
|
-
* "settings.dark": true,
|
559
|
-
* "settings.plan": "free"
|
560
|
-
* }
|
561
|
-
* },
|
562
|
-
* }
|
563
|
-
* ```
|
564
|
-
*
|
565
|
-
* The `$all` and `$any` operators can also receive an array of objects, which allows for repeating column names:
|
566
|
-
*
|
567
|
-
* ```json
|
568
|
-
* {
|
569
|
-
* "filter": {
|
570
|
-
* "$any": [
|
571
|
-
* {
|
572
|
-
* "name": "r1",
|
573
|
-
* },
|
574
|
-
* {
|
575
|
-
* "name": "r2",
|
576
|
-
* }
|
577
|
-
* ]
|
578
|
-
* }
|
579
|
-
* }
|
580
|
-
* ```
|
581
|
-
*
|
582
|
-
* You can check for a value being not-null with `$exists`:
|
583
|
-
*
|
584
|
-
* ```json
|
585
|
-
* {
|
586
|
-
* "filter": {
|
587
|
-
* "$exists": "settings",
|
588
|
-
* }
|
589
|
-
* }
|
590
|
-
* ```
|
591
|
-
*
|
592
|
-
* This can be combined with `$all` or `$any` :
|
593
|
-
*
|
594
|
-
* ```json
|
595
|
-
* {
|
596
|
-
* "filter": {
|
597
|
-
* "$all": [
|
598
|
-
* {
|
599
|
-
* "$exists": "settings",
|
600
|
-
* },
|
601
|
-
* {
|
602
|
-
* "$exists": "name",
|
603
|
-
* }
|
604
|
-
* ]
|
605
|
-
* }
|
606
|
-
* }
|
607
|
-
* ```
|
608
|
-
*
|
609
|
-
* Or you can use the inverse operator `$notExists`:
|
610
|
-
*
|
611
|
-
* ```json
|
612
|
-
* {
|
613
|
-
* "filter": {
|
614
|
-
* "$notExists": "settings",
|
615
|
-
* }
|
616
|
-
* }
|
617
|
-
* ```
|
618
|
-
*
|
619
|
-
* #### Partial match
|
620
|
-
*
|
621
|
-
* `$contains` is the simplest operator for partial matching. We should generally
|
622
|
-
* discourage overusing `$contains` because it typically can't make use of
|
623
|
-
* indices.
|
624
|
-
*
|
625
|
-
* ```json
|
626
|
-
* {
|
627
|
-
* "filter": {
|
628
|
-
* "<column_name>": {
|
629
|
-
* "$contains": "value"
|
630
|
-
* }
|
631
|
-
* }
|
632
|
-
* }
|
633
|
-
* ```
|
634
|
-
*
|
635
|
-
* Wildcards are supported via the `$pattern` operator:
|
636
|
-
*
|
637
|
-
* ```json
|
638
|
-
* {
|
639
|
-
* "filter": {
|
640
|
-
* "<column_name>": {
|
641
|
-
* "$pattern": "v*alue*"
|
642
|
-
* }
|
643
|
-
* }
|
644
|
-
* }
|
645
|
-
* ```
|
646
|
-
*
|
647
|
-
* We could also have `$endsWith` and `$startsWith` operators:
|
648
|
-
*
|
649
|
-
* ```json
|
650
|
-
* {
|
651
|
-
* "filter": {
|
652
|
-
* "<column_name>": {
|
653
|
-
* "$endsWith": ".gz"
|
654
|
-
* },
|
655
|
-
* "<column_name>": {
|
656
|
-
* "$startsWith": "tmp-"
|
657
|
-
* }
|
658
|
-
* }
|
659
|
-
* }
|
660
|
-
* ```
|
661
|
-
*
|
662
|
-
* #### Numeric ranges
|
663
|
-
*
|
664
|
-
* ```json
|
665
|
-
* {
|
666
|
-
* "filter": {
|
667
|
-
* "<column_name>": {
|
668
|
-
* "$ge": 0,
|
669
|
-
* "$lt": 100
|
670
|
-
* }
|
671
|
-
* }
|
672
|
-
* }
|
673
|
-
* ```
|
674
|
-
*
|
675
|
-
* The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
|
676
|
-
*
|
677
|
-
*
|
678
|
-
* #### Negations
|
679
|
-
*
|
680
|
-
* A general `$not` operator can inverse any operation.
|
681
|
-
*
|
682
|
-
* ```json
|
683
|
-
* {
|
684
|
-
* "filter": {
|
685
|
-
* "$not": {
|
686
|
-
* "<column_name1>": "value1",
|
687
|
-
* "<column_name2>": "value1"
|
688
|
-
* }
|
689
|
-
* }
|
690
|
-
* }
|
691
|
-
* ```
|
692
|
-
*
|
693
|
-
* Note: in the above the two condition are AND together, so this does (NOT ( ...
|
694
|
-
* AND ...))
|
695
|
-
*
|
696
|
-
* Or more complex:
|
697
|
-
*
|
698
|
-
* ```json
|
699
|
-
* {
|
700
|
-
* "filter": {
|
701
|
-
* "$not": {
|
702
|
-
* "$any": [{
|
703
|
-
* "<column_name1>": "value1"
|
704
|
-
* }, {
|
705
|
-
* "$all": [{
|
706
|
-
* "<column_name2>": "value2"
|
707
|
-
* }, {
|
708
|
-
* "<column_name3>": "value3"
|
709
|
-
* }]
|
710
|
-
* }]
|
711
|
-
* }
|
712
|
-
* }
|
713
|
-
* }
|
714
|
-
* ```
|
715
|
-
*
|
716
|
-
* The `$not: { $any: {}}` can be shorted using the `$none` operator:
|
717
|
-
*
|
718
|
-
* ```json
|
719
|
-
* {
|
720
|
-
* "filter": {
|
721
|
-
* "$none": {
|
722
|
-
* "<column_name1>": "value1",
|
723
|
-
* "<column_name2>": "value1"
|
724
|
-
* }
|
725
|
-
* }
|
726
|
-
* }
|
727
|
-
* ```
|
728
|
-
*
|
729
|
-
* In addition, you can use operators like `$isNot` or `$notExists` to simplify expressions:
|
730
|
-
*
|
731
|
-
* ```json
|
732
|
-
* {
|
733
|
-
* "filter": {
|
734
|
-
* "<column_name>": {
|
735
|
-
* "$isNot": "2019-10-12T07:20:50.52Z"
|
736
|
-
* }
|
737
|
-
* }
|
738
|
-
* }
|
739
|
-
* ```
|
740
|
-
*
|
741
|
-
* #### Working with arrays
|
742
|
-
*
|
743
|
-
* To test that an array contains a value, use `$includes`.
|
744
|
-
*
|
745
|
-
* ```json
|
746
|
-
* {
|
747
|
-
* "filter": {
|
748
|
-
* "<array_name>": {
|
749
|
-
* "$includes": "value"
|
750
|
-
* }
|
751
|
-
* }
|
752
|
-
* }
|
753
|
-
* ```
|
754
|
-
*
|
755
|
-
* The `$includes` operator accepts a custom predicate that will check if any
|
756
|
-
* array values matches the predicate. For example a complex predicate can include
|
757
|
-
* the `$all` , `$contains` and `$endsWith` operators:
|
758
|
-
*
|
759
|
-
* ```json
|
760
|
-
* {
|
761
|
-
* "filter": {
|
762
|
-
* "<array name>": {
|
763
|
-
* "$includes": {
|
764
|
-
* "$all": [
|
765
|
-
* {"$contains": "label"},
|
766
|
-
* {"$not": {"$endsWith": "-debug"}}
|
767
|
-
* ]
|
768
|
-
* }
|
769
|
-
* }
|
770
|
-
* }
|
771
|
-
* }
|
772
|
-
* ```
|
773
|
-
*
|
774
|
-
* The `$includes` all operator succeeds if any column in the array matches the
|
775
|
-
* predicate. The `$includesAll` operator succeeds if all array items match the
|
776
|
-
* predicate. The `$includesNone` operator succeeds if no array item matches the
|
777
|
-
* predicate. The `$includes` operator is a synonym for the `$includesAny`
|
778
|
-
* operator.
|
779
|
-
*
|
780
|
-
* Here is an example of using the `$includesAll` operator:
|
781
|
-
*
|
782
|
-
* ```json
|
783
|
-
* {
|
784
|
-
* "filter": {
|
785
|
-
* "settings.labels": {
|
786
|
-
* "$includesAll": [
|
787
|
-
* {"$contains": "label"},
|
788
|
-
* ]
|
789
|
-
* }
|
790
|
-
* }
|
791
|
-
* }
|
792
|
-
* ```
|
793
|
-
*
|
794
|
-
* The above matches if all label values contain the string "labels".
|
795
|
-
*
|
796
|
-
* ### Sorting
|
797
|
-
*
|
798
|
-
* Sorting by one element:
|
799
|
-
*
|
800
|
-
* ```json
|
801
|
-
* POST /db/demo:main/tables/table/query
|
802
|
-
* {
|
803
|
-
* "sort": {
|
804
|
-
* "index": "asc"
|
805
|
-
* }
|
806
|
-
* }
|
807
|
-
* ```
|
808
|
-
*
|
809
|
-
* or descendently:
|
810
|
-
*
|
811
|
-
* ```json
|
812
|
-
* POST /db/demo:main/tables/table/query
|
813
|
-
* {
|
814
|
-
* "sort": {
|
815
|
-
* "index": "desc"
|
816
|
-
* }
|
817
|
-
* }
|
818
|
-
* ```
|
819
|
-
*
|
820
|
-
* Sorting by multiple fields:
|
821
|
-
*
|
822
|
-
* ```json
|
823
|
-
* POST /db/demo:main/tables/table/query
|
824
|
-
* {
|
825
|
-
* "sort": [
|
826
|
-
* {
|
827
|
-
* "index": "desc"
|
828
|
-
* },
|
829
|
-
* {
|
830
|
-
* "createdAt": "desc"
|
831
|
-
* }
|
832
|
-
* ]
|
833
|
-
* }
|
834
|
-
* ```
|
835
|
-
*
|
836
|
-
*
|
837
|
-
* ### Pagination
|
838
|
-
*
|
839
|
-
* We offer cursor pagination and offset pagination. The offset pagination is limited
|
840
|
-
* in the amount of data it can retrieve, so we recommend the cursor pagination if you have more than 1000 records.
|
841
|
-
*
|
842
|
-
* Example of size + offset pagination:
|
843
|
-
*
|
844
|
-
* ```json
|
845
|
-
* POST /db/demo:main/tables/table/query
|
846
|
-
* {
|
847
|
-
* "page": {
|
848
|
-
* "size": 100,
|
849
|
-
* "offset": 200
|
850
|
-
* }
|
851
|
-
* }
|
852
|
-
* ```
|
853
|
-
*
|
854
|
-
* The `page.size` parameter represents the maximum number of records returned by this query. It has a default value of 20 and a maximum value of 200.
|
855
|
-
* The `page.offset` parameter represents the number of matching records to skip. It has a default value of 0 and a maximum value of 800.
|
856
|
-
*
|
857
|
-
* Example of cursor pagination:
|
858
|
-
*
|
859
|
-
* ```json
|
860
|
-
* POST /db/demo:main/tables/table/query
|
861
|
-
* {
|
862
|
-
* "page": {
|
863
|
-
* "after":"fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD"
|
864
|
-
* }
|
865
|
-
* }
|
866
|
-
* ```
|
867
|
-
*
|
868
|
-
* In the above example, the value of the `page.after` parameter is the cursor returned by the previous query. A sample response is shown below:
|
869
|
-
*
|
870
|
-
* ```json
|
871
|
-
* {
|
872
|
-
* "meta": {
|
873
|
-
* "page": {
|
874
|
-
* "cursor": "fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD",
|
875
|
-
* "more": true
|
876
|
-
* }
|
877
|
-
* },
|
878
|
-
* "records": [...]
|
879
|
-
* }
|
880
|
-
* ```
|
881
|
-
*
|
882
|
-
* The `page` object might contain the follow keys, in addition to `size` and `offset` that were introduced before:
|
883
|
-
*
|
884
|
-
* - `after`: Return the next page 'after' the current cursor
|
885
|
-
* - `before`: Return the previous page 'before' the current cursor.
|
886
|
-
* - `first`: Return the first page in the table from a cursor.
|
887
|
-
* - `last`: Return the last N records in the table from a cursor, where N is the `page.size` parameter.
|
888
|
-
*
|
889
|
-
* The request will fail if an invalid cursor value is given to `page.before`,
|
890
|
-
* `page.after`, `page.first` , or `page.last`. No other cursor setting can be
|
891
|
-
* used if `page.first` or `page.last` is set in a query.
|
892
|
-
*
|
893
|
-
* If both `page.before` and `page.after` parameters are present we treat the
|
894
|
-
* request as a range query. The range query will return all entries after
|
895
|
-
* `page.after`, but before `page.before`, up to `page.size` or the maximum
|
896
|
-
* page size. This query requires both cursors to use the same filters and sort
|
897
|
-
* settings, plus we require `page.after < page.before`. The range query returns
|
898
|
-
* a new cursor. If the range encompass multiple pages the next page in the range
|
899
|
-
* can be queried by update `page.after` to the returned cursor while keeping the
|
900
|
-
* `page.before` cursor from the first range query.
|
901
|
-
*
|
902
|
-
* The `filter` , `columns`, `sort` , and `page.size` configuration will be
|
903
|
-
* encoded with the cursor. The pagination request will be invalid if
|
904
|
-
* `filter` or `sort` is set. The columns returned and page size can be changed
|
905
|
-
* anytime by passing the `columns` or `page.size` settings to the next query.
|
906
|
-
*
|
907
|
-
* **Special cursors:**
|
908
|
-
*
|
909
|
-
* - `page.after=end`: Result points past the last entry. The list of records
|
910
|
-
* returned is empty, but `page.meta.cursor` will include a cursor that can be
|
911
|
-
* used to "tail" the table from the end waiting for new data to be inserted.
|
912
|
-
* - `page.before=end`: This cursor returns the last page.
|
913
|
-
* - `page.first=<cursor>`: Go to first page. This is equivalent to querying the
|
914
|
-
* first page without a cursor but `filter` and `sort` . Yet the `page.first`
|
915
|
-
* cursor can be convenient at times as user code does not need to remember the
|
916
|
-
* filter, sort, columns or page size configuration. All these information are
|
917
|
-
* read from the cursor.
|
918
|
-
* - `page.last=<cursor>`: Go to the end of the table. This is equivalent to querying the
|
919
|
-
* last page with `page.before=end`, `filter`, and `sort` . Yet the
|
920
|
-
* `page.last` cursor can be more convenient at times as user code does not
|
921
|
-
* need to remember the filter, sort, columns or page size configuration. All
|
922
|
-
* these information are read from the cursor.
|
923
|
-
*
|
924
|
-
* When using special cursors like `page.after="end"` or `page.before="end"`, we
|
925
|
-
* still allow `filter` and `sort` to be set.
|
926
|
-
*
|
927
|
-
* Example of getting the last page:
|
928
|
-
*
|
929
|
-
* ```json
|
930
|
-
* POST /db/demo:main/tables/table/query
|
931
|
-
* {
|
932
|
-
* "page": {
|
933
|
-
* "size": 10,
|
934
|
-
* "before": "end"
|
935
|
-
* }
|
936
|
-
* }
|
937
|
-
* ```
|
938
|
-
*/
|
939
|
-
const queryTable = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/query', method: 'post' }, variables));
|
940
|
-
exports.queryTable = queryTable;
|
941
|
-
/**
|
942
|
-
* Run a free text search operation across the database branch.
|
943
|
-
*/
|
944
|
-
const searchBranch = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/search', method: 'post' }, variables));
|
945
|
-
exports.searchBranch = searchBranch;
|
946
|
-
exports.operationsByTag = {
|
947
|
-
users: { getUser: exports.getUser, updateUser: exports.updateUser, deleteUser: exports.deleteUser, getUserAPIKeys: exports.getUserAPIKeys, createUserAPIKey: exports.createUserAPIKey, deleteUserAPIKey: exports.deleteUserAPIKey },
|
948
|
-
workspaces: {
|
949
|
-
createWorkspace: exports.createWorkspace,
|
950
|
-
getWorkspacesList: exports.getWorkspacesList,
|
951
|
-
getWorkspace: exports.getWorkspace,
|
952
|
-
updateWorkspace: exports.updateWorkspace,
|
953
|
-
deleteWorkspace: exports.deleteWorkspace,
|
954
|
-
getWorkspaceMembersList: exports.getWorkspaceMembersList,
|
955
|
-
updateWorkspaceMemberRole: exports.updateWorkspaceMemberRole,
|
956
|
-
removeWorkspaceMember: exports.removeWorkspaceMember,
|
957
|
-
inviteWorkspaceMember: exports.inviteWorkspaceMember,
|
958
|
-
cancelWorkspaceMemberInvite: exports.cancelWorkspaceMemberInvite,
|
959
|
-
resendWorkspaceMemberInvite: exports.resendWorkspaceMemberInvite,
|
960
|
-
acceptWorkspaceMemberInvite: exports.acceptWorkspaceMemberInvite
|
961
|
-
},
|
962
|
-
database: { getDatabaseList: exports.getDatabaseList, createDatabase: exports.createDatabase, deleteDatabase: exports.deleteDatabase },
|
963
|
-
branch: {
|
964
|
-
getBranchList: exports.getBranchList,
|
965
|
-
getBranchDetails: exports.getBranchDetails,
|
966
|
-
createBranch: exports.createBranch,
|
967
|
-
deleteBranch: exports.deleteBranch,
|
968
|
-
updateBranchMetadata: exports.updateBranchMetadata,
|
969
|
-
getBranchMetadata: exports.getBranchMetadata,
|
970
|
-
getBranchMigrationHistory: exports.getBranchMigrationHistory,
|
971
|
-
executeBranchMigrationPlan: exports.executeBranchMigrationPlan,
|
972
|
-
getBranchMigrationPlan: exports.getBranchMigrationPlan,
|
973
|
-
getBranchStats: exports.getBranchStats
|
974
|
-
},
|
975
|
-
table: {
|
976
|
-
createTable: exports.createTable,
|
977
|
-
deleteTable: exports.deleteTable,
|
978
|
-
updateTable: exports.updateTable,
|
979
|
-
getTableSchema: exports.getTableSchema,
|
980
|
-
setTableSchema: exports.setTableSchema,
|
981
|
-
getTableColumns: exports.getTableColumns,
|
982
|
-
addTableColumn: exports.addTableColumn,
|
983
|
-
getColumn: exports.getColumn,
|
984
|
-
deleteColumn: exports.deleteColumn,
|
985
|
-
updateColumn: exports.updateColumn
|
986
|
-
},
|
987
|
-
records: {
|
988
|
-
insertRecord: exports.insertRecord,
|
989
|
-
insertRecordWithID: exports.insertRecordWithID,
|
990
|
-
updateRecordWithID: exports.updateRecordWithID,
|
991
|
-
upsertRecordWithID: exports.upsertRecordWithID,
|
992
|
-
deleteRecord: exports.deleteRecord,
|
993
|
-
getRecord: exports.getRecord,
|
994
|
-
bulkInsertTableRecords: exports.bulkInsertTableRecords,
|
995
|
-
queryTable: exports.queryTable,
|
996
|
-
searchBranch: exports.searchBranch
|
997
|
-
}
|
998
|
-
};
|