@xata.io/client 0.2.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/api/client.d.ts +95 -0
  3. package/dist/api/client.js +235 -0
  4. package/dist/api/components.d.ts +1440 -0
  5. package/dist/api/components.js +1001 -0
  6. package/dist/api/fetcher.d.ts +25 -0
  7. package/dist/api/fetcher.js +78 -0
  8. package/dist/api/index.d.ts +7 -0
  9. package/dist/api/index.js +21 -0
  10. package/dist/api/parameters.d.ts +16 -0
  11. package/dist/api/parameters.js +2 -0
  12. package/dist/api/providers.d.ts +8 -0
  13. package/dist/api/providers.js +29 -0
  14. package/dist/api/responses.d.ts +44 -0
  15. package/dist/api/responses.js +2 -0
  16. package/dist/api/schemas.d.ts +311 -0
  17. package/dist/api/schemas.js +2 -0
  18. package/dist/index.d.ts +2 -133
  19. package/dist/index.js +16 -368
  20. package/dist/schema/filters.d.ts +20 -0
  21. package/dist/schema/filters.js +24 -0
  22. package/dist/schema/index.d.ts +6 -0
  23. package/dist/schema/index.js +26 -0
  24. package/dist/schema/operators.d.ts +72 -0
  25. package/dist/schema/operators.js +91 -0
  26. package/dist/schema/pagination.d.ts +83 -0
  27. package/dist/schema/pagination.js +94 -0
  28. package/dist/schema/query.d.ts +129 -0
  29. package/dist/schema/query.js +254 -0
  30. package/dist/schema/record.d.ts +44 -0
  31. package/dist/schema/record.js +2 -0
  32. package/dist/schema/repository.d.ts +104 -0
  33. package/dist/schema/repository.js +280 -0
  34. package/dist/schema/selection.d.ts +12 -0
  35. package/dist/schema/selection.js +2 -0
  36. package/dist/util/lang.d.ts +2 -0
  37. package/dist/util/lang.js +10 -0
  38. package/dist/util/types.d.ts +3 -0
  39. package/dist/util/types.js +2 -0
  40. package/package.json +3 -3
  41. package/dist/index.test.d.ts +0 -1
  42. package/dist/index.test.js +0 -304
  43. package/src/index.test.ts +0 -392
  44. package/src/index.ts +0 -506
@@ -0,0 +1,1440 @@
1
+ /**
2
+ * Generated by @openapi-codegen
3
+ *
4
+ * @version 1.0
5
+ */
6
+ import { FetcherExtraProps } from './fetcher';
7
+ import type * as Schemas from './schemas';
8
+ import type * as Responses from './responses';
9
+ export declare type GetUserVariables = FetcherExtraProps;
10
+ /**
11
+ * Return details of the user making the request
12
+ */
13
+ export declare const getUser: (variables: GetUserVariables) => Promise<Schemas.UserWithID>;
14
+ export declare type UpdateUserVariables = {
15
+ body: Schemas.User;
16
+ } & FetcherExtraProps;
17
+ /**
18
+ * Update user info
19
+ */
20
+ export declare const updateUser: (variables: UpdateUserVariables) => Promise<Schemas.UserWithID>;
21
+ export declare type DeleteUserVariables = FetcherExtraProps;
22
+ /**
23
+ * Delete the user making the request
24
+ */
25
+ export declare const deleteUser: (variables: DeleteUserVariables) => Promise<undefined>;
26
+ export declare type GetUserAPIKeysResponse = {
27
+ keys: {
28
+ name: string;
29
+ createdAt: Schemas.DateTime;
30
+ }[];
31
+ };
32
+ export declare type GetUserAPIKeysVariables = FetcherExtraProps;
33
+ /**
34
+ * Retrieve a list of existing user API keys
35
+ */
36
+ export declare const getUserAPIKeys: (variables: GetUserAPIKeysVariables) => Promise<GetUserAPIKeysResponse>;
37
+ export declare type CreateUserAPIKeyPathParams = {
38
+ keyName: Schemas.APIKeyName;
39
+ };
40
+ export declare type CreateUserAPIKeyResponse = {
41
+ name: string;
42
+ key: string;
43
+ createdAt: Schemas.DateTime;
44
+ };
45
+ export declare type CreateUserAPIKeyVariables = {
46
+ pathParams: CreateUserAPIKeyPathParams;
47
+ } & FetcherExtraProps;
48
+ /**
49
+ * Create and return new API key
50
+ */
51
+ export declare const createUserAPIKey: (variables: CreateUserAPIKeyVariables) => Promise<CreateUserAPIKeyResponse>;
52
+ export declare type DeleteUserAPIKeyPathParams = {
53
+ keyName: Schemas.APIKeyName;
54
+ };
55
+ export declare type DeleteUserAPIKeyVariables = {
56
+ pathParams: DeleteUserAPIKeyPathParams;
57
+ } & FetcherExtraProps;
58
+ /**
59
+ * Delete an existing API key
60
+ */
61
+ export declare const deleteUserAPIKey: (variables: DeleteUserAPIKeyVariables) => Promise<undefined>;
62
+ export declare type CreateWorkspaceVariables = {
63
+ body: Schemas.WorkspaceMeta;
64
+ } & FetcherExtraProps;
65
+ /**
66
+ * Creates a new workspace with the user requesting it as its single owner.
67
+ */
68
+ export declare const createWorkspace: (variables: CreateWorkspaceVariables) => Promise<Schemas.Workspace>;
69
+ export declare type GetWorkspacesListResponse = {
70
+ workspaces: {
71
+ id: Schemas.WorkspaceID;
72
+ name: string;
73
+ slug: string;
74
+ role: Schemas.Role;
75
+ }[];
76
+ };
77
+ export declare type GetWorkspacesListVariables = FetcherExtraProps;
78
+ /**
79
+ * Retrieve the list of workspaces the user belongs to
80
+ */
81
+ export declare const getWorkspacesList: (variables: GetWorkspacesListVariables) => Promise<GetWorkspacesListResponse>;
82
+ export declare type GetWorkspacePathParams = {
83
+ workspaceId: Schemas.WorkspaceID;
84
+ };
85
+ export declare type GetWorkspaceVariables = {
86
+ pathParams: GetWorkspacePathParams;
87
+ } & FetcherExtraProps;
88
+ /**
89
+ * Retrieve workspace info from a workspace ID
90
+ */
91
+ export declare const getWorkspace: (variables: GetWorkspaceVariables) => Promise<Schemas.Workspace>;
92
+ export declare type UpdateWorkspacePathParams = {
93
+ workspaceId: Schemas.WorkspaceID;
94
+ };
95
+ export declare type UpdateWorkspaceVariables = {
96
+ body: Schemas.WorkspaceMeta;
97
+ pathParams: UpdateWorkspacePathParams;
98
+ } & FetcherExtraProps;
99
+ /**
100
+ * Update workspace info
101
+ */
102
+ export declare const updateWorkspace: (variables: UpdateWorkspaceVariables) => Promise<Schemas.Workspace>;
103
+ export declare type DeleteWorkspacePathParams = {
104
+ workspaceId: Schemas.WorkspaceID;
105
+ };
106
+ export declare type DeleteWorkspaceVariables = {
107
+ pathParams: DeleteWorkspacePathParams;
108
+ } & FetcherExtraProps;
109
+ /**
110
+ * Delete the workspace with the provided ID
111
+ */
112
+ export declare const deleteWorkspace: (variables: DeleteWorkspaceVariables) => Promise<undefined>;
113
+ export declare type GetWorkspaceMembersListPathParams = {
114
+ workspaceId: Schemas.WorkspaceID;
115
+ };
116
+ export declare type GetWorkspaceMembersListVariables = {
117
+ pathParams: GetWorkspaceMembersListPathParams;
118
+ } & FetcherExtraProps;
119
+ /**
120
+ * Retrieve the list of members of the given workspace
121
+ */
122
+ export declare const getWorkspaceMembersList: (variables: GetWorkspaceMembersListVariables) => Promise<Schemas.WorkspaceMembers>;
123
+ export declare type UpdateWorkspaceMemberRolePathParams = {
124
+ workspaceId: Schemas.WorkspaceID;
125
+ userId: Schemas.UserID;
126
+ };
127
+ export declare type UpdateWorkspaceMemberRoleRequestBody = {
128
+ role: Schemas.Role;
129
+ };
130
+ export declare type UpdateWorkspaceMemberRoleVariables = {
131
+ body: UpdateWorkspaceMemberRoleRequestBody;
132
+ pathParams: UpdateWorkspaceMemberRolePathParams;
133
+ } & FetcherExtraProps;
134
+ /**
135
+ * 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.
136
+ */
137
+ export declare const updateWorkspaceMemberRole: (variables: UpdateWorkspaceMemberRoleVariables) => Promise<undefined>;
138
+ export declare type RemoveWorkspaceMemberPathParams = {
139
+ workspaceId: Schemas.WorkspaceID;
140
+ userId: Schemas.UserID;
141
+ };
142
+ export declare type RemoveWorkspaceMemberVariables = {
143
+ pathParams: RemoveWorkspaceMemberPathParams;
144
+ } & FetcherExtraProps;
145
+ /**
146
+ * Remove the member from the workspace
147
+ */
148
+ export declare const removeWorkspaceMember: (variables: RemoveWorkspaceMemberVariables) => Promise<undefined>;
149
+ export declare type InviteWorkspaceMemberPathParams = {
150
+ workspaceId: Schemas.WorkspaceID;
151
+ };
152
+ export declare type InviteWorkspaceMemberRequestBody = {
153
+ email: string;
154
+ role: Schemas.Role;
155
+ };
156
+ export declare type InviteWorkspaceMemberVariables = {
157
+ body: InviteWorkspaceMemberRequestBody;
158
+ pathParams: InviteWorkspaceMemberPathParams;
159
+ } & FetcherExtraProps;
160
+ /**
161
+ * Invite some user to join the workspace with the given role
162
+ */
163
+ export declare const inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<Schemas.WorkspaceInvite>;
164
+ export declare type CancelWorkspaceMemberInvitePathParams = {
165
+ workspaceId: Schemas.WorkspaceID;
166
+ inviteId: Schemas.InviteID;
167
+ };
168
+ export declare type CancelWorkspaceMemberInviteVariables = {
169
+ pathParams: CancelWorkspaceMemberInvitePathParams;
170
+ } & FetcherExtraProps;
171
+ /**
172
+ * This operation provides a way to cancel invites by deleting them. Already accepted invites cannot be deleted.
173
+ */
174
+ export declare const cancelWorkspaceMemberInvite: (variables: CancelWorkspaceMemberInviteVariables) => Promise<undefined>;
175
+ export declare type ResendWorkspaceMemberInvitePathParams = {
176
+ workspaceId: Schemas.WorkspaceID;
177
+ inviteId: Schemas.InviteID;
178
+ };
179
+ export declare type ResendWorkspaceMemberInviteVariables = {
180
+ pathParams: ResendWorkspaceMemberInvitePathParams;
181
+ } & FetcherExtraProps;
182
+ /**
183
+ * This operation provides a way to resend an Invite notification. Invite notifications can only be sent for Invites not yet accepted.
184
+ */
185
+ export declare const resendWorkspaceMemberInvite: (variables: ResendWorkspaceMemberInviteVariables) => Promise<undefined>;
186
+ export declare type AcceptWorkspaceMemberInvitePathParams = {
187
+ workspaceId: Schemas.WorkspaceID;
188
+ inviteKey: Schemas.InviteKey;
189
+ };
190
+ export declare type AcceptWorkspaceMemberInviteVariables = {
191
+ pathParams: AcceptWorkspaceMemberInvitePathParams;
192
+ } & FetcherExtraProps;
193
+ /**
194
+ * Accept the invitation to join a workspace. If the operation succeeds the user will be a member of the workspace
195
+ */
196
+ export declare const acceptWorkspaceMemberInvite: (variables: AcceptWorkspaceMemberInviteVariables) => Promise<undefined>;
197
+ export declare type GetDatabaseListPathParams = {
198
+ workspace: string;
199
+ };
200
+ export declare type GetDatabaseListVariables = {
201
+ pathParams: GetDatabaseListPathParams;
202
+ } & FetcherExtraProps;
203
+ /**
204
+ * List all databases available in your Workspace.
205
+ */
206
+ export declare const getDatabaseList: (variables: GetDatabaseListVariables) => Promise<Schemas.ListDatabasesResponse>;
207
+ export declare type GetBranchListPathParams = {
208
+ dbName: Schemas.DBName;
209
+ workspace: string;
210
+ };
211
+ export declare type GetBranchListVariables = {
212
+ pathParams: GetBranchListPathParams;
213
+ } & FetcherExtraProps;
214
+ /**
215
+ * List all available Branches
216
+ */
217
+ export declare const getBranchList: (variables: GetBranchListVariables) => Promise<Schemas.ListBranchesResponse>;
218
+ export declare type CreateDatabasePathParams = {
219
+ dbName: Schemas.DBName;
220
+ workspace: string;
221
+ };
222
+ export declare type CreateDatabaseResponse = {
223
+ databaseName: string;
224
+ branchName?: string;
225
+ };
226
+ export declare type CreateDatabaseRequestBody = {
227
+ displayName?: string;
228
+ branchName?: string;
229
+ ui?: {
230
+ color?: string;
231
+ };
232
+ metadata?: Schemas.BranchMetadata;
233
+ };
234
+ export declare type CreateDatabaseVariables = {
235
+ body?: CreateDatabaseRequestBody;
236
+ pathParams: CreateDatabasePathParams;
237
+ } & FetcherExtraProps;
238
+ /**
239
+ * Create Database with identifier name
240
+ */
241
+ export declare const createDatabase: (variables: CreateDatabaseVariables) => Promise<CreateDatabaseResponse>;
242
+ export declare type DeleteDatabasePathParams = {
243
+ dbName: Schemas.DBName;
244
+ workspace: string;
245
+ };
246
+ export declare type DeleteDatabaseVariables = {
247
+ pathParams: DeleteDatabasePathParams;
248
+ } & FetcherExtraProps;
249
+ /**
250
+ * Delete a database and all of its branches and tables permanently.
251
+ */
252
+ export declare const deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
253
+ export declare type GetBranchDetailsPathParams = {
254
+ dbBranchName: Schemas.DBBranchName;
255
+ workspace: string;
256
+ };
257
+ export declare type GetBranchDetailsVariables = {
258
+ pathParams: GetBranchDetailsPathParams;
259
+ } & FetcherExtraProps;
260
+ export declare const getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<Schemas.DBBranch>;
261
+ export declare type CreateBranchPathParams = {
262
+ dbBranchName: Schemas.DBBranchName;
263
+ workspace: string;
264
+ };
265
+ export declare type CreateBranchQueryParams = {
266
+ from?: string;
267
+ };
268
+ export declare type CreateBranchRequestBody = {
269
+ from?: string;
270
+ metadata?: Schemas.BranchMetadata;
271
+ };
272
+ export declare type CreateBranchVariables = {
273
+ body?: CreateBranchRequestBody;
274
+ pathParams: CreateBranchPathParams;
275
+ queryParams?: CreateBranchQueryParams;
276
+ } & FetcherExtraProps;
277
+ export declare const createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
278
+ export declare type DeleteBranchPathParams = {
279
+ dbBranchName: Schemas.DBBranchName;
280
+ workspace: string;
281
+ };
282
+ export declare type DeleteBranchVariables = {
283
+ pathParams: DeleteBranchPathParams;
284
+ } & FetcherExtraProps;
285
+ /**
286
+ * Delete the branch in the database and all its resources
287
+ */
288
+ export declare const deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
289
+ export declare type UpdateBranchMetadataPathParams = {
290
+ dbBranchName: Schemas.DBBranchName;
291
+ workspace: string;
292
+ };
293
+ export declare type UpdateBranchMetadataVariables = {
294
+ body?: Schemas.BranchMetadata;
295
+ pathParams: UpdateBranchMetadataPathParams;
296
+ } & FetcherExtraProps;
297
+ /**
298
+ * Update the branch metadata
299
+ */
300
+ export declare const updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
301
+ export declare type GetBranchMetadataPathParams = {
302
+ dbBranchName: Schemas.DBBranchName;
303
+ workspace: string;
304
+ };
305
+ export declare type GetBranchMetadataVariables = {
306
+ pathParams: GetBranchMetadataPathParams;
307
+ } & FetcherExtraProps;
308
+ export declare const getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<Schemas.BranchMetadata>;
309
+ export declare type GetBranchMigrationHistoryPathParams = {
310
+ dbBranchName: Schemas.DBBranchName;
311
+ workspace: string;
312
+ };
313
+ export declare type GetBranchMigrationHistoryResponse = {
314
+ startedFrom?: Schemas.StartedFromMetadata;
315
+ migrations?: Schemas.BranchMigration[];
316
+ };
317
+ export declare type GetBranchMigrationHistoryRequestBody = {
318
+ limit?: number;
319
+ startFrom?: string;
320
+ };
321
+ export declare type GetBranchMigrationHistoryVariables = {
322
+ body?: GetBranchMigrationHistoryRequestBody;
323
+ pathParams: GetBranchMigrationHistoryPathParams;
324
+ } & FetcherExtraProps;
325
+ export declare const getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
326
+ export declare type ExecuteBranchMigrationPlanPathParams = {
327
+ dbBranchName: Schemas.DBBranchName;
328
+ workspace: string;
329
+ };
330
+ export declare type ExecuteBranchMigrationPlanRequestBody = {
331
+ version: number;
332
+ migration: Schemas.BranchMigration;
333
+ };
334
+ export declare type ExecuteBranchMigrationPlanVariables = {
335
+ body: ExecuteBranchMigrationPlanRequestBody;
336
+ pathParams: ExecuteBranchMigrationPlanPathParams;
337
+ } & FetcherExtraProps;
338
+ /**
339
+ * Apply a migration plan to the branch
340
+ */
341
+ export declare const executeBranchMigrationPlan: (variables: ExecuteBranchMigrationPlanVariables) => Promise<undefined>;
342
+ export declare type GetBranchMigrationPlanPathParams = {
343
+ dbBranchName: Schemas.DBBranchName;
344
+ workspace: string;
345
+ };
346
+ export declare type GetBranchMigrationPlanVariables = {
347
+ body: Schemas.Schema;
348
+ pathParams: GetBranchMigrationPlanPathParams;
349
+ } & FetcherExtraProps;
350
+ /**
351
+ * Compute a migration plan from a target schema the branch should be migrated too.
352
+ */
353
+ export declare const getBranchMigrationPlan: (variables: GetBranchMigrationPlanVariables) => Promise<Responses.BranchMigrationPlan>;
354
+ export declare type GetBranchStatsPathParams = {
355
+ dbBranchName: Schemas.DBBranchName;
356
+ workspace: string;
357
+ };
358
+ export declare type GetBranchStatsResponse = {
359
+ timestamp: string;
360
+ interval: string;
361
+ resolution: string;
362
+ numberOfRecords?: Schemas.MetricsDatapoint[];
363
+ writesOverTime?: Schemas.MetricsDatapoint[];
364
+ readsOverTime?: Schemas.MetricsDatapoint[];
365
+ readLatency?: Schemas.MetricsLatency;
366
+ writeLatency?: Schemas.MetricsLatency;
367
+ warning?: string;
368
+ };
369
+ export declare type GetBranchStatsVariables = {
370
+ pathParams: GetBranchStatsPathParams;
371
+ } & FetcherExtraProps;
372
+ /**
373
+ * Get branch usage metrics.
374
+ */
375
+ export declare const getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
376
+ export declare type CreateTablePathParams = {
377
+ dbBranchName: Schemas.DBBranchName;
378
+ tableName: Schemas.TableName;
379
+ workspace: string;
380
+ };
381
+ export declare type CreateTableVariables = {
382
+ pathParams: CreateTablePathParams;
383
+ } & FetcherExtraProps;
384
+ /**
385
+ * Creates a new table with the given name. Returns 422 if a table with the same name already exists.
386
+ */
387
+ export declare const createTable: (variables: CreateTableVariables) => Promise<undefined>;
388
+ export declare type DeleteTablePathParams = {
389
+ dbBranchName: Schemas.DBBranchName;
390
+ tableName: Schemas.TableName;
391
+ workspace: string;
392
+ };
393
+ export declare type DeleteTableVariables = {
394
+ pathParams: DeleteTablePathParams;
395
+ } & FetcherExtraProps;
396
+ /**
397
+ * Deletes the table with the given name.
398
+ */
399
+ export declare const deleteTable: (variables: DeleteTableVariables) => Promise<undefined>;
400
+ export declare type UpdateTablePathParams = {
401
+ dbBranchName: Schemas.DBBranchName;
402
+ tableName: Schemas.TableName;
403
+ workspace: string;
404
+ };
405
+ export declare type UpdateTableRequestBody = {
406
+ name: string;
407
+ };
408
+ export declare type UpdateTableVariables = {
409
+ body: UpdateTableRequestBody;
410
+ pathParams: UpdateTablePathParams;
411
+ } & FetcherExtraProps;
412
+ /**
413
+ * Update table. Currently there is only one update operation supported: renaming the table by providing a new name.
414
+ *
415
+ * In the example below, we rename a table from “users” to “people”:
416
+ *
417
+ * ```jsx
418
+ * PATCH /db/test:main/tables/users
419
+ * {
420
+ * "name": "people"
421
+ * }
422
+ * ```
423
+ */
424
+ export declare const updateTable: (variables: UpdateTableVariables) => Promise<undefined>;
425
+ export declare type GetTableSchemaPathParams = {
426
+ dbBranchName: Schemas.DBBranchName;
427
+ tableName: Schemas.TableName;
428
+ workspace: string;
429
+ };
430
+ export declare type GetTableSchemaResponse = {
431
+ columns: Schemas.Column[];
432
+ };
433
+ export declare type GetTableSchemaVariables = {
434
+ pathParams: GetTableSchemaPathParams;
435
+ } & FetcherExtraProps;
436
+ export declare const getTableSchema: (variables: GetTableSchemaVariables) => Promise<GetTableSchemaResponse>;
437
+ export declare type SetTableSchemaPathParams = {
438
+ dbBranchName: Schemas.DBBranchName;
439
+ tableName: Schemas.TableName;
440
+ workspace: string;
441
+ };
442
+ export declare type SetTableSchemaRequestBody = {
443
+ columns: Schemas.Column[];
444
+ };
445
+ export declare type SetTableSchemaVariables = {
446
+ body: SetTableSchemaRequestBody;
447
+ pathParams: SetTableSchemaPathParams;
448
+ } & FetcherExtraProps;
449
+ export declare const setTableSchema: (variables: SetTableSchemaVariables) => Promise<undefined>;
450
+ export declare type GetTableColumnsPathParams = {
451
+ dbBranchName: Schemas.DBBranchName;
452
+ tableName: Schemas.TableName;
453
+ workspace: string;
454
+ };
455
+ export declare type GetTableColumnsResponse = {
456
+ columns: Schemas.Column[];
457
+ };
458
+ export declare type GetTableColumnsVariables = {
459
+ pathParams: GetTableColumnsPathParams;
460
+ } & FetcherExtraProps;
461
+ /**
462
+ * Retrieves the list of table columns and their definition. This endpoint returns the column list with object columns being reported with their
463
+ * full dot-separated path (flattened).
464
+ */
465
+ export declare const getTableColumns: (variables: GetTableColumnsVariables) => Promise<GetTableColumnsResponse>;
466
+ export declare type AddTableColumnPathParams = {
467
+ dbBranchName: Schemas.DBBranchName;
468
+ tableName: Schemas.TableName;
469
+ workspace: string;
470
+ };
471
+ export declare type AddTableColumnVariables = {
472
+ body: Schemas.Column;
473
+ pathParams: AddTableColumnPathParams;
474
+ } & FetcherExtraProps;
475
+ /**
476
+ * 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
477
+ * contain the full path separated by dots. If the parent objects do not exists, they will be automatically created. For example,
478
+ * passing `"name": "address.city"` will auto-create the `address` object if it doesn't exist.
479
+ */
480
+ export declare const addTableColumn: (variables: AddTableColumnVariables) => Promise<Responses.MigrationIdResponse>;
481
+ export declare type GetColumnPathParams = {
482
+ dbBranchName: Schemas.DBBranchName;
483
+ tableName: Schemas.TableName;
484
+ columnName: Schemas.ColumnName;
485
+ workspace: string;
486
+ };
487
+ export declare type GetColumnVariables = {
488
+ pathParams: GetColumnPathParams;
489
+ } & FetcherExtraProps;
490
+ /**
491
+ * Get the definition of a single column. To refer to sub-objects, the column name can contain dots. For example `address.country`.
492
+ */
493
+ export declare const getColumn: (variables: GetColumnVariables) => Promise<Schemas.Column>;
494
+ export declare type DeleteColumnPathParams = {
495
+ dbBranchName: Schemas.DBBranchName;
496
+ tableName: Schemas.TableName;
497
+ columnName: Schemas.ColumnName;
498
+ workspace: string;
499
+ };
500
+ export declare type DeleteColumnVariables = {
501
+ pathParams: DeleteColumnPathParams;
502
+ } & FetcherExtraProps;
503
+ /**
504
+ * Deletes the specified column. To refer to sub-objects, the column name can contain dots. For example `address.country`.
505
+ */
506
+ export declare const deleteColumn: (variables: DeleteColumnVariables) => Promise<Responses.MigrationIdResponse>;
507
+ export declare type UpdateColumnPathParams = {
508
+ dbBranchName: Schemas.DBBranchName;
509
+ tableName: Schemas.TableName;
510
+ columnName: Schemas.ColumnName;
511
+ workspace: string;
512
+ };
513
+ export declare type UpdateColumnRequestBody = {
514
+ name: string;
515
+ };
516
+ export declare type UpdateColumnVariables = {
517
+ body: UpdateColumnRequestBody;
518
+ pathParams: UpdateColumnPathParams;
519
+ } & FetcherExtraProps;
520
+ /**
521
+ * 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`.
522
+ */
523
+ export declare const updateColumn: (variables: UpdateColumnVariables) => Promise<Responses.MigrationIdResponse>;
524
+ export declare type InsertRecordPathParams = {
525
+ dbBranchName: Schemas.DBBranchName;
526
+ tableName: Schemas.TableName;
527
+ workspace: string;
528
+ };
529
+ export declare type InsertRecordResponse = {
530
+ id: string;
531
+ xata: {
532
+ version: number;
533
+ };
534
+ };
535
+ export declare type InsertRecordVariables = {
536
+ body?: Record<string, any>;
537
+ pathParams: InsertRecordPathParams;
538
+ } & FetcherExtraProps;
539
+ /**
540
+ * Insert a new Record into the Table
541
+ */
542
+ export declare const insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
543
+ export declare type InsertRecordWithIDPathParams = {
544
+ dbBranchName: Schemas.DBBranchName;
545
+ tableName: Schemas.TableName;
546
+ recordId: Schemas.RecordID;
547
+ workspace: string;
548
+ };
549
+ export declare type InsertRecordWithIDQueryParams = {
550
+ createOnly?: boolean;
551
+ ifVersion?: number;
552
+ };
553
+ export declare type InsertRecordWithIDVariables = {
554
+ body?: Record<string, any>;
555
+ pathParams: InsertRecordWithIDPathParams;
556
+ queryParams?: InsertRecordWithIDQueryParams;
557
+ } & FetcherExtraProps;
558
+ /**
559
+ * 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.
560
+ */
561
+ export declare const insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<Responses.RecordUpdateResponse>;
562
+ export declare type UpdateRecordWithIDPathParams = {
563
+ dbBranchName: Schemas.DBBranchName;
564
+ tableName: Schemas.TableName;
565
+ recordId: Schemas.RecordID;
566
+ workspace: string;
567
+ };
568
+ export declare type UpdateRecordWithIDQueryParams = {
569
+ ifVersion?: number;
570
+ };
571
+ export declare type UpdateRecordWithIDVariables = {
572
+ body?: Record<string, any>;
573
+ pathParams: UpdateRecordWithIDPathParams;
574
+ queryParams?: UpdateRecordWithIDQueryParams;
575
+ } & FetcherExtraProps;
576
+ export declare const updateRecordWithID: (variables: UpdateRecordWithIDVariables) => Promise<Responses.RecordUpdateResponse>;
577
+ export declare type UpsertRecordWithIDPathParams = {
578
+ dbBranchName: Schemas.DBBranchName;
579
+ tableName: Schemas.TableName;
580
+ recordId: Schemas.RecordID;
581
+ workspace: string;
582
+ };
583
+ export declare type UpsertRecordWithIDQueryParams = {
584
+ ifVersion?: number;
585
+ };
586
+ export declare type UpsertRecordWithIDVariables = {
587
+ body?: Record<string, any>;
588
+ pathParams: UpsertRecordWithIDPathParams;
589
+ queryParams?: UpsertRecordWithIDQueryParams;
590
+ } & FetcherExtraProps;
591
+ export declare const upsertRecordWithID: (variables: UpsertRecordWithIDVariables) => Promise<Responses.RecordUpdateResponse>;
592
+ export declare type DeleteRecordPathParams = {
593
+ dbBranchName: Schemas.DBBranchName;
594
+ tableName: Schemas.TableName;
595
+ recordId: Schemas.RecordID;
596
+ workspace: string;
597
+ };
598
+ export declare type DeleteRecordVariables = {
599
+ pathParams: DeleteRecordPathParams;
600
+ } & FetcherExtraProps;
601
+ export declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
602
+ export declare type GetRecordPathParams = {
603
+ dbBranchName: Schemas.DBBranchName;
604
+ tableName: Schemas.TableName;
605
+ recordId: Schemas.RecordID;
606
+ workspace: string;
607
+ };
608
+ export declare type GetRecordRequestBody = {
609
+ columns?: Schemas.ColumnsFilter;
610
+ };
611
+ export declare type GetRecordVariables = {
612
+ body?: GetRecordRequestBody;
613
+ pathParams: GetRecordPathParams;
614
+ } & FetcherExtraProps;
615
+ /**
616
+ * Retrieve record by ID
617
+ */
618
+ export declare const getRecord: (variables: GetRecordVariables) => Promise<Schemas.XataRecord>;
619
+ export declare type BulkInsertTableRecordsPathParams = {
620
+ dbBranchName: Schemas.DBBranchName;
621
+ tableName: Schemas.TableName;
622
+ workspace: string;
623
+ };
624
+ export declare type BulkInsertTableRecordsResponse = {
625
+ recordIDs: string[];
626
+ };
627
+ export declare type BulkInsertTableRecordsRequestBody = {
628
+ records: Record<string, any>[];
629
+ };
630
+ export declare type BulkInsertTableRecordsVariables = {
631
+ body: BulkInsertTableRecordsRequestBody;
632
+ pathParams: BulkInsertTableRecordsPathParams;
633
+ } & FetcherExtraProps;
634
+ /**
635
+ * Bulk insert records
636
+ */
637
+ export declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
638
+ export declare type QueryTablePathParams = {
639
+ dbBranchName: Schemas.DBBranchName;
640
+ tableName: Schemas.TableName;
641
+ workspace: string;
642
+ };
643
+ export declare type QueryTableRequestBody = {
644
+ filter?: Schemas.FilterExpression;
645
+ sort?: Schemas.SortExpression;
646
+ page?: Schemas.PageConfig;
647
+ columns?: Schemas.ColumnsFilter;
648
+ };
649
+ export declare type QueryTableVariables = {
650
+ body?: QueryTableRequestBody;
651
+ pathParams: QueryTablePathParams;
652
+ } & FetcherExtraProps;
653
+ /**
654
+ * The Query Table API can be used to retrieve all records in a table.
655
+ * The API support filtering, sorting, selecting a subset of columns, and pagination.
656
+ *
657
+ * The overall structure of the request looks like this:
658
+ *
659
+ * ```json
660
+ * // POST /db/<dbname>:<branch>/tables/<table>/query
661
+ * {
662
+ * "columns": [...],
663
+ * "filter": {
664
+ * "$all": [...]
665
+ * "$any": [...]
666
+ * ...
667
+ * },
668
+ * "sort": {
669
+ * "multiple": [...]
670
+ * ...
671
+ * },
672
+ * "page": {
673
+ * ...
674
+ * }
675
+ * }
676
+ * ```
677
+ *
678
+ * ### Column selection
679
+ *
680
+ * If the `columns` array is not specified, all columns are included. For link
681
+ * fields, only the ID column of the linked records is included in the response.
682
+ *
683
+ * If the `columns` array is specified, only the selected columns are included.
684
+ * The `*` wildcard can be used to select all columns of the given array
685
+ *
686
+ * For objects and link fields, if the column name of the object is specified, we
687
+ * include all of its sub-keys. If only some sub-keys are specified (via dotted
688
+ * notation, e.g. `"settings.plan"` ), then only those sub-keys from the object
689
+ * are included.
690
+ *
691
+ * By the way of example, assuming two tables like this:
692
+ *
693
+ * ```json {"truncate": true}
694
+ * {
695
+ * "formatVersion": "1.0",
696
+ * "tables": [
697
+ * {
698
+ * "name": "teams",
699
+ * "columns": [
700
+ * {
701
+ * "name": "name",
702
+ * "type": "string"
703
+ * },
704
+ * {
705
+ * "name": "owner",
706
+ * "type": "link",
707
+ * "link": {
708
+ * "table": "users"
709
+ * }
710
+ * }
711
+ * ]
712
+ * },
713
+ * {
714
+ * "name": "users",
715
+ * "columns": [
716
+ * {
717
+ * "name": "email",
718
+ * "type": "email"
719
+ * },
720
+ * {
721
+ * "name": "full_name",
722
+ * "type": "string"
723
+ * },
724
+ * {
725
+ * "name": "address",
726
+ * "type": "object",
727
+ * "columns": [
728
+ * {
729
+ * "name": "street",
730
+ * "type": "string"
731
+ * },
732
+ * {
733
+ * "name": "number",
734
+ * "type": "int"
735
+ * },
736
+ * {
737
+ * "name": "zipcode",
738
+ * "type": "int"
739
+ * }
740
+ * ]
741
+ * },
742
+ * {
743
+ * "name": "team",
744
+ * "type": "link",
745
+ * "link": {
746
+ * "table": "teams"
747
+ * }
748
+ * }
749
+ * ]
750
+ * }
751
+ * ]
752
+ * }
753
+ * ```
754
+ *
755
+ * A query like this:
756
+ *
757
+ * ```json
758
+ * POST /db/<dbname>:<branch>/tables/<table>/query
759
+ * {
760
+ * "columns": [
761
+ * "name",
762
+ * "address.*"
763
+ * ]
764
+ * }
765
+ * ```
766
+ *
767
+ * returns objects like:
768
+ *
769
+ * ```json
770
+ * {
771
+ * "name": "Kilian",
772
+ * "address": {
773
+ * "street": "New street",
774
+ * "number": 41,
775
+ * "zipcode": 10407
776
+ * }
777
+ * }
778
+ * ```
779
+ *
780
+ * while a query like this:
781
+ *
782
+ * ```json
783
+ * POST /db/<dbname>:<branch>/tables/<table>/query
784
+ * {
785
+ * "columns": [
786
+ * "name",
787
+ * "address.street"
788
+ * ]
789
+ * }
790
+ * ```
791
+ *
792
+ * returns objects like:
793
+ *
794
+ * ```json
795
+ * {
796
+ * "name": "Kilian",
797
+ * "address": {
798
+ * "street": "New street",
799
+ * }
800
+ * }
801
+ * ```
802
+ *
803
+ * If you want to return all columns from the main table and selected columns from the linked table, you can do it like this:
804
+ *
805
+ * ```json
806
+ * {
807
+ * "columns": [
808
+ * "*",
809
+ * "team.name"
810
+ * ]
811
+ * }
812
+ * ```
813
+ *
814
+ * The `"*"` in the above means all columns, including columns of objects. This returns data like:
815
+ *
816
+ * ```json
817
+ * {
818
+ * "name": "Kilian",
819
+ * "email": "kilian@gmail.com",
820
+ * "address": {
821
+ * "street": "New street",
822
+ * "number": 41,
823
+ * "zipcode": 10407
824
+ * },
825
+ * "team": {
826
+ * "id": "XX",
827
+ * "xata": {
828
+ * "version": 0,
829
+ * },
830
+ * "name": "first team"
831
+ * }
832
+ * }
833
+ * ```
834
+ *
835
+ * If you want all columns of the linked table, you can do:
836
+ *
837
+ * ```json
838
+ * {
839
+ * "columns": [
840
+ * "*",
841
+ * "team.*"
842
+ * ]
843
+ * }
844
+ * ```
845
+ *
846
+ * This returns, for example:
847
+ *
848
+ * ```json
849
+ * {
850
+ * "name": "Kilian",
851
+ * "email": "kilian@gmail.com",
852
+ * "address": {
853
+ * "street": "New street",
854
+ * "number": 41,
855
+ * "zipcode": 10407
856
+ * },
857
+ * "team": {
858
+ * "id": "XX",
859
+ * "xata": {
860
+ * "version": 0,
861
+ * },
862
+ * "name": "first team",
863
+ * "code": "A1"
864
+ * }
865
+ * }
866
+ * ```
867
+ *
868
+ * ### Filtering
869
+ *
870
+ * There are two types of operators:
871
+ *
872
+ * - Operators that work on a single column: `$is`, `$contains`, `$pattern`,
873
+ * `$includes`, `$gt`, etc.
874
+ * - Control operators that combine multiple conditions: `$any`, `$all`, `$not` ,
875
+ * `$none`, etc.
876
+ *
877
+ * All operators start with an `$` to differentiate them from column names
878
+ * (which are not allowed to start with an underscore).
879
+ *
880
+ * #### Exact matching and control operators
881
+ *
882
+ * Filter by one column:
883
+ *
884
+ * ```json
885
+ * {
886
+ * "filter": {
887
+ * "<column_name>": "value"
888
+ * }
889
+ * }
890
+ * ```
891
+ *
892
+ * This is equivalent to using the `$is` operator:
893
+ *
894
+ * ```json
895
+ * {
896
+ * "filter": {
897
+ * "<column_name>": {
898
+ * "$is": "value"
899
+ * }
900
+ * }
901
+ * }
902
+ * ```
903
+ *
904
+ * For example:
905
+ *
906
+ * ```json
907
+ * {
908
+ * "filter": {
909
+ * "name": "r2",
910
+ * }
911
+ * }
912
+ * ```
913
+ *
914
+ * Or:
915
+ *
916
+ * ```json
917
+ * {
918
+ * "filter": {
919
+ * "name": {
920
+ * "$is": "r2"
921
+ * }
922
+ * }
923
+ * }
924
+ * ```
925
+ *
926
+ * For objects, both dots and nested versions work:
927
+ *
928
+ * ```json
929
+ * {
930
+ * "filter": {
931
+ * "settings.plan": "free",
932
+ * }
933
+ * }
934
+ * ```
935
+ *
936
+ * ```json
937
+ * {
938
+ * "filter": {
939
+ * "settings": {
940
+ * "plan": "free"
941
+ * },
942
+ * },
943
+ * }
944
+ * ```
945
+ *
946
+ * If you want to OR together multiple values, you can use an array of values:
947
+ *
948
+ * ```json
949
+ * {
950
+ * "filter": {
951
+ * "settings.plan": ["free", "paid"]
952
+ * },
953
+ * }
954
+ * ```
955
+ *
956
+ * Same query with `$is` operator:
957
+ *
958
+ * ```json
959
+ * {
960
+ * "filter": {
961
+ * "settings.plan": { "$is": ["free", "paid"]}
962
+ * },
963
+ * }
964
+ * ```
965
+ *
966
+ * Specifying multiple columns, ANDs them together:
967
+ *
968
+ * ```json
969
+ * {
970
+ * "filter": {
971
+ * "settings.dark": true,
972
+ * "settings.plan": "free",
973
+ * },
974
+ * }
975
+ * ```
976
+ *
977
+ * To be more explicit about it, you can use `$all` or `$any`:
978
+ *
979
+ * ```json
980
+ * {
981
+ * "filter": {
982
+ * "$any": {
983
+ * "settings.dark": true,
984
+ * "settings.plan": "free",
985
+ * }
986
+ * },
987
+ * }
988
+ * ```
989
+ *
990
+ * `$all` and `$any` can also receive an array of objects, which allows for repeating columns:
991
+ *
992
+ * ```json
993
+ * {
994
+ * "filter": {
995
+ * "$any": [
996
+ * {
997
+ * "name": "r1",
998
+ * },
999
+ * {
1000
+ * "name": "r2",
1001
+ * },
1002
+ * ],
1003
+ * }
1004
+ * ```
1005
+ *
1006
+ * You can check for a value being not-null with `$exists`:
1007
+ *
1008
+ * ```json
1009
+ * {
1010
+ * "filter": {
1011
+ * "$exists": "settings",
1012
+ * },
1013
+ * }
1014
+ * ```
1015
+ *
1016
+ * This can be combined with `$all` or `$any` :
1017
+ *
1018
+ * ```json
1019
+ * {
1020
+ * "filter": {
1021
+ * "$all": [
1022
+ * {
1023
+ * "$exists": "settings",
1024
+ * },
1025
+ * {
1026
+ * "$exists": "name",
1027
+ * },
1028
+ * ],
1029
+ * }
1030
+ * }
1031
+ * ```
1032
+ *
1033
+ * We can also make the negation version, `$notExists` :
1034
+ *
1035
+ * ```json
1036
+ * {
1037
+ * "filter": {
1038
+ * "$notExists": "settings",
1039
+ * },
1040
+ * }
1041
+ * ```
1042
+ *
1043
+ * #### Partial match
1044
+ *
1045
+ * `$contains` is the simplest operator for partial matching. We should generally
1046
+ * discourage overusing `$contains` because it typically can't make use of
1047
+ * indices.
1048
+ *
1049
+ * ```json
1050
+ * {
1051
+ * "filter": {
1052
+ * "<column_name>": {
1053
+ * "$contains": "value"
1054
+ * }
1055
+ * }
1056
+ * }
1057
+ * ```
1058
+ *
1059
+ * Wildcards are supported via the `$pattern` operator:
1060
+ *
1061
+ * ```json
1062
+ * {
1063
+ * "filter": {
1064
+ * "<column_name>": {
1065
+ * "$pattern": "v*alue*"
1066
+ * }
1067
+ * }
1068
+ * }
1069
+ * ```
1070
+ *
1071
+ * We could also have `$endsWith` and `$startsWith` operators:
1072
+ *
1073
+ * ```json
1074
+ * {
1075
+ * "filter": {
1076
+ * "<column_name>": {
1077
+ * "$endsWith": ".gz"
1078
+ * },
1079
+ * "<column_name>": {
1080
+ * "$startsWith": "tmp-"
1081
+ * }
1082
+ * }
1083
+ * }
1084
+ * ```
1085
+ *
1086
+ * #### Numeric/date ranges
1087
+ *
1088
+ * ```json
1089
+ * {
1090
+ * "filter": {
1091
+ * "<column_name>": {
1092
+ * "$ge": 0,
1093
+ * "$lt": 100
1094
+ * }
1095
+ * }
1096
+ * }
1097
+ * ```
1098
+ *
1099
+ * The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
1100
+ *
1101
+ * Date ranges would support the same operators, with the date as string in RFC 3339:
1102
+ *
1103
+ * ```json
1104
+ * {
1105
+ * "filter": {
1106
+ * "<column_name>": {
1107
+ * "$gt": "2019-10-12T07:20:50.52Z",
1108
+ * "$lt": "2021-10-12T07:20:50.52Z"
1109
+ * }
1110
+ * }
1111
+ * }
1112
+ * ```
1113
+ *
1114
+ * #### Negations
1115
+ *
1116
+ * A general `$not` operator can inverse any operation.
1117
+ *
1118
+ * ```json
1119
+ * {
1120
+ * "filter": {
1121
+ * "$not": {
1122
+ * "<column_name1>": "value1",
1123
+ * "<column_name2>": "value1"
1124
+ * }
1125
+ * }
1126
+ * }
1127
+ * ```
1128
+ *
1129
+ * Note: in the above the two condition are AND together, so this does (NOT ( ...
1130
+ * AND ...))
1131
+ *
1132
+ * Or more complex:
1133
+ *
1134
+ * ```json
1135
+ * {
1136
+ * "filter": {
1137
+ * "$not": {
1138
+ * "$any": [{
1139
+ * "<column_name1>": "value1"
1140
+ * }, {
1141
+ * "$all": [{
1142
+ * "<column_name2>": "value2"
1143
+ * }, {
1144
+ * "<column_name3>": "value3"
1145
+ * }]
1146
+ * }]
1147
+ * }
1148
+ * }
1149
+ * }
1150
+ * ```
1151
+ *
1152
+ * The `$not: { $any: {}}` can be shorted using the `$none` operator:
1153
+ *
1154
+ * ```json
1155
+ * {
1156
+ * "filter": {
1157
+ * "$none": {
1158
+ * "<column_name1>": "value1",
1159
+ * "<column_name2>": "value1"
1160
+ * }
1161
+ * }
1162
+ * }
1163
+ * ```
1164
+ *
1165
+ * In addition, we can add specific operators like `$isNot` to simplify expressions:
1166
+ *
1167
+ * ```json
1168
+ * {
1169
+ * "filter": {
1170
+ * "<column_name>": {
1171
+ * "$isNot": "2019-10-12T07:20:50.52Z"
1172
+ * }
1173
+ * }
1174
+ * }
1175
+ * ```
1176
+ *
1177
+ * #### Working with arrays
1178
+ *
1179
+ * To test that an array contains a value, use `$includes`.
1180
+ *
1181
+ * ```json
1182
+ * {
1183
+ * "filter": {
1184
+ * "<array_name>": {
1185
+ * "$includes": "value"
1186
+ * }
1187
+ * }
1188
+ * }
1189
+ * ```
1190
+ *
1191
+ * The `$includes` operator accepts a custom predicate that will check if any
1192
+ * array values matches the predicate. For example a complex predicate can include
1193
+ * the `$all` , `$contains` and `$endsWith` operators:
1194
+ *
1195
+ * ```json
1196
+ * {
1197
+ * "filter": {
1198
+ * "<array name>": {
1199
+ * "$includes": {
1200
+ * "$all": [
1201
+ * {"$contains": "label"},
1202
+ * {"$not": {"$endsWith": "-debug"}}
1203
+ * ]
1204
+ * }
1205
+ * }
1206
+ * }
1207
+ * }
1208
+ * ```
1209
+ *
1210
+ * The `$includes` all operator succeeds if any column in the array matches the
1211
+ * predicate. The `$includesAll` operator succeeds if all array items match the
1212
+ * predicate. The `$includesNone` operator succeeds if no array item matches the
1213
+ * predicate. The `$includes` operator is a synonym for the `$includesAny`
1214
+ * operator.
1215
+ *
1216
+ * ### Sorting
1217
+ *
1218
+ * Sorting by one element:
1219
+ *
1220
+ * ```json
1221
+ * POST /db/demo:main/tables/table/query
1222
+ * {
1223
+ * "sort": {
1224
+ * "index": "asc"
1225
+ * }
1226
+ * }
1227
+ * ```
1228
+ *
1229
+ * or descendently:
1230
+ *
1231
+ * ```json
1232
+ * POST /db/demo:main/tables/table/query
1233
+ * {
1234
+ * "sort": {
1235
+ * "index": "desc"
1236
+ * }
1237
+ * }
1238
+ * ```
1239
+ *
1240
+ * Sorting by multiple fields:
1241
+ *
1242
+ * ```json
1243
+ * POST /db/demo:main/tables/table/query
1244
+ * {
1245
+ * "sort": [
1246
+ * {
1247
+ * "index": "desc"
1248
+ * },
1249
+ * {
1250
+ * "createdAt": "desc"
1251
+ * }
1252
+ * ]
1253
+ * }
1254
+ * ```
1255
+ *
1256
+ *
1257
+ * ### Pagination
1258
+ *
1259
+ * We offer cursor pagination and offset pagination. The offset pagination is limited
1260
+ * in the amount of data it can retrieve, so we recommend the cursor pagination if you have more than 1000 records.
1261
+ *
1262
+ * Example of size + offset pagination:
1263
+ *
1264
+ * ```json
1265
+ * POST /db/demo:main/tables/table/query
1266
+ * {
1267
+ * "page": {
1268
+ * "size": 100,
1269
+ * "offset": 200
1270
+ * }
1271
+ * }
1272
+ * ```
1273
+ *
1274
+ * 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.
1275
+ * 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.
1276
+ *
1277
+ * Example of cursor pagination:
1278
+ *
1279
+ * ```json
1280
+ * POST /db/demo:main/tables/table/query
1281
+ * {
1282
+ * "page": {
1283
+ * "after":"fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD"
1284
+ * }
1285
+ * }
1286
+ * ```
1287
+ *
1288
+ * 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:
1289
+ *
1290
+ * ```json
1291
+ * {
1292
+ * "meta": {
1293
+ * "page": {
1294
+ * "cursor": "fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD",
1295
+ * "more": true
1296
+ * }
1297
+ * },
1298
+ * "records": [...]
1299
+ * }
1300
+ * ```
1301
+ *
1302
+ * The `page` object might contain the follow keys, in addition to `size` and `offset` that were introduced before:
1303
+ *
1304
+ * - `after`: Return the next page 'after' the current cursor
1305
+ * - `before`: Return the previous page 'before' the current cursor.
1306
+ * - `first`: Return the first page in the table from a cursor.
1307
+ * - `last`: Return the last N records in the table from a cursor, where N is the `page.size` parameter.
1308
+ *
1309
+ * The request will fail if an invalid cursor value is given to `page.before`,
1310
+ * `page.after`, `page.first` , or `page.last`. No other cursor setting can be
1311
+ * used if `page.first` or `page.last` is set in a query.
1312
+ *
1313
+ * If both `page.before` and `page.after` parameters are present we treat the
1314
+ * request as a range query. The range query will return all entries after
1315
+ * `page.after`, but before `page.before`, up to `page.size` or the maximum
1316
+ * page size. This query requires both cursors to use the same filters and sort
1317
+ * settings, plus we require `page.after < page.before`. The range query returns
1318
+ * a new cursor. If the range encompass multiple pages the next page in the range
1319
+ * can be queried by update `page.after` to the returned cursor while keeping the
1320
+ * `page.before` cursor from the first range query.
1321
+ *
1322
+ * The `filter` , `columns`, `sort` , and `page.size` configuration will be
1323
+ * encoded with the cursor. The pagination request will be invalid if
1324
+ * `filter` or `sort` is set. The columns returned and page size can be changed
1325
+ * anytime by passing the `columns` or `page.size` settings to the next query.
1326
+ *
1327
+ * **Special cursors:**
1328
+ *
1329
+ * - `page.after=end`: Result points past the last entry. The list of records
1330
+ * returned is empty, but `page.meta.cursor` will include a cursor that can be
1331
+ * used to "tail" the table from the end waiting for new data to be inserted.
1332
+ * - `page.before=end`: This cursor returns the last page.
1333
+ * - `page.first=<cursor>`: Go to first page. This is equivalent to querying the
1334
+ * first page without a cursor but `filter` and `sort` . Yet the `page.first`
1335
+ * cursor can be convenient at times as user code does not need to remember the
1336
+ * filter, sort, columns or page size configuration. All these information are
1337
+ * read from the cursor.
1338
+ * - `page.last=<cursor>`: Go to the end of the table. This is equivalent to querying the
1339
+ * last page with `page.before=end`, `filter`, and `sort` . Yet the
1340
+ * `page.last` cursor can be more convenient at times as user code does not
1341
+ * need to remember the filter, sort, columns or page size configuration. All
1342
+ * these information are read from the cursor.
1343
+ *
1344
+ * When using special cursors like `page.after="end"` or `page.before="end"`, we
1345
+ * still allow `filter` and `sort` to be set.
1346
+ *
1347
+ * Example of getting the last page:
1348
+ *
1349
+ * ```json
1350
+ * POST /db/demo:main/tables/table/query
1351
+ * {
1352
+ * "page": {
1353
+ * "size": 10,
1354
+ * "before": "end"
1355
+ * }
1356
+ * }
1357
+ * ```
1358
+ */
1359
+ export declare const queryTable: (variables: QueryTableVariables) => Promise<Responses.QueryResponse>;
1360
+ export declare type SearchBranchPathParams = {
1361
+ dbBranchName: Schemas.DBBranchName;
1362
+ workspace: string;
1363
+ };
1364
+ export declare type SearchBranchRequestBody = {
1365
+ tables?: string[];
1366
+ query: string;
1367
+ fuzziness?: number;
1368
+ };
1369
+ export declare type SearchBranchVariables = {
1370
+ body: SearchBranchRequestBody;
1371
+ pathParams: SearchBranchPathParams;
1372
+ } & FetcherExtraProps;
1373
+ /**
1374
+ * Run a free text search operation across the database branch.
1375
+ */
1376
+ export declare const searchBranch: (variables: SearchBranchVariables) => Promise<Responses.SearchResponse>;
1377
+ export declare const operationsByTag: {
1378
+ users: {
1379
+ getUser: (variables: GetUserVariables) => Promise<Schemas.UserWithID>;
1380
+ updateUser: (variables: UpdateUserVariables) => Promise<Schemas.UserWithID>;
1381
+ deleteUser: (variables: DeleteUserVariables) => Promise<undefined>;
1382
+ getUserAPIKeys: (variables: GetUserAPIKeysVariables) => Promise<GetUserAPIKeysResponse>;
1383
+ createUserAPIKey: (variables: CreateUserAPIKeyVariables) => Promise<CreateUserAPIKeyResponse>;
1384
+ deleteUserAPIKey: (variables: DeleteUserAPIKeyVariables) => Promise<undefined>;
1385
+ };
1386
+ workspaces: {
1387
+ createWorkspace: (variables: CreateWorkspaceVariables) => Promise<Schemas.Workspace>;
1388
+ getWorkspacesList: (variables: GetWorkspacesListVariables) => Promise<GetWorkspacesListResponse>;
1389
+ getWorkspace: (variables: GetWorkspaceVariables) => Promise<Schemas.Workspace>;
1390
+ updateWorkspace: (variables: UpdateWorkspaceVariables) => Promise<Schemas.Workspace>;
1391
+ deleteWorkspace: (variables: DeleteWorkspaceVariables) => Promise<undefined>;
1392
+ getWorkspaceMembersList: (variables: GetWorkspaceMembersListVariables) => Promise<Schemas.WorkspaceMembers>;
1393
+ updateWorkspaceMemberRole: (variables: UpdateWorkspaceMemberRoleVariables) => Promise<undefined>;
1394
+ removeWorkspaceMember: (variables: RemoveWorkspaceMemberVariables) => Promise<undefined>;
1395
+ inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<Schemas.WorkspaceInvite>;
1396
+ cancelWorkspaceMemberInvite: (variables: CancelWorkspaceMemberInviteVariables) => Promise<undefined>;
1397
+ resendWorkspaceMemberInvite: (variables: ResendWorkspaceMemberInviteVariables) => Promise<undefined>;
1398
+ acceptWorkspaceMemberInvite: (variables: AcceptWorkspaceMemberInviteVariables) => Promise<undefined>;
1399
+ };
1400
+ database: {
1401
+ getDatabaseList: (variables: GetDatabaseListVariables) => Promise<Schemas.ListDatabasesResponse>;
1402
+ createDatabase: (variables: CreateDatabaseVariables) => Promise<CreateDatabaseResponse>;
1403
+ deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
1404
+ };
1405
+ branch: {
1406
+ getBranchList: (variables: GetBranchListVariables) => Promise<Schemas.ListBranchesResponse>;
1407
+ getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<Schemas.DBBranch>;
1408
+ createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
1409
+ deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
1410
+ updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
1411
+ getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<Schemas.BranchMetadata>;
1412
+ getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
1413
+ executeBranchMigrationPlan: (variables: ExecuteBranchMigrationPlanVariables) => Promise<undefined>;
1414
+ getBranchMigrationPlan: (variables: GetBranchMigrationPlanVariables) => Promise<Responses.BranchMigrationPlan>;
1415
+ getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
1416
+ };
1417
+ table: {
1418
+ createTable: (variables: CreateTableVariables) => Promise<undefined>;
1419
+ deleteTable: (variables: DeleteTableVariables) => Promise<undefined>;
1420
+ updateTable: (variables: UpdateTableVariables) => Promise<undefined>;
1421
+ getTableSchema: (variables: GetTableSchemaVariables) => Promise<GetTableSchemaResponse>;
1422
+ setTableSchema: (variables: SetTableSchemaVariables) => Promise<undefined>;
1423
+ getTableColumns: (variables: GetTableColumnsVariables) => Promise<GetTableColumnsResponse>;
1424
+ addTableColumn: (variables: AddTableColumnVariables) => Promise<Responses.MigrationIdResponse>;
1425
+ getColumn: (variables: GetColumnVariables) => Promise<Schemas.Column>;
1426
+ deleteColumn: (variables: DeleteColumnVariables) => Promise<Responses.MigrationIdResponse>;
1427
+ updateColumn: (variables: UpdateColumnVariables) => Promise<Responses.MigrationIdResponse>;
1428
+ };
1429
+ records: {
1430
+ insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
1431
+ insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<Responses.RecordUpdateResponse>;
1432
+ updateRecordWithID: (variables: UpdateRecordWithIDVariables) => Promise<Responses.RecordUpdateResponse>;
1433
+ upsertRecordWithID: (variables: UpsertRecordWithIDVariables) => Promise<Responses.RecordUpdateResponse>;
1434
+ deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
1435
+ getRecord: (variables: GetRecordVariables) => Promise<Schemas.XataRecord>;
1436
+ bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
1437
+ queryTable: (variables: QueryTableVariables) => Promise<Responses.QueryResponse>;
1438
+ searchBranch: (variables: SearchBranchVariables) => Promise<Responses.SearchResponse>;
1439
+ };
1440
+ };