@xata.io/client 0.0.0-beta.18f8d57 → 0.0.0-beta.4e4e7fc

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