@xata.io/client 0.0.0-beta.62e04e1 → 0.0.0-beta.645c53a

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.
Files changed (49) hide show
  1. package/.eslintrc.cjs +13 -0
  2. package/CHANGELOG.md +49 -0
  3. package/dist/api/client.d.ts +95 -0
  4. package/dist/api/client.js +236 -0
  5. package/dist/api/components.d.ts +1436 -0
  6. package/dist/api/components.js +997 -0
  7. package/dist/api/fetcher.d.ts +25 -0
  8. package/dist/api/fetcher.js +73 -0
  9. package/dist/api/index.d.ts +7 -0
  10. package/dist/api/index.js +21 -0
  11. package/dist/api/parameters.d.ts +16 -0
  12. package/dist/api/parameters.js +2 -0
  13. package/dist/api/providers.d.ts +8 -0
  14. package/dist/api/providers.js +30 -0
  15. package/dist/api/responses.d.ts +50 -0
  16. package/dist/api/responses.js +2 -0
  17. package/dist/api/schemas.d.ts +311 -0
  18. package/dist/api/schemas.js +2 -0
  19. package/dist/index.d.ts +2 -182
  20. package/dist/index.js +16 -499
  21. package/dist/schema/filters.d.ts +22 -0
  22. package/dist/schema/filters.js +25 -0
  23. package/dist/schema/index.d.ts +7 -0
  24. package/dist/schema/index.js +29 -0
  25. package/dist/schema/operators.d.ts +72 -0
  26. package/dist/schema/operators.js +91 -0
  27. package/dist/schema/pagination.d.ts +83 -0
  28. package/dist/schema/pagination.js +93 -0
  29. package/dist/schema/query.d.ts +118 -0
  30. package/dist/schema/query.js +242 -0
  31. package/dist/schema/record.d.ts +66 -0
  32. package/dist/schema/record.js +13 -0
  33. package/dist/schema/repository.d.ts +100 -0
  34. package/dist/schema/repository.js +288 -0
  35. package/dist/schema/selection.d.ts +25 -0
  36. package/dist/schema/selection.js +2 -0
  37. package/dist/{index.test.d.ts → schema/selection.spec.d.ts} +0 -0
  38. package/dist/schema/selection.spec.js +203 -0
  39. package/dist/util/lang.d.ts +5 -0
  40. package/dist/util/lang.js +22 -0
  41. package/dist/util/types.d.ts +13 -0
  42. package/dist/util/types.js +2 -0
  43. package/package.json +3 -3
  44. package/dist/index.test.js +0 -320
  45. package/dist/util/errors.d.ts +0 -3
  46. package/dist/util/errors.js +0 -9
  47. package/src/index.test.ts +0 -412
  48. package/src/index.ts +0 -667
  49. package/src/util/errors.ts +0 -6
@@ -0,0 +1,997 @@
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
+ * You can check for a value being not-null with `$exists`:
582
+ *
583
+ * ```json
584
+ * {
585
+ * "filter": {
586
+ * "$exists": "settings",
587
+ * },
588
+ * }
589
+ * ```
590
+ *
591
+ * This can be combined with `$all` or `$any` :
592
+ *
593
+ * ```json
594
+ * {
595
+ * "filter": {
596
+ * "$all": [
597
+ * {
598
+ * "$exists": "settings",
599
+ * },
600
+ * {
601
+ * "$exists": "name",
602
+ * },
603
+ * ],
604
+ * }
605
+ * }
606
+ * ```
607
+ *
608
+ * Or you can use the inverse operator `$notExists`:
609
+ *
610
+ * ```json
611
+ * {
612
+ * "filter": {
613
+ * "$notExists": "settings",
614
+ * },
615
+ * }
616
+ * ```
617
+ *
618
+ * #### Partial match
619
+ *
620
+ * `$contains` is the simplest operator for partial matching. We should generally
621
+ * discourage overusing `$contains` because it typically can't make use of
622
+ * indices.
623
+ *
624
+ * ```json
625
+ * {
626
+ * "filter": {
627
+ * "<column_name>": {
628
+ * "$contains": "value"
629
+ * }
630
+ * }
631
+ * }
632
+ * ```
633
+ *
634
+ * Wildcards are supported via the `$pattern` operator:
635
+ *
636
+ * ```json
637
+ * {
638
+ * "filter": {
639
+ * "<column_name>": {
640
+ * "$pattern": "v*alue*"
641
+ * }
642
+ * }
643
+ * }
644
+ * ```
645
+ *
646
+ * We could also have `$endsWith` and `$startsWith` operators:
647
+ *
648
+ * ```json
649
+ * {
650
+ * "filter": {
651
+ * "<column_name>": {
652
+ * "$endsWith": ".gz"
653
+ * },
654
+ * "<column_name>": {
655
+ * "$startsWith": "tmp-"
656
+ * }
657
+ * }
658
+ * }
659
+ * ```
660
+ *
661
+ * #### Numeric ranges
662
+ *
663
+ * ```json
664
+ * {
665
+ * "filter": {
666
+ * "<column_name>": {
667
+ * "$ge": 0,
668
+ * "$lt": 100
669
+ * }
670
+ * }
671
+ * }
672
+ * ```
673
+ *
674
+ * The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
675
+ *
676
+ *
677
+ * #### Negations
678
+ *
679
+ * A general `$not` operator can inverse any operation.
680
+ *
681
+ * ```json
682
+ * {
683
+ * "filter": {
684
+ * "$not": {
685
+ * "<column_name1>": "value1",
686
+ * "<column_name2>": "value1"
687
+ * }
688
+ * }
689
+ * }
690
+ * ```
691
+ *
692
+ * Note: in the above the two condition are AND together, so this does (NOT ( ...
693
+ * AND ...))
694
+ *
695
+ * Or more complex:
696
+ *
697
+ * ```json
698
+ * {
699
+ * "filter": {
700
+ * "$not": {
701
+ * "$any": [{
702
+ * "<column_name1>": "value1"
703
+ * }, {
704
+ * "$all": [{
705
+ * "<column_name2>": "value2"
706
+ * }, {
707
+ * "<column_name3>": "value3"
708
+ * }]
709
+ * }]
710
+ * }
711
+ * }
712
+ * }
713
+ * ```
714
+ *
715
+ * The `$not: { $any: {}}` can be shorted using the `$none` operator:
716
+ *
717
+ * ```json
718
+ * {
719
+ * "filter": {
720
+ * "$none": {
721
+ * "<column_name1>": "value1",
722
+ * "<column_name2>": "value1"
723
+ * }
724
+ * }
725
+ * }
726
+ * ```
727
+ *
728
+ * In addition, you can use operators like `$isNot` or `$notExists` to simplify expressions:
729
+ *
730
+ * ```json
731
+ * {
732
+ * "filter": {
733
+ * "<column_name>": {
734
+ * "$isNot": "2019-10-12T07:20:50.52Z"
735
+ * }
736
+ * }
737
+ * }
738
+ * ```
739
+ *
740
+ * #### Working with arrays
741
+ *
742
+ * To test that an array contains a value, use `$includes`.
743
+ *
744
+ * ```json
745
+ * {
746
+ * "filter": {
747
+ * "<array_name>": {
748
+ * "$includes": "value"
749
+ * }
750
+ * }
751
+ * }
752
+ * ```
753
+ *
754
+ * The `$includes` operator accepts a custom predicate that will check if any
755
+ * array values matches the predicate. For example a complex predicate can include
756
+ * the `$all` , `$contains` and `$endsWith` operators:
757
+ *
758
+ * ```json
759
+ * {
760
+ * "filter": {
761
+ * "<array name>": {
762
+ * "$includes": {
763
+ * "$all": [
764
+ * {"$contains": "label"},
765
+ * {"$not": {"$endsWith": "-debug"}}
766
+ * ]
767
+ * }
768
+ * }
769
+ * }
770
+ * }
771
+ * ```
772
+ *
773
+ * The `$includes` all operator succeeds if any column in the array matches the
774
+ * predicate. The `$includesAll` operator succeeds if all array items match the
775
+ * predicate. The `$includesNone` operator succeeds if no array item matches the
776
+ * predicate. The `$includes` operator is a synonym for the `$includesAny`
777
+ * operator.
778
+ *
779
+ * Here is an example of using the `$includesAll` operator:
780
+ *
781
+ * ```json
782
+ * {
783
+ * "filter": {
784
+ * "settings.labels": {
785
+ * "$includesAll": [
786
+ * {"$contains": "label"},
787
+ * ]
788
+ * }
789
+ * }
790
+ * }
791
+ * ```
792
+ *
793
+ * The above matches if all label values contain the string "labels".
794
+ *
795
+ * ### Sorting
796
+ *
797
+ * Sorting by one element:
798
+ *
799
+ * ```json
800
+ * POST /db/demo:main/tables/table/query
801
+ * {
802
+ * "sort": {
803
+ * "index": "asc"
804
+ * }
805
+ * }
806
+ * ```
807
+ *
808
+ * or descendently:
809
+ *
810
+ * ```json
811
+ * POST /db/demo:main/tables/table/query
812
+ * {
813
+ * "sort": {
814
+ * "index": "desc"
815
+ * }
816
+ * }
817
+ * ```
818
+ *
819
+ * Sorting by multiple fields:
820
+ *
821
+ * ```json
822
+ * POST /db/demo:main/tables/table/query
823
+ * {
824
+ * "sort": [
825
+ * {
826
+ * "index": "desc"
827
+ * },
828
+ * {
829
+ * "createdAt": "desc"
830
+ * }
831
+ * ]
832
+ * }
833
+ * ```
834
+ *
835
+ *
836
+ * ### Pagination
837
+ *
838
+ * We offer cursor pagination and offset pagination. The offset pagination is limited
839
+ * in the amount of data it can retrieve, so we recommend the cursor pagination if you have more than 1000 records.
840
+ *
841
+ * Example of size + offset pagination:
842
+ *
843
+ * ```json
844
+ * POST /db/demo:main/tables/table/query
845
+ * {
846
+ * "page": {
847
+ * "size": 100,
848
+ * "offset": 200
849
+ * }
850
+ * }
851
+ * ```
852
+ *
853
+ * 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.
854
+ * 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.
855
+ *
856
+ * Example of cursor pagination:
857
+ *
858
+ * ```json
859
+ * POST /db/demo:main/tables/table/query
860
+ * {
861
+ * "page": {
862
+ * "after":"fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD"
863
+ * }
864
+ * }
865
+ * ```
866
+ *
867
+ * 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:
868
+ *
869
+ * ```json
870
+ * {
871
+ * "meta": {
872
+ * "page": {
873
+ * "cursor": "fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD",
874
+ * "more": true
875
+ * }
876
+ * },
877
+ * "records": [...]
878
+ * }
879
+ * ```
880
+ *
881
+ * The `page` object might contain the follow keys, in addition to `size` and `offset` that were introduced before:
882
+ *
883
+ * - `after`: Return the next page 'after' the current cursor
884
+ * - `before`: Return the previous page 'before' the current cursor.
885
+ * - `first`: Return the first page in the table from a cursor.
886
+ * - `last`: Return the last N records in the table from a cursor, where N is the `page.size` parameter.
887
+ *
888
+ * The request will fail if an invalid cursor value is given to `page.before`,
889
+ * `page.after`, `page.first` , or `page.last`. No other cursor setting can be
890
+ * used if `page.first` or `page.last` is set in a query.
891
+ *
892
+ * If both `page.before` and `page.after` parameters are present we treat the
893
+ * request as a range query. The range query will return all entries after
894
+ * `page.after`, but before `page.before`, up to `page.size` or the maximum
895
+ * page size. This query requires both cursors to use the same filters and sort
896
+ * settings, plus we require `page.after < page.before`. The range query returns
897
+ * a new cursor. If the range encompass multiple pages the next page in the range
898
+ * can be queried by update `page.after` to the returned cursor while keeping the
899
+ * `page.before` cursor from the first range query.
900
+ *
901
+ * The `filter` , `columns`, `sort` , and `page.size` configuration will be
902
+ * encoded with the cursor. The pagination request will be invalid if
903
+ * `filter` or `sort` is set. The columns returned and page size can be changed
904
+ * anytime by passing the `columns` or `page.size` settings to the next query.
905
+ *
906
+ * **Special cursors:**
907
+ *
908
+ * - `page.after=end`: Result points past the last entry. The list of records
909
+ * returned is empty, but `page.meta.cursor` will include a cursor that can be
910
+ * used to "tail" the table from the end waiting for new data to be inserted.
911
+ * - `page.before=end`: This cursor returns the last page.
912
+ * - `page.first=<cursor>`: Go to first page. This is equivalent to querying the
913
+ * first page without a cursor but `filter` and `sort` . Yet the `page.first`
914
+ * cursor can be convenient at times as user code does not need to remember the
915
+ * filter, sort, columns or page size configuration. All these information are
916
+ * read from the cursor.
917
+ * - `page.last=<cursor>`: Go to the end of the table. This is equivalent to querying the
918
+ * last page with `page.before=end`, `filter`, and `sort` . Yet the
919
+ * `page.last` cursor can be more convenient at times as user code does not
920
+ * need to remember the filter, sort, columns or page size configuration. All
921
+ * these information are read from the cursor.
922
+ *
923
+ * When using special cursors like `page.after="end"` or `page.before="end"`, we
924
+ * still allow `filter` and `sort` to be set.
925
+ *
926
+ * Example of getting the last page:
927
+ *
928
+ * ```json
929
+ * POST /db/demo:main/tables/table/query
930
+ * {
931
+ * "page": {
932
+ * "size": 10,
933
+ * "before": "end"
934
+ * }
935
+ * }
936
+ * ```
937
+ */
938
+ const queryTable = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/query', method: 'post' }, variables));
939
+ exports.queryTable = queryTable;
940
+ /**
941
+ * Run a free text search operation across the database branch.
942
+ */
943
+ const searchBranch = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/search', method: 'post' }, variables));
944
+ exports.searchBranch = searchBranch;
945
+ exports.operationsByTag = {
946
+ users: { getUser: exports.getUser, updateUser: exports.updateUser, deleteUser: exports.deleteUser, getUserAPIKeys: exports.getUserAPIKeys, createUserAPIKey: exports.createUserAPIKey, deleteUserAPIKey: exports.deleteUserAPIKey },
947
+ workspaces: {
948
+ createWorkspace: exports.createWorkspace,
949
+ getWorkspacesList: exports.getWorkspacesList,
950
+ getWorkspace: exports.getWorkspace,
951
+ updateWorkspace: exports.updateWorkspace,
952
+ deleteWorkspace: exports.deleteWorkspace,
953
+ getWorkspaceMembersList: exports.getWorkspaceMembersList,
954
+ updateWorkspaceMemberRole: exports.updateWorkspaceMemberRole,
955
+ removeWorkspaceMember: exports.removeWorkspaceMember,
956
+ inviteWorkspaceMember: exports.inviteWorkspaceMember,
957
+ cancelWorkspaceMemberInvite: exports.cancelWorkspaceMemberInvite,
958
+ resendWorkspaceMemberInvite: exports.resendWorkspaceMemberInvite,
959
+ acceptWorkspaceMemberInvite: exports.acceptWorkspaceMemberInvite
960
+ },
961
+ database: { getDatabaseList: exports.getDatabaseList, createDatabase: exports.createDatabase, deleteDatabase: exports.deleteDatabase },
962
+ branch: {
963
+ getBranchList: exports.getBranchList,
964
+ getBranchDetails: exports.getBranchDetails,
965
+ createBranch: exports.createBranch,
966
+ deleteBranch: exports.deleteBranch,
967
+ updateBranchMetadata: exports.updateBranchMetadata,
968
+ getBranchMetadata: exports.getBranchMetadata,
969
+ getBranchMigrationHistory: exports.getBranchMigrationHistory,
970
+ executeBranchMigrationPlan: exports.executeBranchMigrationPlan,
971
+ getBranchMigrationPlan: exports.getBranchMigrationPlan,
972
+ getBranchStats: exports.getBranchStats
973
+ },
974
+ table: {
975
+ createTable: exports.createTable,
976
+ deleteTable: exports.deleteTable,
977
+ updateTable: exports.updateTable,
978
+ getTableSchema: exports.getTableSchema,
979
+ setTableSchema: exports.setTableSchema,
980
+ getTableColumns: exports.getTableColumns,
981
+ addTableColumn: exports.addTableColumn,
982
+ getColumn: exports.getColumn,
983
+ deleteColumn: exports.deleteColumn,
984
+ updateColumn: exports.updateColumn
985
+ },
986
+ records: {
987
+ insertRecord: exports.insertRecord,
988
+ insertRecordWithID: exports.insertRecordWithID,
989
+ updateRecordWithID: exports.updateRecordWithID,
990
+ upsertRecordWithID: exports.upsertRecordWithID,
991
+ deleteRecord: exports.deleteRecord,
992
+ getRecord: exports.getRecord,
993
+ bulkInsertTableRecords: exports.bulkInsertTableRecords,
994
+ queryTable: exports.queryTable,
995
+ searchBranch: exports.searchBranch
996
+ }
997
+ };