@xata.io/client 0.0.0-alpha.vf38f30b → 0.0.0-alpha.vf4752f8

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
  /**
@@ -94,22 +130,32 @@ 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
+ displayName: string;
139
+ createdAt: DateTime;
140
+ numberOfBranches: number;
141
+ ui?: {
142
+ color?: string;
143
+ };
144
+ };
97
145
  declare type ListDatabasesResponse = {
98
- databases?: {
99
- name: string;
100
- displayName: string;
101
- createdAt: DateTime;
102
- numberOfBranches: number;
103
- ui?: {
104
- color?: string;
105
- };
106
- }[];
146
+ databases?: DatabaseMetadata[];
107
147
  };
108
148
  declare type ListBranchesResponse = {
109
149
  databaseName: string;
110
150
  displayName: string;
111
151
  branches: Branch[];
112
152
  };
153
+ declare type ListGitBranchesResponse = {
154
+ mapping: {
155
+ gitBranch: string;
156
+ xataBranch: string;
157
+ }[];
158
+ };
113
159
  declare type Branch = {
114
160
  name: string;
115
161
  createdAt: DateTime;
@@ -147,18 +193,34 @@ declare type Schema = {
147
193
  tables: Table[];
148
194
  tablesOrder?: string[];
149
195
  };
196
+ /**
197
+ * @x-internal true
198
+ */
199
+ declare type SchemaEditScript = {
200
+ sourceMigrationID?: string;
201
+ targetMigrationID?: string;
202
+ tables: TableEdit[];
203
+ };
150
204
  declare type Table = {
151
205
  id?: string;
152
206
  name: TableName;
153
207
  columns: Column[];
154
208
  revLinks?: RevLink[];
155
209
  };
210
+ /**
211
+ * @x-internal true
212
+ */
213
+ declare type TableEdit = {
214
+ oldName?: string;
215
+ newName?: string;
216
+ columns?: MigrationColumnOp[];
217
+ };
156
218
  /**
157
219
  * @x-go-type xata.Column
158
220
  */
159
221
  declare type Column = {
160
222
  name: string;
161
- type: 'bool' | 'int' | 'float' | 'string' | 'text' | 'email' | 'multiple' | 'link' | 'object';
223
+ type: 'bool' | 'int' | 'float' | 'string' | 'text' | 'email' | 'multiple' | 'link' | 'object' | 'datetime';
162
224
  link?: {
163
225
  table: string;
164
226
  };
@@ -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 charcter 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;
@@ -982,11 +1308,11 @@ declare type DeleteDatabaseVariables = {
982
1308
  * Delete a database and all of its branches and tables permanently.
983
1309
  */
984
1310
  declare const deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
985
- declare type GetBranchDetailsPathParams = {
986
- dbBranchName: DBBranchName;
1311
+ declare type GetDatabaseMetadataPathParams = {
1312
+ dbName: DBName;
987
1313
  workspace: string;
988
1314
  };
989
- declare type GetBranchDetailsError = ErrorWrapper<{
1315
+ declare type GetDatabaseMetadataError = ErrorWrapper<{
990
1316
  status: 400;
991
1317
  payload: BadRequestError;
992
1318
  } | {
@@ -996,18 +1322,18 @@ declare type GetBranchDetailsError = ErrorWrapper<{
996
1322
  status: 404;
997
1323
  payload: SimpleError;
998
1324
  }>;
999
- declare type GetBranchDetailsVariables = {
1000
- pathParams: GetBranchDetailsPathParams;
1325
+ declare type GetDatabaseMetadataVariables = {
1326
+ pathParams: GetDatabaseMetadataPathParams;
1001
1327
  } & FetcherExtraProps;
1002
- declare const getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
1003
- declare type CreateBranchPathParams = {
1004
- dbBranchName: DBBranchName;
1328
+ /**
1329
+ * Retrieve metadata of the given database
1330
+ */
1331
+ declare const getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
1332
+ declare type PatchDatabaseMetadataPathParams = {
1333
+ dbName: DBName;
1005
1334
  workspace: string;
1006
1335
  };
1007
- declare type CreateBranchQueryParams = {
1008
- from?: string;
1009
- };
1010
- declare type CreateBranchError = ErrorWrapper<{
1336
+ declare type PatchDatabaseMetadataError = ErrorWrapper<{
1011
1337
  status: 400;
1012
1338
  payload: BadRequestError;
1013
1339
  } | {
@@ -1017,109 +1343,561 @@ declare type CreateBranchError = ErrorWrapper<{
1017
1343
  status: 404;
1018
1344
  payload: SimpleError;
1019
1345
  }>;
1020
- declare type CreateBranchRequestBody = {
1021
- from?: string;
1022
- metadata?: BranchMetadata;
1346
+ declare type PatchDatabaseMetadataRequestBody = {
1347
+ ui?: {
1348
+ color?: string;
1349
+ };
1023
1350
  };
1024
- declare type CreateBranchVariables = {
1025
- body?: CreateBranchRequestBody;
1026
- pathParams: CreateBranchPathParams;
1027
- queryParams?: CreateBranchQueryParams;
1351
+ declare type PatchDatabaseMetadataVariables = {
1352
+ body?: PatchDatabaseMetadataRequestBody;
1353
+ pathParams: PatchDatabaseMetadataPathParams;
1028
1354
  } & FetcherExtraProps;
1029
- declare const createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
1030
- declare type DeleteBranchPathParams = {
1031
- dbBranchName: DBBranchName;
1355
+ /**
1356
+ * Update the color of the selected database
1357
+ */
1358
+ declare const patchDatabaseMetadata: (variables: PatchDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
1359
+ declare type GetGitBranchesMappingPathParams = {
1360
+ dbName: DBName;
1032
1361
  workspace: string;
1033
1362
  };
1034
- declare type DeleteBranchError = ErrorWrapper<{
1363
+ declare type GetGitBranchesMappingError = ErrorWrapper<{
1035
1364
  status: 400;
1036
1365
  payload: BadRequestError;
1037
1366
  } | {
1038
1367
  status: 401;
1039
1368
  payload: AuthError;
1040
- } | {
1041
- status: 404;
1042
- payload: SimpleError;
1043
1369
  }>;
1044
- declare type DeleteBranchVariables = {
1045
- pathParams: DeleteBranchPathParams;
1370
+ declare type GetGitBranchesMappingVariables = {
1371
+ pathParams: GetGitBranchesMappingPathParams;
1046
1372
  } & FetcherExtraProps;
1047
1373
  /**
1048
- * Delete the branch in the database and all its resources
1374
+ * Lists all the git branches in the mapping, and their associated Xata branches.
1375
+ *
1376
+ * Example response:
1377
+ *
1378
+ * ```json
1379
+ * {
1380
+ * "mappings": [
1381
+ * {
1382
+ * "gitBranch": "main",
1383
+ * "xataBranch": "main"
1384
+ * },
1385
+ * {
1386
+ * "gitBranch": "gitBranch1",
1387
+ * "xataBranch": "xataBranch1"
1388
+ * }
1389
+ * {
1390
+ * "gitBranch": "xataBranch2",
1391
+ * "xataBranch": "xataBranch2"
1392
+ * }
1393
+ * ]
1394
+ * }
1395
+ * ```
1049
1396
  */
1050
- declare const deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
1051
- declare type UpdateBranchMetadataPathParams = {
1052
- dbBranchName: DBBranchName;
1397
+ declare const getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
1398
+ declare type AddGitBranchesEntryPathParams = {
1399
+ dbName: DBName;
1053
1400
  workspace: string;
1054
1401
  };
1055
- declare type UpdateBranchMetadataError = ErrorWrapper<{
1402
+ declare type AddGitBranchesEntryError = ErrorWrapper<{
1056
1403
  status: 400;
1057
1404
  payload: BadRequestError;
1058
1405
  } | {
1059
1406
  status: 401;
1060
1407
  payload: AuthError;
1061
- } | {
1062
- status: 404;
1063
- payload: SimpleError;
1064
1408
  }>;
1065
- declare type UpdateBranchMetadataVariables = {
1066
- body?: BranchMetadata;
1067
- pathParams: UpdateBranchMetadataPathParams;
1409
+ declare type AddGitBranchesEntryResponse = {
1410
+ warning?: string;
1411
+ };
1412
+ declare type AddGitBranchesEntryRequestBody = {
1413
+ gitBranch: string;
1414
+ xataBranch: BranchName;
1415
+ };
1416
+ declare type AddGitBranchesEntryVariables = {
1417
+ body: AddGitBranchesEntryRequestBody;
1418
+ pathParams: AddGitBranchesEntryPathParams;
1068
1419
  } & FetcherExtraProps;
1069
1420
  /**
1070
- * Update the branch metadata
1421
+ * 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.
1422
+ *
1423
+ * 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.
1424
+ *
1425
+ * Example request:
1426
+ *
1427
+ * ```json
1428
+ * // POST https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches
1429
+ * {
1430
+ * "gitBranch": "fix/bug123",
1431
+ * "xataBranch": "fix_bug"
1432
+ * }
1433
+ * ```
1071
1434
  */
1072
- declare const updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
1073
- declare type GetBranchMetadataPathParams = {
1074
- dbBranchName: DBBranchName;
1435
+ declare const addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
1436
+ declare type RemoveGitBranchesEntryPathParams = {
1437
+ dbName: DBName;
1075
1438
  workspace: string;
1076
1439
  };
1077
- declare type GetBranchMetadataError = ErrorWrapper<{
1440
+ declare type RemoveGitBranchesEntryQueryParams = {
1441
+ gitBranch: string;
1442
+ };
1443
+ declare type RemoveGitBranchesEntryError = ErrorWrapper<{
1078
1444
  status: 400;
1079
1445
  payload: BadRequestError;
1080
1446
  } | {
1081
1447
  status: 401;
1082
1448
  payload: AuthError;
1083
- } | {
1084
- status: 404;
1085
- payload: SimpleError;
1086
1449
  }>;
1087
- declare type GetBranchMetadataVariables = {
1088
- pathParams: GetBranchMetadataPathParams;
1450
+ declare type RemoveGitBranchesEntryVariables = {
1451
+ pathParams: RemoveGitBranchesEntryPathParams;
1452
+ queryParams: RemoveGitBranchesEntryQueryParams;
1089
1453
  } & FetcherExtraProps;
1090
- declare const getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
1091
- declare type GetBranchMigrationHistoryPathParams = {
1092
- dbBranchName: DBBranchName;
1454
+ /**
1455
+ * 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.
1456
+ *
1457
+ * Example request:
1458
+ *
1459
+ * ```json
1460
+ * // DELETE https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches?gitBranch=fix%2Fbug123
1461
+ * ```
1462
+ */
1463
+ declare const removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
1464
+ declare type ResolveBranchPathParams = {
1465
+ dbName: DBName;
1093
1466
  workspace: string;
1094
1467
  };
1095
- declare type GetBranchMigrationHistoryError = ErrorWrapper<{
1468
+ declare type ResolveBranchQueryParams = {
1469
+ gitBranch?: string;
1470
+ fallbackBranch?: string;
1471
+ };
1472
+ declare type ResolveBranchError = ErrorWrapper<{
1096
1473
  status: 400;
1097
1474
  payload: BadRequestError;
1098
1475
  } | {
1099
1476
  status: 401;
1100
1477
  payload: AuthError;
1101
- } | {
1102
- status: 404;
1103
- payload: SimpleError;
1104
1478
  }>;
1105
- declare type GetBranchMigrationHistoryResponse = {
1106
- startedFrom?: StartedFromMetadata;
1107
- migrations?: BranchMigration[];
1108
- };
1109
- declare type GetBranchMigrationHistoryRequestBody = {
1110
- limit?: number;
1111
- startFrom?: string;
1479
+ declare type ResolveBranchResponse = {
1480
+ branch: string;
1481
+ reason: {
1482
+ code: 'FOUND_IN_MAPPING' | 'BRANCH_EXISTS' | 'FALLBACK_BRANCH' | 'DEFAULT_BRANCH';
1483
+ message: string;
1484
+ };
1112
1485
  };
1113
- declare type GetBranchMigrationHistoryVariables = {
1114
- body?: GetBranchMigrationHistoryRequestBody;
1115
- pathParams: GetBranchMigrationHistoryPathParams;
1486
+ declare type ResolveBranchVariables = {
1487
+ pathParams: ResolveBranchPathParams;
1488
+ queryParams?: ResolveBranchQueryParams;
1116
1489
  } & FetcherExtraProps;
1117
- declare const getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
1490
+ /**
1491
+ * In order to resolve the database branch, the following algorithm is used:
1492
+ * * 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
1493
+ * * else, if a Xata branch with the exact same name as `gitBranch` exists, return it
1494
+ * * else, if `fallbackBranch` is provided and a branch with that name exists, return it
1495
+ * * else, return the default branch of the DB (`main` or the first branch)
1496
+ *
1497
+ * Example call:
1498
+ *
1499
+ * ```json
1500
+ * // GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test&fallbackBranch=tsg
1501
+ * ```
1502
+ *
1503
+ * Example response:
1504
+ *
1505
+ * ```json
1506
+ * {
1507
+ * "branch": "main",
1508
+ * "reason": {
1509
+ * "code": "DEFAULT_BRANCH",
1510
+ * "message": "Default branch for this database (main)"
1511
+ * }
1512
+ * }
1513
+ * ```
1514
+ */
1515
+ declare const resolveBranch: (variables: ResolveBranchVariables) => Promise<ResolveBranchResponse>;
1516
+ declare type ListMigrationRequestsPathParams = {
1517
+ dbName: DBName;
1518
+ workspace: string;
1519
+ };
1520
+ declare type ListMigrationRequestsError = ErrorWrapper<{
1521
+ status: 400;
1522
+ payload: BadRequestError;
1523
+ } | {
1524
+ status: 401;
1525
+ payload: AuthError;
1526
+ } | {
1527
+ status: 404;
1528
+ payload: SimpleError;
1529
+ }>;
1530
+ declare type ListMigrationRequestsResponse = {
1531
+ migrationRequests: MigrationRequest[];
1532
+ meta: RecordsMetadata;
1533
+ };
1534
+ declare type ListMigrationRequestsRequestBody = {
1535
+ filter?: FilterExpression;
1536
+ sort?: SortExpression;
1537
+ page?: PageConfig;
1538
+ columns?: ColumnsProjection;
1539
+ };
1540
+ declare type ListMigrationRequestsVariables = {
1541
+ body?: ListMigrationRequestsRequestBody;
1542
+ pathParams: ListMigrationRequestsPathParams;
1543
+ } & FetcherExtraProps;
1544
+ declare const listMigrationRequests: (variables: ListMigrationRequestsVariables) => Promise<ListMigrationRequestsResponse>;
1545
+ declare type CreateMigrationRequestPathParams = {
1546
+ dbName: DBName;
1547
+ workspace: string;
1548
+ };
1549
+ declare type CreateMigrationRequestError = ErrorWrapper<{
1550
+ status: 400;
1551
+ payload: BadRequestError;
1552
+ } | {
1553
+ status: 401;
1554
+ payload: AuthError;
1555
+ } | {
1556
+ status: 404;
1557
+ payload: SimpleError;
1558
+ }>;
1559
+ declare type CreateMigrationRequestResponse = {
1560
+ number: number;
1561
+ };
1562
+ declare type CreateMigrationRequestRequestBody = {
1563
+ source: string;
1564
+ target: string;
1565
+ title: string;
1566
+ body?: string;
1567
+ };
1568
+ declare type CreateMigrationRequestVariables = {
1569
+ body: CreateMigrationRequestRequestBody;
1570
+ pathParams: CreateMigrationRequestPathParams;
1571
+ } & FetcherExtraProps;
1572
+ declare const createMigrationRequest: (variables: CreateMigrationRequestVariables) => Promise<CreateMigrationRequestResponse>;
1573
+ declare type GetMigrationRequestPathParams = {
1574
+ dbName: DBName;
1575
+ mrNumber: number;
1576
+ workspace: string;
1577
+ };
1578
+ declare type GetMigrationRequestError = ErrorWrapper<{
1579
+ status: 400;
1580
+ payload: BadRequestError;
1581
+ } | {
1582
+ status: 401;
1583
+ payload: AuthError;
1584
+ } | {
1585
+ status: 404;
1586
+ payload: SimpleError;
1587
+ }>;
1588
+ declare type GetMigrationRequestVariables = {
1589
+ pathParams: GetMigrationRequestPathParams;
1590
+ } & FetcherExtraProps;
1591
+ declare const getMigrationRequest: (variables: GetMigrationRequestVariables) => Promise<MigrationRequest>;
1592
+ declare type UpdateMigrationRequestPathParams = {
1593
+ dbName: DBName;
1594
+ mrNumber: number;
1595
+ workspace: string;
1596
+ };
1597
+ declare type UpdateMigrationRequestError = ErrorWrapper<{
1598
+ status: 400;
1599
+ payload: BadRequestError;
1600
+ } | {
1601
+ status: 401;
1602
+ payload: AuthError;
1603
+ } | {
1604
+ status: 404;
1605
+ payload: SimpleError;
1606
+ }>;
1607
+ declare type UpdateMigrationRequestRequestBody = {
1608
+ title?: string;
1609
+ body?: string;
1610
+ status?: 'open' | 'closed';
1611
+ };
1612
+ declare type UpdateMigrationRequestVariables = {
1613
+ body?: UpdateMigrationRequestRequestBody;
1614
+ pathParams: UpdateMigrationRequestPathParams;
1615
+ } & FetcherExtraProps;
1616
+ declare const updateMigrationRequest: (variables: UpdateMigrationRequestVariables) => Promise<undefined>;
1617
+ declare type ListMigrationRequestsCommitsPathParams = {
1618
+ dbName: DBName;
1619
+ mrNumber: number;
1620
+ workspace: string;
1621
+ };
1622
+ declare type ListMigrationRequestsCommitsError = ErrorWrapper<{
1623
+ status: 400;
1624
+ payload: BadRequestError;
1625
+ } | {
1626
+ status: 401;
1627
+ payload: AuthError;
1628
+ } | {
1629
+ status: 404;
1630
+ payload: SimpleError;
1631
+ }>;
1632
+ declare type ListMigrationRequestsCommitsResponse = {
1633
+ meta: {
1634
+ cursor: string;
1635
+ more: boolean;
1636
+ };
1637
+ logs: Commit[];
1638
+ };
1639
+ declare type ListMigrationRequestsCommitsRequestBody = {
1640
+ page?: {
1641
+ after?: string;
1642
+ before?: string;
1643
+ size?: number;
1644
+ };
1645
+ };
1646
+ declare type ListMigrationRequestsCommitsVariables = {
1647
+ body?: ListMigrationRequestsCommitsRequestBody;
1648
+ pathParams: ListMigrationRequestsCommitsPathParams;
1649
+ } & FetcherExtraProps;
1650
+ declare const listMigrationRequestsCommits: (variables: ListMigrationRequestsCommitsVariables) => Promise<ListMigrationRequestsCommitsResponse>;
1651
+ declare type CompareMigrationRequestPathParams = {
1652
+ dbName: DBName;
1653
+ mrNumber: number;
1654
+ workspace: string;
1655
+ };
1656
+ declare type CompareMigrationRequestError = ErrorWrapper<{
1657
+ status: 400;
1658
+ payload: BadRequestError;
1659
+ } | {
1660
+ status: 401;
1661
+ payload: AuthError;
1662
+ } | {
1663
+ status: 404;
1664
+ payload: SimpleError;
1665
+ }>;
1666
+ declare type CompareMigrationRequestVariables = {
1667
+ pathParams: CompareMigrationRequestPathParams;
1668
+ } & FetcherExtraProps;
1669
+ declare const compareMigrationRequest: (variables: CompareMigrationRequestVariables) => Promise<SchemaCompareResponse>;
1670
+ declare type GetMigrationRequestIsMergedPathParams = {
1671
+ dbName: DBName;
1672
+ mrNumber: number;
1673
+ workspace: string;
1674
+ };
1675
+ declare type GetMigrationRequestIsMergedError = ErrorWrapper<{
1676
+ status: 400;
1677
+ payload: BadRequestError;
1678
+ } | {
1679
+ status: 401;
1680
+ payload: AuthError;
1681
+ } | {
1682
+ status: 404;
1683
+ payload: SimpleError;
1684
+ }>;
1685
+ declare type GetMigrationRequestIsMergedResponse = {
1686
+ merged?: boolean;
1687
+ };
1688
+ declare type GetMigrationRequestIsMergedVariables = {
1689
+ pathParams: GetMigrationRequestIsMergedPathParams;
1690
+ } & FetcherExtraProps;
1691
+ declare const getMigrationRequestIsMerged: (variables: GetMigrationRequestIsMergedVariables) => Promise<GetMigrationRequestIsMergedResponse>;
1692
+ declare type MergeMigrationRequestPathParams = {
1693
+ dbName: DBName;
1694
+ mrNumber: number;
1695
+ workspace: string;
1696
+ };
1697
+ declare type MergeMigrationRequestError = ErrorWrapper<{
1698
+ status: 400;
1699
+ payload: BadRequestError;
1700
+ } | {
1701
+ status: 401;
1702
+ payload: AuthError;
1703
+ } | {
1704
+ status: 404;
1705
+ payload: SimpleError;
1706
+ }>;
1707
+ declare type MergeMigrationRequestVariables = {
1708
+ pathParams: MergeMigrationRequestPathParams;
1709
+ } & FetcherExtraProps;
1710
+ declare const mergeMigrationRequest: (variables: MergeMigrationRequestVariables) => Promise<Commit>;
1711
+ declare type GetBranchDetailsPathParams = {
1712
+ dbBranchName: DBBranchName;
1713
+ workspace: string;
1714
+ };
1715
+ declare type GetBranchDetailsError = ErrorWrapper<{
1716
+ status: 400;
1717
+ payload: BadRequestError;
1718
+ } | {
1719
+ status: 401;
1720
+ payload: AuthError;
1721
+ } | {
1722
+ status: 404;
1723
+ payload: SimpleError;
1724
+ }>;
1725
+ declare type GetBranchDetailsVariables = {
1726
+ pathParams: GetBranchDetailsPathParams;
1727
+ } & FetcherExtraProps;
1728
+ declare const getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
1729
+ declare type CreateBranchPathParams = {
1730
+ dbBranchName: DBBranchName;
1731
+ workspace: string;
1732
+ };
1733
+ declare type CreateBranchQueryParams = {
1734
+ from?: string;
1735
+ };
1736
+ declare type CreateBranchError = ErrorWrapper<{
1737
+ status: 400;
1738
+ payload: BadRequestError;
1739
+ } | {
1740
+ status: 401;
1741
+ payload: AuthError;
1742
+ } | {
1743
+ status: 404;
1744
+ payload: SimpleError;
1745
+ }>;
1746
+ declare type CreateBranchResponse = {
1747
+ databaseName: string;
1748
+ branchName: string;
1749
+ };
1750
+ declare type CreateBranchRequestBody = {
1751
+ from?: string;
1752
+ metadata?: BranchMetadata;
1753
+ };
1754
+ declare type CreateBranchVariables = {
1755
+ body?: CreateBranchRequestBody;
1756
+ pathParams: CreateBranchPathParams;
1757
+ queryParams?: CreateBranchQueryParams;
1758
+ } & FetcherExtraProps;
1759
+ declare const createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
1760
+ declare type DeleteBranchPathParams = {
1761
+ dbBranchName: DBBranchName;
1762
+ workspace: string;
1763
+ };
1764
+ declare type DeleteBranchError = ErrorWrapper<{
1765
+ status: 400;
1766
+ payload: BadRequestError;
1767
+ } | {
1768
+ status: 401;
1769
+ payload: AuthError;
1770
+ } | {
1771
+ status: 404;
1772
+ payload: SimpleError;
1773
+ }>;
1774
+ declare type DeleteBranchVariables = {
1775
+ pathParams: DeleteBranchPathParams;
1776
+ } & FetcherExtraProps;
1777
+ /**
1778
+ * Delete the branch in the database and all its resources
1779
+ */
1780
+ declare const deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
1781
+ declare type UpdateBranchMetadataPathParams = {
1782
+ dbBranchName: DBBranchName;
1783
+ workspace: string;
1784
+ };
1785
+ declare type UpdateBranchMetadataError = ErrorWrapper<{
1786
+ status: 400;
1787
+ payload: BadRequestError;
1788
+ } | {
1789
+ status: 401;
1790
+ payload: AuthError;
1791
+ } | {
1792
+ status: 404;
1793
+ payload: SimpleError;
1794
+ }>;
1795
+ declare type UpdateBranchMetadataVariables = {
1796
+ body?: BranchMetadata;
1797
+ pathParams: UpdateBranchMetadataPathParams;
1798
+ } & FetcherExtraProps;
1799
+ /**
1800
+ * Update the branch metadata
1801
+ */
1802
+ declare const updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
1803
+ declare type GetBranchMetadataPathParams = {
1804
+ dbBranchName: DBBranchName;
1805
+ workspace: string;
1806
+ };
1807
+ declare type GetBranchMetadataError = ErrorWrapper<{
1808
+ status: 400;
1809
+ payload: BadRequestError;
1810
+ } | {
1811
+ status: 401;
1812
+ payload: AuthError;
1813
+ } | {
1814
+ status: 404;
1815
+ payload: SimpleError;
1816
+ }>;
1817
+ declare type GetBranchMetadataVariables = {
1818
+ pathParams: GetBranchMetadataPathParams;
1819
+ } & FetcherExtraProps;
1820
+ declare const getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
1821
+ declare type GetBranchMigrationHistoryPathParams = {
1822
+ dbBranchName: DBBranchName;
1823
+ workspace: string;
1824
+ };
1825
+ declare type GetBranchMigrationHistoryError = ErrorWrapper<{
1826
+ status: 400;
1827
+ payload: BadRequestError;
1828
+ } | {
1829
+ status: 401;
1830
+ payload: AuthError;
1831
+ } | {
1832
+ status: 404;
1833
+ payload: SimpleError;
1834
+ }>;
1835
+ declare type GetBranchMigrationHistoryResponse = {
1836
+ startedFrom?: StartedFromMetadata;
1837
+ migrations?: BranchMigration[];
1838
+ };
1839
+ declare type GetBranchMigrationHistoryRequestBody = {
1840
+ limit?: number;
1841
+ startFrom?: string;
1842
+ };
1843
+ declare type GetBranchMigrationHistoryVariables = {
1844
+ body?: GetBranchMigrationHistoryRequestBody;
1845
+ pathParams: GetBranchMigrationHistoryPathParams;
1846
+ } & FetcherExtraProps;
1847
+ declare const getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
1118
1848
  declare type ExecuteBranchMigrationPlanPathParams = {
1119
1849
  dbBranchName: DBBranchName;
1120
1850
  workspace: string;
1121
1851
  };
1122
- declare type ExecuteBranchMigrationPlanError = ErrorWrapper<{
1852
+ declare type ExecuteBranchMigrationPlanError = ErrorWrapper<{
1853
+ status: 400;
1854
+ payload: BadRequestError;
1855
+ } | {
1856
+ status: 401;
1857
+ payload: AuthError;
1858
+ } | {
1859
+ status: 404;
1860
+ payload: SimpleError;
1861
+ }>;
1862
+ declare type ExecuteBranchMigrationPlanRequestBody = {
1863
+ version: number;
1864
+ migration: BranchMigration;
1865
+ };
1866
+ declare type ExecuteBranchMigrationPlanVariables = {
1867
+ body: ExecuteBranchMigrationPlanRequestBody;
1868
+ pathParams: ExecuteBranchMigrationPlanPathParams;
1869
+ } & FetcherExtraProps;
1870
+ /**
1871
+ * Apply a migration plan to the branch
1872
+ */
1873
+ declare const executeBranchMigrationPlan: (variables: ExecuteBranchMigrationPlanVariables) => Promise<undefined>;
1874
+ declare type GetBranchMigrationPlanPathParams = {
1875
+ dbBranchName: DBBranchName;
1876
+ workspace: string;
1877
+ };
1878
+ declare type GetBranchMigrationPlanError = ErrorWrapper<{
1879
+ status: 400;
1880
+ payload: BadRequestError;
1881
+ } | {
1882
+ status: 401;
1883
+ payload: AuthError;
1884
+ } | {
1885
+ status: 404;
1886
+ payload: SimpleError;
1887
+ }>;
1888
+ declare type GetBranchMigrationPlanVariables = {
1889
+ body: Schema;
1890
+ pathParams: GetBranchMigrationPlanPathParams;
1891
+ } & FetcherExtraProps;
1892
+ /**
1893
+ * Compute a migration plan from a target schema the branch should be migrated too.
1894
+ */
1895
+ declare const getBranchMigrationPlan: (variables: GetBranchMigrationPlanVariables) => Promise<BranchMigrationPlan>;
1896
+ declare type CompareBranchWithUserSchemaPathParams = {
1897
+ dbBranchName: DBBranchName;
1898
+ workspace: string;
1899
+ };
1900
+ declare type CompareBranchWithUserSchemaError = ErrorWrapper<{
1123
1901
  status: 400;
1124
1902
  payload: BadRequestError;
1125
1903
  } | {
@@ -1129,23 +1907,20 @@ declare type ExecuteBranchMigrationPlanError = ErrorWrapper<{
1129
1907
  status: 404;
1130
1908
  payload: SimpleError;
1131
1909
  }>;
1132
- declare type ExecuteBranchMigrationPlanRequestBody = {
1133
- version: number;
1134
- migration: BranchMigration;
1910
+ declare type CompareBranchWithUserSchemaRequestBody = {
1911
+ schema: Schema;
1135
1912
  };
1136
- declare type ExecuteBranchMigrationPlanVariables = {
1137
- body: ExecuteBranchMigrationPlanRequestBody;
1138
- pathParams: ExecuteBranchMigrationPlanPathParams;
1913
+ declare type CompareBranchWithUserSchemaVariables = {
1914
+ body: CompareBranchWithUserSchemaRequestBody;
1915
+ pathParams: CompareBranchWithUserSchemaPathParams;
1139
1916
  } & FetcherExtraProps;
1140
- /**
1141
- * Apply a migration plan to the branch
1142
- */
1143
- declare const executeBranchMigrationPlan: (variables: ExecuteBranchMigrationPlanVariables) => Promise<undefined>;
1144
- declare type GetBranchMigrationPlanPathParams = {
1917
+ declare const compareBranchWithUserSchema: (variables: CompareBranchWithUserSchemaVariables) => Promise<SchemaCompareResponse>;
1918
+ declare type CompareBranchSchemasPathParams = {
1145
1919
  dbBranchName: DBBranchName;
1920
+ branchName: BranchName;
1146
1921
  workspace: string;
1147
1922
  };
1148
- declare type GetBranchMigrationPlanError = ErrorWrapper<{
1923
+ declare type CompareBranchSchemasError = ErrorWrapper<{
1149
1924
  status: 400;
1150
1925
  payload: BadRequestError;
1151
1926
  } | {
@@ -1155,14 +1930,120 @@ declare type GetBranchMigrationPlanError = ErrorWrapper<{
1155
1930
  status: 404;
1156
1931
  payload: SimpleError;
1157
1932
  }>;
1158
- declare type GetBranchMigrationPlanVariables = {
1159
- body: Schema;
1160
- pathParams: GetBranchMigrationPlanPathParams;
1933
+ declare type CompareBranchSchemasVariables = {
1934
+ body?: Record<string, any>;
1935
+ pathParams: CompareBranchSchemasPathParams;
1161
1936
  } & 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>;
1937
+ declare const compareBranchSchemas: (variables: CompareBranchSchemasVariables) => Promise<SchemaCompareResponse>;
1938
+ declare type UpdateBranchSchemaPathParams = {
1939
+ dbBranchName: DBBranchName;
1940
+ workspace: string;
1941
+ };
1942
+ declare type UpdateBranchSchemaError = ErrorWrapper<{
1943
+ status: 400;
1944
+ payload: BadRequestError;
1945
+ } | {
1946
+ status: 401;
1947
+ payload: AuthError;
1948
+ } | {
1949
+ status: 404;
1950
+ payload: SimpleError;
1951
+ }>;
1952
+ declare type UpdateBranchSchemaResponse = {
1953
+ id: string;
1954
+ parentID: string;
1955
+ };
1956
+ declare type UpdateBranchSchemaVariables = {
1957
+ body: Migration;
1958
+ pathParams: UpdateBranchSchemaPathParams;
1959
+ } & FetcherExtraProps;
1960
+ declare const updateBranchSchema: (variables: UpdateBranchSchemaVariables) => Promise<UpdateBranchSchemaResponse>;
1961
+ declare type PreviewBranchSchemaEditPathParams = {
1962
+ dbBranchName: DBBranchName;
1963
+ workspace: string;
1964
+ };
1965
+ declare type PreviewBranchSchemaEditError = ErrorWrapper<{
1966
+ status: 400;
1967
+ payload: BadRequestError;
1968
+ } | {
1969
+ status: 401;
1970
+ payload: AuthError;
1971
+ } | {
1972
+ status: 404;
1973
+ payload: SimpleError;
1974
+ }>;
1975
+ declare type PreviewBranchSchemaEditResponse = {
1976
+ original: Schema;
1977
+ updated: Schema;
1978
+ };
1979
+ declare type PreviewBranchSchemaEditRequestBody = {
1980
+ edits?: SchemaEditScript;
1981
+ operations?: MigrationOp[];
1982
+ };
1983
+ declare type PreviewBranchSchemaEditVariables = {
1984
+ body?: PreviewBranchSchemaEditRequestBody;
1985
+ pathParams: PreviewBranchSchemaEditPathParams;
1986
+ } & FetcherExtraProps;
1987
+ declare const previewBranchSchemaEdit: (variables: PreviewBranchSchemaEditVariables) => Promise<PreviewBranchSchemaEditResponse>;
1988
+ declare type ApplyBranchSchemaEditPathParams = {
1989
+ dbBranchName: DBBranchName;
1990
+ workspace: string;
1991
+ };
1992
+ declare type ApplyBranchSchemaEditError = ErrorWrapper<{
1993
+ status: 400;
1994
+ payload: BadRequestError;
1995
+ } | {
1996
+ status: 401;
1997
+ payload: AuthError;
1998
+ } | {
1999
+ status: 404;
2000
+ payload: SimpleError;
2001
+ }>;
2002
+ declare type ApplyBranchSchemaEditResponse = {
2003
+ id: string;
2004
+ parentID: string;
2005
+ };
2006
+ declare type ApplyBranchSchemaEditRequestBody = {
2007
+ edits: SchemaEditScript;
2008
+ };
2009
+ declare type ApplyBranchSchemaEditVariables = {
2010
+ body: ApplyBranchSchemaEditRequestBody;
2011
+ pathParams: ApplyBranchSchemaEditPathParams;
2012
+ } & FetcherExtraProps;
2013
+ declare const applyBranchSchemaEdit: (variables: ApplyBranchSchemaEditVariables) => Promise<ApplyBranchSchemaEditResponse>;
2014
+ declare type GetBranchSchemaHistoryPathParams = {
2015
+ dbBranchName: DBBranchName;
2016
+ workspace: string;
2017
+ };
2018
+ declare type GetBranchSchemaHistoryError = ErrorWrapper<{
2019
+ status: 400;
2020
+ payload: BadRequestError;
2021
+ } | {
2022
+ status: 401;
2023
+ payload: AuthError;
2024
+ } | {
2025
+ status: 404;
2026
+ payload: SimpleError;
2027
+ }>;
2028
+ declare type GetBranchSchemaHistoryResponse = {
2029
+ meta: {
2030
+ cursor: string;
2031
+ more: boolean;
2032
+ };
2033
+ logs: Commit[];
2034
+ };
2035
+ declare type GetBranchSchemaHistoryRequestBody = {
2036
+ page?: {
2037
+ after?: string;
2038
+ before?: string;
2039
+ size?: number;
2040
+ };
2041
+ };
2042
+ declare type GetBranchSchemaHistoryVariables = {
2043
+ body?: GetBranchSchemaHistoryRequestBody;
2044
+ pathParams: GetBranchSchemaHistoryPathParams;
2045
+ } & FetcherExtraProps;
2046
+ declare const getBranchSchemaHistory: (variables: GetBranchSchemaHistoryVariables) => Promise<GetBranchSchemaHistoryResponse>;
1166
2047
  declare type GetBranchStatsPathParams = {
1167
2048
  dbBranchName: DBBranchName;
1168
2049
  workspace: string;
@@ -1213,13 +2094,17 @@ declare type CreateTableError = ErrorWrapper<{
1213
2094
  status: 422;
1214
2095
  payload: SimpleError;
1215
2096
  }>;
2097
+ declare type CreateTableResponse = {
2098
+ branchName: string;
2099
+ tableName: string;
2100
+ };
1216
2101
  declare type CreateTableVariables = {
1217
2102
  pathParams: CreateTablePathParams;
1218
2103
  } & FetcherExtraProps;
1219
2104
  /**
1220
2105
  * Creates a new table with the given name. Returns 422 if a table with the same name already exists.
1221
2106
  */
1222
- declare const createTable: (variables: CreateTableVariables) => Promise<undefined>;
2107
+ declare const createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
1223
2108
  declare type DeleteTablePathParams = {
1224
2109
  dbBranchName: DBBranchName;
1225
2110
  tableName: TableName;
@@ -1266,8 +2151,9 @@ declare type UpdateTableVariables = {
1266
2151
  *
1267
2152
  * In the example below, we rename a table from “users” to “people”:
1268
2153
  *
1269
- * ```jsx
1270
- * PATCH /db/test:main/tables/users
2154
+ * ```json
2155
+ * // PATCH /db/test:main/tables/users
2156
+ *
1271
2157
  * {
1272
2158
  * "name": "people"
1273
2159
  * }
@@ -1451,6 +2337,9 @@ declare type InsertRecordPathParams = {
1451
2337
  tableName: TableName;
1452
2338
  workspace: string;
1453
2339
  };
2340
+ declare type InsertRecordQueryParams = {
2341
+ columns?: ColumnsProjection;
2342
+ };
1454
2343
  declare type InsertRecordError = ErrorWrapper<{
1455
2344
  status: 400;
1456
2345
  payload: BadRequestError;
@@ -1461,20 +2350,15 @@ declare type InsertRecordError = ErrorWrapper<{
1461
2350
  status: 404;
1462
2351
  payload: SimpleError;
1463
2352
  }>;
1464
- declare type InsertRecordResponse = {
1465
- id: string;
1466
- xata: {
1467
- version: number;
1468
- };
1469
- };
1470
2353
  declare type InsertRecordVariables = {
1471
2354
  body?: Record<string, any>;
1472
2355
  pathParams: InsertRecordPathParams;
2356
+ queryParams?: InsertRecordQueryParams;
1473
2357
  } & FetcherExtraProps;
1474
2358
  /**
1475
2359
  * Insert a new Record into the Table
1476
2360
  */
1477
- declare const insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
2361
+ declare const insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
1478
2362
  declare type InsertRecordWithIDPathParams = {
1479
2363
  dbBranchName: DBBranchName;
1480
2364
  tableName: TableName;
@@ -1482,6 +2366,7 @@ declare type InsertRecordWithIDPathParams = {
1482
2366
  workspace: string;
1483
2367
  };
1484
2368
  declare type InsertRecordWithIDQueryParams = {
2369
+ columns?: ColumnsProjection;
1485
2370
  createOnly?: boolean;
1486
2371
  ifVersion?: number;
1487
2372
  };
@@ -1514,6 +2399,7 @@ declare type UpdateRecordWithIDPathParams = {
1514
2399
  workspace: string;
1515
2400
  };
1516
2401
  declare type UpdateRecordWithIDQueryParams = {
2402
+ columns?: ColumnsProjection;
1517
2403
  ifVersion?: number;
1518
2404
  };
1519
2405
  declare type UpdateRecordWithIDError = ErrorWrapper<{
@@ -1542,6 +2428,7 @@ declare type UpsertRecordWithIDPathParams = {
1542
2428
  workspace: string;
1543
2429
  };
1544
2430
  declare type UpsertRecordWithIDQueryParams = {
2431
+ columns?: ColumnsProjection;
1545
2432
  ifVersion?: number;
1546
2433
  };
1547
2434
  declare type UpsertRecordWithIDError = ErrorWrapper<{
@@ -1569,6 +2456,9 @@ declare type DeleteRecordPathParams = {
1569
2456
  recordId: RecordID;
1570
2457
  workspace: string;
1571
2458
  };
2459
+ declare type DeleteRecordQueryParams = {
2460
+ columns?: ColumnsProjection;
2461
+ };
1572
2462
  declare type DeleteRecordError = ErrorWrapper<{
1573
2463
  status: 400;
1574
2464
  payload: BadRequestError;
@@ -1581,14 +2471,18 @@ declare type DeleteRecordError = ErrorWrapper<{
1581
2471
  }>;
1582
2472
  declare type DeleteRecordVariables = {
1583
2473
  pathParams: DeleteRecordPathParams;
2474
+ queryParams?: DeleteRecordQueryParams;
1584
2475
  } & FetcherExtraProps;
1585
- declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
2476
+ declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
1586
2477
  declare type GetRecordPathParams = {
1587
2478
  dbBranchName: DBBranchName;
1588
2479
  tableName: TableName;
1589
2480
  recordId: RecordID;
1590
2481
  workspace: string;
1591
2482
  };
2483
+ declare type GetRecordQueryParams = {
2484
+ columns?: ColumnsProjection;
2485
+ };
1592
2486
  declare type GetRecordError = ErrorWrapper<{
1593
2487
  status: 400;
1594
2488
  payload: BadRequestError;
@@ -1599,12 +2493,9 @@ declare type GetRecordError = ErrorWrapper<{
1599
2493
  status: 404;
1600
2494
  payload: SimpleError;
1601
2495
  }>;
1602
- declare type GetRecordRequestBody = {
1603
- columns?: ColumnsFilter;
1604
- };
1605
2496
  declare type GetRecordVariables = {
1606
- body?: GetRecordRequestBody;
1607
2497
  pathParams: GetRecordPathParams;
2498
+ queryParams?: GetRecordQueryParams;
1608
2499
  } & FetcherExtraProps;
1609
2500
  /**
1610
2501
  * Retrieve record by ID
@@ -1615,6 +2506,9 @@ declare type BulkInsertTableRecordsPathParams = {
1615
2506
  tableName: TableName;
1616
2507
  workspace: string;
1617
2508
  };
2509
+ declare type BulkInsertTableRecordsQueryParams = {
2510
+ columns?: ColumnsProjection;
2511
+ };
1618
2512
  declare type BulkInsertTableRecordsError = ErrorWrapper<{
1619
2513
  status: 400;
1620
2514
  payload: BulkError;
@@ -1624,21 +2518,22 @@ declare type BulkInsertTableRecordsError = ErrorWrapper<{
1624
2518
  } | {
1625
2519
  status: 404;
1626
2520
  payload: SimpleError;
2521
+ } | {
2522
+ status: 422;
2523
+ payload: SimpleError;
1627
2524
  }>;
1628
- declare type BulkInsertTableRecordsResponse = {
1629
- recordIDs: string[];
1630
- };
1631
2525
  declare type BulkInsertTableRecordsRequestBody = {
1632
2526
  records: Record<string, any>[];
1633
2527
  };
1634
2528
  declare type BulkInsertTableRecordsVariables = {
1635
2529
  body: BulkInsertTableRecordsRequestBody;
1636
2530
  pathParams: BulkInsertTableRecordsPathParams;
2531
+ queryParams?: BulkInsertTableRecordsQueryParams;
1637
2532
  } & FetcherExtraProps;
1638
2533
  /**
1639
2534
  * Bulk insert records
1640
2535
  */
1641
- declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
2536
+ declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
1642
2537
  declare type QueryTablePathParams = {
1643
2538
  dbBranchName: DBBranchName;
1644
2539
  tableName: TableName;
@@ -1658,7 +2553,7 @@ declare type QueryTableRequestBody = {
1658
2553
  filter?: FilterExpression;
1659
2554
  sort?: SortExpression;
1660
2555
  page?: PageConfig;
1661
- columns?: ColumnsFilter;
2556
+ columns?: ColumnsProjection;
1662
2557
  };
1663
2558
  declare type QueryTableVariables = {
1664
2559
  body?: QueryTableRequestBody;
@@ -1675,7 +2570,7 @@ declare type QueryTableVariables = {
1675
2570
  * {
1676
2571
  * "columns": [...],
1677
2572
  * "filter": {
1678
- * "$all": [...]
2573
+ * "$all": [...],
1679
2574
  * "$any": [...]
1680
2575
  * ...
1681
2576
  * },
@@ -1721,7 +2616,11 @@ declare type QueryTableVariables = {
1721
2616
  * "link": {
1722
2617
  * "table": "users"
1723
2618
  * }
1724
- * }
2619
+ * },
2620
+ * {
2621
+ * "name": "foundedDate",
2622
+ * "type": "datetime"
2623
+ * },
1725
2624
  * ]
1726
2625
  * },
1727
2626
  * {
@@ -1809,7 +2708,7 @@ declare type QueryTableVariables = {
1809
2708
  * {
1810
2709
  * "name": "Kilian",
1811
2710
  * "address": {
1812
- * "street": "New street",
2711
+ * "street": "New street"
1813
2712
  * }
1814
2713
  * }
1815
2714
  * ```
@@ -1818,10 +2717,7 @@ declare type QueryTableVariables = {
1818
2717
  *
1819
2718
  * ```json
1820
2719
  * {
1821
- * "columns": [
1822
- * "*",
1823
- * "team.name"
1824
- * ]
2720
+ * "columns": ["*", "team.name"]
1825
2721
  * }
1826
2722
  * ```
1827
2723
  *
@@ -1839,7 +2735,7 @@ declare type QueryTableVariables = {
1839
2735
  * "team": {
1840
2736
  * "id": "XX",
1841
2737
  * "xata": {
1842
- * "version": 0,
2738
+ * "version": 0
1843
2739
  * },
1844
2740
  * "name": "first team"
1845
2741
  * }
@@ -1850,10 +2746,7 @@ declare type QueryTableVariables = {
1850
2746
  *
1851
2747
  * ```json
1852
2748
  * {
1853
- * "columns": [
1854
- * "*",
1855
- * "team.*"
1856
- * ]
2749
+ * "columns": ["*", "team.*"]
1857
2750
  * }
1858
2751
  * ```
1859
2752
  *
@@ -1871,10 +2764,11 @@ declare type QueryTableVariables = {
1871
2764
  * "team": {
1872
2765
  * "id": "XX",
1873
2766
  * "xata": {
1874
- * "version": 0,
2767
+ * "version": 0
1875
2768
  * },
1876
2769
  * "name": "first team",
1877
- * "code": "A1"
2770
+ * "code": "A1",
2771
+ * "foundedDate": "2020-03-04T10:43:54.32Z"
1878
2772
  * }
1879
2773
  * }
1880
2774
  * ```
@@ -1889,7 +2783,7 @@ declare type QueryTableVariables = {
1889
2783
  * `$none`, etc.
1890
2784
  *
1891
2785
  * All operators start with an `$` to differentiate them from column names
1892
- * (which are not allowed to start with an dollar sign).
2786
+ * (which are not allowed to start with a dollar sign).
1893
2787
  *
1894
2788
  * #### Exact matching and control operators
1895
2789
  *
@@ -1920,7 +2814,7 @@ declare type QueryTableVariables = {
1920
2814
  * ```json
1921
2815
  * {
1922
2816
  * "filter": {
1923
- * "name": "r2",
2817
+ * "name": "r2"
1924
2818
  * }
1925
2819
  * }
1926
2820
  * ```
@@ -1942,7 +2836,7 @@ declare type QueryTableVariables = {
1942
2836
  * ```json
1943
2837
  * {
1944
2838
  * "filter": {
1945
- * "settings.plan": "free",
2839
+ * "settings.plan": "free"
1946
2840
  * }
1947
2841
  * }
1948
2842
  * ```
@@ -1952,8 +2846,8 @@ declare type QueryTableVariables = {
1952
2846
  * "filter": {
1953
2847
  * "settings": {
1954
2848
  * "plan": "free"
1955
- * },
1956
- * },
2849
+ * }
2850
+ * }
1957
2851
  * }
1958
2852
  * ```
1959
2853
  *
@@ -1962,8 +2856,8 @@ declare type QueryTableVariables = {
1962
2856
  * ```json
1963
2857
  * {
1964
2858
  * "filter": {
1965
- * "settings.plan": {"$any": ["free", "paid"]}
1966
- * },
2859
+ * "settings.plan": { "$any": ["free", "paid"] }
2860
+ * }
1967
2861
  * }
1968
2862
  * ```
1969
2863
  *
@@ -1972,9 +2866,9 @@ declare type QueryTableVariables = {
1972
2866
  * ```json
1973
2867
  * {
1974
2868
  * "filter": {
1975
- * "settings.dark": true,
1976
- * "settings.plan": "free",
1977
- * },
2869
+ * "settings.dark": true,
2870
+ * "settings.plan": "free"
2871
+ * }
1978
2872
  * }
1979
2873
  * ```
1980
2874
  *
@@ -1985,11 +2879,11 @@ declare type QueryTableVariables = {
1985
2879
  * ```json
1986
2880
  * {
1987
2881
  * "filter": {
1988
- * "$any": {
1989
- * "settings.dark": true,
1990
- * "settings.plan": "free"
1991
- * }
1992
- * },
2882
+ * "$any": {
2883
+ * "settings.dark": true,
2884
+ * "settings.plan": "free"
2885
+ * }
2886
+ * }
1993
2887
  * }
1994
2888
  * ```
1995
2889
  *
@@ -2000,10 +2894,10 @@ declare type QueryTableVariables = {
2000
2894
  * "filter": {
2001
2895
  * "$any": [
2002
2896
  * {
2003
- * "name": "r1",
2897
+ * "name": "r1"
2004
2898
  * },
2005
2899
  * {
2006
- * "name": "r2",
2900
+ * "name": "r2"
2007
2901
  * }
2008
2902
  * ]
2009
2903
  * }
@@ -2015,7 +2909,7 @@ declare type QueryTableVariables = {
2015
2909
  * ```json
2016
2910
  * {
2017
2911
  * "filter": {
2018
- * "$exists": "settings",
2912
+ * "$exists": "settings"
2019
2913
  * }
2020
2914
  * }
2021
2915
  * ```
@@ -2027,10 +2921,10 @@ declare type QueryTableVariables = {
2027
2921
  * "filter": {
2028
2922
  * "$all": [
2029
2923
  * {
2030
- * "$exists": "settings",
2924
+ * "$exists": "settings"
2031
2925
  * },
2032
2926
  * {
2033
- * "$exists": "name",
2927
+ * "$exists": "name"
2034
2928
  * }
2035
2929
  * ]
2036
2930
  * }
@@ -2042,7 +2936,7 @@ declare type QueryTableVariables = {
2042
2936
  * ```json
2043
2937
  * {
2044
2938
  * "filter": {
2045
- * "$notExists": "settings",
2939
+ * "$notExists": "settings"
2046
2940
  * }
2047
2941
  * }
2048
2942
  * ```
@@ -2069,43 +2963,59 @@ declare type QueryTableVariables = {
2069
2963
  * {
2070
2964
  * "filter": {
2071
2965
  * "<column_name>": {
2072
- * "$pattern": "v*alue*"
2966
+ * "$pattern": "v*alu?"
2073
2967
  * }
2074
2968
  * }
2075
2969
  * }
2076
2970
  * ```
2077
2971
  *
2972
+ * The `$pattern` operator accepts two wildcard characters:
2973
+ * * `*` matches zero or more characters
2974
+ * * `?` matches exactly one character
2975
+ *
2976
+ * 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.
2977
+ *
2078
2978
  * We could also have `$endsWith` and `$startsWith` operators:
2079
2979
  *
2080
2980
  * ```json
2081
2981
  * {
2082
2982
  * "filter": {
2083
2983
  * "<column_name>": {
2084
- * "$endsWith": ".gz"
2984
+ * "$endsWith": ".gz"
2085
2985
  * },
2086
2986
  * "<column_name>": {
2087
- * "$startsWith": "tmp-"
2987
+ * "$startsWith": "tmp-"
2088
2988
  * }
2089
2989
  * }
2090
2990
  * }
2091
2991
  * ```
2092
2992
  *
2093
- * #### Numeric ranges
2993
+ * #### Numeric or datetime ranges
2094
2994
  *
2095
2995
  * ```json
2096
2996
  * {
2097
2997
  * "filter": {
2098
- * "<column_name>": {
2099
- * "$ge": 0,
2100
- * "$lt": 100
2101
- * }
2998
+ * "<column_name>": {
2999
+ * "$ge": 0,
3000
+ * "$lt": 100
3001
+ * }
3002
+ * }
3003
+ * }
3004
+ * ```
3005
+ * Date ranges support the same operators, with the date using the format defined in
3006
+ * [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339):
3007
+ * ```json
3008
+ * {
3009
+ * "filter": {
3010
+ * "<column_name>": {
3011
+ * "$gt": "2019-10-12T07:20:50.52Z",
3012
+ * "$lt": "2021-10-12T07:20:50.52Z"
3013
+ * }
2102
3014
  * }
2103
3015
  * }
2104
3016
  * ```
2105
- *
2106
3017
  * The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
2107
3018
  *
2108
- *
2109
3019
  * #### Negations
2110
3020
  *
2111
3021
  * A general `$not` operator can inverse any operation.
@@ -2130,15 +3040,21 @@ declare type QueryTableVariables = {
2130
3040
  * {
2131
3041
  * "filter": {
2132
3042
  * "$not": {
2133
- * "$any": [{
2134
- * "<column_name1>": "value1"
2135
- * }, {
2136
- * "$all": [{
2137
- * "<column_name2>": "value2"
2138
- * }, {
2139
- * "<column_name3>": "value3"
2140
- * }]
2141
- * }]
3043
+ * "$any": [
3044
+ * {
3045
+ * "<column_name1>": "value1"
3046
+ * },
3047
+ * {
3048
+ * "$all": [
3049
+ * {
3050
+ * "<column_name2>": "value2"
3051
+ * },
3052
+ * {
3053
+ * "<column_name3>": "value3"
3054
+ * }
3055
+ * ]
3056
+ * }
3057
+ * ]
2142
3058
  * }
2143
3059
  * }
2144
3060
  * }
@@ -2193,8 +3109,8 @@ declare type QueryTableVariables = {
2193
3109
  * "<array name>": {
2194
3110
  * "$includes": {
2195
3111
  * "$all": [
2196
- * {"$contains": "label"},
2197
- * {"$not": {"$endsWith": "-debug"}}
3112
+ * { "$contains": "label" },
3113
+ * { "$not": { "$endsWith": "-debug" } }
2198
3114
  * ]
2199
3115
  * }
2200
3116
  * }
@@ -2214,9 +3130,7 @@ declare type QueryTableVariables = {
2214
3130
  * {
2215
3131
  * "filter": {
2216
3132
  * "settings.labels": {
2217
- * "$includesAll": [
2218
- * {"$contains": "label"},
2219
- * ]
3133
+ * "$includesAll": [{ "$contains": "label" }]
2220
3134
  * }
2221
3135
  * }
2222
3136
  * }
@@ -2264,7 +3178,6 @@ declare type QueryTableVariables = {
2264
3178
  * }
2265
3179
  * ```
2266
3180
  *
2267
- *
2268
3181
  * ### Pagination
2269
3182
  *
2270
3183
  * We offer cursor pagination and offset pagination. The offset pagination is limited
@@ -2330,8 +3243,8 @@ declare type QueryTableVariables = {
2330
3243
  * can be queried by update `page.after` to the returned cursor while keeping the
2331
3244
  * `page.before` cursor from the first range query.
2332
3245
  *
2333
- * The `filter` , `columns`, `sort` , and `page.size` configuration will be
2334
- * encoded with the cursor. The pagination request will be invalid if
3246
+ * The `filter` , `columns`, `sort` , and `page.size` configuration will be
3247
+ * encoded with the cursor. The pagination request will be invalid if
2335
3248
  * `filter` or `sort` is set. The columns returned and page size can be changed
2336
3249
  * anytime by passing the `columns` or `page.size` settings to the next query.
2337
3250
  *
@@ -2368,6 +3281,41 @@ declare type QueryTableVariables = {
2368
3281
  * ```
2369
3282
  */
2370
3283
  declare const queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
3284
+ declare type SearchTablePathParams = {
3285
+ dbBranchName: DBBranchName;
3286
+ tableName: TableName;
3287
+ workspace: string;
3288
+ };
3289
+ declare type SearchTableError = ErrorWrapper<{
3290
+ status: 400;
3291
+ payload: BadRequestError;
3292
+ } | {
3293
+ status: 401;
3294
+ payload: AuthError;
3295
+ } | {
3296
+ status: 404;
3297
+ payload: SimpleError;
3298
+ }>;
3299
+ declare type SearchTableRequestBody = {
3300
+ query: string;
3301
+ fuzziness?: FuzzinessExpression;
3302
+ prefix?: PrefixExpression;
3303
+ filter?: FilterExpression;
3304
+ highlight?: HighlightExpression;
3305
+ boosters?: BoosterExpression[];
3306
+ };
3307
+ declare type SearchTableVariables = {
3308
+ body: SearchTableRequestBody;
3309
+ pathParams: SearchTablePathParams;
3310
+ } & FetcherExtraProps;
3311
+ /**
3312
+ * Run a free text search operation in a particular table.
3313
+ *
3314
+ * 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:
3315
+ * * filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of type `text`
3316
+ * * filtering on columns of type `multiple` is currently unsupported
3317
+ */
3318
+ declare const searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2371
3319
  declare type SearchBranchPathParams = {
2372
3320
  dbBranchName: DBBranchName;
2373
3321
  workspace: string;
@@ -2383,9 +3331,14 @@ declare type SearchBranchError = ErrorWrapper<{
2383
3331
  payload: SimpleError;
2384
3332
  }>;
2385
3333
  declare type SearchBranchRequestBody = {
2386
- tables?: string[];
3334
+ tables?: (string | {
3335
+ table: string;
3336
+ filter?: FilterExpression;
3337
+ boosters?: BoosterExpression[];
3338
+ })[];
2387
3339
  query: string;
2388
- fuzziness?: number;
3340
+ fuzziness?: FuzzinessExpression;
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
+ patchDatabaseMetadata: (variables: PatchDatabaseMetadataVariables) => 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,27 @@ 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
+ getGitBranchesMapping(workspace: WorkspaceID, dbName: DBName): Promise<ListGitBranchesResponse>;
3502
+ addGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, body: AddGitBranchesEntryRequestBody): Promise<AddGitBranchesEntryResponse>;
3503
+ removeGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<void>;
3504
+ resolveBranch(workspace: WorkspaceID, dbName: DBName, gitBranch?: string, fallbackBranch?: string): Promise<ResolveBranchResponse>;
2517
3505
  }
2518
3506
  declare class BranchApi {
2519
3507
  private extraProps;
2520
3508
  constructor(extraProps: FetcherExtraProps);
2521
3509
  getBranchList(workspace: WorkspaceID, dbName: DBName): Promise<ListBranchesResponse>;
2522
3510
  getBranchDetails(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<DBBranch>;
2523
- createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<void>;
3511
+ createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<CreateBranchResponse>;
2524
3512
  deleteBranch(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<void>;
2525
3513
  updateBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName, metadata?: BranchMetadata): Promise<void>;
2526
3514
  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
3515
  getBranchStats(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<GetBranchStatsResponse>;
2531
3516
  }
2532
3517
  declare class TableApi {
2533
3518
  private extraProps;
2534
3519
  constructor(extraProps: FetcherExtraProps);
2535
- createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
3520
+ createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<CreateTableResponse>;
2536
3521
  deleteTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
2537
3522
  updateTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, options: UpdateTableRequestBody): Promise<void>;
2538
3523
  getTableSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<GetTableSchemaResponse>;
@@ -2546,16 +3531,42 @@ declare class TableApi {
2546
3531
  declare class RecordsApi {
2547
3532
  private extraProps;
2548
3533
  constructor(extraProps: FetcherExtraProps);
2549
- insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>): Promise<InsertRecordResponse>;
3534
+ insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>, options?: InsertRecordQueryParams): Promise<RecordUpdateResponse>;
2550
3535
  insertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: InsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2551
3536
  updateRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpdateRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2552
3537
  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>;
3538
+ deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: DeleteRecordQueryParams): Promise<RecordUpdateResponse>;
3539
+ getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordQueryParams): Promise<XataRecord$1>;
3540
+ bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[], options?: BulkInsertTableRecordsQueryParams): Promise<BulkInsertResponse>;
2556
3541
  queryTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: QueryTableRequestBody): Promise<QueryResponse>;
3542
+ searchTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: SearchTableRequestBody): Promise<SearchResponse>;
2557
3543
  searchBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, query: SearchBranchRequestBody): Promise<SearchResponse>;
2558
3544
  }
3545
+ declare class MigrationRequestsApi {
3546
+ private extraProps;
3547
+ constructor(extraProps: FetcherExtraProps);
3548
+ listMigrationRequests(workspace: WorkspaceID, database: DBName, options?: ListMigrationRequestsRequestBody): Promise<ListMigrationRequestsResponse>;
3549
+ createMigrationRequest(workspace: WorkspaceID, database: DBName, options: CreateMigrationRequestRequestBody): Promise<CreateMigrationRequestResponse>;
3550
+ getMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<MigrationRequest>;
3551
+ updateMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number, options: UpdateMigrationRequestRequestBody): Promise<void>;
3552
+ listMigrationRequestsCommits(workspace: WorkspaceID, database: DBName, migrationRequest: number, options?: ListMigrationRequestsCommitsRequestBody): Promise<ListMigrationRequestsCommitsResponse>;
3553
+ compareMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<SchemaCompareResponse>;
3554
+ getMigrationRequestIsMerged(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<GetMigrationRequestIsMergedResponse>;
3555
+ mergeMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<Commit>;
3556
+ }
3557
+ declare class BranchSchemaApi {
3558
+ private extraProps;
3559
+ constructor(extraProps: FetcherExtraProps);
3560
+ getBranchMigrationHistory(workspace: WorkspaceID, database: DBName, branch: BranchName, options?: GetBranchMigrationHistoryRequestBody): Promise<GetBranchMigrationHistoryResponse>;
3561
+ executeBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, migrationPlan: ExecuteBranchMigrationPlanRequestBody): Promise<void>;
3562
+ getBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, schema: Schema): Promise<BranchMigrationPlan>;
3563
+ compareBranchWithUserSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, schema: Schema): Promise<SchemaCompareResponse>;
3564
+ compareBranchSchemas(workspace: WorkspaceID, database: DBName, branch: BranchName, branchName: BranchName, schema: Schema): Promise<SchemaCompareResponse>;
3565
+ updateBranchSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, migration: Migration): Promise<UpdateBranchSchemaResponse>;
3566
+ previewBranchSchemaEdit(workspace: WorkspaceID, database: DBName, branch: BranchName, migration: Migration): Promise<PreviewBranchSchemaEditResponse>;
3567
+ applyBranchSchemaEdit(workspace: WorkspaceID, database: DBName, branch: BranchName, edits: SchemaEditScript): Promise<ApplyBranchSchemaEditResponse>;
3568
+ getBranchSchemaHistory(workspace: WorkspaceID, database: DBName, branch: BranchName, options?: GetBranchSchemaHistoryRequestBody): Promise<GetBranchSchemaHistoryResponse>;
3569
+ }
2559
3570
 
2560
3571
  declare class XataApiPlugin implements XataPlugin {
2561
3572
  build(options: XataPluginOptions): Promise<XataApiClient>;
@@ -2567,28 +3578,29 @@ declare type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) ex
2567
3578
  declare type If<Condition, Then, Else> = Condition extends true ? Then : Else;
2568
3579
  declare type IsObject<T> = T extends Record<string, any> ? true : false;
2569
3580
  declare type IsArray<T> = T extends Array<any> ? true : false;
2570
- declare type NonEmptyArray<T> = T[] & {
2571
- 0: T;
2572
- };
2573
3581
  declare type RequiredBy<T, K extends keyof T> = T & {
2574
3582
  [P in K]-?: NonNullable<T[P]>;
2575
3583
  };
2576
3584
  declare type GetArrayInnerType<T extends readonly any[]> = T[number];
2577
3585
  declare type SingleOrArray<T> = T | T[];
2578
- declare type Dictionary<T> = Record<string, T>;
3586
+ declare type OmitBy<T, K extends keyof T> = T extends any ? Omit<T, K> : never;
3587
+ declare type Without<T, U> = {
3588
+ [P in Exclude<keyof T, keyof U>]?: never;
3589
+ };
3590
+ declare type ExclusiveOr<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
2579
3591
 
2580
3592
  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;
3593
+ declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord<O> & UnionToIntersection<Values<{
3594
+ [K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord<O>;
2583
3595
  }>>;
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;
3596
+ 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> ? {
3597
+ V: ValueAtColumn<Item, V>;
3598
+ } : never : O[K] : never> : never : never;
2587
3599
  declare type MAX_RECURSION = 5;
2588
3600
  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>>;
3601
+ [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
3602
+ 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
3603
+ K>> : never;
2592
3604
  }>, never>;
2593
3605
  declare type DataProps<O> = Exclude<StringKeys<O>, StringKeys<XataRecord>>;
2594
3606
  declare type NestedValueAtColumn<O, Key extends SelectableColumn<O>> = Key extends `${infer N}.${infer M}` ? N extends DataProps<O> ? {
@@ -2615,56 +3627,85 @@ interface BaseData {
2615
3627
  /**
2616
3628
  * Represents a persisted record from the database.
2617
3629
  */
2618
- interface XataRecord extends Identifiable {
3630
+ interface XataRecord<OriginalRecord extends XataRecord<any> = XataRecord<any>> extends Identifiable {
2619
3631
  /**
2620
- * Metadata of this record.
3632
+ * Get metadata of this record.
2621
3633
  */
2622
- xata: {
2623
- /**
2624
- * Number that is increased every time the record is updated.
2625
- */
2626
- version: number;
2627
- };
3634
+ getMetadata(): XataRecordMetadata;
2628
3635
  /**
2629
3636
  * Retrieves a refreshed copy of the current record from the database.
3637
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3638
+ * @returns The persisted record with the selected columns, null if not found.
2630
3639
  */
2631
- read(): Promise<Readonly<SelectedPick<this, ['*']>> | null>;
3640
+ read<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
3641
+ /**
3642
+ * Retrieves a refreshed copy of the current record from the database.
3643
+ * @returns The persisted record with all first level properties, null if not found.
3644
+ */
3645
+ read(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2632
3646
  /**
2633
3647
  * Performs a partial update of the current record. On success a new object is
2634
3648
  * 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.
3649
+ * @param partialUpdate The columns and their values that have to be updated.
3650
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3651
+ * @returns The persisted record with the selected columns, null if not found.
2637
3652
  */
2638
- update(partialUpdate: Partial<EditableData<Omit<this, keyof XataRecord>>>): Promise<Readonly<SelectedPick<this, ['*']>>>;
3653
+ update<K extends SelectableColumn<OriginalRecord>>(partialUpdate: Partial<EditableData<OriginalRecord>>, columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
3654
+ /**
3655
+ * Performs a partial update of the current record. On success a new object is
3656
+ * returned and the current object is not mutated.
3657
+ * @param partialUpdate The columns and their values that have to be updated.
3658
+ * @returns The persisted record with all first level properties, null if not found.
3659
+ */
3660
+ update(partialUpdate: Partial<EditableData<OriginalRecord>>): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2639
3661
  /**
2640
3662
  * 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.
3663
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3664
+ * @returns The deleted record, null if not found.
2643
3665
  */
2644
- delete(): Promise<void>;
3666
+ delete<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
3667
+ /**
3668
+ * Performs a deletion of the current record in the database.
3669
+ * @returns The deleted record, null if not found.
3670
+
3671
+ */
3672
+ delete(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2645
3673
  }
2646
3674
  declare type Link<Record extends XataRecord> = Omit<XataRecord, 'read' | 'update'> & {
2647
3675
  /**
2648
3676
  * Retrieves a refreshed copy of the current record from the database.
2649
3677
  */
2650
- read(): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3678
+ read<K extends SelectableColumn<Record>>(columns?: K[]): Promise<Readonly<SelectedPick<Record, typeof columns extends SelectableColumn<Record>[] ? typeof columns : ['*']>> | null>;
2651
3679
  /**
2652
3680
  * Performs a partial update of the current record. On success a new object is
2653
3681
  * returned and the current object is not mutated.
2654
- * @param data The columns and their values that have to be updated.
3682
+ * @param partialUpdate The columns and their values that have to be updated.
2655
3683
  * @returns A new record containing the latest values for all the columns of the current record.
2656
3684
  */
2657
- update(partialUpdate: Partial<EditableData<Omit<Record, keyof XataRecord>>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3685
+ update<K extends SelectableColumn<Record>>(partialUpdate: Partial<EditableData<Record>>, columns?: K[]): Promise<Readonly<SelectedPick<Record, typeof columns extends SelectableColumn<Record>[] ? typeof columns : ['*']>>>;
3686
+ /**
3687
+ * Performs a deletion of the current record in the database.
3688
+ *
3689
+ * @throws If the record was already deleted or if an error happened while performing the deletion.
3690
+ */
3691
+ delete(): Promise<void>;
3692
+ };
3693
+ declare type XataRecordMetadata = {
3694
+ /**
3695
+ * Number that is increased every time the record is updated.
3696
+ */
3697
+ version: number;
3698
+ warnings?: string[];
2658
3699
  };
2659
3700
  declare function isIdentifiable(x: any): x is Identifiable & Record<string, unknown>;
2660
3701
  declare function isXataRecord(x: any): x is XataRecord & Record<string, unknown>;
2661
- declare type EditableData<O extends BaseData> = {
3702
+ declare type EditableData<O extends XataRecord> = Identifiable & Omit<{
2662
3703
  [K in keyof O]: O[K] extends XataRecord ? {
2663
3704
  id: string;
2664
- } : NonNullable<O[K]> extends XataRecord ? {
3705
+ } | string : NonNullable<O[K]> extends XataRecord ? {
2665
3706
  id: string;
2666
- } | null | undefined : O[K];
2667
- };
3707
+ } | string | null | undefined : O[K];
3708
+ }, keyof XataRecord>;
2668
3709
 
2669
3710
  /**
2670
3711
  * PropertyMatchFilter
@@ -2739,8 +3780,8 @@ declare type ValueTypeFilters<T> = T | T extends string ? StringTypeFilter : T e
2739
3780
  ],
2740
3781
  }
2741
3782
  */
2742
- declare type AggregatorFilter<Record> = {
2743
- [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<Record>>;
3783
+ declare type AggregatorFilter<T> = {
3784
+ [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<T>>;
2744
3785
  };
2745
3786
  /**
2746
3787
  * Existance filter
@@ -2749,16 +3790,94 @@ declare type AggregatorFilter<Record> = {
2749
3790
  declare type ExistanceFilter<Record> = {
2750
3791
  [key in '$exists' | '$notExists']?: SelectableColumn<Record>;
2751
3792
  };
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>;
3793
+ declare type BaseApiFilter<Record> = PropertyAccessFilter<Record> | AggregatorFilter<Record> | ExistanceFilter<Record>;
3794
+ /**
3795
+ * Nested filter
3796
+ * Injects the Api filters on nested properties
3797
+ * Example: { filter: { settings: { plan: { $any: ['free', 'trial'] } } } }
3798
+ */
3799
+ declare type NestedApiFilter<T> = {
3800
+ [key in keyof T]?: T[key] extends Record<string, any> ? SingleOrArray<Filter<T[key]>> : PropertyFilter<T[key]>;
3801
+ };
3802
+ 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>;
3803
+
3804
+ declare type DateBooster = {
3805
+ origin?: string;
3806
+ scale: string;
3807
+ decay: number;
3808
+ };
3809
+ declare type NumericBooster = {
3810
+ factor: number;
3811
+ };
3812
+ declare type ValueBooster<T extends string | number | boolean> = {
3813
+ value: T;
3814
+ factor: number;
3815
+ };
3816
+ declare type Boosters<O extends XataRecord> = Values<{
3817
+ [K in SelectableColumn<O>]: NonNullable<ValueAtColumn<O, K>> extends Date ? {
3818
+ dateBooster: {
3819
+ column: K;
3820
+ } & DateBooster;
3821
+ } : NonNullable<ValueAtColumn<O, K>> extends number ? ExclusiveOr<{
3822
+ numericBooster?: {
3823
+ column: K;
3824
+ } & NumericBooster;
3825
+ }, {
3826
+ valueBooster?: {
3827
+ column: K;
3828
+ } & ValueBooster<number>;
3829
+ }> : NonNullable<ValueAtColumn<O, K>> extends string | boolean ? {
3830
+ valueBooster: {
3831
+ column: K;
3832
+ } & ValueBooster<NonNullable<ValueAtColumn<O, K>>>;
3833
+ } : never;
3834
+ }>;
3835
+
3836
+ declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3837
+ fuzziness?: FuzzinessExpression;
3838
+ prefix?: PrefixExpression;
3839
+ highlight?: HighlightExpression;
3840
+ tables?: Array<Tables | Values<{
3841
+ [Model in GetArrayInnerType<NonNullable<Tables[]>>]: {
3842
+ table: Model;
3843
+ filter?: Filter<SelectedPick<Schemas[Model] & XataRecord, ['*']>>;
3844
+ boosters?: Boosters<Schemas[Model] & XataRecord>[];
3845
+ };
3846
+ }>>;
3847
+ };
3848
+ declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3849
+ all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3850
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]: {
3851
+ table: Model;
3852
+ record: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>>;
3853
+ };
3854
+ }>[]>;
3855
+ byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3856
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]?: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>[]>;
3857
+ }>;
3858
+ };
3859
+ declare class SearchPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin {
3860
+ #private;
3861
+ private db;
3862
+ constructor(db: SchemaPluginResult<Schemas>, schemaTables?: Schemas.Table[]);
3863
+ build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
3864
+ }
3865
+ declare type SearchXataRecord<Record extends XataRecord> = Omit<Record, 'getMetadata'> & {
3866
+ getMetadata: () => XataRecordMetadata & SearchExtraProperties;
3867
+ };
3868
+ declare type SearchExtraProperties = {
3869
+ table: string;
3870
+ highlight?: {
3871
+ [key: string]: string[] | {
3872
+ [key: string]: any;
3873
+ };
3874
+ };
3875
+ score?: number;
3876
+ };
3877
+ declare type ReturnTable<Table, Tables> = Table extends Tables ? Table : never;
3878
+ 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 {
3879
+ table: infer Table;
3880
+ } ? ReturnTable<Table, Tables> : never;
2762
3881
 
2763
3882
  declare type SortDirection = 'asc' | 'desc';
2764
3883
  declare type SortFilterExtended<T extends XataRecord> = {
@@ -2770,12 +3889,21 @@ declare type SortFilterBase<T extends XataRecord> = {
2770
3889
  [Key in StringKeys<T>]: SortDirection;
2771
3890
  };
2772
3891
 
2773
- declare type QueryOptions<T extends XataRecord> = {
2774
- page?: PaginationOptions;
2775
- columns?: NonEmptyArray<SelectableColumn<T>>;
3892
+ declare type BaseOptions<T extends XataRecord> = {
3893
+ columns?: SelectableColumn<T>[];
3894
+ cache?: number;
3895
+ };
3896
+ declare type CursorQueryOptions = {
3897
+ pagination?: CursorNavigationOptions & OffsetNavigationOptions;
3898
+ filter?: never;
3899
+ sort?: never;
3900
+ };
3901
+ declare type OffsetQueryOptions<T extends XataRecord> = {
3902
+ pagination?: OffsetNavigationOptions;
2776
3903
  filter?: FilterExpression;
2777
3904
  sort?: SortFilter<T> | SortFilter<T>[];
2778
3905
  };
3906
+ declare type QueryOptions<T extends XataRecord> = BaseOptions<T> & (CursorQueryOptions | OffsetQueryOptions<T>);
2779
3907
  /**
2780
3908
  * Query objects contain the information of all filters, sorting, etc. to be included in the database query.
2781
3909
  *
@@ -2785,9 +3913,13 @@ declare type QueryOptions<T extends XataRecord> = {
2785
3913
  declare class Query<Record extends XataRecord, Result extends XataRecord = Record> implements Paginable<Record, Result> {
2786
3914
  #private;
2787
3915
  readonly meta: PaginationQueryMeta;
2788
- readonly records: Result[];
2789
- constructor(repository: Repository<Record> | null, table: string, data: Partial<QueryOptions<Record>>, parent?: Partial<QueryOptions<Record>>);
3916
+ readonly records: RecordArray<Result>;
3917
+ constructor(repository: Repository<Record> | null, table: {
3918
+ name: string;
3919
+ schema?: Table;
3920
+ }, data: Partial<QueryOptions<Record>>, rawParent?: Partial<QueryOptions<Record>>);
2790
3921
  getQueryOptions(): QueryOptions<Record>;
3922
+ key(): string;
2791
3923
  /**
2792
3924
  * Builds a new query object representing a logical OR between the given subqueries.
2793
3925
  * @param queries An array of subqueries.
@@ -2817,67 +3949,186 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
2817
3949
  *
2818
3950
  * ```
2819
3951
  * query.filter("columnName", columnValue)
2820
- * query.filter({
2821
- * "columnName": columnValue
2822
- * })
3952
+ * query.filter("columnName", operator(columnValue)) // Use gt, gte, lt, lte, startsWith,...
3953
+ * ```
3954
+ *
3955
+ * @param column The name of the column to filter.
3956
+ * @param value The value to filter.
3957
+ * @returns A new Query object.
3958
+ */
3959
+ filter<F extends SelectableColumn<Record>>(column: F, value: Filter<NonNullable<ValueAtColumn<Record, F>>>): Query<Record, Result>;
3960
+ /**
3961
+ * Builds a new query object adding one or more constraints. Examples:
3962
+ *
3963
+ * ```
3964
+ * query.filter({ "columnName": columnValue })
2823
3965
  * query.filter({
2824
3966
  * "columnName": operator(columnValue) // Use gt, gte, lt, lte, startsWith,...
2825
3967
  * })
2826
3968
  * ```
2827
3969
  *
3970
+ * @param filters A filter object
2828
3971
  * @returns A new Query object.
2829
3972
  */
2830
- filter(filters: Filter<Record>): Query<Record, Result>;
2831
- filter<F extends SelectableColumn<Record>>(column: F, value: Filter<ValueAtColumn<Record, F>>): Query<Record, Result>;
3973
+ filter(filters?: Filter<Record>): Query<Record, Result>;
3974
+ defaultFilter<T>(column: string, value: T): T | {
3975
+ $includes: (T & string) | (T & string[]);
3976
+ };
2832
3977
  /**
2833
3978
  * Builds a new query with a new sort option.
2834
3979
  * @param column The column name.
2835
3980
  * @param direction The direction. Either ascending or descending.
2836
3981
  * @returns A new Query object.
2837
3982
  */
2838
- sort<F extends SelectableColumn<Record>>(column: F, direction: SortDirection): Query<Record, Result>;
3983
+ sort<F extends SelectableColumn<Record>>(column: F, direction?: SortDirection): Query<Record, Result>;
2839
3984
  /**
2840
3985
  * Builds a new query specifying the set of columns to be returned in the query response.
2841
3986
  * @param columns Array of column names to be returned by the query.
2842
3987
  * @returns A new Query object.
2843
3988
  */
2844
- select<K extends SelectableColumn<Record>>(columns: NonEmptyArray<K>): Query<Record, SelectedPick<Record, NonEmptyArray<K>>>;
3989
+ select<K extends SelectableColumn<Record>>(columns: K[]): Query<Record, SelectedPick<Record, K[]>>;
3990
+ /**
3991
+ * Get paginated results
3992
+ *
3993
+ * @returns A page of results
3994
+ */
2845
3995
  getPaginated(): Promise<Page<Record, Result>>;
2846
- getPaginated(options: Omit<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
3996
+ /**
3997
+ * Get paginated results
3998
+ *
3999
+ * @param options Pagination options
4000
+ * @returns A page of results
4001
+ */
4002
+ getPaginated(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
4003
+ /**
4004
+ * Get paginated results
4005
+ *
4006
+ * @param options Pagination options
4007
+ * @returns A page of results
4008
+ */
2847
4009
  getPaginated<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<Page<Record, SelectedPick<Record, typeof options['columns']>>>;
4010
+ /**
4011
+ * Get results in an iterator
4012
+ *
4013
+ * @async
4014
+ * @returns Async interable of results
4015
+ */
2848
4016
  [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']>[]>;
4017
+ /**
4018
+ * Build an iterator of results
4019
+ *
4020
+ * @returns Async generator of results array
4021
+ */
4022
+ getIterator(): AsyncGenerator<Result[]>;
4023
+ /**
4024
+ * Build an iterator of results
4025
+ *
4026
+ * @param options Pagination options with batchSize
4027
+ * @returns Async generator of results array
4028
+ */
4029
+ getIterator(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
4030
+ batchSize?: number;
4031
+ }): AsyncGenerator<Result[]>;
4032
+ /**
4033
+ * Build an iterator of results
4034
+ *
4035
+ * @param options Pagination options with batchSize
4036
+ * @returns Async generator of results array
4037
+ */
4038
+ getIterator<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
4039
+ batchSize?: number;
4040
+ }>(options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
4041
+ /**
4042
+ * Performs the query in the database and returns a set of results.
4043
+ * @returns An array of records from the database.
4044
+ */
4045
+ getMany(): Promise<RecordArray<Result>>;
4046
+ /**
4047
+ * Performs the query in the database and returns a set of results.
4048
+ * @param options Additional options to be used when performing the query.
4049
+ * @returns An array of records from the database.
4050
+ */
4051
+ getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<RecordArray<SelectedPick<Record, typeof options['columns']>>>;
2852
4052
  /**
2853
4053
  * Performs the query in the database and returns a set of results.
2854
4054
  * @param options Additional options to be used when performing the query.
2855
4055
  * @returns An array of records from the database.
2856
4056
  */
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']>[]>;
4057
+ getMany(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<RecordArray<Result>>;
4058
+ /**
4059
+ * Performs the query in the database and returns all the results.
4060
+ * Warning: If there are a large number of results, this method can have performance implications.
4061
+ * @returns An array of records from the database.
4062
+ */
4063
+ getAll(): Promise<Result[]>;
4064
+ /**
4065
+ * Performs the query in the database and returns all the results.
4066
+ * Warning: If there are a large number of results, this method can have performance implications.
4067
+ * @param options Additional options to be used when performing the query.
4068
+ * @returns An array of records from the database.
4069
+ */
4070
+ getAll<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
4071
+ batchSize?: number;
4072
+ }>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
2860
4073
  /**
2861
4074
  * Performs the query in the database and returns all the results.
2862
4075
  * Warning: If there are a large number of results, this method can have performance implications.
2863
4076
  * @param options Additional options to be used when performing the query.
2864
4077
  * @returns An array of records from the database.
2865
4078
  */
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']>[]>;
4079
+ getAll(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
4080
+ batchSize?: number;
4081
+ }): Promise<Result[]>;
4082
+ /**
4083
+ * Performs the query in the database and returns the first result.
4084
+ * @returns The first record that matches the query, or null if no record matched the query.
4085
+ */
4086
+ getFirst(): Promise<Result | null>;
4087
+ /**
4088
+ * Performs the query in the database and returns the first result.
4089
+ * @param options Additional options to be used when performing the query.
4090
+ * @returns The first record that matches the query, or null if no record matched the query.
4091
+ */
4092
+ getFirst<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
2869
4093
  /**
2870
4094
  * Performs the query in the database and returns the first result.
2871
4095
  * @param options Additional options to be used when performing the query.
2872
4096
  * @returns The first record that matches the query, or null if no record matched the query.
2873
4097
  */
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>;
4098
+ getFirst(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result | null>;
4099
+ /**
4100
+ * Builds a new query object adding a cache TTL in milliseconds.
4101
+ * @param ttl The cache TTL in milliseconds.
4102
+ * @returns A new Query object.
4103
+ */
4104
+ cache(ttl: number): Query<Record, Result>;
4105
+ /**
4106
+ * Retrieve next page of records
4107
+ *
4108
+ * @returns A new page object.
4109
+ */
2877
4110
  nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4111
+ /**
4112
+ * Retrieve previous page of records
4113
+ *
4114
+ * @returns A new page object
4115
+ */
2878
4116
  previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4117
+ /**
4118
+ * Retrieve first page of records
4119
+ *
4120
+ * @returns A new page object
4121
+ */
2879
4122
  firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4123
+ /**
4124
+ * Retrieve last page of records
4125
+ *
4126
+ * @returns A new page object
4127
+ */
2880
4128
  lastPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4129
+ /**
4130
+ * @returns Boolean indicating if there is a next page
4131
+ */
2881
4132
  hasNextPage(): boolean;
2882
4133
  }
2883
4134
 
@@ -2889,7 +4140,7 @@ declare type PaginationQueryMeta = {
2889
4140
  };
2890
4141
  interface Paginable<Record extends XataRecord, Result extends XataRecord = Record> {
2891
4142
  meta: PaginationQueryMeta;
2892
- records: Result[];
4143
+ records: RecordArray<Result>;
2893
4144
  nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
2894
4145
  previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
2895
4146
  firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
@@ -2909,7 +4160,7 @@ declare class Page<Record extends XataRecord, Result extends XataRecord = Record
2909
4160
  /**
2910
4161
  * The set of results for this page.
2911
4162
  */
2912
- readonly records: Result[];
4163
+ readonly records: RecordArray<Result>;
2913
4164
  constructor(query: Query<Record, Result>, meta: PaginationQueryMeta, records?: Result[]);
2914
4165
  /**
2915
4166
  * Retrieves the next page of results.
@@ -2957,64 +4208,198 @@ declare type OffsetNavigationOptions = {
2957
4208
  size?: number;
2958
4209
  offset?: number;
2959
4210
  };
2960
- declare type PaginationOptions = CursorNavigationOptions & OffsetNavigationOptions;
2961
4211
  declare const PAGINATION_MAX_SIZE = 200;
2962
- declare const PAGINATION_DEFAULT_SIZE = 200;
4212
+ declare const PAGINATION_DEFAULT_SIZE = 20;
2963
4213
  declare const PAGINATION_MAX_OFFSET = 800;
2964
4214
  declare const PAGINATION_DEFAULT_OFFSET = 0;
4215
+ declare function isCursorPaginationOptions(options: Record<string, unknown> | undefined | null): options is CursorNavigationOptions;
4216
+ declare class RecordArray<Result extends XataRecord> extends Array<Result> {
4217
+ #private;
4218
+ constructor(page: Paginable<any, Result>, overrideRecords?: Result[]);
4219
+ static parseConstructorParams(...args: any[]): any[];
4220
+ toArray(): Result[];
4221
+ map<U>(callbackfn: (value: Result, index: number, array: Result[]) => U, thisArg?: any): U[];
4222
+ /**
4223
+ * Retrieve next page of records
4224
+ *
4225
+ * @returns A new array of objects
4226
+ */
4227
+ nextPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4228
+ /**
4229
+ * Retrieve previous page of records
4230
+ *
4231
+ * @returns A new array of objects
4232
+ */
4233
+ previousPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4234
+ /**
4235
+ * Retrieve first page of records
4236
+ *
4237
+ * @returns A new array of objects
4238
+ */
4239
+ firstPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4240
+ /**
4241
+ * Retrieve last page of records
4242
+ *
4243
+ * @returns A new array of objects
4244
+ */
4245
+ lastPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4246
+ /**
4247
+ * @returns Boolean indicating if there is a next page
4248
+ */
4249
+ hasNextPage(): boolean;
4250
+ }
2965
4251
 
2966
- declare type TableLink = string[];
2967
- declare type LinkDictionary = Dictionary<TableLink[]>;
2968
4252
  /**
2969
4253
  * Common interface for performing operations on a table.
2970
4254
  */
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, ['*']>>>;
4255
+ declare abstract class Repository<Record extends XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
4256
+ abstract create<K extends SelectableColumn<Record>>(object: Omit<EditableData<Record>, 'id'> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4257
+ abstract create(object: Omit<EditableData<Record>, 'id'> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4258
+ /**
4259
+ * Creates a single record in the table with a unique id.
4260
+ * @param id The unique id.
4261
+ * @param object Object containing the column names with their values to be stored in the table.
4262
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4263
+ * @returns The full persisted record.
4264
+ */
4265
+ abstract create<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
2973
4266
  /**
2974
4267
  * Creates a single record in the table with a unique id.
2975
4268
  * @param id The unique id.
2976
4269
  * @param object Object containing the column names with their values to be stored in the table.
2977
4270
  * @returns The full persisted record.
2978
4271
  */
2979
- abstract create(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4272
+ abstract create(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
2980
4273
  /**
2981
4274
  * Creates multiple records in the table.
2982
4275
  * @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.
4276
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4277
+ * @returns Array of the persisted records in order.
4278
+ */
4279
+ abstract create<K extends SelectableColumn<Record>>(objects: Array<Omit<EditableData<Record>, 'id'> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4280
+ /**
4281
+ * Creates multiple records in the table.
4282
+ * @param objects Array of objects with the column names and the values to be stored in the table.
4283
+ * @returns Array of the persisted records in order.
4284
+ */
4285
+ abstract create(objects: Array<Omit<EditableData<Record>, 'id'> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4286
+ /**
4287
+ * Queries a single record from the table given its unique id.
4288
+ * @param id The unique id.
4289
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4290
+ * @returns The persisted record for the given id or null if the record could not be found.
2984
4291
  */
2985
- abstract create(objects: Array<EditableData<Data> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4292
+ abstract read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
2986
4293
  /**
2987
4294
  * Queries a single record from the table given its unique id.
2988
4295
  * @param id The unique id.
2989
4296
  * @returns The persisted record for the given id or null if the record could not be found.
2990
4297
  */
2991
4298
  abstract read(id: string): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4299
+ /**
4300
+ * Queries multiple records from the table given their unique id.
4301
+ * @param ids The unique ids array.
4302
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4303
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4304
+ */
4305
+ abstract read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4306
+ /**
4307
+ * Queries multiple records from the table given their unique id.
4308
+ * @param ids The unique ids array.
4309
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4310
+ */
4311
+ abstract read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4312
+ /**
4313
+ * Queries a single record from the table by the id in the object.
4314
+ * @param object Object containing the id of the record.
4315
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4316
+ * @returns The persisted record for the given id or null if the record could not be found.
4317
+ */
4318
+ abstract read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
4319
+ /**
4320
+ * Queries a single record from the table by the id in the object.
4321
+ * @param object Object containing the id of the record.
4322
+ * @returns The persisted record for the given id or null if the record could not be found.
4323
+ */
4324
+ abstract read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4325
+ /**
4326
+ * Queries multiple records from the table by the ids in the objects.
4327
+ * @param objects Array of objects containing the ids of the records.
4328
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4329
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4330
+ */
4331
+ abstract read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4332
+ /**
4333
+ * Queries multiple records from the table by the ids in the objects.
4334
+ * @param objects Array of objects containing the ids of the records.
4335
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4336
+ */
4337
+ abstract read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
2992
4338
  /**
2993
4339
  * Partially update a single record.
2994
4340
  * @param object An object with its id and the columns to be updated.
2995
- * @returns The full persisted record.
4341
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4342
+ * @returns The full persisted record, null if the record could not be found.
4343
+ */
4344
+ abstract update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4345
+ /**
4346
+ * Partially update a single record.
4347
+ * @param object An object with its id and the columns to be updated.
4348
+ * @returns The full persisted record, null if the record could not be found.
2996
4349
  */
2997
- abstract update(object: Partial<EditableData<Data>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4350
+ abstract update(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
2998
4351
  /**
2999
4352
  * Partially update a single record given its unique id.
3000
4353
  * @param id The unique id.
3001
4354
  * @param object The column names and their values that have to be updated.
3002
- * @returns The full persisted record.
4355
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4356
+ * @returns The full persisted record, null if the record could not be found.
4357
+ */
4358
+ abstract update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4359
+ /**
4360
+ * Partially update a single record given its unique id.
4361
+ * @param id The unique id.
4362
+ * @param object The column names and their values that have to be updated.
4363
+ * @returns The full persisted record, null if the record could not be found.
3003
4364
  */
3004
- abstract update(id: string, object: Partial<EditableData<Data>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4365
+ abstract update(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3005
4366
  /**
3006
4367
  * Partially updates multiple records.
3007
4368
  * @param objects An array of objects with their ids and columns to be updated.
3008
- * @returns Array of the persisted records.
4369
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4370
+ * @returns Array of the persisted records in order (if a record could not be found null is returned).
4371
+ */
4372
+ abstract update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4373
+ /**
4374
+ * Partially updates multiple records.
4375
+ * @param objects An array of objects with their ids and columns to be updated.
4376
+ * @returns Array of the persisted records in order (if a record could not be found null is returned).
4377
+ */
4378
+ abstract update(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4379
+ /**
4380
+ * Creates or updates a single record. If a record exists with the given id,
4381
+ * it will be update, otherwise a new record will be created.
4382
+ * @param object Object containing the column names with their values to be persisted in the table.
4383
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4384
+ * @returns The full persisted record.
3009
4385
  */
3010
- abstract update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4386
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Record> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3011
4387
  /**
3012
4388
  * Creates or updates a single record. If a record exists with the given id,
3013
4389
  * it will be update, otherwise a new record will be created.
3014
4390
  * @param object Object containing the column names with their values to be persisted in the table.
3015
4391
  * @returns The full persisted record.
3016
4392
  */
3017
- abstract createOrUpdate(object: EditableData<Data> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4393
+ abstract createOrUpdate(object: EditableData<Record> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4394
+ /**
4395
+ * Creates or updates a single record. If a record exists with the given id,
4396
+ * it will be update, otherwise a new record will be created.
4397
+ * @param id A unique id.
4398
+ * @param object The column names and the values to be persisted.
4399
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4400
+ * @returns The full persisted record.
4401
+ */
4402
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3018
4403
  /**
3019
4404
  * Creates or updates a single record. If a record exists with the given id,
3020
4405
  * it will be update, otherwise a new record will be created.
@@ -3022,38 +4407,74 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3022
4407
  * @param object The column names and the values to be persisted.
3023
4408
  * @returns The full persisted record.
3024
4409
  */
3025
- abstract createOrUpdate(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4410
+ abstract createOrUpdate(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4411
+ /**
4412
+ * Creates or updates a single record. If a record exists with the given id,
4413
+ * it will be update, otherwise a new record will be created.
4414
+ * @param objects Array of objects with the column names and the values to be stored in the table.
4415
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4416
+ * @returns Array of the persisted records.
4417
+ */
4418
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3026
4419
  /**
3027
4420
  * Creates or updates a single record. If a record exists with the given id,
3028
4421
  * it will be update, otherwise a new record will be created.
3029
4422
  * @param objects Array of objects with the column names and the values to be stored in the table.
3030
4423
  * @returns Array of the persisted records.
3031
4424
  */
3032
- abstract createOrUpdate(objects: Array<EditableData<Data> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4425
+ abstract createOrUpdate(objects: Array<EditableData<Record> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3033
4426
  /**
3034
4427
  * 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.
4428
+ * @param object An object with a unique id.
4429
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4430
+ * @returns The deleted record, null if the record could not be found.
3037
4431
  */
3038
- abstract delete(id: string): Promise<void>;
4432
+ abstract delete<K extends SelectableColumn<Record>>(object: Identifiable & Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3039
4433
  /**
3040
4434
  * 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.
4435
+ * @param object An object with a unique id.
4436
+ * @returns The deleted record, null if the record could not be found.
3043
4437
  */
3044
- abstract delete(id: Identifiable): Promise<void>;
4438
+ abstract delete(object: Identifiable & Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3045
4439
  /**
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.
4440
+ * Deletes a record given a unique id.
4441
+ * @param id The unique id.
4442
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4443
+ * @returns The deleted record, null if the record could not be found.
4444
+ */
4445
+ abstract delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4446
+ /**
4447
+ * Deletes a record given a unique id.
4448
+ * @param id The unique id.
4449
+ * @returns The deleted record, null if the record could not be found.
4450
+ */
4451
+ abstract delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4452
+ /**
4453
+ * Deletes multiple records given an array of objects with ids.
4454
+ * @param objects An array of objects with unique ids.
4455
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4456
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4457
+ */
4458
+ abstract delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4459
+ /**
4460
+ * Deletes multiple records given an array of objects with ids.
4461
+ * @param objects An array of objects with unique ids.
4462
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
3049
4463
  */
3050
- abstract delete(ids: string[]): Promise<void>;
4464
+ abstract delete(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3051
4465
  /**
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.
4466
+ * Deletes multiple records given an array of unique ids.
4467
+ * @param objects An array of ids.
4468
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4469
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
3055
4470
  */
3056
- abstract delete(ids: Identifiable[]): Promise<void>;
4471
+ abstract delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4472
+ /**
4473
+ * Deletes multiple records given an array of unique ids.
4474
+ * @param objects An array of ids.
4475
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4476
+ */
4477
+ abstract delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3057
4478
  /**
3058
4479
  * Search for records in the table.
3059
4480
  * @param query The query to search for.
@@ -3061,36 +4482,123 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3061
4482
  * @returns The found records.
3062
4483
  */
3063
4484
  abstract search(query: string, options?: {
3064
- fuzziness?: number;
3065
- }): Promise<SelectedPick<Record, ['*']>[]>;
4485
+ fuzziness?: FuzzinessExpression;
4486
+ prefix?: PrefixExpression;
4487
+ highlight?: HighlightExpression;
4488
+ filter?: Filter<Record>;
4489
+ boosters?: Boosters<Record>[];
4490
+ }): Promise<SearchXataRecord<SelectedPick<Record, ['*']>>[]>;
3066
4491
  abstract query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3067
4492
  }
3068
- declare class RestRepository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Data, Record> {
4493
+ declare class RestRepository<Record extends XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Record> {
3069
4494
  #private;
3070
- db: SchemaPluginResult<any>;
3071
4495
  constructor(options: {
3072
4496
  table: string;
3073
- links?: LinkDictionary;
3074
- getFetchProps: () => Promise<FetcherExtraProps>;
3075
4497
  db: SchemaPluginResult<any>;
4498
+ pluginOptions: XataPluginOptions;
4499
+ schemaTables?: Table[];
3076
4500
  });
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>;
4501
+ create<K extends SelectableColumn<Record>>(object: EditableData<Record> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4502
+ create(object: EditableData<Record> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4503
+ create<K extends SelectableColumn<Record>>(id: string, object: EditableData<Record>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4504
+ create(id: string, object: EditableData<Record>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4505
+ create<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4506
+ create(objects: Array<EditableData<Record> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4507
+ read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
4508
+ read(id: string): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4509
+ read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4510
+ read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4511
+ read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
4512
+ read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4513
+ read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4514
+ read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4515
+ update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4516
+ update(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4517
+ update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4518
+ update(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4519
+ update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4520
+ update(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4521
+ createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Record> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4522
+ createOrUpdate(object: EditableData<Record> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4523
+ createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4524
+ createOrUpdate(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4525
+ createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4526
+ createOrUpdate(objects: Array<EditableData<Record> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4527
+ delete<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4528
+ delete(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4529
+ delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4530
+ delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4531
+ delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4532
+ delete(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4533
+ delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4534
+ delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3088
4535
  search(query: string, options?: {
3089
- fuzziness?: number;
3090
- }): Promise<SelectedPick<Record, ['*']>[]>;
4536
+ fuzziness?: FuzzinessExpression;
4537
+ prefix?: PrefixExpression;
4538
+ highlight?: HighlightExpression;
4539
+ filter?: Filter<Record>;
4540
+ boosters?: Boosters<Record>[];
4541
+ }): Promise<any>;
3091
4542
  query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3092
4543
  }
3093
4544
 
4545
+ declare type BaseSchema = {
4546
+ name: string;
4547
+ columns: readonly ({
4548
+ name: string;
4549
+ type: Column['type'];
4550
+ } | {
4551
+ name: string;
4552
+ type: 'link';
4553
+ link: {
4554
+ table: string;
4555
+ };
4556
+ } | {
4557
+ name: string;
4558
+ type: 'object';
4559
+ columns: {
4560
+ name: string;
4561
+ type: string;
4562
+ }[];
4563
+ })[];
4564
+ };
4565
+ declare type SchemaInference<T extends readonly BaseSchema[]> = T extends never[] ? Record<string, Record<string, any>> : T extends readonly unknown[] ? T[number] extends {
4566
+ name: string;
4567
+ columns: readonly unknown[];
4568
+ } ? {
4569
+ [K in T[number]['name']]: TableType<T[number], K>;
4570
+ } : never : never;
4571
+ declare type TableType<Tables, TableName> = Tables & {
4572
+ name: TableName;
4573
+ } extends infer Table ? Table extends {
4574
+ name: string;
4575
+ columns: infer Columns;
4576
+ } ? Columns extends readonly unknown[] ? Columns[number] extends {
4577
+ name: string;
4578
+ type: string;
4579
+ } ? Identifiable & {
4580
+ [K in Columns[number]['name']]?: PropertyType<Tables, Columns[number], K>;
4581
+ } : never : never : never : never;
4582
+ declare type PropertyType<Tables, Properties, PropertyName> = Properties & {
4583
+ name: PropertyName;
4584
+ } extends infer Property ? Property extends {
4585
+ name: string;
4586
+ type: infer Type;
4587
+ link?: {
4588
+ table: infer LinkedTable;
4589
+ };
4590
+ columns?: infer ObjectColumns;
4591
+ } ? (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 {
4592
+ name: string;
4593
+ type: string;
4594
+ } ? {
4595
+ [K in ObjectColumns[number]['name']]?: PropertyType<Tables, ObjectColumns[number], K>;
4596
+ } : never : never : Type extends 'link' ? TableType<Tables, LinkedTable> & XataRecord : never) | null : never : never;
4597
+
4598
+ /**
4599
+ * Operator to restrict results to only values that are greater than the given value.
4600
+ */
4601
+ declare const greaterThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3094
4602
  /**
3095
4603
  * Operator to restrict results to only values that are greater than the given value.
3096
4604
  */
@@ -3098,15 +4606,35 @@ declare const gt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T
3098
4606
  /**
3099
4607
  * Operator to restrict results to only values that are greater than or equal to the given value.
3100
4608
  */
3101
- declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4609
+ declare const greaterThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4610
+ /**
4611
+ * Operator to restrict results to only values that are greater than or equal to the given value.
4612
+ */
4613
+ declare const greaterEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3102
4614
  /**
3103
4615
  * Operator to restrict results to only values that are greater than or equal to the given value.
3104
4616
  */
3105
4617
  declare const gte: <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 ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4622
+ /**
4623
+ * Operator to restrict results to only values that are lower than the given value.
4624
+ */
4625
+ declare const lessThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3106
4626
  /**
3107
4627
  * Operator to restrict results to only values that are lower than the given value.
3108
4628
  */
3109
4629
  declare const lt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4630
+ /**
4631
+ * Operator to restrict results to only values that are lower than or equal to the given value.
4632
+ */
4633
+ declare const lessThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4634
+ /**
4635
+ * Operator to restrict results to only values that are lower than or equal to the given value.
4636
+ */
4637
+ declare const lessEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3110
4638
  /**
3111
4639
  * Operator to restrict results to only values that are lower than or equal to the given value.
3112
4640
  */
@@ -3139,6 +4667,10 @@ declare const pattern: (value: string) => StringTypeFilter;
3139
4667
  * Operator to restrict results to only values that are equal to the given value.
3140
4668
  */
3141
4669
  declare const is: <T>(value: T) => PropertyFilter<T>;
4670
+ /**
4671
+ * Operator to restrict results to only values that are equal to the given value.
4672
+ */
4673
+ declare const equals: <T>(value: T) => PropertyFilter<T>;
3142
4674
  /**
3143
4675
  * Operator to restrict results to only values that are not equal to the given value.
3144
4676
  */
@@ -3166,46 +4698,15 @@ declare const includesAny: <T>(value: T) => ArrayFilter<T>;
3166
4698
 
3167
4699
  declare type SchemaDefinition = {
3168
4700
  table: string;
3169
- links?: LinkDictionary;
3170
4701
  };
3171
- declare type SchemaPluginResult<Schemas extends Record<string, BaseData>> = {
4702
+ declare type SchemaPluginResult<Schemas extends Record<string, XataRecord>> = {
3172
4703
  [Key in keyof Schemas]: Repository<Schemas[Key]>;
3173
4704
  };
3174
- declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
3175
- #private;
3176
- private links?;
3177
- private tableNames?;
3178
- constructor(links?: LinkDictionary | undefined, tableNames?: string[] | undefined);
3179
- build(options: XataPluginOptions): SchemaPluginResult<Schemas>;
3180
- }
3181
-
3182
- declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3183
- fuzziness?: number;
3184
- tables?: Tables[];
3185
- };
3186
- declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3187
- all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3188
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]: {
3189
- table: Model;
3190
- record: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>>;
3191
- };
3192
- }>[]>;
3193
- byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3194
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]?: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>[]>;
3195
- }>;
3196
- };
3197
- declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
4705
+ declare class SchemaPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin {
3198
4706
  #private;
3199
- private db;
3200
- private links;
3201
- constructor(db: SchemaPluginResult<Schemas>, links: LinkDictionary);
3202
- build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
4707
+ constructor(schemaTables?: Schemas.Table[]);
4708
+ build(pluginOptions: XataPluginOptions): SchemaPluginResult<Schemas>;
3203
4709
  }
3204
- declare type SearchXataRecord = XataRecord & {
3205
- xata: {
3206
- table: string;
3207
- };
3208
- };
3209
4710
 
3210
4711
  declare type BranchStrategyValue = string | undefined | null;
3211
4712
  declare type BranchStrategyBuilder = () => BranchStrategyValue | Promise<BranchStrategyValue>;
@@ -3217,34 +4718,130 @@ declare type BaseClientOptions = {
3217
4718
  apiKey?: string;
3218
4719
  databaseURL?: string;
3219
4720
  branch?: BranchStrategyOption;
4721
+ cache?: CacheImpl;
4722
+ trace?: TraceFunction;
3220
4723
  };
3221
4724
  declare const buildClient: <Plugins extends Record<string, XataPlugin> = {}>(plugins?: Plugins | undefined) => ClientConstructor<Plugins>;
3222
4725
  interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
3223
- new <Schemas extends Record<string, BaseData>>(options?: Partial<BaseClientOptions>, links?: LinkDictionary): Omit<{
4726
+ new <Schemas extends Record<string, XataRecord> = {}>(options?: Partial<BaseClientOptions>, schemaTables?: readonly BaseSchema[]): Omit<{
3224
4727
  db: Awaited<ReturnType<SchemaPlugin<Schemas>['build']>>;
3225
4728
  search: Awaited<ReturnType<SearchPlugin<Schemas>['build']>>;
3226
4729
  }, keyof Plugins> & {
3227
4730
  [Key in StringKeys<NonNullable<Plugins>>]: Awaited<ReturnType<NonNullable<Plugins>[Key]['build']>>;
4731
+ } & {
4732
+ getConfig(): Promise<{
4733
+ databaseURL: string;
4734
+ branch: string;
4735
+ }>;
3228
4736
  };
3229
4737
  }
3230
4738
  declare const BaseClient_base: ClientConstructor<{}>;
3231
4739
  declare class BaseClient extends BaseClient_base<Record<string, any>> {
3232
4740
  }
3233
4741
 
4742
+ declare class Serializer {
4743
+ classes: Record<string, any>;
4744
+ add(clazz: any): void;
4745
+ toJSON<T>(data: T): string;
4746
+ fromJSON<T>(json: string): T;
4747
+ }
4748
+ declare const serialize: <T>(data: T) => string;
4749
+ declare const deserialize: <T>(json: string) => T;
4750
+
3234
4751
  declare type BranchResolutionOptions = {
3235
4752
  databaseURL?: string;
3236
4753
  apiKey?: string;
3237
4754
  fetchImpl?: FetchImpl;
3238
4755
  };
3239
- declare function getCurrentBranchName(options?: BranchResolutionOptions): Promise<string | undefined>;
4756
+ declare function getCurrentBranchName(options?: BranchResolutionOptions): Promise<string>;
3240
4757
  declare function getCurrentBranchDetails(options?: BranchResolutionOptions): Promise<DBBranch | null>;
3241
4758
  declare function getDatabaseURL(): string | undefined;
3242
4759
 
3243
4760
  declare function getAPIKey(): string | undefined;
3244
4761
 
4762
+ interface Body {
4763
+ arrayBuffer(): Promise<ArrayBuffer>;
4764
+ blob(): Promise<Blob>;
4765
+ formData(): Promise<FormData>;
4766
+ json(): Promise<any>;
4767
+ text(): Promise<string>;
4768
+ }
4769
+ interface Blob {
4770
+ readonly size: number;
4771
+ readonly type: string;
4772
+ arrayBuffer(): Promise<ArrayBuffer>;
4773
+ slice(start?: number, end?: number, contentType?: string): Blob;
4774
+ text(): Promise<string>;
4775
+ }
4776
+ /** Provides information about files and allows JavaScript in a web page to access their content. */
4777
+ interface File extends Blob {
4778
+ readonly lastModified: number;
4779
+ readonly name: string;
4780
+ readonly webkitRelativePath: string;
4781
+ }
4782
+ declare type FormDataEntryValue = File | string;
4783
+ /** 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". */
4784
+ interface FormData {
4785
+ append(name: string, value: string | Blob, fileName?: string): void;
4786
+ delete(name: string): void;
4787
+ get(name: string): FormDataEntryValue | null;
4788
+ getAll(name: string): FormDataEntryValue[];
4789
+ has(name: string): boolean;
4790
+ set(name: string, value: string | Blob, fileName?: string): void;
4791
+ forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void;
4792
+ }
4793
+ /** 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. */
4794
+ interface Headers {
4795
+ append(name: string, value: string): void;
4796
+ delete(name: string): void;
4797
+ get(name: string): string | null;
4798
+ has(name: string): boolean;
4799
+ set(name: string, value: string): void;
4800
+ forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void;
4801
+ }
4802
+ interface Request extends Body {
4803
+ /** Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching. */
4804
+ readonly cache: 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload';
4805
+ /** 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. */
4806
+ readonly credentials: 'include' | 'omit' | 'same-origin';
4807
+ /** Returns the kind of resource requested by request, e.g., "document" or "script". */
4808
+ readonly destination: '' | 'audio' | 'audioworklet' | 'document' | 'embed' | 'font' | 'frame' | 'iframe' | 'image' | 'manifest' | 'object' | 'paintworklet' | 'report' | 'script' | 'sharedworker' | 'style' | 'track' | 'video' | 'worker' | 'xslt';
4809
+ /** 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. */
4810
+ readonly headers: Headers;
4811
+ /** 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] */
4812
+ readonly integrity: string;
4813
+ /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
4814
+ readonly keepalive: boolean;
4815
+ /** Returns request's HTTP method, which is "GET" by default. */
4816
+ readonly method: string;
4817
+ /** 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. */
4818
+ readonly mode: 'cors' | 'navigate' | 'no-cors' | 'same-origin';
4819
+ /** 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. */
4820
+ readonly redirect: 'error' | 'follow' | 'manual';
4821
+ /** 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. */
4822
+ readonly referrer: string;
4823
+ /** Returns the referrer policy associated with request. This is used during fetching to compute the value of the request's referrer. */
4824
+ readonly referrerPolicy: '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
4825
+ /** Returns the URL of request as a string. */
4826
+ readonly url: string;
4827
+ clone(): Request;
4828
+ }
4829
+
4830
+ declare type XataWorkerContext<XataClient> = {
4831
+ xata: XataClient;
4832
+ request: Request;
4833
+ env: Record<string, string | undefined>;
4834
+ };
4835
+ declare type RemoveFirst<T> = T extends [any, ...infer U] ? U : never;
4836
+ declare type WorkerRunnerConfig = {
4837
+ workspace: string;
4838
+ worker: string;
4839
+ };
4840
+ 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>>>;
4841
+
3245
4842
  declare class XataError extends Error {
3246
4843
  readonly status: number;
3247
4844
  constructor(message: string, status: number);
3248
4845
  }
3249
4846
 
3250
- 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 };
4847
+ 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, PatchDatabaseMetadataError, PatchDatabaseMetadataPathParams, PatchDatabaseMetadataRequestBody, PatchDatabaseMetadataVariables, 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, 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, patchDatabaseMetadata, pattern, previewBranchSchemaEdit, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, startsWith, updateBranchMetadata, updateBranchSchema, updateColumn, updateMigrationRequest, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };