@xata.io/client 0.0.0-alpha.vee88fdc → 0.0.0-alpha.veec3be2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,8 @@
1
+ declare type AttributeDictionary = Record<string, string | number | boolean | undefined>;
2
+ declare type TraceFunction = <T>(name: string, fn: (options: {
3
+ setAttributes: (attrs: AttributeDictionary) => void;
4
+ }) => T, options?: AttributeDictionary) => Promise<T>;
5
+
1
6
  declare type FetchImpl = (url: string, init?: {
2
7
  body?: string;
3
8
  headers?: Record<string, string>;
@@ -5,25 +10,56 @@ declare type FetchImpl = (url: string, init?: {
5
10
  }) => Promise<{
6
11
  ok: boolean;
7
12
  status: number;
13
+ url: string;
8
14
  json(): Promise<any>;
15
+ headers?: {
16
+ get(name: string): string | null;
17
+ };
9
18
  }>;
10
- declare type WorkspaceApiUrlBuilder = (path: string, pathParams: Record<string, string>) => string;
19
+ declare type WorkspaceApiUrlBuilder = (path: string, pathParams: Partial<Record<string, string | number>>) => string;
11
20
  declare type FetcherExtraProps = {
12
21
  apiUrl: string;
13
22
  workspacesApiUrl: string | WorkspaceApiUrlBuilder;
14
23
  fetchImpl: FetchImpl;
15
24
  apiKey: string;
25
+ trace: TraceFunction;
16
26
  };
17
27
  declare type ErrorWrapper<TError> = TError | {
18
28
  status: 'unknown';
19
29
  payload: string;
20
30
  };
21
31
 
32
+ interface CacheImpl {
33
+ defaultQueryTTL: number;
34
+ getAll(): Promise<Record<string, unknown>>;
35
+ get: <T>(key: string) => Promise<T | null>;
36
+ set: <T>(key: string, value: T) => Promise<void>;
37
+ delete: (key: string) => Promise<void>;
38
+ clear: () => Promise<void>;
39
+ }
40
+ interface SimpleCacheOptions {
41
+ max?: number;
42
+ defaultQueryTTL?: number;
43
+ }
44
+ declare class SimpleCache implements CacheImpl {
45
+ #private;
46
+ capacity: number;
47
+ defaultQueryTTL: number;
48
+ constructor(options?: SimpleCacheOptions);
49
+ getAll(): Promise<Record<string, unknown>>;
50
+ get<T>(key: string): Promise<T | null>;
51
+ set<T>(key: string, value: T): Promise<void>;
52
+ delete(key: string): Promise<void>;
53
+ clear(): Promise<void>;
54
+ }
55
+
22
56
  declare abstract class XataPlugin {
23
57
  abstract build(options: XataPluginOptions): unknown | Promise<unknown>;
24
58
  }
25
59
  declare type XataPluginOptions = {
26
60
  getFetchProps: () => Promise<FetcherExtraProps>;
61
+ cache: CacheImpl;
62
+ trace?: TraceFunction;
27
63
  };
28
64
 
29
65
  /**
@@ -63,7 +99,7 @@ declare type WorkspaceID = string;
63
99
  declare type Role = 'owner' | 'maintainer';
64
100
  declare type WorkspaceMeta = {
65
101
  name: string;
66
- slug: string;
102
+ slug?: string;
67
103
  };
68
104
  declare type Workspace = WorkspaceMeta & {
69
105
  id: WorkspaceID;
@@ -94,22 +130,30 @@ declare type WorkspaceMembers = {
94
130
  * @pattern ^ik_[a-zA-Z0-9]+
95
131
  */
96
132
  declare type InviteKey = string;
133
+ /**
134
+ * Metadata of databases
135
+ */
136
+ declare type DatabaseMetadata = {
137
+ name: string;
138
+ createdAt: DateTime;
139
+ numberOfBranches: number;
140
+ ui?: {
141
+ color?: string;
142
+ };
143
+ };
97
144
  declare type ListDatabasesResponse = {
98
- databases?: {
99
- name: string;
100
- displayName: string;
101
- createdAt: DateTime;
102
- numberOfBranches: number;
103
- ui?: {
104
- color?: string;
105
- };
106
- }[];
145
+ databases?: DatabaseMetadata[];
107
146
  };
108
147
  declare type ListBranchesResponse = {
109
148
  databaseName: string;
110
- displayName: string;
111
149
  branches: Branch[];
112
150
  };
151
+ declare type ListGitBranchesResponse = {
152
+ mapping: {
153
+ gitBranch: string;
154
+ xataBranch: string;
155
+ }[];
156
+ };
113
157
  declare type Branch = {
114
158
  name: string;
115
159
  createdAt: DateTime;
@@ -147,21 +191,39 @@ declare type Schema = {
147
191
  tables: Table[];
148
192
  tablesOrder?: string[];
149
193
  };
194
+ /**
195
+ * @x-internal true
196
+ */
197
+ declare type SchemaEditScript = {
198
+ sourceMigrationID?: string;
199
+ targetMigrationID?: string;
200
+ tables: TableEdit[];
201
+ };
150
202
  declare type Table = {
151
203
  id?: string;
152
204
  name: TableName;
153
205
  columns: Column[];
154
206
  revLinks?: RevLink[];
155
207
  };
208
+ /**
209
+ * @x-internal true
210
+ */
211
+ declare type TableEdit = {
212
+ oldName?: string;
213
+ newName?: string;
214
+ columns?: MigrationColumnOp[];
215
+ };
156
216
  /**
157
217
  * @x-go-type xata.Column
158
218
  */
159
219
  declare type Column = {
160
220
  name: string;
161
- type: 'bool' | 'int' | 'float' | 'string' | 'text' | 'email' | 'multiple' | 'link' | 'object';
221
+ type: 'bool' | 'int' | 'float' | 'string' | 'text' | 'email' | 'multiple' | 'link' | 'object' | 'datetime';
162
222
  link?: {
163
223
  table: string;
164
224
  };
225
+ notNull?: boolean;
226
+ unique?: boolean;
165
227
  columns?: Column[];
166
228
  };
167
229
  declare type RevLink = {
@@ -228,12 +290,131 @@ declare type ColumnMigration = {
228
290
  old: Column;
229
291
  ['new']: Column;
230
292
  };
293
+ /**
294
+ * @x-internal true
295
+ */
296
+ declare type Commit = {
297
+ meta?: {
298
+ title?: string;
299
+ message?: string;
300
+ id: string;
301
+ parentID?: string;
302
+ mergeParentID?: string;
303
+ status: string;
304
+ createdAt: DateTime;
305
+ modifiedAt?: DateTime;
306
+ };
307
+ operations: MigrationOp[];
308
+ };
309
+ /**
310
+ * Branch schema migration.
311
+ *
312
+ * @x-internal true
313
+ */
314
+ declare type Migration = {
315
+ parentID?: string;
316
+ operations: MigrationOp[];
317
+ };
318
+ /**
319
+ * Branch schema migration operations.
320
+ *
321
+ * @x-internal true
322
+ */
323
+ declare type MigrationOp = MigrationTableOp | MigrationColumnOp;
324
+ /**
325
+ * @x-internal true
326
+ */
327
+ declare type MigrationTableOp = {
328
+ addTable: TableOpAdd;
329
+ } | {
330
+ removeTable: TableOpRemove;
331
+ } | {
332
+ renameTable: TableOpRename;
333
+ };
334
+ /**
335
+ * @x-internal true
336
+ */
337
+ declare type MigrationColumnOp = {
338
+ addColumn: ColumnOpAdd;
339
+ } | {
340
+ removeColumn: ColumnOpRemove;
341
+ } | {
342
+ renameColumn: ColumnOpRename;
343
+ };
344
+ /**
345
+ * @x-internal true
346
+ */
347
+ declare type TableOpAdd = {
348
+ table: string;
349
+ };
350
+ /**
351
+ * @x-internal true
352
+ */
353
+ declare type TableOpRemove = {
354
+ table: string;
355
+ };
356
+ /**
357
+ * @x-internal true
358
+ */
359
+ declare type TableOpRename = {
360
+ oldName: string;
361
+ newName: string;
362
+ };
363
+ /**
364
+ * @x-internal true
365
+ */
366
+ declare type ColumnOpAdd = {
367
+ table?: string;
368
+ column: Column;
369
+ };
370
+ /**
371
+ * @x-internal true
372
+ */
373
+ declare type ColumnOpRemove = {
374
+ table?: string;
375
+ column: string;
376
+ };
377
+ /**
378
+ * @x-internal true
379
+ */
380
+ declare type ColumnOpRename = {
381
+ table?: string;
382
+ oldName: string;
383
+ newName: string;
384
+ };
385
+ declare type MigrationRequest = {
386
+ number: number;
387
+ createdAt: DateTime;
388
+ modifiedAt?: DateTime;
389
+ closedAt?: DateTime;
390
+ mergedAt?: DateTime;
391
+ status: 'open' | 'closed' | 'merging' | 'merged';
392
+ title: string;
393
+ body: string;
394
+ source: string;
395
+ target: string;
396
+ };
231
397
  declare type SortExpression = string[] | {
232
398
  [key: string]: SortOrder;
233
399
  } | {
234
400
  [key: string]: SortOrder;
235
401
  }[];
236
402
  declare type SortOrder = 'asc' | 'desc';
403
+ /**
404
+ * Maximum [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) for the search terms. The Levenshtein
405
+ * distance is the number of one character changes needed to make two strings equal. The default is 1, meaning that single
406
+ * character typos per word are tollerated by search. You can set it to 0 to remove the typo tollerance or set it to 2
407
+ * to allow two typos in a word.
408
+ *
409
+ * @default 1
410
+ * @maximum 2
411
+ * @minimum 0
412
+ */
413
+ declare type FuzzinessExpression = number;
414
+ /**
415
+ * If the prefix type is set to "disabled" (the default), the search only matches full words. If the prefix type is set to "phrase", the search will return results that match prefixes of the search phrase.
416
+ */
417
+ declare type PrefixExpression = 'phrase' | 'disabled';
237
418
  /**
238
419
  * @minProperties 1
239
420
  */
@@ -247,6 +428,48 @@ declare type FilterExpression = {
247
428
  } & {
248
429
  [key: string]: FilterColumn;
249
430
  };
431
+ declare type HighlightExpression = {
432
+ enabled?: boolean;
433
+ encodeHTML?: boolean;
434
+ };
435
+ /**
436
+ * Booster Expression
437
+ *
438
+ * @x-go-type xata.BoosterExpression
439
+ */
440
+ declare type BoosterExpression = {
441
+ valueBooster?: ValueBooster$1;
442
+ } | {
443
+ numericBooster?: NumericBooster$1;
444
+ } | {
445
+ dateBooster?: DateBooster$1;
446
+ };
447
+ /**
448
+ * Boost records with a particular value for a column.
449
+ */
450
+ declare type ValueBooster$1 = {
451
+ column: string;
452
+ value: string | number | boolean;
453
+ factor: number;
454
+ };
455
+ /**
456
+ * Boost records based on the value of a numeric column.
457
+ */
458
+ declare type NumericBooster$1 = {
459
+ column: string;
460
+ factor: number;
461
+ };
462
+ /**
463
+ * Boost records based on the value of a datetime column. It is configured via "origin", "scale", and "decay". The further away from the "origin",
464
+ * the more the score is decayed. The decay function uses an exponential function. For example if origin is "now", and scale is 10 days and decay is 0.5, it
465
+ * should be interpreted as: a record with a date 10 days before/after origin will score 2 times less than a record with the date at origin.
466
+ */
467
+ declare type DateBooster$1 = {
468
+ column: string;
469
+ origin?: string;
470
+ scale: string;
471
+ decay: number;
472
+ };
250
473
  declare type FilterList = FilterExpression | FilterExpression[];
251
474
  declare type FilterColumn = FilterColumnIncludes | FilterPredicate | FilterList;
252
475
  /**
@@ -303,7 +526,24 @@ declare type PageConfig = {
303
526
  size?: number;
304
527
  offset?: number;
305
528
  };
306
- declare type ColumnsFilter = string[];
529
+ declare type ColumnsProjection = string[];
530
+ /**
531
+ * Xata Table Record Metadata
532
+ */
533
+ declare type RecordMeta = {
534
+ id: RecordID;
535
+ xata: {
536
+ version: number;
537
+ table?: string;
538
+ highlight?: {
539
+ [key: string]: string[] | {
540
+ [key: string]: any;
541
+ };
542
+ };
543
+ score?: number;
544
+ warnings?: string[];
545
+ };
546
+ };
307
547
  /**
308
548
  * @pattern [a-zA-Z0-9_-~:]+
309
549
  */
@@ -325,16 +565,9 @@ declare type RecordsMetadata = {
325
565
  };
326
566
  };
327
567
  /**
328
- * Xata Table Record
568
+ * Xata Table Record Metadata
329
569
  */
330
- declare type XataRecord$1 = {
331
- id: RecordID;
332
- xata: {
333
- version: number;
334
- table?: string;
335
- warnings?: string[];
336
- };
337
- } & {
570
+ declare type XataRecord$1 = RecordMeta & {
338
571
  [key: string]: any;
339
572
  };
340
573
 
@@ -352,14 +585,18 @@ type schemas_InviteID = InviteID;
352
585
  type schemas_WorkspaceInvite = WorkspaceInvite;
353
586
  type schemas_WorkspaceMembers = WorkspaceMembers;
354
587
  type schemas_InviteKey = InviteKey;
588
+ type schemas_DatabaseMetadata = DatabaseMetadata;
355
589
  type schemas_ListDatabasesResponse = ListDatabasesResponse;
356
590
  type schemas_ListBranchesResponse = ListBranchesResponse;
591
+ type schemas_ListGitBranchesResponse = ListGitBranchesResponse;
357
592
  type schemas_Branch = Branch;
358
593
  type schemas_BranchMetadata = BranchMetadata;
359
594
  type schemas_DBBranch = DBBranch;
360
595
  type schemas_StartedFromMetadata = StartedFromMetadata;
361
596
  type schemas_Schema = Schema;
597
+ type schemas_SchemaEditScript = SchemaEditScript;
362
598
  type schemas_Table = Table;
599
+ type schemas_TableEdit = TableEdit;
363
600
  type schemas_Column = Column;
364
601
  type schemas_RevLink = RevLink;
365
602
  type schemas_BranchName = BranchName;
@@ -372,9 +609,25 @@ type schemas_MetricsLatency = MetricsLatency;
372
609
  type schemas_BranchMigration = BranchMigration;
373
610
  type schemas_TableMigration = TableMigration;
374
611
  type schemas_ColumnMigration = ColumnMigration;
612
+ type schemas_Commit = Commit;
613
+ type schemas_Migration = Migration;
614
+ type schemas_MigrationOp = MigrationOp;
615
+ type schemas_MigrationTableOp = MigrationTableOp;
616
+ type schemas_MigrationColumnOp = MigrationColumnOp;
617
+ type schemas_TableOpAdd = TableOpAdd;
618
+ type schemas_TableOpRemove = TableOpRemove;
619
+ type schemas_TableOpRename = TableOpRename;
620
+ type schemas_ColumnOpAdd = ColumnOpAdd;
621
+ type schemas_ColumnOpRemove = ColumnOpRemove;
622
+ type schemas_ColumnOpRename = ColumnOpRename;
623
+ type schemas_MigrationRequest = MigrationRequest;
375
624
  type schemas_SortExpression = SortExpression;
376
625
  type schemas_SortOrder = SortOrder;
626
+ type schemas_FuzzinessExpression = FuzzinessExpression;
627
+ type schemas_PrefixExpression = PrefixExpression;
377
628
  type schemas_FilterExpression = FilterExpression;
629
+ type schemas_HighlightExpression = HighlightExpression;
630
+ type schemas_BoosterExpression = BoosterExpression;
378
631
  type schemas_FilterList = FilterList;
379
632
  type schemas_FilterColumn = FilterColumn;
380
633
  type schemas_FilterColumnIncludes = FilterColumnIncludes;
@@ -384,7 +637,8 @@ type schemas_FilterPredicateRangeOp = FilterPredicateRangeOp;
384
637
  type schemas_FilterRangeValue = FilterRangeValue;
385
638
  type schemas_FilterValue = FilterValue;
386
639
  type schemas_PageConfig = PageConfig;
387
- type schemas_ColumnsFilter = ColumnsFilter;
640
+ type schemas_ColumnsProjection = ColumnsProjection;
641
+ type schemas_RecordMeta = RecordMeta;
388
642
  type schemas_RecordID = RecordID;
389
643
  type schemas_TableRename = TableRename;
390
644
  type schemas_RecordsMetadata = RecordsMetadata;
@@ -404,14 +658,18 @@ declare namespace schemas {
404
658
  schemas_WorkspaceInvite as WorkspaceInvite,
405
659
  schemas_WorkspaceMembers as WorkspaceMembers,
406
660
  schemas_InviteKey as InviteKey,
661
+ schemas_DatabaseMetadata as DatabaseMetadata,
407
662
  schemas_ListDatabasesResponse as ListDatabasesResponse,
408
663
  schemas_ListBranchesResponse as ListBranchesResponse,
664
+ schemas_ListGitBranchesResponse as ListGitBranchesResponse,
409
665
  schemas_Branch as Branch,
410
666
  schemas_BranchMetadata as BranchMetadata,
411
667
  schemas_DBBranch as DBBranch,
412
668
  schemas_StartedFromMetadata as StartedFromMetadata,
413
669
  schemas_Schema as Schema,
670
+ schemas_SchemaEditScript as SchemaEditScript,
414
671
  schemas_Table as Table,
672
+ schemas_TableEdit as TableEdit,
415
673
  schemas_Column as Column,
416
674
  schemas_RevLink as RevLink,
417
675
  schemas_BranchName as BranchName,
@@ -424,9 +682,28 @@ declare namespace schemas {
424
682
  schemas_BranchMigration as BranchMigration,
425
683
  schemas_TableMigration as TableMigration,
426
684
  schemas_ColumnMigration as ColumnMigration,
685
+ schemas_Commit as Commit,
686
+ schemas_Migration as Migration,
687
+ schemas_MigrationOp as MigrationOp,
688
+ schemas_MigrationTableOp as MigrationTableOp,
689
+ schemas_MigrationColumnOp as MigrationColumnOp,
690
+ schemas_TableOpAdd as TableOpAdd,
691
+ schemas_TableOpRemove as TableOpRemove,
692
+ schemas_TableOpRename as TableOpRename,
693
+ schemas_ColumnOpAdd as ColumnOpAdd,
694
+ schemas_ColumnOpRemove as ColumnOpRemove,
695
+ schemas_ColumnOpRename as ColumnOpRename,
696
+ schemas_MigrationRequest as MigrationRequest,
427
697
  schemas_SortExpression as SortExpression,
428
698
  schemas_SortOrder as SortOrder,
699
+ schemas_FuzzinessExpression as FuzzinessExpression,
700
+ schemas_PrefixExpression as PrefixExpression,
429
701
  schemas_FilterExpression as FilterExpression,
702
+ schemas_HighlightExpression as HighlightExpression,
703
+ schemas_BoosterExpression as BoosterExpression,
704
+ ValueBooster$1 as ValueBooster,
705
+ NumericBooster$1 as NumericBooster,
706
+ DateBooster$1 as DateBooster,
430
707
  schemas_FilterList as FilterList,
431
708
  schemas_FilterColumn as FilterColumn,
432
709
  schemas_FilterColumnIncludes as FilterColumnIncludes,
@@ -436,7 +713,8 @@ declare namespace schemas {
436
713
  schemas_FilterRangeValue as FilterRangeValue,
437
714
  schemas_FilterValue as FilterValue,
438
715
  schemas_PageConfig as PageConfig,
439
- schemas_ColumnsFilter as ColumnsFilter,
716
+ schemas_ColumnsProjection as ColumnsProjection,
717
+ schemas_RecordMeta as RecordMeta,
440
718
  schemas_RecordID as RecordID,
441
719
  schemas_TableRename as TableRename,
442
720
  schemas_RecordsMetadata as RecordsMetadata,
@@ -471,11 +749,22 @@ declare type BulkError = {
471
749
  status?: number;
472
750
  }[];
473
751
  };
752
+ declare type BulkInsertResponse = {
753
+ recordIDs: string[];
754
+ } | {
755
+ records: XataRecord$1[];
756
+ };
474
757
  declare type BranchMigrationPlan = {
475
758
  version: number;
476
759
  migration: BranchMigration;
477
760
  };
478
- declare type RecordUpdateResponse = {
761
+ declare type RecordResponse = XataRecord$1;
762
+ declare type SchemaCompareResponse = {
763
+ source: Schema;
764
+ target: Schema;
765
+ edits: SchemaEditScript;
766
+ };
767
+ declare type RecordUpdateResponse = XataRecord$1 | {
479
768
  id: string;
480
769
  xata: {
481
770
  version: number;
@@ -499,7 +788,10 @@ type responses_SimpleError = SimpleError;
499
788
  type responses_BadRequestError = BadRequestError;
500
789
  type responses_AuthError = AuthError;
501
790
  type responses_BulkError = BulkError;
791
+ type responses_BulkInsertResponse = BulkInsertResponse;
502
792
  type responses_BranchMigrationPlan = BranchMigrationPlan;
793
+ type responses_RecordResponse = RecordResponse;
794
+ type responses_SchemaCompareResponse = SchemaCompareResponse;
503
795
  type responses_RecordUpdateResponse = RecordUpdateResponse;
504
796
  type responses_QueryResponse = QueryResponse;
505
797
  type responses_SearchResponse = SearchResponse;
@@ -510,7 +802,10 @@ declare namespace responses {
510
802
  responses_BadRequestError as BadRequestError,
511
803
  responses_AuthError as AuthError,
512
804
  responses_BulkError as BulkError,
805
+ responses_BulkInsertResponse as BulkInsertResponse,
513
806
  responses_BranchMigrationPlan as BranchMigrationPlan,
807
+ responses_RecordResponse as RecordResponse,
808
+ responses_SchemaCompareResponse as SchemaCompareResponse,
514
809
  responses_RecordUpdateResponse as RecordUpdateResponse,
515
810
  responses_QueryResponse as QueryResponse,
516
811
  responses_SearchResponse as SearchResponse,
@@ -816,6 +1111,9 @@ declare type InviteWorkspaceMemberError = ErrorWrapper<{
816
1111
  } | {
817
1112
  status: 404;
818
1113
  payload: SimpleError;
1114
+ } | {
1115
+ status: 409;
1116
+ payload: SimpleError;
819
1117
  }>;
820
1118
  declare type InviteWorkspaceMemberRequestBody = {
821
1119
  email: string;
@@ -829,6 +1127,34 @@ declare type InviteWorkspaceMemberVariables = {
829
1127
  * Invite some user to join the workspace with the given role
830
1128
  */
831
1129
  declare const inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<WorkspaceInvite>;
1130
+ declare type UpdateWorkspaceMemberInvitePathParams = {
1131
+ workspaceId: WorkspaceID;
1132
+ inviteId: InviteID;
1133
+ };
1134
+ declare type UpdateWorkspaceMemberInviteError = ErrorWrapper<{
1135
+ status: 400;
1136
+ payload: BadRequestError;
1137
+ } | {
1138
+ status: 401;
1139
+ payload: AuthError;
1140
+ } | {
1141
+ status: 404;
1142
+ payload: SimpleError;
1143
+ } | {
1144
+ status: 422;
1145
+ payload: SimpleError;
1146
+ }>;
1147
+ declare type UpdateWorkspaceMemberInviteRequestBody = {
1148
+ role: Role;
1149
+ };
1150
+ declare type UpdateWorkspaceMemberInviteVariables = {
1151
+ body: UpdateWorkspaceMemberInviteRequestBody;
1152
+ pathParams: UpdateWorkspaceMemberInvitePathParams;
1153
+ } & FetcherExtraProps;
1154
+ /**
1155
+ * This operation provides a way to update an existing invite. Updates are performed in-place; they do not change the invite link, the expiry time, nor do they re-notify the recipient of the invite.
1156
+ */
1157
+ declare const updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
832
1158
  declare type CancelWorkspaceMemberInvitePathParams = {
833
1159
  workspaceId: WorkspaceID;
834
1160
  inviteId: InviteID;
@@ -946,7 +1272,6 @@ declare type CreateDatabaseResponse = {
946
1272
  branchName?: string;
947
1273
  };
948
1274
  declare type CreateDatabaseRequestBody = {
949
- displayName?: string;
950
1275
  branchName?: string;
951
1276
  ui?: {
952
1277
  color?: string;
@@ -982,11 +1307,11 @@ declare type DeleteDatabaseVariables = {
982
1307
  * Delete a database and all of its branches and tables permanently.
983
1308
  */
984
1309
  declare const deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
985
- declare type GetBranchDetailsPathParams = {
986
- dbBranchName: DBBranchName;
1310
+ declare type GetDatabaseMetadataPathParams = {
1311
+ dbName: DBName;
987
1312
  workspace: string;
988
1313
  };
989
- declare type GetBranchDetailsError = ErrorWrapper<{
1314
+ declare type GetDatabaseMetadataError = ErrorWrapper<{
990
1315
  status: 400;
991
1316
  payload: BadRequestError;
992
1317
  } | {
@@ -996,18 +1321,18 @@ declare type GetBranchDetailsError = ErrorWrapper<{
996
1321
  status: 404;
997
1322
  payload: SimpleError;
998
1323
  }>;
999
- declare type GetBranchDetailsVariables = {
1000
- pathParams: GetBranchDetailsPathParams;
1324
+ declare type GetDatabaseMetadataVariables = {
1325
+ pathParams: GetDatabaseMetadataPathParams;
1001
1326
  } & FetcherExtraProps;
1002
- declare const getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
1003
- declare type CreateBranchPathParams = {
1004
- dbBranchName: DBBranchName;
1327
+ /**
1328
+ * Retrieve metadata of the given database
1329
+ */
1330
+ declare const getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
1331
+ declare type UpdateDatabaseMetadataPathParams = {
1332
+ dbName: DBName;
1005
1333
  workspace: string;
1006
1334
  };
1007
- declare type CreateBranchQueryParams = {
1008
- from?: string;
1009
- };
1010
- declare type CreateBranchError = ErrorWrapper<{
1335
+ declare type UpdateDatabaseMetadataError = ErrorWrapper<{
1011
1336
  status: 400;
1012
1337
  payload: BadRequestError;
1013
1338
  } | {
@@ -1017,109 +1342,561 @@ declare type CreateBranchError = ErrorWrapper<{
1017
1342
  status: 404;
1018
1343
  payload: SimpleError;
1019
1344
  }>;
1020
- declare type CreateBranchRequestBody = {
1021
- from?: string;
1022
- metadata?: BranchMetadata;
1345
+ declare type UpdateDatabaseMetadataRequestBody = {
1346
+ ui?: {
1347
+ color?: string;
1348
+ };
1023
1349
  };
1024
- declare type CreateBranchVariables = {
1025
- body?: CreateBranchRequestBody;
1026
- pathParams: CreateBranchPathParams;
1027
- queryParams?: CreateBranchQueryParams;
1350
+ declare type UpdateDatabaseMetadataVariables = {
1351
+ body?: UpdateDatabaseMetadataRequestBody;
1352
+ pathParams: UpdateDatabaseMetadataPathParams;
1028
1353
  } & FetcherExtraProps;
1029
- declare const createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
1030
- declare type DeleteBranchPathParams = {
1031
- dbBranchName: DBBranchName;
1354
+ /**
1355
+ * Update the color of the selected database
1356
+ */
1357
+ declare const updateDatabaseMetadata: (variables: UpdateDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
1358
+ declare type GetGitBranchesMappingPathParams = {
1359
+ dbName: DBName;
1032
1360
  workspace: string;
1033
1361
  };
1034
- declare type DeleteBranchError = ErrorWrapper<{
1362
+ declare type GetGitBranchesMappingError = ErrorWrapper<{
1035
1363
  status: 400;
1036
1364
  payload: BadRequestError;
1037
1365
  } | {
1038
1366
  status: 401;
1039
1367
  payload: AuthError;
1040
- } | {
1041
- status: 404;
1042
- payload: SimpleError;
1043
1368
  }>;
1044
- declare type DeleteBranchVariables = {
1045
- pathParams: DeleteBranchPathParams;
1369
+ declare type GetGitBranchesMappingVariables = {
1370
+ pathParams: GetGitBranchesMappingPathParams;
1046
1371
  } & FetcherExtraProps;
1047
1372
  /**
1048
- * Delete the branch in the database and all its resources
1373
+ * Lists all the git branches in the mapping, and their associated Xata branches.
1374
+ *
1375
+ * Example response:
1376
+ *
1377
+ * ```json
1378
+ * {
1379
+ * "mappings": [
1380
+ * {
1381
+ * "gitBranch": "main",
1382
+ * "xataBranch": "main"
1383
+ * },
1384
+ * {
1385
+ * "gitBranch": "gitBranch1",
1386
+ * "xataBranch": "xataBranch1"
1387
+ * }
1388
+ * {
1389
+ * "gitBranch": "xataBranch2",
1390
+ * "xataBranch": "xataBranch2"
1391
+ * }
1392
+ * ]
1393
+ * }
1394
+ * ```
1049
1395
  */
1050
- declare const deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
1051
- declare type UpdateBranchMetadataPathParams = {
1052
- dbBranchName: DBBranchName;
1396
+ declare const getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
1397
+ declare type AddGitBranchesEntryPathParams = {
1398
+ dbName: DBName;
1053
1399
  workspace: string;
1054
1400
  };
1055
- declare type UpdateBranchMetadataError = ErrorWrapper<{
1401
+ declare type AddGitBranchesEntryError = ErrorWrapper<{
1056
1402
  status: 400;
1057
1403
  payload: BadRequestError;
1058
1404
  } | {
1059
1405
  status: 401;
1060
1406
  payload: AuthError;
1061
- } | {
1062
- status: 404;
1063
- payload: SimpleError;
1064
1407
  }>;
1065
- declare type UpdateBranchMetadataVariables = {
1066
- body?: BranchMetadata;
1067
- pathParams: UpdateBranchMetadataPathParams;
1408
+ declare type AddGitBranchesEntryResponse = {
1409
+ warning?: string;
1410
+ };
1411
+ declare type AddGitBranchesEntryRequestBody = {
1412
+ gitBranch: string;
1413
+ xataBranch: BranchName;
1414
+ };
1415
+ declare type AddGitBranchesEntryVariables = {
1416
+ body: AddGitBranchesEntryRequestBody;
1417
+ pathParams: AddGitBranchesEntryPathParams;
1068
1418
  } & FetcherExtraProps;
1069
1419
  /**
1070
- * Update the branch metadata
1420
+ * Adds an entry to the mapping of git branches to Xata branches. The git branch and the Xata branch must be present in the body of the request. If the Xata branch doesn't exist, a 400 error is returned.
1421
+ *
1422
+ * If the git branch is already present in the mapping, the old entry is overwritten, and a warning message is included in the response. If the git branch is added and didn't exist before, the response code is 204. If the git branch existed and it was overwritten, the response code is 201.
1423
+ *
1424
+ * Example request:
1425
+ *
1426
+ * ```json
1427
+ * // POST https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches
1428
+ * {
1429
+ * "gitBranch": "fix/bug123",
1430
+ * "xataBranch": "fix_bug"
1431
+ * }
1432
+ * ```
1071
1433
  */
1072
- declare const updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
1073
- declare type GetBranchMetadataPathParams = {
1074
- dbBranchName: DBBranchName;
1434
+ declare const addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
1435
+ declare type RemoveGitBranchesEntryPathParams = {
1436
+ dbName: DBName;
1075
1437
  workspace: string;
1076
1438
  };
1077
- declare type GetBranchMetadataError = ErrorWrapper<{
1439
+ declare type RemoveGitBranchesEntryQueryParams = {
1440
+ gitBranch: string;
1441
+ };
1442
+ declare type RemoveGitBranchesEntryError = ErrorWrapper<{
1078
1443
  status: 400;
1079
1444
  payload: BadRequestError;
1080
1445
  } | {
1081
1446
  status: 401;
1082
1447
  payload: AuthError;
1083
- } | {
1084
- status: 404;
1085
- payload: SimpleError;
1086
1448
  }>;
1087
- declare type GetBranchMetadataVariables = {
1088
- pathParams: GetBranchMetadataPathParams;
1449
+ declare type RemoveGitBranchesEntryVariables = {
1450
+ pathParams: RemoveGitBranchesEntryPathParams;
1451
+ queryParams: RemoveGitBranchesEntryQueryParams;
1089
1452
  } & FetcherExtraProps;
1090
- declare const getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
1091
- declare type GetBranchMigrationHistoryPathParams = {
1092
- dbBranchName: DBBranchName;
1453
+ /**
1454
+ * Removes an entry from the mapping of git branches to Xata branches. The name of the git branch must be passed as a query parameter. If the git branch is not found, the endpoint returns a 404 status code.
1455
+ *
1456
+ * Example request:
1457
+ *
1458
+ * ```json
1459
+ * // DELETE https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches?gitBranch=fix%2Fbug123
1460
+ * ```
1461
+ */
1462
+ declare const removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
1463
+ declare type ResolveBranchPathParams = {
1464
+ dbName: DBName;
1093
1465
  workspace: string;
1094
1466
  };
1095
- declare type GetBranchMigrationHistoryError = ErrorWrapper<{
1467
+ declare type ResolveBranchQueryParams = {
1468
+ gitBranch?: string;
1469
+ fallbackBranch?: string;
1470
+ };
1471
+ declare type ResolveBranchError = ErrorWrapper<{
1096
1472
  status: 400;
1097
1473
  payload: BadRequestError;
1098
1474
  } | {
1099
1475
  status: 401;
1100
1476
  payload: AuthError;
1101
- } | {
1102
- status: 404;
1103
- payload: SimpleError;
1104
1477
  }>;
1105
- declare type GetBranchMigrationHistoryResponse = {
1106
- startedFrom?: StartedFromMetadata;
1107
- migrations?: BranchMigration[];
1108
- };
1109
- declare type GetBranchMigrationHistoryRequestBody = {
1110
- limit?: number;
1111
- startFrom?: string;
1478
+ declare type ResolveBranchResponse = {
1479
+ branch: string;
1480
+ reason: {
1481
+ code: 'FOUND_IN_MAPPING' | 'BRANCH_EXISTS' | 'FALLBACK_BRANCH' | 'DEFAULT_BRANCH';
1482
+ message: string;
1483
+ };
1112
1484
  };
1113
- declare type GetBranchMigrationHistoryVariables = {
1114
- body?: GetBranchMigrationHistoryRequestBody;
1115
- pathParams: GetBranchMigrationHistoryPathParams;
1485
+ declare type ResolveBranchVariables = {
1486
+ pathParams: ResolveBranchPathParams;
1487
+ queryParams?: ResolveBranchQueryParams;
1116
1488
  } & FetcherExtraProps;
1117
- declare const getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
1118
- declare type ExecuteBranchMigrationPlanPathParams = {
1489
+ /**
1490
+ * In order to resolve the database branch, the following algorithm is used:
1491
+ * * if the `gitBranch` was provided and is found in the [git branches mapping](/api-reference/dbs/db_name/gitBranches), the associated Xata branch is returned
1492
+ * * else, if a Xata branch with the exact same name as `gitBranch` exists, return it
1493
+ * * else, if `fallbackBranch` is provided and a branch with that name exists, return it
1494
+ * * else, return the default branch of the DB (`main` or the first branch)
1495
+ *
1496
+ * Example call:
1497
+ *
1498
+ * ```json
1499
+ * // GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test&fallbackBranch=tsg
1500
+ * ```
1501
+ *
1502
+ * Example response:
1503
+ *
1504
+ * ```json
1505
+ * {
1506
+ * "branch": "main",
1507
+ * "reason": {
1508
+ * "code": "DEFAULT_BRANCH",
1509
+ * "message": "Default branch for this database (main)"
1510
+ * }
1511
+ * }
1512
+ * ```
1513
+ */
1514
+ declare const resolveBranch: (variables: ResolveBranchVariables) => Promise<ResolveBranchResponse>;
1515
+ declare type ListMigrationRequestsPathParams = {
1516
+ dbName: DBName;
1517
+ workspace: string;
1518
+ };
1519
+ declare type ListMigrationRequestsError = ErrorWrapper<{
1520
+ status: 400;
1521
+ payload: BadRequestError;
1522
+ } | {
1523
+ status: 401;
1524
+ payload: AuthError;
1525
+ } | {
1526
+ status: 404;
1527
+ payload: SimpleError;
1528
+ }>;
1529
+ declare type ListMigrationRequestsResponse = {
1530
+ migrationRequests: MigrationRequest[];
1531
+ meta: RecordsMetadata;
1532
+ };
1533
+ declare type ListMigrationRequestsRequestBody = {
1534
+ filter?: FilterExpression;
1535
+ sort?: SortExpression;
1536
+ page?: PageConfig;
1537
+ columns?: ColumnsProjection;
1538
+ };
1539
+ declare type ListMigrationRequestsVariables = {
1540
+ body?: ListMigrationRequestsRequestBody;
1541
+ pathParams: ListMigrationRequestsPathParams;
1542
+ } & FetcherExtraProps;
1543
+ declare const listMigrationRequests: (variables: ListMigrationRequestsVariables) => Promise<ListMigrationRequestsResponse>;
1544
+ declare type CreateMigrationRequestPathParams = {
1545
+ dbName: DBName;
1546
+ workspace: string;
1547
+ };
1548
+ declare type CreateMigrationRequestError = ErrorWrapper<{
1549
+ status: 400;
1550
+ payload: BadRequestError;
1551
+ } | {
1552
+ status: 401;
1553
+ payload: AuthError;
1554
+ } | {
1555
+ status: 404;
1556
+ payload: SimpleError;
1557
+ }>;
1558
+ declare type CreateMigrationRequestResponse = {
1559
+ number: number;
1560
+ };
1561
+ declare type CreateMigrationRequestRequestBody = {
1562
+ source: string;
1563
+ target: string;
1564
+ title: string;
1565
+ body?: string;
1566
+ };
1567
+ declare type CreateMigrationRequestVariables = {
1568
+ body: CreateMigrationRequestRequestBody;
1569
+ pathParams: CreateMigrationRequestPathParams;
1570
+ } & FetcherExtraProps;
1571
+ declare const createMigrationRequest: (variables: CreateMigrationRequestVariables) => Promise<CreateMigrationRequestResponse>;
1572
+ declare type GetMigrationRequestPathParams = {
1573
+ dbName: DBName;
1574
+ mrNumber: number;
1575
+ workspace: string;
1576
+ };
1577
+ declare type GetMigrationRequestError = ErrorWrapper<{
1578
+ status: 400;
1579
+ payload: BadRequestError;
1580
+ } | {
1581
+ status: 401;
1582
+ payload: AuthError;
1583
+ } | {
1584
+ status: 404;
1585
+ payload: SimpleError;
1586
+ }>;
1587
+ declare type GetMigrationRequestVariables = {
1588
+ pathParams: GetMigrationRequestPathParams;
1589
+ } & FetcherExtraProps;
1590
+ declare const getMigrationRequest: (variables: GetMigrationRequestVariables) => Promise<MigrationRequest>;
1591
+ declare type UpdateMigrationRequestPathParams = {
1592
+ dbName: DBName;
1593
+ mrNumber: number;
1594
+ workspace: string;
1595
+ };
1596
+ declare type UpdateMigrationRequestError = ErrorWrapper<{
1597
+ status: 400;
1598
+ payload: BadRequestError;
1599
+ } | {
1600
+ status: 401;
1601
+ payload: AuthError;
1602
+ } | {
1603
+ status: 404;
1604
+ payload: SimpleError;
1605
+ }>;
1606
+ declare type UpdateMigrationRequestRequestBody = {
1607
+ title?: string;
1608
+ body?: string;
1609
+ status?: 'open' | 'closed';
1610
+ };
1611
+ declare type UpdateMigrationRequestVariables = {
1612
+ body?: UpdateMigrationRequestRequestBody;
1613
+ pathParams: UpdateMigrationRequestPathParams;
1614
+ } & FetcherExtraProps;
1615
+ declare const updateMigrationRequest: (variables: UpdateMigrationRequestVariables) => Promise<undefined>;
1616
+ declare type ListMigrationRequestsCommitsPathParams = {
1617
+ dbName: DBName;
1618
+ mrNumber: number;
1619
+ workspace: string;
1620
+ };
1621
+ declare type ListMigrationRequestsCommitsError = ErrorWrapper<{
1622
+ status: 400;
1623
+ payload: BadRequestError;
1624
+ } | {
1625
+ status: 401;
1626
+ payload: AuthError;
1627
+ } | {
1628
+ status: 404;
1629
+ payload: SimpleError;
1630
+ }>;
1631
+ declare type ListMigrationRequestsCommitsResponse = {
1632
+ meta: {
1633
+ cursor: string;
1634
+ more: boolean;
1635
+ };
1636
+ logs: Commit[];
1637
+ };
1638
+ declare type ListMigrationRequestsCommitsRequestBody = {
1639
+ page?: {
1640
+ after?: string;
1641
+ before?: string;
1642
+ size?: number;
1643
+ };
1644
+ };
1645
+ declare type ListMigrationRequestsCommitsVariables = {
1646
+ body?: ListMigrationRequestsCommitsRequestBody;
1647
+ pathParams: ListMigrationRequestsCommitsPathParams;
1648
+ } & FetcherExtraProps;
1649
+ declare const listMigrationRequestsCommits: (variables: ListMigrationRequestsCommitsVariables) => Promise<ListMigrationRequestsCommitsResponse>;
1650
+ declare type CompareMigrationRequestPathParams = {
1651
+ dbName: DBName;
1652
+ mrNumber: number;
1653
+ workspace: string;
1654
+ };
1655
+ declare type CompareMigrationRequestError = ErrorWrapper<{
1656
+ status: 400;
1657
+ payload: BadRequestError;
1658
+ } | {
1659
+ status: 401;
1660
+ payload: AuthError;
1661
+ } | {
1662
+ status: 404;
1663
+ payload: SimpleError;
1664
+ }>;
1665
+ declare type CompareMigrationRequestVariables = {
1666
+ pathParams: CompareMigrationRequestPathParams;
1667
+ } & FetcherExtraProps;
1668
+ declare const compareMigrationRequest: (variables: CompareMigrationRequestVariables) => Promise<SchemaCompareResponse>;
1669
+ declare type GetMigrationRequestIsMergedPathParams = {
1670
+ dbName: DBName;
1671
+ mrNumber: number;
1672
+ workspace: string;
1673
+ };
1674
+ declare type GetMigrationRequestIsMergedError = ErrorWrapper<{
1675
+ status: 400;
1676
+ payload: BadRequestError;
1677
+ } | {
1678
+ status: 401;
1679
+ payload: AuthError;
1680
+ } | {
1681
+ status: 404;
1682
+ payload: SimpleError;
1683
+ }>;
1684
+ declare type GetMigrationRequestIsMergedResponse = {
1685
+ merged?: boolean;
1686
+ };
1687
+ declare type GetMigrationRequestIsMergedVariables = {
1688
+ pathParams: GetMigrationRequestIsMergedPathParams;
1689
+ } & FetcherExtraProps;
1690
+ declare const getMigrationRequestIsMerged: (variables: GetMigrationRequestIsMergedVariables) => Promise<GetMigrationRequestIsMergedResponse>;
1691
+ declare type MergeMigrationRequestPathParams = {
1692
+ dbName: DBName;
1693
+ mrNumber: number;
1694
+ workspace: string;
1695
+ };
1696
+ declare type MergeMigrationRequestError = ErrorWrapper<{
1697
+ status: 400;
1698
+ payload: BadRequestError;
1699
+ } | {
1700
+ status: 401;
1701
+ payload: AuthError;
1702
+ } | {
1703
+ status: 404;
1704
+ payload: SimpleError;
1705
+ }>;
1706
+ declare type MergeMigrationRequestVariables = {
1707
+ pathParams: MergeMigrationRequestPathParams;
1708
+ } & FetcherExtraProps;
1709
+ declare const mergeMigrationRequest: (variables: MergeMigrationRequestVariables) => Promise<Commit>;
1710
+ declare type GetBranchDetailsPathParams = {
1711
+ dbBranchName: DBBranchName;
1712
+ workspace: string;
1713
+ };
1714
+ declare type GetBranchDetailsError = ErrorWrapper<{
1715
+ status: 400;
1716
+ payload: BadRequestError;
1717
+ } | {
1718
+ status: 401;
1719
+ payload: AuthError;
1720
+ } | {
1721
+ status: 404;
1722
+ payload: SimpleError;
1723
+ }>;
1724
+ declare type GetBranchDetailsVariables = {
1725
+ pathParams: GetBranchDetailsPathParams;
1726
+ } & FetcherExtraProps;
1727
+ declare const getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
1728
+ declare type CreateBranchPathParams = {
1729
+ dbBranchName: DBBranchName;
1730
+ workspace: string;
1731
+ };
1732
+ declare type CreateBranchQueryParams = {
1733
+ from?: string;
1734
+ };
1735
+ declare type CreateBranchError = ErrorWrapper<{
1736
+ status: 400;
1737
+ payload: BadRequestError;
1738
+ } | {
1739
+ status: 401;
1740
+ payload: AuthError;
1741
+ } | {
1742
+ status: 404;
1743
+ payload: SimpleError;
1744
+ }>;
1745
+ declare type CreateBranchResponse = {
1746
+ databaseName: string;
1747
+ branchName: string;
1748
+ };
1749
+ declare type CreateBranchRequestBody = {
1750
+ from?: string;
1751
+ metadata?: BranchMetadata;
1752
+ };
1753
+ declare type CreateBranchVariables = {
1754
+ body?: CreateBranchRequestBody;
1755
+ pathParams: CreateBranchPathParams;
1756
+ queryParams?: CreateBranchQueryParams;
1757
+ } & FetcherExtraProps;
1758
+ declare const createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
1759
+ declare type DeleteBranchPathParams = {
1760
+ dbBranchName: DBBranchName;
1761
+ workspace: string;
1762
+ };
1763
+ declare type DeleteBranchError = ErrorWrapper<{
1764
+ status: 400;
1765
+ payload: BadRequestError;
1766
+ } | {
1767
+ status: 401;
1768
+ payload: AuthError;
1769
+ } | {
1770
+ status: 404;
1771
+ payload: SimpleError;
1772
+ }>;
1773
+ declare type DeleteBranchVariables = {
1774
+ pathParams: DeleteBranchPathParams;
1775
+ } & FetcherExtraProps;
1776
+ /**
1777
+ * Delete the branch in the database and all its resources
1778
+ */
1779
+ declare const deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
1780
+ declare type UpdateBranchMetadataPathParams = {
1781
+ dbBranchName: DBBranchName;
1782
+ workspace: string;
1783
+ };
1784
+ declare type UpdateBranchMetadataError = ErrorWrapper<{
1785
+ status: 400;
1786
+ payload: BadRequestError;
1787
+ } | {
1788
+ status: 401;
1789
+ payload: AuthError;
1790
+ } | {
1791
+ status: 404;
1792
+ payload: SimpleError;
1793
+ }>;
1794
+ declare type UpdateBranchMetadataVariables = {
1795
+ body?: BranchMetadata;
1796
+ pathParams: UpdateBranchMetadataPathParams;
1797
+ } & FetcherExtraProps;
1798
+ /**
1799
+ * Update the branch metadata
1800
+ */
1801
+ declare const updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
1802
+ declare type GetBranchMetadataPathParams = {
1803
+ dbBranchName: DBBranchName;
1804
+ workspace: string;
1805
+ };
1806
+ declare type GetBranchMetadataError = ErrorWrapper<{
1807
+ status: 400;
1808
+ payload: BadRequestError;
1809
+ } | {
1810
+ status: 401;
1811
+ payload: AuthError;
1812
+ } | {
1813
+ status: 404;
1814
+ payload: SimpleError;
1815
+ }>;
1816
+ declare type GetBranchMetadataVariables = {
1817
+ pathParams: GetBranchMetadataPathParams;
1818
+ } & FetcherExtraProps;
1819
+ declare const getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
1820
+ declare type GetBranchMigrationHistoryPathParams = {
1821
+ dbBranchName: DBBranchName;
1822
+ workspace: string;
1823
+ };
1824
+ declare type GetBranchMigrationHistoryError = ErrorWrapper<{
1825
+ status: 400;
1826
+ payload: BadRequestError;
1827
+ } | {
1828
+ status: 401;
1829
+ payload: AuthError;
1830
+ } | {
1831
+ status: 404;
1832
+ payload: SimpleError;
1833
+ }>;
1834
+ declare type GetBranchMigrationHistoryResponse = {
1835
+ startedFrom?: StartedFromMetadata;
1836
+ migrations?: BranchMigration[];
1837
+ };
1838
+ declare type GetBranchMigrationHistoryRequestBody = {
1839
+ limit?: number;
1840
+ startFrom?: string;
1841
+ };
1842
+ declare type GetBranchMigrationHistoryVariables = {
1843
+ body?: GetBranchMigrationHistoryRequestBody;
1844
+ pathParams: GetBranchMigrationHistoryPathParams;
1845
+ } & FetcherExtraProps;
1846
+ declare const getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
1847
+ declare type ExecuteBranchMigrationPlanPathParams = {
1848
+ dbBranchName: DBBranchName;
1849
+ workspace: string;
1850
+ };
1851
+ declare type ExecuteBranchMigrationPlanError = ErrorWrapper<{
1852
+ status: 400;
1853
+ payload: BadRequestError;
1854
+ } | {
1855
+ status: 401;
1856
+ payload: AuthError;
1857
+ } | {
1858
+ status: 404;
1859
+ payload: SimpleError;
1860
+ }>;
1861
+ declare type ExecuteBranchMigrationPlanRequestBody = {
1862
+ version: number;
1863
+ migration: BranchMigration;
1864
+ };
1865
+ declare type ExecuteBranchMigrationPlanVariables = {
1866
+ body: ExecuteBranchMigrationPlanRequestBody;
1867
+ pathParams: ExecuteBranchMigrationPlanPathParams;
1868
+ } & FetcherExtraProps;
1869
+ /**
1870
+ * Apply a migration plan to the branch
1871
+ */
1872
+ declare const executeBranchMigrationPlan: (variables: ExecuteBranchMigrationPlanVariables) => Promise<undefined>;
1873
+ declare type GetBranchMigrationPlanPathParams = {
1874
+ dbBranchName: DBBranchName;
1875
+ workspace: string;
1876
+ };
1877
+ declare type GetBranchMigrationPlanError = ErrorWrapper<{
1878
+ status: 400;
1879
+ payload: BadRequestError;
1880
+ } | {
1881
+ status: 401;
1882
+ payload: AuthError;
1883
+ } | {
1884
+ status: 404;
1885
+ payload: SimpleError;
1886
+ }>;
1887
+ declare type GetBranchMigrationPlanVariables = {
1888
+ body: Schema;
1889
+ pathParams: GetBranchMigrationPlanPathParams;
1890
+ } & FetcherExtraProps;
1891
+ /**
1892
+ * Compute a migration plan from a target schema the branch should be migrated too.
1893
+ */
1894
+ declare const getBranchMigrationPlan: (variables: GetBranchMigrationPlanVariables) => Promise<BranchMigrationPlan>;
1895
+ declare type CompareBranchWithUserSchemaPathParams = {
1119
1896
  dbBranchName: DBBranchName;
1120
1897
  workspace: string;
1121
1898
  };
1122
- declare type ExecuteBranchMigrationPlanError = ErrorWrapper<{
1899
+ declare type CompareBranchWithUserSchemaError = ErrorWrapper<{
1123
1900
  status: 400;
1124
1901
  payload: BadRequestError;
1125
1902
  } | {
@@ -1129,23 +1906,20 @@ declare type ExecuteBranchMigrationPlanError = ErrorWrapper<{
1129
1906
  status: 404;
1130
1907
  payload: SimpleError;
1131
1908
  }>;
1132
- declare type ExecuteBranchMigrationPlanRequestBody = {
1133
- version: number;
1134
- migration: BranchMigration;
1909
+ declare type CompareBranchWithUserSchemaRequestBody = {
1910
+ schema: Schema;
1135
1911
  };
1136
- declare type ExecuteBranchMigrationPlanVariables = {
1137
- body: ExecuteBranchMigrationPlanRequestBody;
1138
- pathParams: ExecuteBranchMigrationPlanPathParams;
1912
+ declare type CompareBranchWithUserSchemaVariables = {
1913
+ body: CompareBranchWithUserSchemaRequestBody;
1914
+ pathParams: CompareBranchWithUserSchemaPathParams;
1139
1915
  } & FetcherExtraProps;
1140
- /**
1141
- * Apply a migration plan to the branch
1142
- */
1143
- declare const executeBranchMigrationPlan: (variables: ExecuteBranchMigrationPlanVariables) => Promise<undefined>;
1144
- declare type GetBranchMigrationPlanPathParams = {
1916
+ declare const compareBranchWithUserSchema: (variables: CompareBranchWithUserSchemaVariables) => Promise<SchemaCompareResponse>;
1917
+ declare type CompareBranchSchemasPathParams = {
1145
1918
  dbBranchName: DBBranchName;
1919
+ branchName: BranchName;
1146
1920
  workspace: string;
1147
1921
  };
1148
- declare type GetBranchMigrationPlanError = ErrorWrapper<{
1922
+ declare type CompareBranchSchemasError = ErrorWrapper<{
1149
1923
  status: 400;
1150
1924
  payload: BadRequestError;
1151
1925
  } | {
@@ -1155,14 +1929,120 @@ declare type GetBranchMigrationPlanError = ErrorWrapper<{
1155
1929
  status: 404;
1156
1930
  payload: SimpleError;
1157
1931
  }>;
1158
- declare type GetBranchMigrationPlanVariables = {
1159
- body: Schema;
1160
- pathParams: GetBranchMigrationPlanPathParams;
1932
+ declare type CompareBranchSchemasVariables = {
1933
+ body?: Record<string, any>;
1934
+ pathParams: CompareBranchSchemasPathParams;
1161
1935
  } & FetcherExtraProps;
1162
- /**
1163
- * Compute a migration plan from a target schema the branch should be migrated too.
1164
- */
1165
- declare const getBranchMigrationPlan: (variables: GetBranchMigrationPlanVariables) => Promise<BranchMigrationPlan>;
1936
+ declare const compareBranchSchemas: (variables: CompareBranchSchemasVariables) => Promise<SchemaCompareResponse>;
1937
+ declare type UpdateBranchSchemaPathParams = {
1938
+ dbBranchName: DBBranchName;
1939
+ workspace: string;
1940
+ };
1941
+ declare type UpdateBranchSchemaError = ErrorWrapper<{
1942
+ status: 400;
1943
+ payload: BadRequestError;
1944
+ } | {
1945
+ status: 401;
1946
+ payload: AuthError;
1947
+ } | {
1948
+ status: 404;
1949
+ payload: SimpleError;
1950
+ }>;
1951
+ declare type UpdateBranchSchemaResponse = {
1952
+ id: string;
1953
+ parentID: string;
1954
+ };
1955
+ declare type UpdateBranchSchemaVariables = {
1956
+ body: Migration;
1957
+ pathParams: UpdateBranchSchemaPathParams;
1958
+ } & FetcherExtraProps;
1959
+ declare const updateBranchSchema: (variables: UpdateBranchSchemaVariables) => Promise<UpdateBranchSchemaResponse>;
1960
+ declare type PreviewBranchSchemaEditPathParams = {
1961
+ dbBranchName: DBBranchName;
1962
+ workspace: string;
1963
+ };
1964
+ declare type PreviewBranchSchemaEditError = ErrorWrapper<{
1965
+ status: 400;
1966
+ payload: BadRequestError;
1967
+ } | {
1968
+ status: 401;
1969
+ payload: AuthError;
1970
+ } | {
1971
+ status: 404;
1972
+ payload: SimpleError;
1973
+ }>;
1974
+ declare type PreviewBranchSchemaEditResponse = {
1975
+ original: Schema;
1976
+ updated: Schema;
1977
+ };
1978
+ declare type PreviewBranchSchemaEditRequestBody = {
1979
+ edits?: SchemaEditScript;
1980
+ operations?: MigrationOp[];
1981
+ };
1982
+ declare type PreviewBranchSchemaEditVariables = {
1983
+ body?: PreviewBranchSchemaEditRequestBody;
1984
+ pathParams: PreviewBranchSchemaEditPathParams;
1985
+ } & FetcherExtraProps;
1986
+ declare const previewBranchSchemaEdit: (variables: PreviewBranchSchemaEditVariables) => Promise<PreviewBranchSchemaEditResponse>;
1987
+ declare type ApplyBranchSchemaEditPathParams = {
1988
+ dbBranchName: DBBranchName;
1989
+ workspace: string;
1990
+ };
1991
+ declare type ApplyBranchSchemaEditError = ErrorWrapper<{
1992
+ status: 400;
1993
+ payload: BadRequestError;
1994
+ } | {
1995
+ status: 401;
1996
+ payload: AuthError;
1997
+ } | {
1998
+ status: 404;
1999
+ payload: SimpleError;
2000
+ }>;
2001
+ declare type ApplyBranchSchemaEditResponse = {
2002
+ id: string;
2003
+ parentID: string;
2004
+ };
2005
+ declare type ApplyBranchSchemaEditRequestBody = {
2006
+ edits: SchemaEditScript;
2007
+ };
2008
+ declare type ApplyBranchSchemaEditVariables = {
2009
+ body: ApplyBranchSchemaEditRequestBody;
2010
+ pathParams: ApplyBranchSchemaEditPathParams;
2011
+ } & FetcherExtraProps;
2012
+ declare const applyBranchSchemaEdit: (variables: ApplyBranchSchemaEditVariables) => Promise<ApplyBranchSchemaEditResponse>;
2013
+ declare type GetBranchSchemaHistoryPathParams = {
2014
+ dbBranchName: DBBranchName;
2015
+ workspace: string;
2016
+ };
2017
+ declare type GetBranchSchemaHistoryError = ErrorWrapper<{
2018
+ status: 400;
2019
+ payload: BadRequestError;
2020
+ } | {
2021
+ status: 401;
2022
+ payload: AuthError;
2023
+ } | {
2024
+ status: 404;
2025
+ payload: SimpleError;
2026
+ }>;
2027
+ declare type GetBranchSchemaHistoryResponse = {
2028
+ meta: {
2029
+ cursor: string;
2030
+ more: boolean;
2031
+ };
2032
+ logs: Commit[];
2033
+ };
2034
+ declare type GetBranchSchemaHistoryRequestBody = {
2035
+ page?: {
2036
+ after?: string;
2037
+ before?: string;
2038
+ size?: number;
2039
+ };
2040
+ };
2041
+ declare type GetBranchSchemaHistoryVariables = {
2042
+ body?: GetBranchSchemaHistoryRequestBody;
2043
+ pathParams: GetBranchSchemaHistoryPathParams;
2044
+ } & FetcherExtraProps;
2045
+ declare const getBranchSchemaHistory: (variables: GetBranchSchemaHistoryVariables) => Promise<GetBranchSchemaHistoryResponse>;
1166
2046
  declare type GetBranchStatsPathParams = {
1167
2047
  dbBranchName: DBBranchName;
1168
2048
  workspace: string;
@@ -1213,13 +2093,17 @@ declare type CreateTableError = ErrorWrapper<{
1213
2093
  status: 422;
1214
2094
  payload: SimpleError;
1215
2095
  }>;
2096
+ declare type CreateTableResponse = {
2097
+ branchName: string;
2098
+ tableName: string;
2099
+ };
1216
2100
  declare type CreateTableVariables = {
1217
2101
  pathParams: CreateTablePathParams;
1218
2102
  } & FetcherExtraProps;
1219
2103
  /**
1220
2104
  * Creates a new table with the given name. Returns 422 if a table with the same name already exists.
1221
2105
  */
1222
- declare const createTable: (variables: CreateTableVariables) => Promise<undefined>;
2106
+ declare const createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
1223
2107
  declare type DeleteTablePathParams = {
1224
2108
  dbBranchName: DBBranchName;
1225
2109
  tableName: TableName;
@@ -1266,8 +2150,9 @@ declare type UpdateTableVariables = {
1266
2150
  *
1267
2151
  * In the example below, we rename a table from “users” to “people”:
1268
2152
  *
1269
- * ```jsx
1270
- * PATCH /db/test:main/tables/users
2153
+ * ```json
2154
+ * // PATCH /db/test:main/tables/users
2155
+ *
1271
2156
  * {
1272
2157
  * "name": "people"
1273
2158
  * }
@@ -1451,6 +2336,9 @@ declare type InsertRecordPathParams = {
1451
2336
  tableName: TableName;
1452
2337
  workspace: string;
1453
2338
  };
2339
+ declare type InsertRecordQueryParams = {
2340
+ columns?: ColumnsProjection;
2341
+ };
1454
2342
  declare type InsertRecordError = ErrorWrapper<{
1455
2343
  status: 400;
1456
2344
  payload: BadRequestError;
@@ -1461,20 +2349,15 @@ declare type InsertRecordError = ErrorWrapper<{
1461
2349
  status: 404;
1462
2350
  payload: SimpleError;
1463
2351
  }>;
1464
- declare type InsertRecordResponse = {
1465
- id: string;
1466
- xata: {
1467
- version: number;
1468
- };
1469
- };
1470
2352
  declare type InsertRecordVariables = {
1471
2353
  body?: Record<string, any>;
1472
2354
  pathParams: InsertRecordPathParams;
2355
+ queryParams?: InsertRecordQueryParams;
1473
2356
  } & FetcherExtraProps;
1474
2357
  /**
1475
2358
  * Insert a new Record into the Table
1476
2359
  */
1477
- declare const insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
2360
+ declare const insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
1478
2361
  declare type InsertRecordWithIDPathParams = {
1479
2362
  dbBranchName: DBBranchName;
1480
2363
  tableName: TableName;
@@ -1482,6 +2365,7 @@ declare type InsertRecordWithIDPathParams = {
1482
2365
  workspace: string;
1483
2366
  };
1484
2367
  declare type InsertRecordWithIDQueryParams = {
2368
+ columns?: ColumnsProjection;
1485
2369
  createOnly?: boolean;
1486
2370
  ifVersion?: number;
1487
2371
  };
@@ -1514,6 +2398,7 @@ declare type UpdateRecordWithIDPathParams = {
1514
2398
  workspace: string;
1515
2399
  };
1516
2400
  declare type UpdateRecordWithIDQueryParams = {
2401
+ columns?: ColumnsProjection;
1517
2402
  ifVersion?: number;
1518
2403
  };
1519
2404
  declare type UpdateRecordWithIDError = ErrorWrapper<{
@@ -1542,6 +2427,7 @@ declare type UpsertRecordWithIDPathParams = {
1542
2427
  workspace: string;
1543
2428
  };
1544
2429
  declare type UpsertRecordWithIDQueryParams = {
2430
+ columns?: ColumnsProjection;
1545
2431
  ifVersion?: number;
1546
2432
  };
1547
2433
  declare type UpsertRecordWithIDError = ErrorWrapper<{
@@ -1569,6 +2455,9 @@ declare type DeleteRecordPathParams = {
1569
2455
  recordId: RecordID;
1570
2456
  workspace: string;
1571
2457
  };
2458
+ declare type DeleteRecordQueryParams = {
2459
+ columns?: ColumnsProjection;
2460
+ };
1572
2461
  declare type DeleteRecordError = ErrorWrapper<{
1573
2462
  status: 400;
1574
2463
  payload: BadRequestError;
@@ -1581,14 +2470,18 @@ declare type DeleteRecordError = ErrorWrapper<{
1581
2470
  }>;
1582
2471
  declare type DeleteRecordVariables = {
1583
2472
  pathParams: DeleteRecordPathParams;
2473
+ queryParams?: DeleteRecordQueryParams;
1584
2474
  } & FetcherExtraProps;
1585
- declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
2475
+ declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
1586
2476
  declare type GetRecordPathParams = {
1587
2477
  dbBranchName: DBBranchName;
1588
2478
  tableName: TableName;
1589
2479
  recordId: RecordID;
1590
2480
  workspace: string;
1591
2481
  };
2482
+ declare type GetRecordQueryParams = {
2483
+ columns?: ColumnsProjection;
2484
+ };
1592
2485
  declare type GetRecordError = ErrorWrapper<{
1593
2486
  status: 400;
1594
2487
  payload: BadRequestError;
@@ -1599,12 +2492,9 @@ declare type GetRecordError = ErrorWrapper<{
1599
2492
  status: 404;
1600
2493
  payload: SimpleError;
1601
2494
  }>;
1602
- declare type GetRecordRequestBody = {
1603
- columns?: ColumnsFilter;
1604
- };
1605
2495
  declare type GetRecordVariables = {
1606
- body?: GetRecordRequestBody;
1607
2496
  pathParams: GetRecordPathParams;
2497
+ queryParams?: GetRecordQueryParams;
1608
2498
  } & FetcherExtraProps;
1609
2499
  /**
1610
2500
  * Retrieve record by ID
@@ -1615,6 +2505,9 @@ declare type BulkInsertTableRecordsPathParams = {
1615
2505
  tableName: TableName;
1616
2506
  workspace: string;
1617
2507
  };
2508
+ declare type BulkInsertTableRecordsQueryParams = {
2509
+ columns?: ColumnsProjection;
2510
+ };
1618
2511
  declare type BulkInsertTableRecordsError = ErrorWrapper<{
1619
2512
  status: 400;
1620
2513
  payload: BulkError;
@@ -1624,21 +2517,22 @@ declare type BulkInsertTableRecordsError = ErrorWrapper<{
1624
2517
  } | {
1625
2518
  status: 404;
1626
2519
  payload: SimpleError;
2520
+ } | {
2521
+ status: 422;
2522
+ payload: SimpleError;
1627
2523
  }>;
1628
- declare type BulkInsertTableRecordsResponse = {
1629
- recordIDs: string[];
1630
- };
1631
2524
  declare type BulkInsertTableRecordsRequestBody = {
1632
2525
  records: Record<string, any>[];
1633
2526
  };
1634
2527
  declare type BulkInsertTableRecordsVariables = {
1635
2528
  body: BulkInsertTableRecordsRequestBody;
1636
2529
  pathParams: BulkInsertTableRecordsPathParams;
2530
+ queryParams?: BulkInsertTableRecordsQueryParams;
1637
2531
  } & FetcherExtraProps;
1638
2532
  /**
1639
2533
  * Bulk insert records
1640
2534
  */
1641
- declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
2535
+ declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
1642
2536
  declare type QueryTablePathParams = {
1643
2537
  dbBranchName: DBBranchName;
1644
2538
  tableName: TableName;
@@ -1658,7 +2552,7 @@ declare type QueryTableRequestBody = {
1658
2552
  filter?: FilterExpression;
1659
2553
  sort?: SortExpression;
1660
2554
  page?: PageConfig;
1661
- columns?: ColumnsFilter;
2555
+ columns?: ColumnsProjection;
1662
2556
  };
1663
2557
  declare type QueryTableVariables = {
1664
2558
  body?: QueryTableRequestBody;
@@ -1675,7 +2569,7 @@ declare type QueryTableVariables = {
1675
2569
  * {
1676
2570
  * "columns": [...],
1677
2571
  * "filter": {
1678
- * "$all": [...]
2572
+ * "$all": [...],
1679
2573
  * "$any": [...]
1680
2574
  * ...
1681
2575
  * },
@@ -1721,7 +2615,11 @@ declare type QueryTableVariables = {
1721
2615
  * "link": {
1722
2616
  * "table": "users"
1723
2617
  * }
1724
- * }
2618
+ * },
2619
+ * {
2620
+ * "name": "foundedDate",
2621
+ * "type": "datetime"
2622
+ * },
1725
2623
  * ]
1726
2624
  * },
1727
2625
  * {
@@ -1809,7 +2707,7 @@ declare type QueryTableVariables = {
1809
2707
  * {
1810
2708
  * "name": "Kilian",
1811
2709
  * "address": {
1812
- * "street": "New street",
2710
+ * "street": "New street"
1813
2711
  * }
1814
2712
  * }
1815
2713
  * ```
@@ -1818,10 +2716,7 @@ declare type QueryTableVariables = {
1818
2716
  *
1819
2717
  * ```json
1820
2718
  * {
1821
- * "columns": [
1822
- * "*",
1823
- * "team.name"
1824
- * ]
2719
+ * "columns": ["*", "team.name"]
1825
2720
  * }
1826
2721
  * ```
1827
2722
  *
@@ -1839,7 +2734,7 @@ declare type QueryTableVariables = {
1839
2734
  * "team": {
1840
2735
  * "id": "XX",
1841
2736
  * "xata": {
1842
- * "version": 0,
2737
+ * "version": 0
1843
2738
  * },
1844
2739
  * "name": "first team"
1845
2740
  * }
@@ -1850,10 +2745,7 @@ declare type QueryTableVariables = {
1850
2745
  *
1851
2746
  * ```json
1852
2747
  * {
1853
- * "columns": [
1854
- * "*",
1855
- * "team.*"
1856
- * ]
2748
+ * "columns": ["*", "team.*"]
1857
2749
  * }
1858
2750
  * ```
1859
2751
  *
@@ -1871,10 +2763,11 @@ declare type QueryTableVariables = {
1871
2763
  * "team": {
1872
2764
  * "id": "XX",
1873
2765
  * "xata": {
1874
- * "version": 0,
2766
+ * "version": 0
1875
2767
  * },
1876
2768
  * "name": "first team",
1877
- * "code": "A1"
2769
+ * "code": "A1",
2770
+ * "foundedDate": "2020-03-04T10:43:54.32Z"
1878
2771
  * }
1879
2772
  * }
1880
2773
  * ```
@@ -1889,7 +2782,7 @@ declare type QueryTableVariables = {
1889
2782
  * `$none`, etc.
1890
2783
  *
1891
2784
  * All operators start with an `$` to differentiate them from column names
1892
- * (which are not allowed to start with an dollar sign).
2785
+ * (which are not allowed to start with a dollar sign).
1893
2786
  *
1894
2787
  * #### Exact matching and control operators
1895
2788
  *
@@ -1920,7 +2813,7 @@ declare type QueryTableVariables = {
1920
2813
  * ```json
1921
2814
  * {
1922
2815
  * "filter": {
1923
- * "name": "r2",
2816
+ * "name": "r2"
1924
2817
  * }
1925
2818
  * }
1926
2819
  * ```
@@ -1942,7 +2835,7 @@ declare type QueryTableVariables = {
1942
2835
  * ```json
1943
2836
  * {
1944
2837
  * "filter": {
1945
- * "settings.plan": "free",
2838
+ * "settings.plan": "free"
1946
2839
  * }
1947
2840
  * }
1948
2841
  * ```
@@ -1952,8 +2845,8 @@ declare type QueryTableVariables = {
1952
2845
  * "filter": {
1953
2846
  * "settings": {
1954
2847
  * "plan": "free"
1955
- * },
1956
- * },
2848
+ * }
2849
+ * }
1957
2850
  * }
1958
2851
  * ```
1959
2852
  *
@@ -1962,8 +2855,8 @@ declare type QueryTableVariables = {
1962
2855
  * ```json
1963
2856
  * {
1964
2857
  * "filter": {
1965
- * "settings.plan": {"$any": ["free", "paid"]}
1966
- * },
2858
+ * "settings.plan": { "$any": ["free", "paid"] }
2859
+ * }
1967
2860
  * }
1968
2861
  * ```
1969
2862
  *
@@ -1972,9 +2865,9 @@ declare type QueryTableVariables = {
1972
2865
  * ```json
1973
2866
  * {
1974
2867
  * "filter": {
1975
- * "settings.dark": true,
1976
- * "settings.plan": "free",
1977
- * },
2868
+ * "settings.dark": true,
2869
+ * "settings.plan": "free"
2870
+ * }
1978
2871
  * }
1979
2872
  * ```
1980
2873
  *
@@ -1985,11 +2878,11 @@ declare type QueryTableVariables = {
1985
2878
  * ```json
1986
2879
  * {
1987
2880
  * "filter": {
1988
- * "$any": {
1989
- * "settings.dark": true,
1990
- * "settings.plan": "free"
1991
- * }
1992
- * },
2881
+ * "$any": {
2882
+ * "settings.dark": true,
2883
+ * "settings.plan": "free"
2884
+ * }
2885
+ * }
1993
2886
  * }
1994
2887
  * ```
1995
2888
  *
@@ -2000,10 +2893,10 @@ declare type QueryTableVariables = {
2000
2893
  * "filter": {
2001
2894
  * "$any": [
2002
2895
  * {
2003
- * "name": "r1",
2896
+ * "name": "r1"
2004
2897
  * },
2005
2898
  * {
2006
- * "name": "r2",
2899
+ * "name": "r2"
2007
2900
  * }
2008
2901
  * ]
2009
2902
  * }
@@ -2015,7 +2908,7 @@ declare type QueryTableVariables = {
2015
2908
  * ```json
2016
2909
  * {
2017
2910
  * "filter": {
2018
- * "$exists": "settings",
2911
+ * "$exists": "settings"
2019
2912
  * }
2020
2913
  * }
2021
2914
  * ```
@@ -2027,10 +2920,10 @@ declare type QueryTableVariables = {
2027
2920
  * "filter": {
2028
2921
  * "$all": [
2029
2922
  * {
2030
- * "$exists": "settings",
2923
+ * "$exists": "settings"
2031
2924
  * },
2032
2925
  * {
2033
- * "$exists": "name",
2926
+ * "$exists": "name"
2034
2927
  * }
2035
2928
  * ]
2036
2929
  * }
@@ -2042,7 +2935,7 @@ declare type QueryTableVariables = {
2042
2935
  * ```json
2043
2936
  * {
2044
2937
  * "filter": {
2045
- * "$notExists": "settings",
2938
+ * "$notExists": "settings"
2046
2939
  * }
2047
2940
  * }
2048
2941
  * ```
@@ -2069,43 +2962,59 @@ declare type QueryTableVariables = {
2069
2962
  * {
2070
2963
  * "filter": {
2071
2964
  * "<column_name>": {
2072
- * "$pattern": "v*alue*"
2965
+ * "$pattern": "v*alu?"
2073
2966
  * }
2074
2967
  * }
2075
2968
  * }
2076
2969
  * ```
2077
2970
  *
2971
+ * The `$pattern` operator accepts two wildcard characters:
2972
+ * * `*` matches zero or more characters
2973
+ * * `?` matches exactly one character
2974
+ *
2975
+ * If you want to match a string that contains a wildcard character, you can escape them using a backslash (`\`). You can escape a backslash by usign another backslash.
2976
+ *
2078
2977
  * We could also have `$endsWith` and `$startsWith` operators:
2079
2978
  *
2080
2979
  * ```json
2081
2980
  * {
2082
2981
  * "filter": {
2083
2982
  * "<column_name>": {
2084
- * "$endsWith": ".gz"
2983
+ * "$endsWith": ".gz"
2085
2984
  * },
2086
2985
  * "<column_name>": {
2087
- * "$startsWith": "tmp-"
2986
+ * "$startsWith": "tmp-"
2088
2987
  * }
2089
2988
  * }
2090
2989
  * }
2091
2990
  * ```
2092
2991
  *
2093
- * #### Numeric ranges
2992
+ * #### Numeric or datetime ranges
2094
2993
  *
2095
2994
  * ```json
2096
2995
  * {
2097
2996
  * "filter": {
2098
- * "<column_name>": {
2099
- * "$ge": 0,
2100
- * "$lt": 100
2101
- * }
2997
+ * "<column_name>": {
2998
+ * "$ge": 0,
2999
+ * "$lt": 100
3000
+ * }
3001
+ * }
3002
+ * }
3003
+ * ```
3004
+ * Date ranges support the same operators, with the date using the format defined in
3005
+ * [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339):
3006
+ * ```json
3007
+ * {
3008
+ * "filter": {
3009
+ * "<column_name>": {
3010
+ * "$gt": "2019-10-12T07:20:50.52Z",
3011
+ * "$lt": "2021-10-12T07:20:50.52Z"
3012
+ * }
2102
3013
  * }
2103
3014
  * }
2104
3015
  * ```
2105
- *
2106
3016
  * The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
2107
3017
  *
2108
- *
2109
3018
  * #### Negations
2110
3019
  *
2111
3020
  * A general `$not` operator can inverse any operation.
@@ -2130,15 +3039,21 @@ declare type QueryTableVariables = {
2130
3039
  * {
2131
3040
  * "filter": {
2132
3041
  * "$not": {
2133
- * "$any": [{
2134
- * "<column_name1>": "value1"
2135
- * }, {
2136
- * "$all": [{
2137
- * "<column_name2>": "value2"
2138
- * }, {
2139
- * "<column_name3>": "value3"
2140
- * }]
2141
- * }]
3042
+ * "$any": [
3043
+ * {
3044
+ * "<column_name1>": "value1"
3045
+ * },
3046
+ * {
3047
+ * "$all": [
3048
+ * {
3049
+ * "<column_name2>": "value2"
3050
+ * },
3051
+ * {
3052
+ * "<column_name3>": "value3"
3053
+ * }
3054
+ * ]
3055
+ * }
3056
+ * ]
2142
3057
  * }
2143
3058
  * }
2144
3059
  * }
@@ -2193,8 +3108,8 @@ declare type QueryTableVariables = {
2193
3108
  * "<array name>": {
2194
3109
  * "$includes": {
2195
3110
  * "$all": [
2196
- * {"$contains": "label"},
2197
- * {"$not": {"$endsWith": "-debug"}}
3111
+ * { "$contains": "label" },
3112
+ * { "$not": { "$endsWith": "-debug" } }
2198
3113
  * ]
2199
3114
  * }
2200
3115
  * }
@@ -2214,9 +3129,7 @@ declare type QueryTableVariables = {
2214
3129
  * {
2215
3130
  * "filter": {
2216
3131
  * "settings.labels": {
2217
- * "$includesAll": [
2218
- * {"$contains": "label"},
2219
- * ]
3132
+ * "$includesAll": [{ "$contains": "label" }]
2220
3133
  * }
2221
3134
  * }
2222
3135
  * }
@@ -2264,7 +3177,6 @@ declare type QueryTableVariables = {
2264
3177
  * }
2265
3178
  * ```
2266
3179
  *
2267
- *
2268
3180
  * ### Pagination
2269
3181
  *
2270
3182
  * We offer cursor pagination and offset pagination. The offset pagination is limited
@@ -2330,8 +3242,8 @@ declare type QueryTableVariables = {
2330
3242
  * can be queried by update `page.after` to the returned cursor while keeping the
2331
3243
  * `page.before` cursor from the first range query.
2332
3244
  *
2333
- * The `filter` , `columns`, `sort` , and `page.size` configuration will be
2334
- * encoded with the cursor. The pagination request will be invalid if
3245
+ * The `filter` , `columns`, `sort` , and `page.size` configuration will be
3246
+ * encoded with the cursor. The pagination request will be invalid if
2335
3247
  * `filter` or `sort` is set. The columns returned and page size can be changed
2336
3248
  * anytime by passing the `columns` or `page.size` settings to the next query.
2337
3249
  *
@@ -2368,6 +3280,41 @@ declare type QueryTableVariables = {
2368
3280
  * ```
2369
3281
  */
2370
3282
  declare const queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
3283
+ declare type SearchTablePathParams = {
3284
+ dbBranchName: DBBranchName;
3285
+ tableName: TableName;
3286
+ workspace: string;
3287
+ };
3288
+ declare type SearchTableError = ErrorWrapper<{
3289
+ status: 400;
3290
+ payload: BadRequestError;
3291
+ } | {
3292
+ status: 401;
3293
+ payload: AuthError;
3294
+ } | {
3295
+ status: 404;
3296
+ payload: SimpleError;
3297
+ }>;
3298
+ declare type SearchTableRequestBody = {
3299
+ query: string;
3300
+ fuzziness?: FuzzinessExpression;
3301
+ prefix?: PrefixExpression;
3302
+ filter?: FilterExpression;
3303
+ highlight?: HighlightExpression;
3304
+ boosters?: BoosterExpression[];
3305
+ };
3306
+ declare type SearchTableVariables = {
3307
+ body: SearchTableRequestBody;
3308
+ pathParams: SearchTablePathParams;
3309
+ } & FetcherExtraProps;
3310
+ /**
3311
+ * Run a free text search operation in a particular table.
3312
+ *
3313
+ * The endpoint accepts a `query` parameter that is used for the free text search and a set of structured filters (via the `filter` parameter) that are applied before the search. The `filter` parameter uses the same syntax as the [query endpoint](/api-reference/db/db_branch_name/tables/table_name/) with the following exceptions:
3314
+ * * filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of type `text`
3315
+ * * filtering on columns of type `multiple` is currently unsupported
3316
+ */
3317
+ declare const searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2371
3318
  declare type SearchBranchPathParams = {
2372
3319
  dbBranchName: DBBranchName;
2373
3320
  workspace: string;
@@ -2383,9 +3330,15 @@ declare type SearchBranchError = ErrorWrapper<{
2383
3330
  payload: SimpleError;
2384
3331
  }>;
2385
3332
  declare type SearchBranchRequestBody = {
2386
- tables?: string[];
3333
+ tables?: (string | {
3334
+ table: string;
3335
+ filter?: FilterExpression;
3336
+ boosters?: BoosterExpression[];
3337
+ })[];
2387
3338
  query: string;
2388
- fuzziness?: number;
3339
+ fuzziness?: FuzzinessExpression;
3340
+ prefix?: PrefixExpression;
3341
+ highlight?: HighlightExpression;
2389
3342
  };
2390
3343
  declare type SearchBranchVariables = {
2391
3344
  body: SearchBranchRequestBody;
@@ -2414,6 +3367,7 @@ declare const operationsByTag: {
2414
3367
  updateWorkspaceMemberRole: (variables: UpdateWorkspaceMemberRoleVariables) => Promise<undefined>;
2415
3368
  removeWorkspaceMember: (variables: RemoveWorkspaceMemberVariables) => Promise<undefined>;
2416
3369
  inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<WorkspaceInvite>;
3370
+ updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
2417
3371
  cancelWorkspaceMemberInvite: (variables: CancelWorkspaceMemberInviteVariables) => Promise<undefined>;
2418
3372
  resendWorkspaceMemberInvite: (variables: ResendWorkspaceMemberInviteVariables) => Promise<undefined>;
2419
3373
  acceptWorkspaceMemberInvite: (variables: AcceptWorkspaceMemberInviteVariables) => Promise<undefined>;
@@ -2422,21 +3376,45 @@ declare const operationsByTag: {
2422
3376
  getDatabaseList: (variables: GetDatabaseListVariables) => Promise<ListDatabasesResponse>;
2423
3377
  createDatabase: (variables: CreateDatabaseVariables) => Promise<CreateDatabaseResponse>;
2424
3378
  deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
3379
+ getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
3380
+ updateDatabaseMetadata: (variables: UpdateDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
3381
+ getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
3382
+ addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
3383
+ removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
3384
+ resolveBranch: (variables: ResolveBranchVariables) => Promise<ResolveBranchResponse>;
2425
3385
  };
2426
3386
  branch: {
2427
3387
  getBranchList: (variables: GetBranchListVariables) => Promise<ListBranchesResponse>;
2428
3388
  getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
2429
- createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
3389
+ createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
2430
3390
  deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
2431
3391
  updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
2432
3392
  getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
3393
+ getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
3394
+ };
3395
+ migrationRequests: {
3396
+ listMigrationRequests: (variables: ListMigrationRequestsVariables) => Promise<ListMigrationRequestsResponse>;
3397
+ createMigrationRequest: (variables: CreateMigrationRequestVariables) => Promise<CreateMigrationRequestResponse>;
3398
+ getMigrationRequest: (variables: GetMigrationRequestVariables) => Promise<MigrationRequest>;
3399
+ updateMigrationRequest: (variables: UpdateMigrationRequestVariables) => Promise<undefined>;
3400
+ listMigrationRequestsCommits: (variables: ListMigrationRequestsCommitsVariables) => Promise<ListMigrationRequestsCommitsResponse>;
3401
+ compareMigrationRequest: (variables: CompareMigrationRequestVariables) => Promise<SchemaCompareResponse>;
3402
+ getMigrationRequestIsMerged: (variables: GetMigrationRequestIsMergedVariables) => Promise<GetMigrationRequestIsMergedResponse>;
3403
+ mergeMigrationRequest: (variables: MergeMigrationRequestVariables) => Promise<Commit>;
3404
+ };
3405
+ branchSchema: {
2433
3406
  getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
2434
3407
  executeBranchMigrationPlan: (variables: ExecuteBranchMigrationPlanVariables) => Promise<undefined>;
2435
3408
  getBranchMigrationPlan: (variables: GetBranchMigrationPlanVariables) => Promise<BranchMigrationPlan>;
2436
- getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
3409
+ compareBranchWithUserSchema: (variables: CompareBranchWithUserSchemaVariables) => Promise<SchemaCompareResponse>;
3410
+ compareBranchSchemas: (variables: CompareBranchSchemasVariables) => Promise<SchemaCompareResponse>;
3411
+ updateBranchSchema: (variables: UpdateBranchSchemaVariables) => Promise<UpdateBranchSchemaResponse>;
3412
+ previewBranchSchemaEdit: (variables: PreviewBranchSchemaEditVariables) => Promise<PreviewBranchSchemaEditResponse>;
3413
+ applyBranchSchemaEdit: (variables: ApplyBranchSchemaEditVariables) => Promise<ApplyBranchSchemaEditResponse>;
3414
+ getBranchSchemaHistory: (variables: GetBranchSchemaHistoryVariables) => Promise<GetBranchSchemaHistoryResponse>;
2437
3415
  };
2438
3416
  table: {
2439
- createTable: (variables: CreateTableVariables) => Promise<undefined>;
3417
+ createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
2440
3418
  deleteTable: (variables: DeleteTableVariables) => Promise<undefined>;
2441
3419
  updateTable: (variables: UpdateTableVariables) => Promise<undefined>;
2442
3420
  getTableSchema: (variables: GetTableSchemaVariables) => Promise<GetTableSchemaResponse>;
@@ -2448,14 +3426,15 @@ declare const operationsByTag: {
2448
3426
  updateColumn: (variables: UpdateColumnVariables) => Promise<MigrationIdResponse>;
2449
3427
  };
2450
3428
  records: {
2451
- insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
3429
+ insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
2452
3430
  insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2453
3431
  updateRecordWithID: (variables: UpdateRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2454
3432
  upsertRecordWithID: (variables: UpsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2455
- deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
3433
+ deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
2456
3434
  getRecord: (variables: GetRecordVariables) => Promise<XataRecord$1>;
2457
- bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
3435
+ bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
2458
3436
  queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
3437
+ searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2459
3438
  searchBranch: (variables: SearchBranchVariables) => Promise<SearchResponse>;
2460
3439
  };
2461
3440
  };
@@ -2471,6 +3450,7 @@ interface XataApiClientOptions {
2471
3450
  fetch?: FetchImpl;
2472
3451
  apiKey?: string;
2473
3452
  host?: HostProvider;
3453
+ trace?: TraceFunction;
2474
3454
  }
2475
3455
  declare class XataApiClient {
2476
3456
  #private;
@@ -2481,6 +3461,8 @@ declare class XataApiClient {
2481
3461
  get branches(): BranchApi;
2482
3462
  get tables(): TableApi;
2483
3463
  get records(): RecordsApi;
3464
+ get migrationRequests(): MigrationRequestsApi;
3465
+ get branchSchema(): BranchSchemaApi;
2484
3466
  }
2485
3467
  declare class UserApi {
2486
3468
  private extraProps;
@@ -2504,6 +3486,7 @@ declare class WorkspaceApi {
2504
3486
  updateWorkspaceMemberRole(workspaceId: WorkspaceID, userId: UserID, role: Role): Promise<void>;
2505
3487
  removeWorkspaceMember(workspaceId: WorkspaceID, userId: UserID): Promise<void>;
2506
3488
  inviteWorkspaceMember(workspaceId: WorkspaceID, email: string, role: Role): Promise<WorkspaceInvite>;
3489
+ updateWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID, role: Role): Promise<WorkspaceInvite>;
2507
3490
  cancelWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2508
3491
  resendWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2509
3492
  acceptWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteKey: InviteKey): Promise<void>;
@@ -2514,25 +3497,28 @@ declare class DatabaseApi {
2514
3497
  getDatabaseList(workspace: WorkspaceID): Promise<ListDatabasesResponse>;
2515
3498
  createDatabase(workspace: WorkspaceID, dbName: DBName, options?: CreateDatabaseRequestBody): Promise<CreateDatabaseResponse>;
2516
3499
  deleteDatabase(workspace: WorkspaceID, dbName: DBName): Promise<void>;
3500
+ getDatabaseMetadata(workspace: WorkspaceID, dbName: DBName): Promise<DatabaseMetadata>;
3501
+ updateDatabaseMetadata(workspace: WorkspaceID, dbName: DBName, options?: UpdateDatabaseMetadataRequestBody): Promise<DatabaseMetadata>;
3502
+ getGitBranchesMapping(workspace: WorkspaceID, dbName: DBName): Promise<ListGitBranchesResponse>;
3503
+ addGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, body: AddGitBranchesEntryRequestBody): Promise<AddGitBranchesEntryResponse>;
3504
+ removeGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<void>;
3505
+ resolveBranch(workspace: WorkspaceID, dbName: DBName, gitBranch?: string, fallbackBranch?: string): Promise<ResolveBranchResponse>;
2517
3506
  }
2518
3507
  declare class BranchApi {
2519
3508
  private extraProps;
2520
3509
  constructor(extraProps: FetcherExtraProps);
2521
3510
  getBranchList(workspace: WorkspaceID, dbName: DBName): Promise<ListBranchesResponse>;
2522
3511
  getBranchDetails(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<DBBranch>;
2523
- createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<void>;
3512
+ createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<CreateBranchResponse>;
2524
3513
  deleteBranch(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<void>;
2525
3514
  updateBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName, metadata?: BranchMetadata): Promise<void>;
2526
3515
  getBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<BranchMetadata>;
2527
- getBranchMigrationHistory(workspace: WorkspaceID, database: DBName, branch: BranchName, options?: GetBranchMigrationHistoryRequestBody): Promise<GetBranchMigrationHistoryResponse>;
2528
- executeBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, migrationPlan: ExecuteBranchMigrationPlanRequestBody): Promise<void>;
2529
- getBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, schema: Schema): Promise<BranchMigrationPlan>;
2530
3516
  getBranchStats(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<GetBranchStatsResponse>;
2531
3517
  }
2532
3518
  declare class TableApi {
2533
3519
  private extraProps;
2534
3520
  constructor(extraProps: FetcherExtraProps);
2535
- createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
3521
+ createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<CreateTableResponse>;
2536
3522
  deleteTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
2537
3523
  updateTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, options: UpdateTableRequestBody): Promise<void>;
2538
3524
  getTableSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<GetTableSchemaResponse>;
@@ -2546,16 +3532,42 @@ declare class TableApi {
2546
3532
  declare class RecordsApi {
2547
3533
  private extraProps;
2548
3534
  constructor(extraProps: FetcherExtraProps);
2549
- insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>): Promise<InsertRecordResponse>;
3535
+ insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>, options?: InsertRecordQueryParams): Promise<RecordUpdateResponse>;
2550
3536
  insertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: InsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2551
3537
  updateRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpdateRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2552
3538
  upsertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2553
- deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID): Promise<void>;
2554
- getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordRequestBody): Promise<XataRecord$1>;
2555
- bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[]): Promise<BulkInsertTableRecordsResponse>;
3539
+ deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: DeleteRecordQueryParams): Promise<RecordUpdateResponse>;
3540
+ getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordQueryParams): Promise<XataRecord$1>;
3541
+ bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[], options?: BulkInsertTableRecordsQueryParams): Promise<BulkInsertResponse>;
2556
3542
  queryTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: QueryTableRequestBody): Promise<QueryResponse>;
3543
+ searchTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: SearchTableRequestBody): Promise<SearchResponse>;
2557
3544
  searchBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, query: SearchBranchRequestBody): Promise<SearchResponse>;
2558
3545
  }
3546
+ declare class MigrationRequestsApi {
3547
+ private extraProps;
3548
+ constructor(extraProps: FetcherExtraProps);
3549
+ listMigrationRequests(workspace: WorkspaceID, database: DBName, options?: ListMigrationRequestsRequestBody): Promise<ListMigrationRequestsResponse>;
3550
+ createMigrationRequest(workspace: WorkspaceID, database: DBName, options: CreateMigrationRequestRequestBody): Promise<CreateMigrationRequestResponse>;
3551
+ getMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<MigrationRequest>;
3552
+ updateMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number, options: UpdateMigrationRequestRequestBody): Promise<void>;
3553
+ listMigrationRequestsCommits(workspace: WorkspaceID, database: DBName, migrationRequest: number, options?: ListMigrationRequestsCommitsRequestBody): Promise<ListMigrationRequestsCommitsResponse>;
3554
+ compareMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<SchemaCompareResponse>;
3555
+ getMigrationRequestIsMerged(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<GetMigrationRequestIsMergedResponse>;
3556
+ mergeMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<Commit>;
3557
+ }
3558
+ declare class BranchSchemaApi {
3559
+ private extraProps;
3560
+ constructor(extraProps: FetcherExtraProps);
3561
+ getBranchMigrationHistory(workspace: WorkspaceID, database: DBName, branch: BranchName, options?: GetBranchMigrationHistoryRequestBody): Promise<GetBranchMigrationHistoryResponse>;
3562
+ executeBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, migrationPlan: ExecuteBranchMigrationPlanRequestBody): Promise<void>;
3563
+ getBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, schema: Schema): Promise<BranchMigrationPlan>;
3564
+ compareBranchWithUserSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, schema: Schema): Promise<SchemaCompareResponse>;
3565
+ compareBranchSchemas(workspace: WorkspaceID, database: DBName, branch: BranchName, branchName: BranchName, schema: Schema): Promise<SchemaCompareResponse>;
3566
+ updateBranchSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, migration: Migration): Promise<UpdateBranchSchemaResponse>;
3567
+ previewBranchSchemaEdit(workspace: WorkspaceID, database: DBName, branch: BranchName, migration: Migration): Promise<PreviewBranchSchemaEditResponse>;
3568
+ applyBranchSchemaEdit(workspace: WorkspaceID, database: DBName, branch: BranchName, edits: SchemaEditScript): Promise<ApplyBranchSchemaEditResponse>;
3569
+ getBranchSchemaHistory(workspace: WorkspaceID, database: DBName, branch: BranchName, options?: GetBranchSchemaHistoryRequestBody): Promise<GetBranchSchemaHistoryResponse>;
3570
+ }
2559
3571
 
2560
3572
  declare class XataApiPlugin implements XataPlugin {
2561
3573
  build(options: XataPluginOptions): Promise<XataApiClient>;
@@ -2567,28 +3579,29 @@ declare type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) ex
2567
3579
  declare type If<Condition, Then, Else> = Condition extends true ? Then : Else;
2568
3580
  declare type IsObject<T> = T extends Record<string, any> ? true : false;
2569
3581
  declare type IsArray<T> = T extends Array<any> ? true : false;
2570
- declare type NonEmptyArray<T> = T[] & {
2571
- 0: T;
2572
- };
2573
3582
  declare type RequiredBy<T, K extends keyof T> = T & {
2574
3583
  [P in K]-?: NonNullable<T[P]>;
2575
3584
  };
2576
3585
  declare type GetArrayInnerType<T extends readonly any[]> = T[number];
2577
3586
  declare type SingleOrArray<T> = T | T[];
2578
- declare type Dictionary<T> = Record<string, T>;
3587
+ declare type OmitBy<T, K extends keyof T> = T extends any ? Omit<T, K> : never;
3588
+ declare type Without<T, U> = {
3589
+ [P in Exclude<keyof T, keyof U>]?: never;
3590
+ };
3591
+ declare type ExclusiveOr<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
2579
3592
 
2580
3593
  declare type SelectableColumn<O, RecursivePath extends any[] = []> = '*' | 'id' | DataProps<O> | NestedColumns<O, RecursivePath>;
2581
- declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord & UnionToIntersection<Values<{
2582
- [K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord;
3594
+ declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord<O> & UnionToIntersection<Values<{
3595
+ [K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord<O>;
2583
3596
  }>>;
2584
- declare type ValueAtColumn<O, P extends SelectableColumn<O>> = P extends '*' ? Values<O> : P extends 'id' ? string : P extends keyof O ? O[P] : P extends `${infer K}.${infer V}` ? K extends keyof O ? Values<O[K] extends XataRecord ? (V extends SelectableColumn<O[K]> ? {
2585
- V: ValueAtColumn<O[K], V>;
2586
- } : never) : O[K]> : never : never;
3597
+ declare type ValueAtColumn<O, P extends SelectableColumn<O>> = P extends '*' ? Values<O> : P extends 'id' ? string : P extends keyof O ? O[P] : P extends `${infer K}.${infer V}` ? K extends keyof O ? Values<NonNullable<O[K]> extends infer Item ? Item extends Record<string, any> ? V extends SelectableColumn<Item> ? {
3598
+ V: ValueAtColumn<Item, V>;
3599
+ } : never : O[K] : never> : never : never;
2587
3600
  declare type MAX_RECURSION = 5;
2588
3601
  declare type NestedColumns<O, RecursivePath extends any[]> = RecursivePath['length'] extends MAX_RECURSION ? never : If<IsObject<O>, Values<{
2589
- [K in DataProps<O>]: If<IsArray<NonNullable<O[K]>>, K, // If the property is an array, we stop recursion. We don't support object arrays yet
2590
- If<IsObject<NonNullable<O[K]>>, NonNullable<O[K]> extends XataRecord ? SelectableColumn<NonNullable<O[K]>, [...RecursivePath, O[K]]> extends string ? K | `${K}.${SelectableColumn<NonNullable<O[K]>, [...RecursivePath, O[K]]>}` : never : `${K}.${StringKeys<NonNullable<O[K]>> | '*'}`, // This allows usage of objects that are not links
2591
- K>>;
3602
+ [K in DataProps<O>]: NonNullable<O[K]> extends infer Item ? If<IsArray<Item>, K, // If the property is an array, we stop recursion. We don't support object arrays yet
3603
+ If<IsObject<Item>, Item extends XataRecord ? SelectableColumn<Item, [...RecursivePath, Item]> extends infer Column ? Column extends string ? K | `${K}.${Column}` : never : never : Item extends Date ? K : `${K}.${StringKeys<Item> | '*'}`, // This allows usage of objects that are not links
3604
+ K>> : never;
2592
3605
  }>, never>;
2593
3606
  declare type DataProps<O> = Exclude<StringKeys<O>, StringKeys<XataRecord>>;
2594
3607
  declare type NestedValueAtColumn<O, Key extends SelectableColumn<O>> = Key extends `${infer N}.${infer M}` ? N extends DataProps<O> ? {
@@ -2615,56 +3628,85 @@ interface BaseData {
2615
3628
  /**
2616
3629
  * Represents a persisted record from the database.
2617
3630
  */
2618
- interface XataRecord extends Identifiable {
3631
+ interface XataRecord<OriginalRecord extends XataRecord<any> = XataRecord<any>> extends Identifiable {
2619
3632
  /**
2620
- * Metadata of this record.
3633
+ * Get metadata of this record.
2621
3634
  */
2622
- xata: {
2623
- /**
2624
- * Number that is increased every time the record is updated.
2625
- */
2626
- version: number;
2627
- };
3635
+ getMetadata(): XataRecordMetadata;
3636
+ /**
3637
+ * Retrieves a refreshed copy of the current record from the database.
3638
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3639
+ * @returns The persisted record with the selected columns, null if not found.
3640
+ */
3641
+ read<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
2628
3642
  /**
2629
3643
  * Retrieves a refreshed copy of the current record from the database.
3644
+ * @returns The persisted record with all first level properties, null if not found.
2630
3645
  */
2631
- read(): Promise<Readonly<SelectedPick<this, ['*']>> | null>;
3646
+ read(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2632
3647
  /**
2633
3648
  * Performs a partial update of the current record. On success a new object is
2634
3649
  * returned and the current object is not mutated.
2635
- * @param data The columns and their values that have to be updated.
2636
- * @returns A new record containing the latest values for all the columns of the current record.
3650
+ * @param partialUpdate The columns and their values that have to be updated.
3651
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3652
+ * @returns The persisted record with the selected columns, null if not found.
3653
+ */
3654
+ update<K extends SelectableColumn<OriginalRecord>>(partialUpdate: Partial<EditableData<OriginalRecord>>, columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
3655
+ /**
3656
+ * Performs a partial update of the current record. On success a new object is
3657
+ * returned and the current object is not mutated.
3658
+ * @param partialUpdate The columns and their values that have to be updated.
3659
+ * @returns The persisted record with all first level properties, null if not found.
2637
3660
  */
2638
- update(partialUpdate: Partial<EditableData<Omit<this, keyof XataRecord>>>): Promise<Readonly<SelectedPick<this, ['*']>>>;
3661
+ update(partialUpdate: Partial<EditableData<OriginalRecord>>): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2639
3662
  /**
2640
3663
  * Performs a deletion of the current record in the database.
2641
- *
2642
- * @throws If the record was already deleted or if an error happened while performing the deletion.
3664
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3665
+ * @returns The deleted record, null if not found.
2643
3666
  */
2644
- delete(): Promise<void>;
3667
+ delete<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
3668
+ /**
3669
+ * Performs a deletion of the current record in the database.
3670
+ * @returns The deleted record, null if not found.
3671
+
3672
+ */
3673
+ delete(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2645
3674
  }
2646
3675
  declare type Link<Record extends XataRecord> = Omit<XataRecord, 'read' | 'update'> & {
2647
3676
  /**
2648
3677
  * Retrieves a refreshed copy of the current record from the database.
2649
3678
  */
2650
- read(): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3679
+ read<K extends SelectableColumn<Record>>(columns?: K[]): Promise<Readonly<SelectedPick<Record, typeof columns extends SelectableColumn<Record>[] ? typeof columns : ['*']>> | null>;
2651
3680
  /**
2652
3681
  * Performs a partial update of the current record. On success a new object is
2653
3682
  * returned and the current object is not mutated.
2654
- * @param data The columns and their values that have to be updated.
3683
+ * @param partialUpdate The columns and their values that have to be updated.
2655
3684
  * @returns A new record containing the latest values for all the columns of the current record.
2656
3685
  */
2657
- update(partialUpdate: Partial<EditableData<Omit<Record, keyof XataRecord>>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3686
+ update<K extends SelectableColumn<Record>>(partialUpdate: Partial<EditableData<Record>>, columns?: K[]): Promise<Readonly<SelectedPick<Record, typeof columns extends SelectableColumn<Record>[] ? typeof columns : ['*']>>>;
3687
+ /**
3688
+ * Performs a deletion of the current record in the database.
3689
+ *
3690
+ * @throws If the record was already deleted or if an error happened while performing the deletion.
3691
+ */
3692
+ delete(): Promise<void>;
3693
+ };
3694
+ declare type XataRecordMetadata = {
3695
+ /**
3696
+ * Number that is increased every time the record is updated.
3697
+ */
3698
+ version: number;
3699
+ warnings?: string[];
2658
3700
  };
2659
3701
  declare function isIdentifiable(x: any): x is Identifiable & Record<string, unknown>;
2660
3702
  declare function isXataRecord(x: any): x is XataRecord & Record<string, unknown>;
2661
- declare type EditableData<O extends BaseData> = {
3703
+ declare type EditableData<O extends XataRecord> = Identifiable & Omit<{
2662
3704
  [K in keyof O]: O[K] extends XataRecord ? {
2663
3705
  id: string;
2664
- } : NonNullable<O[K]> extends XataRecord ? {
3706
+ } | string : NonNullable<O[K]> extends XataRecord ? {
2665
3707
  id: string;
2666
- } | null | undefined : O[K];
2667
- };
3708
+ } | string | null | undefined : O[K];
3709
+ }, keyof XataRecord>;
2668
3710
 
2669
3711
  /**
2670
3712
  * PropertyMatchFilter
@@ -2739,8 +3781,8 @@ declare type ValueTypeFilters<T> = T | T extends string ? StringTypeFilter : T e
2739
3781
  ],
2740
3782
  }
2741
3783
  */
2742
- declare type AggregatorFilter<Record> = {
2743
- [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<Record>>;
3784
+ declare type AggregatorFilter<T> = {
3785
+ [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<T>>;
2744
3786
  };
2745
3787
  /**
2746
3788
  * Existance filter
@@ -2749,16 +3791,94 @@ declare type AggregatorFilter<Record> = {
2749
3791
  declare type ExistanceFilter<Record> = {
2750
3792
  [key in '$exists' | '$notExists']?: SelectableColumn<Record>;
2751
3793
  };
2752
- declare type BaseApiFilter<Record> = PropertyAccessFilter<Record> | AggregatorFilter<Record> | ExistanceFilter<Record>;
2753
- /**
2754
- * Nested filter
2755
- * Injects the Api filters on nested properties
2756
- * Example: { filter: { settings: { plan: { $any: ['free', 'trial'] } } } }
2757
- */
2758
- declare type NestedApiFilter<T> = T extends Record<string, any> ? {
2759
- [key in keyof T]?: T[key] extends Record<string, any> ? SingleOrArray<Filter<T[key]>> : PropertyFilter<T[key]>;
2760
- } : PropertyFilter<T>;
2761
- declare type Filter<Record> = BaseApiFilter<Record> | NestedApiFilter<Record>;
3794
+ declare type BaseApiFilter<Record> = PropertyAccessFilter<Record> | AggregatorFilter<Record> | ExistanceFilter<Record>;
3795
+ /**
3796
+ * Nested filter
3797
+ * Injects the Api filters on nested properties
3798
+ * Example: { filter: { settings: { plan: { $any: ['free', 'trial'] } } } }
3799
+ */
3800
+ declare type NestedApiFilter<T> = {
3801
+ [key in keyof T]?: T[key] extends Record<string, any> ? SingleOrArray<Filter<T[key]>> : PropertyFilter<T[key]>;
3802
+ };
3803
+ declare type Filter<T> = T extends Record<string, any> ? T extends (infer ArrayType)[] ? ArrayType | ArrayType[] | ArrayFilter<ArrayType> | ArrayFilter<ArrayType[]> : T extends Date ? PropertyFilter<T> : BaseApiFilter<T> | NestedApiFilter<T> : PropertyFilter<T>;
3804
+
3805
+ declare type DateBooster = {
3806
+ origin?: string;
3807
+ scale: string;
3808
+ decay: number;
3809
+ };
3810
+ declare type NumericBooster = {
3811
+ factor: number;
3812
+ };
3813
+ declare type ValueBooster<T extends string | number | boolean> = {
3814
+ value: T;
3815
+ factor: number;
3816
+ };
3817
+ declare type Boosters<O extends XataRecord> = Values<{
3818
+ [K in SelectableColumn<O>]: NonNullable<ValueAtColumn<O, K>> extends Date ? {
3819
+ dateBooster: {
3820
+ column: K;
3821
+ } & DateBooster;
3822
+ } : NonNullable<ValueAtColumn<O, K>> extends number ? ExclusiveOr<{
3823
+ numericBooster?: {
3824
+ column: K;
3825
+ } & NumericBooster;
3826
+ }, {
3827
+ valueBooster?: {
3828
+ column: K;
3829
+ } & ValueBooster<number>;
3830
+ }> : NonNullable<ValueAtColumn<O, K>> extends string | boolean ? {
3831
+ valueBooster: {
3832
+ column: K;
3833
+ } & ValueBooster<NonNullable<ValueAtColumn<O, K>>>;
3834
+ } : never;
3835
+ }>;
3836
+
3837
+ declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3838
+ fuzziness?: FuzzinessExpression;
3839
+ prefix?: PrefixExpression;
3840
+ highlight?: HighlightExpression;
3841
+ tables?: Array<Tables | Values<{
3842
+ [Model in GetArrayInnerType<NonNullable<Tables[]>>]: {
3843
+ table: Model;
3844
+ filter?: Filter<SelectedPick<Schemas[Model] & XataRecord, ['*']>>;
3845
+ boosters?: Boosters<Schemas[Model] & XataRecord>[];
3846
+ };
3847
+ }>>;
3848
+ };
3849
+ declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3850
+ all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3851
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]: {
3852
+ table: Model;
3853
+ record: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>>;
3854
+ };
3855
+ }>[]>;
3856
+ byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3857
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]?: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>[]>;
3858
+ }>;
3859
+ };
3860
+ declare class SearchPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin {
3861
+ #private;
3862
+ private db;
3863
+ constructor(db: SchemaPluginResult<Schemas>, schemaTables?: Schemas.Table[]);
3864
+ build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
3865
+ }
3866
+ declare type SearchXataRecord<Record extends XataRecord> = Omit<Record, 'getMetadata'> & {
3867
+ getMetadata: () => XataRecordMetadata & SearchExtraProperties;
3868
+ };
3869
+ declare type SearchExtraProperties = {
3870
+ table: string;
3871
+ highlight?: {
3872
+ [key: string]: string[] | {
3873
+ [key: string]: any;
3874
+ };
3875
+ };
3876
+ score?: number;
3877
+ };
3878
+ declare type ReturnTable<Table, Tables> = Table extends Tables ? Table : never;
3879
+ declare type ExtractTables<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>, TableOptions extends GetArrayInnerType<NonNullable<NonNullable<SearchOptions<Schemas, Tables>>['tables']>>> = TableOptions extends `${infer Table}` ? ReturnTable<Table, Tables> : TableOptions extends {
3880
+ table: infer Table;
3881
+ } ? ReturnTable<Table, Tables> : never;
2762
3882
 
2763
3883
  declare type SortDirection = 'asc' | 'desc';
2764
3884
  declare type SortFilterExtended<T extends XataRecord> = {
@@ -2770,12 +3890,21 @@ declare type SortFilterBase<T extends XataRecord> = {
2770
3890
  [Key in StringKeys<T>]: SortDirection;
2771
3891
  };
2772
3892
 
2773
- declare type QueryOptions<T extends XataRecord> = {
2774
- page?: PaginationOptions;
2775
- columns?: NonEmptyArray<SelectableColumn<T>>;
3893
+ declare type BaseOptions<T extends XataRecord> = {
3894
+ columns?: SelectableColumn<T>[];
3895
+ cache?: number;
3896
+ };
3897
+ declare type CursorQueryOptions = {
3898
+ pagination?: CursorNavigationOptions & OffsetNavigationOptions;
3899
+ filter?: never;
3900
+ sort?: never;
3901
+ };
3902
+ declare type OffsetQueryOptions<T extends XataRecord> = {
3903
+ pagination?: OffsetNavigationOptions;
2776
3904
  filter?: FilterExpression;
2777
3905
  sort?: SortFilter<T> | SortFilter<T>[];
2778
3906
  };
3907
+ declare type QueryOptions<T extends XataRecord> = BaseOptions<T> & (CursorQueryOptions | OffsetQueryOptions<T>);
2779
3908
  /**
2780
3909
  * Query objects contain the information of all filters, sorting, etc. to be included in the database query.
2781
3910
  *
@@ -2785,9 +3914,13 @@ declare type QueryOptions<T extends XataRecord> = {
2785
3914
  declare class Query<Record extends XataRecord, Result extends XataRecord = Record> implements Paginable<Record, Result> {
2786
3915
  #private;
2787
3916
  readonly meta: PaginationQueryMeta;
2788
- readonly records: Result[];
2789
- constructor(repository: Repository<Record> | null, table: string, data: Partial<QueryOptions<Record>>, parent?: Partial<QueryOptions<Record>>);
3917
+ readonly records: RecordArray<Result>;
3918
+ constructor(repository: Repository<Record> | null, table: {
3919
+ name: string;
3920
+ schema?: Table;
3921
+ }, data: Partial<QueryOptions<Record>>, rawParent?: Partial<QueryOptions<Record>>);
2790
3922
  getQueryOptions(): QueryOptions<Record>;
3923
+ key(): string;
2791
3924
  /**
2792
3925
  * Builds a new query object representing a logical OR between the given subqueries.
2793
3926
  * @param queries An array of subqueries.
@@ -2817,67 +3950,186 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
2817
3950
  *
2818
3951
  * ```
2819
3952
  * query.filter("columnName", columnValue)
2820
- * query.filter({
2821
- * "columnName": columnValue
2822
- * })
3953
+ * query.filter("columnName", operator(columnValue)) // Use gt, gte, lt, lte, startsWith,...
3954
+ * ```
3955
+ *
3956
+ * @param column The name of the column to filter.
3957
+ * @param value The value to filter.
3958
+ * @returns A new Query object.
3959
+ */
3960
+ filter<F extends SelectableColumn<Record>>(column: F, value: Filter<NonNullable<ValueAtColumn<Record, F>>>): Query<Record, Result>;
3961
+ /**
3962
+ * Builds a new query object adding one or more constraints. Examples:
3963
+ *
3964
+ * ```
3965
+ * query.filter({ "columnName": columnValue })
2823
3966
  * query.filter({
2824
3967
  * "columnName": operator(columnValue) // Use gt, gte, lt, lte, startsWith,...
2825
3968
  * })
2826
3969
  * ```
2827
3970
  *
3971
+ * @param filters A filter object
2828
3972
  * @returns A new Query object.
2829
3973
  */
2830
- filter(filters: Filter<Record>): Query<Record, Result>;
2831
- filter<F extends SelectableColumn<Record>>(column: F, value: Filter<ValueAtColumn<Record, F>>): Query<Record, Result>;
3974
+ filter(filters?: Filter<Record>): Query<Record, Result>;
3975
+ defaultFilter<T>(column: string, value: T): T | {
3976
+ $includes: (T & string) | (T & string[]);
3977
+ };
2832
3978
  /**
2833
3979
  * Builds a new query with a new sort option.
2834
3980
  * @param column The column name.
2835
3981
  * @param direction The direction. Either ascending or descending.
2836
3982
  * @returns A new Query object.
2837
3983
  */
2838
- sort<F extends SelectableColumn<Record>>(column: F, direction: SortDirection): Query<Record, Result>;
3984
+ sort<F extends SelectableColumn<Record>>(column: F, direction?: SortDirection): Query<Record, Result>;
2839
3985
  /**
2840
3986
  * Builds a new query specifying the set of columns to be returned in the query response.
2841
3987
  * @param columns Array of column names to be returned by the query.
2842
3988
  * @returns A new Query object.
2843
3989
  */
2844
- select<K extends SelectableColumn<Record>>(columns: NonEmptyArray<K>): Query<Record, SelectedPick<Record, NonEmptyArray<K>>>;
3990
+ select<K extends SelectableColumn<Record>>(columns: K[]): Query<Record, SelectedPick<Record, K[]>>;
3991
+ /**
3992
+ * Get paginated results
3993
+ *
3994
+ * @returns A page of results
3995
+ */
2845
3996
  getPaginated(): Promise<Page<Record, Result>>;
2846
- getPaginated(options: Omit<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
3997
+ /**
3998
+ * Get paginated results
3999
+ *
4000
+ * @param options Pagination options
4001
+ * @returns A page of results
4002
+ */
4003
+ getPaginated(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
4004
+ /**
4005
+ * Get paginated results
4006
+ *
4007
+ * @param options Pagination options
4008
+ * @returns A page of results
4009
+ */
2847
4010
  getPaginated<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<Page<Record, SelectedPick<Record, typeof options['columns']>>>;
4011
+ /**
4012
+ * Get results in an iterator
4013
+ *
4014
+ * @async
4015
+ * @returns Async interable of results
4016
+ */
2848
4017
  [Symbol.asyncIterator](): AsyncIterableIterator<Result>;
2849
- getIterator(chunk: number): AsyncGenerator<Result[]>;
2850
- getIterator(chunk: number, options: Omit<QueryOptions<Record>, 'columns' | 'page'>): AsyncGenerator<Result[]>;
2851
- getIterator<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(chunk: number, options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
4018
+ /**
4019
+ * Build an iterator of results
4020
+ *
4021
+ * @returns Async generator of results array
4022
+ */
4023
+ getIterator(): AsyncGenerator<Result[]>;
4024
+ /**
4025
+ * Build an iterator of results
4026
+ *
4027
+ * @param options Pagination options with batchSize
4028
+ * @returns Async generator of results array
4029
+ */
4030
+ getIterator(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
4031
+ batchSize?: number;
4032
+ }): AsyncGenerator<Result[]>;
4033
+ /**
4034
+ * Build an iterator of results
4035
+ *
4036
+ * @param options Pagination options with batchSize
4037
+ * @returns Async generator of results array
4038
+ */
4039
+ getIterator<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
4040
+ batchSize?: number;
4041
+ }>(options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
4042
+ /**
4043
+ * Performs the query in the database and returns a set of results.
4044
+ * @returns An array of records from the database.
4045
+ */
4046
+ getMany(): Promise<RecordArray<Result>>;
4047
+ /**
4048
+ * Performs the query in the database and returns a set of results.
4049
+ * @param options Additional options to be used when performing the query.
4050
+ * @returns An array of records from the database.
4051
+ */
4052
+ getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<RecordArray<SelectedPick<Record, typeof options['columns']>>>;
2852
4053
  /**
2853
4054
  * Performs the query in the database and returns a set of results.
2854
4055
  * @param options Additional options to be used when performing the query.
2855
4056
  * @returns An array of records from the database.
2856
4057
  */
2857
- getMany(): Promise<Result[]>;
2858
- getMany(options: Omit<QueryOptions<Record>, 'columns'>): Promise<Result[]>;
2859
- getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
4058
+ getMany(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<RecordArray<Result>>;
4059
+ /**
4060
+ * Performs the query in the database and returns all the results.
4061
+ * Warning: If there are a large number of results, this method can have performance implications.
4062
+ * @returns An array of records from the database.
4063
+ */
4064
+ getAll(): Promise<Result[]>;
4065
+ /**
4066
+ * Performs the query in the database and returns all the results.
4067
+ * Warning: If there are a large number of results, this method can have performance implications.
4068
+ * @param options Additional options to be used when performing the query.
4069
+ * @returns An array of records from the database.
4070
+ */
4071
+ getAll<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
4072
+ batchSize?: number;
4073
+ }>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
2860
4074
  /**
2861
4075
  * Performs the query in the database and returns all the results.
2862
4076
  * Warning: If there are a large number of results, this method can have performance implications.
2863
4077
  * @param options Additional options to be used when performing the query.
2864
4078
  * @returns An array of records from the database.
2865
4079
  */
2866
- getAll(chunk?: number): Promise<Result[]>;
2867
- getAll(chunk: number | undefined, options: Omit<QueryOptions<Record>, 'columns' | 'page'>): Promise<Result[]>;
2868
- getAll<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(chunk: number | undefined, options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
4080
+ getAll(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
4081
+ batchSize?: number;
4082
+ }): Promise<Result[]>;
4083
+ /**
4084
+ * Performs the query in the database and returns the first result.
4085
+ * @returns The first record that matches the query, or null if no record matched the query.
4086
+ */
4087
+ getFirst(): Promise<Result | null>;
4088
+ /**
4089
+ * Performs the query in the database and returns the first result.
4090
+ * @param options Additional options to be used when performing the query.
4091
+ * @returns The first record that matches the query, or null if no record matched the query.
4092
+ */
4093
+ getFirst<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
2869
4094
  /**
2870
4095
  * Performs the query in the database and returns the first result.
2871
4096
  * @param options Additional options to be used when performing the query.
2872
4097
  * @returns The first record that matches the query, or null if no record matched the query.
2873
4098
  */
2874
- getOne(): Promise<Result | null>;
2875
- getOne(options: Omit<QueryOptions<Record>, 'columns' | 'page'>): Promise<Result | null>;
2876
- getOne<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
4099
+ getFirst(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result | null>;
4100
+ /**
4101
+ * Builds a new query object adding a cache TTL in milliseconds.
4102
+ * @param ttl The cache TTL in milliseconds.
4103
+ * @returns A new Query object.
4104
+ */
4105
+ cache(ttl: number): Query<Record, Result>;
4106
+ /**
4107
+ * Retrieve next page of records
4108
+ *
4109
+ * @returns A new page object.
4110
+ */
2877
4111
  nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4112
+ /**
4113
+ * Retrieve previous page of records
4114
+ *
4115
+ * @returns A new page object
4116
+ */
2878
4117
  previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4118
+ /**
4119
+ * Retrieve first page of records
4120
+ *
4121
+ * @returns A new page object
4122
+ */
2879
4123
  firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4124
+ /**
4125
+ * Retrieve last page of records
4126
+ *
4127
+ * @returns A new page object
4128
+ */
2880
4129
  lastPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4130
+ /**
4131
+ * @returns Boolean indicating if there is a next page
4132
+ */
2881
4133
  hasNextPage(): boolean;
2882
4134
  }
2883
4135
 
@@ -2889,7 +4141,7 @@ declare type PaginationQueryMeta = {
2889
4141
  };
2890
4142
  interface Paginable<Record extends XataRecord, Result extends XataRecord = Record> {
2891
4143
  meta: PaginationQueryMeta;
2892
- records: Result[];
4144
+ records: RecordArray<Result>;
2893
4145
  nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
2894
4146
  previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
2895
4147
  firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
@@ -2909,7 +4161,7 @@ declare class Page<Record extends XataRecord, Result extends XataRecord = Record
2909
4161
  /**
2910
4162
  * The set of results for this page.
2911
4163
  */
2912
- readonly records: Result[];
4164
+ readonly records: RecordArray<Result>;
2913
4165
  constructor(query: Query<Record, Result>, meta: PaginationQueryMeta, records?: Result[]);
2914
4166
  /**
2915
4167
  * Retrieves the next page of results.
@@ -2957,64 +4209,198 @@ declare type OffsetNavigationOptions = {
2957
4209
  size?: number;
2958
4210
  offset?: number;
2959
4211
  };
2960
- declare type PaginationOptions = CursorNavigationOptions & OffsetNavigationOptions;
2961
4212
  declare const PAGINATION_MAX_SIZE = 200;
2962
- declare const PAGINATION_DEFAULT_SIZE = 200;
4213
+ declare const PAGINATION_DEFAULT_SIZE = 20;
2963
4214
  declare const PAGINATION_MAX_OFFSET = 800;
2964
4215
  declare const PAGINATION_DEFAULT_OFFSET = 0;
4216
+ declare function isCursorPaginationOptions(options: Record<string, unknown> | undefined | null): options is CursorNavigationOptions;
4217
+ declare class RecordArray<Result extends XataRecord> extends Array<Result> {
4218
+ #private;
4219
+ constructor(page: Paginable<any, Result>, overrideRecords?: Result[]);
4220
+ static parseConstructorParams(...args: any[]): any[];
4221
+ toArray(): Result[];
4222
+ map<U>(callbackfn: (value: Result, index: number, array: Result[]) => U, thisArg?: any): U[];
4223
+ /**
4224
+ * Retrieve next page of records
4225
+ *
4226
+ * @returns A new array of objects
4227
+ */
4228
+ nextPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4229
+ /**
4230
+ * Retrieve previous page of records
4231
+ *
4232
+ * @returns A new array of objects
4233
+ */
4234
+ previousPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4235
+ /**
4236
+ * Retrieve first page of records
4237
+ *
4238
+ * @returns A new array of objects
4239
+ */
4240
+ firstPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4241
+ /**
4242
+ * Retrieve last page of records
4243
+ *
4244
+ * @returns A new array of objects
4245
+ */
4246
+ lastPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4247
+ /**
4248
+ * @returns Boolean indicating if there is a next page
4249
+ */
4250
+ hasNextPage(): boolean;
4251
+ }
2965
4252
 
2966
- declare type TableLink = string[];
2967
- declare type LinkDictionary = Dictionary<TableLink[]>;
2968
4253
  /**
2969
4254
  * Common interface for performing operations on a table.
2970
4255
  */
2971
- declare abstract class Repository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
2972
- abstract create(object: EditableData<Data> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4256
+ declare abstract class Repository<Record extends XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
4257
+ abstract create<K extends SelectableColumn<Record>>(object: Omit<EditableData<Record>, 'id'> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4258
+ abstract create(object: Omit<EditableData<Record>, 'id'> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4259
+ /**
4260
+ * Creates a single record in the table with a unique id.
4261
+ * @param id The unique id.
4262
+ * @param object Object containing the column names with their values to be stored in the table.
4263
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4264
+ * @returns The full persisted record.
4265
+ */
4266
+ abstract create<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
2973
4267
  /**
2974
4268
  * Creates a single record in the table with a unique id.
2975
4269
  * @param id The unique id.
2976
4270
  * @param object Object containing the column names with their values to be stored in the table.
2977
4271
  * @returns The full persisted record.
2978
4272
  */
2979
- abstract create(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4273
+ abstract create(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
2980
4274
  /**
2981
4275
  * Creates multiple records in the table.
2982
4276
  * @param objects Array of objects with the column names and the values to be stored in the table.
2983
- * @returns Array of the persisted records.
4277
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4278
+ * @returns Array of the persisted records in order.
4279
+ */
4280
+ abstract create<K extends SelectableColumn<Record>>(objects: Array<Omit<EditableData<Record>, 'id'> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4281
+ /**
4282
+ * Creates multiple records in the table.
4283
+ * @param objects Array of objects with the column names and the values to be stored in the table.
4284
+ * @returns Array of the persisted records in order.
2984
4285
  */
2985
- abstract create(objects: Array<EditableData<Data> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4286
+ abstract create(objects: Array<Omit<EditableData<Record>, 'id'> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4287
+ /**
4288
+ * Queries a single record from the table given its unique id.
4289
+ * @param id The unique id.
4290
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4291
+ * @returns The persisted record for the given id or null if the record could not be found.
4292
+ */
4293
+ abstract read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
2986
4294
  /**
2987
4295
  * Queries a single record from the table given its unique id.
2988
4296
  * @param id The unique id.
2989
4297
  * @returns The persisted record for the given id or null if the record could not be found.
2990
4298
  */
2991
4299
  abstract read(id: string): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4300
+ /**
4301
+ * Queries multiple records from the table given their unique id.
4302
+ * @param ids The unique ids array.
4303
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4304
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4305
+ */
4306
+ abstract read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4307
+ /**
4308
+ * Queries multiple records from the table given their unique id.
4309
+ * @param ids The unique ids array.
4310
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4311
+ */
4312
+ abstract read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4313
+ /**
4314
+ * Queries a single record from the table by the id in the object.
4315
+ * @param object Object containing the id of the record.
4316
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4317
+ * @returns The persisted record for the given id or null if the record could not be found.
4318
+ */
4319
+ abstract read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
4320
+ /**
4321
+ * Queries a single record from the table by the id in the object.
4322
+ * @param object Object containing the id of the record.
4323
+ * @returns The persisted record for the given id or null if the record could not be found.
4324
+ */
4325
+ abstract read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4326
+ /**
4327
+ * Queries multiple records from the table by the ids in the objects.
4328
+ * @param objects Array of objects containing the ids of the records.
4329
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4330
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4331
+ */
4332
+ abstract read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4333
+ /**
4334
+ * Queries multiple records from the table by the ids in the objects.
4335
+ * @param objects Array of objects containing the ids of the records.
4336
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4337
+ */
4338
+ abstract read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
2992
4339
  /**
2993
4340
  * Partially update a single record.
2994
4341
  * @param object An object with its id and the columns to be updated.
2995
- * @returns The full persisted record.
4342
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4343
+ * @returns The full persisted record, null if the record could not be found.
4344
+ */
4345
+ abstract update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4346
+ /**
4347
+ * Partially update a single record.
4348
+ * @param object An object with its id and the columns to be updated.
4349
+ * @returns The full persisted record, null if the record could not be found.
2996
4350
  */
2997
- abstract update(object: Partial<EditableData<Data>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4351
+ abstract update(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
2998
4352
  /**
2999
4353
  * Partially update a single record given its unique id.
3000
4354
  * @param id The unique id.
3001
4355
  * @param object The column names and their values that have to be updated.
3002
- * @returns The full persisted record.
4356
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4357
+ * @returns The full persisted record, null if the record could not be found.
4358
+ */
4359
+ abstract update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4360
+ /**
4361
+ * Partially update a single record given its unique id.
4362
+ * @param id The unique id.
4363
+ * @param object The column names and their values that have to be updated.
4364
+ * @returns The full persisted record, null if the record could not be found.
3003
4365
  */
3004
- abstract update(id: string, object: Partial<EditableData<Data>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4366
+ abstract update(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3005
4367
  /**
3006
4368
  * Partially updates multiple records.
3007
4369
  * @param objects An array of objects with their ids and columns to be updated.
3008
- * @returns Array of the persisted records.
4370
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4371
+ * @returns Array of the persisted records in order (if a record could not be found null is returned).
4372
+ */
4373
+ abstract update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4374
+ /**
4375
+ * Partially updates multiple records.
4376
+ * @param objects An array of objects with their ids and columns to be updated.
4377
+ * @returns Array of the persisted records in order (if a record could not be found null is returned).
4378
+ */
4379
+ abstract update(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4380
+ /**
4381
+ * Creates or updates a single record. If a record exists with the given id,
4382
+ * it will be update, otherwise a new record will be created.
4383
+ * @param object Object containing the column names with their values to be persisted in the table.
4384
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4385
+ * @returns The full persisted record.
3009
4386
  */
3010
- abstract update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4387
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Record> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3011
4388
  /**
3012
4389
  * Creates or updates a single record. If a record exists with the given id,
3013
4390
  * it will be update, otherwise a new record will be created.
3014
4391
  * @param object Object containing the column names with their values to be persisted in the table.
3015
4392
  * @returns The full persisted record.
3016
4393
  */
3017
- abstract createOrUpdate(object: EditableData<Data> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4394
+ abstract createOrUpdate(object: EditableData<Record> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4395
+ /**
4396
+ * Creates or updates a single record. If a record exists with the given id,
4397
+ * it will be update, otherwise a new record will be created.
4398
+ * @param id A unique id.
4399
+ * @param object The column names and the values to be persisted.
4400
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4401
+ * @returns The full persisted record.
4402
+ */
4403
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3018
4404
  /**
3019
4405
  * Creates or updates a single record. If a record exists with the given id,
3020
4406
  * it will be update, otherwise a new record will be created.
@@ -3022,38 +4408,74 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3022
4408
  * @param object The column names and the values to be persisted.
3023
4409
  * @returns The full persisted record.
3024
4410
  */
3025
- abstract createOrUpdate(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4411
+ abstract createOrUpdate(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3026
4412
  /**
3027
4413
  * Creates or updates a single record. If a record exists with the given id,
3028
4414
  * it will be update, otherwise a new record will be created.
3029
4415
  * @param objects Array of objects with the column names and the values to be stored in the table.
4416
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3030
4417
  * @returns Array of the persisted records.
3031
4418
  */
3032
- abstract createOrUpdate(objects: Array<EditableData<Data> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4419
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4420
+ /**
4421
+ * Creates or updates a single record. If a record exists with the given id,
4422
+ * it will be update, otherwise a new record will be created.
4423
+ * @param objects Array of objects with the column names and the values to be stored in the table.
4424
+ * @returns Array of the persisted records.
4425
+ */
4426
+ abstract createOrUpdate(objects: Array<EditableData<Record> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3033
4427
  /**
3034
4428
  * Deletes a record given its unique id.
3035
- * @param id The unique id.
3036
- * @throws If the record could not be found or there was an error while performing the deletion.
4429
+ * @param object An object with a unique id.
4430
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4431
+ * @returns The deleted record, null if the record could not be found.
3037
4432
  */
3038
- abstract delete(id: string): Promise<void>;
4433
+ abstract delete<K extends SelectableColumn<Record>>(object: Identifiable & Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3039
4434
  /**
3040
4435
  * Deletes a record given its unique id.
3041
- * @param id An object with a unique id.
3042
- * @throws If the record could not be found or there was an error while performing the deletion.
4436
+ * @param object An object with a unique id.
4437
+ * @returns The deleted record, null if the record could not be found.
4438
+ */
4439
+ abstract delete(object: Identifiable & Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4440
+ /**
4441
+ * Deletes a record given a unique id.
4442
+ * @param id The unique id.
4443
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4444
+ * @returns The deleted record, null if the record could not be found.
4445
+ */
4446
+ abstract delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4447
+ /**
4448
+ * Deletes a record given a unique id.
4449
+ * @param id The unique id.
4450
+ * @returns The deleted record, null if the record could not be found.
4451
+ */
4452
+ abstract delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4453
+ /**
4454
+ * Deletes multiple records given an array of objects with ids.
4455
+ * @param objects An array of objects with unique ids.
4456
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4457
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4458
+ */
4459
+ abstract delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4460
+ /**
4461
+ * Deletes multiple records given an array of objects with ids.
4462
+ * @param objects An array of objects with unique ids.
4463
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
3043
4464
  */
3044
- abstract delete(id: Identifiable): Promise<void>;
4465
+ abstract delete(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3045
4466
  /**
3046
- * Deletes a record given a list of unique ids.
3047
- * @param ids The array of unique ids.
3048
- * @throws If the record could not be found or there was an error while performing the deletion.
4467
+ * Deletes multiple records given an array of unique ids.
4468
+ * @param objects An array of ids.
4469
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4470
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
3049
4471
  */
3050
- abstract delete(ids: string[]): Promise<void>;
4472
+ abstract delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3051
4473
  /**
3052
- * Deletes a record given a list of unique ids.
3053
- * @param ids An array of objects with unique ids.
3054
- * @throws If the record could not be found or there was an error while performing the deletion.
4474
+ * Deletes multiple records given an array of unique ids.
4475
+ * @param objects An array of ids.
4476
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
3055
4477
  */
3056
- abstract delete(ids: Identifiable[]): Promise<void>;
4478
+ abstract delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3057
4479
  /**
3058
4480
  * Search for records in the table.
3059
4481
  * @param query The query to search for.
@@ -3061,36 +4483,130 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3061
4483
  * @returns The found records.
3062
4484
  */
3063
4485
  abstract search(query: string, options?: {
3064
- fuzziness?: number;
3065
- }): Promise<SelectedPick<Record, ['*']>[]>;
4486
+ fuzziness?: FuzzinessExpression;
4487
+ prefix?: PrefixExpression;
4488
+ highlight?: HighlightExpression;
4489
+ filter?: Filter<Record>;
4490
+ boosters?: Boosters<Record>[];
4491
+ }): Promise<SearchXataRecord<SelectedPick<Record, ['*']>>[]>;
3066
4492
  abstract query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3067
4493
  }
3068
- declare class RestRepository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Data, Record> {
4494
+ declare class RestRepository<Record extends XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Record> {
3069
4495
  #private;
3070
- db: SchemaPluginResult<any>;
3071
4496
  constructor(options: {
3072
4497
  table: string;
3073
- links?: LinkDictionary;
3074
- getFetchProps: () => Promise<FetcherExtraProps>;
3075
4498
  db: SchemaPluginResult<any>;
4499
+ pluginOptions: XataPluginOptions;
4500
+ schemaTables?: Table[];
3076
4501
  });
3077
- create(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3078
- create(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3079
- create(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3080
- read(recordId: string): Promise<SelectedPick<Record, ['*']> | null>;
3081
- update(object: Partial<EditableData<Data>> & Identifiable): Promise<SelectedPick<Record, ['*']>>;
3082
- update(recordId: string, object: Partial<EditableData<Data>>): Promise<SelectedPick<Record, ['*']>>;
3083
- update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<SelectedPick<Record, ['*']>[]>;
3084
- createOrUpdate(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3085
- createOrUpdate(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3086
- createOrUpdate(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3087
- delete(recordId: string | Identifiable | Array<string | Identifiable>): Promise<void>;
4502
+ create<K extends SelectableColumn<Record>>(object: EditableData<Record> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4503
+ create(object: EditableData<Record> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4504
+ create<K extends SelectableColumn<Record>>(id: string, object: EditableData<Record>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4505
+ create(id: string, object: EditableData<Record>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4506
+ create<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4507
+ create(objects: Array<EditableData<Record> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4508
+ read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
4509
+ read(id: string): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4510
+ read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4511
+ read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4512
+ read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
4513
+ read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4514
+ read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4515
+ read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4516
+ update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4517
+ update(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4518
+ update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4519
+ update(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4520
+ update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4521
+ update(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4522
+ createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Record> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4523
+ createOrUpdate(object: EditableData<Record> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4524
+ createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4525
+ createOrUpdate(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4526
+ createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4527
+ createOrUpdate(objects: Array<EditableData<Record> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4528
+ delete<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4529
+ delete(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4530
+ delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4531
+ delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4532
+ delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4533
+ delete(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4534
+ delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4535
+ delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3088
4536
  search(query: string, options?: {
3089
- fuzziness?: number;
3090
- }): Promise<SelectedPick<Record, ['*']>[]>;
4537
+ fuzziness?: FuzzinessExpression;
4538
+ prefix?: PrefixExpression;
4539
+ highlight?: HighlightExpression;
4540
+ filter?: Filter<Record>;
4541
+ boosters?: Boosters<Record>[];
4542
+ }): Promise<any>;
3091
4543
  query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3092
4544
  }
3093
4545
 
4546
+ declare type BaseSchema = {
4547
+ name: string;
4548
+ columns: readonly ({
4549
+ name: string;
4550
+ type: Column['type'];
4551
+ notNull?: boolean;
4552
+ } | {
4553
+ name: string;
4554
+ type: 'link';
4555
+ link: {
4556
+ table: string;
4557
+ };
4558
+ } | {
4559
+ name: string;
4560
+ type: 'object';
4561
+ columns: {
4562
+ name: string;
4563
+ type: string;
4564
+ }[];
4565
+ })[];
4566
+ };
4567
+ declare type SchemaInference<T extends readonly BaseSchema[]> = T extends never[] ? Record<string, Record<string, any>> : T extends readonly unknown[] ? T[number] extends {
4568
+ name: string;
4569
+ columns: readonly unknown[];
4570
+ } ? {
4571
+ [K in T[number]['name']]: TableType<T[number], K>;
4572
+ } : never : never;
4573
+ declare type TableType<Tables, TableName> = Tables & {
4574
+ name: TableName;
4575
+ } extends infer Table ? Table extends {
4576
+ name: string;
4577
+ columns: infer Columns;
4578
+ } ? Columns extends readonly unknown[] ? Columns[number] extends {
4579
+ name: string;
4580
+ type: string;
4581
+ } ? Identifiable & UnionToIntersection<Values<{
4582
+ [K in Columns[number]['name']]: PropertyType<Tables, Columns[number], K>;
4583
+ }>> : never : never : never : never;
4584
+ declare type PropertyType<Tables, Properties, PropertyName extends PropertyKey> = Properties & {
4585
+ name: PropertyName;
4586
+ } extends infer Property ? Property extends {
4587
+ name: string;
4588
+ type: infer Type;
4589
+ link?: {
4590
+ table: infer LinkedTable;
4591
+ };
4592
+ columns?: infer ObjectColumns;
4593
+ notNull?: infer NotNull;
4594
+ } ? NotNull extends true ? {
4595
+ [K in PropertyName]: InnerType<Type, ObjectColumns, Tables, LinkedTable>;
4596
+ } : {
4597
+ [K in PropertyName]?: InnerType<Type, ObjectColumns, Tables, LinkedTable> | null;
4598
+ } : never : never;
4599
+ declare type InnerType<Type, ObjectColumns, Tables, LinkedTable> = Type extends 'string' | 'text' | 'email' ? string : Type extends 'int' | 'float' ? number : Type extends 'bool' ? boolean : Type extends 'datetime' ? Date : Type extends 'multiple' ? string[] : Type extends 'object' ? ObjectColumns extends readonly unknown[] ? ObjectColumns[number] extends {
4600
+ name: string;
4601
+ type: string;
4602
+ } ? UnionToIntersection<Values<{
4603
+ [K in ObjectColumns[number]['name']]: PropertyType<Tables, ObjectColumns[number], K>;
4604
+ }>> : never : never : Type extends 'link' ? TableType<Tables, LinkedTable> & XataRecord : never;
4605
+
4606
+ /**
4607
+ * Operator to restrict results to only values that are greater than the given value.
4608
+ */
4609
+ declare const greaterThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3094
4610
  /**
3095
4611
  * Operator to restrict results to only values that are greater than the given value.
3096
4612
  */
@@ -3098,15 +4614,35 @@ declare const gt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T
3098
4614
  /**
3099
4615
  * Operator to restrict results to only values that are greater than or equal to the given value.
3100
4616
  */
3101
- declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4617
+ declare const greaterThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4618
+ /**
4619
+ * Operator to restrict results to only values that are greater than or equal to the given value.
4620
+ */
4621
+ declare const greaterEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3102
4622
  /**
3103
4623
  * Operator to restrict results to only values that are greater than or equal to the given value.
3104
4624
  */
3105
4625
  declare const gte: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4626
+ /**
4627
+ * Operator to restrict results to only values that are greater than or equal to the given value.
4628
+ */
4629
+ declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4630
+ /**
4631
+ * Operator to restrict results to only values that are lower than the given value.
4632
+ */
4633
+ declare const lessThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3106
4634
  /**
3107
4635
  * Operator to restrict results to only values that are lower than the given value.
3108
4636
  */
3109
4637
  declare const lt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4638
+ /**
4639
+ * Operator to restrict results to only values that are lower than or equal to the given value.
4640
+ */
4641
+ declare const lessThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4642
+ /**
4643
+ * Operator to restrict results to only values that are lower than or equal to the given value.
4644
+ */
4645
+ declare const lessEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3110
4646
  /**
3111
4647
  * Operator to restrict results to only values that are lower than or equal to the given value.
3112
4648
  */
@@ -3139,6 +4675,10 @@ declare const pattern: (value: string) => StringTypeFilter;
3139
4675
  * Operator to restrict results to only values that are equal to the given value.
3140
4676
  */
3141
4677
  declare const is: <T>(value: T) => PropertyFilter<T>;
4678
+ /**
4679
+ * Operator to restrict results to only values that are equal to the given value.
4680
+ */
4681
+ declare const equals: <T>(value: T) => PropertyFilter<T>;
3142
4682
  /**
3143
4683
  * Operator to restrict results to only values that are not equal to the given value.
3144
4684
  */
@@ -3166,45 +4706,15 @@ declare const includesAny: <T>(value: T) => ArrayFilter<T>;
3166
4706
 
3167
4707
  declare type SchemaDefinition = {
3168
4708
  table: string;
3169
- links?: LinkDictionary;
3170
4709
  };
3171
- declare type SchemaPluginResult<Schemas extends Record<string, BaseData>> = {
4710
+ declare type SchemaPluginResult<Schemas extends Record<string, XataRecord>> = {
3172
4711
  [Key in keyof Schemas]: Repository<Schemas[Key]>;
3173
4712
  };
3174
- declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
3175
- #private;
3176
- private links?;
3177
- constructor(links?: LinkDictionary | undefined);
3178
- build(options: XataPluginOptions): SchemaPluginResult<Schemas>;
3179
- }
3180
-
3181
- declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3182
- fuzziness?: number;
3183
- tables?: Tables[];
3184
- };
3185
- declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3186
- all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3187
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]: {
3188
- table: Model;
3189
- record: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>>;
3190
- };
3191
- }>[]>;
3192
- byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3193
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]?: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>[]>;
3194
- }>;
3195
- };
3196
- declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
4713
+ declare class SchemaPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin {
3197
4714
  #private;
3198
- private db;
3199
- private links;
3200
- constructor(db: SchemaPluginResult<Schemas>, links: LinkDictionary);
3201
- build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
4715
+ constructor(schemaTables?: Schemas.Table[]);
4716
+ build(pluginOptions: XataPluginOptions): SchemaPluginResult<Schemas>;
3202
4717
  }
3203
- declare type SearchXataRecord = XataRecord & {
3204
- xata: {
3205
- table: string;
3206
- };
3207
- };
3208
4718
 
3209
4719
  declare type BranchStrategyValue = string | undefined | null;
3210
4720
  declare type BranchStrategyBuilder = () => BranchStrategyValue | Promise<BranchStrategyValue>;
@@ -3216,33 +4726,130 @@ declare type BaseClientOptions = {
3216
4726
  apiKey?: string;
3217
4727
  databaseURL?: string;
3218
4728
  branch?: BranchStrategyOption;
4729
+ cache?: CacheImpl;
4730
+ trace?: TraceFunction;
3219
4731
  };
3220
4732
  declare const buildClient: <Plugins extends Record<string, XataPlugin> = {}>(plugins?: Plugins | undefined) => ClientConstructor<Plugins>;
3221
4733
  interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
3222
- new <Schemas extends Record<string, BaseData>>(options?: Partial<BaseClientOptions>, links?: LinkDictionary): Omit<{
4734
+ new <Schemas extends Record<string, XataRecord> = {}>(options?: Partial<BaseClientOptions>, schemaTables?: readonly BaseSchema[]): Omit<{
3223
4735
  db: Awaited<ReturnType<SchemaPlugin<Schemas>['build']>>;
3224
4736
  search: Awaited<ReturnType<SearchPlugin<Schemas>['build']>>;
3225
4737
  }, keyof Plugins> & {
3226
4738
  [Key in StringKeys<NonNullable<Plugins>>]: Awaited<ReturnType<NonNullable<Plugins>[Key]['build']>>;
4739
+ } & {
4740
+ getConfig(): Promise<{
4741
+ databaseURL: string;
4742
+ branch: string;
4743
+ }>;
3227
4744
  };
3228
4745
  }
3229
4746
  declare const BaseClient_base: ClientConstructor<{}>;
3230
4747
  declare class BaseClient extends BaseClient_base<Record<string, any>> {
3231
4748
  }
3232
4749
 
4750
+ declare class Serializer {
4751
+ classes: Record<string, any>;
4752
+ add(clazz: any): void;
4753
+ toJSON<T>(data: T): string;
4754
+ fromJSON<T>(json: string): T;
4755
+ }
4756
+ declare const serialize: <T>(data: T) => string;
4757
+ declare const deserialize: <T>(json: string) => T;
4758
+
3233
4759
  declare type BranchResolutionOptions = {
3234
4760
  databaseURL?: string;
3235
4761
  apiKey?: string;
3236
4762
  fetchImpl?: FetchImpl;
3237
4763
  };
3238
- declare function getCurrentBranchName(options?: BranchResolutionOptions): Promise<string | undefined>;
4764
+ declare function getCurrentBranchName(options?: BranchResolutionOptions): Promise<string>;
3239
4765
  declare function getCurrentBranchDetails(options?: BranchResolutionOptions): Promise<DBBranch | null>;
3240
4766
  declare function getDatabaseURL(): string | undefined;
4767
+
3241
4768
  declare function getAPIKey(): string | undefined;
3242
4769
 
4770
+ interface Body {
4771
+ arrayBuffer(): Promise<ArrayBuffer>;
4772
+ blob(): Promise<Blob>;
4773
+ formData(): Promise<FormData>;
4774
+ json(): Promise<any>;
4775
+ text(): Promise<string>;
4776
+ }
4777
+ interface Blob {
4778
+ readonly size: number;
4779
+ readonly type: string;
4780
+ arrayBuffer(): Promise<ArrayBuffer>;
4781
+ slice(start?: number, end?: number, contentType?: string): Blob;
4782
+ text(): Promise<string>;
4783
+ }
4784
+ /** Provides information about files and allows JavaScript in a web page to access their content. */
4785
+ interface File extends Blob {
4786
+ readonly lastModified: number;
4787
+ readonly name: string;
4788
+ readonly webkitRelativePath: string;
4789
+ }
4790
+ declare type FormDataEntryValue = File | string;
4791
+ /** Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data". */
4792
+ interface FormData {
4793
+ append(name: string, value: string | Blob, fileName?: string): void;
4794
+ delete(name: string): void;
4795
+ get(name: string): FormDataEntryValue | null;
4796
+ getAll(name: string): FormDataEntryValue[];
4797
+ has(name: string): boolean;
4798
+ set(name: string, value: string | Blob, fileName?: string): void;
4799
+ forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void;
4800
+ }
4801
+ /** This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs. You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence. */
4802
+ interface Headers {
4803
+ append(name: string, value: string): void;
4804
+ delete(name: string): void;
4805
+ get(name: string): string | null;
4806
+ has(name: string): boolean;
4807
+ set(name: string, value: string): void;
4808
+ forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void;
4809
+ }
4810
+ interface Request extends Body {
4811
+ /** Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching. */
4812
+ readonly cache: 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload';
4813
+ /** Returns the credentials mode associated with request, which is a string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. */
4814
+ readonly credentials: 'include' | 'omit' | 'same-origin';
4815
+ /** Returns the kind of resource requested by request, e.g., "document" or "script". */
4816
+ readonly destination: '' | 'audio' | 'audioworklet' | 'document' | 'embed' | 'font' | 'frame' | 'iframe' | 'image' | 'manifest' | 'object' | 'paintworklet' | 'report' | 'script' | 'sharedworker' | 'style' | 'track' | 'video' | 'worker' | 'xslt';
4817
+ /** Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header. */
4818
+ readonly headers: Headers;
4819
+ /** Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI] */
4820
+ readonly integrity: string;
4821
+ /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
4822
+ readonly keepalive: boolean;
4823
+ /** Returns request's HTTP method, which is "GET" by default. */
4824
+ readonly method: string;
4825
+ /** Returns the mode associated with request, which is a string indicating whether the request will use CORS, or will be restricted to same-origin URLs. */
4826
+ readonly mode: 'cors' | 'navigate' | 'no-cors' | 'same-origin';
4827
+ /** Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default. */
4828
+ readonly redirect: 'error' | 'follow' | 'manual';
4829
+ /** Returns the referrer of request. Its value can be a same-origin URL if explicitly set in init, the empty string to indicate no referrer, and "about:client" when defaulting to the global's default. This is used during fetching to determine the value of the `Referer` header of the request being made. */
4830
+ readonly referrer: string;
4831
+ /** Returns the referrer policy associated with request. This is used during fetching to compute the value of the request's referrer. */
4832
+ readonly referrerPolicy: '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
4833
+ /** Returns the URL of request as a string. */
4834
+ readonly url: string;
4835
+ clone(): Request;
4836
+ }
4837
+
4838
+ declare type XataWorkerContext<XataClient> = {
4839
+ xata: XataClient;
4840
+ request: Request;
4841
+ env: Record<string, string | undefined>;
4842
+ };
4843
+ declare type RemoveFirst<T> = T extends [any, ...infer U] ? U : never;
4844
+ declare type WorkerRunnerConfig = {
4845
+ workspace: string;
4846
+ worker: string;
4847
+ };
4848
+ declare function buildWorkerRunner<XataClient>(config: WorkerRunnerConfig): <WorkerFunction extends (ctx: XataWorkerContext<XataClient>, ...args: any[]) => any>(name: string, _worker: WorkerFunction) => (...args: RemoveFirst<Parameters<WorkerFunction>>) => Promise<Awaited<ReturnType<WorkerFunction>>>;
4849
+
3243
4850
  declare class XataError extends Error {
3244
4851
  readonly status: number;
3245
4852
  constructor(message: string, status: number);
3246
4853
  }
3247
4854
 
3248
- export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, AddTableColumnError, AddTableColumnPathParams, AddTableColumnVariables, BaseClient, BaseClientOptions, BaseData, BulkInsertTableRecordsError, BulkInsertTableRecordsPathParams, BulkInsertTableRecordsRequestBody, BulkInsertTableRecordsResponse, BulkInsertTableRecordsVariables, CancelWorkspaceMemberInviteError, CancelWorkspaceMemberInvitePathParams, CancelWorkspaceMemberInviteVariables, ClientConstructor, CreateBranchError, CreateBranchPathParams, CreateBranchQueryParams, CreateBranchRequestBody, CreateBranchVariables, CreateDatabaseError, CreateDatabasePathParams, CreateDatabaseRequestBody, CreateDatabaseResponse, CreateDatabaseVariables, CreateTableError, CreateTablePathParams, CreateTableVariables, CreateUserAPIKeyError, CreateUserAPIKeyPathParams, CreateUserAPIKeyResponse, CreateUserAPIKeyVariables, CreateWorkspaceError, CreateWorkspaceVariables, CursorNavigationOptions, DeleteBranchError, DeleteBranchPathParams, DeleteBranchVariables, DeleteColumnError, DeleteColumnPathParams, DeleteColumnVariables, DeleteDatabaseError, DeleteDatabasePathParams, DeleteDatabaseVariables, DeleteRecordError, DeleteRecordPathParams, DeleteRecordVariables, DeleteTableError, DeleteTablePathParams, DeleteTableVariables, DeleteUserAPIKeyError, DeleteUserAPIKeyPathParams, DeleteUserAPIKeyVariables, DeleteUserError, DeleteUserVariables, DeleteWorkspaceError, DeleteWorkspacePathParams, DeleteWorkspaceVariables, EditableData, ExecuteBranchMigrationPlanError, ExecuteBranchMigrationPlanPathParams, ExecuteBranchMigrationPlanRequestBody, ExecuteBranchMigrationPlanVariables, FetchImpl, FetcherExtraProps, GetBranchDetailsError, GetBranchDetailsPathParams, GetBranchDetailsVariables, GetBranchListError, GetBranchListPathParams, GetBranchListVariables, GetBranchMetadataError, GetBranchMetadataPathParams, GetBranchMetadataVariables, GetBranchMigrationHistoryError, GetBranchMigrationHistoryPathParams, GetBranchMigrationHistoryRequestBody, GetBranchMigrationHistoryResponse, GetBranchMigrationHistoryVariables, GetBranchMigrationPlanError, GetBranchMigrationPlanPathParams, GetBranchMigrationPlanVariables, GetBranchStatsError, GetBranchStatsPathParams, GetBranchStatsResponse, GetBranchStatsVariables, GetColumnError, GetColumnPathParams, GetColumnVariables, GetDatabaseListError, GetDatabaseListPathParams, GetDatabaseListVariables, GetRecordError, GetRecordPathParams, GetRecordRequestBody, GetRecordVariables, GetTableColumnsError, GetTableColumnsPathParams, GetTableColumnsResponse, GetTableColumnsVariables, GetTableSchemaError, GetTableSchemaPathParams, GetTableSchemaResponse, GetTableSchemaVariables, GetUserAPIKeysError, GetUserAPIKeysResponse, GetUserAPIKeysVariables, GetUserError, GetUserVariables, GetWorkspaceError, GetWorkspaceMembersListError, GetWorkspaceMembersListPathParams, GetWorkspaceMembersListVariables, GetWorkspacePathParams, GetWorkspaceVariables, GetWorkspacesListError, GetWorkspacesListResponse, GetWorkspacesListVariables, Identifiable, InsertRecordError, InsertRecordPathParams, InsertRecordResponse, InsertRecordVariables, InsertRecordWithIDError, InsertRecordWithIDPathParams, InsertRecordWithIDQueryParams, InsertRecordWithIDVariables, InviteWorkspaceMemberError, InviteWorkspaceMemberPathParams, InviteWorkspaceMemberRequestBody, InviteWorkspaceMemberVariables, LinkDictionary, OffsetNavigationOptions, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Paginable, PaginationOptions, PaginationQueryMeta, Query, QueryTableError, QueryTablePathParams, QueryTableRequestBody, QueryTableVariables, RemoveWorkspaceMemberError, RemoveWorkspaceMemberPathParams, RemoveWorkspaceMemberVariables, Repository, ResendWorkspaceMemberInviteError, ResendWorkspaceMemberInvitePathParams, ResendWorkspaceMemberInviteVariables, responses as Responses, RestRepository, SchemaDefinition, SchemaPlugin, SchemaPluginResult, schemas as Schemas, SearchBranchError, SearchBranchPathParams, SearchBranchRequestBody, SearchBranchVariables, SearchOptions, SearchPlugin, SearchPluginResult, SelectableColumn, SelectedPick, SetTableSchemaError, SetTableSchemaPathParams, SetTableSchemaRequestBody, SetTableSchemaVariables, UpdateBranchMetadataError, UpdateBranchMetadataPathParams, UpdateBranchMetadataVariables, UpdateColumnError, UpdateColumnPathParams, UpdateColumnRequestBody, UpdateColumnVariables, UpdateRecordWithIDError, UpdateRecordWithIDPathParams, UpdateRecordWithIDQueryParams, UpdateRecordWithIDVariables, UpdateTableError, UpdateTablePathParams, UpdateTableRequestBody, UpdateTableVariables, UpdateUserError, UpdateUserVariables, UpdateWorkspaceError, UpdateWorkspaceMemberRoleError, UpdateWorkspaceMemberRolePathParams, UpdateWorkspaceMemberRoleRequestBody, UpdateWorkspaceMemberRoleVariables, UpdateWorkspacePathParams, UpdateWorkspaceVariables, UpsertRecordWithIDError, UpsertRecordWithIDPathParams, UpsertRecordWithIDQueryParams, UpsertRecordWithIDVariables, ValueAtColumn, XataApiClient, XataApiClientOptions, XataApiPlugin, XataError, XataPlugin, XataPluginOptions, XataRecord, acceptWorkspaceMemberInvite, addTableColumn, buildClient, bulkInsertTableRecords, cancelWorkspaceMemberInvite, contains, createBranch, createDatabase, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, endsWith, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseURL, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isIdentifiable, isNot, isXataRecord, le, lt, lte, notExists, operationsByTag, pattern, queryTable, removeWorkspaceMember, resendWorkspaceMemberInvite, searchBranch, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberRole, upsertRecordWithID };
4855
+ export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, AddGitBranchesEntryError, AddGitBranchesEntryPathParams, AddGitBranchesEntryRequestBody, AddGitBranchesEntryResponse, AddGitBranchesEntryVariables, AddTableColumnError, AddTableColumnPathParams, AddTableColumnVariables, ApplyBranchSchemaEditError, ApplyBranchSchemaEditPathParams, ApplyBranchSchemaEditRequestBody, ApplyBranchSchemaEditResponse, ApplyBranchSchemaEditVariables, BaseClient, BaseClientOptions, BaseData, BaseSchema, BulkInsertTableRecordsError, BulkInsertTableRecordsPathParams, BulkInsertTableRecordsQueryParams, BulkInsertTableRecordsRequestBody, BulkInsertTableRecordsVariables, CacheImpl, CancelWorkspaceMemberInviteError, CancelWorkspaceMemberInvitePathParams, CancelWorkspaceMemberInviteVariables, ClientConstructor, CompareBranchSchemasError, CompareBranchSchemasPathParams, CompareBranchSchemasVariables, CompareBranchWithUserSchemaError, CompareBranchWithUserSchemaPathParams, CompareBranchWithUserSchemaRequestBody, CompareBranchWithUserSchemaVariables, CompareMigrationRequestError, CompareMigrationRequestPathParams, CompareMigrationRequestVariables, CreateBranchError, CreateBranchPathParams, CreateBranchQueryParams, CreateBranchRequestBody, CreateBranchResponse, CreateBranchVariables, CreateDatabaseError, CreateDatabasePathParams, CreateDatabaseRequestBody, CreateDatabaseResponse, CreateDatabaseVariables, CreateMigrationRequestError, CreateMigrationRequestPathParams, CreateMigrationRequestRequestBody, CreateMigrationRequestResponse, CreateMigrationRequestVariables, CreateTableError, CreateTablePathParams, CreateTableResponse, CreateTableVariables, CreateUserAPIKeyError, CreateUserAPIKeyPathParams, CreateUserAPIKeyResponse, CreateUserAPIKeyVariables, CreateWorkspaceError, CreateWorkspaceVariables, CursorNavigationOptions, DeleteBranchError, DeleteBranchPathParams, DeleteBranchVariables, DeleteColumnError, DeleteColumnPathParams, DeleteColumnVariables, DeleteDatabaseError, DeleteDatabasePathParams, DeleteDatabaseVariables, DeleteRecordError, DeleteRecordPathParams, DeleteRecordQueryParams, DeleteRecordVariables, DeleteTableError, DeleteTablePathParams, DeleteTableVariables, DeleteUserAPIKeyError, DeleteUserAPIKeyPathParams, DeleteUserAPIKeyVariables, DeleteUserError, DeleteUserVariables, DeleteWorkspaceError, DeleteWorkspacePathParams, DeleteWorkspaceVariables, EditableData, ExecuteBranchMigrationPlanError, ExecuteBranchMigrationPlanPathParams, ExecuteBranchMigrationPlanRequestBody, ExecuteBranchMigrationPlanVariables, FetchImpl, FetcherExtraProps, GetBranchDetailsError, GetBranchDetailsPathParams, GetBranchDetailsVariables, GetBranchListError, GetBranchListPathParams, GetBranchListVariables, GetBranchMetadataError, GetBranchMetadataPathParams, GetBranchMetadataVariables, GetBranchMigrationHistoryError, GetBranchMigrationHistoryPathParams, GetBranchMigrationHistoryRequestBody, GetBranchMigrationHistoryResponse, GetBranchMigrationHistoryVariables, GetBranchMigrationPlanError, GetBranchMigrationPlanPathParams, GetBranchMigrationPlanVariables, GetBranchSchemaHistoryError, GetBranchSchemaHistoryPathParams, GetBranchSchemaHistoryRequestBody, GetBranchSchemaHistoryResponse, GetBranchSchemaHistoryVariables, GetBranchStatsError, GetBranchStatsPathParams, GetBranchStatsResponse, GetBranchStatsVariables, GetColumnError, GetColumnPathParams, GetColumnVariables, GetDatabaseListError, GetDatabaseListPathParams, GetDatabaseListVariables, GetDatabaseMetadataError, GetDatabaseMetadataPathParams, GetDatabaseMetadataVariables, GetGitBranchesMappingError, GetGitBranchesMappingPathParams, GetGitBranchesMappingVariables, GetMigrationRequestError, GetMigrationRequestIsMergedError, GetMigrationRequestIsMergedPathParams, GetMigrationRequestIsMergedResponse, GetMigrationRequestIsMergedVariables, GetMigrationRequestPathParams, GetMigrationRequestVariables, GetRecordError, GetRecordPathParams, GetRecordQueryParams, GetRecordVariables, GetTableColumnsError, GetTableColumnsPathParams, GetTableColumnsResponse, GetTableColumnsVariables, GetTableSchemaError, GetTableSchemaPathParams, GetTableSchemaResponse, GetTableSchemaVariables, GetUserAPIKeysError, GetUserAPIKeysResponse, GetUserAPIKeysVariables, GetUserError, GetUserVariables, GetWorkspaceError, GetWorkspaceMembersListError, GetWorkspaceMembersListPathParams, GetWorkspaceMembersListVariables, GetWorkspacePathParams, GetWorkspaceVariables, GetWorkspacesListError, GetWorkspacesListResponse, GetWorkspacesListVariables, Identifiable, InsertRecordError, InsertRecordPathParams, InsertRecordQueryParams, InsertRecordVariables, InsertRecordWithIDError, InsertRecordWithIDPathParams, InsertRecordWithIDQueryParams, InsertRecordWithIDVariables, InviteWorkspaceMemberError, InviteWorkspaceMemberPathParams, InviteWorkspaceMemberRequestBody, InviteWorkspaceMemberVariables, Link, ListMigrationRequestsCommitsError, ListMigrationRequestsCommitsPathParams, ListMigrationRequestsCommitsRequestBody, ListMigrationRequestsCommitsResponse, ListMigrationRequestsCommitsVariables, ListMigrationRequestsError, ListMigrationRequestsPathParams, ListMigrationRequestsRequestBody, ListMigrationRequestsResponse, ListMigrationRequestsVariables, MergeMigrationRequestError, MergeMigrationRequestPathParams, MergeMigrationRequestVariables, OffsetNavigationOptions, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Paginable, PaginationQueryMeta, PreviewBranchSchemaEditError, PreviewBranchSchemaEditPathParams, PreviewBranchSchemaEditRequestBody, PreviewBranchSchemaEditResponse, PreviewBranchSchemaEditVariables, Query, QueryTableError, QueryTablePathParams, QueryTableRequestBody, QueryTableVariables, RecordArray, RemoveGitBranchesEntryError, RemoveGitBranchesEntryPathParams, RemoveGitBranchesEntryQueryParams, RemoveGitBranchesEntryVariables, RemoveWorkspaceMemberError, RemoveWorkspaceMemberPathParams, RemoveWorkspaceMemberVariables, Repository, ResendWorkspaceMemberInviteError, ResendWorkspaceMemberInvitePathParams, ResendWorkspaceMemberInviteVariables, ResolveBranchError, ResolveBranchPathParams, ResolveBranchQueryParams, ResolveBranchResponse, ResolveBranchVariables, responses as Responses, RestRepository, SchemaDefinition, SchemaInference, SchemaPlugin, SchemaPluginResult, schemas as Schemas, SearchBranchError, SearchBranchPathParams, SearchBranchRequestBody, SearchBranchVariables, SearchOptions, SearchPlugin, SearchPluginResult, SearchTableError, SearchTablePathParams, SearchTableRequestBody, SearchTableVariables, SearchXataRecord, SelectableColumn, SelectedPick, Serializer, SetTableSchemaError, SetTableSchemaPathParams, SetTableSchemaRequestBody, SetTableSchemaVariables, SimpleCache, SimpleCacheOptions, UpdateBranchMetadataError, UpdateBranchMetadataPathParams, UpdateBranchMetadataVariables, UpdateBranchSchemaError, UpdateBranchSchemaPathParams, UpdateBranchSchemaResponse, UpdateBranchSchemaVariables, UpdateColumnError, UpdateColumnPathParams, UpdateColumnRequestBody, UpdateColumnVariables, UpdateDatabaseMetadataError, UpdateDatabaseMetadataPathParams, UpdateDatabaseMetadataRequestBody, UpdateDatabaseMetadataVariables, UpdateMigrationRequestError, UpdateMigrationRequestPathParams, UpdateMigrationRequestRequestBody, UpdateMigrationRequestVariables, UpdateRecordWithIDError, UpdateRecordWithIDPathParams, UpdateRecordWithIDQueryParams, UpdateRecordWithIDVariables, UpdateTableError, UpdateTablePathParams, UpdateTableRequestBody, UpdateTableVariables, UpdateUserError, UpdateUserVariables, UpdateWorkspaceError, UpdateWorkspaceMemberInviteError, UpdateWorkspaceMemberInvitePathParams, UpdateWorkspaceMemberInviteRequestBody, UpdateWorkspaceMemberInviteVariables, UpdateWorkspaceMemberRoleError, UpdateWorkspaceMemberRolePathParams, UpdateWorkspaceMemberRoleRequestBody, UpdateWorkspaceMemberRoleVariables, UpdateWorkspacePathParams, UpdateWorkspaceVariables, UpsertRecordWithIDError, UpsertRecordWithIDPathParams, UpsertRecordWithIDQueryParams, UpsertRecordWithIDVariables, ValueAtColumn, XataApiClient, XataApiClientOptions, XataApiPlugin, XataError, XataPlugin, XataPluginOptions, XataRecord, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, applyBranchSchemaEdit, buildClient, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, createBranch, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getGitBranchesMapping, getMigrationRequest, getMigrationRequestIsMerged, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isIdentifiable, isNot, isXataRecord, le, lessEquals, lessThan, lessThanEquals, listMigrationRequests, listMigrationRequestsCommits, lt, lte, mergeMigrationRequest, notExists, operationsByTag, pattern, previewBranchSchemaEdit, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, startsWith, updateBranchMetadata, updateBranchSchema, updateColumn, updateDatabaseMetadata, updateMigrationRequest, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };