@xata.io/client 0.0.0-alpha.vf7b5320 → 0.0.0-alpha.vf7fccd9

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
  /**
@@ -60,6 +68,9 @@ declare type XataPluginOptions = {
60
68
  * @version 1.0
61
69
  */
62
70
  declare type User = {
71
+ /**
72
+ * @format email
73
+ */
63
74
  email: string;
64
75
  fullname: string;
65
76
  image: string;
@@ -91,7 +102,7 @@ declare type WorkspaceID = string;
91
102
  declare type Role = 'owner' | 'maintainer';
92
103
  declare type WorkspaceMeta = {
93
104
  name: string;
94
- slug: string;
105
+ slug?: string;
95
106
  };
96
107
  declare type Workspace = WorkspaceMeta & {
97
108
  id: WorkspaceID;
@@ -101,6 +112,9 @@ declare type Workspace = WorkspaceMeta & {
101
112
  declare type WorkspaceMember = {
102
113
  userId: UserID;
103
114
  fullname: string;
115
+ /**
116
+ * @format email
117
+ */
104
118
  email: string;
105
119
  role: Role;
106
120
  };
@@ -110,7 +124,13 @@ declare type WorkspaceMember = {
110
124
  declare type InviteID = string;
111
125
  declare type WorkspaceInvite = {
112
126
  inviteId: InviteID;
127
+ /**
128
+ * @format email
129
+ */
113
130
  email: string;
131
+ /**
132
+ * @format date-time
133
+ */
114
134
  expires: string;
115
135
  role: Role;
116
136
  };
@@ -122,20 +142,40 @@ declare type WorkspaceMembers = {
122
142
  * @pattern ^ik_[a-zA-Z0-9]+
123
143
  */
124
144
  declare type InviteKey = string;
145
+ /**
146
+ * Metadata of databases
147
+ */
148
+ declare type DatabaseMetadata = {
149
+ /**
150
+ * The machine-readable name of a database
151
+ */
152
+ name: string;
153
+ /**
154
+ * The time this database was created
155
+ */
156
+ createdAt: DateTime;
157
+ /**
158
+ * The number of branches the database has
159
+ */
160
+ numberOfBranches: number;
161
+ /**
162
+ * Metadata about the database for display in Xata user interfaces
163
+ */
164
+ ui?: {
165
+ /**
166
+ * The user-selected color for this database across interfaces
167
+ */
168
+ color?: string;
169
+ };
170
+ };
125
171
  declare type ListDatabasesResponse = {
126
- databases?: {
127
- name: string;
128
- displayName: string;
129
- createdAt: DateTime;
130
- numberOfBranches: number;
131
- ui?: {
132
- color?: string;
133
- };
134
- }[];
172
+ /**
173
+ * A list of databases in a Xata workspace
174
+ */
175
+ databases?: DatabaseMetadata[];
135
176
  };
136
177
  declare type ListBranchesResponse = {
137
178
  databaseName: string;
138
- displayName: string;
139
179
  branches: Branch[];
140
180
  };
141
181
  declare type ListGitBranchesResponse = {
@@ -153,8 +193,14 @@ declare type Branch = {
153
193
  * @x-go-type xata.BranchMetadata
154
194
  */
155
195
  declare type BranchMetadata = {
196
+ /**
197
+ * @minLength 1
198
+ */
156
199
  repository?: string;
157
200
  branch?: BranchName;
201
+ /**
202
+ * @minLength 1
203
+ */
158
204
  stage?: string;
159
205
  labels?: string[];
160
206
  };
@@ -181,12 +227,28 @@ declare type Schema = {
181
227
  tables: Table[];
182
228
  tablesOrder?: string[];
183
229
  };
230
+ /**
231
+ * @x-internal true
232
+ */
233
+ declare type SchemaEditScript = {
234
+ sourceMigrationID?: string;
235
+ targetMigrationID?: string;
236
+ tables: TableEdit[];
237
+ };
184
238
  declare type Table = {
185
239
  id?: string;
186
240
  name: TableName;
187
241
  columns: Column[];
188
242
  revLinks?: RevLink[];
189
243
  };
244
+ /**
245
+ * @x-internal true
246
+ */
247
+ declare type TableEdit = {
248
+ oldName?: string;
249
+ newName?: string;
250
+ columns?: MigrationColumnOp[];
251
+ };
190
252
  /**
191
253
  * @x-go-type xata.Column
192
254
  */
@@ -196,6 +258,8 @@ declare type Column = {
196
258
  link?: {
197
259
  table: string;
198
260
  };
261
+ notNull?: boolean;
262
+ unique?: boolean;
199
263
  columns?: Column[];
200
264
  };
201
265
  declare type RevLink = {
@@ -262,12 +326,158 @@ declare type ColumnMigration = {
262
326
  old: Column;
263
327
  ['new']: Column;
264
328
  };
329
+ /**
330
+ * @x-internal true
331
+ */
332
+ declare type Commit = {
333
+ meta?: {
334
+ title?: string;
335
+ message?: string;
336
+ id: string;
337
+ parentID?: string;
338
+ mergeParentID?: string;
339
+ status: string;
340
+ createdAt: DateTime;
341
+ modifiedAt?: DateTime;
342
+ };
343
+ operations: MigrationOp[];
344
+ };
345
+ /**
346
+ * Branch schema migration.
347
+ *
348
+ * @x-internal true
349
+ */
350
+ declare type Migration = {
351
+ parentID?: string;
352
+ operations: MigrationOp[];
353
+ };
354
+ /**
355
+ * Branch schema migration operations.
356
+ *
357
+ * @x-internal true
358
+ */
359
+ declare type MigrationOp = MigrationTableOp | MigrationColumnOp;
360
+ /**
361
+ * @x-internal true
362
+ */
363
+ declare type MigrationTableOp = {
364
+ addTable: TableOpAdd;
365
+ } | {
366
+ removeTable: TableOpRemove;
367
+ } | {
368
+ renameTable: TableOpRename;
369
+ };
370
+ /**
371
+ * @x-internal true
372
+ */
373
+ declare type MigrationColumnOp = {
374
+ addColumn: ColumnOpAdd;
375
+ } | {
376
+ removeColumn: ColumnOpRemove;
377
+ } | {
378
+ renameColumn: ColumnOpRename;
379
+ };
380
+ /**
381
+ * @x-internal true
382
+ */
383
+ declare type TableOpAdd = {
384
+ table: string;
385
+ };
386
+ /**
387
+ * @x-internal true
388
+ */
389
+ declare type TableOpRemove = {
390
+ table: string;
391
+ };
392
+ /**
393
+ * @x-internal true
394
+ */
395
+ declare type TableOpRename = {
396
+ oldName: string;
397
+ newName: string;
398
+ };
399
+ /**
400
+ * @x-internal true
401
+ */
402
+ declare type ColumnOpAdd = {
403
+ table?: string;
404
+ column: Column;
405
+ };
406
+ /**
407
+ * @x-internal true
408
+ */
409
+ declare type ColumnOpRemove = {
410
+ table?: string;
411
+ column: string;
412
+ };
413
+ /**
414
+ * @x-internal true
415
+ */
416
+ declare type ColumnOpRename = {
417
+ table?: string;
418
+ oldName: string;
419
+ newName: string;
420
+ };
421
+ declare type MigrationRequest = {
422
+ /**
423
+ * The migration request number.
424
+ */
425
+ number: number;
426
+ /**
427
+ * Migration request creation timestamp.
428
+ */
429
+ createdAt: DateTime;
430
+ /**
431
+ * Last modified timestamp.
432
+ */
433
+ modifiedAt?: DateTime;
434
+ /**
435
+ * Timestamp when the migration request was closed.
436
+ */
437
+ closedAt?: DateTime;
438
+ /**
439
+ * Timestamp when the migration request was merged.
440
+ */
441
+ mergedAt?: DateTime;
442
+ status: 'open' | 'closed' | 'merging' | 'merged';
443
+ /**
444
+ * The migration request title.
445
+ */
446
+ title: string;
447
+ /**
448
+ * The migration request body with detailed description.
449
+ */
450
+ body: string;
451
+ /**
452
+ * Name of the source branch.
453
+ */
454
+ source: string;
455
+ /**
456
+ * Name of the target branch.
457
+ */
458
+ target: string;
459
+ };
265
460
  declare type SortExpression = string[] | {
266
461
  [key: string]: SortOrder;
267
462
  } | {
268
463
  [key: string]: SortOrder;
269
464
  }[];
270
465
  declare type SortOrder = 'asc' | 'desc';
466
+ /**
467
+ * Maximum [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) for the search terms. The Levenshtein
468
+ * distance is the number of one character changes needed to make two strings equal. The default is 1, meaning that single
469
+ * character typos per word are tollerated by search. You can set it to 0 to remove the typo tollerance or set it to 2
470
+ * to allow two typos in a word.
471
+ *
472
+ * @default 1
473
+ * @maximum 2
474
+ * @minimum 0
475
+ */
476
+ declare type FuzzinessExpression = number;
477
+ /**
478
+ * 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.
479
+ */
480
+ declare type PrefixExpression = 'phrase' | 'disabled';
271
481
  /**
272
482
  * @minProperties 1
273
483
  */
@@ -281,6 +491,122 @@ declare type FilterExpression = {
281
491
  } & {
282
492
  [key: string]: FilterColumn;
283
493
  };
494
+ /**
495
+ * The description of the summaries you wish to receive. Set each key to be the field name
496
+ * you'd like for the summary. These names must not collide with other columns you've
497
+ * requested from `columns`; including implicit requests like `settings.*`.
498
+ *
499
+ * The value for each key needs to be an object. This object should contain one key and one
500
+ * value only. In this object, the key should be set to the summary function you wish to use
501
+ * and the value set to the column name to be summarized.
502
+ *
503
+ * The column being summarized cannot be an internal column (id, xata.*), nor the base of
504
+ * an object, i.e. if `settings` is an object with `dark_mode` as a field, you may summarize
505
+ * `settings.dark_mode` but not `settings` nor `settings.*`.
506
+ *
507
+ * @example {"all_users":{"count":"*"}}
508
+ * @example {"total_created":{"count":"created_at"}}
509
+ * @x-go-type xbquery.SummaryList
510
+ */
511
+ declare type SummaryExpressionList = {
512
+ [key: string]: SummaryExpression;
513
+ };
514
+ /**
515
+ * A summary expression is the description of a single summary operation. It consists of a single
516
+ * key representing the operation, and a value representing the column to be operated on.
517
+ *
518
+ * The column being summarized cannot be an internal column (id, xata.*), nor the base of
519
+ * an object, i.e. if `settings` is an object with `dark_mode` as a field, you may summarize
520
+ * `settings.dark_mode` but not `settings` nor `settings.*`.
521
+ *
522
+ * We currently support the `count` operation. When using `count`, one can set a column name
523
+ * as the value. Xata will return the total number times this column is non-null in each group.
524
+ *
525
+ * Alternately, if you'd like to count the total rows in each group - irregardless of null/not null
526
+ * status - you can set `count` to `*` to count everything.
527
+ *
528
+ * @example {"count":"deleted_at"}
529
+ * @x-go-type xbquery.Summary
530
+ */
531
+ declare type SummaryExpression = Record<string, any>;
532
+ declare type HighlightExpression = {
533
+ /**
534
+ * Set to `false` to disable highlighting. By default it is `true`.
535
+ */
536
+ enabled?: boolean;
537
+ /**
538
+ * Set to `false` to disable HTML encoding in highlight snippets. By default it is `true`.
539
+ */
540
+ encodeHTML?: boolean;
541
+ };
542
+ /**
543
+ * Booster Expression
544
+ *
545
+ * @x-go-type xata.BoosterExpression
546
+ */
547
+ declare type BoosterExpression = {
548
+ valueBooster?: ValueBooster$1;
549
+ } | {
550
+ numericBooster?: NumericBooster$1;
551
+ } | {
552
+ dateBooster?: DateBooster$1;
553
+ };
554
+ /**
555
+ * Boost records with a particular value for a column.
556
+ */
557
+ declare type ValueBooster$1 = {
558
+ /**
559
+ * The column in which to look for the value.
560
+ */
561
+ column: string;
562
+ /**
563
+ * The exact value to boost.
564
+ */
565
+ value: string | number | boolean;
566
+ /**
567
+ * The factor with which to multiply the score of the record.
568
+ */
569
+ factor: number;
570
+ };
571
+ /**
572
+ * Boost records based on the value of a numeric column.
573
+ */
574
+ declare type NumericBooster$1 = {
575
+ /**
576
+ * The column in which to look for the value.
577
+ */
578
+ column: string;
579
+ /**
580
+ * The factor with which to multiply the value of the column before adding it to the item score.
581
+ */
582
+ factor: number;
583
+ };
584
+ /**
585
+ * Boost records based on the value of a datetime column. It is configured via "origin", "scale", and "decay". The further away from the "origin",
586
+ * 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
587
+ * 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.
588
+ */
589
+ declare type DateBooster$1 = {
590
+ /**
591
+ * The column in which to look for the value.
592
+ */
593
+ column: string;
594
+ /**
595
+ * The datetime (formatted as RFC3339) from where to apply the score decay function. The maximum boost will be applied for records with values at this time.
596
+ * If it is not specified, the current date and time is used.
597
+ */
598
+ origin?: string;
599
+ /**
600
+ * The duration at which distance from origin the score is decayed with factor, using an exponential function. It is fromatted as number + units, for example: `5d`, `20m`, `10s`.
601
+ *
602
+ * @pattern ^(\d+)(d|h|m|s|ms)$
603
+ */
604
+ scale: string;
605
+ /**
606
+ * The decay factor to expect at "scale" distance from the "origin".
607
+ */
608
+ decay: number;
609
+ };
284
610
  declare type FilterList = FilterExpression | FilterExpression[];
285
611
  declare type FilterColumn = FilterColumnIncludes | FilterPredicate | FilterList;
286
612
  /**
@@ -330,14 +656,73 @@ declare type FilterValue = number | string | boolean;
330
656
  * Pagination settings.
331
657
  */
332
658
  declare type PageConfig = {
659
+ /**
660
+ * Query the next page that follow the cursor.
661
+ */
333
662
  after?: string;
663
+ /**
664
+ * Query the previous page before the cursor.
665
+ */
334
666
  before?: string;
667
+ /**
668
+ * Query the first page from the cursor.
669
+ */
335
670
  first?: string;
671
+ /**
672
+ * Query the last page from the cursor.
673
+ */
336
674
  last?: string;
675
+ /**
676
+ * Set page size. If the size is missing it is read from the cursor. If no cursor is given xata will choose the default page size.
677
+ *
678
+ * @default 20
679
+ */
337
680
  size?: number;
681
+ /**
682
+ * Use offset to skip entries. To skip pages set offset to a multiple of size.
683
+ *
684
+ * @default 0
685
+ */
338
686
  offset?: number;
339
687
  };
340
- declare type ColumnsFilter = string[];
688
+ /**
689
+ * @example name
690
+ * @example email
691
+ * @example created_at
692
+ */
693
+ declare type ColumnsProjection = string[];
694
+ /**
695
+ * Xata Table Record Metadata
696
+ */
697
+ declare type RecordMeta = {
698
+ id: RecordID;
699
+ xata: {
700
+ /**
701
+ * The record's version. Can be used for optimistic concurrency control.
702
+ */
703
+ version: number;
704
+ /**
705
+ * The record's table name. APIs that return records from multiple tables will set this field accordingly.
706
+ */
707
+ table?: string;
708
+ /**
709
+ * Highlights of the record. This is used by the search APIs to indicate which fields and parts of the fields have matched the search.
710
+ */
711
+ highlight?: {
712
+ [key: string]: string[] | {
713
+ [key: string]: any;
714
+ };
715
+ };
716
+ /**
717
+ * The record's relevancy score. This is returned by the search APIs.
718
+ */
719
+ score?: number;
720
+ /**
721
+ * Encoding/Decoding errors
722
+ */
723
+ warnings?: string[];
724
+ };
725
+ };
341
726
  /**
342
727
  * @pattern [a-zA-Z0-9_-~:]+
343
728
  */
@@ -346,7 +731,13 @@ declare type RecordID = string;
346
731
  * @example {"newName":"newName","oldName":"oldName"}
347
732
  */
348
733
  declare type TableRename = {
734
+ /**
735
+ * @minLength 1
736
+ */
349
737
  newName: string;
738
+ /**
739
+ * @minLength 1
740
+ */
350
741
  oldName: string;
351
742
  };
352
743
  /**
@@ -354,21 +745,20 @@ declare type TableRename = {
354
745
  */
355
746
  declare type RecordsMetadata = {
356
747
  page: {
748
+ /**
749
+ * last record id
750
+ */
357
751
  cursor: string;
752
+ /**
753
+ * true if more records can be fetch
754
+ */
358
755
  more: boolean;
359
756
  };
360
757
  };
361
758
  /**
362
- * Xata Table Record
759
+ * Xata Table Record Metadata
363
760
  */
364
- declare type XataRecord$1 = {
365
- id: RecordID;
366
- xata: {
367
- version: number;
368
- table?: string;
369
- warnings?: string[];
370
- };
371
- } & {
761
+ declare type XataRecord$1 = RecordMeta & {
372
762
  [key: string]: any;
373
763
  };
374
764
 
@@ -386,6 +776,7 @@ type schemas_InviteID = InviteID;
386
776
  type schemas_WorkspaceInvite = WorkspaceInvite;
387
777
  type schemas_WorkspaceMembers = WorkspaceMembers;
388
778
  type schemas_InviteKey = InviteKey;
779
+ type schemas_DatabaseMetadata = DatabaseMetadata;
389
780
  type schemas_ListDatabasesResponse = ListDatabasesResponse;
390
781
  type schemas_ListBranchesResponse = ListBranchesResponse;
391
782
  type schemas_ListGitBranchesResponse = ListGitBranchesResponse;
@@ -394,7 +785,9 @@ type schemas_BranchMetadata = BranchMetadata;
394
785
  type schemas_DBBranch = DBBranch;
395
786
  type schemas_StartedFromMetadata = StartedFromMetadata;
396
787
  type schemas_Schema = Schema;
788
+ type schemas_SchemaEditScript = SchemaEditScript;
397
789
  type schemas_Table = Table;
790
+ type schemas_TableEdit = TableEdit;
398
791
  type schemas_Column = Column;
399
792
  type schemas_RevLink = RevLink;
400
793
  type schemas_BranchName = BranchName;
@@ -407,9 +800,27 @@ type schemas_MetricsLatency = MetricsLatency;
407
800
  type schemas_BranchMigration = BranchMigration;
408
801
  type schemas_TableMigration = TableMigration;
409
802
  type schemas_ColumnMigration = ColumnMigration;
803
+ type schemas_Commit = Commit;
804
+ type schemas_Migration = Migration;
805
+ type schemas_MigrationOp = MigrationOp;
806
+ type schemas_MigrationTableOp = MigrationTableOp;
807
+ type schemas_MigrationColumnOp = MigrationColumnOp;
808
+ type schemas_TableOpAdd = TableOpAdd;
809
+ type schemas_TableOpRemove = TableOpRemove;
810
+ type schemas_TableOpRename = TableOpRename;
811
+ type schemas_ColumnOpAdd = ColumnOpAdd;
812
+ type schemas_ColumnOpRemove = ColumnOpRemove;
813
+ type schemas_ColumnOpRename = ColumnOpRename;
814
+ type schemas_MigrationRequest = MigrationRequest;
410
815
  type schemas_SortExpression = SortExpression;
411
816
  type schemas_SortOrder = SortOrder;
817
+ type schemas_FuzzinessExpression = FuzzinessExpression;
818
+ type schemas_PrefixExpression = PrefixExpression;
412
819
  type schemas_FilterExpression = FilterExpression;
820
+ type schemas_SummaryExpressionList = SummaryExpressionList;
821
+ type schemas_SummaryExpression = SummaryExpression;
822
+ type schemas_HighlightExpression = HighlightExpression;
823
+ type schemas_BoosterExpression = BoosterExpression;
413
824
  type schemas_FilterList = FilterList;
414
825
  type schemas_FilterColumn = FilterColumn;
415
826
  type schemas_FilterColumnIncludes = FilterColumnIncludes;
@@ -419,7 +830,8 @@ type schemas_FilterPredicateRangeOp = FilterPredicateRangeOp;
419
830
  type schemas_FilterRangeValue = FilterRangeValue;
420
831
  type schemas_FilterValue = FilterValue;
421
832
  type schemas_PageConfig = PageConfig;
422
- type schemas_ColumnsFilter = ColumnsFilter;
833
+ type schemas_ColumnsProjection = ColumnsProjection;
834
+ type schemas_RecordMeta = RecordMeta;
423
835
  type schemas_RecordID = RecordID;
424
836
  type schemas_TableRename = TableRename;
425
837
  type schemas_RecordsMetadata = RecordsMetadata;
@@ -439,6 +851,7 @@ declare namespace schemas {
439
851
  schemas_WorkspaceInvite as WorkspaceInvite,
440
852
  schemas_WorkspaceMembers as WorkspaceMembers,
441
853
  schemas_InviteKey as InviteKey,
854
+ schemas_DatabaseMetadata as DatabaseMetadata,
442
855
  schemas_ListDatabasesResponse as ListDatabasesResponse,
443
856
  schemas_ListBranchesResponse as ListBranchesResponse,
444
857
  schemas_ListGitBranchesResponse as ListGitBranchesResponse,
@@ -447,7 +860,9 @@ declare namespace schemas {
447
860
  schemas_DBBranch as DBBranch,
448
861
  schemas_StartedFromMetadata as StartedFromMetadata,
449
862
  schemas_Schema as Schema,
863
+ schemas_SchemaEditScript as SchemaEditScript,
450
864
  schemas_Table as Table,
865
+ schemas_TableEdit as TableEdit,
451
866
  schemas_Column as Column,
452
867
  schemas_RevLink as RevLink,
453
868
  schemas_BranchName as BranchName,
@@ -460,9 +875,30 @@ declare namespace schemas {
460
875
  schemas_BranchMigration as BranchMigration,
461
876
  schemas_TableMigration as TableMigration,
462
877
  schemas_ColumnMigration as ColumnMigration,
878
+ schemas_Commit as Commit,
879
+ schemas_Migration as Migration,
880
+ schemas_MigrationOp as MigrationOp,
881
+ schemas_MigrationTableOp as MigrationTableOp,
882
+ schemas_MigrationColumnOp as MigrationColumnOp,
883
+ schemas_TableOpAdd as TableOpAdd,
884
+ schemas_TableOpRemove as TableOpRemove,
885
+ schemas_TableOpRename as TableOpRename,
886
+ schemas_ColumnOpAdd as ColumnOpAdd,
887
+ schemas_ColumnOpRemove as ColumnOpRemove,
888
+ schemas_ColumnOpRename as ColumnOpRename,
889
+ schemas_MigrationRequest as MigrationRequest,
463
890
  schemas_SortExpression as SortExpression,
464
891
  schemas_SortOrder as SortOrder,
892
+ schemas_FuzzinessExpression as FuzzinessExpression,
893
+ schemas_PrefixExpression as PrefixExpression,
465
894
  schemas_FilterExpression as FilterExpression,
895
+ schemas_SummaryExpressionList as SummaryExpressionList,
896
+ schemas_SummaryExpression as SummaryExpression,
897
+ schemas_HighlightExpression as HighlightExpression,
898
+ schemas_BoosterExpression as BoosterExpression,
899
+ ValueBooster$1 as ValueBooster,
900
+ NumericBooster$1 as NumericBooster,
901
+ DateBooster$1 as DateBooster,
466
902
  schemas_FilterList as FilterList,
467
903
  schemas_FilterColumn as FilterColumn,
468
904
  schemas_FilterColumnIncludes as FilterColumnIncludes,
@@ -472,7 +908,8 @@ declare namespace schemas {
472
908
  schemas_FilterRangeValue as FilterRangeValue,
473
909
  schemas_FilterValue as FilterValue,
474
910
  schemas_PageConfig as PageConfig,
475
- schemas_ColumnsFilter as ColumnsFilter,
911
+ schemas_ColumnsProjection as ColumnsProjection,
912
+ schemas_RecordMeta as RecordMeta,
476
913
  schemas_RecordID as RecordID,
477
914
  schemas_TableRename as TableRename,
478
915
  schemas_RecordsMetadata as RecordsMetadata,
@@ -507,11 +944,22 @@ declare type BulkError = {
507
944
  status?: number;
508
945
  }[];
509
946
  };
947
+ declare type BulkInsertResponse = {
948
+ recordIDs: string[];
949
+ } | {
950
+ records: XataRecord$1[];
951
+ };
510
952
  declare type BranchMigrationPlan = {
511
953
  version: number;
512
954
  migration: BranchMigration;
513
955
  };
514
- declare type RecordUpdateResponse = {
956
+ declare type RecordResponse = XataRecord$1;
957
+ declare type SchemaCompareResponse = {
958
+ source: Schema;
959
+ target: Schema;
960
+ edits: SchemaEditScript;
961
+ };
962
+ declare type RecordUpdateResponse = XataRecord$1 | {
515
963
  id: string;
516
964
  xata: {
517
965
  version: number;
@@ -521,6 +969,9 @@ declare type QueryResponse = {
521
969
  records: XataRecord$1[];
522
970
  meta: RecordsMetadata;
523
971
  };
972
+ declare type SummarizeResponse = {
973
+ summary: Record<string, any>[];
974
+ };
524
975
  declare type SearchResponse = {
525
976
  records: XataRecord$1[];
526
977
  };
@@ -528,6 +979,9 @@ declare type SearchResponse = {
528
979
  * @example {"migrationID":"mig_c7m19ilcefoebpqj12p0"}
529
980
  */
530
981
  declare type MigrationIdResponse = {
982
+ /**
983
+ * @minLength 1
984
+ */
531
985
  migrationID: string;
532
986
  };
533
987
 
@@ -535,9 +989,13 @@ type responses_SimpleError = SimpleError;
535
989
  type responses_BadRequestError = BadRequestError;
536
990
  type responses_AuthError = AuthError;
537
991
  type responses_BulkError = BulkError;
992
+ type responses_BulkInsertResponse = BulkInsertResponse;
538
993
  type responses_BranchMigrationPlan = BranchMigrationPlan;
994
+ type responses_RecordResponse = RecordResponse;
995
+ type responses_SchemaCompareResponse = SchemaCompareResponse;
539
996
  type responses_RecordUpdateResponse = RecordUpdateResponse;
540
997
  type responses_QueryResponse = QueryResponse;
998
+ type responses_SummarizeResponse = SummarizeResponse;
541
999
  type responses_SearchResponse = SearchResponse;
542
1000
  type responses_MigrationIdResponse = MigrationIdResponse;
543
1001
  declare namespace responses {
@@ -546,9 +1004,13 @@ declare namespace responses {
546
1004
  responses_BadRequestError as BadRequestError,
547
1005
  responses_AuthError as AuthError,
548
1006
  responses_BulkError as BulkError,
1007
+ responses_BulkInsertResponse as BulkInsertResponse,
549
1008
  responses_BranchMigrationPlan as BranchMigrationPlan,
1009
+ responses_RecordResponse as RecordResponse,
1010
+ responses_SchemaCompareResponse as SchemaCompareResponse,
550
1011
  responses_RecordUpdateResponse as RecordUpdateResponse,
551
1012
  responses_QueryResponse as QueryResponse,
1013
+ responses_SummarizeResponse as SummarizeResponse,
552
1014
  responses_SearchResponse as SearchResponse,
553
1015
  responses_MigrationIdResponse as MigrationIdResponse,
554
1016
  };
@@ -629,6 +1091,9 @@ declare type GetUserAPIKeysVariables = FetcherExtraProps;
629
1091
  */
630
1092
  declare const getUserAPIKeys: (variables: GetUserAPIKeysVariables) => Promise<GetUserAPIKeysResponse>;
631
1093
  declare type CreateUserAPIKeyPathParams = {
1094
+ /**
1095
+ * API Key name
1096
+ */
632
1097
  keyName: APIKeyName;
633
1098
  };
634
1099
  declare type CreateUserAPIKeyError = ErrorWrapper<{
@@ -654,6 +1119,9 @@ declare type CreateUserAPIKeyVariables = {
654
1119
  */
655
1120
  declare const createUserAPIKey: (variables: CreateUserAPIKeyVariables) => Promise<CreateUserAPIKeyResponse>;
656
1121
  declare type DeleteUserAPIKeyPathParams = {
1122
+ /**
1123
+ * API Key name
1124
+ */
657
1125
  keyName: APIKeyName;
658
1126
  };
659
1127
  declare type DeleteUserAPIKeyError = ErrorWrapper<{
@@ -714,6 +1182,9 @@ declare type GetWorkspacesListVariables = FetcherExtraProps;
714
1182
  */
715
1183
  declare const getWorkspacesList: (variables: GetWorkspacesListVariables) => Promise<GetWorkspacesListResponse>;
716
1184
  declare type GetWorkspacePathParams = {
1185
+ /**
1186
+ * Workspace name
1187
+ */
717
1188
  workspaceId: WorkspaceID;
718
1189
  };
719
1190
  declare type GetWorkspaceError = ErrorWrapper<{
@@ -734,6 +1205,9 @@ declare type GetWorkspaceVariables = {
734
1205
  */
735
1206
  declare const getWorkspace: (variables: GetWorkspaceVariables) => Promise<Workspace>;
736
1207
  declare type UpdateWorkspacePathParams = {
1208
+ /**
1209
+ * Workspace name
1210
+ */
737
1211
  workspaceId: WorkspaceID;
738
1212
  };
739
1213
  declare type UpdateWorkspaceError = ErrorWrapper<{
@@ -755,6 +1229,9 @@ declare type UpdateWorkspaceVariables = {
755
1229
  */
756
1230
  declare const updateWorkspace: (variables: UpdateWorkspaceVariables) => Promise<Workspace>;
757
1231
  declare type DeleteWorkspacePathParams = {
1232
+ /**
1233
+ * Workspace name
1234
+ */
758
1235
  workspaceId: WorkspaceID;
759
1236
  };
760
1237
  declare type DeleteWorkspaceError = ErrorWrapper<{
@@ -775,6 +1252,9 @@ declare type DeleteWorkspaceVariables = {
775
1252
  */
776
1253
  declare const deleteWorkspace: (variables: DeleteWorkspaceVariables) => Promise<undefined>;
777
1254
  declare type GetWorkspaceMembersListPathParams = {
1255
+ /**
1256
+ * Workspace name
1257
+ */
778
1258
  workspaceId: WorkspaceID;
779
1259
  };
780
1260
  declare type GetWorkspaceMembersListError = ErrorWrapper<{
@@ -795,7 +1275,13 @@ declare type GetWorkspaceMembersListVariables = {
795
1275
  */
796
1276
  declare const getWorkspaceMembersList: (variables: GetWorkspaceMembersListVariables) => Promise<WorkspaceMembers>;
797
1277
  declare type UpdateWorkspaceMemberRolePathParams = {
1278
+ /**
1279
+ * Workspace name
1280
+ */
798
1281
  workspaceId: WorkspaceID;
1282
+ /**
1283
+ * UserID
1284
+ */
799
1285
  userId: UserID;
800
1286
  };
801
1287
  declare type UpdateWorkspaceMemberRoleError = ErrorWrapper<{
@@ -820,7 +1306,13 @@ declare type UpdateWorkspaceMemberRoleVariables = {
820
1306
  */
821
1307
  declare const updateWorkspaceMemberRole: (variables: UpdateWorkspaceMemberRoleVariables) => Promise<undefined>;
822
1308
  declare type RemoveWorkspaceMemberPathParams = {
1309
+ /**
1310
+ * Workspace name
1311
+ */
823
1312
  workspaceId: WorkspaceID;
1313
+ /**
1314
+ * UserID
1315
+ */
824
1316
  userId: UserID;
825
1317
  };
826
1318
  declare type RemoveWorkspaceMemberError = ErrorWrapper<{
@@ -841,6 +1333,9 @@ declare type RemoveWorkspaceMemberVariables = {
841
1333
  */
842
1334
  declare const removeWorkspaceMember: (variables: RemoveWorkspaceMemberVariables) => Promise<undefined>;
843
1335
  declare type InviteWorkspaceMemberPathParams = {
1336
+ /**
1337
+ * Workspace name
1338
+ */
844
1339
  workspaceId: WorkspaceID;
845
1340
  };
846
1341
  declare type InviteWorkspaceMemberError = ErrorWrapper<{
@@ -852,8 +1347,14 @@ declare type InviteWorkspaceMemberError = ErrorWrapper<{
852
1347
  } | {
853
1348
  status: 404;
854
1349
  payload: SimpleError;
1350
+ } | {
1351
+ status: 409;
1352
+ payload: SimpleError;
855
1353
  }>;
856
1354
  declare type InviteWorkspaceMemberRequestBody = {
1355
+ /**
1356
+ * @format email
1357
+ */
857
1358
  email: string;
858
1359
  role: Role;
859
1360
  };
@@ -865,8 +1366,48 @@ declare type InviteWorkspaceMemberVariables = {
865
1366
  * Invite some user to join the workspace with the given role
866
1367
  */
867
1368
  declare const inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<WorkspaceInvite>;
868
- declare type CancelWorkspaceMemberInvitePathParams = {
869
- workspaceId: WorkspaceID;
1369
+ declare type UpdateWorkspaceMemberInvitePathParams = {
1370
+ /**
1371
+ * Workspace name
1372
+ */
1373
+ workspaceId: WorkspaceID;
1374
+ /**
1375
+ * Invite identifier
1376
+ */
1377
+ inviteId: InviteID;
1378
+ };
1379
+ declare type UpdateWorkspaceMemberInviteError = ErrorWrapper<{
1380
+ status: 400;
1381
+ payload: BadRequestError;
1382
+ } | {
1383
+ status: 401;
1384
+ payload: AuthError;
1385
+ } | {
1386
+ status: 404;
1387
+ payload: SimpleError;
1388
+ } | {
1389
+ status: 422;
1390
+ payload: SimpleError;
1391
+ }>;
1392
+ declare type UpdateWorkspaceMemberInviteRequestBody = {
1393
+ role: Role;
1394
+ };
1395
+ declare type UpdateWorkspaceMemberInviteVariables = {
1396
+ body: UpdateWorkspaceMemberInviteRequestBody;
1397
+ pathParams: UpdateWorkspaceMemberInvitePathParams;
1398
+ } & FetcherExtraProps;
1399
+ /**
1400
+ * 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.
1401
+ */
1402
+ declare const updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
1403
+ declare type CancelWorkspaceMemberInvitePathParams = {
1404
+ /**
1405
+ * Workspace name
1406
+ */
1407
+ workspaceId: WorkspaceID;
1408
+ /**
1409
+ * Invite identifier
1410
+ */
870
1411
  inviteId: InviteID;
871
1412
  };
872
1413
  declare type CancelWorkspaceMemberInviteError = ErrorWrapper<{
@@ -887,7 +1428,13 @@ declare type CancelWorkspaceMemberInviteVariables = {
887
1428
  */
888
1429
  declare const cancelWorkspaceMemberInvite: (variables: CancelWorkspaceMemberInviteVariables) => Promise<undefined>;
889
1430
  declare type ResendWorkspaceMemberInvitePathParams = {
1431
+ /**
1432
+ * Workspace name
1433
+ */
890
1434
  workspaceId: WorkspaceID;
1435
+ /**
1436
+ * Invite identifier
1437
+ */
891
1438
  inviteId: InviteID;
892
1439
  };
893
1440
  declare type ResendWorkspaceMemberInviteError = ErrorWrapper<{
@@ -908,7 +1455,13 @@ declare type ResendWorkspaceMemberInviteVariables = {
908
1455
  */
909
1456
  declare const resendWorkspaceMemberInvite: (variables: ResendWorkspaceMemberInviteVariables) => Promise<undefined>;
910
1457
  declare type AcceptWorkspaceMemberInvitePathParams = {
1458
+ /**
1459
+ * Workspace name
1460
+ */
911
1461
  workspaceId: WorkspaceID;
1462
+ /**
1463
+ * Invite Key (secret) for the invited user
1464
+ */
912
1465
  inviteKey: InviteKey;
913
1466
  };
914
1467
  declare type AcceptWorkspaceMemberInviteError = ErrorWrapper<{
@@ -946,6 +1499,9 @@ declare type GetDatabaseListVariables = {
946
1499
  */
947
1500
  declare const getDatabaseList: (variables: GetDatabaseListVariables) => Promise<ListDatabasesResponse>;
948
1501
  declare type GetBranchListPathParams = {
1502
+ /**
1503
+ * The Database Name
1504
+ */
949
1505
  dbName: DBName;
950
1506
  workspace: string;
951
1507
  };
@@ -967,6 +1523,9 @@ declare type GetBranchListVariables = {
967
1523
  */
968
1524
  declare const getBranchList: (variables: GetBranchListVariables) => Promise<ListBranchesResponse>;
969
1525
  declare type CreateDatabasePathParams = {
1526
+ /**
1527
+ * The Database Name
1528
+ */
970
1529
  dbName: DBName;
971
1530
  workspace: string;
972
1531
  };
@@ -978,11 +1537,16 @@ declare type CreateDatabaseError = ErrorWrapper<{
978
1537
  payload: AuthError;
979
1538
  }>;
980
1539
  declare type CreateDatabaseResponse = {
1540
+ /**
1541
+ * @minLength 1
1542
+ */
981
1543
  databaseName: string;
982
1544
  branchName?: string;
983
1545
  };
984
1546
  declare type CreateDatabaseRequestBody = {
985
- displayName?: string;
1547
+ /**
1548
+ * @minLength 1
1549
+ */
986
1550
  branchName?: string;
987
1551
  ui?: {
988
1552
  color?: string;
@@ -998,6 +1562,9 @@ declare type CreateDatabaseVariables = {
998
1562
  */
999
1563
  declare const createDatabase: (variables: CreateDatabaseVariables) => Promise<CreateDatabaseResponse>;
1000
1564
  declare type DeleteDatabasePathParams = {
1565
+ /**
1566
+ * The Database Name
1567
+ */
1001
1568
  dbName: DBName;
1002
1569
  workspace: string;
1003
1570
  };
@@ -1018,7 +1585,67 @@ declare type DeleteDatabaseVariables = {
1018
1585
  * Delete a database and all of its branches and tables permanently.
1019
1586
  */
1020
1587
  declare const deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
1588
+ declare type GetDatabaseMetadataPathParams = {
1589
+ /**
1590
+ * The Database Name
1591
+ */
1592
+ dbName: DBName;
1593
+ workspace: string;
1594
+ };
1595
+ declare type GetDatabaseMetadataError = ErrorWrapper<{
1596
+ status: 400;
1597
+ payload: BadRequestError;
1598
+ } | {
1599
+ status: 401;
1600
+ payload: AuthError;
1601
+ } | {
1602
+ status: 404;
1603
+ payload: SimpleError;
1604
+ }>;
1605
+ declare type GetDatabaseMetadataVariables = {
1606
+ pathParams: GetDatabaseMetadataPathParams;
1607
+ } & FetcherExtraProps;
1608
+ /**
1609
+ * Retrieve metadata of the given database
1610
+ */
1611
+ declare const getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
1612
+ declare type UpdateDatabaseMetadataPathParams = {
1613
+ /**
1614
+ * The Database Name
1615
+ */
1616
+ dbName: DBName;
1617
+ workspace: string;
1618
+ };
1619
+ declare type UpdateDatabaseMetadataError = ErrorWrapper<{
1620
+ status: 400;
1621
+ payload: BadRequestError;
1622
+ } | {
1623
+ status: 401;
1624
+ payload: AuthError;
1625
+ } | {
1626
+ status: 404;
1627
+ payload: SimpleError;
1628
+ }>;
1629
+ declare type UpdateDatabaseMetadataRequestBody = {
1630
+ ui?: {
1631
+ /**
1632
+ * @minLength 1
1633
+ */
1634
+ color?: string;
1635
+ };
1636
+ };
1637
+ declare type UpdateDatabaseMetadataVariables = {
1638
+ body?: UpdateDatabaseMetadataRequestBody;
1639
+ pathParams: UpdateDatabaseMetadataPathParams;
1640
+ } & FetcherExtraProps;
1641
+ /**
1642
+ * Update the color of the selected database
1643
+ */
1644
+ declare const updateDatabaseMetadata: (variables: UpdateDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
1021
1645
  declare type GetGitBranchesMappingPathParams = {
1646
+ /**
1647
+ * The Database Name
1648
+ */
1022
1649
  dbName: DBName;
1023
1650
  workspace: string;
1024
1651
  };
@@ -1058,6 +1685,9 @@ declare type GetGitBranchesMappingVariables = {
1058
1685
  */
1059
1686
  declare const getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
1060
1687
  declare type AddGitBranchesEntryPathParams = {
1688
+ /**
1689
+ * The Database Name
1690
+ */
1061
1691
  dbName: DBName;
1062
1692
  workspace: string;
1063
1693
  };
@@ -1069,10 +1699,19 @@ declare type AddGitBranchesEntryError = ErrorWrapper<{
1069
1699
  payload: AuthError;
1070
1700
  }>;
1071
1701
  declare type AddGitBranchesEntryResponse = {
1702
+ /**
1703
+ * Warning message
1704
+ */
1072
1705
  warning?: string;
1073
1706
  };
1074
1707
  declare type AddGitBranchesEntryRequestBody = {
1708
+ /**
1709
+ * The name of the Git branch.
1710
+ */
1075
1711
  gitBranch: string;
1712
+ /**
1713
+ * The name of the Xata branch.
1714
+ */
1076
1715
  xataBranch: BranchName;
1077
1716
  };
1078
1717
  declare type AddGitBranchesEntryVariables = {
@@ -1096,10 +1735,16 @@ declare type AddGitBranchesEntryVariables = {
1096
1735
  */
1097
1736
  declare const addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
1098
1737
  declare type RemoveGitBranchesEntryPathParams = {
1738
+ /**
1739
+ * The Database Name
1740
+ */
1099
1741
  dbName: DBName;
1100
1742
  workspace: string;
1101
1743
  };
1102
1744
  declare type RemoveGitBranchesEntryQueryParams = {
1745
+ /**
1746
+ * The Git Branch to remove from the mapping
1747
+ */
1103
1748
  gitBranch: string;
1104
1749
  };
1105
1750
  declare type RemoveGitBranchesEntryError = ErrorWrapper<{
@@ -1124,11 +1769,20 @@ declare type RemoveGitBranchesEntryVariables = {
1124
1769
  */
1125
1770
  declare const removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
1126
1771
  declare type ResolveBranchPathParams = {
1772
+ /**
1773
+ * The Database Name
1774
+ */
1127
1775
  dbName: DBName;
1128
1776
  workspace: string;
1129
1777
  };
1130
1778
  declare type ResolveBranchQueryParams = {
1779
+ /**
1780
+ * The Git Branch
1781
+ */
1131
1782
  gitBranch?: string;
1783
+ /**
1784
+ * Default branch to fallback to
1785
+ */
1132
1786
  fallbackBranch?: string;
1133
1787
  };
1134
1788
  declare type ResolveBranchError = ErrorWrapper<{
@@ -1151,14 +1805,15 @@ declare type ResolveBranchVariables = {
1151
1805
  } & FetcherExtraProps;
1152
1806
  /**
1153
1807
  * In order to resolve the database branch, the following algorithm is used:
1154
- * * if the `gitBranch` is found in the [git branches mapping](), the associated Xata branch is returned
1808
+ * * 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
1155
1809
  * * else, if a Xata branch with the exact same name as `gitBranch` exists, return it
1156
- * * else, return the default branch of the DB (currently `main` or the first branch)
1810
+ * * else, if `fallbackBranch` is provided and a branch with that name exists, return it
1811
+ * * else, return the default branch of the DB (`main` or the first branch)
1157
1812
  *
1158
1813
  * Example call:
1159
1814
  *
1160
1815
  * ```json
1161
- * // GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test?fallbackBranch=tsg
1816
+ * // GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test&fallbackBranch=tsg
1162
1817
  * ```
1163
1818
  *
1164
1819
  * Example response:
@@ -1174,11 +1829,14 @@ declare type ResolveBranchVariables = {
1174
1829
  * ```
1175
1830
  */
1176
1831
  declare const resolveBranch: (variables: ResolveBranchVariables) => Promise<ResolveBranchResponse>;
1177
- declare type GetBranchDetailsPathParams = {
1178
- dbBranchName: DBBranchName;
1832
+ declare type ListMigrationRequestsPathParams = {
1833
+ /**
1834
+ * The Database Name
1835
+ */
1836
+ dbName: DBName;
1179
1837
  workspace: string;
1180
1838
  };
1181
- declare type GetBranchDetailsError = ErrorWrapper<{
1839
+ declare type ListMigrationRequestsError = ErrorWrapper<{
1182
1840
  status: 400;
1183
1841
  payload: BadRequestError;
1184
1842
  } | {
@@ -1188,18 +1846,29 @@ declare type GetBranchDetailsError = ErrorWrapper<{
1188
1846
  status: 404;
1189
1847
  payload: SimpleError;
1190
1848
  }>;
1191
- declare type GetBranchDetailsVariables = {
1192
- pathParams: GetBranchDetailsPathParams;
1849
+ declare type ListMigrationRequestsResponse = {
1850
+ migrationRequests: MigrationRequest[];
1851
+ meta: RecordsMetadata;
1852
+ };
1853
+ declare type ListMigrationRequestsRequestBody = {
1854
+ filter?: FilterExpression;
1855
+ sort?: SortExpression;
1856
+ page?: PageConfig;
1857
+ columns?: ColumnsProjection;
1858
+ };
1859
+ declare type ListMigrationRequestsVariables = {
1860
+ body?: ListMigrationRequestsRequestBody;
1861
+ pathParams: ListMigrationRequestsPathParams;
1193
1862
  } & FetcherExtraProps;
1194
- declare const getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
1195
- declare type CreateBranchPathParams = {
1196
- dbBranchName: DBBranchName;
1863
+ declare const listMigrationRequests: (variables: ListMigrationRequestsVariables) => Promise<ListMigrationRequestsResponse>;
1864
+ declare type CreateMigrationRequestPathParams = {
1865
+ /**
1866
+ * The Database Name
1867
+ */
1868
+ dbName: DBName;
1197
1869
  workspace: string;
1198
1870
  };
1199
- declare type CreateBranchQueryParams = {
1200
- from?: string;
1201
- };
1202
- declare type CreateBranchError = ErrorWrapper<{
1871
+ declare type CreateMigrationRequestError = ErrorWrapper<{
1203
1872
  status: 400;
1204
1873
  payload: BadRequestError;
1205
1874
  } | {
@@ -1209,21 +1878,44 @@ declare type CreateBranchError = ErrorWrapper<{
1209
1878
  status: 404;
1210
1879
  payload: SimpleError;
1211
1880
  }>;
1212
- declare type CreateBranchRequestBody = {
1213
- from?: string;
1214
- metadata?: BranchMetadata;
1881
+ declare type CreateMigrationRequestResponse = {
1882
+ number: number;
1215
1883
  };
1216
- declare type CreateBranchVariables = {
1217
- body?: CreateBranchRequestBody;
1218
- pathParams: CreateBranchPathParams;
1219
- queryParams?: CreateBranchQueryParams;
1884
+ declare type CreateMigrationRequestRequestBody = {
1885
+ /**
1886
+ * The source branch.
1887
+ */
1888
+ source: string;
1889
+ /**
1890
+ * The target branch.
1891
+ */
1892
+ target: string;
1893
+ /**
1894
+ * The title.
1895
+ */
1896
+ title: string;
1897
+ /**
1898
+ * Optional migration request description.
1899
+ */
1900
+ body?: string;
1901
+ };
1902
+ declare type CreateMigrationRequestVariables = {
1903
+ body: CreateMigrationRequestRequestBody;
1904
+ pathParams: CreateMigrationRequestPathParams;
1220
1905
  } & FetcherExtraProps;
1221
- declare const createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
1222
- declare type DeleteBranchPathParams = {
1223
- dbBranchName: DBBranchName;
1906
+ declare const createMigrationRequest: (variables: CreateMigrationRequestVariables) => Promise<CreateMigrationRequestResponse>;
1907
+ declare type GetMigrationRequestPathParams = {
1908
+ /**
1909
+ * The Database Name
1910
+ */
1911
+ dbName: DBName;
1912
+ /**
1913
+ * The migration request number.
1914
+ */
1915
+ mrNumber: number;
1224
1916
  workspace: string;
1225
1917
  };
1226
- declare type DeleteBranchError = ErrorWrapper<{
1918
+ declare type GetMigrationRequestError = ErrorWrapper<{
1227
1919
  status: 400;
1228
1920
  payload: BadRequestError;
1229
1921
  } | {
@@ -1233,18 +1925,22 @@ declare type DeleteBranchError = ErrorWrapper<{
1233
1925
  status: 404;
1234
1926
  payload: SimpleError;
1235
1927
  }>;
1236
- declare type DeleteBranchVariables = {
1237
- pathParams: DeleteBranchPathParams;
1928
+ declare type GetMigrationRequestVariables = {
1929
+ pathParams: GetMigrationRequestPathParams;
1238
1930
  } & FetcherExtraProps;
1239
- /**
1240
- * Delete the branch in the database and all its resources
1241
- */
1242
- declare const deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
1243
- declare type UpdateBranchMetadataPathParams = {
1244
- dbBranchName: DBBranchName;
1931
+ declare const getMigrationRequest: (variables: GetMigrationRequestVariables) => Promise<MigrationRequest>;
1932
+ declare type UpdateMigrationRequestPathParams = {
1933
+ /**
1934
+ * The Database Name
1935
+ */
1936
+ dbName: DBName;
1937
+ /**
1938
+ * The migration request number.
1939
+ */
1940
+ mrNumber: number;
1245
1941
  workspace: string;
1246
1942
  };
1247
- declare type UpdateBranchMetadataError = ErrorWrapper<{
1943
+ declare type UpdateMigrationRequestError = ErrorWrapper<{
1248
1944
  status: 400;
1249
1945
  payload: BadRequestError;
1250
1946
  } | {
@@ -1254,19 +1950,37 @@ declare type UpdateBranchMetadataError = ErrorWrapper<{
1254
1950
  status: 404;
1255
1951
  payload: SimpleError;
1256
1952
  }>;
1257
- declare type UpdateBranchMetadataVariables = {
1258
- body?: BranchMetadata;
1259
- pathParams: UpdateBranchMetadataPathParams;
1953
+ declare type UpdateMigrationRequestRequestBody = {
1954
+ /**
1955
+ * New migration request title.
1956
+ */
1957
+ title?: string;
1958
+ /**
1959
+ * New migration request description.
1960
+ */
1961
+ body?: string;
1962
+ /**
1963
+ * Change the migration request status.
1964
+ */
1965
+ status?: 'open' | 'closed';
1966
+ };
1967
+ declare type UpdateMigrationRequestVariables = {
1968
+ body?: UpdateMigrationRequestRequestBody;
1969
+ pathParams: UpdateMigrationRequestPathParams;
1260
1970
  } & FetcherExtraProps;
1261
- /**
1262
- * Update the branch metadata
1263
- */
1264
- declare const updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
1265
- declare type GetBranchMetadataPathParams = {
1266
- dbBranchName: DBBranchName;
1971
+ declare const updateMigrationRequest: (variables: UpdateMigrationRequestVariables) => Promise<undefined>;
1972
+ declare type ListMigrationRequestsCommitsPathParams = {
1973
+ /**
1974
+ * The Database Name
1975
+ */
1976
+ dbName: DBName;
1977
+ /**
1978
+ * The migration request number.
1979
+ */
1980
+ mrNumber: number;
1267
1981
  workspace: string;
1268
1982
  };
1269
- declare type GetBranchMetadataError = ErrorWrapper<{
1983
+ declare type ListMigrationRequestsCommitsError = ErrorWrapper<{
1270
1984
  status: 400;
1271
1985
  payload: BadRequestError;
1272
1986
  } | {
@@ -1276,15 +1990,54 @@ declare type GetBranchMetadataError = ErrorWrapper<{
1276
1990
  status: 404;
1277
1991
  payload: SimpleError;
1278
1992
  }>;
1279
- declare type GetBranchMetadataVariables = {
1280
- pathParams: GetBranchMetadataPathParams;
1993
+ declare type ListMigrationRequestsCommitsResponse = {
1994
+ meta: {
1995
+ /**
1996
+ * last record id
1997
+ */
1998
+ cursor: string;
1999
+ /**
2000
+ * true if more records can be fetch
2001
+ */
2002
+ more: boolean;
2003
+ };
2004
+ logs: Commit[];
2005
+ };
2006
+ declare type ListMigrationRequestsCommitsRequestBody = {
2007
+ page?: {
2008
+ /**
2009
+ * Query the next page that follow the cursor.
2010
+ */
2011
+ after?: string;
2012
+ /**
2013
+ * Query the previous page before the cursor.
2014
+ */
2015
+ before?: string;
2016
+ /**
2017
+ * Set page size. If the size is missing it is read from the cursor. If no cursor is given xata will choose the default page size.
2018
+ *
2019
+ * @default 20
2020
+ */
2021
+ size?: number;
2022
+ };
2023
+ };
2024
+ declare type ListMigrationRequestsCommitsVariables = {
2025
+ body?: ListMigrationRequestsCommitsRequestBody;
2026
+ pathParams: ListMigrationRequestsCommitsPathParams;
1281
2027
  } & FetcherExtraProps;
1282
- declare const getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
1283
- declare type GetBranchMigrationHistoryPathParams = {
1284
- dbBranchName: DBBranchName;
2028
+ declare const listMigrationRequestsCommits: (variables: ListMigrationRequestsCommitsVariables) => Promise<ListMigrationRequestsCommitsResponse>;
2029
+ declare type CompareMigrationRequestPathParams = {
2030
+ /**
2031
+ * The Database Name
2032
+ */
2033
+ dbName: DBName;
2034
+ /**
2035
+ * The migration request number.
2036
+ */
2037
+ mrNumber: number;
1285
2038
  workspace: string;
1286
2039
  };
1287
- declare type GetBranchMigrationHistoryError = ErrorWrapper<{
2040
+ declare type CompareMigrationRequestError = ErrorWrapper<{
1288
2041
  status: 400;
1289
2042
  payload: BadRequestError;
1290
2043
  } | {
@@ -1294,24 +2047,22 @@ declare type GetBranchMigrationHistoryError = ErrorWrapper<{
1294
2047
  status: 404;
1295
2048
  payload: SimpleError;
1296
2049
  }>;
1297
- declare type GetBranchMigrationHistoryResponse = {
1298
- startedFrom?: StartedFromMetadata;
1299
- migrations?: BranchMigration[];
1300
- };
1301
- declare type GetBranchMigrationHistoryRequestBody = {
1302
- limit?: number;
1303
- startFrom?: string;
1304
- };
1305
- declare type GetBranchMigrationHistoryVariables = {
1306
- body?: GetBranchMigrationHistoryRequestBody;
1307
- pathParams: GetBranchMigrationHistoryPathParams;
2050
+ declare type CompareMigrationRequestVariables = {
2051
+ pathParams: CompareMigrationRequestPathParams;
1308
2052
  } & FetcherExtraProps;
1309
- declare const getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
1310
- declare type ExecuteBranchMigrationPlanPathParams = {
1311
- dbBranchName: DBBranchName;
2053
+ declare const compareMigrationRequest: (variables: CompareMigrationRequestVariables) => Promise<SchemaCompareResponse>;
2054
+ declare type GetMigrationRequestIsMergedPathParams = {
2055
+ /**
2056
+ * The Database Name
2057
+ */
2058
+ dbName: DBName;
2059
+ /**
2060
+ * The migration request number.
2061
+ */
2062
+ mrNumber: number;
1312
2063
  workspace: string;
1313
2064
  };
1314
- declare type ExecuteBranchMigrationPlanError = ErrorWrapper<{
2065
+ declare type GetMigrationRequestIsMergedError = ErrorWrapper<{
1315
2066
  status: 400;
1316
2067
  payload: BadRequestError;
1317
2068
  } | {
@@ -1321,22 +2072,238 @@ declare type ExecuteBranchMigrationPlanError = ErrorWrapper<{
1321
2072
  status: 404;
1322
2073
  payload: SimpleError;
1323
2074
  }>;
1324
- declare type ExecuteBranchMigrationPlanRequestBody = {
1325
- version: number;
1326
- migration: BranchMigration;
2075
+ declare type GetMigrationRequestIsMergedResponse = {
2076
+ merged?: boolean;
1327
2077
  };
1328
- declare type ExecuteBranchMigrationPlanVariables = {
1329
- body: ExecuteBranchMigrationPlanRequestBody;
1330
- pathParams: ExecuteBranchMigrationPlanPathParams;
2078
+ declare type GetMigrationRequestIsMergedVariables = {
2079
+ pathParams: GetMigrationRequestIsMergedPathParams;
1331
2080
  } & FetcherExtraProps;
1332
- /**
1333
- * Apply a migration plan to the branch
1334
- */
1335
- declare const executeBranchMigrationPlan: (variables: ExecuteBranchMigrationPlanVariables) => Promise<undefined>;
1336
- declare type GetBranchMigrationPlanPathParams = {
1337
- dbBranchName: DBBranchName;
1338
- workspace: string;
1339
- };
2081
+ declare const getMigrationRequestIsMerged: (variables: GetMigrationRequestIsMergedVariables) => Promise<GetMigrationRequestIsMergedResponse>;
2082
+ declare type MergeMigrationRequestPathParams = {
2083
+ /**
2084
+ * The Database Name
2085
+ */
2086
+ dbName: DBName;
2087
+ /**
2088
+ * The migration request number.
2089
+ */
2090
+ mrNumber: number;
2091
+ workspace: string;
2092
+ };
2093
+ declare type MergeMigrationRequestError = ErrorWrapper<{
2094
+ status: 400;
2095
+ payload: BadRequestError;
2096
+ } | {
2097
+ status: 401;
2098
+ payload: AuthError;
2099
+ } | {
2100
+ status: 404;
2101
+ payload: SimpleError;
2102
+ }>;
2103
+ declare type MergeMigrationRequestVariables = {
2104
+ pathParams: MergeMigrationRequestPathParams;
2105
+ } & FetcherExtraProps;
2106
+ declare const mergeMigrationRequest: (variables: MergeMigrationRequestVariables) => Promise<Commit>;
2107
+ declare type GetBranchDetailsPathParams = {
2108
+ /**
2109
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2110
+ */
2111
+ dbBranchName: DBBranchName;
2112
+ workspace: string;
2113
+ };
2114
+ declare type GetBranchDetailsError = ErrorWrapper<{
2115
+ status: 400;
2116
+ payload: BadRequestError;
2117
+ } | {
2118
+ status: 401;
2119
+ payload: AuthError;
2120
+ } | {
2121
+ status: 404;
2122
+ payload: SimpleError;
2123
+ }>;
2124
+ declare type GetBranchDetailsVariables = {
2125
+ pathParams: GetBranchDetailsPathParams;
2126
+ } & FetcherExtraProps;
2127
+ declare const getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
2128
+ declare type CreateBranchPathParams = {
2129
+ /**
2130
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2131
+ */
2132
+ dbBranchName: DBBranchName;
2133
+ workspace: string;
2134
+ };
2135
+ declare type CreateBranchQueryParams = {
2136
+ /**
2137
+ * Name of source branch to branch the new schema from
2138
+ */
2139
+ from?: string;
2140
+ };
2141
+ declare type CreateBranchError = ErrorWrapper<{
2142
+ status: 400;
2143
+ payload: BadRequestError;
2144
+ } | {
2145
+ status: 401;
2146
+ payload: AuthError;
2147
+ } | {
2148
+ status: 404;
2149
+ payload: SimpleError;
2150
+ }>;
2151
+ declare type CreateBranchResponse = {
2152
+ /**
2153
+ * @minLength 1
2154
+ */
2155
+ databaseName: string;
2156
+ branchName: string;
2157
+ };
2158
+ declare type CreateBranchRequestBody = {
2159
+ /**
2160
+ * Select the branch to fork from. Defaults to 'main'
2161
+ */
2162
+ from?: string;
2163
+ metadata?: BranchMetadata;
2164
+ };
2165
+ declare type CreateBranchVariables = {
2166
+ body?: CreateBranchRequestBody;
2167
+ pathParams: CreateBranchPathParams;
2168
+ queryParams?: CreateBranchQueryParams;
2169
+ } & FetcherExtraProps;
2170
+ declare const createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
2171
+ declare type DeleteBranchPathParams = {
2172
+ /**
2173
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2174
+ */
2175
+ dbBranchName: DBBranchName;
2176
+ workspace: string;
2177
+ };
2178
+ declare type DeleteBranchError = ErrorWrapper<{
2179
+ status: 400;
2180
+ payload: BadRequestError;
2181
+ } | {
2182
+ status: 401;
2183
+ payload: AuthError;
2184
+ } | {
2185
+ status: 404;
2186
+ payload: SimpleError;
2187
+ }>;
2188
+ declare type DeleteBranchVariables = {
2189
+ pathParams: DeleteBranchPathParams;
2190
+ } & FetcherExtraProps;
2191
+ /**
2192
+ * Delete the branch in the database and all its resources
2193
+ */
2194
+ declare const deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
2195
+ declare type UpdateBranchMetadataPathParams = {
2196
+ /**
2197
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2198
+ */
2199
+ dbBranchName: DBBranchName;
2200
+ workspace: string;
2201
+ };
2202
+ declare type UpdateBranchMetadataError = ErrorWrapper<{
2203
+ status: 400;
2204
+ payload: BadRequestError;
2205
+ } | {
2206
+ status: 401;
2207
+ payload: AuthError;
2208
+ } | {
2209
+ status: 404;
2210
+ payload: SimpleError;
2211
+ }>;
2212
+ declare type UpdateBranchMetadataVariables = {
2213
+ body?: BranchMetadata;
2214
+ pathParams: UpdateBranchMetadataPathParams;
2215
+ } & FetcherExtraProps;
2216
+ /**
2217
+ * Update the branch metadata
2218
+ */
2219
+ declare const updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
2220
+ declare type GetBranchMetadataPathParams = {
2221
+ /**
2222
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2223
+ */
2224
+ dbBranchName: DBBranchName;
2225
+ workspace: string;
2226
+ };
2227
+ declare type GetBranchMetadataError = ErrorWrapper<{
2228
+ status: 400;
2229
+ payload: BadRequestError;
2230
+ } | {
2231
+ status: 401;
2232
+ payload: AuthError;
2233
+ } | {
2234
+ status: 404;
2235
+ payload: SimpleError;
2236
+ }>;
2237
+ declare type GetBranchMetadataVariables = {
2238
+ pathParams: GetBranchMetadataPathParams;
2239
+ } & FetcherExtraProps;
2240
+ declare const getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
2241
+ declare type GetBranchMigrationHistoryPathParams = {
2242
+ /**
2243
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2244
+ */
2245
+ dbBranchName: DBBranchName;
2246
+ workspace: string;
2247
+ };
2248
+ declare type GetBranchMigrationHistoryError = ErrorWrapper<{
2249
+ status: 400;
2250
+ payload: BadRequestError;
2251
+ } | {
2252
+ status: 401;
2253
+ payload: AuthError;
2254
+ } | {
2255
+ status: 404;
2256
+ payload: SimpleError;
2257
+ }>;
2258
+ declare type GetBranchMigrationHistoryResponse = {
2259
+ startedFrom?: StartedFromMetadata;
2260
+ migrations?: BranchMigration[];
2261
+ };
2262
+ declare type GetBranchMigrationHistoryRequestBody = {
2263
+ limit?: number;
2264
+ startFrom?: string;
2265
+ };
2266
+ declare type GetBranchMigrationHistoryVariables = {
2267
+ body?: GetBranchMigrationHistoryRequestBody;
2268
+ pathParams: GetBranchMigrationHistoryPathParams;
2269
+ } & FetcherExtraProps;
2270
+ declare const getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
2271
+ declare type ExecuteBranchMigrationPlanPathParams = {
2272
+ /**
2273
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2274
+ */
2275
+ dbBranchName: DBBranchName;
2276
+ workspace: string;
2277
+ };
2278
+ declare type ExecuteBranchMigrationPlanError = ErrorWrapper<{
2279
+ status: 400;
2280
+ payload: BadRequestError;
2281
+ } | {
2282
+ status: 401;
2283
+ payload: AuthError;
2284
+ } | {
2285
+ status: 404;
2286
+ payload: SimpleError;
2287
+ }>;
2288
+ declare type ExecuteBranchMigrationPlanRequestBody = {
2289
+ version: number;
2290
+ migration: BranchMigration;
2291
+ };
2292
+ declare type ExecuteBranchMigrationPlanVariables = {
2293
+ body: ExecuteBranchMigrationPlanRequestBody;
2294
+ pathParams: ExecuteBranchMigrationPlanPathParams;
2295
+ } & FetcherExtraProps;
2296
+ /**
2297
+ * Apply a migration plan to the branch
2298
+ */
2299
+ declare const executeBranchMigrationPlan: (variables: ExecuteBranchMigrationPlanVariables) => Promise<undefined>;
2300
+ declare type GetBranchMigrationPlanPathParams = {
2301
+ /**
2302
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2303
+ */
2304
+ dbBranchName: DBBranchName;
2305
+ workspace: string;
2306
+ };
1340
2307
  declare type GetBranchMigrationPlanError = ErrorWrapper<{
1341
2308
  status: 400;
1342
2309
  payload: BadRequestError;
@@ -1355,7 +2322,199 @@ declare type GetBranchMigrationPlanVariables = {
1355
2322
  * Compute a migration plan from a target schema the branch should be migrated too.
1356
2323
  */
1357
2324
  declare const getBranchMigrationPlan: (variables: GetBranchMigrationPlanVariables) => Promise<BranchMigrationPlan>;
2325
+ declare type CompareBranchWithUserSchemaPathParams = {
2326
+ /**
2327
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2328
+ */
2329
+ dbBranchName: DBBranchName;
2330
+ workspace: string;
2331
+ };
2332
+ declare type CompareBranchWithUserSchemaError = ErrorWrapper<{
2333
+ status: 400;
2334
+ payload: BadRequestError;
2335
+ } | {
2336
+ status: 401;
2337
+ payload: AuthError;
2338
+ } | {
2339
+ status: 404;
2340
+ payload: SimpleError;
2341
+ }>;
2342
+ declare type CompareBranchWithUserSchemaRequestBody = {
2343
+ schema: Schema;
2344
+ };
2345
+ declare type CompareBranchWithUserSchemaVariables = {
2346
+ body: CompareBranchWithUserSchemaRequestBody;
2347
+ pathParams: CompareBranchWithUserSchemaPathParams;
2348
+ } & FetcherExtraProps;
2349
+ declare const compareBranchWithUserSchema: (variables: CompareBranchWithUserSchemaVariables) => Promise<SchemaCompareResponse>;
2350
+ declare type CompareBranchSchemasPathParams = {
2351
+ /**
2352
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2353
+ */
2354
+ dbBranchName: DBBranchName;
2355
+ /**
2356
+ * The Database Name
2357
+ */
2358
+ branchName: BranchName;
2359
+ workspace: string;
2360
+ };
2361
+ declare type CompareBranchSchemasError = ErrorWrapper<{
2362
+ status: 400;
2363
+ payload: BadRequestError;
2364
+ } | {
2365
+ status: 401;
2366
+ payload: AuthError;
2367
+ } | {
2368
+ status: 404;
2369
+ payload: SimpleError;
2370
+ }>;
2371
+ declare type CompareBranchSchemasVariables = {
2372
+ body?: Record<string, any>;
2373
+ pathParams: CompareBranchSchemasPathParams;
2374
+ } & FetcherExtraProps;
2375
+ declare const compareBranchSchemas: (variables: CompareBranchSchemasVariables) => Promise<SchemaCompareResponse>;
2376
+ declare type UpdateBranchSchemaPathParams = {
2377
+ /**
2378
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2379
+ */
2380
+ dbBranchName: DBBranchName;
2381
+ workspace: string;
2382
+ };
2383
+ declare type UpdateBranchSchemaError = ErrorWrapper<{
2384
+ status: 400;
2385
+ payload: BadRequestError;
2386
+ } | {
2387
+ status: 401;
2388
+ payload: AuthError;
2389
+ } | {
2390
+ status: 404;
2391
+ payload: SimpleError;
2392
+ }>;
2393
+ declare type UpdateBranchSchemaResponse = {
2394
+ id: string;
2395
+ parentID: string;
2396
+ };
2397
+ declare type UpdateBranchSchemaVariables = {
2398
+ body: Migration;
2399
+ pathParams: UpdateBranchSchemaPathParams;
2400
+ } & FetcherExtraProps;
2401
+ declare const updateBranchSchema: (variables: UpdateBranchSchemaVariables) => Promise<UpdateBranchSchemaResponse>;
2402
+ declare type PreviewBranchSchemaEditPathParams = {
2403
+ /**
2404
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2405
+ */
2406
+ dbBranchName: DBBranchName;
2407
+ workspace: string;
2408
+ };
2409
+ declare type PreviewBranchSchemaEditError = ErrorWrapper<{
2410
+ status: 400;
2411
+ payload: BadRequestError;
2412
+ } | {
2413
+ status: 401;
2414
+ payload: AuthError;
2415
+ } | {
2416
+ status: 404;
2417
+ payload: SimpleError;
2418
+ }>;
2419
+ declare type PreviewBranchSchemaEditResponse = {
2420
+ original: Schema;
2421
+ updated: Schema;
2422
+ };
2423
+ declare type PreviewBranchSchemaEditRequestBody = {
2424
+ edits?: SchemaEditScript;
2425
+ operations?: MigrationOp[];
2426
+ };
2427
+ declare type PreviewBranchSchemaEditVariables = {
2428
+ body?: PreviewBranchSchemaEditRequestBody;
2429
+ pathParams: PreviewBranchSchemaEditPathParams;
2430
+ } & FetcherExtraProps;
2431
+ declare const previewBranchSchemaEdit: (variables: PreviewBranchSchemaEditVariables) => Promise<PreviewBranchSchemaEditResponse>;
2432
+ declare type ApplyBranchSchemaEditPathParams = {
2433
+ /**
2434
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2435
+ */
2436
+ dbBranchName: DBBranchName;
2437
+ workspace: string;
2438
+ };
2439
+ declare type ApplyBranchSchemaEditError = ErrorWrapper<{
2440
+ status: 400;
2441
+ payload: BadRequestError;
2442
+ } | {
2443
+ status: 401;
2444
+ payload: AuthError;
2445
+ } | {
2446
+ status: 404;
2447
+ payload: SimpleError;
2448
+ }>;
2449
+ declare type ApplyBranchSchemaEditResponse = {
2450
+ id: string;
2451
+ parentID: string;
2452
+ };
2453
+ declare type ApplyBranchSchemaEditRequestBody = {
2454
+ edits: SchemaEditScript;
2455
+ };
2456
+ declare type ApplyBranchSchemaEditVariables = {
2457
+ body: ApplyBranchSchemaEditRequestBody;
2458
+ pathParams: ApplyBranchSchemaEditPathParams;
2459
+ } & FetcherExtraProps;
2460
+ declare const applyBranchSchemaEdit: (variables: ApplyBranchSchemaEditVariables) => Promise<ApplyBranchSchemaEditResponse>;
2461
+ declare type GetBranchSchemaHistoryPathParams = {
2462
+ /**
2463
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2464
+ */
2465
+ dbBranchName: DBBranchName;
2466
+ workspace: string;
2467
+ };
2468
+ declare type GetBranchSchemaHistoryError = ErrorWrapper<{
2469
+ status: 400;
2470
+ payload: BadRequestError;
2471
+ } | {
2472
+ status: 401;
2473
+ payload: AuthError;
2474
+ } | {
2475
+ status: 404;
2476
+ payload: SimpleError;
2477
+ }>;
2478
+ declare type GetBranchSchemaHistoryResponse = {
2479
+ meta: {
2480
+ /**
2481
+ * last record id
2482
+ */
2483
+ cursor: string;
2484
+ /**
2485
+ * true if more records can be fetch
2486
+ */
2487
+ more: boolean;
2488
+ };
2489
+ logs: Commit[];
2490
+ };
2491
+ declare type GetBranchSchemaHistoryRequestBody = {
2492
+ page?: {
2493
+ /**
2494
+ * Query the next page that follow the cursor.
2495
+ */
2496
+ after?: string;
2497
+ /**
2498
+ * Query the previous page before the cursor.
2499
+ */
2500
+ before?: string;
2501
+ /**
2502
+ * Set page size. If the size is missing it is read from the cursor. If no cursor is given xata will choose the default page size.
2503
+ *
2504
+ * @default 20
2505
+ */
2506
+ size?: number;
2507
+ };
2508
+ };
2509
+ declare type GetBranchSchemaHistoryVariables = {
2510
+ body?: GetBranchSchemaHistoryRequestBody;
2511
+ pathParams: GetBranchSchemaHistoryPathParams;
2512
+ } & FetcherExtraProps;
2513
+ declare const getBranchSchemaHistory: (variables: GetBranchSchemaHistoryVariables) => Promise<GetBranchSchemaHistoryResponse>;
1358
2514
  declare type GetBranchStatsPathParams = {
2515
+ /**
2516
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2517
+ */
1359
2518
  dbBranchName: DBBranchName;
1360
2519
  workspace: string;
1361
2520
  };
@@ -1388,7 +2547,13 @@ declare type GetBranchStatsVariables = {
1388
2547
  */
1389
2548
  declare const getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
1390
2549
  declare type CreateTablePathParams = {
2550
+ /**
2551
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2552
+ */
1391
2553
  dbBranchName: DBBranchName;
2554
+ /**
2555
+ * The Table name
2556
+ */
1392
2557
  tableName: TableName;
1393
2558
  workspace: string;
1394
2559
  };
@@ -1405,15 +2570,28 @@ declare type CreateTableError = ErrorWrapper<{
1405
2570
  status: 422;
1406
2571
  payload: SimpleError;
1407
2572
  }>;
2573
+ declare type CreateTableResponse = {
2574
+ branchName: string;
2575
+ /**
2576
+ * @minLength 1
2577
+ */
2578
+ tableName: string;
2579
+ };
1408
2580
  declare type CreateTableVariables = {
1409
2581
  pathParams: CreateTablePathParams;
1410
2582
  } & FetcherExtraProps;
1411
2583
  /**
1412
2584
  * Creates a new table with the given name. Returns 422 if a table with the same name already exists.
1413
2585
  */
1414
- declare const createTable: (variables: CreateTableVariables) => Promise<undefined>;
2586
+ declare const createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
1415
2587
  declare type DeleteTablePathParams = {
2588
+ /**
2589
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2590
+ */
1416
2591
  dbBranchName: DBBranchName;
2592
+ /**
2593
+ * The Table name
2594
+ */
1417
2595
  tableName: TableName;
1418
2596
  workspace: string;
1419
2597
  };
@@ -1432,7 +2610,13 @@ declare type DeleteTableVariables = {
1432
2610
  */
1433
2611
  declare const deleteTable: (variables: DeleteTableVariables) => Promise<undefined>;
1434
2612
  declare type UpdateTablePathParams = {
2613
+ /**
2614
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2615
+ */
1435
2616
  dbBranchName: DBBranchName;
2617
+ /**
2618
+ * The Table name
2619
+ */
1436
2620
  tableName: TableName;
1437
2621
  workspace: string;
1438
2622
  };
@@ -1447,6 +2631,9 @@ declare type UpdateTableError = ErrorWrapper<{
1447
2631
  payload: SimpleError;
1448
2632
  }>;
1449
2633
  declare type UpdateTableRequestBody = {
2634
+ /**
2635
+ * @minLength 1
2636
+ */
1450
2637
  name: string;
1451
2638
  };
1452
2639
  declare type UpdateTableVariables = {
@@ -1458,8 +2645,9 @@ declare type UpdateTableVariables = {
1458
2645
  *
1459
2646
  * In the example below, we rename a table from “users” to “people”:
1460
2647
  *
1461
- * ```jsx
1462
- * PATCH /db/test:main/tables/users
2648
+ * ```json
2649
+ * // PATCH /db/test:main/tables/users
2650
+ *
1463
2651
  * {
1464
2652
  * "name": "people"
1465
2653
  * }
@@ -1467,7 +2655,13 @@ declare type UpdateTableVariables = {
1467
2655
  */
1468
2656
  declare const updateTable: (variables: UpdateTableVariables) => Promise<undefined>;
1469
2657
  declare type GetTableSchemaPathParams = {
2658
+ /**
2659
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2660
+ */
1470
2661
  dbBranchName: DBBranchName;
2662
+ /**
2663
+ * The Table name
2664
+ */
1471
2665
  tableName: TableName;
1472
2666
  workspace: string;
1473
2667
  };
@@ -1489,7 +2683,13 @@ declare type GetTableSchemaVariables = {
1489
2683
  } & FetcherExtraProps;
1490
2684
  declare const getTableSchema: (variables: GetTableSchemaVariables) => Promise<GetTableSchemaResponse>;
1491
2685
  declare type SetTableSchemaPathParams = {
2686
+ /**
2687
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2688
+ */
1492
2689
  dbBranchName: DBBranchName;
2690
+ /**
2691
+ * The Table name
2692
+ */
1493
2693
  tableName: TableName;
1494
2694
  workspace: string;
1495
2695
  };
@@ -1515,7 +2715,13 @@ declare type SetTableSchemaVariables = {
1515
2715
  } & FetcherExtraProps;
1516
2716
  declare const setTableSchema: (variables: SetTableSchemaVariables) => Promise<undefined>;
1517
2717
  declare type GetTableColumnsPathParams = {
2718
+ /**
2719
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2720
+ */
1518
2721
  dbBranchName: DBBranchName;
2722
+ /**
2723
+ * The Table name
2724
+ */
1519
2725
  tableName: TableName;
1520
2726
  workspace: string;
1521
2727
  };
@@ -1541,7 +2747,13 @@ declare type GetTableColumnsVariables = {
1541
2747
  */
1542
2748
  declare const getTableColumns: (variables: GetTableColumnsVariables) => Promise<GetTableColumnsResponse>;
1543
2749
  declare type AddTableColumnPathParams = {
2750
+ /**
2751
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2752
+ */
1544
2753
  dbBranchName: DBBranchName;
2754
+ /**
2755
+ * The Table name
2756
+ */
1545
2757
  tableName: TableName;
1546
2758
  workspace: string;
1547
2759
  };
@@ -1566,8 +2778,17 @@ declare type AddTableColumnVariables = {
1566
2778
  */
1567
2779
  declare const addTableColumn: (variables: AddTableColumnVariables) => Promise<MigrationIdResponse>;
1568
2780
  declare type GetColumnPathParams = {
2781
+ /**
2782
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2783
+ */
1569
2784
  dbBranchName: DBBranchName;
2785
+ /**
2786
+ * The Table name
2787
+ */
1570
2788
  tableName: TableName;
2789
+ /**
2790
+ * The Column name
2791
+ */
1571
2792
  columnName: ColumnName;
1572
2793
  workspace: string;
1573
2794
  };
@@ -1589,8 +2810,17 @@ declare type GetColumnVariables = {
1589
2810
  */
1590
2811
  declare const getColumn: (variables: GetColumnVariables) => Promise<Column>;
1591
2812
  declare type DeleteColumnPathParams = {
2813
+ /**
2814
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2815
+ */
1592
2816
  dbBranchName: DBBranchName;
2817
+ /**
2818
+ * The Table name
2819
+ */
1593
2820
  tableName: TableName;
2821
+ /**
2822
+ * The Column name
2823
+ */
1594
2824
  columnName: ColumnName;
1595
2825
  workspace: string;
1596
2826
  };
@@ -1612,8 +2842,17 @@ declare type DeleteColumnVariables = {
1612
2842
  */
1613
2843
  declare const deleteColumn: (variables: DeleteColumnVariables) => Promise<MigrationIdResponse>;
1614
2844
  declare type UpdateColumnPathParams = {
2845
+ /**
2846
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2847
+ */
1615
2848
  dbBranchName: DBBranchName;
2849
+ /**
2850
+ * The Table name
2851
+ */
1616
2852
  tableName: TableName;
2853
+ /**
2854
+ * The Column name
2855
+ */
1617
2856
  columnName: ColumnName;
1618
2857
  workspace: string;
1619
2858
  };
@@ -1628,6 +2867,9 @@ declare type UpdateColumnError = ErrorWrapper<{
1628
2867
  payload: SimpleError;
1629
2868
  }>;
1630
2869
  declare type UpdateColumnRequestBody = {
2870
+ /**
2871
+ * @minLength 1
2872
+ */
1631
2873
  name: string;
1632
2874
  };
1633
2875
  declare type UpdateColumnVariables = {
@@ -1639,10 +2881,22 @@ declare type UpdateColumnVariables = {
1639
2881
  */
1640
2882
  declare const updateColumn: (variables: UpdateColumnVariables) => Promise<MigrationIdResponse>;
1641
2883
  declare type InsertRecordPathParams = {
2884
+ /**
2885
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2886
+ */
1642
2887
  dbBranchName: DBBranchName;
2888
+ /**
2889
+ * The Table name
2890
+ */
1643
2891
  tableName: TableName;
1644
2892
  workspace: string;
1645
2893
  };
2894
+ declare type InsertRecordQueryParams = {
2895
+ /**
2896
+ * Column filters
2897
+ */
2898
+ columns?: ColumnsProjection;
2899
+ };
1646
2900
  declare type InsertRecordError = ErrorWrapper<{
1647
2901
  status: 400;
1648
2902
  payload: BadRequestError;
@@ -1653,27 +2907,35 @@ declare type InsertRecordError = ErrorWrapper<{
1653
2907
  status: 404;
1654
2908
  payload: SimpleError;
1655
2909
  }>;
1656
- declare type InsertRecordResponse = {
1657
- id: string;
1658
- xata: {
1659
- version: number;
1660
- };
1661
- };
1662
2910
  declare type InsertRecordVariables = {
1663
2911
  body?: Record<string, any>;
1664
2912
  pathParams: InsertRecordPathParams;
2913
+ queryParams?: InsertRecordQueryParams;
1665
2914
  } & FetcherExtraProps;
1666
2915
  /**
1667
2916
  * Insert a new Record into the Table
1668
2917
  */
1669
- declare const insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
2918
+ declare const insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
1670
2919
  declare type InsertRecordWithIDPathParams = {
2920
+ /**
2921
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2922
+ */
1671
2923
  dbBranchName: DBBranchName;
2924
+ /**
2925
+ * The Table name
2926
+ */
1672
2927
  tableName: TableName;
2928
+ /**
2929
+ * The Record name
2930
+ */
1673
2931
  recordId: RecordID;
1674
2932
  workspace: string;
1675
2933
  };
1676
2934
  declare type InsertRecordWithIDQueryParams = {
2935
+ /**
2936
+ * Column filters
2937
+ */
2938
+ columns?: ColumnsProjection;
1677
2939
  createOnly?: boolean;
1678
2940
  ifVersion?: number;
1679
2941
  };
@@ -1700,12 +2962,25 @@ declare type InsertRecordWithIDVariables = {
1700
2962
  */
1701
2963
  declare const insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
1702
2964
  declare type UpdateRecordWithIDPathParams = {
2965
+ /**
2966
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2967
+ */
1703
2968
  dbBranchName: DBBranchName;
2969
+ /**
2970
+ * The Table name
2971
+ */
1704
2972
  tableName: TableName;
2973
+ /**
2974
+ * The Record name
2975
+ */
1705
2976
  recordId: RecordID;
1706
2977
  workspace: string;
1707
2978
  };
1708
2979
  declare type UpdateRecordWithIDQueryParams = {
2980
+ /**
2981
+ * Column filters
2982
+ */
2983
+ columns?: ColumnsProjection;
1709
2984
  ifVersion?: number;
1710
2985
  };
1711
2986
  declare type UpdateRecordWithIDError = ErrorWrapper<{
@@ -1728,12 +3003,25 @@ declare type UpdateRecordWithIDVariables = {
1728
3003
  } & FetcherExtraProps;
1729
3004
  declare const updateRecordWithID: (variables: UpdateRecordWithIDVariables) => Promise<RecordUpdateResponse>;
1730
3005
  declare type UpsertRecordWithIDPathParams = {
3006
+ /**
3007
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
3008
+ */
1731
3009
  dbBranchName: DBBranchName;
3010
+ /**
3011
+ * The Table name
3012
+ */
1732
3013
  tableName: TableName;
3014
+ /**
3015
+ * The Record name
3016
+ */
1733
3017
  recordId: RecordID;
1734
3018
  workspace: string;
1735
3019
  };
1736
3020
  declare type UpsertRecordWithIDQueryParams = {
3021
+ /**
3022
+ * Column filters
3023
+ */
3024
+ columns?: ColumnsProjection;
1737
3025
  ifVersion?: number;
1738
3026
  };
1739
3027
  declare type UpsertRecordWithIDError = ErrorWrapper<{
@@ -1756,11 +3044,26 @@ declare type UpsertRecordWithIDVariables = {
1756
3044
  } & FetcherExtraProps;
1757
3045
  declare const upsertRecordWithID: (variables: UpsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
1758
3046
  declare type DeleteRecordPathParams = {
3047
+ /**
3048
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
3049
+ */
1759
3050
  dbBranchName: DBBranchName;
3051
+ /**
3052
+ * The Table name
3053
+ */
1760
3054
  tableName: TableName;
3055
+ /**
3056
+ * The Record name
3057
+ */
1761
3058
  recordId: RecordID;
1762
3059
  workspace: string;
1763
3060
  };
3061
+ declare type DeleteRecordQueryParams = {
3062
+ /**
3063
+ * Column filters
3064
+ */
3065
+ columns?: ColumnsProjection;
3066
+ };
1764
3067
  declare type DeleteRecordError = ErrorWrapper<{
1765
3068
  status: 400;
1766
3069
  payload: BadRequestError;
@@ -1773,14 +3076,30 @@ declare type DeleteRecordError = ErrorWrapper<{
1773
3076
  }>;
1774
3077
  declare type DeleteRecordVariables = {
1775
3078
  pathParams: DeleteRecordPathParams;
3079
+ queryParams?: DeleteRecordQueryParams;
1776
3080
  } & FetcherExtraProps;
1777
- declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
3081
+ declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
1778
3082
  declare type GetRecordPathParams = {
3083
+ /**
3084
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
3085
+ */
1779
3086
  dbBranchName: DBBranchName;
3087
+ /**
3088
+ * The Table name
3089
+ */
1780
3090
  tableName: TableName;
3091
+ /**
3092
+ * The Record name
3093
+ */
1781
3094
  recordId: RecordID;
1782
3095
  workspace: string;
1783
3096
  };
3097
+ declare type GetRecordQueryParams = {
3098
+ /**
3099
+ * Column filters
3100
+ */
3101
+ columns?: ColumnsProjection;
3102
+ };
1784
3103
  declare type GetRecordError = ErrorWrapper<{
1785
3104
  status: 400;
1786
3105
  payload: BadRequestError;
@@ -1791,22 +3110,31 @@ declare type GetRecordError = ErrorWrapper<{
1791
3110
  status: 404;
1792
3111
  payload: SimpleError;
1793
3112
  }>;
1794
- declare type GetRecordRequestBody = {
1795
- columns?: ColumnsFilter;
1796
- };
1797
3113
  declare type GetRecordVariables = {
1798
- body?: GetRecordRequestBody;
1799
3114
  pathParams: GetRecordPathParams;
3115
+ queryParams?: GetRecordQueryParams;
1800
3116
  } & FetcherExtraProps;
1801
3117
  /**
1802
3118
  * Retrieve record by ID
1803
3119
  */
1804
3120
  declare const getRecord: (variables: GetRecordVariables) => Promise<XataRecord$1>;
1805
3121
  declare type BulkInsertTableRecordsPathParams = {
3122
+ /**
3123
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
3124
+ */
1806
3125
  dbBranchName: DBBranchName;
3126
+ /**
3127
+ * The Table name
3128
+ */
1807
3129
  tableName: TableName;
1808
3130
  workspace: string;
1809
3131
  };
3132
+ declare type BulkInsertTableRecordsQueryParams = {
3133
+ /**
3134
+ * Column filters
3135
+ */
3136
+ columns?: ColumnsProjection;
3137
+ };
1810
3138
  declare type BulkInsertTableRecordsError = ErrorWrapper<{
1811
3139
  status: 400;
1812
3140
  payload: BulkError;
@@ -1816,23 +3144,30 @@ declare type BulkInsertTableRecordsError = ErrorWrapper<{
1816
3144
  } | {
1817
3145
  status: 404;
1818
3146
  payload: SimpleError;
3147
+ } | {
3148
+ status: 422;
3149
+ payload: SimpleError;
1819
3150
  }>;
1820
- declare type BulkInsertTableRecordsResponse = {
1821
- recordIDs: string[];
1822
- };
1823
3151
  declare type BulkInsertTableRecordsRequestBody = {
1824
3152
  records: Record<string, any>[];
1825
3153
  };
1826
3154
  declare type BulkInsertTableRecordsVariables = {
1827
3155
  body: BulkInsertTableRecordsRequestBody;
1828
3156
  pathParams: BulkInsertTableRecordsPathParams;
3157
+ queryParams?: BulkInsertTableRecordsQueryParams;
1829
3158
  } & FetcherExtraProps;
1830
3159
  /**
1831
3160
  * Bulk insert records
1832
3161
  */
1833
- declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
3162
+ declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
1834
3163
  declare type QueryTablePathParams = {
3164
+ /**
3165
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
3166
+ */
1835
3167
  dbBranchName: DBBranchName;
3168
+ /**
3169
+ * The Table name
3170
+ */
1836
3171
  tableName: TableName;
1837
3172
  workspace: string;
1838
3173
  };
@@ -1850,7 +3185,7 @@ declare type QueryTableRequestBody = {
1850
3185
  filter?: FilterExpression;
1851
3186
  sort?: SortExpression;
1852
3187
  page?: PageConfig;
1853
- columns?: ColumnsFilter;
3188
+ columns?: ColumnsProjection;
1854
3189
  };
1855
3190
  declare type QueryTableVariables = {
1856
3191
  body?: QueryTableRequestBody;
@@ -1867,7 +3202,7 @@ declare type QueryTableVariables = {
1867
3202
  * {
1868
3203
  * "columns": [...],
1869
3204
  * "filter": {
1870
- * "$all": [...]
3205
+ * "$all": [...],
1871
3206
  * "$any": [...]
1872
3207
  * ...
1873
3208
  * },
@@ -1886,8 +3221,9 @@ declare type QueryTableVariables = {
1886
3221
  * If the `columns` array is not specified, all columns are included. For link
1887
3222
  * fields, only the ID column of the linked records is included in the response.
1888
3223
  *
1889
- * If the `columns` array is specified, only the selected columns are included.
1890
- * The `*` wildcard can be used to select all columns of the given array
3224
+ * If the `columns` array is specified, only the selected and internal
3225
+ * columns `id` and `xata` are included. The `*` wildcard can be used to
3226
+ * select all columns.
1891
3227
  *
1892
3228
  * For objects and link fields, if the column name of the object is specified, we
1893
3229
  * include all of its sub-keys. If only some sub-keys are specified (via dotted
@@ -2003,9 +3339,13 @@ declare type QueryTableVariables = {
2003
3339
  *
2004
3340
  * ```json
2005
3341
  * {
3342
+ * "id": "id1"
3343
+ * "xata": {
3344
+ * "version": 0
3345
+ * }
2006
3346
  * "name": "Kilian",
2007
3347
  * "address": {
2008
- * "street": "New street",
3348
+ * "street": "New street"
2009
3349
  * }
2010
3350
  * }
2011
3351
  * ```
@@ -2014,10 +3354,7 @@ declare type QueryTableVariables = {
2014
3354
  *
2015
3355
  * ```json
2016
3356
  * {
2017
- * "columns": [
2018
- * "*",
2019
- * "team.name"
2020
- * ]
3357
+ * "columns": ["*", "team.name"]
2021
3358
  * }
2022
3359
  * ```
2023
3360
  *
@@ -2025,6 +3362,10 @@ declare type QueryTableVariables = {
2025
3362
  *
2026
3363
  * ```json
2027
3364
  * {
3365
+ * "id": "id1"
3366
+ * "xata": {
3367
+ * "version": 0
3368
+ * }
2028
3369
  * "name": "Kilian",
2029
3370
  * "email": "kilian@gmail.com",
2030
3371
  * "address": {
@@ -2035,7 +3376,7 @@ declare type QueryTableVariables = {
2035
3376
  * "team": {
2036
3377
  * "id": "XX",
2037
3378
  * "xata": {
2038
- * "version": 0,
3379
+ * "version": 0
2039
3380
  * },
2040
3381
  * "name": "first team"
2041
3382
  * }
@@ -2046,10 +3387,7 @@ declare type QueryTableVariables = {
2046
3387
  *
2047
3388
  * ```json
2048
3389
  * {
2049
- * "columns": [
2050
- * "*",
2051
- * "team.*"
2052
- * ]
3390
+ * "columns": ["*", "team.*"]
2053
3391
  * }
2054
3392
  * ```
2055
3393
  *
@@ -2057,6 +3395,10 @@ declare type QueryTableVariables = {
2057
3395
  *
2058
3396
  * ```json
2059
3397
  * {
3398
+ * "id": "id1"
3399
+ * "xata": {
3400
+ * "version": 0
3401
+ * }
2060
3402
  * "name": "Kilian",
2061
3403
  * "email": "kilian@gmail.com",
2062
3404
  * "address": {
@@ -2067,7 +3409,7 @@ declare type QueryTableVariables = {
2067
3409
  * "team": {
2068
3410
  * "id": "XX",
2069
3411
  * "xata": {
2070
- * "version": 0,
3412
+ * "version": 0
2071
3413
  * },
2072
3414
  * "name": "first team",
2073
3415
  * "code": "A1",
@@ -2117,7 +3459,7 @@ declare type QueryTableVariables = {
2117
3459
  * ```json
2118
3460
  * {
2119
3461
  * "filter": {
2120
- * "name": "r2",
3462
+ * "name": "r2"
2121
3463
  * }
2122
3464
  * }
2123
3465
  * ```
@@ -2139,7 +3481,7 @@ declare type QueryTableVariables = {
2139
3481
  * ```json
2140
3482
  * {
2141
3483
  * "filter": {
2142
- * "settings.plan": "free",
3484
+ * "settings.plan": "free"
2143
3485
  * }
2144
3486
  * }
2145
3487
  * ```
@@ -2149,8 +3491,8 @@ declare type QueryTableVariables = {
2149
3491
  * "filter": {
2150
3492
  * "settings": {
2151
3493
  * "plan": "free"
2152
- * },
2153
- * },
3494
+ * }
3495
+ * }
2154
3496
  * }
2155
3497
  * ```
2156
3498
  *
@@ -2159,8 +3501,8 @@ declare type QueryTableVariables = {
2159
3501
  * ```json
2160
3502
  * {
2161
3503
  * "filter": {
2162
- * "settings.plan": {"$any": ["free", "paid"]}
2163
- * },
3504
+ * "settings.plan": { "$any": ["free", "paid"] }
3505
+ * }
2164
3506
  * }
2165
3507
  * ```
2166
3508
  *
@@ -2169,9 +3511,9 @@ declare type QueryTableVariables = {
2169
3511
  * ```json
2170
3512
  * {
2171
3513
  * "filter": {
2172
- * "settings.dark": true,
2173
- * "settings.plan": "free",
2174
- * },
3514
+ * "settings.dark": true,
3515
+ * "settings.plan": "free"
3516
+ * }
2175
3517
  * }
2176
3518
  * ```
2177
3519
  *
@@ -2182,11 +3524,11 @@ declare type QueryTableVariables = {
2182
3524
  * ```json
2183
3525
  * {
2184
3526
  * "filter": {
2185
- * "$any": {
2186
- * "settings.dark": true,
2187
- * "settings.plan": "free"
2188
- * }
2189
- * },
3527
+ * "$any": {
3528
+ * "settings.dark": true,
3529
+ * "settings.plan": "free"
3530
+ * }
3531
+ * }
2190
3532
  * }
2191
3533
  * ```
2192
3534
  *
@@ -2197,10 +3539,10 @@ declare type QueryTableVariables = {
2197
3539
  * "filter": {
2198
3540
  * "$any": [
2199
3541
  * {
2200
- * "name": "r1",
3542
+ * "name": "r1"
2201
3543
  * },
2202
3544
  * {
2203
- * "name": "r2",
3545
+ * "name": "r2"
2204
3546
  * }
2205
3547
  * ]
2206
3548
  * }
@@ -2212,7 +3554,7 @@ declare type QueryTableVariables = {
2212
3554
  * ```json
2213
3555
  * {
2214
3556
  * "filter": {
2215
- * "$exists": "settings",
3557
+ * "$exists": "settings"
2216
3558
  * }
2217
3559
  * }
2218
3560
  * ```
@@ -2224,10 +3566,10 @@ declare type QueryTableVariables = {
2224
3566
  * "filter": {
2225
3567
  * "$all": [
2226
3568
  * {
2227
- * "$exists": "settings",
3569
+ * "$exists": "settings"
2228
3570
  * },
2229
3571
  * {
2230
- * "$exists": "name",
3572
+ * "$exists": "name"
2231
3573
  * }
2232
3574
  * ]
2233
3575
  * }
@@ -2239,7 +3581,7 @@ declare type QueryTableVariables = {
2239
3581
  * ```json
2240
3582
  * {
2241
3583
  * "filter": {
2242
- * "$notExists": "settings",
3584
+ * "$notExists": "settings"
2243
3585
  * }
2244
3586
  * }
2245
3587
  * ```
@@ -2266,22 +3608,28 @@ declare type QueryTableVariables = {
2266
3608
  * {
2267
3609
  * "filter": {
2268
3610
  * "<column_name>": {
2269
- * "$pattern": "v*alue*"
3611
+ * "$pattern": "v*alu?"
2270
3612
  * }
2271
3613
  * }
2272
3614
  * }
2273
3615
  * ```
2274
3616
  *
3617
+ * The `$pattern` operator accepts two wildcard characters:
3618
+ * * `*` matches zero or more characters
3619
+ * * `?` matches exactly one character
3620
+ *
3621
+ * 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.
3622
+ *
2275
3623
  * We could also have `$endsWith` and `$startsWith` operators:
2276
3624
  *
2277
3625
  * ```json
2278
3626
  * {
2279
3627
  * "filter": {
2280
3628
  * "<column_name>": {
2281
- * "$endsWith": ".gz"
3629
+ * "$endsWith": ".gz"
2282
3630
  * },
2283
3631
  * "<column_name>": {
2284
- * "$startsWith": "tmp-"
3632
+ * "$startsWith": "tmp-"
2285
3633
  * }
2286
3634
  * }
2287
3635
  * }
@@ -2292,10 +3640,10 @@ declare type QueryTableVariables = {
2292
3640
  * ```json
2293
3641
  * {
2294
3642
  * "filter": {
2295
- * "<column_name>": {
2296
- * "$ge": 0,
2297
- * "$lt": 100
2298
- * }
3643
+ * "<column_name>": {
3644
+ * "$ge": 0,
3645
+ * "$lt": 100
3646
+ * }
2299
3647
  * }
2300
3648
  * }
2301
3649
  * ```
@@ -2313,7 +3661,6 @@ declare type QueryTableVariables = {
2313
3661
  * ```
2314
3662
  * The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
2315
3663
  *
2316
- *
2317
3664
  * #### Negations
2318
3665
  *
2319
3666
  * A general `$not` operator can inverse any operation.
@@ -2338,15 +3685,21 @@ declare type QueryTableVariables = {
2338
3685
  * {
2339
3686
  * "filter": {
2340
3687
  * "$not": {
2341
- * "$any": [{
2342
- * "<column_name1>": "value1"
2343
- * }, {
2344
- * "$all": [{
2345
- * "<column_name2>": "value2"
2346
- * }, {
2347
- * "<column_name3>": "value3"
2348
- * }]
2349
- * }]
3688
+ * "$any": [
3689
+ * {
3690
+ * "<column_name1>": "value1"
3691
+ * },
3692
+ * {
3693
+ * "$all": [
3694
+ * {
3695
+ * "<column_name2>": "value2"
3696
+ * },
3697
+ * {
3698
+ * "<column_name3>": "value3"
3699
+ * }
3700
+ * ]
3701
+ * }
3702
+ * ]
2350
3703
  * }
2351
3704
  * }
2352
3705
  * }
@@ -2401,8 +3754,8 @@ declare type QueryTableVariables = {
2401
3754
  * "<array name>": {
2402
3755
  * "$includes": {
2403
3756
  * "$all": [
2404
- * {"$contains": "label"},
2405
- * {"$not": {"$endsWith": "-debug"}}
3757
+ * { "$contains": "label" },
3758
+ * { "$not": { "$endsWith": "-debug" } }
2406
3759
  * ]
2407
3760
  * }
2408
3761
  * }
@@ -2422,9 +3775,7 @@ declare type QueryTableVariables = {
2422
3775
  * {
2423
3776
  * "filter": {
2424
3777
  * "settings.labels": {
2425
- * "$includesAll": [
2426
- * {"$contains": "label"},
2427
- * ]
3778
+ * "$includesAll": [{ "$contains": "label" }]
2428
3779
  * }
2429
3780
  * }
2430
3781
  * }
@@ -2472,7 +3823,6 @@ declare type QueryTableVariables = {
2472
3823
  * }
2473
3824
  * ```
2474
3825
  *
2475
- *
2476
3826
  * ### Pagination
2477
3827
  *
2478
3828
  * We offer cursor pagination and offset pagination. The offset pagination is limited
@@ -2538,8 +3888,8 @@ declare type QueryTableVariables = {
2538
3888
  * can be queried by update `page.after` to the returned cursor while keeping the
2539
3889
  * `page.before` cursor from the first range query.
2540
3890
  *
2541
- * The `filter` , `columns`, `sort` , and `page.size` configuration will be
2542
- * encoded with the cursor. The pagination request will be invalid if
3891
+ * The `filter` , `columns`, `sort` , and `page.size` configuration will be
3892
+ * encoded with the cursor. The pagination request will be invalid if
2543
3893
  * `filter` or `sort` is set. The columns returned and page size can be changed
2544
3894
  * anytime by passing the `columns` or `page.size` settings to the next query.
2545
3895
  *
@@ -2576,7 +3926,56 @@ declare type QueryTableVariables = {
2576
3926
  * ```
2577
3927
  */
2578
3928
  declare const queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
3929
+ declare type SearchTablePathParams = {
3930
+ /**
3931
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
3932
+ */
3933
+ dbBranchName: DBBranchName;
3934
+ /**
3935
+ * The Table name
3936
+ */
3937
+ tableName: TableName;
3938
+ workspace: string;
3939
+ };
3940
+ declare type SearchTableError = ErrorWrapper<{
3941
+ status: 400;
3942
+ payload: BadRequestError;
3943
+ } | {
3944
+ status: 401;
3945
+ payload: AuthError;
3946
+ } | {
3947
+ status: 404;
3948
+ payload: SimpleError;
3949
+ }>;
3950
+ declare type SearchTableRequestBody = {
3951
+ /**
3952
+ * The query string.
3953
+ *
3954
+ * @minLength 1
3955
+ */
3956
+ query: string;
3957
+ fuzziness?: FuzzinessExpression;
3958
+ prefix?: PrefixExpression;
3959
+ filter?: FilterExpression;
3960
+ highlight?: HighlightExpression;
3961
+ boosters?: BoosterExpression[];
3962
+ };
3963
+ declare type SearchTableVariables = {
3964
+ body: SearchTableRequestBody;
3965
+ pathParams: SearchTablePathParams;
3966
+ } & FetcherExtraProps;
3967
+ /**
3968
+ * Run a free text search operation in a particular table.
3969
+ *
3970
+ * 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:
3971
+ * * filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of type `text`
3972
+ * * filtering on columns of type `multiple` is currently unsupported
3973
+ */
3974
+ declare const searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2579
3975
  declare type SearchBranchPathParams = {
3976
+ /**
3977
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
3978
+ */
2580
3979
  dbBranchName: DBBranchName;
2581
3980
  workspace: string;
2582
3981
  };
@@ -2591,9 +3990,26 @@ declare type SearchBranchError = ErrorWrapper<{
2591
3990
  payload: SimpleError;
2592
3991
  }>;
2593
3992
  declare type SearchBranchRequestBody = {
2594
- tables?: string[];
3993
+ /**
3994
+ * An array with the tables in which to search. By default, all tables are included. Optionally, filters can be included that apply to each table.
3995
+ */
3996
+ tables?: (string | {
3997
+ /**
3998
+ * The name of the table.
3999
+ */
4000
+ table: string;
4001
+ filter?: FilterExpression;
4002
+ boosters?: BoosterExpression[];
4003
+ })[];
4004
+ /**
4005
+ * The query string.
4006
+ *
4007
+ * @minLength 1
4008
+ */
2595
4009
  query: string;
2596
- fuzziness?: number;
4010
+ fuzziness?: FuzzinessExpression;
4011
+ prefix?: PrefixExpression;
4012
+ highlight?: HighlightExpression;
2597
4013
  };
2598
4014
  declare type SearchBranchVariables = {
2599
4015
  body: SearchBranchRequestBody;
@@ -2603,6 +4019,77 @@ declare type SearchBranchVariables = {
2603
4019
  * Run a free text search operation across the database branch.
2604
4020
  */
2605
4021
  declare const searchBranch: (variables: SearchBranchVariables) => Promise<SearchResponse>;
4022
+ declare type SummarizeTablePathParams = {
4023
+ /**
4024
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
4025
+ */
4026
+ dbBranchName: DBBranchName;
4027
+ /**
4028
+ * The Table name
4029
+ */
4030
+ tableName: TableName;
4031
+ workspace: string;
4032
+ };
4033
+ declare type SummarizeTableError = ErrorWrapper<{
4034
+ status: 400;
4035
+ payload: BadRequestError;
4036
+ } | {
4037
+ status: 401;
4038
+ payload: AuthError;
4039
+ } | {
4040
+ status: 404;
4041
+ payload: SimpleError;
4042
+ }>;
4043
+ declare type SummarizeTableRequestBody = {
4044
+ columns?: ColumnsProjection;
4045
+ summaries?: SummaryExpressionList;
4046
+ sort?: SortExpression;
4047
+ };
4048
+ declare type SummarizeTableVariables = {
4049
+ body?: SummarizeTableRequestBody;
4050
+ pathParams: SummarizeTablePathParams;
4051
+ } & FetcherExtraProps;
4052
+ /**
4053
+ * This endpoint allows you to (optionally) define groups, and then to run
4054
+ * calculations on the values in each group. This is most helpful when you'd
4055
+ * like to understand the data you have in your database.
4056
+ *
4057
+ * A group is a combination of unique values. If you create a group for `sold_by`,
4058
+ * `product_name`, we will return one row for every combination of `sold_by` and
4059
+ * `product_name` you have in your database. When you want to calculate statistics,
4060
+ * you define these groups and ask Xata to calculate data on each group.
4061
+ *
4062
+ * **Some questions you can ask of your data:**
4063
+ *
4064
+ * How many records do I have in this table?
4065
+ * - Set `columns: []` as we we want data from the entire table, so we ask for no groups.
4066
+ * - Set `summaries: {"total": {"count": "*"}}` in order to see the count of all records.
4067
+ * We use `count: *` here we'd like to know the total amount of rows; ignoring whether
4068
+ * they are `null` or not.
4069
+ *
4070
+ * What are the top total sales for each product?
4071
+ * - Set `columns: [product_name]` as we'd like to run calculations on each unique product
4072
+ * name in our table. Setting `columns` like this will produce one row per unique product
4073
+ * name.
4074
+ * - Set `summaries: {"total_sales": {"count": "product_name"}}` as we'd like to create a
4075
+ * field called "total_sales" for each group. This field will count all rows in each group
4076
+ * with non-null product names.
4077
+ * - Set `sort: [{"total_sales": "desc"}]` in order to bring the rows with the highest
4078
+ * total_sales field to the top.
4079
+ *
4080
+ * `columns`: tells Xata how to create each group. If you add `product_id` we will create
4081
+ * a new group for every unique `product_id`.
4082
+ *
4083
+ * `summaries`: tells Xata which calculations to run on each group.
4084
+ *
4085
+ * `sort`: tells Xata in which order you'd like to see results. You may sort by fields
4086
+ * specified in `columns` as well as the summary names defined in `summaries`.
4087
+ *
4088
+ * note: Sorting on summarized values can be slower on very large tables; this will impact
4089
+ * your rate limit significantly more than other queries. Try use `filter` [coming soon] to
4090
+ * reduce the amount of data being processed in order to reduce impact on your limits.
4091
+ */
4092
+ declare const summarizeTable: (variables: SummarizeTableVariables) => Promise<SummarizeResponse>;
2606
4093
  declare const operationsByTag: {
2607
4094
  users: {
2608
4095
  getUser: (variables: GetUserVariables) => Promise<UserWithID>;
@@ -2622,6 +4109,7 @@ declare const operationsByTag: {
2622
4109
  updateWorkspaceMemberRole: (variables: UpdateWorkspaceMemberRoleVariables) => Promise<undefined>;
2623
4110
  removeWorkspaceMember: (variables: RemoveWorkspaceMemberVariables) => Promise<undefined>;
2624
4111
  inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<WorkspaceInvite>;
4112
+ updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
2625
4113
  cancelWorkspaceMemberInvite: (variables: CancelWorkspaceMemberInviteVariables) => Promise<undefined>;
2626
4114
  resendWorkspaceMemberInvite: (variables: ResendWorkspaceMemberInviteVariables) => Promise<undefined>;
2627
4115
  acceptWorkspaceMemberInvite: (variables: AcceptWorkspaceMemberInviteVariables) => Promise<undefined>;
@@ -2630,6 +4118,8 @@ declare const operationsByTag: {
2630
4118
  getDatabaseList: (variables: GetDatabaseListVariables) => Promise<ListDatabasesResponse>;
2631
4119
  createDatabase: (variables: CreateDatabaseVariables) => Promise<CreateDatabaseResponse>;
2632
4120
  deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
4121
+ getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
4122
+ updateDatabaseMetadata: (variables: UpdateDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
2633
4123
  getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
2634
4124
  addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
2635
4125
  removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
@@ -2638,17 +4128,35 @@ declare const operationsByTag: {
2638
4128
  branch: {
2639
4129
  getBranchList: (variables: GetBranchListVariables) => Promise<ListBranchesResponse>;
2640
4130
  getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
2641
- createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
4131
+ createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
2642
4132
  deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
2643
4133
  updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
2644
4134
  getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
4135
+ getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
4136
+ };
4137
+ migrationRequests: {
4138
+ listMigrationRequests: (variables: ListMigrationRequestsVariables) => Promise<ListMigrationRequestsResponse>;
4139
+ createMigrationRequest: (variables: CreateMigrationRequestVariables) => Promise<CreateMigrationRequestResponse>;
4140
+ getMigrationRequest: (variables: GetMigrationRequestVariables) => Promise<MigrationRequest>;
4141
+ updateMigrationRequest: (variables: UpdateMigrationRequestVariables) => Promise<undefined>;
4142
+ listMigrationRequestsCommits: (variables: ListMigrationRequestsCommitsVariables) => Promise<ListMigrationRequestsCommitsResponse>;
4143
+ compareMigrationRequest: (variables: CompareMigrationRequestVariables) => Promise<SchemaCompareResponse>;
4144
+ getMigrationRequestIsMerged: (variables: GetMigrationRequestIsMergedVariables) => Promise<GetMigrationRequestIsMergedResponse>;
4145
+ mergeMigrationRequest: (variables: MergeMigrationRequestVariables) => Promise<Commit>;
4146
+ };
4147
+ branchSchema: {
2645
4148
  getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
2646
4149
  executeBranchMigrationPlan: (variables: ExecuteBranchMigrationPlanVariables) => Promise<undefined>;
2647
4150
  getBranchMigrationPlan: (variables: GetBranchMigrationPlanVariables) => Promise<BranchMigrationPlan>;
2648
- getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
4151
+ compareBranchWithUserSchema: (variables: CompareBranchWithUserSchemaVariables) => Promise<SchemaCompareResponse>;
4152
+ compareBranchSchemas: (variables: CompareBranchSchemasVariables) => Promise<SchemaCompareResponse>;
4153
+ updateBranchSchema: (variables: UpdateBranchSchemaVariables) => Promise<UpdateBranchSchemaResponse>;
4154
+ previewBranchSchemaEdit: (variables: PreviewBranchSchemaEditVariables) => Promise<PreviewBranchSchemaEditResponse>;
4155
+ applyBranchSchemaEdit: (variables: ApplyBranchSchemaEditVariables) => Promise<ApplyBranchSchemaEditResponse>;
4156
+ getBranchSchemaHistory: (variables: GetBranchSchemaHistoryVariables) => Promise<GetBranchSchemaHistoryResponse>;
2649
4157
  };
2650
4158
  table: {
2651
- createTable: (variables: CreateTableVariables) => Promise<undefined>;
4159
+ createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
2652
4160
  deleteTable: (variables: DeleteTableVariables) => Promise<undefined>;
2653
4161
  updateTable: (variables: UpdateTableVariables) => Promise<undefined>;
2654
4162
  getTableSchema: (variables: GetTableSchemaVariables) => Promise<GetTableSchemaResponse>;
@@ -2660,15 +4168,17 @@ declare const operationsByTag: {
2660
4168
  updateColumn: (variables: UpdateColumnVariables) => Promise<MigrationIdResponse>;
2661
4169
  };
2662
4170
  records: {
2663
- insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
4171
+ insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
2664
4172
  insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2665
4173
  updateRecordWithID: (variables: UpdateRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2666
4174
  upsertRecordWithID: (variables: UpsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2667
- deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
4175
+ deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
2668
4176
  getRecord: (variables: GetRecordVariables) => Promise<XataRecord$1>;
2669
- bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
4177
+ bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
2670
4178
  queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
4179
+ searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2671
4180
  searchBranch: (variables: SearchBranchVariables) => Promise<SearchResponse>;
4181
+ summarizeTable: (variables: SummarizeTableVariables) => Promise<SummarizeResponse>;
2672
4182
  };
2673
4183
  };
2674
4184
 
@@ -2683,10 +4193,8 @@ interface XataApiClientOptions {
2683
4193
  fetch?: FetchImpl;
2684
4194
  apiKey?: string;
2685
4195
  host?: HostProvider;
4196
+ trace?: TraceFunction;
2686
4197
  }
2687
- /**
2688
- * @deprecated Use XataApiPlugin instead
2689
- */
2690
4198
  declare class XataApiClient {
2691
4199
  #private;
2692
4200
  constructor(options?: XataApiClientOptions);
@@ -2696,6 +4204,8 @@ declare class XataApiClient {
2696
4204
  get branches(): BranchApi;
2697
4205
  get tables(): TableApi;
2698
4206
  get records(): RecordsApi;
4207
+ get migrationRequests(): MigrationRequestsApi;
4208
+ get branchSchema(): BranchSchemaApi;
2699
4209
  }
2700
4210
  declare class UserApi {
2701
4211
  private extraProps;
@@ -2719,6 +4229,7 @@ declare class WorkspaceApi {
2719
4229
  updateWorkspaceMemberRole(workspaceId: WorkspaceID, userId: UserID, role: Role): Promise<void>;
2720
4230
  removeWorkspaceMember(workspaceId: WorkspaceID, userId: UserID): Promise<void>;
2721
4231
  inviteWorkspaceMember(workspaceId: WorkspaceID, email: string, role: Role): Promise<WorkspaceInvite>;
4232
+ updateWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID, role: Role): Promise<WorkspaceInvite>;
2722
4233
  cancelWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2723
4234
  resendWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2724
4235
  acceptWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteKey: InviteKey): Promise<void>;
@@ -2729,29 +4240,28 @@ declare class DatabaseApi {
2729
4240
  getDatabaseList(workspace: WorkspaceID): Promise<ListDatabasesResponse>;
2730
4241
  createDatabase(workspace: WorkspaceID, dbName: DBName, options?: CreateDatabaseRequestBody): Promise<CreateDatabaseResponse>;
2731
4242
  deleteDatabase(workspace: WorkspaceID, dbName: DBName): Promise<void>;
4243
+ getDatabaseMetadata(workspace: WorkspaceID, dbName: DBName): Promise<DatabaseMetadata>;
4244
+ updateDatabaseMetadata(workspace: WorkspaceID, dbName: DBName, options?: UpdateDatabaseMetadataRequestBody): Promise<DatabaseMetadata>;
2732
4245
  getGitBranchesMapping(workspace: WorkspaceID, dbName: DBName): Promise<ListGitBranchesResponse>;
2733
4246
  addGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, body: AddGitBranchesEntryRequestBody): Promise<AddGitBranchesEntryResponse>;
2734
4247
  removeGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<void>;
2735
- resolveBranch(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<ResolveBranchResponse>;
4248
+ resolveBranch(workspace: WorkspaceID, dbName: DBName, gitBranch?: string, fallbackBranch?: string): Promise<ResolveBranchResponse>;
2736
4249
  }
2737
4250
  declare class BranchApi {
2738
4251
  private extraProps;
2739
4252
  constructor(extraProps: FetcherExtraProps);
2740
4253
  getBranchList(workspace: WorkspaceID, dbName: DBName): Promise<ListBranchesResponse>;
2741
4254
  getBranchDetails(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<DBBranch>;
2742
- createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<void>;
4255
+ createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<CreateBranchResponse>;
2743
4256
  deleteBranch(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<void>;
2744
4257
  updateBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName, metadata?: BranchMetadata): Promise<void>;
2745
4258
  getBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<BranchMetadata>;
2746
- getBranchMigrationHistory(workspace: WorkspaceID, database: DBName, branch: BranchName, options?: GetBranchMigrationHistoryRequestBody): Promise<GetBranchMigrationHistoryResponse>;
2747
- executeBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, migrationPlan: ExecuteBranchMigrationPlanRequestBody): Promise<void>;
2748
- getBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, schema: Schema): Promise<BranchMigrationPlan>;
2749
4259
  getBranchStats(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<GetBranchStatsResponse>;
2750
4260
  }
2751
4261
  declare class TableApi {
2752
4262
  private extraProps;
2753
4263
  constructor(extraProps: FetcherExtraProps);
2754
- createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
4264
+ createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<CreateTableResponse>;
2755
4265
  deleteTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
2756
4266
  updateTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, options: UpdateTableRequestBody): Promise<void>;
2757
4267
  getTableSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<GetTableSchemaResponse>;
@@ -2765,15 +4275,42 @@ declare class TableApi {
2765
4275
  declare class RecordsApi {
2766
4276
  private extraProps;
2767
4277
  constructor(extraProps: FetcherExtraProps);
2768
- insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>): Promise<InsertRecordResponse>;
4278
+ insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>, options?: InsertRecordQueryParams): Promise<RecordUpdateResponse>;
2769
4279
  insertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: InsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2770
4280
  updateRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpdateRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2771
4281
  upsertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2772
- deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID): Promise<void>;
2773
- getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordRequestBody): Promise<XataRecord$1>;
2774
- bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[]): Promise<BulkInsertTableRecordsResponse>;
4282
+ deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: DeleteRecordQueryParams): Promise<RecordUpdateResponse>;
4283
+ getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordQueryParams): Promise<XataRecord$1>;
4284
+ bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[], options?: BulkInsertTableRecordsQueryParams): Promise<BulkInsertResponse>;
2775
4285
  queryTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: QueryTableRequestBody): Promise<QueryResponse>;
4286
+ searchTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: SearchTableRequestBody): Promise<SearchResponse>;
2776
4287
  searchBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, query: SearchBranchRequestBody): Promise<SearchResponse>;
4288
+ summarizeTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: SummarizeTableRequestBody): Promise<SummarizeResponse>;
4289
+ }
4290
+ declare class MigrationRequestsApi {
4291
+ private extraProps;
4292
+ constructor(extraProps: FetcherExtraProps);
4293
+ listMigrationRequests(workspace: WorkspaceID, database: DBName, options?: ListMigrationRequestsRequestBody): Promise<ListMigrationRequestsResponse>;
4294
+ createMigrationRequest(workspace: WorkspaceID, database: DBName, options: CreateMigrationRequestRequestBody): Promise<CreateMigrationRequestResponse>;
4295
+ getMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<MigrationRequest>;
4296
+ updateMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number, options: UpdateMigrationRequestRequestBody): Promise<void>;
4297
+ listMigrationRequestsCommits(workspace: WorkspaceID, database: DBName, migrationRequest: number, options?: ListMigrationRequestsCommitsRequestBody): Promise<ListMigrationRequestsCommitsResponse>;
4298
+ compareMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<SchemaCompareResponse>;
4299
+ getMigrationRequestIsMerged(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<GetMigrationRequestIsMergedResponse>;
4300
+ mergeMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<Commit>;
4301
+ }
4302
+ declare class BranchSchemaApi {
4303
+ private extraProps;
4304
+ constructor(extraProps: FetcherExtraProps);
4305
+ getBranchMigrationHistory(workspace: WorkspaceID, database: DBName, branch: BranchName, options?: GetBranchMigrationHistoryRequestBody): Promise<GetBranchMigrationHistoryResponse>;
4306
+ executeBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, migrationPlan: ExecuteBranchMigrationPlanRequestBody): Promise<void>;
4307
+ getBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, schema: Schema): Promise<BranchMigrationPlan>;
4308
+ compareBranchWithUserSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, schema: Schema): Promise<SchemaCompareResponse>;
4309
+ compareBranchSchemas(workspace: WorkspaceID, database: DBName, branch: BranchName, branchName: BranchName, schema: Schema): Promise<SchemaCompareResponse>;
4310
+ updateBranchSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, migration: Migration): Promise<UpdateBranchSchemaResponse>;
4311
+ previewBranchSchemaEdit(workspace: WorkspaceID, database: DBName, branch: BranchName, migration: Migration): Promise<PreviewBranchSchemaEditResponse>;
4312
+ applyBranchSchemaEdit(workspace: WorkspaceID, database: DBName, branch: BranchName, edits: SchemaEditScript): Promise<ApplyBranchSchemaEditResponse>;
4313
+ getBranchSchemaHistory(workspace: WorkspaceID, database: DBName, branch: BranchName, options?: GetBranchSchemaHistoryRequestBody): Promise<GetBranchSchemaHistoryResponse>;
2777
4314
  }
2778
4315
 
2779
4316
  declare class XataApiPlugin implements XataPlugin {
@@ -2786,27 +4323,29 @@ declare type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) ex
2786
4323
  declare type If<Condition, Then, Else> = Condition extends true ? Then : Else;
2787
4324
  declare type IsObject<T> = T extends Record<string, any> ? true : false;
2788
4325
  declare type IsArray<T> = T extends Array<any> ? true : false;
2789
- declare type NonEmptyArray<T> = T[] & {
2790
- 0: T;
2791
- };
2792
4326
  declare type RequiredBy<T, K extends keyof T> = T & {
2793
4327
  [P in K]-?: NonNullable<T[P]>;
2794
4328
  };
2795
4329
  declare type GetArrayInnerType<T extends readonly any[]> = T[number];
2796
4330
  declare type SingleOrArray<T> = T | T[];
4331
+ declare type OmitBy<T, K extends keyof T> = T extends any ? Omit<T, K> : never;
4332
+ declare type Without<T, U> = {
4333
+ [P in Exclude<keyof T, keyof U>]?: never;
4334
+ };
4335
+ declare type ExclusiveOr<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
2797
4336
 
2798
4337
  declare type SelectableColumn<O, RecursivePath extends any[] = []> = '*' | 'id' | DataProps<O> | NestedColumns<O, RecursivePath>;
2799
- declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord & UnionToIntersection<Values<{
2800
- [K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord;
4338
+ declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord<O> & UnionToIntersection<Values<{
4339
+ [K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord<O>;
2801
4340
  }>>;
2802
- 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]> ? {
2803
- V: ValueAtColumn<O[K], V>;
2804
- } : never) : O[K]> : never : never;
4341
+ 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> ? {
4342
+ V: ValueAtColumn<Item, V>;
4343
+ } : never : O[K] : never> : never : never;
2805
4344
  declare type MAX_RECURSION = 5;
2806
4345
  declare type NestedColumns<O, RecursivePath extends any[]> = RecursivePath['length'] extends MAX_RECURSION ? never : If<IsObject<O>, Values<{
2807
- [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
2808
- 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
2809
- K>>;
4346
+ [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
4347
+ 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
4348
+ K>> : never;
2810
4349
  }>, never>;
2811
4350
  declare type DataProps<O> = Exclude<StringKeys<O>, StringKeys<XataRecord>>;
2812
4351
  declare type NestedValueAtColumn<O, Key extends SelectableColumn<O>> = Key extends `${infer N}.${infer M}` ? N extends DataProps<O> ? {
@@ -2833,56 +4372,67 @@ interface BaseData {
2833
4372
  /**
2834
4373
  * Represents a persisted record from the database.
2835
4374
  */
2836
- interface XataRecord extends Identifiable {
4375
+ interface XataRecord<OriginalRecord extends XataRecord<any> = XataRecord<any>> extends Identifiable {
2837
4376
  /**
2838
- * Metadata of this record.
4377
+ * Get metadata of this record.
2839
4378
  */
2840
- xata: {
2841
- /**
2842
- * Number that is increased every time the record is updated.
2843
- */
2844
- version: number;
2845
- };
4379
+ getMetadata(): XataRecordMetadata;
4380
+ /**
4381
+ * Retrieves a refreshed copy of the current record from the database.
4382
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
4383
+ * @returns The persisted record with the selected columns, null if not found.
4384
+ */
4385
+ read<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
2846
4386
  /**
2847
4387
  * Retrieves a refreshed copy of the current record from the database.
4388
+ * @returns The persisted record with all first level properties, null if not found.
4389
+ */
4390
+ read(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
4391
+ /**
4392
+ * Performs a partial update of the current record. On success a new object is
4393
+ * returned and the current object is not mutated.
4394
+ * @param partialUpdate The columns and their values that have to be updated.
4395
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
4396
+ * @returns The persisted record with the selected columns, null if not found.
2848
4397
  */
2849
- read(): Promise<Readonly<SelectedPick<this, ['*']>> | null>;
4398
+ update<K extends SelectableColumn<OriginalRecord>>(partialUpdate: Partial<EditableData<OriginalRecord>>, columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
2850
4399
  /**
2851
4400
  * Performs a partial update of the current record. On success a new object is
2852
4401
  * returned and the current object is not mutated.
2853
- * @param data The columns and their values that have to be updated.
2854
- * @returns A new record containing the latest values for all the columns of the current record.
4402
+ * @param partialUpdate The columns and their values that have to be updated.
4403
+ * @returns The persisted record with all first level properties, null if not found.
2855
4404
  */
2856
- update(partialUpdate: Partial<EditableData<Omit<this, keyof XataRecord>>>): Promise<Readonly<SelectedPick<this, ['*']>>>;
4405
+ update(partialUpdate: Partial<EditableData<OriginalRecord>>): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2857
4406
  /**
2858
4407
  * Performs a deletion of the current record in the database.
2859
- *
2860
- * @throws If the record was already deleted or if an error happened while performing the deletion.
4408
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
4409
+ * @returns The deleted record, null if not found.
2861
4410
  */
2862
- delete(): Promise<void>;
2863
- }
2864
- declare type Link<Record extends XataRecord> = Omit<XataRecord, 'read' | 'update'> & {
4411
+ delete<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
2865
4412
  /**
2866
- * Retrieves a refreshed copy of the current record from the database.
4413
+ * Performs a deletion of the current record in the database.
4414
+ * @returns The deleted record, null if not found.
4415
+
2867
4416
  */
2868
- read(): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4417
+ delete(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
4418
+ }
4419
+ declare type Link<Record extends XataRecord> = XataRecord<Record>;
4420
+ declare type XataRecordMetadata = {
2869
4421
  /**
2870
- * Performs a partial update of the current record. On success a new object is
2871
- * returned and the current object is not mutated.
2872
- * @param data The columns and their values that have to be updated.
2873
- * @returns A new record containing the latest values for all the columns of the current record.
4422
+ * Number that is increased every time the record is updated.
2874
4423
  */
2875
- update(partialUpdate: Partial<EditableData<Omit<Record, keyof XataRecord>>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4424
+ version: number;
4425
+ warnings?: string[];
2876
4426
  };
2877
4427
  declare function isIdentifiable(x: any): x is Identifiable & Record<string, unknown>;
2878
4428
  declare function isXataRecord(x: any): x is XataRecord & Record<string, unknown>;
2879
- declare type EditableData<O extends BaseData> = {
4429
+ declare type EditableData<O extends XataRecord> = Identifiable & Omit<{
2880
4430
  [K in keyof O]: O[K] extends XataRecord ? {
2881
4431
  id: string;
2882
- } : NonNullable<O[K]> extends XataRecord ? {
4432
+ } | string : NonNullable<O[K]> extends XataRecord ? {
2883
4433
  id: string;
2884
- } | null | undefined : O[K];
2885
- };
4434
+ } | string | null | undefined : O[K];
4435
+ }, keyof XataRecord>;
2886
4436
 
2887
4437
  /**
2888
4438
  * PropertyMatchFilter
@@ -2957,8 +4507,8 @@ declare type ValueTypeFilters<T> = T | T extends string ? StringTypeFilter : T e
2957
4507
  ],
2958
4508
  }
2959
4509
  */
2960
- declare type AggregatorFilter<Record> = {
2961
- [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<Record>>;
4510
+ declare type AggregatorFilter<T> = {
4511
+ [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<T>>;
2962
4512
  };
2963
4513
  /**
2964
4514
  * Existance filter
@@ -2973,10 +4523,88 @@ declare type BaseApiFilter<Record> = PropertyAccessFilter<Record> | AggregatorFi
2973
4523
  * Injects the Api filters on nested properties
2974
4524
  * Example: { filter: { settings: { plan: { $any: ['free', 'trial'] } } } }
2975
4525
  */
2976
- declare type NestedApiFilter<T> = T extends Record<string, any> ? {
4526
+ declare type NestedApiFilter<T> = {
2977
4527
  [key in keyof T]?: T[key] extends Record<string, any> ? SingleOrArray<Filter<T[key]>> : PropertyFilter<T[key]>;
2978
- } : PropertyFilter<T>;
2979
- declare type Filter<Record> = BaseApiFilter<Record> | NestedApiFilter<Record>;
4528
+ };
4529
+ 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>;
4530
+
4531
+ declare type DateBooster = {
4532
+ origin?: string;
4533
+ scale: string;
4534
+ decay: number;
4535
+ };
4536
+ declare type NumericBooster = {
4537
+ factor: number;
4538
+ };
4539
+ declare type ValueBooster<T extends string | number | boolean> = {
4540
+ value: T;
4541
+ factor: number;
4542
+ };
4543
+ declare type Boosters<O extends XataRecord> = Values<{
4544
+ [K in SelectableColumn<O>]: NonNullable<ValueAtColumn<O, K>> extends Date ? {
4545
+ dateBooster: {
4546
+ column: K;
4547
+ } & DateBooster;
4548
+ } : NonNullable<ValueAtColumn<O, K>> extends number ? ExclusiveOr<{
4549
+ numericBooster?: {
4550
+ column: K;
4551
+ } & NumericBooster;
4552
+ }, {
4553
+ valueBooster?: {
4554
+ column: K;
4555
+ } & ValueBooster<number>;
4556
+ }> : NonNullable<ValueAtColumn<O, K>> extends string | boolean ? {
4557
+ valueBooster: {
4558
+ column: K;
4559
+ } & ValueBooster<NonNullable<ValueAtColumn<O, K>>>;
4560
+ } : never;
4561
+ }>;
4562
+
4563
+ declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
4564
+ fuzziness?: FuzzinessExpression;
4565
+ prefix?: PrefixExpression;
4566
+ highlight?: HighlightExpression;
4567
+ tables?: Array<Tables | Values<{
4568
+ [Model in GetArrayInnerType<NonNullable<Tables[]>>]: {
4569
+ table: Model;
4570
+ filter?: Filter<SelectedPick<Schemas[Model] & XataRecord, ['*']>>;
4571
+ boosters?: Boosters<Schemas[Model] & XataRecord>[];
4572
+ };
4573
+ }>>;
4574
+ };
4575
+ declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
4576
+ all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
4577
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]: {
4578
+ table: Model;
4579
+ record: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>>;
4580
+ };
4581
+ }>[]>;
4582
+ byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
4583
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]?: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>[]>;
4584
+ }>;
4585
+ };
4586
+ declare class SearchPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin {
4587
+ #private;
4588
+ private db;
4589
+ constructor(db: SchemaPluginResult<Schemas>, schemaTables?: Schemas.Table[]);
4590
+ build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
4591
+ }
4592
+ declare type SearchXataRecord<Record extends XataRecord> = Omit<Record, 'getMetadata'> & {
4593
+ getMetadata: () => XataRecordMetadata & SearchExtraProperties;
4594
+ };
4595
+ declare type SearchExtraProperties = {
4596
+ table: string;
4597
+ highlight?: {
4598
+ [key: string]: string[] | {
4599
+ [key: string]: any;
4600
+ };
4601
+ };
4602
+ score?: number;
4603
+ };
4604
+ declare type ReturnTable<Table, Tables> = Table extends Tables ? Table : never;
4605
+ 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 {
4606
+ table: infer Table;
4607
+ } ? ReturnTable<Table, Tables> : never;
2980
4608
 
2981
4609
  declare type SortDirection = 'asc' | 'desc';
2982
4610
  declare type SortFilterExtended<T extends XataRecord> = {
@@ -2988,13 +4616,21 @@ declare type SortFilterBase<T extends XataRecord> = {
2988
4616
  [Key in StringKeys<T>]: SortDirection;
2989
4617
  };
2990
4618
 
2991
- declare type QueryOptions<T extends XataRecord> = {
2992
- pagination?: PaginationOptions;
2993
- columns?: NonEmptyArray<SelectableColumn<T>>;
4619
+ declare type BaseOptions<T extends XataRecord> = {
4620
+ columns?: SelectableColumn<T>[];
4621
+ cache?: number;
4622
+ };
4623
+ declare type CursorQueryOptions = {
4624
+ pagination?: CursorNavigationOptions & OffsetNavigationOptions;
4625
+ filter?: never;
4626
+ sort?: never;
4627
+ };
4628
+ declare type OffsetQueryOptions<T extends XataRecord> = {
4629
+ pagination?: OffsetNavigationOptions;
2994
4630
  filter?: FilterExpression;
2995
4631
  sort?: SortFilter<T> | SortFilter<T>[];
2996
- cache?: number;
2997
4632
  };
4633
+ declare type QueryOptions<T extends XataRecord> = BaseOptions<T> & (CursorQueryOptions | OffsetQueryOptions<T>);
2998
4634
  /**
2999
4635
  * Query objects contain the information of all filters, sorting, etc. to be included in the database query.
3000
4636
  *
@@ -3004,8 +4640,11 @@ declare type QueryOptions<T extends XataRecord> = {
3004
4640
  declare class Query<Record extends XataRecord, Result extends XataRecord = Record> implements Paginable<Record, Result> {
3005
4641
  #private;
3006
4642
  readonly meta: PaginationQueryMeta;
3007
- readonly records: Result[];
3008
- constructor(repository: Repository<Record> | null, table: string, data: Partial<QueryOptions<Record>>, parent?: Partial<QueryOptions<Record>>);
4643
+ readonly records: RecordArray<Result>;
4644
+ constructor(repository: Repository<Record> | null, table: {
4645
+ name: string;
4646
+ schema?: Table;
4647
+ }, data: Partial<QueryOptions<Record>>, rawParent?: Partial<QueryOptions<Record>>);
3009
4648
  getQueryOptions(): QueryOptions<Record>;
3010
4649
  key(): string;
3011
4650
  /**
@@ -3037,73 +4676,206 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3037
4676
  *
3038
4677
  * ```
3039
4678
  * query.filter("columnName", columnValue)
3040
- * query.filter({
3041
- * "columnName": columnValue
3042
- * })
4679
+ * query.filter("columnName", operator(columnValue)) // Use gt, gte, lt, lte, startsWith,...
4680
+ * ```
4681
+ *
4682
+ * @param column The name of the column to filter.
4683
+ * @param value The value to filter.
4684
+ * @returns A new Query object.
4685
+ */
4686
+ filter<F extends SelectableColumn<Record>>(column: F, value: Filter<NonNullable<ValueAtColumn<Record, F>>>): Query<Record, Result>;
4687
+ /**
4688
+ * Builds a new query object adding one or more constraints. Examples:
4689
+ *
4690
+ * ```
4691
+ * query.filter({ "columnName": columnValue })
3043
4692
  * query.filter({
3044
4693
  * "columnName": operator(columnValue) // Use gt, gte, lt, lte, startsWith,...
3045
4694
  * })
3046
4695
  * ```
3047
4696
  *
4697
+ * @param filters A filter object
3048
4698
  * @returns A new Query object.
3049
4699
  */
3050
- filter(filters: Filter<Record>): Query<Record, Result>;
3051
- filter<F extends SelectableColumn<Record>>(column: F, value: Filter<ValueAtColumn<Record, F>>): Query<Record, Result>;
4700
+ filter(filters?: Filter<Record>): Query<Record, Result>;
4701
+ cleanFilterConstraint<T>(column: string, value: T): string | T | {
4702
+ $includes: (T & string) | (T & string[]);
4703
+ };
3052
4704
  /**
3053
4705
  * Builds a new query with a new sort option.
3054
4706
  * @param column The column name.
3055
4707
  * @param direction The direction. Either ascending or descending.
3056
4708
  * @returns A new Query object.
3057
4709
  */
3058
- sort<F extends SelectableColumn<Record>>(column: F, direction: SortDirection): Query<Record, Result>;
4710
+ sort<F extends SelectableColumn<Record>>(column: F, direction?: SortDirection): Query<Record, Result>;
3059
4711
  /**
3060
4712
  * Builds a new query specifying the set of columns to be returned in the query response.
3061
4713
  * @param columns Array of column names to be returned by the query.
3062
4714
  * @returns A new Query object.
3063
4715
  */
3064
- select<K extends SelectableColumn<Record>>(columns: NonEmptyArray<K>): Query<Record, SelectedPick<Record, NonEmptyArray<K>>>;
4716
+ select<K extends SelectableColumn<Record>>(columns: K[]): Query<Record, SelectedPick<Record, K[]>>;
4717
+ /**
4718
+ * Get paginated results
4719
+ *
4720
+ * @returns A page of results
4721
+ */
3065
4722
  getPaginated(): Promise<Page<Record, Result>>;
3066
- getPaginated(options: Omit<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
4723
+ /**
4724
+ * Get paginated results
4725
+ *
4726
+ * @param options Pagination options
4727
+ * @returns A page of results
4728
+ */
4729
+ getPaginated(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
4730
+ /**
4731
+ * Get paginated results
4732
+ *
4733
+ * @param options Pagination options
4734
+ * @returns A page of results
4735
+ */
3067
4736
  getPaginated<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<Page<Record, SelectedPick<Record, typeof options['columns']>>>;
4737
+ /**
4738
+ * Get results in an iterator
4739
+ *
4740
+ * @async
4741
+ * @returns Async interable of results
4742
+ */
3068
4743
  [Symbol.asyncIterator](): AsyncIterableIterator<Result>;
3069
- getIterator(chunk: number): AsyncGenerator<Result[]>;
3070
- getIterator(chunk: number, options: Omit<QueryOptions<Record>, 'columns' | 'page'>): AsyncGenerator<Result[]>;
3071
- getIterator<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(chunk: number, options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
3072
4744
  /**
3073
- * Performs the query in the database and returns a set of results.
4745
+ * Build an iterator of results
4746
+ *
4747
+ * @returns Async generator of results array
4748
+ */
4749
+ getIterator(): AsyncGenerator<Result[]>;
4750
+ /**
4751
+ * Build an iterator of results
4752
+ *
4753
+ * @param options Pagination options with batchSize
4754
+ * @returns Async generator of results array
4755
+ */
4756
+ getIterator(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
4757
+ batchSize?: number;
4758
+ }): AsyncGenerator<Result[]>;
4759
+ /**
4760
+ * Build an iterator of results
4761
+ *
4762
+ * @param options Pagination options with batchSize
4763
+ * @returns Async generator of results array
4764
+ */
4765
+ getIterator<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
4766
+ batchSize?: number;
4767
+ }>(options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
4768
+ /**
4769
+ * Performs the query in the database and returns a set of results.
4770
+ * @returns An array of records from the database.
4771
+ */
4772
+ getMany(): Promise<RecordArray<Result>>;
4773
+ /**
4774
+ * Performs the query in the database and returns a set of results.
4775
+ * @param options Additional options to be used when performing the query.
4776
+ * @returns An array of records from the database.
4777
+ */
4778
+ getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<RecordArray<SelectedPick<Record, typeof options['columns']>>>;
4779
+ /**
4780
+ * Performs the query in the database and returns a set of results.
4781
+ * @param options Additional options to be used when performing the query.
4782
+ * @returns An array of records from the database.
4783
+ */
4784
+ getMany(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<RecordArray<Result>>;
4785
+ /**
4786
+ * Performs the query in the database and returns all the results.
4787
+ * Warning: If there are a large number of results, this method can have performance implications.
4788
+ * @returns An array of records from the database.
4789
+ */
4790
+ getAll(): Promise<Result[]>;
4791
+ /**
4792
+ * Performs the query in the database and returns all the results.
4793
+ * Warning: If there are a large number of results, this method can have performance implications.
4794
+ * @param options Additional options to be used when performing the query.
4795
+ * @returns An array of records from the database.
4796
+ */
4797
+ getAll<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
4798
+ batchSize?: number;
4799
+ }>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
4800
+ /**
4801
+ * Performs the query in the database and returns all the results.
4802
+ * Warning: If there are a large number of results, this method can have performance implications.
4803
+ * @param options Additional options to be used when performing the query.
4804
+ * @returns An array of records from the database.
4805
+ */
4806
+ getAll(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
4807
+ batchSize?: number;
4808
+ }): Promise<Result[]>;
4809
+ /**
4810
+ * Performs the query in the database and returns the first result.
4811
+ * @returns The first record that matches the query, or null if no record matched the query.
4812
+ */
4813
+ getFirst(): Promise<Result | null>;
4814
+ /**
4815
+ * Performs the query in the database and returns the first result.
4816
+ * @param options Additional options to be used when performing the query.
4817
+ * @returns The first record that matches the query, or null if no record matched the query.
4818
+ */
4819
+ getFirst<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
4820
+ /**
4821
+ * Performs the query in the database and returns the first result.
3074
4822
  * @param options Additional options to be used when performing the query.
3075
- * @returns An array of records from the database.
4823
+ * @returns The first record that matches the query, or null if no record matched the query.
3076
4824
  */
3077
- getMany(): Promise<Result[]>;
3078
- getMany(options: Omit<QueryOptions<Record>, 'columns'>): Promise<Result[]>;
3079
- getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
4825
+ getFirst(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result | null>;
3080
4826
  /**
3081
- * Performs the query in the database and returns all the results.
3082
- * Warning: If there are a large number of results, this method can have performance implications.
4827
+ * Performs the query in the database and returns the first result.
4828
+ * @returns The first record that matches the query, or null if no record matched the query.
4829
+ * @throws if there are no results.
4830
+ */
4831
+ getFirstOrThrow(): Promise<Result>;
4832
+ /**
4833
+ * Performs the query in the database and returns the first result.
3083
4834
  * @param options Additional options to be used when performing the query.
3084
- * @returns An array of records from the database.
4835
+ * @returns The first record that matches the query, or null if no record matched the query.
4836
+ * @throws if there are no results.
3085
4837
  */
3086
- getAll(chunk?: number): Promise<Result[]>;
3087
- getAll(chunk: number | undefined, options: Omit<QueryOptions<Record>, 'columns' | 'page'>): Promise<Result[]>;
3088
- getAll<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(chunk: number | undefined, options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
4838
+ getFirstOrThrow<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>>;
3089
4839
  /**
3090
4840
  * Performs the query in the database and returns the first result.
3091
4841
  * @param options Additional options to be used when performing the query.
3092
4842
  * @returns The first record that matches the query, or null if no record matched the query.
4843
+ * @throws if there are no results.
3093
4844
  */
3094
- getFirst(): Promise<Result | null>;
3095
- getFirst(options: Omit<QueryOptions<Record>, 'columns' | 'page'>): Promise<Result | null>;
3096
- getFirst<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
4845
+ getFirstOrThrow(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result>;
3097
4846
  /**
3098
4847
  * Builds a new query object adding a cache TTL in milliseconds.
3099
4848
  * @param ttl The cache TTL in milliseconds.
3100
4849
  * @returns A new Query object.
3101
4850
  */
3102
4851
  cache(ttl: number): Query<Record, Result>;
4852
+ /**
4853
+ * Retrieve next page of records
4854
+ *
4855
+ * @returns A new page object.
4856
+ */
3103
4857
  nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4858
+ /**
4859
+ * Retrieve previous page of records
4860
+ *
4861
+ * @returns A new page object
4862
+ */
3104
4863
  previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4864
+ /**
4865
+ * Retrieve first page of records
4866
+ *
4867
+ * @returns A new page object
4868
+ */
3105
4869
  firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4870
+ /**
4871
+ * Retrieve last page of records
4872
+ *
4873
+ * @returns A new page object
4874
+ */
3106
4875
  lastPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4876
+ /**
4877
+ * @returns Boolean indicating if there is a next page
4878
+ */
3107
4879
  hasNextPage(): boolean;
3108
4880
  }
3109
4881
 
@@ -3115,7 +4887,7 @@ declare type PaginationQueryMeta = {
3115
4887
  };
3116
4888
  interface Paginable<Record extends XataRecord, Result extends XataRecord = Record> {
3117
4889
  meta: PaginationQueryMeta;
3118
- records: Result[];
4890
+ records: RecordArray<Result>;
3119
4891
  nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
3120
4892
  previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
3121
4893
  firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
@@ -3135,7 +4907,7 @@ declare class Page<Record extends XataRecord, Result extends XataRecord = Record
3135
4907
  /**
3136
4908
  * The set of results for this page.
3137
4909
  */
3138
- readonly records: Result[];
4910
+ readonly records: RecordArray<Result>;
3139
4911
  constructor(query: Query<Record, Result>, meta: PaginationQueryMeta, records?: Result[]);
3140
4912
  /**
3141
4913
  * Retrieves the next page of results.
@@ -3183,62 +4955,305 @@ declare type OffsetNavigationOptions = {
3183
4955
  size?: number;
3184
4956
  offset?: number;
3185
4957
  };
3186
- declare type PaginationOptions = CursorNavigationOptions & OffsetNavigationOptions;
3187
4958
  declare const PAGINATION_MAX_SIZE = 200;
3188
- declare const PAGINATION_DEFAULT_SIZE = 200;
4959
+ declare const PAGINATION_DEFAULT_SIZE = 20;
3189
4960
  declare const PAGINATION_MAX_OFFSET = 800;
3190
4961
  declare const PAGINATION_DEFAULT_OFFSET = 0;
4962
+ declare function isCursorPaginationOptions(options: Record<string, unknown> | undefined | null): options is CursorNavigationOptions;
4963
+ declare class RecordArray<Result extends XataRecord> extends Array<Result> {
4964
+ #private;
4965
+ constructor(page: Paginable<any, Result>, overrideRecords?: Result[]);
4966
+ static parseConstructorParams(...args: any[]): any[];
4967
+ toArray(): Result[];
4968
+ map<U>(callbackfn: (value: Result, index: number, array: Result[]) => U, thisArg?: any): U[];
4969
+ /**
4970
+ * Retrieve next page of records
4971
+ *
4972
+ * @returns A new array of objects
4973
+ */
4974
+ nextPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4975
+ /**
4976
+ * Retrieve previous page of records
4977
+ *
4978
+ * @returns A new array of objects
4979
+ */
4980
+ previousPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4981
+ /**
4982
+ * Retrieve first page of records
4983
+ *
4984
+ * @returns A new array of objects
4985
+ */
4986
+ firstPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4987
+ /**
4988
+ * Retrieve last page of records
4989
+ *
4990
+ * @returns A new array of objects
4991
+ */
4992
+ lastPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4993
+ /**
4994
+ * @returns Boolean indicating if there is a next page
4995
+ */
4996
+ hasNextPage(): boolean;
4997
+ }
3191
4998
 
3192
4999
  /**
3193
5000
  * Common interface for performing operations on a table.
3194
5001
  */
3195
- declare abstract class Repository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
3196
- abstract create(object: EditableData<Data> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5002
+ declare abstract class Repository<Record extends XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
5003
+ abstract create<K extends SelectableColumn<Record>>(object: Omit<EditableData<Record>, 'id'> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5004
+ abstract create(object: Omit<EditableData<Record>, 'id'> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5005
+ /**
5006
+ * Creates a single record in the table with a unique id.
5007
+ * @param id The unique id.
5008
+ * @param object Object containing the column names with their values to be stored in the table.
5009
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5010
+ * @returns The full persisted record.
5011
+ */
5012
+ abstract create<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3197
5013
  /**
3198
5014
  * Creates a single record in the table with a unique id.
3199
5015
  * @param id The unique id.
3200
5016
  * @param object Object containing the column names with their values to be stored in the table.
3201
5017
  * @returns The full persisted record.
3202
5018
  */
3203
- abstract create(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5019
+ abstract create(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3204
5020
  /**
3205
5021
  * Creates multiple records in the table.
3206
5022
  * @param objects Array of objects with the column names and the values to be stored in the table.
3207
- * @returns Array of the persisted records.
5023
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5024
+ * @returns Array of the persisted records in order.
5025
+ */
5026
+ abstract create<K extends SelectableColumn<Record>>(objects: Array<Omit<EditableData<Record>, 'id'> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
5027
+ /**
5028
+ * Creates multiple records in the table.
5029
+ * @param objects Array of objects with the column names and the values to be stored in the table.
5030
+ * @returns Array of the persisted records in order.
3208
5031
  */
3209
- abstract create(objects: Array<EditableData<Data> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
5032
+ abstract create(objects: Array<Omit<EditableData<Record>, 'id'> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
5033
+ /**
5034
+ * Queries a single record from the table given its unique id.
5035
+ * @param id The unique id.
5036
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5037
+ * @returns The persisted record for the given id or null if the record could not be found.
5038
+ */
5039
+ abstract read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
3210
5040
  /**
3211
5041
  * Queries a single record from the table given its unique id.
3212
5042
  * @param id The unique id.
3213
5043
  * @returns The persisted record for the given id or null if the record could not be found.
3214
5044
  */
3215
5045
  abstract read(id: string): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
5046
+ /**
5047
+ * Queries multiple records from the table given their unique id.
5048
+ * @param ids The unique ids array.
5049
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5050
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
5051
+ */
5052
+ abstract read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
5053
+ /**
5054
+ * Queries multiple records from the table given their unique id.
5055
+ * @param ids The unique ids array.
5056
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
5057
+ */
5058
+ abstract read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
5059
+ /**
5060
+ * Queries a single record from the table by the id in the object.
5061
+ * @param object Object containing the id of the record.
5062
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5063
+ * @returns The persisted record for the given id or null if the record could not be found.
5064
+ */
5065
+ abstract read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
5066
+ /**
5067
+ * Queries a single record from the table by the id in the object.
5068
+ * @param object Object containing the id of the record.
5069
+ * @returns The persisted record for the given id or null if the record could not be found.
5070
+ */
5071
+ abstract read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
5072
+ /**
5073
+ * Queries multiple records from the table by the ids in the objects.
5074
+ * @param objects Array of objects containing the ids of the records.
5075
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5076
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
5077
+ */
5078
+ abstract read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
5079
+ /**
5080
+ * Queries multiple records from the table by the ids in the objects.
5081
+ * @param objects Array of objects containing the ids of the records.
5082
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
5083
+ */
5084
+ abstract read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
5085
+ /**
5086
+ * Queries a single record from the table given its unique id.
5087
+ * @param id The unique id.
5088
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5089
+ * @returns The persisted record for the given id.
5090
+ * @throws If the record could not be found.
5091
+ */
5092
+ abstract readOrThrow<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5093
+ /**
5094
+ * Queries a single record from the table given its unique id.
5095
+ * @param id The unique id.
5096
+ * @returns The persisted record for the given id.
5097
+ * @throws If the record could not be found.
5098
+ */
5099
+ abstract readOrThrow(id: string): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5100
+ /**
5101
+ * Queries multiple records from the table given their unique id.
5102
+ * @param ids The unique ids array.
5103
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5104
+ * @returns The persisted records for the given ids in order.
5105
+ * @throws If one or more records could not be found.
5106
+ */
5107
+ abstract readOrThrow<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
5108
+ /**
5109
+ * Queries multiple records from the table given their unique id.
5110
+ * @param ids The unique ids array.
5111
+ * @returns The persisted records for the given ids in order.
5112
+ * @throws If one or more records could not be found.
5113
+ */
5114
+ abstract readOrThrow(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
5115
+ /**
5116
+ * Queries a single record from the table by the id in the object.
5117
+ * @param object Object containing the id of the record.
5118
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5119
+ * @returns The persisted record for the given id.
5120
+ * @throws If the record could not be found.
5121
+ */
5122
+ abstract readOrThrow<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5123
+ /**
5124
+ * Queries a single record from the table by the id in the object.
5125
+ * @param object Object containing the id of the record.
5126
+ * @returns The persisted record for the given id.
5127
+ * @throws If the record could not be found.
5128
+ */
5129
+ abstract readOrThrow(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5130
+ /**
5131
+ * Queries multiple records from the table by the ids in the objects.
5132
+ * @param objects Array of objects containing the ids of the records.
5133
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5134
+ * @returns The persisted records for the given ids in order.
5135
+ * @throws If one or more records could not be found.
5136
+ */
5137
+ abstract readOrThrow<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
5138
+ /**
5139
+ * Queries multiple records from the table by the ids in the objects.
5140
+ * @param objects Array of objects containing the ids of the records.
5141
+ * @returns The persisted records for the given ids in order.
5142
+ * @throws If one or more records could not be found.
5143
+ */
5144
+ abstract readOrThrow(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
5145
+ /**
5146
+ * Partially update a single record.
5147
+ * @param object An object with its id and the columns to be updated.
5148
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5149
+ * @returns The full persisted record, null if the record could not be found.
5150
+ */
5151
+ abstract update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
5152
+ /**
5153
+ * Partially update a single record.
5154
+ * @param object An object with its id and the columns to be updated.
5155
+ * @returns The full persisted record, null if the record could not be found.
5156
+ */
5157
+ abstract update(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
5158
+ /**
5159
+ * Partially update a single record given its unique id.
5160
+ * @param id The unique id.
5161
+ * @param object The column names and their values that have to be updated.
5162
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5163
+ * @returns The full persisted record, null if the record could not be found.
5164
+ */
5165
+ abstract update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
5166
+ /**
5167
+ * Partially update a single record given its unique id.
5168
+ * @param id The unique id.
5169
+ * @param object The column names and their values that have to be updated.
5170
+ * @returns The full persisted record, null if the record could not be found.
5171
+ */
5172
+ abstract update(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
5173
+ /**
5174
+ * Partially updates multiple records.
5175
+ * @param objects An array of objects with their ids and columns to be updated.
5176
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5177
+ * @returns Array of the persisted records in order (if a record could not be found null is returned).
5178
+ */
5179
+ abstract update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
5180
+ /**
5181
+ * Partially updates multiple records.
5182
+ * @param objects An array of objects with their ids and columns to be updated.
5183
+ * @returns Array of the persisted records in order (if a record could not be found null is returned).
5184
+ */
5185
+ abstract update(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
5186
+ /**
5187
+ * Partially update a single record.
5188
+ * @param object An object with its id and the columns to be updated.
5189
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5190
+ * @returns The full persisted record.
5191
+ * @throws If the record could not be found.
5192
+ */
5193
+ abstract updateOrThrow<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3216
5194
  /**
3217
5195
  * Partially update a single record.
3218
5196
  * @param object An object with its id and the columns to be updated.
3219
5197
  * @returns The full persisted record.
5198
+ * @throws If the record could not be found.
5199
+ */
5200
+ abstract updateOrThrow(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5201
+ /**
5202
+ * Partially update a single record given its unique id.
5203
+ * @param id The unique id.
5204
+ * @param object The column names and their values that have to be updated.
5205
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5206
+ * @returns The full persisted record.
5207
+ * @throws If the record could not be found.
3220
5208
  */
3221
- abstract update(object: Partial<EditableData<Data>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5209
+ abstract updateOrThrow<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3222
5210
  /**
3223
5211
  * Partially update a single record given its unique id.
3224
5212
  * @param id The unique id.
3225
5213
  * @param object The column names and their values that have to be updated.
3226
5214
  * @returns The full persisted record.
5215
+ * @throws If the record could not be found.
3227
5216
  */
3228
- abstract update(id: string, object: Partial<EditableData<Data>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5217
+ abstract updateOrThrow(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3229
5218
  /**
3230
5219
  * Partially updates multiple records.
3231
5220
  * @param objects An array of objects with their ids and columns to be updated.
3232
- * @returns Array of the persisted records.
5221
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5222
+ * @returns Array of the persisted records in order.
5223
+ * @throws If one or more records could not be found.
5224
+ */
5225
+ abstract updateOrThrow<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
5226
+ /**
5227
+ * Partially updates multiple records.
5228
+ * @param objects An array of objects with their ids and columns to be updated.
5229
+ * @returns Array of the persisted records in order.
5230
+ * @throws If one or more records could not be found.
5231
+ */
5232
+ abstract updateOrThrow(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
5233
+ /**
5234
+ * Creates or updates a single record. If a record exists with the given id,
5235
+ * it will be update, otherwise a new record will be created.
5236
+ * @param object Object containing the column names with their values to be persisted in the table.
5237
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5238
+ * @returns The full persisted record.
3233
5239
  */
3234
- abstract update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
5240
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Record> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3235
5241
  /**
3236
5242
  * Creates or updates a single record. If a record exists with the given id,
3237
5243
  * it will be update, otherwise a new record will be created.
3238
5244
  * @param object Object containing the column names with their values to be persisted in the table.
3239
5245
  * @returns The full persisted record.
3240
5246
  */
3241
- abstract createOrUpdate(object: EditableData<Data> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5247
+ abstract createOrUpdate(object: EditableData<Record> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5248
+ /**
5249
+ * Creates or updates a single record. If a record exists with the given id,
5250
+ * it will be update, otherwise a new record will be created.
5251
+ * @param id A unique id.
5252
+ * @param object The column names and the values to be persisted.
5253
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5254
+ * @returns The full persisted record.
5255
+ */
5256
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3242
5257
  /**
3243
5258
  * Creates or updates a single record. If a record exists with the given id,
3244
5259
  * it will be update, otherwise a new record will be created.
@@ -3246,38 +5261,134 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3246
5261
  * @param object The column names and the values to be persisted.
3247
5262
  * @returns The full persisted record.
3248
5263
  */
3249
- abstract createOrUpdate(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5264
+ abstract createOrUpdate(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5265
+ /**
5266
+ * Creates or updates a single record. If a record exists with the given id,
5267
+ * it will be update, otherwise a new record will be created.
5268
+ * @param objects Array of objects with the column names and the values to be stored in the table.
5269
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5270
+ * @returns Array of the persisted records.
5271
+ */
5272
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3250
5273
  /**
3251
5274
  * Creates or updates a single record. If a record exists with the given id,
3252
5275
  * it will be update, otherwise a new record will be created.
3253
5276
  * @param objects Array of objects with the column names and the values to be stored in the table.
3254
5277
  * @returns Array of the persisted records.
3255
5278
  */
3256
- abstract createOrUpdate(objects: Array<EditableData<Data> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
5279
+ abstract createOrUpdate(objects: Array<EditableData<Record> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3257
5280
  /**
3258
5281
  * Deletes a record given its unique id.
5282
+ * @param object An object with a unique id.
5283
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5284
+ * @returns The deleted record, null if the record could not be found.
5285
+ */
5286
+ abstract delete<K extends SelectableColumn<Record>>(object: Identifiable & Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
5287
+ /**
5288
+ * Deletes a record given its unique id.
5289
+ * @param object An object with a unique id.
5290
+ * @returns The deleted record, null if the record could not be found.
5291
+ */
5292
+ abstract delete(object: Identifiable & Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
5293
+ /**
5294
+ * Deletes a record given a unique id.
5295
+ * @param id The unique id.
5296
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5297
+ * @returns The deleted record, null if the record could not be found.
5298
+ */
5299
+ abstract delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
5300
+ /**
5301
+ * Deletes a record given a unique id.
3259
5302
  * @param id The unique id.
3260
- * @throws If the record could not be found or there was an error while performing the deletion.
5303
+ * @returns The deleted record, null if the record could not be found.
5304
+ */
5305
+ abstract delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
5306
+ /**
5307
+ * Deletes multiple records given an array of objects with ids.
5308
+ * @param objects An array of objects with unique ids.
5309
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5310
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
5311
+ */
5312
+ abstract delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
5313
+ /**
5314
+ * Deletes multiple records given an array of objects with ids.
5315
+ * @param objects An array of objects with unique ids.
5316
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
3261
5317
  */
3262
- abstract delete(id: string): Promise<void>;
5318
+ abstract delete(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
5319
+ /**
5320
+ * Deletes multiple records given an array of unique ids.
5321
+ * @param objects An array of ids.
5322
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5323
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
5324
+ */
5325
+ abstract delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
5326
+ /**
5327
+ * Deletes multiple records given an array of unique ids.
5328
+ * @param objects An array of ids.
5329
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
5330
+ */
5331
+ abstract delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3263
5332
  /**
3264
5333
  * Deletes a record given its unique id.
3265
- * @param id An object with a unique id.
3266
- * @throws If the record could not be found or there was an error while performing the deletion.
5334
+ * @param object An object with a unique id.
5335
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5336
+ * @returns The deleted record, null if the record could not be found.
5337
+ * @throws If the record could not be found.
5338
+ */
5339
+ abstract deleteOrThrow<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5340
+ /**
5341
+ * Deletes a record given its unique id.
5342
+ * @param object An object with a unique id.
5343
+ * @returns The deleted record, null if the record could not be found.
5344
+ * @throws If the record could not be found.
5345
+ */
5346
+ abstract deleteOrThrow(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5347
+ /**
5348
+ * Deletes a record given a unique id.
5349
+ * @param id The unique id.
5350
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5351
+ * @returns The deleted record, null if the record could not be found.
5352
+ * @throws If the record could not be found.
5353
+ */
5354
+ abstract deleteOrThrow<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5355
+ /**
5356
+ * Deletes a record given a unique id.
5357
+ * @param id The unique id.
5358
+ * @returns The deleted record, null if the record could not be found.
5359
+ * @throws If the record could not be found.
5360
+ */
5361
+ abstract deleteOrThrow(id: string): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5362
+ /**
5363
+ * Deletes multiple records given an array of objects with ids.
5364
+ * @param objects An array of objects with unique ids.
5365
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5366
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
5367
+ * @throws If one or more records could not be found.
5368
+ */
5369
+ abstract deleteOrThrow<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
5370
+ /**
5371
+ * Deletes multiple records given an array of objects with ids.
5372
+ * @param objects An array of objects with unique ids.
5373
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
5374
+ * @throws If one or more records could not be found.
3267
5375
  */
3268
- abstract delete(id: Identifiable): Promise<void>;
5376
+ abstract deleteOrThrow(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3269
5377
  /**
3270
- * Deletes a record given a list of unique ids.
3271
- * @param ids The array of unique ids.
3272
- * @throws If the record could not be found or there was an error while performing the deletion.
5378
+ * Deletes multiple records given an array of unique ids.
5379
+ * @param objects An array of ids.
5380
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5381
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
5382
+ * @throws If one or more records could not be found.
3273
5383
  */
3274
- abstract delete(ids: string[]): Promise<void>;
5384
+ abstract deleteOrThrow<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
3275
5385
  /**
3276
- * Deletes a record given a list of unique ids.
3277
- * @param ids An array of objects with unique ids.
3278
- * @throws If the record could not be found or there was an error while performing the deletion.
5386
+ * Deletes multiple records given an array of unique ids.
5387
+ * @param objects An array of ids.
5388
+ * @returns Array of the deleted records in order.
5389
+ * @throws If one or more records could not be found.
3279
5390
  */
3280
- abstract delete(ids: Identifiable[]): Promise<void>;
5391
+ abstract deleteOrThrow(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3281
5392
  /**
3282
5393
  * Search for records in the table.
3283
5394
  * @param query The query to search for.
@@ -3285,35 +5396,152 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3285
5396
  * @returns The found records.
3286
5397
  */
3287
5398
  abstract search(query: string, options?: {
3288
- fuzziness?: number;
3289
- }): Promise<SelectedPick<Record, ['*']>[]>;
5399
+ fuzziness?: FuzzinessExpression;
5400
+ prefix?: PrefixExpression;
5401
+ highlight?: HighlightExpression;
5402
+ filter?: Filter<Record>;
5403
+ boosters?: Boosters<Record>[];
5404
+ }): Promise<SearchXataRecord<SelectedPick<Record, ['*']>>[]>;
3290
5405
  abstract query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3291
5406
  }
3292
- declare class RestRepository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Data, Record> {
5407
+ declare class RestRepository<Record extends XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Record> {
3293
5408
  #private;
3294
- db: SchemaPluginResult<any>;
3295
5409
  constructor(options: {
3296
5410
  table: string;
3297
5411
  db: SchemaPluginResult<any>;
3298
5412
  pluginOptions: XataPluginOptions;
5413
+ schemaTables?: Table[];
3299
5414
  });
3300
- create(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3301
- create(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3302
- create(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3303
- read(recordId: string): Promise<SelectedPick<Record, ['*']> | null>;
3304
- update(object: Partial<EditableData<Data>> & Identifiable): Promise<SelectedPick<Record, ['*']>>;
3305
- update(recordId: string, object: Partial<EditableData<Data>>): Promise<SelectedPick<Record, ['*']>>;
3306
- update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<SelectedPick<Record, ['*']>[]>;
3307
- createOrUpdate(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3308
- createOrUpdate(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3309
- createOrUpdate(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3310
- delete(a: string | Identifiable | Array<string | Identifiable>): Promise<void>;
5415
+ create<K extends SelectableColumn<Record>>(object: EditableData<Record> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5416
+ create(object: EditableData<Record> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5417
+ create<K extends SelectableColumn<Record>>(id: string, object: EditableData<Record>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5418
+ create(id: string, object: EditableData<Record>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5419
+ create<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
5420
+ create(objects: Array<EditableData<Record> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
5421
+ read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
5422
+ read(id: string): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
5423
+ read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
5424
+ read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
5425
+ read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
5426
+ read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
5427
+ read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
5428
+ read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
5429
+ readOrThrow<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5430
+ readOrThrow(id: string): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5431
+ readOrThrow<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
5432
+ readOrThrow(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
5433
+ readOrThrow<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5434
+ readOrThrow(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5435
+ readOrThrow<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
5436
+ readOrThrow(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
5437
+ update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
5438
+ update(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
5439
+ update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
5440
+ update(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
5441
+ update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
5442
+ update(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
5443
+ updateOrThrow<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5444
+ updateOrThrow(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5445
+ updateOrThrow<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5446
+ updateOrThrow(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5447
+ updateOrThrow<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
5448
+ updateOrThrow(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
5449
+ createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Record> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5450
+ createOrUpdate(object: EditableData<Record> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5451
+ createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5452
+ createOrUpdate(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5453
+ createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
5454
+ createOrUpdate(objects: Array<EditableData<Record> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
5455
+ delete<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
5456
+ delete(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
5457
+ delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
5458
+ delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
5459
+ delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
5460
+ delete(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
5461
+ delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
5462
+ delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
5463
+ deleteOrThrow<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5464
+ deleteOrThrow(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5465
+ deleteOrThrow<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5466
+ deleteOrThrow(id: string): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5467
+ deleteOrThrow<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
5468
+ deleteOrThrow(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
5469
+ deleteOrThrow<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
5470
+ deleteOrThrow(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3311
5471
  search(query: string, options?: {
3312
- fuzziness?: number;
3313
- }): Promise<SelectedPick<Record, ['*']>[]>;
5472
+ fuzziness?: FuzzinessExpression;
5473
+ prefix?: PrefixExpression;
5474
+ highlight?: HighlightExpression;
5475
+ filter?: Filter<Record>;
5476
+ boosters?: Boosters<Record>[];
5477
+ }): Promise<any>;
3314
5478
  query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3315
5479
  }
3316
5480
 
5481
+ declare type BaseSchema = {
5482
+ name: string;
5483
+ columns: readonly ({
5484
+ name: string;
5485
+ type: Column['type'];
5486
+ notNull?: boolean;
5487
+ } | {
5488
+ name: string;
5489
+ type: 'link';
5490
+ link: {
5491
+ table: string;
5492
+ };
5493
+ } | {
5494
+ name: string;
5495
+ type: 'object';
5496
+ columns: {
5497
+ name: string;
5498
+ type: string;
5499
+ }[];
5500
+ })[];
5501
+ };
5502
+ declare type SchemaInference<T extends readonly BaseSchema[]> = T extends never[] ? Record<string, Record<string, any>> : T extends readonly unknown[] ? T[number] extends {
5503
+ name: string;
5504
+ columns: readonly unknown[];
5505
+ } ? {
5506
+ [K in T[number]['name']]: TableType<T[number], K>;
5507
+ } : never : never;
5508
+ declare type TableType<Tables, TableName> = Tables & {
5509
+ name: TableName;
5510
+ } extends infer Table ? Table extends {
5511
+ name: string;
5512
+ columns: infer Columns;
5513
+ } ? Columns extends readonly unknown[] ? Columns[number] extends {
5514
+ name: string;
5515
+ type: string;
5516
+ } ? Identifiable & UnionToIntersection<Values<{
5517
+ [K in Columns[number]['name']]: PropertyType<Tables, Columns[number], K>;
5518
+ }>> : never : never : never : never;
5519
+ declare type PropertyType<Tables, Properties, PropertyName extends PropertyKey> = Properties & {
5520
+ name: PropertyName;
5521
+ } extends infer Property ? Property extends {
5522
+ name: string;
5523
+ type: infer Type;
5524
+ link?: {
5525
+ table: infer LinkedTable;
5526
+ };
5527
+ columns?: infer ObjectColumns;
5528
+ notNull?: infer NotNull;
5529
+ } ? NotNull extends true ? {
5530
+ [K in PropertyName]: InnerType<Type, ObjectColumns, Tables, LinkedTable>;
5531
+ } : {
5532
+ [K in PropertyName]?: InnerType<Type, ObjectColumns, Tables, LinkedTable> | null;
5533
+ } : never : never;
5534
+ declare type InnerType<Type, ObjectColumns, Tables, LinkedTable> = Type extends 'string' | 'text' | 'email' ? string : Type extends 'int' | 'float' ? number : Type extends 'bool' ? boolean : Type extends 'datetime' ? Date : Type extends 'multiple' ? string[] : Type extends 'object' ? ObjectColumns extends readonly unknown[] ? ObjectColumns[number] extends {
5535
+ name: string;
5536
+ type: string;
5537
+ } ? UnionToIntersection<Values<{
5538
+ [K in ObjectColumns[number]['name']]: PropertyType<Tables, ObjectColumns[number], K>;
5539
+ }>> : never : never : Type extends 'link' ? TableType<Tables, LinkedTable> & XataRecord : never;
5540
+
5541
+ /**
5542
+ * Operator to restrict results to only values that are greater than the given value.
5543
+ */
5544
+ declare const greaterThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3317
5545
  /**
3318
5546
  * Operator to restrict results to only values that are greater than the given value.
3319
5547
  */
@@ -3321,15 +5549,35 @@ declare const gt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T
3321
5549
  /**
3322
5550
  * Operator to restrict results to only values that are greater than or equal to the given value.
3323
5551
  */
3324
- declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
5552
+ declare const greaterThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
5553
+ /**
5554
+ * Operator to restrict results to only values that are greater than or equal to the given value.
5555
+ */
5556
+ declare const greaterEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3325
5557
  /**
3326
5558
  * Operator to restrict results to only values that are greater than or equal to the given value.
3327
5559
  */
3328
5560
  declare const gte: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
5561
+ /**
5562
+ * Operator to restrict results to only values that are greater than or equal to the given value.
5563
+ */
5564
+ declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
5565
+ /**
5566
+ * Operator to restrict results to only values that are lower than the given value.
5567
+ */
5568
+ declare const lessThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3329
5569
  /**
3330
5570
  * Operator to restrict results to only values that are lower than the given value.
3331
5571
  */
3332
5572
  declare const lt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
5573
+ /**
5574
+ * Operator to restrict results to only values that are lower than or equal to the given value.
5575
+ */
5576
+ declare const lessThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
5577
+ /**
5578
+ * Operator to restrict results to only values that are lower than or equal to the given value.
5579
+ */
5580
+ declare const lessEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3333
5581
  /**
3334
5582
  * Operator to restrict results to only values that are lower than or equal to the given value.
3335
5583
  */
@@ -3362,6 +5610,10 @@ declare const pattern: (value: string) => StringTypeFilter;
3362
5610
  * Operator to restrict results to only values that are equal to the given value.
3363
5611
  */
3364
5612
  declare const is: <T>(value: T) => PropertyFilter<T>;
5613
+ /**
5614
+ * Operator to restrict results to only values that are equal to the given value.
5615
+ */
5616
+ declare const equals: <T>(value: T) => PropertyFilter<T>;
3365
5617
  /**
3366
5618
  * Operator to restrict results to only values that are not equal to the given value.
3367
5619
  */
@@ -3390,45 +5642,15 @@ declare const includesAny: <T>(value: T) => ArrayFilter<T>;
3390
5642
  declare type SchemaDefinition = {
3391
5643
  table: string;
3392
5644
  };
3393
- declare type SchemaPluginResult<Schemas extends Record<string, BaseData>> = {
5645
+ declare type SchemaPluginResult<Schemas extends Record<string, XataRecord>> = {
3394
5646
  [Key in keyof Schemas]: Repository<Schemas[Key]>;
3395
- } & {
3396
- [key: string]: Repository<XataRecord$1>;
3397
5647
  };
3398
- declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
5648
+ declare class SchemaPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin {
3399
5649
  #private;
3400
- private tableNames?;
3401
- constructor(tableNames?: string[] | undefined);
5650
+ constructor(schemaTables?: Schemas.Table[]);
3402
5651
  build(pluginOptions: XataPluginOptions): SchemaPluginResult<Schemas>;
3403
5652
  }
3404
5653
 
3405
- declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3406
- fuzziness?: number;
3407
- tables?: Tables[];
3408
- };
3409
- declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3410
- all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3411
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]: {
3412
- table: Model;
3413
- record: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>>;
3414
- };
3415
- }>[]>;
3416
- byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3417
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]?: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>[]>;
3418
- }>;
3419
- };
3420
- declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
3421
- #private;
3422
- private db;
3423
- constructor(db: SchemaPluginResult<Schemas>);
3424
- build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
3425
- }
3426
- declare type SearchXataRecord = XataRecord & {
3427
- xata: {
3428
- table: string;
3429
- };
3430
- };
3431
-
3432
5654
  declare type BranchStrategyValue = string | undefined | null;
3433
5655
  declare type BranchStrategyBuilder = () => BranchStrategyValue | Promise<BranchStrategyValue>;
3434
5656
  declare type BranchStrategy = BranchStrategyValue | BranchStrategyBuilder;
@@ -3440,20 +5662,35 @@ declare type BaseClientOptions = {
3440
5662
  databaseURL?: string;
3441
5663
  branch?: BranchStrategyOption;
3442
5664
  cache?: CacheImpl;
5665
+ trace?: TraceFunction;
3443
5666
  };
3444
5667
  declare const buildClient: <Plugins extends Record<string, XataPlugin> = {}>(plugins?: Plugins | undefined) => ClientConstructor<Plugins>;
3445
5668
  interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
3446
- new <Schemas extends Record<string, BaseData> = {}>(options?: Partial<BaseClientOptions>, tables?: string[]): Omit<{
5669
+ new <Schemas extends Record<string, XataRecord> = {}>(options?: Partial<BaseClientOptions>, schemaTables?: readonly BaseSchema[]): Omit<{
3447
5670
  db: Awaited<ReturnType<SchemaPlugin<Schemas>['build']>>;
3448
5671
  search: Awaited<ReturnType<SearchPlugin<Schemas>['build']>>;
3449
5672
  }, keyof Plugins> & {
3450
5673
  [Key in StringKeys<NonNullable<Plugins>>]: Awaited<ReturnType<NonNullable<Plugins>[Key]['build']>>;
5674
+ } & {
5675
+ getConfig(): Promise<{
5676
+ databaseURL: string;
5677
+ branch: string;
5678
+ }>;
3451
5679
  };
3452
5680
  }
3453
5681
  declare const BaseClient_base: ClientConstructor<{}>;
3454
5682
  declare class BaseClient extends BaseClient_base<Record<string, any>> {
3455
5683
  }
3456
5684
 
5685
+ declare class Serializer {
5686
+ classes: Record<string, any>;
5687
+ add(clazz: any): void;
5688
+ toJSON<T>(data: T): string;
5689
+ fromJSON<T>(json: string): T;
5690
+ }
5691
+ declare const serialize: <T>(data: T) => string;
5692
+ declare const deserialize: <T>(json: string) => T;
5693
+
3457
5694
  declare type BranchResolutionOptions = {
3458
5695
  databaseURL?: string;
3459
5696
  apiKey?: string;
@@ -3465,9 +5702,89 @@ declare function getDatabaseURL(): string | undefined;
3465
5702
 
3466
5703
  declare function getAPIKey(): string | undefined;
3467
5704
 
5705
+ interface Body {
5706
+ arrayBuffer(): Promise<ArrayBuffer>;
5707
+ blob(): Promise<Blob>;
5708
+ formData(): Promise<FormData>;
5709
+ json(): Promise<any>;
5710
+ text(): Promise<string>;
5711
+ }
5712
+ interface Blob {
5713
+ readonly size: number;
5714
+ readonly type: string;
5715
+ arrayBuffer(): Promise<ArrayBuffer>;
5716
+ slice(start?: number, end?: number, contentType?: string): Blob;
5717
+ text(): Promise<string>;
5718
+ }
5719
+ /** Provides information about files and allows JavaScript in a web page to access their content. */
5720
+ interface File extends Blob {
5721
+ readonly lastModified: number;
5722
+ readonly name: string;
5723
+ readonly webkitRelativePath: string;
5724
+ }
5725
+ declare type FormDataEntryValue = File | string;
5726
+ /** 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". */
5727
+ interface FormData {
5728
+ append(name: string, value: string | Blob, fileName?: string): void;
5729
+ delete(name: string): void;
5730
+ get(name: string): FormDataEntryValue | null;
5731
+ getAll(name: string): FormDataEntryValue[];
5732
+ has(name: string): boolean;
5733
+ set(name: string, value: string | Blob, fileName?: string): void;
5734
+ forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void;
5735
+ }
5736
+ /** 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. */
5737
+ interface Headers {
5738
+ append(name: string, value: string): void;
5739
+ delete(name: string): void;
5740
+ get(name: string): string | null;
5741
+ has(name: string): boolean;
5742
+ set(name: string, value: string): void;
5743
+ forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void;
5744
+ }
5745
+ interface Request extends Body {
5746
+ /** Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching. */
5747
+ readonly cache: 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload';
5748
+ /** 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. */
5749
+ readonly credentials: 'include' | 'omit' | 'same-origin';
5750
+ /** Returns the kind of resource requested by request, e.g., "document" or "script". */
5751
+ readonly destination: '' | 'audio' | 'audioworklet' | 'document' | 'embed' | 'font' | 'frame' | 'iframe' | 'image' | 'manifest' | 'object' | 'paintworklet' | 'report' | 'script' | 'sharedworker' | 'style' | 'track' | 'video' | 'worker' | 'xslt';
5752
+ /** 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. */
5753
+ readonly headers: Headers;
5754
+ /** 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] */
5755
+ readonly integrity: string;
5756
+ /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
5757
+ readonly keepalive: boolean;
5758
+ /** Returns request's HTTP method, which is "GET" by default. */
5759
+ readonly method: string;
5760
+ /** 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. */
5761
+ readonly mode: 'cors' | 'navigate' | 'no-cors' | 'same-origin';
5762
+ /** 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. */
5763
+ readonly redirect: 'error' | 'follow' | 'manual';
5764
+ /** 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. */
5765
+ readonly referrer: string;
5766
+ /** Returns the referrer policy associated with request. This is used during fetching to compute the value of the request's referrer. */
5767
+ readonly referrerPolicy: '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
5768
+ /** Returns the URL of request as a string. */
5769
+ readonly url: string;
5770
+ clone(): Request;
5771
+ }
5772
+
5773
+ declare type XataWorkerContext<XataClient> = {
5774
+ xata: XataClient;
5775
+ request: Request;
5776
+ env: Record<string, string | undefined>;
5777
+ };
5778
+ declare type RemoveFirst<T> = T extends [any, ...infer U] ? U : never;
5779
+ declare type WorkerRunnerConfig = {
5780
+ workspace: string;
5781
+ worker: string;
5782
+ };
5783
+ 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>>>;
5784
+
3468
5785
  declare class XataError extends Error {
3469
5786
  readonly status: number;
3470
5787
  constructor(message: string, status: number);
3471
5788
  }
3472
5789
 
3473
- export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, AddGitBranchesEntryError, AddGitBranchesEntryPathParams, AddGitBranchesEntryRequestBody, AddGitBranchesEntryResponse, AddGitBranchesEntryVariables, AddTableColumnError, AddTableColumnPathParams, AddTableColumnVariables, BaseClient, BaseClientOptions, BaseData, BulkInsertTableRecordsError, BulkInsertTableRecordsPathParams, BulkInsertTableRecordsRequestBody, BulkInsertTableRecordsResponse, BulkInsertTableRecordsVariables, CacheImpl, CancelWorkspaceMemberInviteError, CancelWorkspaceMemberInvitePathParams, CancelWorkspaceMemberInviteVariables, ClientConstructor, CreateBranchError, CreateBranchPathParams, CreateBranchQueryParams, CreateBranchRequestBody, CreateBranchVariables, CreateDatabaseError, CreateDatabasePathParams, CreateDatabaseRequestBody, CreateDatabaseResponse, CreateDatabaseVariables, CreateTableError, CreateTablePathParams, CreateTableVariables, CreateUserAPIKeyError, CreateUserAPIKeyPathParams, CreateUserAPIKeyResponse, CreateUserAPIKeyVariables, CreateWorkspaceError, CreateWorkspaceVariables, CursorNavigationOptions, DeleteBranchError, DeleteBranchPathParams, DeleteBranchVariables, DeleteColumnError, DeleteColumnPathParams, DeleteColumnVariables, DeleteDatabaseError, DeleteDatabasePathParams, DeleteDatabaseVariables, DeleteRecordError, DeleteRecordPathParams, DeleteRecordVariables, DeleteTableError, DeleteTablePathParams, DeleteTableVariables, DeleteUserAPIKeyError, DeleteUserAPIKeyPathParams, DeleteUserAPIKeyVariables, DeleteUserError, DeleteUserVariables, DeleteWorkspaceError, DeleteWorkspacePathParams, DeleteWorkspaceVariables, EditableData, ExecuteBranchMigrationPlanError, ExecuteBranchMigrationPlanPathParams, ExecuteBranchMigrationPlanRequestBody, ExecuteBranchMigrationPlanVariables, FetchImpl, FetcherExtraProps, GetBranchDetailsError, GetBranchDetailsPathParams, GetBranchDetailsVariables, GetBranchListError, GetBranchListPathParams, GetBranchListVariables, GetBranchMetadataError, GetBranchMetadataPathParams, GetBranchMetadataVariables, GetBranchMigrationHistoryError, GetBranchMigrationHistoryPathParams, GetBranchMigrationHistoryRequestBody, GetBranchMigrationHistoryResponse, GetBranchMigrationHistoryVariables, GetBranchMigrationPlanError, GetBranchMigrationPlanPathParams, GetBranchMigrationPlanVariables, GetBranchStatsError, GetBranchStatsPathParams, GetBranchStatsResponse, GetBranchStatsVariables, GetColumnError, GetColumnPathParams, GetColumnVariables, GetDatabaseListError, GetDatabaseListPathParams, GetDatabaseListVariables, GetGitBranchesMappingError, GetGitBranchesMappingPathParams, GetGitBranchesMappingVariables, 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, 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, RemoveGitBranchesEntryError, RemoveGitBranchesEntryPathParams, RemoveGitBranchesEntryQueryParams, RemoveGitBranchesEntryVariables, RemoveWorkspaceMemberError, RemoveWorkspaceMemberPathParams, RemoveWorkspaceMemberVariables, Repository, ResendWorkspaceMemberInviteError, ResendWorkspaceMemberInvitePathParams, ResendWorkspaceMemberInviteVariables, ResolveBranchError, ResolveBranchPathParams, ResolveBranchQueryParams, ResolveBranchResponse, ResolveBranchVariables, 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, 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, addGitBranchesEntry, addTableColumn, buildClient, bulkInsertTableRecords, cancelWorkspaceMemberInvite, contains, createBranch, createDatabase, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, endsWith, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseURL, getGitBranchesMapping, 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, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberRole, upsertRecordWithID };
5790
+ export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, AddGitBranchesEntryError, AddGitBranchesEntryPathParams, AddGitBranchesEntryRequestBody, AddGitBranchesEntryResponse, AddGitBranchesEntryVariables, AddTableColumnError, AddTableColumnPathParams, AddTableColumnVariables, ApplyBranchSchemaEditError, ApplyBranchSchemaEditPathParams, ApplyBranchSchemaEditRequestBody, ApplyBranchSchemaEditResponse, ApplyBranchSchemaEditVariables, BaseClient, BaseClientOptions, BaseData, BaseSchema, BulkInsertTableRecordsError, BulkInsertTableRecordsPathParams, BulkInsertTableRecordsQueryParams, BulkInsertTableRecordsRequestBody, BulkInsertTableRecordsVariables, CacheImpl, CancelWorkspaceMemberInviteError, CancelWorkspaceMemberInvitePathParams, CancelWorkspaceMemberInviteVariables, ClientConstructor, CompareBranchSchemasError, CompareBranchSchemasPathParams, CompareBranchSchemasVariables, CompareBranchWithUserSchemaError, CompareBranchWithUserSchemaPathParams, CompareBranchWithUserSchemaRequestBody, CompareBranchWithUserSchemaVariables, CompareMigrationRequestError, CompareMigrationRequestPathParams, CompareMigrationRequestVariables, CreateBranchError, CreateBranchPathParams, CreateBranchQueryParams, CreateBranchRequestBody, CreateBranchResponse, CreateBranchVariables, CreateDatabaseError, CreateDatabasePathParams, CreateDatabaseRequestBody, CreateDatabaseResponse, CreateDatabaseVariables, CreateMigrationRequestError, CreateMigrationRequestPathParams, CreateMigrationRequestRequestBody, CreateMigrationRequestResponse, CreateMigrationRequestVariables, CreateTableError, CreateTablePathParams, CreateTableResponse, CreateTableVariables, CreateUserAPIKeyError, CreateUserAPIKeyPathParams, CreateUserAPIKeyResponse, CreateUserAPIKeyVariables, CreateWorkspaceError, CreateWorkspaceVariables, CursorNavigationOptions, DeleteBranchError, DeleteBranchPathParams, DeleteBranchVariables, DeleteColumnError, DeleteColumnPathParams, DeleteColumnVariables, DeleteDatabaseError, DeleteDatabasePathParams, DeleteDatabaseVariables, DeleteRecordError, DeleteRecordPathParams, DeleteRecordQueryParams, DeleteRecordVariables, DeleteTableError, DeleteTablePathParams, DeleteTableVariables, DeleteUserAPIKeyError, DeleteUserAPIKeyPathParams, DeleteUserAPIKeyVariables, DeleteUserError, DeleteUserVariables, DeleteWorkspaceError, DeleteWorkspacePathParams, DeleteWorkspaceVariables, EditableData, ExecuteBranchMigrationPlanError, ExecuteBranchMigrationPlanPathParams, ExecuteBranchMigrationPlanRequestBody, ExecuteBranchMigrationPlanVariables, FetchImpl, FetcherExtraProps, GetBranchDetailsError, GetBranchDetailsPathParams, GetBranchDetailsVariables, GetBranchListError, GetBranchListPathParams, GetBranchListVariables, GetBranchMetadataError, GetBranchMetadataPathParams, GetBranchMetadataVariables, GetBranchMigrationHistoryError, GetBranchMigrationHistoryPathParams, GetBranchMigrationHistoryRequestBody, GetBranchMigrationHistoryResponse, GetBranchMigrationHistoryVariables, GetBranchMigrationPlanError, GetBranchMigrationPlanPathParams, GetBranchMigrationPlanVariables, GetBranchSchemaHistoryError, GetBranchSchemaHistoryPathParams, GetBranchSchemaHistoryRequestBody, GetBranchSchemaHistoryResponse, GetBranchSchemaHistoryVariables, GetBranchStatsError, GetBranchStatsPathParams, GetBranchStatsResponse, GetBranchStatsVariables, GetColumnError, GetColumnPathParams, GetColumnVariables, GetDatabaseListError, GetDatabaseListPathParams, GetDatabaseListVariables, GetDatabaseMetadataError, GetDatabaseMetadataPathParams, GetDatabaseMetadataVariables, GetGitBranchesMappingError, GetGitBranchesMappingPathParams, GetGitBranchesMappingVariables, GetMigrationRequestError, GetMigrationRequestIsMergedError, GetMigrationRequestIsMergedPathParams, GetMigrationRequestIsMergedResponse, GetMigrationRequestIsMergedVariables, GetMigrationRequestPathParams, GetMigrationRequestVariables, GetRecordError, GetRecordPathParams, GetRecordQueryParams, GetRecordVariables, GetTableColumnsError, GetTableColumnsPathParams, GetTableColumnsResponse, GetTableColumnsVariables, GetTableSchemaError, GetTableSchemaPathParams, GetTableSchemaResponse, GetTableSchemaVariables, GetUserAPIKeysError, GetUserAPIKeysResponse, GetUserAPIKeysVariables, GetUserError, GetUserVariables, GetWorkspaceError, GetWorkspaceMembersListError, GetWorkspaceMembersListPathParams, GetWorkspaceMembersListVariables, GetWorkspacePathParams, GetWorkspaceVariables, GetWorkspacesListError, GetWorkspacesListResponse, GetWorkspacesListVariables, Identifiable, InsertRecordError, InsertRecordPathParams, InsertRecordQueryParams, InsertRecordVariables, InsertRecordWithIDError, InsertRecordWithIDPathParams, InsertRecordWithIDQueryParams, InsertRecordWithIDVariables, InviteWorkspaceMemberError, InviteWorkspaceMemberPathParams, InviteWorkspaceMemberRequestBody, InviteWorkspaceMemberVariables, Link, ListMigrationRequestsCommitsError, ListMigrationRequestsCommitsPathParams, ListMigrationRequestsCommitsRequestBody, ListMigrationRequestsCommitsResponse, ListMigrationRequestsCommitsVariables, ListMigrationRequestsError, ListMigrationRequestsPathParams, ListMigrationRequestsRequestBody, ListMigrationRequestsResponse, ListMigrationRequestsVariables, MergeMigrationRequestError, MergeMigrationRequestPathParams, MergeMigrationRequestVariables, OffsetNavigationOptions, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Paginable, PaginationQueryMeta, PreviewBranchSchemaEditError, PreviewBranchSchemaEditPathParams, PreviewBranchSchemaEditRequestBody, PreviewBranchSchemaEditResponse, PreviewBranchSchemaEditVariables, Query, QueryTableError, QueryTablePathParams, QueryTableRequestBody, QueryTableVariables, RecordArray, RemoveGitBranchesEntryError, RemoveGitBranchesEntryPathParams, RemoveGitBranchesEntryQueryParams, RemoveGitBranchesEntryVariables, RemoveWorkspaceMemberError, RemoveWorkspaceMemberPathParams, RemoveWorkspaceMemberVariables, Repository, ResendWorkspaceMemberInviteError, ResendWorkspaceMemberInvitePathParams, ResendWorkspaceMemberInviteVariables, ResolveBranchError, ResolveBranchPathParams, ResolveBranchQueryParams, ResolveBranchResponse, ResolveBranchVariables, responses as Responses, RestRepository, SchemaDefinition, SchemaInference, SchemaPlugin, SchemaPluginResult, schemas as Schemas, SearchBranchError, SearchBranchPathParams, SearchBranchRequestBody, SearchBranchVariables, SearchOptions, SearchPlugin, SearchPluginResult, SearchTableError, SearchTablePathParams, SearchTableRequestBody, SearchTableVariables, SearchXataRecord, SelectableColumn, SelectedPick, Serializer, SetTableSchemaError, SetTableSchemaPathParams, SetTableSchemaRequestBody, SetTableSchemaVariables, SimpleCache, SimpleCacheOptions, SummarizeTableError, SummarizeTablePathParams, SummarizeTableRequestBody, SummarizeTableVariables, UpdateBranchMetadataError, UpdateBranchMetadataPathParams, UpdateBranchMetadataVariables, UpdateBranchSchemaError, UpdateBranchSchemaPathParams, UpdateBranchSchemaResponse, UpdateBranchSchemaVariables, UpdateColumnError, UpdateColumnPathParams, UpdateColumnRequestBody, UpdateColumnVariables, UpdateDatabaseMetadataError, UpdateDatabaseMetadataPathParams, UpdateDatabaseMetadataRequestBody, UpdateDatabaseMetadataVariables, UpdateMigrationRequestError, UpdateMigrationRequestPathParams, UpdateMigrationRequestRequestBody, UpdateMigrationRequestVariables, UpdateRecordWithIDError, UpdateRecordWithIDPathParams, UpdateRecordWithIDQueryParams, UpdateRecordWithIDVariables, UpdateTableError, UpdateTablePathParams, UpdateTableRequestBody, UpdateTableVariables, UpdateUserError, UpdateUserVariables, UpdateWorkspaceError, UpdateWorkspaceMemberInviteError, UpdateWorkspaceMemberInvitePathParams, UpdateWorkspaceMemberInviteRequestBody, UpdateWorkspaceMemberInviteVariables, UpdateWorkspaceMemberRoleError, UpdateWorkspaceMemberRolePathParams, UpdateWorkspaceMemberRoleRequestBody, UpdateWorkspaceMemberRoleVariables, UpdateWorkspacePathParams, UpdateWorkspaceVariables, UpsertRecordWithIDError, UpsertRecordWithIDPathParams, UpsertRecordWithIDQueryParams, UpsertRecordWithIDVariables, ValueAtColumn, XataApiClient, XataApiClientOptions, XataApiPlugin, XataError, XataPlugin, XataPluginOptions, XataRecord, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, applyBranchSchemaEdit, buildClient, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, createBranch, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getGitBranchesMapping, getMigrationRequest, getMigrationRequestIsMerged, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isIdentifiable, isNot, isXataRecord, le, lessEquals, lessThan, lessThanEquals, listMigrationRequests, listMigrationRequestsCommits, lt, lte, mergeMigrationRequest, notExists, operationsByTag, pattern, previewBranchSchemaEdit, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, startsWith, summarizeTable, updateBranchMetadata, updateBranchSchema, updateColumn, updateDatabaseMetadata, updateMigrationRequest, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };