@xata.io/client 0.0.0-alpha.ved00a04 → 0.0.0-alpha.ved155c7

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,14 +10,19 @@ 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';
@@ -20,7 +30,6 @@ declare type ErrorWrapper<TError> = TError | {
20
30
  };
21
31
 
22
32
  interface CacheImpl {
23
- cacheRecords: boolean;
24
33
  defaultQueryTTL: number;
25
34
  getAll(): Promise<Record<string, unknown>>;
26
35
  get: <T>(key: string) => Promise<T | null>;
@@ -30,13 +39,11 @@ interface CacheImpl {
30
39
  }
31
40
  interface SimpleCacheOptions {
32
41
  max?: number;
33
- cacheRecords?: boolean;
34
42
  defaultQueryTTL?: number;
35
43
  }
36
44
  declare class SimpleCache implements CacheImpl {
37
45
  #private;
38
46
  capacity: number;
39
- cacheRecords: boolean;
40
47
  defaultQueryTTL: number;
41
48
  constructor(options?: SimpleCacheOptions);
42
49
  getAll(): Promise<Record<string, unknown>>;
@@ -52,6 +59,7 @@ declare abstract class XataPlugin {
52
59
  declare type XataPluginOptions = {
53
60
  getFetchProps: () => Promise<FetcherExtraProps>;
54
61
  cache: CacheImpl;
62
+ trace?: TraceFunction;
55
63
  };
56
64
 
57
65
  /**
@@ -91,7 +99,7 @@ declare type WorkspaceID = string;
91
99
  declare type Role = 'owner' | 'maintainer';
92
100
  declare type WorkspaceMeta = {
93
101
  name: string;
94
- slug: string;
102
+ slug?: string;
95
103
  };
96
104
  declare type Workspace = WorkspaceMeta & {
97
105
  id: WorkspaceID;
@@ -122,22 +130,32 @@ declare type WorkspaceMembers = {
122
130
  * @pattern ^ik_[a-zA-Z0-9]+
123
131
  */
124
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
+ };
125
145
  declare type ListDatabasesResponse = {
126
- databases?: {
127
- name: string;
128
- displayName: string;
129
- createdAt: DateTime;
130
- numberOfBranches: number;
131
- ui?: {
132
- color?: string;
133
- };
134
- }[];
146
+ databases?: DatabaseMetadata[];
135
147
  };
136
148
  declare type ListBranchesResponse = {
137
149
  databaseName: string;
138
150
  displayName: string;
139
151
  branches: Branch[];
140
152
  };
153
+ declare type ListGitBranchesResponse = {
154
+ mapping: {
155
+ gitBranch: string;
156
+ xataBranch: string;
157
+ }[];
158
+ };
141
159
  declare type Branch = {
142
160
  name: string;
143
161
  createdAt: DateTime;
@@ -175,21 +193,38 @@ declare type Schema = {
175
193
  tables: Table[];
176
194
  tablesOrder?: string[];
177
195
  };
196
+ /**
197
+ * @x-internal true
198
+ */
199
+ declare type SchemaEditScript = {
200
+ sourceMigrationID?: string;
201
+ targetMigrationID?: string;
202
+ tables: TableEdit[];
203
+ };
178
204
  declare type Table = {
179
205
  id?: string;
180
206
  name: TableName;
181
207
  columns: Column[];
182
208
  revLinks?: RevLink[];
183
209
  };
210
+ /**
211
+ * @x-internal true
212
+ */
213
+ declare type TableEdit = {
214
+ oldName?: string;
215
+ newName?: string;
216
+ columns?: MigrationColumnOp[];
217
+ };
184
218
  /**
185
219
  * @x-go-type xata.Column
186
220
  */
187
221
  declare type Column = {
188
222
  name: string;
189
- type: 'bool' | 'int' | 'float' | 'string' | 'text' | 'email' | 'multiple' | 'link' | 'object';
223
+ type: 'bool' | 'int' | 'float' | 'string' | 'text' | 'email' | 'multiple' | 'link' | 'object' | 'datetime';
190
224
  link?: {
191
225
  table: string;
192
226
  };
227
+ notNull?: boolean;
193
228
  columns?: Column[];
194
229
  };
195
230
  declare type RevLink = {
@@ -256,12 +291,131 @@ declare type ColumnMigration = {
256
291
  old: Column;
257
292
  ['new']: Column;
258
293
  };
294
+ /**
295
+ * @x-internal true
296
+ */
297
+ declare type Commit = {
298
+ meta?: {
299
+ title?: string;
300
+ message?: string;
301
+ id: string;
302
+ parentID?: string;
303
+ mergeParentID?: string;
304
+ status: string;
305
+ createdAt: DateTime;
306
+ modifiedAt?: DateTime;
307
+ };
308
+ operations: MigrationOp[];
309
+ };
310
+ /**
311
+ * Branch schema migration.
312
+ *
313
+ * @x-internal true
314
+ */
315
+ declare type Migration = {
316
+ parentID?: string;
317
+ operations: MigrationOp[];
318
+ };
319
+ /**
320
+ * Branch schema migration operations.
321
+ *
322
+ * @x-internal true
323
+ */
324
+ declare type MigrationOp = MigrationTableOp | MigrationColumnOp;
325
+ /**
326
+ * @x-internal true
327
+ */
328
+ declare type MigrationTableOp = {
329
+ addTable: TableOpAdd;
330
+ } | {
331
+ removeTable: TableOpRemove;
332
+ } | {
333
+ renameTable: TableOpRename;
334
+ };
335
+ /**
336
+ * @x-internal true
337
+ */
338
+ declare type MigrationColumnOp = {
339
+ addColumn: ColumnOpAdd;
340
+ } | {
341
+ removeColumn: ColumnOpRemove;
342
+ } | {
343
+ renameColumn: ColumnOpRename;
344
+ };
345
+ /**
346
+ * @x-internal true
347
+ */
348
+ declare type TableOpAdd = {
349
+ table: string;
350
+ };
351
+ /**
352
+ * @x-internal true
353
+ */
354
+ declare type TableOpRemove = {
355
+ table: string;
356
+ };
357
+ /**
358
+ * @x-internal true
359
+ */
360
+ declare type TableOpRename = {
361
+ oldName: string;
362
+ newName: string;
363
+ };
364
+ /**
365
+ * @x-internal true
366
+ */
367
+ declare type ColumnOpAdd = {
368
+ table?: string;
369
+ column: Column;
370
+ };
371
+ /**
372
+ * @x-internal true
373
+ */
374
+ declare type ColumnOpRemove = {
375
+ table?: string;
376
+ column: string;
377
+ };
378
+ /**
379
+ * @x-internal true
380
+ */
381
+ declare type ColumnOpRename = {
382
+ table?: string;
383
+ oldName: string;
384
+ newName: string;
385
+ };
386
+ declare type MigrationRequest = {
387
+ number: number;
388
+ createdAt: DateTime;
389
+ modifiedAt?: DateTime;
390
+ closedAt?: DateTime;
391
+ mergedAt?: DateTime;
392
+ status: 'open' | 'closed' | 'merging' | 'merged';
393
+ title: string;
394
+ body: string;
395
+ source: string;
396
+ target: string;
397
+ };
259
398
  declare type SortExpression = string[] | {
260
399
  [key: string]: SortOrder;
261
400
  } | {
262
401
  [key: string]: SortOrder;
263
402
  }[];
264
403
  declare type SortOrder = 'asc' | 'desc';
404
+ /**
405
+ * Maximum [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) for the search terms. The Levenshtein
406
+ * distance is the number of one character changes needed to make two strings equal. The default is 1, meaning that single
407
+ * character typos per word are tollerated by search. You can set it to 0 to remove the typo tollerance or set it to 2
408
+ * to allow two typos in a word.
409
+ *
410
+ * @default 1
411
+ * @maximum 2
412
+ * @minimum 0
413
+ */
414
+ declare type FuzzinessExpression = number;
415
+ /**
416
+ * 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.
417
+ */
418
+ declare type PrefixExpression = 'phrase' | 'disabled';
265
419
  /**
266
420
  * @minProperties 1
267
421
  */
@@ -275,6 +429,48 @@ declare type FilterExpression = {
275
429
  } & {
276
430
  [key: string]: FilterColumn;
277
431
  };
432
+ declare type HighlightExpression = {
433
+ enabled?: boolean;
434
+ encodeHTML?: boolean;
435
+ };
436
+ /**
437
+ * Booster Expression
438
+ *
439
+ * @x-go-type xata.BoosterExpression
440
+ */
441
+ declare type BoosterExpression = {
442
+ valueBooster?: ValueBooster$1;
443
+ } | {
444
+ numericBooster?: NumericBooster$1;
445
+ } | {
446
+ dateBooster?: DateBooster$1;
447
+ };
448
+ /**
449
+ * Boost records with a particular value for a column.
450
+ */
451
+ declare type ValueBooster$1 = {
452
+ column: string;
453
+ value: string | number | boolean;
454
+ factor: number;
455
+ };
456
+ /**
457
+ * Boost records based on the value of a numeric column.
458
+ */
459
+ declare type NumericBooster$1 = {
460
+ column: string;
461
+ factor: number;
462
+ };
463
+ /**
464
+ * Boost records based on the value of a datetime column. It is configured via "origin", "scale", and "decay". The further away from the "origin",
465
+ * 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
466
+ * 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.
467
+ */
468
+ declare type DateBooster$1 = {
469
+ column: string;
470
+ origin?: string;
471
+ scale: string;
472
+ decay: number;
473
+ };
278
474
  declare type FilterList = FilterExpression | FilterExpression[];
279
475
  declare type FilterColumn = FilterColumnIncludes | FilterPredicate | FilterList;
280
476
  /**
@@ -331,7 +527,24 @@ declare type PageConfig = {
331
527
  size?: number;
332
528
  offset?: number;
333
529
  };
334
- declare type ColumnsFilter = string[];
530
+ declare type ColumnsProjection = string[];
531
+ /**
532
+ * Xata Table Record Metadata
533
+ */
534
+ declare type RecordMeta = {
535
+ id: RecordID;
536
+ xata: {
537
+ version: number;
538
+ table?: string;
539
+ highlight?: {
540
+ [key: string]: string[] | {
541
+ [key: string]: any;
542
+ };
543
+ };
544
+ score?: number;
545
+ warnings?: string[];
546
+ };
547
+ };
335
548
  /**
336
549
  * @pattern [a-zA-Z0-9_-~:]+
337
550
  */
@@ -353,16 +566,9 @@ declare type RecordsMetadata = {
353
566
  };
354
567
  };
355
568
  /**
356
- * Xata Table Record
569
+ * Xata Table Record Metadata
357
570
  */
358
- declare type XataRecord$1 = {
359
- id: RecordID;
360
- xata: {
361
- version: number;
362
- table?: string;
363
- warnings?: string[];
364
- };
365
- } & {
571
+ declare type XataRecord$1 = RecordMeta & {
366
572
  [key: string]: any;
367
573
  };
368
574
 
@@ -380,14 +586,18 @@ type schemas_InviteID = InviteID;
380
586
  type schemas_WorkspaceInvite = WorkspaceInvite;
381
587
  type schemas_WorkspaceMembers = WorkspaceMembers;
382
588
  type schemas_InviteKey = InviteKey;
589
+ type schemas_DatabaseMetadata = DatabaseMetadata;
383
590
  type schemas_ListDatabasesResponse = ListDatabasesResponse;
384
591
  type schemas_ListBranchesResponse = ListBranchesResponse;
592
+ type schemas_ListGitBranchesResponse = ListGitBranchesResponse;
385
593
  type schemas_Branch = Branch;
386
594
  type schemas_BranchMetadata = BranchMetadata;
387
595
  type schemas_DBBranch = DBBranch;
388
596
  type schemas_StartedFromMetadata = StartedFromMetadata;
389
597
  type schemas_Schema = Schema;
598
+ type schemas_SchemaEditScript = SchemaEditScript;
390
599
  type schemas_Table = Table;
600
+ type schemas_TableEdit = TableEdit;
391
601
  type schemas_Column = Column;
392
602
  type schemas_RevLink = RevLink;
393
603
  type schemas_BranchName = BranchName;
@@ -400,9 +610,25 @@ type schemas_MetricsLatency = MetricsLatency;
400
610
  type schemas_BranchMigration = BranchMigration;
401
611
  type schemas_TableMigration = TableMigration;
402
612
  type schemas_ColumnMigration = ColumnMigration;
613
+ type schemas_Commit = Commit;
614
+ type schemas_Migration = Migration;
615
+ type schemas_MigrationOp = MigrationOp;
616
+ type schemas_MigrationTableOp = MigrationTableOp;
617
+ type schemas_MigrationColumnOp = MigrationColumnOp;
618
+ type schemas_TableOpAdd = TableOpAdd;
619
+ type schemas_TableOpRemove = TableOpRemove;
620
+ type schemas_TableOpRename = TableOpRename;
621
+ type schemas_ColumnOpAdd = ColumnOpAdd;
622
+ type schemas_ColumnOpRemove = ColumnOpRemove;
623
+ type schemas_ColumnOpRename = ColumnOpRename;
624
+ type schemas_MigrationRequest = MigrationRequest;
403
625
  type schemas_SortExpression = SortExpression;
404
626
  type schemas_SortOrder = SortOrder;
627
+ type schemas_FuzzinessExpression = FuzzinessExpression;
628
+ type schemas_PrefixExpression = PrefixExpression;
405
629
  type schemas_FilterExpression = FilterExpression;
630
+ type schemas_HighlightExpression = HighlightExpression;
631
+ type schemas_BoosterExpression = BoosterExpression;
406
632
  type schemas_FilterList = FilterList;
407
633
  type schemas_FilterColumn = FilterColumn;
408
634
  type schemas_FilterColumnIncludes = FilterColumnIncludes;
@@ -412,7 +638,8 @@ type schemas_FilterPredicateRangeOp = FilterPredicateRangeOp;
412
638
  type schemas_FilterRangeValue = FilterRangeValue;
413
639
  type schemas_FilterValue = FilterValue;
414
640
  type schemas_PageConfig = PageConfig;
415
- type schemas_ColumnsFilter = ColumnsFilter;
641
+ type schemas_ColumnsProjection = ColumnsProjection;
642
+ type schemas_RecordMeta = RecordMeta;
416
643
  type schemas_RecordID = RecordID;
417
644
  type schemas_TableRename = TableRename;
418
645
  type schemas_RecordsMetadata = RecordsMetadata;
@@ -432,14 +659,18 @@ declare namespace schemas {
432
659
  schemas_WorkspaceInvite as WorkspaceInvite,
433
660
  schemas_WorkspaceMembers as WorkspaceMembers,
434
661
  schemas_InviteKey as InviteKey,
662
+ schemas_DatabaseMetadata as DatabaseMetadata,
435
663
  schemas_ListDatabasesResponse as ListDatabasesResponse,
436
664
  schemas_ListBranchesResponse as ListBranchesResponse,
665
+ schemas_ListGitBranchesResponse as ListGitBranchesResponse,
437
666
  schemas_Branch as Branch,
438
667
  schemas_BranchMetadata as BranchMetadata,
439
668
  schemas_DBBranch as DBBranch,
440
669
  schemas_StartedFromMetadata as StartedFromMetadata,
441
670
  schemas_Schema as Schema,
671
+ schemas_SchemaEditScript as SchemaEditScript,
442
672
  schemas_Table as Table,
673
+ schemas_TableEdit as TableEdit,
443
674
  schemas_Column as Column,
444
675
  schemas_RevLink as RevLink,
445
676
  schemas_BranchName as BranchName,
@@ -452,9 +683,28 @@ declare namespace schemas {
452
683
  schemas_BranchMigration as BranchMigration,
453
684
  schemas_TableMigration as TableMigration,
454
685
  schemas_ColumnMigration as ColumnMigration,
686
+ schemas_Commit as Commit,
687
+ schemas_Migration as Migration,
688
+ schemas_MigrationOp as MigrationOp,
689
+ schemas_MigrationTableOp as MigrationTableOp,
690
+ schemas_MigrationColumnOp as MigrationColumnOp,
691
+ schemas_TableOpAdd as TableOpAdd,
692
+ schemas_TableOpRemove as TableOpRemove,
693
+ schemas_TableOpRename as TableOpRename,
694
+ schemas_ColumnOpAdd as ColumnOpAdd,
695
+ schemas_ColumnOpRemove as ColumnOpRemove,
696
+ schemas_ColumnOpRename as ColumnOpRename,
697
+ schemas_MigrationRequest as MigrationRequest,
455
698
  schemas_SortExpression as SortExpression,
456
699
  schemas_SortOrder as SortOrder,
700
+ schemas_FuzzinessExpression as FuzzinessExpression,
701
+ schemas_PrefixExpression as PrefixExpression,
457
702
  schemas_FilterExpression as FilterExpression,
703
+ schemas_HighlightExpression as HighlightExpression,
704
+ schemas_BoosterExpression as BoosterExpression,
705
+ ValueBooster$1 as ValueBooster,
706
+ NumericBooster$1 as NumericBooster,
707
+ DateBooster$1 as DateBooster,
458
708
  schemas_FilterList as FilterList,
459
709
  schemas_FilterColumn as FilterColumn,
460
710
  schemas_FilterColumnIncludes as FilterColumnIncludes,
@@ -464,7 +714,8 @@ declare namespace schemas {
464
714
  schemas_FilterRangeValue as FilterRangeValue,
465
715
  schemas_FilterValue as FilterValue,
466
716
  schemas_PageConfig as PageConfig,
467
- schemas_ColumnsFilter as ColumnsFilter,
717
+ schemas_ColumnsProjection as ColumnsProjection,
718
+ schemas_RecordMeta as RecordMeta,
468
719
  schemas_RecordID as RecordID,
469
720
  schemas_TableRename as TableRename,
470
721
  schemas_RecordsMetadata as RecordsMetadata,
@@ -499,11 +750,22 @@ declare type BulkError = {
499
750
  status?: number;
500
751
  }[];
501
752
  };
753
+ declare type BulkInsertResponse = {
754
+ recordIDs: string[];
755
+ } | {
756
+ records: XataRecord$1[];
757
+ };
502
758
  declare type BranchMigrationPlan = {
503
759
  version: number;
504
760
  migration: BranchMigration;
505
761
  };
506
- declare type RecordUpdateResponse = {
762
+ declare type RecordResponse = XataRecord$1;
763
+ declare type SchemaCompareResponse = {
764
+ source: Schema;
765
+ target: Schema;
766
+ edits: SchemaEditScript;
767
+ };
768
+ declare type RecordUpdateResponse = XataRecord$1 | {
507
769
  id: string;
508
770
  xata: {
509
771
  version: number;
@@ -527,7 +789,10 @@ type responses_SimpleError = SimpleError;
527
789
  type responses_BadRequestError = BadRequestError;
528
790
  type responses_AuthError = AuthError;
529
791
  type responses_BulkError = BulkError;
792
+ type responses_BulkInsertResponse = BulkInsertResponse;
530
793
  type responses_BranchMigrationPlan = BranchMigrationPlan;
794
+ type responses_RecordResponse = RecordResponse;
795
+ type responses_SchemaCompareResponse = SchemaCompareResponse;
531
796
  type responses_RecordUpdateResponse = RecordUpdateResponse;
532
797
  type responses_QueryResponse = QueryResponse;
533
798
  type responses_SearchResponse = SearchResponse;
@@ -538,7 +803,10 @@ declare namespace responses {
538
803
  responses_BadRequestError as BadRequestError,
539
804
  responses_AuthError as AuthError,
540
805
  responses_BulkError as BulkError,
806
+ responses_BulkInsertResponse as BulkInsertResponse,
541
807
  responses_BranchMigrationPlan as BranchMigrationPlan,
808
+ responses_RecordResponse as RecordResponse,
809
+ responses_SchemaCompareResponse as SchemaCompareResponse,
542
810
  responses_RecordUpdateResponse as RecordUpdateResponse,
543
811
  responses_QueryResponse as QueryResponse,
544
812
  responses_SearchResponse as SearchResponse,
@@ -844,6 +1112,9 @@ declare type InviteWorkspaceMemberError = ErrorWrapper<{
844
1112
  } | {
845
1113
  status: 404;
846
1114
  payload: SimpleError;
1115
+ } | {
1116
+ status: 409;
1117
+ payload: SimpleError;
847
1118
  }>;
848
1119
  declare type InviteWorkspaceMemberRequestBody = {
849
1120
  email: string;
@@ -857,6 +1128,34 @@ declare type InviteWorkspaceMemberVariables = {
857
1128
  * Invite some user to join the workspace with the given role
858
1129
  */
859
1130
  declare const inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<WorkspaceInvite>;
1131
+ declare type UpdateWorkspaceMemberInvitePathParams = {
1132
+ workspaceId: WorkspaceID;
1133
+ inviteId: InviteID;
1134
+ };
1135
+ declare type UpdateWorkspaceMemberInviteError = ErrorWrapper<{
1136
+ status: 400;
1137
+ payload: BadRequestError;
1138
+ } | {
1139
+ status: 401;
1140
+ payload: AuthError;
1141
+ } | {
1142
+ status: 404;
1143
+ payload: SimpleError;
1144
+ } | {
1145
+ status: 422;
1146
+ payload: SimpleError;
1147
+ }>;
1148
+ declare type UpdateWorkspaceMemberInviteRequestBody = {
1149
+ role: Role;
1150
+ };
1151
+ declare type UpdateWorkspaceMemberInviteVariables = {
1152
+ body: UpdateWorkspaceMemberInviteRequestBody;
1153
+ pathParams: UpdateWorkspaceMemberInvitePathParams;
1154
+ } & FetcherExtraProps;
1155
+ /**
1156
+ * 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.
1157
+ */
1158
+ declare const updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
860
1159
  declare type CancelWorkspaceMemberInvitePathParams = {
861
1160
  workspaceId: WorkspaceID;
862
1161
  inviteId: InviteID;
@@ -1010,11 +1309,11 @@ declare type DeleteDatabaseVariables = {
1010
1309
  * Delete a database and all of its branches and tables permanently.
1011
1310
  */
1012
1311
  declare const deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
1013
- declare type GetBranchDetailsPathParams = {
1014
- dbBranchName: DBBranchName;
1312
+ declare type GetDatabaseMetadataPathParams = {
1313
+ dbName: DBName;
1015
1314
  workspace: string;
1016
1315
  };
1017
- declare type GetBranchDetailsError = ErrorWrapper<{
1316
+ declare type GetDatabaseMetadataError = ErrorWrapper<{
1018
1317
  status: 400;
1019
1318
  payload: BadRequestError;
1020
1319
  } | {
@@ -1024,18 +1323,18 @@ declare type GetBranchDetailsError = ErrorWrapper<{
1024
1323
  status: 404;
1025
1324
  payload: SimpleError;
1026
1325
  }>;
1027
- declare type GetBranchDetailsVariables = {
1028
- pathParams: GetBranchDetailsPathParams;
1326
+ declare type GetDatabaseMetadataVariables = {
1327
+ pathParams: GetDatabaseMetadataPathParams;
1029
1328
  } & FetcherExtraProps;
1030
- declare const getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
1031
- declare type CreateBranchPathParams = {
1032
- dbBranchName: DBBranchName;
1329
+ /**
1330
+ * Retrieve metadata of the given database
1331
+ */
1332
+ declare const getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
1333
+ declare type PatchDatabaseMetadataPathParams = {
1334
+ dbName: DBName;
1033
1335
  workspace: string;
1034
1336
  };
1035
- declare type CreateBranchQueryParams = {
1036
- from?: string;
1037
- };
1038
- declare type CreateBranchError = ErrorWrapper<{
1337
+ declare type PatchDatabaseMetadataError = ErrorWrapper<{
1039
1338
  status: 400;
1040
1339
  payload: BadRequestError;
1041
1340
  } | {
@@ -1045,109 +1344,513 @@ declare type CreateBranchError = ErrorWrapper<{
1045
1344
  status: 404;
1046
1345
  payload: SimpleError;
1047
1346
  }>;
1048
- declare type CreateBranchRequestBody = {
1049
- from?: string;
1050
- metadata?: BranchMetadata;
1347
+ declare type PatchDatabaseMetadataRequestBody = {
1348
+ ui?: {
1349
+ color?: string;
1350
+ };
1051
1351
  };
1052
- declare type CreateBranchVariables = {
1053
- body?: CreateBranchRequestBody;
1054
- pathParams: CreateBranchPathParams;
1055
- queryParams?: CreateBranchQueryParams;
1352
+ declare type PatchDatabaseMetadataVariables = {
1353
+ body?: PatchDatabaseMetadataRequestBody;
1354
+ pathParams: PatchDatabaseMetadataPathParams;
1056
1355
  } & FetcherExtraProps;
1057
- declare const createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
1058
- declare type DeleteBranchPathParams = {
1059
- dbBranchName: DBBranchName;
1356
+ /**
1357
+ * Update the color of the selected database
1358
+ */
1359
+ declare const patchDatabaseMetadata: (variables: PatchDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
1360
+ declare type GetGitBranchesMappingPathParams = {
1361
+ dbName: DBName;
1060
1362
  workspace: string;
1061
1363
  };
1062
- declare type DeleteBranchError = ErrorWrapper<{
1364
+ declare type GetGitBranchesMappingError = ErrorWrapper<{
1063
1365
  status: 400;
1064
1366
  payload: BadRequestError;
1065
1367
  } | {
1066
1368
  status: 401;
1067
1369
  payload: AuthError;
1068
- } | {
1069
- status: 404;
1070
- payload: SimpleError;
1071
1370
  }>;
1072
- declare type DeleteBranchVariables = {
1073
- pathParams: DeleteBranchPathParams;
1371
+ declare type GetGitBranchesMappingVariables = {
1372
+ pathParams: GetGitBranchesMappingPathParams;
1074
1373
  } & FetcherExtraProps;
1075
1374
  /**
1076
- * Delete the branch in the database and all its resources
1375
+ * Lists all the git branches in the mapping, and their associated Xata branches.
1376
+ *
1377
+ * Example response:
1378
+ *
1379
+ * ```json
1380
+ * {
1381
+ * "mappings": [
1382
+ * {
1383
+ * "gitBranch": "main",
1384
+ * "xataBranch": "main"
1385
+ * },
1386
+ * {
1387
+ * "gitBranch": "gitBranch1",
1388
+ * "xataBranch": "xataBranch1"
1389
+ * }
1390
+ * {
1391
+ * "gitBranch": "xataBranch2",
1392
+ * "xataBranch": "xataBranch2"
1393
+ * }
1394
+ * ]
1395
+ * }
1396
+ * ```
1077
1397
  */
1078
- declare const deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
1079
- declare type UpdateBranchMetadataPathParams = {
1080
- dbBranchName: DBBranchName;
1398
+ declare const getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
1399
+ declare type AddGitBranchesEntryPathParams = {
1400
+ dbName: DBName;
1081
1401
  workspace: string;
1082
1402
  };
1083
- declare type UpdateBranchMetadataError = ErrorWrapper<{
1403
+ declare type AddGitBranchesEntryError = ErrorWrapper<{
1084
1404
  status: 400;
1085
1405
  payload: BadRequestError;
1086
1406
  } | {
1087
1407
  status: 401;
1088
1408
  payload: AuthError;
1089
- } | {
1090
- status: 404;
1091
- payload: SimpleError;
1092
1409
  }>;
1093
- declare type UpdateBranchMetadataVariables = {
1094
- body?: BranchMetadata;
1095
- pathParams: UpdateBranchMetadataPathParams;
1410
+ declare type AddGitBranchesEntryResponse = {
1411
+ warning?: string;
1412
+ };
1413
+ declare type AddGitBranchesEntryRequestBody = {
1414
+ gitBranch: string;
1415
+ xataBranch: BranchName;
1416
+ };
1417
+ declare type AddGitBranchesEntryVariables = {
1418
+ body: AddGitBranchesEntryRequestBody;
1419
+ pathParams: AddGitBranchesEntryPathParams;
1096
1420
  } & FetcherExtraProps;
1097
1421
  /**
1098
- * Update the branch metadata
1422
+ * 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.
1423
+ *
1424
+ * 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.
1425
+ *
1426
+ * Example request:
1427
+ *
1428
+ * ```json
1429
+ * // POST https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches
1430
+ * {
1431
+ * "gitBranch": "fix/bug123",
1432
+ * "xataBranch": "fix_bug"
1433
+ * }
1434
+ * ```
1099
1435
  */
1100
- declare const updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
1101
- declare type GetBranchMetadataPathParams = {
1102
- dbBranchName: DBBranchName;
1436
+ declare const addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
1437
+ declare type RemoveGitBranchesEntryPathParams = {
1438
+ dbName: DBName;
1103
1439
  workspace: string;
1104
1440
  };
1105
- declare type GetBranchMetadataError = ErrorWrapper<{
1441
+ declare type RemoveGitBranchesEntryQueryParams = {
1442
+ gitBranch: string;
1443
+ };
1444
+ declare type RemoveGitBranchesEntryError = ErrorWrapper<{
1106
1445
  status: 400;
1107
1446
  payload: BadRequestError;
1108
1447
  } | {
1109
1448
  status: 401;
1110
1449
  payload: AuthError;
1111
- } | {
1112
- status: 404;
1113
- payload: SimpleError;
1114
1450
  }>;
1115
- declare type GetBranchMetadataVariables = {
1116
- pathParams: GetBranchMetadataPathParams;
1451
+ declare type RemoveGitBranchesEntryVariables = {
1452
+ pathParams: RemoveGitBranchesEntryPathParams;
1453
+ queryParams: RemoveGitBranchesEntryQueryParams;
1117
1454
  } & FetcherExtraProps;
1118
- declare const getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
1119
- declare type GetBranchMigrationHistoryPathParams = {
1120
- dbBranchName: DBBranchName;
1455
+ /**
1456
+ * 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.
1457
+ *
1458
+ * Example request:
1459
+ *
1460
+ * ```json
1461
+ * // DELETE https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches?gitBranch=fix%2Fbug123
1462
+ * ```
1463
+ */
1464
+ declare const removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
1465
+ declare type ResolveBranchPathParams = {
1466
+ dbName: DBName;
1121
1467
  workspace: string;
1122
1468
  };
1123
- declare type GetBranchMigrationHistoryError = ErrorWrapper<{
1469
+ declare type ResolveBranchQueryParams = {
1470
+ gitBranch?: string;
1471
+ fallbackBranch?: string;
1472
+ };
1473
+ declare type ResolveBranchError = ErrorWrapper<{
1124
1474
  status: 400;
1125
1475
  payload: BadRequestError;
1126
1476
  } | {
1127
1477
  status: 401;
1128
1478
  payload: AuthError;
1129
- } | {
1130
- status: 404;
1131
- payload: SimpleError;
1132
1479
  }>;
1133
- declare type GetBranchMigrationHistoryResponse = {
1134
- startedFrom?: StartedFromMetadata;
1135
- migrations?: BranchMigration[];
1136
- };
1137
- declare type GetBranchMigrationHistoryRequestBody = {
1138
- limit?: number;
1139
- startFrom?: string;
1480
+ declare type ResolveBranchResponse = {
1481
+ branch: string;
1482
+ reason: {
1483
+ code: 'FOUND_IN_MAPPING' | 'BRANCH_EXISTS' | 'FALLBACK_BRANCH' | 'DEFAULT_BRANCH';
1484
+ message: string;
1485
+ };
1140
1486
  };
1141
- declare type GetBranchMigrationHistoryVariables = {
1142
- body?: GetBranchMigrationHistoryRequestBody;
1143
- pathParams: GetBranchMigrationHistoryPathParams;
1487
+ declare type ResolveBranchVariables = {
1488
+ pathParams: ResolveBranchPathParams;
1489
+ queryParams?: ResolveBranchQueryParams;
1144
1490
  } & FetcherExtraProps;
1145
- declare const getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
1146
- declare type ExecuteBranchMigrationPlanPathParams = {
1147
- dbBranchName: DBBranchName;
1148
- workspace: string;
1149
- };
1150
- declare type ExecuteBranchMigrationPlanError = ErrorWrapper<{
1491
+ /**
1492
+ * In order to resolve the database branch, the following algorithm is used:
1493
+ * * 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
1494
+ * * else, if a Xata branch with the exact same name as `gitBranch` exists, return it
1495
+ * * else, if `fallbackBranch` is provided and a branch with that name exists, return it
1496
+ * * else, return the default branch of the DB (`main` or the first branch)
1497
+ *
1498
+ * Example call:
1499
+ *
1500
+ * ```json
1501
+ * // GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test&fallbackBranch=tsg
1502
+ * ```
1503
+ *
1504
+ * Example response:
1505
+ *
1506
+ * ```json
1507
+ * {
1508
+ * "branch": "main",
1509
+ * "reason": {
1510
+ * "code": "DEFAULT_BRANCH",
1511
+ * "message": "Default branch for this database (main)"
1512
+ * }
1513
+ * }
1514
+ * ```
1515
+ */
1516
+ declare const resolveBranch: (variables: ResolveBranchVariables) => Promise<ResolveBranchResponse>;
1517
+ declare type ListMigrationRequestsPathParams = {
1518
+ dbName: DBName;
1519
+ workspace: string;
1520
+ };
1521
+ declare type ListMigrationRequestsError = ErrorWrapper<{
1522
+ status: 400;
1523
+ payload: BadRequestError;
1524
+ } | {
1525
+ status: 401;
1526
+ payload: AuthError;
1527
+ } | {
1528
+ status: 404;
1529
+ payload: SimpleError;
1530
+ }>;
1531
+ declare type ListMigrationRequestsResponse = {
1532
+ migrationRequests: MigrationRequest[];
1533
+ meta: RecordsMetadata;
1534
+ };
1535
+ declare type ListMigrationRequestsRequestBody = {
1536
+ filter?: FilterExpression;
1537
+ sort?: SortExpression;
1538
+ page?: PageConfig;
1539
+ columns?: ColumnsProjection;
1540
+ };
1541
+ declare type ListMigrationRequestsVariables = {
1542
+ body?: ListMigrationRequestsRequestBody;
1543
+ pathParams: ListMigrationRequestsPathParams;
1544
+ } & FetcherExtraProps;
1545
+ declare const listMigrationRequests: (variables: ListMigrationRequestsVariables) => Promise<ListMigrationRequestsResponse>;
1546
+ declare type CreateMigrationRequestPathParams = {
1547
+ dbName: DBName;
1548
+ workspace: string;
1549
+ };
1550
+ declare type CreateMigrationRequestError = ErrorWrapper<{
1551
+ status: 400;
1552
+ payload: BadRequestError;
1553
+ } | {
1554
+ status: 401;
1555
+ payload: AuthError;
1556
+ } | {
1557
+ status: 404;
1558
+ payload: SimpleError;
1559
+ }>;
1560
+ declare type CreateMigrationRequestResponse = {
1561
+ number: number;
1562
+ };
1563
+ declare type CreateMigrationRequestRequestBody = {
1564
+ source: string;
1565
+ target: string;
1566
+ title: string;
1567
+ body?: string;
1568
+ };
1569
+ declare type CreateMigrationRequestVariables = {
1570
+ body: CreateMigrationRequestRequestBody;
1571
+ pathParams: CreateMigrationRequestPathParams;
1572
+ } & FetcherExtraProps;
1573
+ declare const createMigrationRequest: (variables: CreateMigrationRequestVariables) => Promise<CreateMigrationRequestResponse>;
1574
+ declare type GetMigrationRequestPathParams = {
1575
+ dbName: DBName;
1576
+ mrNumber: number;
1577
+ workspace: string;
1578
+ };
1579
+ declare type GetMigrationRequestError = ErrorWrapper<{
1580
+ status: 400;
1581
+ payload: BadRequestError;
1582
+ } | {
1583
+ status: 401;
1584
+ payload: AuthError;
1585
+ } | {
1586
+ status: 404;
1587
+ payload: SimpleError;
1588
+ }>;
1589
+ declare type GetMigrationRequestVariables = {
1590
+ pathParams: GetMigrationRequestPathParams;
1591
+ } & FetcherExtraProps;
1592
+ declare const getMigrationRequest: (variables: GetMigrationRequestVariables) => Promise<MigrationRequest>;
1593
+ declare type UpdateMigrationRequestPathParams = {
1594
+ dbName: DBName;
1595
+ mrNumber: number;
1596
+ workspace: string;
1597
+ };
1598
+ declare type UpdateMigrationRequestError = ErrorWrapper<{
1599
+ status: 400;
1600
+ payload: BadRequestError;
1601
+ } | {
1602
+ status: 401;
1603
+ payload: AuthError;
1604
+ } | {
1605
+ status: 404;
1606
+ payload: SimpleError;
1607
+ }>;
1608
+ declare type UpdateMigrationRequestRequestBody = {
1609
+ title?: string;
1610
+ body?: string;
1611
+ status?: 'open' | 'closed';
1612
+ };
1613
+ declare type UpdateMigrationRequestVariables = {
1614
+ body?: UpdateMigrationRequestRequestBody;
1615
+ pathParams: UpdateMigrationRequestPathParams;
1616
+ } & FetcherExtraProps;
1617
+ declare const updateMigrationRequest: (variables: UpdateMigrationRequestVariables) => Promise<undefined>;
1618
+ declare type ListMigrationRequestsCommitsPathParams = {
1619
+ dbName: DBName;
1620
+ mrNumber: number;
1621
+ workspace: string;
1622
+ };
1623
+ declare type ListMigrationRequestsCommitsError = ErrorWrapper<{
1624
+ status: 400;
1625
+ payload: BadRequestError;
1626
+ } | {
1627
+ status: 401;
1628
+ payload: AuthError;
1629
+ } | {
1630
+ status: 404;
1631
+ payload: SimpleError;
1632
+ }>;
1633
+ declare type ListMigrationRequestsCommitsResponse = {
1634
+ meta: {
1635
+ cursor: string;
1636
+ more: boolean;
1637
+ };
1638
+ logs: Commit[];
1639
+ };
1640
+ declare type ListMigrationRequestsCommitsRequestBody = {
1641
+ page?: {
1642
+ after?: string;
1643
+ before?: string;
1644
+ size?: number;
1645
+ };
1646
+ };
1647
+ declare type ListMigrationRequestsCommitsVariables = {
1648
+ body?: ListMigrationRequestsCommitsRequestBody;
1649
+ pathParams: ListMigrationRequestsCommitsPathParams;
1650
+ } & FetcherExtraProps;
1651
+ declare const listMigrationRequestsCommits: (variables: ListMigrationRequestsCommitsVariables) => Promise<ListMigrationRequestsCommitsResponse>;
1652
+ declare type CompareMigrationRequestPathParams = {
1653
+ dbName: DBName;
1654
+ mrNumber: number;
1655
+ workspace: string;
1656
+ };
1657
+ declare type CompareMigrationRequestError = ErrorWrapper<{
1658
+ status: 400;
1659
+ payload: BadRequestError;
1660
+ } | {
1661
+ status: 401;
1662
+ payload: AuthError;
1663
+ } | {
1664
+ status: 404;
1665
+ payload: SimpleError;
1666
+ }>;
1667
+ declare type CompareMigrationRequestVariables = {
1668
+ pathParams: CompareMigrationRequestPathParams;
1669
+ } & FetcherExtraProps;
1670
+ declare const compareMigrationRequest: (variables: CompareMigrationRequestVariables) => Promise<SchemaCompareResponse>;
1671
+ declare type GetMigrationRequestIsMergedPathParams = {
1672
+ dbName: DBName;
1673
+ mrNumber: number;
1674
+ workspace: string;
1675
+ };
1676
+ declare type GetMigrationRequestIsMergedError = ErrorWrapper<{
1677
+ status: 400;
1678
+ payload: BadRequestError;
1679
+ } | {
1680
+ status: 401;
1681
+ payload: AuthError;
1682
+ } | {
1683
+ status: 404;
1684
+ payload: SimpleError;
1685
+ }>;
1686
+ declare type GetMigrationRequestIsMergedResponse = {
1687
+ merged?: boolean;
1688
+ };
1689
+ declare type GetMigrationRequestIsMergedVariables = {
1690
+ pathParams: GetMigrationRequestIsMergedPathParams;
1691
+ } & FetcherExtraProps;
1692
+ declare const getMigrationRequestIsMerged: (variables: GetMigrationRequestIsMergedVariables) => Promise<GetMigrationRequestIsMergedResponse>;
1693
+ declare type MergeMigrationRequestPathParams = {
1694
+ dbName: DBName;
1695
+ mrNumber: number;
1696
+ workspace: string;
1697
+ };
1698
+ declare type MergeMigrationRequestError = ErrorWrapper<{
1699
+ status: 400;
1700
+ payload: BadRequestError;
1701
+ } | {
1702
+ status: 401;
1703
+ payload: AuthError;
1704
+ } | {
1705
+ status: 404;
1706
+ payload: SimpleError;
1707
+ }>;
1708
+ declare type MergeMigrationRequestVariables = {
1709
+ pathParams: MergeMigrationRequestPathParams;
1710
+ } & FetcherExtraProps;
1711
+ declare const mergeMigrationRequest: (variables: MergeMigrationRequestVariables) => Promise<Commit>;
1712
+ declare type GetBranchDetailsPathParams = {
1713
+ dbBranchName: DBBranchName;
1714
+ workspace: string;
1715
+ };
1716
+ declare type GetBranchDetailsError = ErrorWrapper<{
1717
+ status: 400;
1718
+ payload: BadRequestError;
1719
+ } | {
1720
+ status: 401;
1721
+ payload: AuthError;
1722
+ } | {
1723
+ status: 404;
1724
+ payload: SimpleError;
1725
+ }>;
1726
+ declare type GetBranchDetailsVariables = {
1727
+ pathParams: GetBranchDetailsPathParams;
1728
+ } & FetcherExtraProps;
1729
+ declare const getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
1730
+ declare type CreateBranchPathParams = {
1731
+ dbBranchName: DBBranchName;
1732
+ workspace: string;
1733
+ };
1734
+ declare type CreateBranchQueryParams = {
1735
+ from?: string;
1736
+ };
1737
+ declare type CreateBranchError = ErrorWrapper<{
1738
+ status: 400;
1739
+ payload: BadRequestError;
1740
+ } | {
1741
+ status: 401;
1742
+ payload: AuthError;
1743
+ } | {
1744
+ status: 404;
1745
+ payload: SimpleError;
1746
+ }>;
1747
+ declare type CreateBranchResponse = {
1748
+ databaseName: string;
1749
+ branchName: string;
1750
+ };
1751
+ declare type CreateBranchRequestBody = {
1752
+ from?: string;
1753
+ metadata?: BranchMetadata;
1754
+ };
1755
+ declare type CreateBranchVariables = {
1756
+ body?: CreateBranchRequestBody;
1757
+ pathParams: CreateBranchPathParams;
1758
+ queryParams?: CreateBranchQueryParams;
1759
+ } & FetcherExtraProps;
1760
+ declare const createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
1761
+ declare type DeleteBranchPathParams = {
1762
+ dbBranchName: DBBranchName;
1763
+ workspace: string;
1764
+ };
1765
+ declare type DeleteBranchError = ErrorWrapper<{
1766
+ status: 400;
1767
+ payload: BadRequestError;
1768
+ } | {
1769
+ status: 401;
1770
+ payload: AuthError;
1771
+ } | {
1772
+ status: 404;
1773
+ payload: SimpleError;
1774
+ }>;
1775
+ declare type DeleteBranchVariables = {
1776
+ pathParams: DeleteBranchPathParams;
1777
+ } & FetcherExtraProps;
1778
+ /**
1779
+ * Delete the branch in the database and all its resources
1780
+ */
1781
+ declare const deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
1782
+ declare type UpdateBranchMetadataPathParams = {
1783
+ dbBranchName: DBBranchName;
1784
+ workspace: string;
1785
+ };
1786
+ declare type UpdateBranchMetadataError = ErrorWrapper<{
1787
+ status: 400;
1788
+ payload: BadRequestError;
1789
+ } | {
1790
+ status: 401;
1791
+ payload: AuthError;
1792
+ } | {
1793
+ status: 404;
1794
+ payload: SimpleError;
1795
+ }>;
1796
+ declare type UpdateBranchMetadataVariables = {
1797
+ body?: BranchMetadata;
1798
+ pathParams: UpdateBranchMetadataPathParams;
1799
+ } & FetcherExtraProps;
1800
+ /**
1801
+ * Update the branch metadata
1802
+ */
1803
+ declare const updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
1804
+ declare type GetBranchMetadataPathParams = {
1805
+ dbBranchName: DBBranchName;
1806
+ workspace: string;
1807
+ };
1808
+ declare type GetBranchMetadataError = ErrorWrapper<{
1809
+ status: 400;
1810
+ payload: BadRequestError;
1811
+ } | {
1812
+ status: 401;
1813
+ payload: AuthError;
1814
+ } | {
1815
+ status: 404;
1816
+ payload: SimpleError;
1817
+ }>;
1818
+ declare type GetBranchMetadataVariables = {
1819
+ pathParams: GetBranchMetadataPathParams;
1820
+ } & FetcherExtraProps;
1821
+ declare const getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
1822
+ declare type GetBranchMigrationHistoryPathParams = {
1823
+ dbBranchName: DBBranchName;
1824
+ workspace: string;
1825
+ };
1826
+ declare type GetBranchMigrationHistoryError = ErrorWrapper<{
1827
+ status: 400;
1828
+ payload: BadRequestError;
1829
+ } | {
1830
+ status: 401;
1831
+ payload: AuthError;
1832
+ } | {
1833
+ status: 404;
1834
+ payload: SimpleError;
1835
+ }>;
1836
+ declare type GetBranchMigrationHistoryResponse = {
1837
+ startedFrom?: StartedFromMetadata;
1838
+ migrations?: BranchMigration[];
1839
+ };
1840
+ declare type GetBranchMigrationHistoryRequestBody = {
1841
+ limit?: number;
1842
+ startFrom?: string;
1843
+ };
1844
+ declare type GetBranchMigrationHistoryVariables = {
1845
+ body?: GetBranchMigrationHistoryRequestBody;
1846
+ pathParams: GetBranchMigrationHistoryPathParams;
1847
+ } & FetcherExtraProps;
1848
+ declare const getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
1849
+ declare type ExecuteBranchMigrationPlanPathParams = {
1850
+ dbBranchName: DBBranchName;
1851
+ workspace: string;
1852
+ };
1853
+ declare type ExecuteBranchMigrationPlanError = ErrorWrapper<{
1151
1854
  status: 400;
1152
1855
  payload: BadRequestError;
1153
1856
  } | {
@@ -1191,12 +1894,34 @@ declare type GetBranchMigrationPlanVariables = {
1191
1894
  * Compute a migration plan from a target schema the branch should be migrated too.
1192
1895
  */
1193
1896
  declare const getBranchMigrationPlan: (variables: GetBranchMigrationPlanVariables) => Promise<BranchMigrationPlan>;
1194
- declare type CompareBranchSchemaPathParams = {
1897
+ declare type CompareBranchWithUserSchemaPathParams = {
1898
+ dbBranchName: DBBranchName;
1899
+ workspace: string;
1900
+ };
1901
+ declare type CompareBranchWithUserSchemaError = ErrorWrapper<{
1902
+ status: 400;
1903
+ payload: BadRequestError;
1904
+ } | {
1905
+ status: 401;
1906
+ payload: AuthError;
1907
+ } | {
1908
+ status: 404;
1909
+ payload: SimpleError;
1910
+ }>;
1911
+ declare type CompareBranchWithUserSchemaRequestBody = {
1912
+ schema: Schema;
1913
+ };
1914
+ declare type CompareBranchWithUserSchemaVariables = {
1915
+ body: CompareBranchWithUserSchemaRequestBody;
1916
+ pathParams: CompareBranchWithUserSchemaPathParams;
1917
+ } & FetcherExtraProps;
1918
+ declare const compareBranchWithUserSchema: (variables: CompareBranchWithUserSchemaVariables) => Promise<SchemaCompareResponse>;
1919
+ declare type CompareBranchSchemasPathParams = {
1195
1920
  dbBranchName: DBBranchName;
1196
1921
  branchName: BranchName;
1197
1922
  workspace: string;
1198
1923
  };
1199
- declare type CompareBranchSchemaError = ErrorWrapper<{
1924
+ declare type CompareBranchSchemasError = ErrorWrapper<{
1200
1925
  status: 400;
1201
1926
  payload: BadRequestError;
1202
1927
  } | {
@@ -1206,11 +1931,11 @@ declare type CompareBranchSchemaError = ErrorWrapper<{
1206
1931
  status: 404;
1207
1932
  payload: SimpleError;
1208
1933
  }>;
1209
- declare type CompareBranchSchemaVariables = {
1934
+ declare type CompareBranchSchemasVariables = {
1210
1935
  body?: Record<string, any>;
1211
- pathParams: CompareBranchSchemaPathParams;
1936
+ pathParams: CompareBranchSchemasPathParams;
1212
1937
  } & FetcherExtraProps;
1213
- declare const compareBranchSchema: (variables: CompareBranchSchemaVariables) => Promise<Record<string, any>>;
1938
+ declare const compareBranchSchemas: (variables: CompareBranchSchemasVariables) => Promise<SchemaCompareResponse>;
1214
1939
  declare type UpdateBranchSchemaPathParams = {
1215
1940
  dbBranchName: DBBranchName;
1216
1941
  workspace: string;
@@ -1225,11 +1950,68 @@ declare type UpdateBranchSchemaError = ErrorWrapper<{
1225
1950
  status: 404;
1226
1951
  payload: SimpleError;
1227
1952
  }>;
1953
+ declare type UpdateBranchSchemaResponse = {
1954
+ id: string;
1955
+ parentID: string;
1956
+ };
1228
1957
  declare type UpdateBranchSchemaVariables = {
1229
- body?: Record<string, any>;
1958
+ body: Migration;
1230
1959
  pathParams: UpdateBranchSchemaPathParams;
1231
1960
  } & FetcherExtraProps;
1232
- declare const updateBranchSchema: (variables: UpdateBranchSchemaVariables) => Promise<Record<string, any>>;
1961
+ declare const updateBranchSchema: (variables: UpdateBranchSchemaVariables) => Promise<UpdateBranchSchemaResponse>;
1962
+ declare type PreviewBranchSchemaEditPathParams = {
1963
+ dbBranchName: DBBranchName;
1964
+ workspace: string;
1965
+ };
1966
+ declare type PreviewBranchSchemaEditError = ErrorWrapper<{
1967
+ status: 400;
1968
+ payload: BadRequestError;
1969
+ } | {
1970
+ status: 401;
1971
+ payload: AuthError;
1972
+ } | {
1973
+ status: 404;
1974
+ payload: SimpleError;
1975
+ }>;
1976
+ declare type PreviewBranchSchemaEditResponse = {
1977
+ original: Schema;
1978
+ updated: Schema;
1979
+ };
1980
+ declare type PreviewBranchSchemaEditRequestBody = {
1981
+ edits?: SchemaEditScript;
1982
+ operations?: MigrationOp[];
1983
+ };
1984
+ declare type PreviewBranchSchemaEditVariables = {
1985
+ body?: PreviewBranchSchemaEditRequestBody;
1986
+ pathParams: PreviewBranchSchemaEditPathParams;
1987
+ } & FetcherExtraProps;
1988
+ declare const previewBranchSchemaEdit: (variables: PreviewBranchSchemaEditVariables) => Promise<PreviewBranchSchemaEditResponse>;
1989
+ declare type ApplyBranchSchemaEditPathParams = {
1990
+ dbBranchName: DBBranchName;
1991
+ workspace: string;
1992
+ };
1993
+ declare type ApplyBranchSchemaEditError = ErrorWrapper<{
1994
+ status: 400;
1995
+ payload: BadRequestError;
1996
+ } | {
1997
+ status: 401;
1998
+ payload: AuthError;
1999
+ } | {
2000
+ status: 404;
2001
+ payload: SimpleError;
2002
+ }>;
2003
+ declare type ApplyBranchSchemaEditResponse = {
2004
+ id: string;
2005
+ parentID: string;
2006
+ };
2007
+ declare type ApplyBranchSchemaEditRequestBody = {
2008
+ edits: SchemaEditScript;
2009
+ };
2010
+ declare type ApplyBranchSchemaEditVariables = {
2011
+ body: ApplyBranchSchemaEditRequestBody;
2012
+ pathParams: ApplyBranchSchemaEditPathParams;
2013
+ } & FetcherExtraProps;
2014
+ declare const applyBranchSchemaEdit: (variables: ApplyBranchSchemaEditVariables) => Promise<ApplyBranchSchemaEditResponse>;
1233
2015
  declare type GetBranchSchemaHistoryPathParams = {
1234
2016
  dbBranchName: DBBranchName;
1235
2017
  workspace: string;
@@ -1244,11 +2026,25 @@ declare type GetBranchSchemaHistoryError = ErrorWrapper<{
1244
2026
  status: 404;
1245
2027
  payload: SimpleError;
1246
2028
  }>;
2029
+ declare type GetBranchSchemaHistoryResponse = {
2030
+ meta: {
2031
+ cursor: string;
2032
+ more: boolean;
2033
+ };
2034
+ logs: Commit[];
2035
+ };
2036
+ declare type GetBranchSchemaHistoryRequestBody = {
2037
+ page?: {
2038
+ after?: string;
2039
+ before?: string;
2040
+ size?: number;
2041
+ };
2042
+ };
1247
2043
  declare type GetBranchSchemaHistoryVariables = {
1248
- body?: Record<string, any>;
2044
+ body?: GetBranchSchemaHistoryRequestBody;
1249
2045
  pathParams: GetBranchSchemaHistoryPathParams;
1250
2046
  } & FetcherExtraProps;
1251
- declare const getBranchSchemaHistory: (variables: GetBranchSchemaHistoryVariables) => Promise<Record<string, any>>;
2047
+ declare const getBranchSchemaHistory: (variables: GetBranchSchemaHistoryVariables) => Promise<GetBranchSchemaHistoryResponse>;
1252
2048
  declare type GetBranchStatsPathParams = {
1253
2049
  dbBranchName: DBBranchName;
1254
2050
  workspace: string;
@@ -1299,13 +2095,17 @@ declare type CreateTableError = ErrorWrapper<{
1299
2095
  status: 422;
1300
2096
  payload: SimpleError;
1301
2097
  }>;
2098
+ declare type CreateTableResponse = {
2099
+ branchName: string;
2100
+ tableName: string;
2101
+ };
1302
2102
  declare type CreateTableVariables = {
1303
2103
  pathParams: CreateTablePathParams;
1304
2104
  } & FetcherExtraProps;
1305
2105
  /**
1306
2106
  * Creates a new table with the given name. Returns 422 if a table with the same name already exists.
1307
2107
  */
1308
- declare const createTable: (variables: CreateTableVariables) => Promise<undefined>;
2108
+ declare const createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
1309
2109
  declare type DeleteTablePathParams = {
1310
2110
  dbBranchName: DBBranchName;
1311
2111
  tableName: TableName;
@@ -1352,8 +2152,9 @@ declare type UpdateTableVariables = {
1352
2152
  *
1353
2153
  * In the example below, we rename a table from “users” to “people”:
1354
2154
  *
1355
- * ```jsx
1356
- * PATCH /db/test:main/tables/users
2155
+ * ```json
2156
+ * // PATCH /db/test:main/tables/users
2157
+ *
1357
2158
  * {
1358
2159
  * "name": "people"
1359
2160
  * }
@@ -1537,6 +2338,9 @@ declare type InsertRecordPathParams = {
1537
2338
  tableName: TableName;
1538
2339
  workspace: string;
1539
2340
  };
2341
+ declare type InsertRecordQueryParams = {
2342
+ columns?: ColumnsProjection;
2343
+ };
1540
2344
  declare type InsertRecordError = ErrorWrapper<{
1541
2345
  status: 400;
1542
2346
  payload: BadRequestError;
@@ -1547,20 +2351,15 @@ declare type InsertRecordError = ErrorWrapper<{
1547
2351
  status: 404;
1548
2352
  payload: SimpleError;
1549
2353
  }>;
1550
- declare type InsertRecordResponse = {
1551
- id: string;
1552
- xata: {
1553
- version: number;
1554
- };
1555
- };
1556
2354
  declare type InsertRecordVariables = {
1557
2355
  body?: Record<string, any>;
1558
2356
  pathParams: InsertRecordPathParams;
2357
+ queryParams?: InsertRecordQueryParams;
1559
2358
  } & FetcherExtraProps;
1560
2359
  /**
1561
2360
  * Insert a new Record into the Table
1562
2361
  */
1563
- declare const insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
2362
+ declare const insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
1564
2363
  declare type InsertRecordWithIDPathParams = {
1565
2364
  dbBranchName: DBBranchName;
1566
2365
  tableName: TableName;
@@ -1568,6 +2367,7 @@ declare type InsertRecordWithIDPathParams = {
1568
2367
  workspace: string;
1569
2368
  };
1570
2369
  declare type InsertRecordWithIDQueryParams = {
2370
+ columns?: ColumnsProjection;
1571
2371
  createOnly?: boolean;
1572
2372
  ifVersion?: number;
1573
2373
  };
@@ -1600,6 +2400,7 @@ declare type UpdateRecordWithIDPathParams = {
1600
2400
  workspace: string;
1601
2401
  };
1602
2402
  declare type UpdateRecordWithIDQueryParams = {
2403
+ columns?: ColumnsProjection;
1603
2404
  ifVersion?: number;
1604
2405
  };
1605
2406
  declare type UpdateRecordWithIDError = ErrorWrapper<{
@@ -1628,6 +2429,7 @@ declare type UpsertRecordWithIDPathParams = {
1628
2429
  workspace: string;
1629
2430
  };
1630
2431
  declare type UpsertRecordWithIDQueryParams = {
2432
+ columns?: ColumnsProjection;
1631
2433
  ifVersion?: number;
1632
2434
  };
1633
2435
  declare type UpsertRecordWithIDError = ErrorWrapper<{
@@ -1655,6 +2457,9 @@ declare type DeleteRecordPathParams = {
1655
2457
  recordId: RecordID;
1656
2458
  workspace: string;
1657
2459
  };
2460
+ declare type DeleteRecordQueryParams = {
2461
+ columns?: ColumnsProjection;
2462
+ };
1658
2463
  declare type DeleteRecordError = ErrorWrapper<{
1659
2464
  status: 400;
1660
2465
  payload: BadRequestError;
@@ -1667,14 +2472,18 @@ declare type DeleteRecordError = ErrorWrapper<{
1667
2472
  }>;
1668
2473
  declare type DeleteRecordVariables = {
1669
2474
  pathParams: DeleteRecordPathParams;
2475
+ queryParams?: DeleteRecordQueryParams;
1670
2476
  } & FetcherExtraProps;
1671
- declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
2477
+ declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
1672
2478
  declare type GetRecordPathParams = {
1673
2479
  dbBranchName: DBBranchName;
1674
2480
  tableName: TableName;
1675
2481
  recordId: RecordID;
1676
2482
  workspace: string;
1677
2483
  };
2484
+ declare type GetRecordQueryParams = {
2485
+ columns?: ColumnsProjection;
2486
+ };
1678
2487
  declare type GetRecordError = ErrorWrapper<{
1679
2488
  status: 400;
1680
2489
  payload: BadRequestError;
@@ -1685,12 +2494,9 @@ declare type GetRecordError = ErrorWrapper<{
1685
2494
  status: 404;
1686
2495
  payload: SimpleError;
1687
2496
  }>;
1688
- declare type GetRecordRequestBody = {
1689
- columns?: ColumnsFilter;
1690
- };
1691
2497
  declare type GetRecordVariables = {
1692
- body?: GetRecordRequestBody;
1693
2498
  pathParams: GetRecordPathParams;
2499
+ queryParams?: GetRecordQueryParams;
1694
2500
  } & FetcherExtraProps;
1695
2501
  /**
1696
2502
  * Retrieve record by ID
@@ -1701,6 +2507,9 @@ declare type BulkInsertTableRecordsPathParams = {
1701
2507
  tableName: TableName;
1702
2508
  workspace: string;
1703
2509
  };
2510
+ declare type BulkInsertTableRecordsQueryParams = {
2511
+ columns?: ColumnsProjection;
2512
+ };
1704
2513
  declare type BulkInsertTableRecordsError = ErrorWrapper<{
1705
2514
  status: 400;
1706
2515
  payload: BulkError;
@@ -1710,21 +2519,22 @@ declare type BulkInsertTableRecordsError = ErrorWrapper<{
1710
2519
  } | {
1711
2520
  status: 404;
1712
2521
  payload: SimpleError;
2522
+ } | {
2523
+ status: 422;
2524
+ payload: SimpleError;
1713
2525
  }>;
1714
- declare type BulkInsertTableRecordsResponse = {
1715
- recordIDs: string[];
1716
- };
1717
2526
  declare type BulkInsertTableRecordsRequestBody = {
1718
2527
  records: Record<string, any>[];
1719
2528
  };
1720
2529
  declare type BulkInsertTableRecordsVariables = {
1721
2530
  body: BulkInsertTableRecordsRequestBody;
1722
2531
  pathParams: BulkInsertTableRecordsPathParams;
2532
+ queryParams?: BulkInsertTableRecordsQueryParams;
1723
2533
  } & FetcherExtraProps;
1724
2534
  /**
1725
2535
  * Bulk insert records
1726
2536
  */
1727
- declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
2537
+ declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
1728
2538
  declare type QueryTablePathParams = {
1729
2539
  dbBranchName: DBBranchName;
1730
2540
  tableName: TableName;
@@ -1744,7 +2554,7 @@ declare type QueryTableRequestBody = {
1744
2554
  filter?: FilterExpression;
1745
2555
  sort?: SortExpression;
1746
2556
  page?: PageConfig;
1747
- columns?: ColumnsFilter;
2557
+ columns?: ColumnsProjection;
1748
2558
  };
1749
2559
  declare type QueryTableVariables = {
1750
2560
  body?: QueryTableRequestBody;
@@ -1761,7 +2571,7 @@ declare type QueryTableVariables = {
1761
2571
  * {
1762
2572
  * "columns": [...],
1763
2573
  * "filter": {
1764
- * "$all": [...]
2574
+ * "$all": [...],
1765
2575
  * "$any": [...]
1766
2576
  * ...
1767
2577
  * },
@@ -1807,7 +2617,11 @@ declare type QueryTableVariables = {
1807
2617
  * "link": {
1808
2618
  * "table": "users"
1809
2619
  * }
1810
- * }
2620
+ * },
2621
+ * {
2622
+ * "name": "foundedDate",
2623
+ * "type": "datetime"
2624
+ * },
1811
2625
  * ]
1812
2626
  * },
1813
2627
  * {
@@ -1895,7 +2709,7 @@ declare type QueryTableVariables = {
1895
2709
  * {
1896
2710
  * "name": "Kilian",
1897
2711
  * "address": {
1898
- * "street": "New street",
2712
+ * "street": "New street"
1899
2713
  * }
1900
2714
  * }
1901
2715
  * ```
@@ -1904,10 +2718,7 @@ declare type QueryTableVariables = {
1904
2718
  *
1905
2719
  * ```json
1906
2720
  * {
1907
- * "columns": [
1908
- * "*",
1909
- * "team.name"
1910
- * ]
2721
+ * "columns": ["*", "team.name"]
1911
2722
  * }
1912
2723
  * ```
1913
2724
  *
@@ -1925,7 +2736,7 @@ declare type QueryTableVariables = {
1925
2736
  * "team": {
1926
2737
  * "id": "XX",
1927
2738
  * "xata": {
1928
- * "version": 0,
2739
+ * "version": 0
1929
2740
  * },
1930
2741
  * "name": "first team"
1931
2742
  * }
@@ -1936,10 +2747,7 @@ declare type QueryTableVariables = {
1936
2747
  *
1937
2748
  * ```json
1938
2749
  * {
1939
- * "columns": [
1940
- * "*",
1941
- * "team.*"
1942
- * ]
2750
+ * "columns": ["*", "team.*"]
1943
2751
  * }
1944
2752
  * ```
1945
2753
  *
@@ -1957,10 +2765,11 @@ declare type QueryTableVariables = {
1957
2765
  * "team": {
1958
2766
  * "id": "XX",
1959
2767
  * "xata": {
1960
- * "version": 0,
2768
+ * "version": 0
1961
2769
  * },
1962
2770
  * "name": "first team",
1963
- * "code": "A1"
2771
+ * "code": "A1",
2772
+ * "foundedDate": "2020-03-04T10:43:54.32Z"
1964
2773
  * }
1965
2774
  * }
1966
2775
  * ```
@@ -1975,7 +2784,7 @@ declare type QueryTableVariables = {
1975
2784
  * `$none`, etc.
1976
2785
  *
1977
2786
  * All operators start with an `$` to differentiate them from column names
1978
- * (which are not allowed to start with an dollar sign).
2787
+ * (which are not allowed to start with a dollar sign).
1979
2788
  *
1980
2789
  * #### Exact matching and control operators
1981
2790
  *
@@ -2006,7 +2815,7 @@ declare type QueryTableVariables = {
2006
2815
  * ```json
2007
2816
  * {
2008
2817
  * "filter": {
2009
- * "name": "r2",
2818
+ * "name": "r2"
2010
2819
  * }
2011
2820
  * }
2012
2821
  * ```
@@ -2028,7 +2837,7 @@ declare type QueryTableVariables = {
2028
2837
  * ```json
2029
2838
  * {
2030
2839
  * "filter": {
2031
- * "settings.plan": "free",
2840
+ * "settings.plan": "free"
2032
2841
  * }
2033
2842
  * }
2034
2843
  * ```
@@ -2038,8 +2847,8 @@ declare type QueryTableVariables = {
2038
2847
  * "filter": {
2039
2848
  * "settings": {
2040
2849
  * "plan": "free"
2041
- * },
2042
- * },
2850
+ * }
2851
+ * }
2043
2852
  * }
2044
2853
  * ```
2045
2854
  *
@@ -2048,8 +2857,8 @@ declare type QueryTableVariables = {
2048
2857
  * ```json
2049
2858
  * {
2050
2859
  * "filter": {
2051
- * "settings.plan": {"$any": ["free", "paid"]}
2052
- * },
2860
+ * "settings.plan": { "$any": ["free", "paid"] }
2861
+ * }
2053
2862
  * }
2054
2863
  * ```
2055
2864
  *
@@ -2058,9 +2867,9 @@ declare type QueryTableVariables = {
2058
2867
  * ```json
2059
2868
  * {
2060
2869
  * "filter": {
2061
- * "settings.dark": true,
2062
- * "settings.plan": "free",
2063
- * },
2870
+ * "settings.dark": true,
2871
+ * "settings.plan": "free"
2872
+ * }
2064
2873
  * }
2065
2874
  * ```
2066
2875
  *
@@ -2071,11 +2880,11 @@ declare type QueryTableVariables = {
2071
2880
  * ```json
2072
2881
  * {
2073
2882
  * "filter": {
2074
- * "$any": {
2075
- * "settings.dark": true,
2076
- * "settings.plan": "free"
2077
- * }
2078
- * },
2883
+ * "$any": {
2884
+ * "settings.dark": true,
2885
+ * "settings.plan": "free"
2886
+ * }
2887
+ * }
2079
2888
  * }
2080
2889
  * ```
2081
2890
  *
@@ -2086,10 +2895,10 @@ declare type QueryTableVariables = {
2086
2895
  * "filter": {
2087
2896
  * "$any": [
2088
2897
  * {
2089
- * "name": "r1",
2898
+ * "name": "r1"
2090
2899
  * },
2091
2900
  * {
2092
- * "name": "r2",
2901
+ * "name": "r2"
2093
2902
  * }
2094
2903
  * ]
2095
2904
  * }
@@ -2101,7 +2910,7 @@ declare type QueryTableVariables = {
2101
2910
  * ```json
2102
2911
  * {
2103
2912
  * "filter": {
2104
- * "$exists": "settings",
2913
+ * "$exists": "settings"
2105
2914
  * }
2106
2915
  * }
2107
2916
  * ```
@@ -2113,10 +2922,10 @@ declare type QueryTableVariables = {
2113
2922
  * "filter": {
2114
2923
  * "$all": [
2115
2924
  * {
2116
- * "$exists": "settings",
2925
+ * "$exists": "settings"
2117
2926
  * },
2118
2927
  * {
2119
- * "$exists": "name",
2928
+ * "$exists": "name"
2120
2929
  * }
2121
2930
  * ]
2122
2931
  * }
@@ -2128,7 +2937,7 @@ declare type QueryTableVariables = {
2128
2937
  * ```json
2129
2938
  * {
2130
2939
  * "filter": {
2131
- * "$notExists": "settings",
2940
+ * "$notExists": "settings"
2132
2941
  * }
2133
2942
  * }
2134
2943
  * ```
@@ -2155,43 +2964,59 @@ declare type QueryTableVariables = {
2155
2964
  * {
2156
2965
  * "filter": {
2157
2966
  * "<column_name>": {
2158
- * "$pattern": "v*alue*"
2967
+ * "$pattern": "v*alu?"
2159
2968
  * }
2160
2969
  * }
2161
2970
  * }
2162
2971
  * ```
2163
2972
  *
2973
+ * The `$pattern` operator accepts two wildcard characters:
2974
+ * * `*` matches zero or more characters
2975
+ * * `?` matches exactly one character
2976
+ *
2977
+ * 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.
2978
+ *
2164
2979
  * We could also have `$endsWith` and `$startsWith` operators:
2165
2980
  *
2166
2981
  * ```json
2167
2982
  * {
2168
2983
  * "filter": {
2169
2984
  * "<column_name>": {
2170
- * "$endsWith": ".gz"
2985
+ * "$endsWith": ".gz"
2171
2986
  * },
2172
2987
  * "<column_name>": {
2173
- * "$startsWith": "tmp-"
2988
+ * "$startsWith": "tmp-"
2174
2989
  * }
2175
2990
  * }
2176
2991
  * }
2177
2992
  * ```
2178
2993
  *
2179
- * #### Numeric ranges
2994
+ * #### Numeric or datetime ranges
2180
2995
  *
2181
2996
  * ```json
2182
2997
  * {
2183
2998
  * "filter": {
2184
- * "<column_name>": {
2185
- * "$ge": 0,
2186
- * "$lt": 100
2187
- * }
2999
+ * "<column_name>": {
3000
+ * "$ge": 0,
3001
+ * "$lt": 100
3002
+ * }
3003
+ * }
3004
+ * }
3005
+ * ```
3006
+ * Date ranges support the same operators, with the date using the format defined in
3007
+ * [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339):
3008
+ * ```json
3009
+ * {
3010
+ * "filter": {
3011
+ * "<column_name>": {
3012
+ * "$gt": "2019-10-12T07:20:50.52Z",
3013
+ * "$lt": "2021-10-12T07:20:50.52Z"
3014
+ * }
2188
3015
  * }
2189
3016
  * }
2190
3017
  * ```
2191
- *
2192
3018
  * The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
2193
3019
  *
2194
- *
2195
3020
  * #### Negations
2196
3021
  *
2197
3022
  * A general `$not` operator can inverse any operation.
@@ -2216,15 +3041,21 @@ declare type QueryTableVariables = {
2216
3041
  * {
2217
3042
  * "filter": {
2218
3043
  * "$not": {
2219
- * "$any": [{
2220
- * "<column_name1>": "value1"
2221
- * }, {
2222
- * "$all": [{
2223
- * "<column_name2>": "value2"
2224
- * }, {
2225
- * "<column_name3>": "value3"
2226
- * }]
2227
- * }]
3044
+ * "$any": [
3045
+ * {
3046
+ * "<column_name1>": "value1"
3047
+ * },
3048
+ * {
3049
+ * "$all": [
3050
+ * {
3051
+ * "<column_name2>": "value2"
3052
+ * },
3053
+ * {
3054
+ * "<column_name3>": "value3"
3055
+ * }
3056
+ * ]
3057
+ * }
3058
+ * ]
2228
3059
  * }
2229
3060
  * }
2230
3061
  * }
@@ -2279,8 +3110,8 @@ declare type QueryTableVariables = {
2279
3110
  * "<array name>": {
2280
3111
  * "$includes": {
2281
3112
  * "$all": [
2282
- * {"$contains": "label"},
2283
- * {"$not": {"$endsWith": "-debug"}}
3113
+ * { "$contains": "label" },
3114
+ * { "$not": { "$endsWith": "-debug" } }
2284
3115
  * ]
2285
3116
  * }
2286
3117
  * }
@@ -2300,9 +3131,7 @@ declare type QueryTableVariables = {
2300
3131
  * {
2301
3132
  * "filter": {
2302
3133
  * "settings.labels": {
2303
- * "$includesAll": [
2304
- * {"$contains": "label"},
2305
- * ]
3134
+ * "$includesAll": [{ "$contains": "label" }]
2306
3135
  * }
2307
3136
  * }
2308
3137
  * }
@@ -2350,7 +3179,6 @@ declare type QueryTableVariables = {
2350
3179
  * }
2351
3180
  * ```
2352
3181
  *
2353
- *
2354
3182
  * ### Pagination
2355
3183
  *
2356
3184
  * We offer cursor pagination and offset pagination. The offset pagination is limited
@@ -2416,8 +3244,8 @@ declare type QueryTableVariables = {
2416
3244
  * can be queried by update `page.after` to the returned cursor while keeping the
2417
3245
  * `page.before` cursor from the first range query.
2418
3246
  *
2419
- * The `filter` , `columns`, `sort` , and `page.size` configuration will be
2420
- * encoded with the cursor. The pagination request will be invalid if
3247
+ * The `filter` , `columns`, `sort` , and `page.size` configuration will be
3248
+ * encoded with the cursor. The pagination request will be invalid if
2421
3249
  * `filter` or `sort` is set. The columns returned and page size can be changed
2422
3250
  * anytime by passing the `columns` or `page.size` settings to the next query.
2423
3251
  *
@@ -2454,6 +3282,41 @@ declare type QueryTableVariables = {
2454
3282
  * ```
2455
3283
  */
2456
3284
  declare const queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
3285
+ declare type SearchTablePathParams = {
3286
+ dbBranchName: DBBranchName;
3287
+ tableName: TableName;
3288
+ workspace: string;
3289
+ };
3290
+ declare type SearchTableError = ErrorWrapper<{
3291
+ status: 400;
3292
+ payload: BadRequestError;
3293
+ } | {
3294
+ status: 401;
3295
+ payload: AuthError;
3296
+ } | {
3297
+ status: 404;
3298
+ payload: SimpleError;
3299
+ }>;
3300
+ declare type SearchTableRequestBody = {
3301
+ query: string;
3302
+ fuzziness?: FuzzinessExpression;
3303
+ prefix?: PrefixExpression;
3304
+ filter?: FilterExpression;
3305
+ highlight?: HighlightExpression;
3306
+ boosters?: BoosterExpression[];
3307
+ };
3308
+ declare type SearchTableVariables = {
3309
+ body: SearchTableRequestBody;
3310
+ pathParams: SearchTablePathParams;
3311
+ } & FetcherExtraProps;
3312
+ /**
3313
+ * Run a free text search operation in a particular table.
3314
+ *
3315
+ * 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:
3316
+ * * filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of type `text`
3317
+ * * filtering on columns of type `multiple` is currently unsupported
3318
+ */
3319
+ declare const searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2457
3320
  declare type SearchBranchPathParams = {
2458
3321
  dbBranchName: DBBranchName;
2459
3322
  workspace: string;
@@ -2469,9 +3332,15 @@ declare type SearchBranchError = ErrorWrapper<{
2469
3332
  payload: SimpleError;
2470
3333
  }>;
2471
3334
  declare type SearchBranchRequestBody = {
2472
- tables?: string[];
3335
+ tables?: (string | {
3336
+ table: string;
3337
+ filter?: FilterExpression;
3338
+ boosters?: BoosterExpression[];
3339
+ })[];
2473
3340
  query: string;
2474
- fuzziness?: number;
3341
+ fuzziness?: FuzzinessExpression;
3342
+ prefix?: PrefixExpression;
3343
+ highlight?: HighlightExpression;
2475
3344
  };
2476
3345
  declare type SearchBranchVariables = {
2477
3346
  body: SearchBranchRequestBody;
@@ -2500,6 +3369,7 @@ declare const operationsByTag: {
2500
3369
  updateWorkspaceMemberRole: (variables: UpdateWorkspaceMemberRoleVariables) => Promise<undefined>;
2501
3370
  removeWorkspaceMember: (variables: RemoveWorkspaceMemberVariables) => Promise<undefined>;
2502
3371
  inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<WorkspaceInvite>;
3372
+ updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
2503
3373
  cancelWorkspaceMemberInvite: (variables: CancelWorkspaceMemberInviteVariables) => Promise<undefined>;
2504
3374
  resendWorkspaceMemberInvite: (variables: ResendWorkspaceMemberInviteVariables) => Promise<undefined>;
2505
3375
  acceptWorkspaceMemberInvite: (variables: AcceptWorkspaceMemberInviteVariables) => Promise<undefined>;
@@ -2508,24 +3378,45 @@ declare const operationsByTag: {
2508
3378
  getDatabaseList: (variables: GetDatabaseListVariables) => Promise<ListDatabasesResponse>;
2509
3379
  createDatabase: (variables: CreateDatabaseVariables) => Promise<CreateDatabaseResponse>;
2510
3380
  deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
3381
+ getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
3382
+ patchDatabaseMetadata: (variables: PatchDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
3383
+ getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
3384
+ addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
3385
+ removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
3386
+ resolveBranch: (variables: ResolveBranchVariables) => Promise<ResolveBranchResponse>;
2511
3387
  };
2512
3388
  branch: {
2513
3389
  getBranchList: (variables: GetBranchListVariables) => Promise<ListBranchesResponse>;
2514
3390
  getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
2515
- createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
3391
+ createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
2516
3392
  deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
2517
3393
  updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
2518
3394
  getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
3395
+ getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
3396
+ };
3397
+ migrationRequests: {
3398
+ listMigrationRequests: (variables: ListMigrationRequestsVariables) => Promise<ListMigrationRequestsResponse>;
3399
+ createMigrationRequest: (variables: CreateMigrationRequestVariables) => Promise<CreateMigrationRequestResponse>;
3400
+ getMigrationRequest: (variables: GetMigrationRequestVariables) => Promise<MigrationRequest>;
3401
+ updateMigrationRequest: (variables: UpdateMigrationRequestVariables) => Promise<undefined>;
3402
+ listMigrationRequestsCommits: (variables: ListMigrationRequestsCommitsVariables) => Promise<ListMigrationRequestsCommitsResponse>;
3403
+ compareMigrationRequest: (variables: CompareMigrationRequestVariables) => Promise<SchemaCompareResponse>;
3404
+ getMigrationRequestIsMerged: (variables: GetMigrationRequestIsMergedVariables) => Promise<GetMigrationRequestIsMergedResponse>;
3405
+ mergeMigrationRequest: (variables: MergeMigrationRequestVariables) => Promise<Commit>;
3406
+ };
3407
+ branchSchema: {
2519
3408
  getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
2520
3409
  executeBranchMigrationPlan: (variables: ExecuteBranchMigrationPlanVariables) => Promise<undefined>;
2521
3410
  getBranchMigrationPlan: (variables: GetBranchMigrationPlanVariables) => Promise<BranchMigrationPlan>;
2522
- compareBranchSchema: (variables: CompareBranchSchemaVariables) => Promise<Record<string, any>>;
2523
- updateBranchSchema: (variables: UpdateBranchSchemaVariables) => Promise<Record<string, any>>;
2524
- getBranchSchemaHistory: (variables: GetBranchSchemaHistoryVariables) => Promise<Record<string, any>>;
2525
- getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
3411
+ compareBranchWithUserSchema: (variables: CompareBranchWithUserSchemaVariables) => Promise<SchemaCompareResponse>;
3412
+ compareBranchSchemas: (variables: CompareBranchSchemasVariables) => Promise<SchemaCompareResponse>;
3413
+ updateBranchSchema: (variables: UpdateBranchSchemaVariables) => Promise<UpdateBranchSchemaResponse>;
3414
+ previewBranchSchemaEdit: (variables: PreviewBranchSchemaEditVariables) => Promise<PreviewBranchSchemaEditResponse>;
3415
+ applyBranchSchemaEdit: (variables: ApplyBranchSchemaEditVariables) => Promise<ApplyBranchSchemaEditResponse>;
3416
+ getBranchSchemaHistory: (variables: GetBranchSchemaHistoryVariables) => Promise<GetBranchSchemaHistoryResponse>;
2526
3417
  };
2527
3418
  table: {
2528
- createTable: (variables: CreateTableVariables) => Promise<undefined>;
3419
+ createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
2529
3420
  deleteTable: (variables: DeleteTableVariables) => Promise<undefined>;
2530
3421
  updateTable: (variables: UpdateTableVariables) => Promise<undefined>;
2531
3422
  getTableSchema: (variables: GetTableSchemaVariables) => Promise<GetTableSchemaResponse>;
@@ -2537,14 +3428,15 @@ declare const operationsByTag: {
2537
3428
  updateColumn: (variables: UpdateColumnVariables) => Promise<MigrationIdResponse>;
2538
3429
  };
2539
3430
  records: {
2540
- insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
3431
+ insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
2541
3432
  insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2542
3433
  updateRecordWithID: (variables: UpdateRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2543
3434
  upsertRecordWithID: (variables: UpsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2544
- deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
3435
+ deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
2545
3436
  getRecord: (variables: GetRecordVariables) => Promise<XataRecord$1>;
2546
- bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
3437
+ bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
2547
3438
  queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
3439
+ searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2548
3440
  searchBranch: (variables: SearchBranchVariables) => Promise<SearchResponse>;
2549
3441
  };
2550
3442
  };
@@ -2560,6 +3452,7 @@ interface XataApiClientOptions {
2560
3452
  fetch?: FetchImpl;
2561
3453
  apiKey?: string;
2562
3454
  host?: HostProvider;
3455
+ trace?: TraceFunction;
2563
3456
  }
2564
3457
  declare class XataApiClient {
2565
3458
  #private;
@@ -2570,6 +3463,8 @@ declare class XataApiClient {
2570
3463
  get branches(): BranchApi;
2571
3464
  get tables(): TableApi;
2572
3465
  get records(): RecordsApi;
3466
+ get migrationRequests(): MigrationRequestsApi;
3467
+ get branchSchema(): BranchSchemaApi;
2573
3468
  }
2574
3469
  declare class UserApi {
2575
3470
  private extraProps;
@@ -2593,6 +3488,7 @@ declare class WorkspaceApi {
2593
3488
  updateWorkspaceMemberRole(workspaceId: WorkspaceID, userId: UserID, role: Role): Promise<void>;
2594
3489
  removeWorkspaceMember(workspaceId: WorkspaceID, userId: UserID): Promise<void>;
2595
3490
  inviteWorkspaceMember(workspaceId: WorkspaceID, email: string, role: Role): Promise<WorkspaceInvite>;
3491
+ updateWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID, role: Role): Promise<WorkspaceInvite>;
2596
3492
  cancelWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2597
3493
  resendWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2598
3494
  acceptWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteKey: InviteKey): Promise<void>;
@@ -2603,25 +3499,28 @@ declare class DatabaseApi {
2603
3499
  getDatabaseList(workspace: WorkspaceID): Promise<ListDatabasesResponse>;
2604
3500
  createDatabase(workspace: WorkspaceID, dbName: DBName, options?: CreateDatabaseRequestBody): Promise<CreateDatabaseResponse>;
2605
3501
  deleteDatabase(workspace: WorkspaceID, dbName: DBName): Promise<void>;
3502
+ getDatabaseMetadata(workspace: WorkspaceID, dbName: DBName): Promise<DatabaseMetadata>;
3503
+ patchDatabaseMetadata(workspace: WorkspaceID, dbName: DBName, options?: PatchDatabaseMetadataRequestBody): Promise<DatabaseMetadata>;
3504
+ getGitBranchesMapping(workspace: WorkspaceID, dbName: DBName): Promise<ListGitBranchesResponse>;
3505
+ addGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, body: AddGitBranchesEntryRequestBody): Promise<AddGitBranchesEntryResponse>;
3506
+ removeGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<void>;
3507
+ resolveBranch(workspace: WorkspaceID, dbName: DBName, gitBranch?: string, fallbackBranch?: string): Promise<ResolveBranchResponse>;
2606
3508
  }
2607
3509
  declare class BranchApi {
2608
3510
  private extraProps;
2609
3511
  constructor(extraProps: FetcherExtraProps);
2610
3512
  getBranchList(workspace: WorkspaceID, dbName: DBName): Promise<ListBranchesResponse>;
2611
3513
  getBranchDetails(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<DBBranch>;
2612
- createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<void>;
3514
+ createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<CreateBranchResponse>;
2613
3515
  deleteBranch(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<void>;
2614
3516
  updateBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName, metadata?: BranchMetadata): Promise<void>;
2615
3517
  getBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<BranchMetadata>;
2616
- getBranchMigrationHistory(workspace: WorkspaceID, database: DBName, branch: BranchName, options?: GetBranchMigrationHistoryRequestBody): Promise<GetBranchMigrationHistoryResponse>;
2617
- executeBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, migrationPlan: ExecuteBranchMigrationPlanRequestBody): Promise<void>;
2618
- getBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, schema: Schema): Promise<BranchMigrationPlan>;
2619
3518
  getBranchStats(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<GetBranchStatsResponse>;
2620
3519
  }
2621
3520
  declare class TableApi {
2622
3521
  private extraProps;
2623
3522
  constructor(extraProps: FetcherExtraProps);
2624
- createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
3523
+ createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<CreateTableResponse>;
2625
3524
  deleteTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
2626
3525
  updateTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, options: UpdateTableRequestBody): Promise<void>;
2627
3526
  getTableSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<GetTableSchemaResponse>;
@@ -2635,16 +3534,42 @@ declare class TableApi {
2635
3534
  declare class RecordsApi {
2636
3535
  private extraProps;
2637
3536
  constructor(extraProps: FetcherExtraProps);
2638
- insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>): Promise<InsertRecordResponse>;
3537
+ insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>, options?: InsertRecordQueryParams): Promise<RecordUpdateResponse>;
2639
3538
  insertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: InsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2640
3539
  updateRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpdateRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2641
3540
  upsertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2642
- deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID): Promise<void>;
2643
- getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordRequestBody): Promise<XataRecord$1>;
2644
- bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[]): Promise<BulkInsertTableRecordsResponse>;
3541
+ deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: DeleteRecordQueryParams): Promise<RecordUpdateResponse>;
3542
+ getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordQueryParams): Promise<XataRecord$1>;
3543
+ bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[], options?: BulkInsertTableRecordsQueryParams): Promise<BulkInsertResponse>;
2645
3544
  queryTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: QueryTableRequestBody): Promise<QueryResponse>;
3545
+ searchTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: SearchTableRequestBody): Promise<SearchResponse>;
2646
3546
  searchBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, query: SearchBranchRequestBody): Promise<SearchResponse>;
2647
3547
  }
3548
+ declare class MigrationRequestsApi {
3549
+ private extraProps;
3550
+ constructor(extraProps: FetcherExtraProps);
3551
+ listMigrationRequests(workspace: WorkspaceID, database: DBName, options?: ListMigrationRequestsRequestBody): Promise<ListMigrationRequestsResponse>;
3552
+ createMigrationRequest(workspace: WorkspaceID, database: DBName, options: CreateMigrationRequestRequestBody): Promise<CreateMigrationRequestResponse>;
3553
+ getMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<MigrationRequest>;
3554
+ updateMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number, options: UpdateMigrationRequestRequestBody): Promise<void>;
3555
+ listMigrationRequestsCommits(workspace: WorkspaceID, database: DBName, migrationRequest: number, options?: ListMigrationRequestsCommitsRequestBody): Promise<ListMigrationRequestsCommitsResponse>;
3556
+ compareMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<SchemaCompareResponse>;
3557
+ getMigrationRequestIsMerged(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<GetMigrationRequestIsMergedResponse>;
3558
+ mergeMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<Commit>;
3559
+ }
3560
+ declare class BranchSchemaApi {
3561
+ private extraProps;
3562
+ constructor(extraProps: FetcherExtraProps);
3563
+ getBranchMigrationHistory(workspace: WorkspaceID, database: DBName, branch: BranchName, options?: GetBranchMigrationHistoryRequestBody): Promise<GetBranchMigrationHistoryResponse>;
3564
+ executeBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, migrationPlan: ExecuteBranchMigrationPlanRequestBody): Promise<void>;
3565
+ getBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, schema: Schema): Promise<BranchMigrationPlan>;
3566
+ compareBranchWithUserSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, schema: Schema): Promise<SchemaCompareResponse>;
3567
+ compareBranchSchemas(workspace: WorkspaceID, database: DBName, branch: BranchName, branchName: BranchName, schema: Schema): Promise<SchemaCompareResponse>;
3568
+ updateBranchSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, migration: Migration): Promise<UpdateBranchSchemaResponse>;
3569
+ previewBranchSchemaEdit(workspace: WorkspaceID, database: DBName, branch: BranchName, migration: Migration): Promise<PreviewBranchSchemaEditResponse>;
3570
+ applyBranchSchemaEdit(workspace: WorkspaceID, database: DBName, branch: BranchName, edits: SchemaEditScript): Promise<ApplyBranchSchemaEditResponse>;
3571
+ getBranchSchemaHistory(workspace: WorkspaceID, database: DBName, branch: BranchName, options?: GetBranchSchemaHistoryRequestBody): Promise<GetBranchSchemaHistoryResponse>;
3572
+ }
2648
3573
 
2649
3574
  declare class XataApiPlugin implements XataPlugin {
2650
3575
  build(options: XataPluginOptions): Promise<XataApiClient>;
@@ -2656,28 +3581,29 @@ declare type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) ex
2656
3581
  declare type If<Condition, Then, Else> = Condition extends true ? Then : Else;
2657
3582
  declare type IsObject<T> = T extends Record<string, any> ? true : false;
2658
3583
  declare type IsArray<T> = T extends Array<any> ? true : false;
2659
- declare type NonEmptyArray<T> = T[] & {
2660
- 0: T;
2661
- };
2662
3584
  declare type RequiredBy<T, K extends keyof T> = T & {
2663
3585
  [P in K]-?: NonNullable<T[P]>;
2664
3586
  };
2665
3587
  declare type GetArrayInnerType<T extends readonly any[]> = T[number];
2666
3588
  declare type SingleOrArray<T> = T | T[];
2667
- declare type Dictionary<T> = Record<string, T>;
3589
+ declare type OmitBy<T, K extends keyof T> = T extends any ? Omit<T, K> : never;
3590
+ declare type Without<T, U> = {
3591
+ [P in Exclude<keyof T, keyof U>]?: never;
3592
+ };
3593
+ declare type ExclusiveOr<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
2668
3594
 
2669
3595
  declare type SelectableColumn<O, RecursivePath extends any[] = []> = '*' | 'id' | DataProps<O> | NestedColumns<O, RecursivePath>;
2670
- declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord & UnionToIntersection<Values<{
2671
- [K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord;
3596
+ declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord<O> & UnionToIntersection<Values<{
3597
+ [K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord<O>;
2672
3598
  }>>;
2673
- 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]> ? {
2674
- V: ValueAtColumn<O[K], V>;
2675
- } : never) : O[K]> : never : never;
3599
+ 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> ? {
3600
+ V: ValueAtColumn<Item, V>;
3601
+ } : never : O[K] : never> : never : never;
2676
3602
  declare type MAX_RECURSION = 5;
2677
3603
  declare type NestedColumns<O, RecursivePath extends any[]> = RecursivePath['length'] extends MAX_RECURSION ? never : If<IsObject<O>, Values<{
2678
- [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
2679
- 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
2680
- K>>;
3604
+ [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
3605
+ 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
3606
+ K>> : never;
2681
3607
  }>, never>;
2682
3608
  declare type DataProps<O> = Exclude<StringKeys<O>, StringKeys<XataRecord>>;
2683
3609
  declare type NestedValueAtColumn<O, Key extends SelectableColumn<O>> = Key extends `${infer N}.${infer M}` ? N extends DataProps<O> ? {
@@ -2704,56 +3630,85 @@ interface BaseData {
2704
3630
  /**
2705
3631
  * Represents a persisted record from the database.
2706
3632
  */
2707
- interface XataRecord extends Identifiable {
3633
+ interface XataRecord<OriginalRecord extends XataRecord<any> = XataRecord<any>> extends Identifiable {
2708
3634
  /**
2709
- * Metadata of this record.
3635
+ * Get metadata of this record.
2710
3636
  */
2711
- xata: {
2712
- /**
2713
- * Number that is increased every time the record is updated.
2714
- */
2715
- version: number;
2716
- };
3637
+ getMetadata(): XataRecordMetadata;
2717
3638
  /**
2718
3639
  * Retrieves a refreshed copy of the current record from the database.
3640
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3641
+ * @returns The persisted record with the selected columns, null if not found.
2719
3642
  */
2720
- read(): Promise<Readonly<SelectedPick<this, ['*']>> | null>;
3643
+ read<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
3644
+ /**
3645
+ * Retrieves a refreshed copy of the current record from the database.
3646
+ * @returns The persisted record with all first level properties, null if not found.
3647
+ */
3648
+ read(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2721
3649
  /**
2722
3650
  * Performs a partial update of the current record. On success a new object is
2723
3651
  * returned and the current object is not mutated.
2724
- * @param data The columns and their values that have to be updated.
2725
- * @returns A new record containing the latest values for all the columns of the current record.
3652
+ * @param partialUpdate The columns and their values that have to be updated.
3653
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3654
+ * @returns The persisted record with the selected columns, null if not found.
3655
+ */
3656
+ update<K extends SelectableColumn<OriginalRecord>>(partialUpdate: Partial<EditableData<OriginalRecord>>, columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
3657
+ /**
3658
+ * Performs a partial update of the current record. On success a new object is
3659
+ * returned and the current object is not mutated.
3660
+ * @param partialUpdate The columns and their values that have to be updated.
3661
+ * @returns The persisted record with all first level properties, null if not found.
2726
3662
  */
2727
- update(partialUpdate: Partial<EditableData<Omit<this, keyof XataRecord>>>): Promise<Readonly<SelectedPick<this, ['*']>>>;
3663
+ update(partialUpdate: Partial<EditableData<OriginalRecord>>): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2728
3664
  /**
2729
3665
  * Performs a deletion of the current record in the database.
2730
- *
2731
- * @throws If the record was already deleted or if an error happened while performing the deletion.
3666
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3667
+ * @returns The deleted record, null if not found.
2732
3668
  */
2733
- delete(): Promise<void>;
3669
+ delete<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
3670
+ /**
3671
+ * Performs a deletion of the current record in the database.
3672
+ * @returns The deleted record, null if not found.
3673
+
3674
+ */
3675
+ delete(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2734
3676
  }
2735
3677
  declare type Link<Record extends XataRecord> = Omit<XataRecord, 'read' | 'update'> & {
2736
3678
  /**
2737
3679
  * Retrieves a refreshed copy of the current record from the database.
2738
3680
  */
2739
- read(): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3681
+ read<K extends SelectableColumn<Record>>(columns?: K[]): Promise<Readonly<SelectedPick<Record, typeof columns extends SelectableColumn<Record>[] ? typeof columns : ['*']>> | null>;
2740
3682
  /**
2741
3683
  * Performs a partial update of the current record. On success a new object is
2742
3684
  * returned and the current object is not mutated.
2743
- * @param data The columns and their values that have to be updated.
3685
+ * @param partialUpdate The columns and their values that have to be updated.
2744
3686
  * @returns A new record containing the latest values for all the columns of the current record.
2745
3687
  */
2746
- update(partialUpdate: Partial<EditableData<Omit<Record, keyof XataRecord>>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3688
+ update<K extends SelectableColumn<Record>>(partialUpdate: Partial<EditableData<Record>>, columns?: K[]): Promise<Readonly<SelectedPick<Record, typeof columns extends SelectableColumn<Record>[] ? typeof columns : ['*']>>>;
3689
+ /**
3690
+ * Performs a deletion of the current record in the database.
3691
+ *
3692
+ * @throws If the record was already deleted or if an error happened while performing the deletion.
3693
+ */
3694
+ delete(): Promise<void>;
3695
+ };
3696
+ declare type XataRecordMetadata = {
3697
+ /**
3698
+ * Number that is increased every time the record is updated.
3699
+ */
3700
+ version: number;
3701
+ warnings?: string[];
2747
3702
  };
2748
3703
  declare function isIdentifiable(x: any): x is Identifiable & Record<string, unknown>;
2749
3704
  declare function isXataRecord(x: any): x is XataRecord & Record<string, unknown>;
2750
- declare type EditableData<O extends BaseData> = {
3705
+ declare type EditableData<O extends XataRecord> = Identifiable & Omit<{
2751
3706
  [K in keyof O]: O[K] extends XataRecord ? {
2752
3707
  id: string;
2753
- } : NonNullable<O[K]> extends XataRecord ? {
3708
+ } | string : NonNullable<O[K]> extends XataRecord ? {
2754
3709
  id: string;
2755
- } | null | undefined : O[K];
2756
- };
3710
+ } | string | null | undefined : O[K];
3711
+ }, keyof XataRecord>;
2757
3712
 
2758
3713
  /**
2759
3714
  * PropertyMatchFilter
@@ -2828,8 +3783,8 @@ declare type ValueTypeFilters<T> = T | T extends string ? StringTypeFilter : T e
2828
3783
  ],
2829
3784
  }
2830
3785
  */
2831
- declare type AggregatorFilter<Record> = {
2832
- [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<Record>>;
3786
+ declare type AggregatorFilter<T> = {
3787
+ [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<T>>;
2833
3788
  };
2834
3789
  /**
2835
3790
  * Existance filter
@@ -2838,16 +3793,94 @@ declare type AggregatorFilter<Record> = {
2838
3793
  declare type ExistanceFilter<Record> = {
2839
3794
  [key in '$exists' | '$notExists']?: SelectableColumn<Record>;
2840
3795
  };
2841
- declare type BaseApiFilter<Record> = PropertyAccessFilter<Record> | AggregatorFilter<Record> | ExistanceFilter<Record>;
2842
- /**
2843
- * Nested filter
2844
- * Injects the Api filters on nested properties
2845
- * Example: { filter: { settings: { plan: { $any: ['free', 'trial'] } } } }
2846
- */
2847
- declare type NestedApiFilter<T> = T extends Record<string, any> ? {
2848
- [key in keyof T]?: T[key] extends Record<string, any> ? SingleOrArray<Filter<T[key]>> : PropertyFilter<T[key]>;
2849
- } : PropertyFilter<T>;
2850
- declare type Filter<Record> = BaseApiFilter<Record> | NestedApiFilter<Record>;
3796
+ declare type BaseApiFilter<Record> = PropertyAccessFilter<Record> | AggregatorFilter<Record> | ExistanceFilter<Record>;
3797
+ /**
3798
+ * Nested filter
3799
+ * Injects the Api filters on nested properties
3800
+ * Example: { filter: { settings: { plan: { $any: ['free', 'trial'] } } } }
3801
+ */
3802
+ declare type NestedApiFilter<T> = {
3803
+ [key in keyof T]?: T[key] extends Record<string, any> ? SingleOrArray<Filter<T[key]>> : PropertyFilter<T[key]>;
3804
+ };
3805
+ 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>;
3806
+
3807
+ declare type DateBooster = {
3808
+ origin?: string;
3809
+ scale: string;
3810
+ decay: number;
3811
+ };
3812
+ declare type NumericBooster = {
3813
+ factor: number;
3814
+ };
3815
+ declare type ValueBooster<T extends string | number | boolean> = {
3816
+ value: T;
3817
+ factor: number;
3818
+ };
3819
+ declare type Boosters<O extends XataRecord> = Values<{
3820
+ [K in SelectableColumn<O>]: NonNullable<ValueAtColumn<O, K>> extends Date ? {
3821
+ dateBooster: {
3822
+ column: K;
3823
+ } & DateBooster;
3824
+ } : NonNullable<ValueAtColumn<O, K>> extends number ? ExclusiveOr<{
3825
+ numericBooster?: {
3826
+ column: K;
3827
+ } & NumericBooster;
3828
+ }, {
3829
+ valueBooster?: {
3830
+ column: K;
3831
+ } & ValueBooster<number>;
3832
+ }> : NonNullable<ValueAtColumn<O, K>> extends string | boolean ? {
3833
+ valueBooster: {
3834
+ column: K;
3835
+ } & ValueBooster<NonNullable<ValueAtColumn<O, K>>>;
3836
+ } : never;
3837
+ }>;
3838
+
3839
+ declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3840
+ fuzziness?: FuzzinessExpression;
3841
+ prefix?: PrefixExpression;
3842
+ highlight?: HighlightExpression;
3843
+ tables?: Array<Tables | Values<{
3844
+ [Model in GetArrayInnerType<NonNullable<Tables[]>>]: {
3845
+ table: Model;
3846
+ filter?: Filter<SelectedPick<Schemas[Model] & XataRecord, ['*']>>;
3847
+ boosters?: Boosters<Schemas[Model] & XataRecord>[];
3848
+ };
3849
+ }>>;
3850
+ };
3851
+ declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3852
+ all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3853
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]: {
3854
+ table: Model;
3855
+ record: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>>;
3856
+ };
3857
+ }>[]>;
3858
+ byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3859
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]?: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>[]>;
3860
+ }>;
3861
+ };
3862
+ declare class SearchPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin {
3863
+ #private;
3864
+ private db;
3865
+ constructor(db: SchemaPluginResult<Schemas>, schemaTables?: Schemas.Table[]);
3866
+ build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
3867
+ }
3868
+ declare type SearchXataRecord<Record extends XataRecord> = Omit<Record, 'getMetadata'> & {
3869
+ getMetadata: () => XataRecordMetadata & SearchExtraProperties;
3870
+ };
3871
+ declare type SearchExtraProperties = {
3872
+ table: string;
3873
+ highlight?: {
3874
+ [key: string]: string[] | {
3875
+ [key: string]: any;
3876
+ };
3877
+ };
3878
+ score?: number;
3879
+ };
3880
+ declare type ReturnTable<Table, Tables> = Table extends Tables ? Table : never;
3881
+ 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 {
3882
+ table: infer Table;
3883
+ } ? ReturnTable<Table, Tables> : never;
2851
3884
 
2852
3885
  declare type SortDirection = 'asc' | 'desc';
2853
3886
  declare type SortFilterExtended<T extends XataRecord> = {
@@ -2859,13 +3892,21 @@ declare type SortFilterBase<T extends XataRecord> = {
2859
3892
  [Key in StringKeys<T>]: SortDirection;
2860
3893
  };
2861
3894
 
2862
- declare type QueryOptions<T extends XataRecord> = {
2863
- page?: PaginationOptions;
2864
- columns?: NonEmptyArray<SelectableColumn<T>>;
3895
+ declare type BaseOptions<T extends XataRecord> = {
3896
+ columns?: SelectableColumn<T>[];
3897
+ cache?: number;
3898
+ };
3899
+ declare type CursorQueryOptions = {
3900
+ pagination?: CursorNavigationOptions & OffsetNavigationOptions;
3901
+ filter?: never;
3902
+ sort?: never;
3903
+ };
3904
+ declare type OffsetQueryOptions<T extends XataRecord> = {
3905
+ pagination?: OffsetNavigationOptions;
2865
3906
  filter?: FilterExpression;
2866
3907
  sort?: SortFilter<T> | SortFilter<T>[];
2867
- cache?: number;
2868
3908
  };
3909
+ declare type QueryOptions<T extends XataRecord> = BaseOptions<T> & (CursorQueryOptions | OffsetQueryOptions<T>);
2869
3910
  /**
2870
3911
  * Query objects contain the information of all filters, sorting, etc. to be included in the database query.
2871
3912
  *
@@ -2875,8 +3916,11 @@ declare type QueryOptions<T extends XataRecord> = {
2875
3916
  declare class Query<Record extends XataRecord, Result extends XataRecord = Record> implements Paginable<Record, Result> {
2876
3917
  #private;
2877
3918
  readonly meta: PaginationQueryMeta;
2878
- readonly records: Result[];
2879
- constructor(repository: Repository<Record> | null, table: string, data: Partial<QueryOptions<Record>>, parent?: Partial<QueryOptions<Record>>);
3919
+ readonly records: RecordArray<Result>;
3920
+ constructor(repository: Repository<Record> | null, table: {
3921
+ name: string;
3922
+ schema?: Table;
3923
+ }, data: Partial<QueryOptions<Record>>, rawParent?: Partial<QueryOptions<Record>>);
2880
3924
  getQueryOptions(): QueryOptions<Record>;
2881
3925
  key(): string;
2882
3926
  /**
@@ -2908,73 +3952,186 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
2908
3952
  *
2909
3953
  * ```
2910
3954
  * query.filter("columnName", columnValue)
2911
- * query.filter({
2912
- * "columnName": columnValue
2913
- * })
3955
+ * query.filter("columnName", operator(columnValue)) // Use gt, gte, lt, lte, startsWith,...
3956
+ * ```
3957
+ *
3958
+ * @param column The name of the column to filter.
3959
+ * @param value The value to filter.
3960
+ * @returns A new Query object.
3961
+ */
3962
+ filter<F extends SelectableColumn<Record>>(column: F, value: Filter<NonNullable<ValueAtColumn<Record, F>>>): Query<Record, Result>;
3963
+ /**
3964
+ * Builds a new query object adding one or more constraints. Examples:
3965
+ *
3966
+ * ```
3967
+ * query.filter({ "columnName": columnValue })
2914
3968
  * query.filter({
2915
3969
  * "columnName": operator(columnValue) // Use gt, gte, lt, lte, startsWith,...
2916
3970
  * })
2917
3971
  * ```
2918
3972
  *
3973
+ * @param filters A filter object
2919
3974
  * @returns A new Query object.
2920
3975
  */
2921
- filter(filters: Filter<Record>): Query<Record, Result>;
2922
- filter<F extends SelectableColumn<Record>>(column: F, value: Filter<ValueAtColumn<Record, F>>): Query<Record, Result>;
3976
+ filter(filters?: Filter<Record>): Query<Record, Result>;
3977
+ defaultFilter<T>(column: string, value: T): T | {
3978
+ $includes: (T & string) | (T & string[]);
3979
+ };
2923
3980
  /**
2924
3981
  * Builds a new query with a new sort option.
2925
3982
  * @param column The column name.
2926
3983
  * @param direction The direction. Either ascending or descending.
2927
3984
  * @returns A new Query object.
2928
3985
  */
2929
- sort<F extends SelectableColumn<Record>>(column: F, direction: SortDirection): Query<Record, Result>;
3986
+ sort<F extends SelectableColumn<Record>>(column: F, direction?: SortDirection): Query<Record, Result>;
2930
3987
  /**
2931
3988
  * Builds a new query specifying the set of columns to be returned in the query response.
2932
3989
  * @param columns Array of column names to be returned by the query.
2933
3990
  * @returns A new Query object.
2934
3991
  */
2935
- select<K extends SelectableColumn<Record>>(columns: NonEmptyArray<K>): Query<Record, SelectedPick<Record, NonEmptyArray<K>>>;
3992
+ select<K extends SelectableColumn<Record>>(columns: K[]): Query<Record, SelectedPick<Record, K[]>>;
3993
+ /**
3994
+ * Get paginated results
3995
+ *
3996
+ * @returns A page of results
3997
+ */
2936
3998
  getPaginated(): Promise<Page<Record, Result>>;
2937
- getPaginated(options: Omit<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
3999
+ /**
4000
+ * Get paginated results
4001
+ *
4002
+ * @param options Pagination options
4003
+ * @returns A page of results
4004
+ */
4005
+ getPaginated(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
4006
+ /**
4007
+ * Get paginated results
4008
+ *
4009
+ * @param options Pagination options
4010
+ * @returns A page of results
4011
+ */
2938
4012
  getPaginated<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<Page<Record, SelectedPick<Record, typeof options['columns']>>>;
4013
+ /**
4014
+ * Get results in an iterator
4015
+ *
4016
+ * @async
4017
+ * @returns Async interable of results
4018
+ */
2939
4019
  [Symbol.asyncIterator](): AsyncIterableIterator<Result>;
2940
- getIterator(chunk: number): AsyncGenerator<Result[]>;
2941
- getIterator(chunk: number, options: Omit<QueryOptions<Record>, 'columns' | 'page'>): AsyncGenerator<Result[]>;
2942
- getIterator<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(chunk: number, options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
4020
+ /**
4021
+ * Build an iterator of results
4022
+ *
4023
+ * @returns Async generator of results array
4024
+ */
4025
+ getIterator(): AsyncGenerator<Result[]>;
4026
+ /**
4027
+ * Build an iterator of results
4028
+ *
4029
+ * @param options Pagination options with batchSize
4030
+ * @returns Async generator of results array
4031
+ */
4032
+ getIterator(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
4033
+ batchSize?: number;
4034
+ }): AsyncGenerator<Result[]>;
4035
+ /**
4036
+ * Build an iterator of results
4037
+ *
4038
+ * @param options Pagination options with batchSize
4039
+ * @returns Async generator of results array
4040
+ */
4041
+ getIterator<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
4042
+ batchSize?: number;
4043
+ }>(options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
4044
+ /**
4045
+ * Performs the query in the database and returns a set of results.
4046
+ * @returns An array of records from the database.
4047
+ */
4048
+ getMany(): Promise<RecordArray<Result>>;
4049
+ /**
4050
+ * Performs the query in the database and returns a set of results.
4051
+ * @param options Additional options to be used when performing the query.
4052
+ * @returns An array of records from the database.
4053
+ */
4054
+ getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<RecordArray<SelectedPick<Record, typeof options['columns']>>>;
2943
4055
  /**
2944
4056
  * Performs the query in the database and returns a set of results.
2945
4057
  * @param options Additional options to be used when performing the query.
2946
4058
  * @returns An array of records from the database.
2947
4059
  */
2948
- getMany(): Promise<Result[]>;
2949
- getMany(options: Omit<QueryOptions<Record>, 'columns'>): Promise<Result[]>;
2950
- getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
4060
+ getMany(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<RecordArray<Result>>;
4061
+ /**
4062
+ * Performs the query in the database and returns all the results.
4063
+ * Warning: If there are a large number of results, this method can have performance implications.
4064
+ * @returns An array of records from the database.
4065
+ */
4066
+ getAll(): Promise<Result[]>;
2951
4067
  /**
2952
4068
  * Performs the query in the database and returns all the results.
2953
4069
  * Warning: If there are a large number of results, this method can have performance implications.
2954
4070
  * @param options Additional options to be used when performing the query.
2955
4071
  * @returns An array of records from the database.
2956
4072
  */
2957
- getAll(chunk?: number): Promise<Result[]>;
2958
- getAll(chunk: number | undefined, options: Omit<QueryOptions<Record>, 'columns' | 'page'>): Promise<Result[]>;
2959
- getAll<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(chunk: number | undefined, options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
4073
+ getAll<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
4074
+ batchSize?: number;
4075
+ }>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
2960
4076
  /**
2961
- * Performs the query in the database and returns the first result.
4077
+ * Performs the query in the database and returns all the results.
4078
+ * Warning: If there are a large number of results, this method can have performance implications.
2962
4079
  * @param options Additional options to be used when performing the query.
4080
+ * @returns An array of records from the database.
4081
+ */
4082
+ getAll(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
4083
+ batchSize?: number;
4084
+ }): Promise<Result[]>;
4085
+ /**
4086
+ * Performs the query in the database and returns the first result.
2963
4087
  * @returns The first record that matches the query, or null if no record matched the query.
2964
4088
  */
2965
4089
  getFirst(): Promise<Result | null>;
2966
- getFirst(options: Omit<QueryOptions<Record>, 'columns' | 'page'>): Promise<Result | null>;
2967
- getFirst<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
4090
+ /**
4091
+ * Performs the query in the database and returns the first result.
4092
+ * @param options Additional options to be used when performing the query.
4093
+ * @returns The first record that matches the query, or null if no record matched the query.
4094
+ */
4095
+ getFirst<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
4096
+ /**
4097
+ * Performs the query in the database and returns the first result.
4098
+ * @param options Additional options to be used when performing the query.
4099
+ * @returns The first record that matches the query, or null if no record matched the query.
4100
+ */
4101
+ getFirst(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result | null>;
2968
4102
  /**
2969
4103
  * Builds a new query object adding a cache TTL in milliseconds.
2970
4104
  * @param ttl The cache TTL in milliseconds.
2971
4105
  * @returns A new Query object.
2972
4106
  */
2973
4107
  cache(ttl: number): Query<Record, Result>;
4108
+ /**
4109
+ * Retrieve next page of records
4110
+ *
4111
+ * @returns A new page object.
4112
+ */
2974
4113
  nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4114
+ /**
4115
+ * Retrieve previous page of records
4116
+ *
4117
+ * @returns A new page object
4118
+ */
2975
4119
  previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4120
+ /**
4121
+ * Retrieve first page of records
4122
+ *
4123
+ * @returns A new page object
4124
+ */
2976
4125
  firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4126
+ /**
4127
+ * Retrieve last page of records
4128
+ *
4129
+ * @returns A new page object
4130
+ */
2977
4131
  lastPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4132
+ /**
4133
+ * @returns Boolean indicating if there is a next page
4134
+ */
2978
4135
  hasNextPage(): boolean;
2979
4136
  }
2980
4137
 
@@ -2986,7 +4143,7 @@ declare type PaginationQueryMeta = {
2986
4143
  };
2987
4144
  interface Paginable<Record extends XataRecord, Result extends XataRecord = Record> {
2988
4145
  meta: PaginationQueryMeta;
2989
- records: Result[];
4146
+ records: RecordArray<Result>;
2990
4147
  nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
2991
4148
  previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
2992
4149
  firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
@@ -3006,7 +4163,7 @@ declare class Page<Record extends XataRecord, Result extends XataRecord = Record
3006
4163
  /**
3007
4164
  * The set of results for this page.
3008
4165
  */
3009
- readonly records: Result[];
4166
+ readonly records: RecordArray<Result>;
3010
4167
  constructor(query: Query<Record, Result>, meta: PaginationQueryMeta, records?: Result[]);
3011
4168
  /**
3012
4169
  * Retrieves the next page of results.
@@ -3054,64 +4211,198 @@ declare type OffsetNavigationOptions = {
3054
4211
  size?: number;
3055
4212
  offset?: number;
3056
4213
  };
3057
- declare type PaginationOptions = CursorNavigationOptions & OffsetNavigationOptions;
3058
4214
  declare const PAGINATION_MAX_SIZE = 200;
3059
- declare const PAGINATION_DEFAULT_SIZE = 200;
4215
+ declare const PAGINATION_DEFAULT_SIZE = 20;
3060
4216
  declare const PAGINATION_MAX_OFFSET = 800;
3061
4217
  declare const PAGINATION_DEFAULT_OFFSET = 0;
4218
+ declare function isCursorPaginationOptions(options: Record<string, unknown> | undefined | null): options is CursorNavigationOptions;
4219
+ declare class RecordArray<Result extends XataRecord> extends Array<Result> {
4220
+ #private;
4221
+ constructor(page: Paginable<any, Result>, overrideRecords?: Result[]);
4222
+ static parseConstructorParams(...args: any[]): any[];
4223
+ toArray(): Result[];
4224
+ map<U>(callbackfn: (value: Result, index: number, array: Result[]) => U, thisArg?: any): U[];
4225
+ /**
4226
+ * Retrieve next page of records
4227
+ *
4228
+ * @returns A new array of objects
4229
+ */
4230
+ nextPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4231
+ /**
4232
+ * Retrieve previous page of records
4233
+ *
4234
+ * @returns A new array of objects
4235
+ */
4236
+ previousPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4237
+ /**
4238
+ * Retrieve first page of records
4239
+ *
4240
+ * @returns A new array of objects
4241
+ */
4242
+ firstPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4243
+ /**
4244
+ * Retrieve last page of records
4245
+ *
4246
+ * @returns A new array of objects
4247
+ */
4248
+ lastPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4249
+ /**
4250
+ * @returns Boolean indicating if there is a next page
4251
+ */
4252
+ hasNextPage(): boolean;
4253
+ }
3062
4254
 
3063
- declare type TableLink = string[];
3064
- declare type LinkDictionary = Dictionary<TableLink[]>;
3065
4255
  /**
3066
4256
  * Common interface for performing operations on a table.
3067
4257
  */
3068
- declare abstract class Repository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
3069
- abstract create(object: EditableData<Data> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4258
+ declare abstract class Repository<Record extends XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
4259
+ abstract create<K extends SelectableColumn<Record>>(object: Omit<EditableData<Record>, 'id'> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4260
+ abstract create(object: Omit<EditableData<Record>, 'id'> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4261
+ /**
4262
+ * Creates a single record in the table with a unique id.
4263
+ * @param id The unique id.
4264
+ * @param object Object containing the column names with their values to be stored in the table.
4265
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4266
+ * @returns The full persisted record.
4267
+ */
4268
+ abstract create<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3070
4269
  /**
3071
4270
  * Creates a single record in the table with a unique id.
3072
4271
  * @param id The unique id.
3073
4272
  * @param object Object containing the column names with their values to be stored in the table.
3074
4273
  * @returns The full persisted record.
3075
4274
  */
3076
- abstract create(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4275
+ abstract create(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3077
4276
  /**
3078
4277
  * Creates multiple records in the table.
3079
4278
  * @param objects Array of objects with the column names and the values to be stored in the table.
3080
- * @returns Array of the persisted records.
4279
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4280
+ * @returns Array of the persisted records in order.
4281
+ */
4282
+ abstract create<K extends SelectableColumn<Record>>(objects: Array<Omit<EditableData<Record>, 'id'> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4283
+ /**
4284
+ * Creates multiple records in the table.
4285
+ * @param objects Array of objects with the column names and the values to be stored in the table.
4286
+ * @returns Array of the persisted records in order.
4287
+ */
4288
+ abstract create(objects: Array<Omit<EditableData<Record>, 'id'> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4289
+ /**
4290
+ * Queries a single record from the table given its unique id.
4291
+ * @param id The unique id.
4292
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4293
+ * @returns The persisted record for the given id or null if the record could not be found.
3081
4294
  */
3082
- abstract create(objects: Array<EditableData<Data> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4295
+ abstract read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
3083
4296
  /**
3084
4297
  * Queries a single record from the table given its unique id.
3085
4298
  * @param id The unique id.
3086
4299
  * @returns The persisted record for the given id or null if the record could not be found.
3087
4300
  */
3088
4301
  abstract read(id: string): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4302
+ /**
4303
+ * Queries multiple records from the table given their unique id.
4304
+ * @param ids The unique ids array.
4305
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4306
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4307
+ */
4308
+ abstract read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4309
+ /**
4310
+ * Queries multiple records from the table given their unique id.
4311
+ * @param ids The unique ids array.
4312
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4313
+ */
4314
+ abstract read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4315
+ /**
4316
+ * Queries a single record from the table by the id in the object.
4317
+ * @param object Object containing the id of the record.
4318
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4319
+ * @returns The persisted record for the given id or null if the record could not be found.
4320
+ */
4321
+ abstract read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
4322
+ /**
4323
+ * Queries a single record from the table by the id in the object.
4324
+ * @param object Object containing the id of the record.
4325
+ * @returns The persisted record for the given id or null if the record could not be found.
4326
+ */
4327
+ abstract read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4328
+ /**
4329
+ * Queries multiple records from the table by the ids in the objects.
4330
+ * @param objects Array of objects containing the ids of the records.
4331
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4332
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4333
+ */
4334
+ abstract read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4335
+ /**
4336
+ * Queries multiple records from the table by the ids in the objects.
4337
+ * @param objects Array of objects containing the ids of the records.
4338
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4339
+ */
4340
+ abstract read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3089
4341
  /**
3090
4342
  * Partially update a single record.
3091
4343
  * @param object An object with its id and the columns to be updated.
3092
- * @returns The full persisted record.
4344
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4345
+ * @returns The full persisted record, null if the record could not be found.
4346
+ */
4347
+ abstract update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4348
+ /**
4349
+ * Partially update a single record.
4350
+ * @param object An object with its id and the columns to be updated.
4351
+ * @returns The full persisted record, null if the record could not be found.
3093
4352
  */
3094
- abstract update(object: Partial<EditableData<Data>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4353
+ abstract update(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3095
4354
  /**
3096
4355
  * Partially update a single record given its unique id.
3097
4356
  * @param id The unique id.
3098
4357
  * @param object The column names and their values that have to be updated.
3099
- * @returns The full persisted record.
4358
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4359
+ * @returns The full persisted record, null if the record could not be found.
4360
+ */
4361
+ abstract update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4362
+ /**
4363
+ * Partially update a single record given its unique id.
4364
+ * @param id The unique id.
4365
+ * @param object The column names and their values that have to be updated.
4366
+ * @returns The full persisted record, null if the record could not be found.
3100
4367
  */
3101
- abstract update(id: string, object: Partial<EditableData<Data>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4368
+ abstract update(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3102
4369
  /**
3103
4370
  * Partially updates multiple records.
3104
4371
  * @param objects An array of objects with their ids and columns to be updated.
3105
- * @returns Array of the persisted records.
4372
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4373
+ * @returns Array of the persisted records in order (if a record could not be found null is returned).
4374
+ */
4375
+ abstract update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4376
+ /**
4377
+ * Partially updates multiple records.
4378
+ * @param objects An array of objects with their ids and columns to be updated.
4379
+ * @returns Array of the persisted records in order (if a record could not be found null is returned).
4380
+ */
4381
+ abstract update(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4382
+ /**
4383
+ * Creates or updates a single record. If a record exists with the given id,
4384
+ * it will be update, otherwise a new record will be created.
4385
+ * @param object Object containing the column names with their values to be persisted in the table.
4386
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4387
+ * @returns The full persisted record.
3106
4388
  */
3107
- abstract update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4389
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Record> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3108
4390
  /**
3109
4391
  * Creates or updates a single record. If a record exists with the given id,
3110
4392
  * it will be update, otherwise a new record will be created.
3111
4393
  * @param object Object containing the column names with their values to be persisted in the table.
3112
4394
  * @returns The full persisted record.
3113
4395
  */
3114
- abstract createOrUpdate(object: EditableData<Data> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4396
+ abstract createOrUpdate(object: EditableData<Record> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4397
+ /**
4398
+ * Creates or updates a single record. If a record exists with the given id,
4399
+ * it will be update, otherwise a new record will be created.
4400
+ * @param id A unique id.
4401
+ * @param object The column names and the values to be persisted.
4402
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4403
+ * @returns The full persisted record.
4404
+ */
4405
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3115
4406
  /**
3116
4407
  * Creates or updates a single record. If a record exists with the given id,
3117
4408
  * it will be update, otherwise a new record will be created.
@@ -3119,38 +4410,74 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3119
4410
  * @param object The column names and the values to be persisted.
3120
4411
  * @returns The full persisted record.
3121
4412
  */
3122
- abstract createOrUpdate(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4413
+ abstract createOrUpdate(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4414
+ /**
4415
+ * Creates or updates a single record. If a record exists with the given id,
4416
+ * it will be update, otherwise a new record will be created.
4417
+ * @param objects Array of objects with the column names and the values to be stored in the table.
4418
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4419
+ * @returns Array of the persisted records.
4420
+ */
4421
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3123
4422
  /**
3124
4423
  * Creates or updates a single record. If a record exists with the given id,
3125
4424
  * it will be update, otherwise a new record will be created.
3126
4425
  * @param objects Array of objects with the column names and the values to be stored in the table.
3127
4426
  * @returns Array of the persisted records.
3128
4427
  */
3129
- abstract createOrUpdate(objects: Array<EditableData<Data> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4428
+ abstract createOrUpdate(objects: Array<EditableData<Record> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3130
4429
  /**
3131
4430
  * Deletes a record given its unique id.
3132
- * @param id The unique id.
3133
- * @throws If the record could not be found or there was an error while performing the deletion.
4431
+ * @param object An object with a unique id.
4432
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4433
+ * @returns The deleted record, null if the record could not be found.
3134
4434
  */
3135
- abstract delete(id: string): Promise<void>;
4435
+ abstract delete<K extends SelectableColumn<Record>>(object: Identifiable & Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3136
4436
  /**
3137
4437
  * Deletes a record given its unique id.
3138
- * @param id An object with a unique id.
3139
- * @throws If the record could not be found or there was an error while performing the deletion.
4438
+ * @param object An object with a unique id.
4439
+ * @returns The deleted record, null if the record could not be found.
3140
4440
  */
3141
- abstract delete(id: Identifiable): Promise<void>;
4441
+ abstract delete(object: Identifiable & Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3142
4442
  /**
3143
- * Deletes a record given a list of unique ids.
3144
- * @param ids The array of unique ids.
3145
- * @throws If the record could not be found or there was an error while performing the deletion.
4443
+ * Deletes a record given a unique id.
4444
+ * @param id The unique id.
4445
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4446
+ * @returns The deleted record, null if the record could not be found.
4447
+ */
4448
+ abstract delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4449
+ /**
4450
+ * Deletes a record given a unique id.
4451
+ * @param id The unique id.
4452
+ * @returns The deleted record, null if the record could not be found.
4453
+ */
4454
+ abstract delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4455
+ /**
4456
+ * Deletes multiple records given an array of objects with ids.
4457
+ * @param objects An array of objects with unique ids.
4458
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4459
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4460
+ */
4461
+ abstract delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4462
+ /**
4463
+ * Deletes multiple records given an array of objects with ids.
4464
+ * @param objects An array of objects with unique ids.
4465
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
3146
4466
  */
3147
- abstract delete(ids: string[]): Promise<void>;
4467
+ abstract delete(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3148
4468
  /**
3149
- * Deletes a record given a list of unique ids.
3150
- * @param ids An array of objects with unique ids.
3151
- * @throws If the record could not be found or there was an error while performing the deletion.
4469
+ * Deletes multiple records given an array of unique ids.
4470
+ * @param objects An array of ids.
4471
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4472
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
3152
4473
  */
3153
- abstract delete(ids: Identifiable[]): Promise<void>;
4474
+ abstract delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4475
+ /**
4476
+ * Deletes multiple records given an array of unique ids.
4477
+ * @param objects An array of ids.
4478
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4479
+ */
4480
+ abstract delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3154
4481
  /**
3155
4482
  * Search for records in the table.
3156
4483
  * @param query The query to search for.
@@ -3158,36 +4485,123 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3158
4485
  * @returns The found records.
3159
4486
  */
3160
4487
  abstract search(query: string, options?: {
3161
- fuzziness?: number;
3162
- }): Promise<SelectedPick<Record, ['*']>[]>;
4488
+ fuzziness?: FuzzinessExpression;
4489
+ prefix?: PrefixExpression;
4490
+ highlight?: HighlightExpression;
4491
+ filter?: Filter<Record>;
4492
+ boosters?: Boosters<Record>[];
4493
+ }): Promise<SearchXataRecord<SelectedPick<Record, ['*']>>[]>;
3163
4494
  abstract query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3164
4495
  }
3165
- declare class RestRepository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Data, Record> {
4496
+ declare class RestRepository<Record extends XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Record> {
3166
4497
  #private;
3167
- db: SchemaPluginResult<any>;
3168
4498
  constructor(options: {
3169
4499
  table: string;
3170
- links?: LinkDictionary;
3171
4500
  db: SchemaPluginResult<any>;
3172
4501
  pluginOptions: XataPluginOptions;
4502
+ schemaTables?: Table[];
3173
4503
  });
3174
- create(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3175
- create(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3176
- create(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3177
- read(recordId: string): Promise<SelectedPick<Record, ['*']> | null>;
3178
- update(object: Partial<EditableData<Data>> & Identifiable): Promise<SelectedPick<Record, ['*']>>;
3179
- update(recordId: string, object: Partial<EditableData<Data>>): Promise<SelectedPick<Record, ['*']>>;
3180
- update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<SelectedPick<Record, ['*']>[]>;
3181
- createOrUpdate(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3182
- createOrUpdate(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3183
- createOrUpdate(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3184
- delete(a: string | Identifiable | Array<string | Identifiable>): Promise<void>;
4504
+ create<K extends SelectableColumn<Record>>(object: EditableData<Record> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4505
+ create(object: EditableData<Record> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4506
+ create<K extends SelectableColumn<Record>>(id: string, object: EditableData<Record>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4507
+ create(id: string, object: EditableData<Record>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4508
+ create<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4509
+ create(objects: Array<EditableData<Record> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4510
+ read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
4511
+ read(id: string): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4512
+ read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4513
+ read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4514
+ read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
4515
+ read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4516
+ read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4517
+ read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4518
+ update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4519
+ update(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4520
+ update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4521
+ update(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4522
+ update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4523
+ update(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4524
+ createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Record> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4525
+ createOrUpdate(object: EditableData<Record> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4526
+ createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4527
+ createOrUpdate(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4528
+ createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4529
+ createOrUpdate(objects: Array<EditableData<Record> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4530
+ delete<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4531
+ delete(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4532
+ delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4533
+ delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4534
+ delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4535
+ delete(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4536
+ delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4537
+ delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3185
4538
  search(query: string, options?: {
3186
- fuzziness?: number;
3187
- }): Promise<SelectedPick<Record, ['*']>[]>;
4539
+ fuzziness?: FuzzinessExpression;
4540
+ prefix?: PrefixExpression;
4541
+ highlight?: HighlightExpression;
4542
+ filter?: Filter<Record>;
4543
+ boosters?: Boosters<Record>[];
4544
+ }): Promise<any>;
3188
4545
  query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3189
4546
  }
3190
4547
 
4548
+ declare type BaseSchema = {
4549
+ name: string;
4550
+ columns: readonly ({
4551
+ name: string;
4552
+ type: Column['type'];
4553
+ } | {
4554
+ name: string;
4555
+ type: 'link';
4556
+ link: {
4557
+ table: string;
4558
+ };
4559
+ } | {
4560
+ name: string;
4561
+ type: 'object';
4562
+ columns: {
4563
+ name: string;
4564
+ type: string;
4565
+ }[];
4566
+ })[];
4567
+ };
4568
+ declare type SchemaInference<T extends readonly BaseSchema[]> = T extends never[] ? Record<string, Record<string, any>> : T extends readonly unknown[] ? T[number] extends {
4569
+ name: string;
4570
+ columns: readonly unknown[];
4571
+ } ? {
4572
+ [K in T[number]['name']]: TableType<T[number], K>;
4573
+ } : never : never;
4574
+ declare type TableType<Tables, TableName> = Tables & {
4575
+ name: TableName;
4576
+ } extends infer Table ? Table extends {
4577
+ name: string;
4578
+ columns: infer Columns;
4579
+ } ? Columns extends readonly unknown[] ? Columns[number] extends {
4580
+ name: string;
4581
+ type: string;
4582
+ } ? Identifiable & {
4583
+ [K in Columns[number]['name']]?: PropertyType<Tables, Columns[number], K>;
4584
+ } : never : never : never : never;
4585
+ declare type PropertyType<Tables, Properties, PropertyName> = Properties & {
4586
+ name: PropertyName;
4587
+ } extends infer Property ? Property extends {
4588
+ name: string;
4589
+ type: infer Type;
4590
+ link?: {
4591
+ table: infer LinkedTable;
4592
+ };
4593
+ columns?: infer ObjectColumns;
4594
+ } ? (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 {
4595
+ name: string;
4596
+ type: string;
4597
+ } ? {
4598
+ [K in ObjectColumns[number]['name']]?: PropertyType<Tables, ObjectColumns[number], K>;
4599
+ } : never : never : Type extends 'link' ? TableType<Tables, LinkedTable> & XataRecord : never) | null : never : never;
4600
+
4601
+ /**
4602
+ * Operator to restrict results to only values that are greater than the given value.
4603
+ */
4604
+ declare const greaterThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3191
4605
  /**
3192
4606
  * Operator to restrict results to only values that are greater than the given value.
3193
4607
  */
@@ -3195,15 +4609,35 @@ declare const gt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T
3195
4609
  /**
3196
4610
  * Operator to restrict results to only values that are greater than or equal to the given value.
3197
4611
  */
3198
- declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4612
+ declare const greaterThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4613
+ /**
4614
+ * Operator to restrict results to only values that are greater than or equal to the given value.
4615
+ */
4616
+ declare const greaterEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3199
4617
  /**
3200
4618
  * Operator to restrict results to only values that are greater than or equal to the given value.
3201
4619
  */
3202
4620
  declare const gte: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4621
+ /**
4622
+ * Operator to restrict results to only values that are greater than or equal to the given value.
4623
+ */
4624
+ declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4625
+ /**
4626
+ * Operator to restrict results to only values that are lower than the given value.
4627
+ */
4628
+ declare const lessThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3203
4629
  /**
3204
4630
  * Operator to restrict results to only values that are lower than the given value.
3205
4631
  */
3206
4632
  declare const lt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4633
+ /**
4634
+ * Operator to restrict results to only values that are lower than or equal to the given value.
4635
+ */
4636
+ declare const lessThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4637
+ /**
4638
+ * Operator to restrict results to only values that are lower than or equal to the given value.
4639
+ */
4640
+ declare const lessEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3207
4641
  /**
3208
4642
  * Operator to restrict results to only values that are lower than or equal to the given value.
3209
4643
  */
@@ -3236,6 +4670,10 @@ declare const pattern: (value: string) => StringTypeFilter;
3236
4670
  * Operator to restrict results to only values that are equal to the given value.
3237
4671
  */
3238
4672
  declare const is: <T>(value: T) => PropertyFilter<T>;
4673
+ /**
4674
+ * Operator to restrict results to only values that are equal to the given value.
4675
+ */
4676
+ declare const equals: <T>(value: T) => PropertyFilter<T>;
3239
4677
  /**
3240
4678
  * Operator to restrict results to only values that are not equal to the given value.
3241
4679
  */
@@ -3263,47 +4701,16 @@ declare const includesAny: <T>(value: T) => ArrayFilter<T>;
3263
4701
 
3264
4702
  declare type SchemaDefinition = {
3265
4703
  table: string;
3266
- links?: LinkDictionary;
3267
4704
  };
3268
- declare type SchemaPluginResult<Schemas extends Record<string, BaseData>> = {
4705
+ declare type SchemaPluginResult<Schemas extends Record<string, XataRecord>> = {
3269
4706
  [Key in keyof Schemas]: Repository<Schemas[Key]>;
3270
4707
  };
3271
- declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
4708
+ declare class SchemaPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin {
3272
4709
  #private;
3273
- private links?;
3274
- private tableNames?;
3275
- constructor(links?: LinkDictionary | undefined, tableNames?: string[] | undefined);
4710
+ constructor(schemaTables?: Schemas.Table[]);
3276
4711
  build(pluginOptions: XataPluginOptions): SchemaPluginResult<Schemas>;
3277
4712
  }
3278
4713
 
3279
- declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3280
- fuzziness?: number;
3281
- tables?: Tables[];
3282
- };
3283
- declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3284
- all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3285
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]: {
3286
- table: Model;
3287
- record: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>>;
3288
- };
3289
- }>[]>;
3290
- byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3291
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]?: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>[]>;
3292
- }>;
3293
- };
3294
- declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
3295
- #private;
3296
- private db;
3297
- private links;
3298
- constructor(db: SchemaPluginResult<Schemas>, links: LinkDictionary);
3299
- build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
3300
- }
3301
- declare type SearchXataRecord = XataRecord & {
3302
- xata: {
3303
- table: string;
3304
- };
3305
- };
3306
-
3307
4714
  declare type BranchStrategyValue = string | undefined | null;
3308
4715
  declare type BranchStrategyBuilder = () => BranchStrategyValue | Promise<BranchStrategyValue>;
3309
4716
  declare type BranchStrategy = BranchStrategyValue | BranchStrategyBuilder;
@@ -3315,20 +4722,35 @@ declare type BaseClientOptions = {
3315
4722
  databaseURL?: string;
3316
4723
  branch?: BranchStrategyOption;
3317
4724
  cache?: CacheImpl;
4725
+ trace?: TraceFunction;
3318
4726
  };
3319
4727
  declare const buildClient: <Plugins extends Record<string, XataPlugin> = {}>(plugins?: Plugins | undefined) => ClientConstructor<Plugins>;
3320
4728
  interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
3321
- new <Schemas extends Record<string, BaseData>>(options?: Partial<BaseClientOptions>, links?: LinkDictionary): Omit<{
4729
+ new <Schemas extends Record<string, XataRecord> = {}>(options?: Partial<BaseClientOptions>, schemaTables?: readonly BaseSchema[]): Omit<{
3322
4730
  db: Awaited<ReturnType<SchemaPlugin<Schemas>['build']>>;
3323
4731
  search: Awaited<ReturnType<SearchPlugin<Schemas>['build']>>;
3324
4732
  }, keyof Plugins> & {
3325
4733
  [Key in StringKeys<NonNullable<Plugins>>]: Awaited<ReturnType<NonNullable<Plugins>[Key]['build']>>;
4734
+ } & {
4735
+ getConfig(): Promise<{
4736
+ databaseURL: string;
4737
+ branch: string;
4738
+ }>;
3326
4739
  };
3327
4740
  }
3328
4741
  declare const BaseClient_base: ClientConstructor<{}>;
3329
4742
  declare class BaseClient extends BaseClient_base<Record<string, any>> {
3330
4743
  }
3331
4744
 
4745
+ declare class Serializer {
4746
+ classes: Record<string, any>;
4747
+ add(clazz: any): void;
4748
+ toJSON<T>(data: T): string;
4749
+ fromJSON<T>(json: string): T;
4750
+ }
4751
+ declare const serialize: <T>(data: T) => string;
4752
+ declare const deserialize: <T>(json: string) => T;
4753
+
3332
4754
  declare type BranchResolutionOptions = {
3333
4755
  databaseURL?: string;
3334
4756
  apiKey?: string;
@@ -3340,9 +4762,89 @@ declare function getDatabaseURL(): string | undefined;
3340
4762
 
3341
4763
  declare function getAPIKey(): string | undefined;
3342
4764
 
4765
+ interface Body {
4766
+ arrayBuffer(): Promise<ArrayBuffer>;
4767
+ blob(): Promise<Blob>;
4768
+ formData(): Promise<FormData>;
4769
+ json(): Promise<any>;
4770
+ text(): Promise<string>;
4771
+ }
4772
+ interface Blob {
4773
+ readonly size: number;
4774
+ readonly type: string;
4775
+ arrayBuffer(): Promise<ArrayBuffer>;
4776
+ slice(start?: number, end?: number, contentType?: string): Blob;
4777
+ text(): Promise<string>;
4778
+ }
4779
+ /** Provides information about files and allows JavaScript in a web page to access their content. */
4780
+ interface File extends Blob {
4781
+ readonly lastModified: number;
4782
+ readonly name: string;
4783
+ readonly webkitRelativePath: string;
4784
+ }
4785
+ declare type FormDataEntryValue = File | string;
4786
+ /** 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". */
4787
+ interface FormData {
4788
+ append(name: string, value: string | Blob, fileName?: string): void;
4789
+ delete(name: string): void;
4790
+ get(name: string): FormDataEntryValue | null;
4791
+ getAll(name: string): FormDataEntryValue[];
4792
+ has(name: string): boolean;
4793
+ set(name: string, value: string | Blob, fileName?: string): void;
4794
+ forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void;
4795
+ }
4796
+ /** 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. */
4797
+ interface Headers {
4798
+ append(name: string, value: string): void;
4799
+ delete(name: string): void;
4800
+ get(name: string): string | null;
4801
+ has(name: string): boolean;
4802
+ set(name: string, value: string): void;
4803
+ forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void;
4804
+ }
4805
+ interface Request extends Body {
4806
+ /** Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching. */
4807
+ readonly cache: 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload';
4808
+ /** 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. */
4809
+ readonly credentials: 'include' | 'omit' | 'same-origin';
4810
+ /** Returns the kind of resource requested by request, e.g., "document" or "script". */
4811
+ readonly destination: '' | 'audio' | 'audioworklet' | 'document' | 'embed' | 'font' | 'frame' | 'iframe' | 'image' | 'manifest' | 'object' | 'paintworklet' | 'report' | 'script' | 'sharedworker' | 'style' | 'track' | 'video' | 'worker' | 'xslt';
4812
+ /** 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. */
4813
+ readonly headers: Headers;
4814
+ /** 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] */
4815
+ readonly integrity: string;
4816
+ /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
4817
+ readonly keepalive: boolean;
4818
+ /** Returns request's HTTP method, which is "GET" by default. */
4819
+ readonly method: string;
4820
+ /** 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. */
4821
+ readonly mode: 'cors' | 'navigate' | 'no-cors' | 'same-origin';
4822
+ /** 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. */
4823
+ readonly redirect: 'error' | 'follow' | 'manual';
4824
+ /** 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. */
4825
+ readonly referrer: string;
4826
+ /** Returns the referrer policy associated with request. This is used during fetching to compute the value of the request's referrer. */
4827
+ readonly referrerPolicy: '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
4828
+ /** Returns the URL of request as a string. */
4829
+ readonly url: string;
4830
+ clone(): Request;
4831
+ }
4832
+
4833
+ declare type XataWorkerContext<XataClient> = {
4834
+ xata: XataClient;
4835
+ request: Request;
4836
+ env: Record<string, string | undefined>;
4837
+ };
4838
+ declare type RemoveFirst<T> = T extends [any, ...infer U] ? U : never;
4839
+ declare type WorkerRunnerConfig = {
4840
+ workspace: string;
4841
+ worker: string;
4842
+ };
4843
+ 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>>>;
4844
+
3343
4845
  declare class XataError extends Error {
3344
4846
  readonly status: number;
3345
4847
  constructor(message: string, status: number);
3346
4848
  }
3347
4849
 
3348
- export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, AddTableColumnError, AddTableColumnPathParams, AddTableColumnVariables, BaseClient, BaseClientOptions, BaseData, BulkInsertTableRecordsError, BulkInsertTableRecordsPathParams, BulkInsertTableRecordsRequestBody, BulkInsertTableRecordsResponse, BulkInsertTableRecordsVariables, CacheImpl, CancelWorkspaceMemberInviteError, CancelWorkspaceMemberInvitePathParams, CancelWorkspaceMemberInviteVariables, ClientConstructor, CompareBranchSchemaError, CompareBranchSchemaPathParams, CompareBranchSchemaVariables, 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, GetBranchSchemaHistoryError, GetBranchSchemaHistoryPathParams, GetBranchSchemaHistoryVariables, 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, SimpleCache, SimpleCacheOptions, UpdateBranchMetadataError, UpdateBranchMetadataPathParams, UpdateBranchMetadataVariables, UpdateBranchSchemaError, UpdateBranchSchemaPathParams, UpdateBranchSchemaVariables, 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, compareBranchSchema, contains, createBranch, createDatabase, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, endsWith, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, 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, updateBranchSchema, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberRole, upsertRecordWithID };
4850
+ 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 };