@xata.io/client 0.0.0-beta.c9e08d0 → 0.0.0-beta.cae436d

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