@xata.io/client 0.0.0-alpha.vf6f2567 → 0.0.0-alpha.vf721f5c

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,16 +102,19 @@ 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;
98
109
  memberCount: number;
99
- plan: 'free';
110
+ plan: 'free' | 'pro';
100
111
  };
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,22 +142,48 @@ 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
  };
181
+ declare type ListGitBranchesResponse = {
182
+ mapping: {
183
+ gitBranch: string;
184
+ xataBranch: string;
185
+ }[];
186
+ };
141
187
  declare type Branch = {
142
188
  name: string;
143
189
  createdAt: DateTime;
@@ -147,8 +193,14 @@ declare type Branch = {
147
193
  * @x-go-type xata.BranchMetadata
148
194
  */
149
195
  declare type BranchMetadata = {
196
+ /**
197
+ * @minLength 1
198
+ */
150
199
  repository?: string;
151
200
  branch?: BranchName;
201
+ /**
202
+ * @minLength 1
203
+ */
152
204
  stage?: string;
153
205
  labels?: string[];
154
206
  };
@@ -175,21 +227,39 @@ declare type Schema = {
175
227
  tables: Table[];
176
228
  tablesOrder?: string[];
177
229
  };
230
+ /**
231
+ * @x-internal true
232
+ */
233
+ declare type SchemaEditScript = {
234
+ sourceMigrationID?: string;
235
+ targetMigrationID?: string;
236
+ tables: TableEdit[];
237
+ };
178
238
  declare type Table = {
179
239
  id?: string;
180
240
  name: TableName;
181
241
  columns: Column[];
182
242
  revLinks?: RevLink[];
183
243
  };
244
+ /**
245
+ * @x-internal true
246
+ */
247
+ declare type TableEdit = {
248
+ oldName?: string;
249
+ newName?: string;
250
+ columns?: MigrationColumnOp[];
251
+ };
184
252
  /**
185
253
  * @x-go-type xata.Column
186
254
  */
187
255
  declare type Column = {
188
256
  name: string;
189
- type: 'bool' | 'int' | 'float' | 'string' | 'text' | 'email' | 'multiple' | 'link' | 'object';
257
+ type: 'bool' | 'int' | 'float' | 'string' | 'text' | 'email' | 'multiple' | 'link' | 'object' | 'datetime';
190
258
  link?: {
191
259
  table: string;
192
260
  };
261
+ notNull?: boolean;
262
+ unique?: boolean;
193
263
  columns?: Column[];
194
264
  };
195
265
  declare type RevLink = {
@@ -256,12 +326,175 @@ declare type ColumnMigration = {
256
326
  old: Column;
257
327
  ['new']: Column;
258
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
+ };
259
460
  declare type SortExpression = string[] | {
260
461
  [key: string]: SortOrder;
261
462
  } | {
262
463
  [key: string]: SortOrder;
263
464
  }[];
264
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';
481
+ /**
482
+ * The target expression is used to filter the search results by the target columns.
483
+ */
484
+ declare type TargetExpression = (string | {
485
+ /**
486
+ * The name of the column.
487
+ */
488
+ column: string;
489
+ /**
490
+ * The weight of the column.
491
+ *
492
+ * @default 1
493
+ * @maximum 10
494
+ * @minimum 1
495
+ */
496
+ weight?: number;
497
+ })[];
265
498
  /**
266
499
  * @minProperties 1
267
500
  */
@@ -275,6 +508,122 @@ declare type FilterExpression = {
275
508
  } & {
276
509
  [key: string]: FilterColumn;
277
510
  };
511
+ /**
512
+ * The description of the summaries you wish to receive. Set each key to be the field name
513
+ * you'd like for the summary. These names must not collide with other columns you've
514
+ * requested from `columns`; including implicit requests like `settings.*`.
515
+ *
516
+ * The value for each key needs to be an object. This object should contain one key and one
517
+ * value only. In this object, the key should be set to the summary function you wish to use
518
+ * and the value set to the column name to be summarized.
519
+ *
520
+ * The column being summarized cannot be an internal column (id, xata.*), nor the base of
521
+ * an object, i.e. if `settings` is an object with `dark_mode` as a field, you may summarize
522
+ * `settings.dark_mode` but not `settings` nor `settings.*`.
523
+ *
524
+ * @example {"all_users":{"count":"*"}}
525
+ * @example {"total_created":{"count":"created_at"}}
526
+ * @x-go-type xbquery.SummaryList
527
+ */
528
+ declare type SummaryExpressionList = {
529
+ [key: string]: SummaryExpression;
530
+ };
531
+ /**
532
+ * A summary expression is the description of a single summary operation. It consists of a single
533
+ * key representing the operation, and a value representing the column to be operated on.
534
+ *
535
+ * The column being summarized cannot be an internal column (id, xata.*), nor the base of
536
+ * an object, i.e. if `settings` is an object with `dark_mode` as a field, you may summarize
537
+ * `settings.dark_mode` but not `settings` nor `settings.*`.
538
+ *
539
+ * We currently support the `count` operation. When using `count`, one can set a column name
540
+ * as the value. Xata will return the total number times this column is non-null in each group.
541
+ *
542
+ * Alternately, if you'd like to count the total rows in each group - irregardless of null/not null
543
+ * status - you can set `count` to `*` to count everything.
544
+ *
545
+ * @example {"count":"deleted_at"}
546
+ * @x-go-type xbquery.Summary
547
+ */
548
+ declare type SummaryExpression = Record<string, any>;
549
+ declare type HighlightExpression = {
550
+ /**
551
+ * Set to `false` to disable highlighting. By default it is `true`.
552
+ */
553
+ enabled?: boolean;
554
+ /**
555
+ * Set to `false` to disable HTML encoding in highlight snippets. By default it is `true`.
556
+ */
557
+ encodeHTML?: boolean;
558
+ };
559
+ /**
560
+ * Booster Expression
561
+ *
562
+ * @x-go-type xata.BoosterExpression
563
+ */
564
+ declare type BoosterExpression = {
565
+ valueBooster?: ValueBooster$1;
566
+ } | {
567
+ numericBooster?: NumericBooster$1;
568
+ } | {
569
+ dateBooster?: DateBooster$1;
570
+ };
571
+ /**
572
+ * Boost records with a particular value for a column.
573
+ */
574
+ declare type ValueBooster$1 = {
575
+ /**
576
+ * The column in which to look for the value.
577
+ */
578
+ column: string;
579
+ /**
580
+ * The exact value to boost.
581
+ */
582
+ value: string | number | boolean;
583
+ /**
584
+ * The factor with which to multiply the score of the record.
585
+ */
586
+ factor: number;
587
+ };
588
+ /**
589
+ * Boost records based on the value of a numeric column.
590
+ */
591
+ declare type NumericBooster$1 = {
592
+ /**
593
+ * The column in which to look for the value.
594
+ */
595
+ column: string;
596
+ /**
597
+ * The factor with which to multiply the value of the column before adding it to the item score.
598
+ */
599
+ factor: number;
600
+ };
601
+ /**
602
+ * Boost records based on the value of a datetime column. It is configured via "origin", "scale", and "decay". The further away from the "origin",
603
+ * 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
604
+ * 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.
605
+ */
606
+ declare type DateBooster$1 = {
607
+ /**
608
+ * The column in which to look for the value.
609
+ */
610
+ column: string;
611
+ /**
612
+ * 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.
613
+ * If it is not specified, the current date and time is used.
614
+ */
615
+ origin?: string;
616
+ /**
617
+ * 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`.
618
+ *
619
+ * @pattern ^(\d+)(d|h|m|s|ms)$
620
+ */
621
+ scale: string;
622
+ /**
623
+ * The decay factor to expect at "scale" distance from the "origin".
624
+ */
625
+ decay: number;
626
+ };
278
627
  declare type FilterList = FilterExpression | FilterExpression[];
279
628
  declare type FilterColumn = FilterColumnIncludes | FilterPredicate | FilterList;
280
629
  /**
@@ -324,14 +673,73 @@ declare type FilterValue = number | string | boolean;
324
673
  * Pagination settings.
325
674
  */
326
675
  declare type PageConfig = {
676
+ /**
677
+ * Query the next page that follow the cursor.
678
+ */
327
679
  after?: string;
680
+ /**
681
+ * Query the previous page before the cursor.
682
+ */
328
683
  before?: string;
684
+ /**
685
+ * Query the first page from the cursor.
686
+ */
329
687
  first?: string;
688
+ /**
689
+ * Query the last page from the cursor.
690
+ */
330
691
  last?: string;
692
+ /**
693
+ * 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.
694
+ *
695
+ * @default 20
696
+ */
331
697
  size?: number;
698
+ /**
699
+ * Use offset to skip entries. To skip pages set offset to a multiple of size.
700
+ *
701
+ * @default 0
702
+ */
332
703
  offset?: number;
333
704
  };
334
- declare type ColumnsFilter = string[];
705
+ /**
706
+ * @example name
707
+ * @example email
708
+ * @example created_at
709
+ */
710
+ declare type ColumnsProjection = string[];
711
+ /**
712
+ * Xata Table Record Metadata
713
+ */
714
+ declare type RecordMeta = {
715
+ id: RecordID;
716
+ xata: {
717
+ /**
718
+ * The record's version. Can be used for optimistic concurrency control.
719
+ */
720
+ version: number;
721
+ /**
722
+ * The record's table name. APIs that return records from multiple tables will set this field accordingly.
723
+ */
724
+ table?: string;
725
+ /**
726
+ * Highlights of the record. This is used by the search APIs to indicate which fields and parts of the fields have matched the search.
727
+ */
728
+ highlight?: {
729
+ [key: string]: string[] | {
730
+ [key: string]: any;
731
+ };
732
+ };
733
+ /**
734
+ * The record's relevancy score. This is returned by the search APIs.
735
+ */
736
+ score?: number;
737
+ /**
738
+ * Encoding/Decoding errors
739
+ */
740
+ warnings?: string[];
741
+ };
742
+ };
335
743
  /**
336
744
  * @pattern [a-zA-Z0-9_-~:]+
337
745
  */
@@ -340,7 +748,13 @@ declare type RecordID = string;
340
748
  * @example {"newName":"newName","oldName":"oldName"}
341
749
  */
342
750
  declare type TableRename = {
751
+ /**
752
+ * @minLength 1
753
+ */
343
754
  newName: string;
755
+ /**
756
+ * @minLength 1
757
+ */
344
758
  oldName: string;
345
759
  };
346
760
  /**
@@ -348,21 +762,20 @@ declare type TableRename = {
348
762
  */
349
763
  declare type RecordsMetadata = {
350
764
  page: {
765
+ /**
766
+ * last record id
767
+ */
351
768
  cursor: string;
769
+ /**
770
+ * true if more records can be fetch
771
+ */
352
772
  more: boolean;
353
773
  };
354
774
  };
355
775
  /**
356
- * Xata Table Record
776
+ * Xata Table Record Metadata
357
777
  */
358
- declare type XataRecord$1 = {
359
- id: RecordID;
360
- xata: {
361
- version: number;
362
- table?: string;
363
- warnings?: string[];
364
- };
365
- } & {
778
+ declare type XataRecord$1 = RecordMeta & {
366
779
  [key: string]: any;
367
780
  };
368
781
 
@@ -380,14 +793,18 @@ type schemas_InviteID = InviteID;
380
793
  type schemas_WorkspaceInvite = WorkspaceInvite;
381
794
  type schemas_WorkspaceMembers = WorkspaceMembers;
382
795
  type schemas_InviteKey = InviteKey;
796
+ type schemas_DatabaseMetadata = DatabaseMetadata;
383
797
  type schemas_ListDatabasesResponse = ListDatabasesResponse;
384
798
  type schemas_ListBranchesResponse = ListBranchesResponse;
799
+ type schemas_ListGitBranchesResponse = ListGitBranchesResponse;
385
800
  type schemas_Branch = Branch;
386
801
  type schemas_BranchMetadata = BranchMetadata;
387
802
  type schemas_DBBranch = DBBranch;
388
803
  type schemas_StartedFromMetadata = StartedFromMetadata;
389
804
  type schemas_Schema = Schema;
805
+ type schemas_SchemaEditScript = SchemaEditScript;
390
806
  type schemas_Table = Table;
807
+ type schemas_TableEdit = TableEdit;
391
808
  type schemas_Column = Column;
392
809
  type schemas_RevLink = RevLink;
393
810
  type schemas_BranchName = BranchName;
@@ -400,9 +817,28 @@ type schemas_MetricsLatency = MetricsLatency;
400
817
  type schemas_BranchMigration = BranchMigration;
401
818
  type schemas_TableMigration = TableMigration;
402
819
  type schemas_ColumnMigration = ColumnMigration;
820
+ type schemas_Commit = Commit;
821
+ type schemas_Migration = Migration;
822
+ type schemas_MigrationOp = MigrationOp;
823
+ type schemas_MigrationTableOp = MigrationTableOp;
824
+ type schemas_MigrationColumnOp = MigrationColumnOp;
825
+ type schemas_TableOpAdd = TableOpAdd;
826
+ type schemas_TableOpRemove = TableOpRemove;
827
+ type schemas_TableOpRename = TableOpRename;
828
+ type schemas_ColumnOpAdd = ColumnOpAdd;
829
+ type schemas_ColumnOpRemove = ColumnOpRemove;
830
+ type schemas_ColumnOpRename = ColumnOpRename;
831
+ type schemas_MigrationRequest = MigrationRequest;
403
832
  type schemas_SortExpression = SortExpression;
404
833
  type schemas_SortOrder = SortOrder;
834
+ type schemas_FuzzinessExpression = FuzzinessExpression;
835
+ type schemas_PrefixExpression = PrefixExpression;
836
+ type schemas_TargetExpression = TargetExpression;
405
837
  type schemas_FilterExpression = FilterExpression;
838
+ type schemas_SummaryExpressionList = SummaryExpressionList;
839
+ type schemas_SummaryExpression = SummaryExpression;
840
+ type schemas_HighlightExpression = HighlightExpression;
841
+ type schemas_BoosterExpression = BoosterExpression;
406
842
  type schemas_FilterList = FilterList;
407
843
  type schemas_FilterColumn = FilterColumn;
408
844
  type schemas_FilterColumnIncludes = FilterColumnIncludes;
@@ -412,7 +848,8 @@ type schemas_FilterPredicateRangeOp = FilterPredicateRangeOp;
412
848
  type schemas_FilterRangeValue = FilterRangeValue;
413
849
  type schemas_FilterValue = FilterValue;
414
850
  type schemas_PageConfig = PageConfig;
415
- type schemas_ColumnsFilter = ColumnsFilter;
851
+ type schemas_ColumnsProjection = ColumnsProjection;
852
+ type schemas_RecordMeta = RecordMeta;
416
853
  type schemas_RecordID = RecordID;
417
854
  type schemas_TableRename = TableRename;
418
855
  type schemas_RecordsMetadata = RecordsMetadata;
@@ -432,14 +869,18 @@ declare namespace schemas {
432
869
  schemas_WorkspaceInvite as WorkspaceInvite,
433
870
  schemas_WorkspaceMembers as WorkspaceMembers,
434
871
  schemas_InviteKey as InviteKey,
872
+ schemas_DatabaseMetadata as DatabaseMetadata,
435
873
  schemas_ListDatabasesResponse as ListDatabasesResponse,
436
874
  schemas_ListBranchesResponse as ListBranchesResponse,
875
+ schemas_ListGitBranchesResponse as ListGitBranchesResponse,
437
876
  schemas_Branch as Branch,
438
877
  schemas_BranchMetadata as BranchMetadata,
439
878
  schemas_DBBranch as DBBranch,
440
879
  schemas_StartedFromMetadata as StartedFromMetadata,
441
880
  schemas_Schema as Schema,
881
+ schemas_SchemaEditScript as SchemaEditScript,
442
882
  schemas_Table as Table,
883
+ schemas_TableEdit as TableEdit,
443
884
  schemas_Column as Column,
444
885
  schemas_RevLink as RevLink,
445
886
  schemas_BranchName as BranchName,
@@ -452,9 +893,31 @@ declare namespace schemas {
452
893
  schemas_BranchMigration as BranchMigration,
453
894
  schemas_TableMigration as TableMigration,
454
895
  schemas_ColumnMigration as ColumnMigration,
896
+ schemas_Commit as Commit,
897
+ schemas_Migration as Migration,
898
+ schemas_MigrationOp as MigrationOp,
899
+ schemas_MigrationTableOp as MigrationTableOp,
900
+ schemas_MigrationColumnOp as MigrationColumnOp,
901
+ schemas_TableOpAdd as TableOpAdd,
902
+ schemas_TableOpRemove as TableOpRemove,
903
+ schemas_TableOpRename as TableOpRename,
904
+ schemas_ColumnOpAdd as ColumnOpAdd,
905
+ schemas_ColumnOpRemove as ColumnOpRemove,
906
+ schemas_ColumnOpRename as ColumnOpRename,
907
+ schemas_MigrationRequest as MigrationRequest,
455
908
  schemas_SortExpression as SortExpression,
456
909
  schemas_SortOrder as SortOrder,
910
+ schemas_FuzzinessExpression as FuzzinessExpression,
911
+ schemas_PrefixExpression as PrefixExpression,
912
+ schemas_TargetExpression as TargetExpression,
457
913
  schemas_FilterExpression as FilterExpression,
914
+ schemas_SummaryExpressionList as SummaryExpressionList,
915
+ schemas_SummaryExpression as SummaryExpression,
916
+ schemas_HighlightExpression as HighlightExpression,
917
+ schemas_BoosterExpression as BoosterExpression,
918
+ ValueBooster$1 as ValueBooster,
919
+ NumericBooster$1 as NumericBooster,
920
+ DateBooster$1 as DateBooster,
458
921
  schemas_FilterList as FilterList,
459
922
  schemas_FilterColumn as FilterColumn,
460
923
  schemas_FilterColumnIncludes as FilterColumnIncludes,
@@ -464,7 +927,8 @@ declare namespace schemas {
464
927
  schemas_FilterRangeValue as FilterRangeValue,
465
928
  schemas_FilterValue as FilterValue,
466
929
  schemas_PageConfig as PageConfig,
467
- schemas_ColumnsFilter as ColumnsFilter,
930
+ schemas_ColumnsProjection as ColumnsProjection,
931
+ schemas_RecordMeta as RecordMeta,
468
932
  schemas_RecordID as RecordID,
469
933
  schemas_TableRename as TableRename,
470
934
  schemas_RecordsMetadata as RecordsMetadata,
@@ -499,11 +963,22 @@ declare type BulkError = {
499
963
  status?: number;
500
964
  }[];
501
965
  };
966
+ declare type BulkInsertResponse = {
967
+ recordIDs: string[];
968
+ } | {
969
+ records: XataRecord$1[];
970
+ };
502
971
  declare type BranchMigrationPlan = {
503
972
  version: number;
504
973
  migration: BranchMigration;
505
974
  };
506
- declare type RecordUpdateResponse = {
975
+ declare type RecordResponse = XataRecord$1;
976
+ declare type SchemaCompareResponse = {
977
+ source: Schema;
978
+ target: Schema;
979
+ edits: SchemaEditScript;
980
+ };
981
+ declare type RecordUpdateResponse = XataRecord$1 | {
507
982
  id: string;
508
983
  xata: {
509
984
  version: number;
@@ -513,13 +988,20 @@ declare type QueryResponse = {
513
988
  records: XataRecord$1[];
514
989
  meta: RecordsMetadata;
515
990
  };
991
+ declare type SummarizeResponse = {
992
+ summaries: Record<string, any>[];
993
+ };
516
994
  declare type SearchResponse = {
517
995
  records: XataRecord$1[];
996
+ warning?: string;
518
997
  };
519
998
  /**
520
999
  * @example {"migrationID":"mig_c7m19ilcefoebpqj12p0"}
521
1000
  */
522
1001
  declare type MigrationIdResponse = {
1002
+ /**
1003
+ * @minLength 1
1004
+ */
523
1005
  migrationID: string;
524
1006
  };
525
1007
 
@@ -527,9 +1009,13 @@ type responses_SimpleError = SimpleError;
527
1009
  type responses_BadRequestError = BadRequestError;
528
1010
  type responses_AuthError = AuthError;
529
1011
  type responses_BulkError = BulkError;
1012
+ type responses_BulkInsertResponse = BulkInsertResponse;
530
1013
  type responses_BranchMigrationPlan = BranchMigrationPlan;
1014
+ type responses_RecordResponse = RecordResponse;
1015
+ type responses_SchemaCompareResponse = SchemaCompareResponse;
531
1016
  type responses_RecordUpdateResponse = RecordUpdateResponse;
532
1017
  type responses_QueryResponse = QueryResponse;
1018
+ type responses_SummarizeResponse = SummarizeResponse;
533
1019
  type responses_SearchResponse = SearchResponse;
534
1020
  type responses_MigrationIdResponse = MigrationIdResponse;
535
1021
  declare namespace responses {
@@ -538,9 +1024,13 @@ declare namespace responses {
538
1024
  responses_BadRequestError as BadRequestError,
539
1025
  responses_AuthError as AuthError,
540
1026
  responses_BulkError as BulkError,
1027
+ responses_BulkInsertResponse as BulkInsertResponse,
541
1028
  responses_BranchMigrationPlan as BranchMigrationPlan,
1029
+ responses_RecordResponse as RecordResponse,
1030
+ responses_SchemaCompareResponse as SchemaCompareResponse,
542
1031
  responses_RecordUpdateResponse as RecordUpdateResponse,
543
1032
  responses_QueryResponse as QueryResponse,
1033
+ responses_SummarizeResponse as SummarizeResponse,
544
1034
  responses_SearchResponse as SearchResponse,
545
1035
  responses_MigrationIdResponse as MigrationIdResponse,
546
1036
  };
@@ -621,6 +1111,9 @@ declare type GetUserAPIKeysVariables = FetcherExtraProps;
621
1111
  */
622
1112
  declare const getUserAPIKeys: (variables: GetUserAPIKeysVariables) => Promise<GetUserAPIKeysResponse>;
623
1113
  declare type CreateUserAPIKeyPathParams = {
1114
+ /**
1115
+ * API Key name
1116
+ */
624
1117
  keyName: APIKeyName;
625
1118
  };
626
1119
  declare type CreateUserAPIKeyError = ErrorWrapper<{
@@ -646,6 +1139,9 @@ declare type CreateUserAPIKeyVariables = {
646
1139
  */
647
1140
  declare const createUserAPIKey: (variables: CreateUserAPIKeyVariables) => Promise<CreateUserAPIKeyResponse>;
648
1141
  declare type DeleteUserAPIKeyPathParams = {
1142
+ /**
1143
+ * API Key name
1144
+ */
649
1145
  keyName: APIKeyName;
650
1146
  };
651
1147
  declare type DeleteUserAPIKeyError = ErrorWrapper<{
@@ -706,6 +1202,9 @@ declare type GetWorkspacesListVariables = FetcherExtraProps;
706
1202
  */
707
1203
  declare const getWorkspacesList: (variables: GetWorkspacesListVariables) => Promise<GetWorkspacesListResponse>;
708
1204
  declare type GetWorkspacePathParams = {
1205
+ /**
1206
+ * Workspace ID
1207
+ */
709
1208
  workspaceId: WorkspaceID;
710
1209
  };
711
1210
  declare type GetWorkspaceError = ErrorWrapper<{
@@ -726,6 +1225,9 @@ declare type GetWorkspaceVariables = {
726
1225
  */
727
1226
  declare const getWorkspace: (variables: GetWorkspaceVariables) => Promise<Workspace>;
728
1227
  declare type UpdateWorkspacePathParams = {
1228
+ /**
1229
+ * Workspace ID
1230
+ */
729
1231
  workspaceId: WorkspaceID;
730
1232
  };
731
1233
  declare type UpdateWorkspaceError = ErrorWrapper<{
@@ -747,6 +1249,9 @@ declare type UpdateWorkspaceVariables = {
747
1249
  */
748
1250
  declare const updateWorkspace: (variables: UpdateWorkspaceVariables) => Promise<Workspace>;
749
1251
  declare type DeleteWorkspacePathParams = {
1252
+ /**
1253
+ * Workspace ID
1254
+ */
750
1255
  workspaceId: WorkspaceID;
751
1256
  };
752
1257
  declare type DeleteWorkspaceError = ErrorWrapper<{
@@ -767,6 +1272,9 @@ declare type DeleteWorkspaceVariables = {
767
1272
  */
768
1273
  declare const deleteWorkspace: (variables: DeleteWorkspaceVariables) => Promise<undefined>;
769
1274
  declare type GetWorkspaceMembersListPathParams = {
1275
+ /**
1276
+ * Workspace ID
1277
+ */
770
1278
  workspaceId: WorkspaceID;
771
1279
  };
772
1280
  declare type GetWorkspaceMembersListError = ErrorWrapper<{
@@ -787,7 +1295,13 @@ declare type GetWorkspaceMembersListVariables = {
787
1295
  */
788
1296
  declare const getWorkspaceMembersList: (variables: GetWorkspaceMembersListVariables) => Promise<WorkspaceMembers>;
789
1297
  declare type UpdateWorkspaceMemberRolePathParams = {
1298
+ /**
1299
+ * Workspace ID
1300
+ */
790
1301
  workspaceId: WorkspaceID;
1302
+ /**
1303
+ * UserID
1304
+ */
791
1305
  userId: UserID;
792
1306
  };
793
1307
  declare type UpdateWorkspaceMemberRoleError = ErrorWrapper<{
@@ -812,7 +1326,13 @@ declare type UpdateWorkspaceMemberRoleVariables = {
812
1326
  */
813
1327
  declare const updateWorkspaceMemberRole: (variables: UpdateWorkspaceMemberRoleVariables) => Promise<undefined>;
814
1328
  declare type RemoveWorkspaceMemberPathParams = {
1329
+ /**
1330
+ * Workspace ID
1331
+ */
815
1332
  workspaceId: WorkspaceID;
1333
+ /**
1334
+ * UserID
1335
+ */
816
1336
  userId: UserID;
817
1337
  };
818
1338
  declare type RemoveWorkspaceMemberError = ErrorWrapper<{
@@ -833,6 +1353,9 @@ declare type RemoveWorkspaceMemberVariables = {
833
1353
  */
834
1354
  declare const removeWorkspaceMember: (variables: RemoveWorkspaceMemberVariables) => Promise<undefined>;
835
1355
  declare type InviteWorkspaceMemberPathParams = {
1356
+ /**
1357
+ * Workspace ID
1358
+ */
836
1359
  workspaceId: WorkspaceID;
837
1360
  };
838
1361
  declare type InviteWorkspaceMemberError = ErrorWrapper<{
@@ -844,8 +1367,14 @@ declare type InviteWorkspaceMemberError = ErrorWrapper<{
844
1367
  } | {
845
1368
  status: 404;
846
1369
  payload: SimpleError;
1370
+ } | {
1371
+ status: 409;
1372
+ payload: SimpleError;
847
1373
  }>;
848
1374
  declare type InviteWorkspaceMemberRequestBody = {
1375
+ /**
1376
+ * @format email
1377
+ */
849
1378
  email: string;
850
1379
  role: Role;
851
1380
  };
@@ -857,8 +1386,48 @@ declare type InviteWorkspaceMemberVariables = {
857
1386
  * Invite some user to join the workspace with the given role
858
1387
  */
859
1388
  declare const inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<WorkspaceInvite>;
1389
+ declare type UpdateWorkspaceMemberInvitePathParams = {
1390
+ /**
1391
+ * Workspace ID
1392
+ */
1393
+ workspaceId: WorkspaceID;
1394
+ /**
1395
+ * Invite identifier
1396
+ */
1397
+ inviteId: InviteID;
1398
+ };
1399
+ declare type UpdateWorkspaceMemberInviteError = ErrorWrapper<{
1400
+ status: 400;
1401
+ payload: BadRequestError;
1402
+ } | {
1403
+ status: 401;
1404
+ payload: AuthError;
1405
+ } | {
1406
+ status: 404;
1407
+ payload: SimpleError;
1408
+ } | {
1409
+ status: 422;
1410
+ payload: SimpleError;
1411
+ }>;
1412
+ declare type UpdateWorkspaceMemberInviteRequestBody = {
1413
+ role: Role;
1414
+ };
1415
+ declare type UpdateWorkspaceMemberInviteVariables = {
1416
+ body: UpdateWorkspaceMemberInviteRequestBody;
1417
+ pathParams: UpdateWorkspaceMemberInvitePathParams;
1418
+ } & FetcherExtraProps;
1419
+ /**
1420
+ * 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.
1421
+ */
1422
+ declare const updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
860
1423
  declare type CancelWorkspaceMemberInvitePathParams = {
1424
+ /**
1425
+ * Workspace ID
1426
+ */
861
1427
  workspaceId: WorkspaceID;
1428
+ /**
1429
+ * Invite identifier
1430
+ */
862
1431
  inviteId: InviteID;
863
1432
  };
864
1433
  declare type CancelWorkspaceMemberInviteError = ErrorWrapper<{
@@ -879,7 +1448,13 @@ declare type CancelWorkspaceMemberInviteVariables = {
879
1448
  */
880
1449
  declare const cancelWorkspaceMemberInvite: (variables: CancelWorkspaceMemberInviteVariables) => Promise<undefined>;
881
1450
  declare type ResendWorkspaceMemberInvitePathParams = {
1451
+ /**
1452
+ * Workspace ID
1453
+ */
882
1454
  workspaceId: WorkspaceID;
1455
+ /**
1456
+ * Invite identifier
1457
+ */
883
1458
  inviteId: InviteID;
884
1459
  };
885
1460
  declare type ResendWorkspaceMemberInviteError = ErrorWrapper<{
@@ -900,7 +1475,13 @@ declare type ResendWorkspaceMemberInviteVariables = {
900
1475
  */
901
1476
  declare const resendWorkspaceMemberInvite: (variables: ResendWorkspaceMemberInviteVariables) => Promise<undefined>;
902
1477
  declare type AcceptWorkspaceMemberInvitePathParams = {
1478
+ /**
1479
+ * Workspace ID
1480
+ */
903
1481
  workspaceId: WorkspaceID;
1482
+ /**
1483
+ * Invite Key (secret) for the invited user
1484
+ */
904
1485
  inviteKey: InviteKey;
905
1486
  };
906
1487
  declare type AcceptWorkspaceMemberInviteError = ErrorWrapper<{
@@ -938,6 +1519,9 @@ declare type GetDatabaseListVariables = {
938
1519
  */
939
1520
  declare const getDatabaseList: (variables: GetDatabaseListVariables) => Promise<ListDatabasesResponse>;
940
1521
  declare type GetBranchListPathParams = {
1522
+ /**
1523
+ * The Database Name
1524
+ */
941
1525
  dbName: DBName;
942
1526
  workspace: string;
943
1527
  };
@@ -959,6 +1543,9 @@ declare type GetBranchListVariables = {
959
1543
  */
960
1544
  declare const getBranchList: (variables: GetBranchListVariables) => Promise<ListBranchesResponse>;
961
1545
  declare type CreateDatabasePathParams = {
1546
+ /**
1547
+ * The Database Name
1548
+ */
962
1549
  dbName: DBName;
963
1550
  workspace: string;
964
1551
  };
@@ -970,11 +1557,16 @@ declare type CreateDatabaseError = ErrorWrapper<{
970
1557
  payload: AuthError;
971
1558
  }>;
972
1559
  declare type CreateDatabaseResponse = {
1560
+ /**
1561
+ * @minLength 1
1562
+ */
973
1563
  databaseName: string;
974
1564
  branchName?: string;
975
1565
  };
976
1566
  declare type CreateDatabaseRequestBody = {
977
- displayName?: string;
1567
+ /**
1568
+ * @minLength 1
1569
+ */
978
1570
  branchName?: string;
979
1571
  ui?: {
980
1572
  color?: string;
@@ -990,10 +1582,535 @@ declare type CreateDatabaseVariables = {
990
1582
  */
991
1583
  declare const createDatabase: (variables: CreateDatabaseVariables) => Promise<CreateDatabaseResponse>;
992
1584
  declare type DeleteDatabasePathParams = {
1585
+ /**
1586
+ * The Database Name
1587
+ */
1588
+ dbName: DBName;
1589
+ workspace: string;
1590
+ };
1591
+ declare type DeleteDatabaseError = ErrorWrapper<{
1592
+ status: 400;
1593
+ payload: BadRequestError;
1594
+ } | {
1595
+ status: 401;
1596
+ payload: AuthError;
1597
+ } | {
1598
+ status: 404;
1599
+ payload: SimpleError;
1600
+ }>;
1601
+ declare type DeleteDatabaseVariables = {
1602
+ pathParams: DeleteDatabasePathParams;
1603
+ } & FetcherExtraProps;
1604
+ /**
1605
+ * Delete a database and all of its branches and tables permanently.
1606
+ */
1607
+ declare const deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
1608
+ declare type GetDatabaseMetadataPathParams = {
1609
+ /**
1610
+ * The Database Name
1611
+ */
1612
+ dbName: DBName;
1613
+ workspace: string;
1614
+ };
1615
+ declare type GetDatabaseMetadataError = ErrorWrapper<{
1616
+ status: 400;
1617
+ payload: BadRequestError;
1618
+ } | {
1619
+ status: 401;
1620
+ payload: AuthError;
1621
+ } | {
1622
+ status: 404;
1623
+ payload: SimpleError;
1624
+ }>;
1625
+ declare type GetDatabaseMetadataVariables = {
1626
+ pathParams: GetDatabaseMetadataPathParams;
1627
+ } & FetcherExtraProps;
1628
+ /**
1629
+ * Retrieve metadata of the given database
1630
+ */
1631
+ declare const getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
1632
+ declare type UpdateDatabaseMetadataPathParams = {
1633
+ /**
1634
+ * The Database Name
1635
+ */
1636
+ dbName: DBName;
1637
+ workspace: string;
1638
+ };
1639
+ declare type UpdateDatabaseMetadataError = ErrorWrapper<{
1640
+ status: 400;
1641
+ payload: BadRequestError;
1642
+ } | {
1643
+ status: 401;
1644
+ payload: AuthError;
1645
+ } | {
1646
+ status: 404;
1647
+ payload: SimpleError;
1648
+ }>;
1649
+ declare type UpdateDatabaseMetadataRequestBody = {
1650
+ ui?: {
1651
+ /**
1652
+ * @minLength 1
1653
+ */
1654
+ color?: string;
1655
+ };
1656
+ };
1657
+ declare type UpdateDatabaseMetadataVariables = {
1658
+ body?: UpdateDatabaseMetadataRequestBody;
1659
+ pathParams: UpdateDatabaseMetadataPathParams;
1660
+ } & FetcherExtraProps;
1661
+ /**
1662
+ * Update the color of the selected database
1663
+ */
1664
+ declare const updateDatabaseMetadata: (variables: UpdateDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
1665
+ declare type GetGitBranchesMappingPathParams = {
1666
+ /**
1667
+ * The Database Name
1668
+ */
1669
+ dbName: DBName;
1670
+ workspace: string;
1671
+ };
1672
+ declare type GetGitBranchesMappingError = ErrorWrapper<{
1673
+ status: 400;
1674
+ payload: BadRequestError;
1675
+ } | {
1676
+ status: 401;
1677
+ payload: AuthError;
1678
+ }>;
1679
+ declare type GetGitBranchesMappingVariables = {
1680
+ pathParams: GetGitBranchesMappingPathParams;
1681
+ } & FetcherExtraProps;
1682
+ /**
1683
+ * Lists all the git branches in the mapping, and their associated Xata branches.
1684
+ *
1685
+ * Example response:
1686
+ *
1687
+ * ```json
1688
+ * {
1689
+ * "mappings": [
1690
+ * {
1691
+ * "gitBranch": "main",
1692
+ * "xataBranch": "main"
1693
+ * },
1694
+ * {
1695
+ * "gitBranch": "gitBranch1",
1696
+ * "xataBranch": "xataBranch1"
1697
+ * }
1698
+ * {
1699
+ * "gitBranch": "xataBranch2",
1700
+ * "xataBranch": "xataBranch2"
1701
+ * }
1702
+ * ]
1703
+ * }
1704
+ * ```
1705
+ */
1706
+ declare const getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
1707
+ declare type AddGitBranchesEntryPathParams = {
1708
+ /**
1709
+ * The Database Name
1710
+ */
1711
+ dbName: DBName;
1712
+ workspace: string;
1713
+ };
1714
+ declare type AddGitBranchesEntryError = ErrorWrapper<{
1715
+ status: 400;
1716
+ payload: BadRequestError;
1717
+ } | {
1718
+ status: 401;
1719
+ payload: AuthError;
1720
+ }>;
1721
+ declare type AddGitBranchesEntryResponse = {
1722
+ /**
1723
+ * Warning message
1724
+ */
1725
+ warning?: string;
1726
+ };
1727
+ declare type AddGitBranchesEntryRequestBody = {
1728
+ /**
1729
+ * The name of the Git branch.
1730
+ */
1731
+ gitBranch: string;
1732
+ /**
1733
+ * The name of the Xata branch.
1734
+ */
1735
+ xataBranch: BranchName;
1736
+ };
1737
+ declare type AddGitBranchesEntryVariables = {
1738
+ body: AddGitBranchesEntryRequestBody;
1739
+ pathParams: AddGitBranchesEntryPathParams;
1740
+ } & FetcherExtraProps;
1741
+ /**
1742
+ * Adds an entry to the mapping of git branches to Xata branches. The git branch and the Xata branch must be present in the body of the request. If the Xata branch doesn't exist, a 400 error is returned.
1743
+ *
1744
+ * If the git branch is already present in the mapping, the old entry is overwritten, and a warning message is included in the response. If the git branch is added and didn't exist before, the response code is 204. If the git branch existed and it was overwritten, the response code is 201.
1745
+ *
1746
+ * Example request:
1747
+ *
1748
+ * ```json
1749
+ * // POST https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches
1750
+ * {
1751
+ * "gitBranch": "fix/bug123",
1752
+ * "xataBranch": "fix_bug"
1753
+ * }
1754
+ * ```
1755
+ */
1756
+ declare const addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
1757
+ declare type RemoveGitBranchesEntryPathParams = {
1758
+ /**
1759
+ * The Database Name
1760
+ */
1761
+ dbName: DBName;
1762
+ workspace: string;
1763
+ };
1764
+ declare type RemoveGitBranchesEntryQueryParams = {
1765
+ /**
1766
+ * The Git Branch to remove from the mapping
1767
+ */
1768
+ gitBranch: string;
1769
+ };
1770
+ declare type RemoveGitBranchesEntryError = ErrorWrapper<{
1771
+ status: 400;
1772
+ payload: BadRequestError;
1773
+ } | {
1774
+ status: 401;
1775
+ payload: AuthError;
1776
+ }>;
1777
+ declare type RemoveGitBranchesEntryVariables = {
1778
+ pathParams: RemoveGitBranchesEntryPathParams;
1779
+ queryParams: RemoveGitBranchesEntryQueryParams;
1780
+ } & FetcherExtraProps;
1781
+ /**
1782
+ * Removes an entry from the mapping of git branches to Xata branches. The name of the git branch must be passed as a query parameter. If the git branch is not found, the endpoint returns a 404 status code.
1783
+ *
1784
+ * Example request:
1785
+ *
1786
+ * ```json
1787
+ * // DELETE https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches?gitBranch=fix%2Fbug123
1788
+ * ```
1789
+ */
1790
+ declare const removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
1791
+ declare type ResolveBranchPathParams = {
1792
+ /**
1793
+ * The Database Name
1794
+ */
1795
+ dbName: DBName;
1796
+ workspace: string;
1797
+ };
1798
+ declare type ResolveBranchQueryParams = {
1799
+ /**
1800
+ * The Git Branch
1801
+ */
1802
+ gitBranch?: string;
1803
+ /**
1804
+ * Default branch to fallback to
1805
+ */
1806
+ fallbackBranch?: string;
1807
+ };
1808
+ declare type ResolveBranchError = ErrorWrapper<{
1809
+ status: 400;
1810
+ payload: BadRequestError;
1811
+ } | {
1812
+ status: 401;
1813
+ payload: AuthError;
1814
+ }>;
1815
+ declare type ResolveBranchResponse = {
1816
+ branch: string;
1817
+ reason: {
1818
+ code: 'FOUND_IN_MAPPING' | 'BRANCH_EXISTS' | 'FALLBACK_BRANCH' | 'DEFAULT_BRANCH';
1819
+ message: string;
1820
+ };
1821
+ };
1822
+ declare type ResolveBranchVariables = {
1823
+ pathParams: ResolveBranchPathParams;
1824
+ queryParams?: ResolveBranchQueryParams;
1825
+ } & FetcherExtraProps;
1826
+ /**
1827
+ * In order to resolve the database branch, the following algorithm is used:
1828
+ * * 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
1829
+ * * else, if a Xata branch with the exact same name as `gitBranch` exists, return it
1830
+ * * else, if `fallbackBranch` is provided and a branch with that name exists, return it
1831
+ * * else, return the default branch of the DB (`main` or the first branch)
1832
+ *
1833
+ * Example call:
1834
+ *
1835
+ * ```json
1836
+ * // GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test&fallbackBranch=tsg
1837
+ * ```
1838
+ *
1839
+ * Example response:
1840
+ *
1841
+ * ```json
1842
+ * {
1843
+ * "branch": "main",
1844
+ * "reason": {
1845
+ * "code": "DEFAULT_BRANCH",
1846
+ * "message": "Default branch for this database (main)"
1847
+ * }
1848
+ * }
1849
+ * ```
1850
+ */
1851
+ declare const resolveBranch: (variables: ResolveBranchVariables) => Promise<ResolveBranchResponse>;
1852
+ declare type ListMigrationRequestsPathParams = {
1853
+ /**
1854
+ * The Database Name
1855
+ */
1856
+ dbName: DBName;
1857
+ workspace: string;
1858
+ };
1859
+ declare type ListMigrationRequestsError = ErrorWrapper<{
1860
+ status: 400;
1861
+ payload: BadRequestError;
1862
+ } | {
1863
+ status: 401;
1864
+ payload: AuthError;
1865
+ } | {
1866
+ status: 404;
1867
+ payload: SimpleError;
1868
+ }>;
1869
+ declare type ListMigrationRequestsResponse = {
1870
+ migrationRequests: MigrationRequest[];
1871
+ meta: RecordsMetadata;
1872
+ };
1873
+ declare type ListMigrationRequestsRequestBody = {
1874
+ filter?: FilterExpression;
1875
+ sort?: SortExpression;
1876
+ page?: PageConfig;
1877
+ columns?: ColumnsProjection;
1878
+ };
1879
+ declare type ListMigrationRequestsVariables = {
1880
+ body?: ListMigrationRequestsRequestBody;
1881
+ pathParams: ListMigrationRequestsPathParams;
1882
+ } & FetcherExtraProps;
1883
+ declare const listMigrationRequests: (variables: ListMigrationRequestsVariables) => Promise<ListMigrationRequestsResponse>;
1884
+ declare type CreateMigrationRequestPathParams = {
1885
+ /**
1886
+ * The Database Name
1887
+ */
1888
+ dbName: DBName;
1889
+ workspace: string;
1890
+ };
1891
+ declare type CreateMigrationRequestError = ErrorWrapper<{
1892
+ status: 400;
1893
+ payload: BadRequestError;
1894
+ } | {
1895
+ status: 401;
1896
+ payload: AuthError;
1897
+ } | {
1898
+ status: 404;
1899
+ payload: SimpleError;
1900
+ }>;
1901
+ declare type CreateMigrationRequestResponse = {
1902
+ number: number;
1903
+ };
1904
+ declare type CreateMigrationRequestRequestBody = {
1905
+ /**
1906
+ * The source branch.
1907
+ */
1908
+ source: string;
1909
+ /**
1910
+ * The target branch.
1911
+ */
1912
+ target: string;
1913
+ /**
1914
+ * The title.
1915
+ */
1916
+ title: string;
1917
+ /**
1918
+ * Optional migration request description.
1919
+ */
1920
+ body?: string;
1921
+ };
1922
+ declare type CreateMigrationRequestVariables = {
1923
+ body: CreateMigrationRequestRequestBody;
1924
+ pathParams: CreateMigrationRequestPathParams;
1925
+ } & FetcherExtraProps;
1926
+ declare const createMigrationRequest: (variables: CreateMigrationRequestVariables) => Promise<CreateMigrationRequestResponse>;
1927
+ declare type GetMigrationRequestPathParams = {
1928
+ /**
1929
+ * The Database Name
1930
+ */
1931
+ dbName: DBName;
1932
+ /**
1933
+ * The migration request number.
1934
+ */
1935
+ mrNumber: number;
1936
+ workspace: string;
1937
+ };
1938
+ declare type GetMigrationRequestError = ErrorWrapper<{
1939
+ status: 400;
1940
+ payload: BadRequestError;
1941
+ } | {
1942
+ status: 401;
1943
+ payload: AuthError;
1944
+ } | {
1945
+ status: 404;
1946
+ payload: SimpleError;
1947
+ }>;
1948
+ declare type GetMigrationRequestVariables = {
1949
+ pathParams: GetMigrationRequestPathParams;
1950
+ } & FetcherExtraProps;
1951
+ declare const getMigrationRequest: (variables: GetMigrationRequestVariables) => Promise<MigrationRequest>;
1952
+ declare type UpdateMigrationRequestPathParams = {
1953
+ /**
1954
+ * The Database Name
1955
+ */
1956
+ dbName: DBName;
1957
+ /**
1958
+ * The migration request number.
1959
+ */
1960
+ mrNumber: number;
1961
+ workspace: string;
1962
+ };
1963
+ declare type UpdateMigrationRequestError = ErrorWrapper<{
1964
+ status: 400;
1965
+ payload: BadRequestError;
1966
+ } | {
1967
+ status: 401;
1968
+ payload: AuthError;
1969
+ } | {
1970
+ status: 404;
1971
+ payload: SimpleError;
1972
+ }>;
1973
+ declare type UpdateMigrationRequestRequestBody = {
1974
+ /**
1975
+ * New migration request title.
1976
+ */
1977
+ title?: string;
1978
+ /**
1979
+ * New migration request description.
1980
+ */
1981
+ body?: string;
1982
+ /**
1983
+ * Change the migration request status.
1984
+ */
1985
+ status?: 'open' | 'closed';
1986
+ };
1987
+ declare type UpdateMigrationRequestVariables = {
1988
+ body?: UpdateMigrationRequestRequestBody;
1989
+ pathParams: UpdateMigrationRequestPathParams;
1990
+ } & FetcherExtraProps;
1991
+ declare const updateMigrationRequest: (variables: UpdateMigrationRequestVariables) => Promise<undefined>;
1992
+ declare type ListMigrationRequestsCommitsPathParams = {
1993
+ /**
1994
+ * The Database Name
1995
+ */
1996
+ dbName: DBName;
1997
+ /**
1998
+ * The migration request number.
1999
+ */
2000
+ mrNumber: number;
2001
+ workspace: string;
2002
+ };
2003
+ declare type ListMigrationRequestsCommitsError = ErrorWrapper<{
2004
+ status: 400;
2005
+ payload: BadRequestError;
2006
+ } | {
2007
+ status: 401;
2008
+ payload: AuthError;
2009
+ } | {
2010
+ status: 404;
2011
+ payload: SimpleError;
2012
+ }>;
2013
+ declare type ListMigrationRequestsCommitsResponse = {
2014
+ meta: {
2015
+ /**
2016
+ * last record id
2017
+ */
2018
+ cursor: string;
2019
+ /**
2020
+ * true if more records can be fetch
2021
+ */
2022
+ more: boolean;
2023
+ };
2024
+ logs: Commit[];
2025
+ };
2026
+ declare type ListMigrationRequestsCommitsRequestBody = {
2027
+ page?: {
2028
+ /**
2029
+ * Query the next page that follow the cursor.
2030
+ */
2031
+ after?: string;
2032
+ /**
2033
+ * Query the previous page before the cursor.
2034
+ */
2035
+ before?: string;
2036
+ /**
2037
+ * 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.
2038
+ *
2039
+ * @default 20
2040
+ */
2041
+ size?: number;
2042
+ };
2043
+ };
2044
+ declare type ListMigrationRequestsCommitsVariables = {
2045
+ body?: ListMigrationRequestsCommitsRequestBody;
2046
+ pathParams: ListMigrationRequestsCommitsPathParams;
2047
+ } & FetcherExtraProps;
2048
+ declare const listMigrationRequestsCommits: (variables: ListMigrationRequestsCommitsVariables) => Promise<ListMigrationRequestsCommitsResponse>;
2049
+ declare type CompareMigrationRequestPathParams = {
2050
+ /**
2051
+ * The Database Name
2052
+ */
2053
+ dbName: DBName;
2054
+ /**
2055
+ * The migration request number.
2056
+ */
2057
+ mrNumber: number;
2058
+ workspace: string;
2059
+ };
2060
+ declare type CompareMigrationRequestError = ErrorWrapper<{
2061
+ status: 400;
2062
+ payload: BadRequestError;
2063
+ } | {
2064
+ status: 401;
2065
+ payload: AuthError;
2066
+ } | {
2067
+ status: 404;
2068
+ payload: SimpleError;
2069
+ }>;
2070
+ declare type CompareMigrationRequestVariables = {
2071
+ pathParams: CompareMigrationRequestPathParams;
2072
+ } & FetcherExtraProps;
2073
+ declare const compareMigrationRequest: (variables: CompareMigrationRequestVariables) => Promise<SchemaCompareResponse>;
2074
+ declare type GetMigrationRequestIsMergedPathParams = {
2075
+ /**
2076
+ * The Database Name
2077
+ */
2078
+ dbName: DBName;
2079
+ /**
2080
+ * The migration request number.
2081
+ */
2082
+ mrNumber: number;
2083
+ workspace: string;
2084
+ };
2085
+ declare type GetMigrationRequestIsMergedError = ErrorWrapper<{
2086
+ status: 400;
2087
+ payload: BadRequestError;
2088
+ } | {
2089
+ status: 401;
2090
+ payload: AuthError;
2091
+ } | {
2092
+ status: 404;
2093
+ payload: SimpleError;
2094
+ }>;
2095
+ declare type GetMigrationRequestIsMergedResponse = {
2096
+ merged?: boolean;
2097
+ };
2098
+ declare type GetMigrationRequestIsMergedVariables = {
2099
+ pathParams: GetMigrationRequestIsMergedPathParams;
2100
+ } & FetcherExtraProps;
2101
+ declare const getMigrationRequestIsMerged: (variables: GetMigrationRequestIsMergedVariables) => Promise<GetMigrationRequestIsMergedResponse>;
2102
+ declare type MergeMigrationRequestPathParams = {
2103
+ /**
2104
+ * The Database Name
2105
+ */
993
2106
  dbName: DBName;
2107
+ /**
2108
+ * The migration request number.
2109
+ */
2110
+ mrNumber: number;
994
2111
  workspace: string;
995
2112
  };
996
- declare type DeleteDatabaseError = ErrorWrapper<{
2113
+ declare type MergeMigrationRequestError = ErrorWrapper<{
997
2114
  status: 400;
998
2115
  payload: BadRequestError;
999
2116
  } | {
@@ -1003,14 +2120,14 @@ declare type DeleteDatabaseError = ErrorWrapper<{
1003
2120
  status: 404;
1004
2121
  payload: SimpleError;
1005
2122
  }>;
1006
- declare type DeleteDatabaseVariables = {
1007
- pathParams: DeleteDatabasePathParams;
2123
+ declare type MergeMigrationRequestVariables = {
2124
+ pathParams: MergeMigrationRequestPathParams;
1008
2125
  } & FetcherExtraProps;
1009
- /**
1010
- * Delete a database and all of its branches and tables permanently.
1011
- */
1012
- declare const deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
2126
+ declare const mergeMigrationRequest: (variables: MergeMigrationRequestVariables) => Promise<Commit>;
1013
2127
  declare type GetBranchDetailsPathParams = {
2128
+ /**
2129
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2130
+ */
1014
2131
  dbBranchName: DBBranchName;
1015
2132
  workspace: string;
1016
2133
  };
@@ -1029,10 +2146,16 @@ declare type GetBranchDetailsVariables = {
1029
2146
  } & FetcherExtraProps;
1030
2147
  declare const getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
1031
2148
  declare type CreateBranchPathParams = {
2149
+ /**
2150
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2151
+ */
1032
2152
  dbBranchName: DBBranchName;
1033
2153
  workspace: string;
1034
2154
  };
1035
2155
  declare type CreateBranchQueryParams = {
2156
+ /**
2157
+ * Name of source branch to branch the new schema from
2158
+ */
1036
2159
  from?: string;
1037
2160
  };
1038
2161
  declare type CreateBranchError = ErrorWrapper<{
@@ -1045,7 +2168,17 @@ declare type CreateBranchError = ErrorWrapper<{
1045
2168
  status: 404;
1046
2169
  payload: SimpleError;
1047
2170
  }>;
2171
+ declare type CreateBranchResponse = {
2172
+ /**
2173
+ * @minLength 1
2174
+ */
2175
+ databaseName: string;
2176
+ branchName: string;
2177
+ };
1048
2178
  declare type CreateBranchRequestBody = {
2179
+ /**
2180
+ * Select the branch to fork from. Defaults to 'main'
2181
+ */
1049
2182
  from?: string;
1050
2183
  metadata?: BranchMetadata;
1051
2184
  };
@@ -1054,8 +2187,11 @@ declare type CreateBranchVariables = {
1054
2187
  pathParams: CreateBranchPathParams;
1055
2188
  queryParams?: CreateBranchQueryParams;
1056
2189
  } & FetcherExtraProps;
1057
- declare const createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
2190
+ declare const createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
1058
2191
  declare type DeleteBranchPathParams = {
2192
+ /**
2193
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2194
+ */
1059
2195
  dbBranchName: DBBranchName;
1060
2196
  workspace: string;
1061
2197
  };
@@ -1077,6 +2213,9 @@ declare type DeleteBranchVariables = {
1077
2213
  */
1078
2214
  declare const deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
1079
2215
  declare type UpdateBranchMetadataPathParams = {
2216
+ /**
2217
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2218
+ */
1080
2219
  dbBranchName: DBBranchName;
1081
2220
  workspace: string;
1082
2221
  };
@@ -1099,6 +2238,9 @@ declare type UpdateBranchMetadataVariables = {
1099
2238
  */
1100
2239
  declare const updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
1101
2240
  declare type GetBranchMetadataPathParams = {
2241
+ /**
2242
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2243
+ */
1102
2244
  dbBranchName: DBBranchName;
1103
2245
  workspace: string;
1104
2246
  };
@@ -1117,6 +2259,9 @@ declare type GetBranchMetadataVariables = {
1117
2259
  } & FetcherExtraProps;
1118
2260
  declare const getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
1119
2261
  declare type GetBranchMigrationHistoryPathParams = {
2262
+ /**
2263
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2264
+ */
1120
2265
  dbBranchName: DBBranchName;
1121
2266
  workspace: string;
1122
2267
  };
@@ -1144,6 +2289,9 @@ declare type GetBranchMigrationHistoryVariables = {
1144
2289
  } & FetcherExtraProps;
1145
2290
  declare const getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
1146
2291
  declare type ExecuteBranchMigrationPlanPathParams = {
2292
+ /**
2293
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2294
+ */
1147
2295
  dbBranchName: DBBranchName;
1148
2296
  workspace: string;
1149
2297
  };
@@ -1170,6 +2318,9 @@ declare type ExecuteBranchMigrationPlanVariables = {
1170
2318
  */
1171
2319
  declare const executeBranchMigrationPlan: (variables: ExecuteBranchMigrationPlanVariables) => Promise<undefined>;
1172
2320
  declare type GetBranchMigrationPlanPathParams = {
2321
+ /**
2322
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2323
+ */
1173
2324
  dbBranchName: DBBranchName;
1174
2325
  workspace: string;
1175
2326
  };
@@ -1191,7 +2342,199 @@ declare type GetBranchMigrationPlanVariables = {
1191
2342
  * Compute a migration plan from a target schema the branch should be migrated too.
1192
2343
  */
1193
2344
  declare const getBranchMigrationPlan: (variables: GetBranchMigrationPlanVariables) => Promise<BranchMigrationPlan>;
2345
+ declare type CompareBranchWithUserSchemaPathParams = {
2346
+ /**
2347
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2348
+ */
2349
+ dbBranchName: DBBranchName;
2350
+ workspace: string;
2351
+ };
2352
+ declare type CompareBranchWithUserSchemaError = ErrorWrapper<{
2353
+ status: 400;
2354
+ payload: BadRequestError;
2355
+ } | {
2356
+ status: 401;
2357
+ payload: AuthError;
2358
+ } | {
2359
+ status: 404;
2360
+ payload: SimpleError;
2361
+ }>;
2362
+ declare type CompareBranchWithUserSchemaRequestBody = {
2363
+ schema: Schema;
2364
+ };
2365
+ declare type CompareBranchWithUserSchemaVariables = {
2366
+ body: CompareBranchWithUserSchemaRequestBody;
2367
+ pathParams: CompareBranchWithUserSchemaPathParams;
2368
+ } & FetcherExtraProps;
2369
+ declare const compareBranchWithUserSchema: (variables: CompareBranchWithUserSchemaVariables) => Promise<SchemaCompareResponse>;
2370
+ declare type CompareBranchSchemasPathParams = {
2371
+ /**
2372
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2373
+ */
2374
+ dbBranchName: DBBranchName;
2375
+ /**
2376
+ * The Database Name
2377
+ */
2378
+ branchName: BranchName;
2379
+ workspace: string;
2380
+ };
2381
+ declare type CompareBranchSchemasError = ErrorWrapper<{
2382
+ status: 400;
2383
+ payload: BadRequestError;
2384
+ } | {
2385
+ status: 401;
2386
+ payload: AuthError;
2387
+ } | {
2388
+ status: 404;
2389
+ payload: SimpleError;
2390
+ }>;
2391
+ declare type CompareBranchSchemasVariables = {
2392
+ body?: Record<string, any>;
2393
+ pathParams: CompareBranchSchemasPathParams;
2394
+ } & FetcherExtraProps;
2395
+ declare const compareBranchSchemas: (variables: CompareBranchSchemasVariables) => Promise<SchemaCompareResponse>;
2396
+ declare type UpdateBranchSchemaPathParams = {
2397
+ /**
2398
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2399
+ */
2400
+ dbBranchName: DBBranchName;
2401
+ workspace: string;
2402
+ };
2403
+ declare type UpdateBranchSchemaError = ErrorWrapper<{
2404
+ status: 400;
2405
+ payload: BadRequestError;
2406
+ } | {
2407
+ status: 401;
2408
+ payload: AuthError;
2409
+ } | {
2410
+ status: 404;
2411
+ payload: SimpleError;
2412
+ }>;
2413
+ declare type UpdateBranchSchemaResponse = {
2414
+ id: string;
2415
+ parentID: string;
2416
+ };
2417
+ declare type UpdateBranchSchemaVariables = {
2418
+ body: Migration;
2419
+ pathParams: UpdateBranchSchemaPathParams;
2420
+ } & FetcherExtraProps;
2421
+ declare const updateBranchSchema: (variables: UpdateBranchSchemaVariables) => Promise<UpdateBranchSchemaResponse>;
2422
+ declare type PreviewBranchSchemaEditPathParams = {
2423
+ /**
2424
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2425
+ */
2426
+ dbBranchName: DBBranchName;
2427
+ workspace: string;
2428
+ };
2429
+ declare type PreviewBranchSchemaEditError = ErrorWrapper<{
2430
+ status: 400;
2431
+ payload: BadRequestError;
2432
+ } | {
2433
+ status: 401;
2434
+ payload: AuthError;
2435
+ } | {
2436
+ status: 404;
2437
+ payload: SimpleError;
2438
+ }>;
2439
+ declare type PreviewBranchSchemaEditResponse = {
2440
+ original: Schema;
2441
+ updated: Schema;
2442
+ };
2443
+ declare type PreviewBranchSchemaEditRequestBody = {
2444
+ edits?: SchemaEditScript;
2445
+ operations?: MigrationOp[];
2446
+ };
2447
+ declare type PreviewBranchSchemaEditVariables = {
2448
+ body?: PreviewBranchSchemaEditRequestBody;
2449
+ pathParams: PreviewBranchSchemaEditPathParams;
2450
+ } & FetcherExtraProps;
2451
+ declare const previewBranchSchemaEdit: (variables: PreviewBranchSchemaEditVariables) => Promise<PreviewBranchSchemaEditResponse>;
2452
+ declare type ApplyBranchSchemaEditPathParams = {
2453
+ /**
2454
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2455
+ */
2456
+ dbBranchName: DBBranchName;
2457
+ workspace: string;
2458
+ };
2459
+ declare type ApplyBranchSchemaEditError = ErrorWrapper<{
2460
+ status: 400;
2461
+ payload: BadRequestError;
2462
+ } | {
2463
+ status: 401;
2464
+ payload: AuthError;
2465
+ } | {
2466
+ status: 404;
2467
+ payload: SimpleError;
2468
+ }>;
2469
+ declare type ApplyBranchSchemaEditResponse = {
2470
+ id: string;
2471
+ parentID: string;
2472
+ };
2473
+ declare type ApplyBranchSchemaEditRequestBody = {
2474
+ edits: SchemaEditScript;
2475
+ };
2476
+ declare type ApplyBranchSchemaEditVariables = {
2477
+ body: ApplyBranchSchemaEditRequestBody;
2478
+ pathParams: ApplyBranchSchemaEditPathParams;
2479
+ } & FetcherExtraProps;
2480
+ declare const applyBranchSchemaEdit: (variables: ApplyBranchSchemaEditVariables) => Promise<ApplyBranchSchemaEditResponse>;
2481
+ declare type GetBranchSchemaHistoryPathParams = {
2482
+ /**
2483
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2484
+ */
2485
+ dbBranchName: DBBranchName;
2486
+ workspace: string;
2487
+ };
2488
+ declare type GetBranchSchemaHistoryError = ErrorWrapper<{
2489
+ status: 400;
2490
+ payload: BadRequestError;
2491
+ } | {
2492
+ status: 401;
2493
+ payload: AuthError;
2494
+ } | {
2495
+ status: 404;
2496
+ payload: SimpleError;
2497
+ }>;
2498
+ declare type GetBranchSchemaHistoryResponse = {
2499
+ meta: {
2500
+ /**
2501
+ * last record id
2502
+ */
2503
+ cursor: string;
2504
+ /**
2505
+ * true if more records can be fetch
2506
+ */
2507
+ more: boolean;
2508
+ };
2509
+ logs: Commit[];
2510
+ };
2511
+ declare type GetBranchSchemaHistoryRequestBody = {
2512
+ page?: {
2513
+ /**
2514
+ * Query the next page that follow the cursor.
2515
+ */
2516
+ after?: string;
2517
+ /**
2518
+ * Query the previous page before the cursor.
2519
+ */
2520
+ before?: string;
2521
+ /**
2522
+ * 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.
2523
+ *
2524
+ * @default 20
2525
+ */
2526
+ size?: number;
2527
+ };
2528
+ };
2529
+ declare type GetBranchSchemaHistoryVariables = {
2530
+ body?: GetBranchSchemaHistoryRequestBody;
2531
+ pathParams: GetBranchSchemaHistoryPathParams;
2532
+ } & FetcherExtraProps;
2533
+ declare const getBranchSchemaHistory: (variables: GetBranchSchemaHistoryVariables) => Promise<GetBranchSchemaHistoryResponse>;
1194
2534
  declare type GetBranchStatsPathParams = {
2535
+ /**
2536
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2537
+ */
1195
2538
  dbBranchName: DBBranchName;
1196
2539
  workspace: string;
1197
2540
  };
@@ -1224,7 +2567,13 @@ declare type GetBranchStatsVariables = {
1224
2567
  */
1225
2568
  declare const getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
1226
2569
  declare type CreateTablePathParams = {
2570
+ /**
2571
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2572
+ */
1227
2573
  dbBranchName: DBBranchName;
2574
+ /**
2575
+ * The Table name
2576
+ */
1228
2577
  tableName: TableName;
1229
2578
  workspace: string;
1230
2579
  };
@@ -1241,15 +2590,28 @@ declare type CreateTableError = ErrorWrapper<{
1241
2590
  status: 422;
1242
2591
  payload: SimpleError;
1243
2592
  }>;
2593
+ declare type CreateTableResponse = {
2594
+ branchName: string;
2595
+ /**
2596
+ * @minLength 1
2597
+ */
2598
+ tableName: string;
2599
+ };
1244
2600
  declare type CreateTableVariables = {
1245
2601
  pathParams: CreateTablePathParams;
1246
2602
  } & FetcherExtraProps;
1247
2603
  /**
1248
2604
  * Creates a new table with the given name. Returns 422 if a table with the same name already exists.
1249
2605
  */
1250
- declare const createTable: (variables: CreateTableVariables) => Promise<undefined>;
2606
+ declare const createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
1251
2607
  declare type DeleteTablePathParams = {
2608
+ /**
2609
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2610
+ */
1252
2611
  dbBranchName: DBBranchName;
2612
+ /**
2613
+ * The Table name
2614
+ */
1253
2615
  tableName: TableName;
1254
2616
  workspace: string;
1255
2617
  };
@@ -1268,7 +2630,13 @@ declare type DeleteTableVariables = {
1268
2630
  */
1269
2631
  declare const deleteTable: (variables: DeleteTableVariables) => Promise<undefined>;
1270
2632
  declare type UpdateTablePathParams = {
2633
+ /**
2634
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2635
+ */
1271
2636
  dbBranchName: DBBranchName;
2637
+ /**
2638
+ * The Table name
2639
+ */
1272
2640
  tableName: TableName;
1273
2641
  workspace: string;
1274
2642
  };
@@ -1283,6 +2651,9 @@ declare type UpdateTableError = ErrorWrapper<{
1283
2651
  payload: SimpleError;
1284
2652
  }>;
1285
2653
  declare type UpdateTableRequestBody = {
2654
+ /**
2655
+ * @minLength 1
2656
+ */
1286
2657
  name: string;
1287
2658
  };
1288
2659
  declare type UpdateTableVariables = {
@@ -1304,7 +2675,13 @@ declare type UpdateTableVariables = {
1304
2675
  */
1305
2676
  declare const updateTable: (variables: UpdateTableVariables) => Promise<undefined>;
1306
2677
  declare type GetTableSchemaPathParams = {
2678
+ /**
2679
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2680
+ */
1307
2681
  dbBranchName: DBBranchName;
2682
+ /**
2683
+ * The Table name
2684
+ */
1308
2685
  tableName: TableName;
1309
2686
  workspace: string;
1310
2687
  };
@@ -1326,7 +2703,13 @@ declare type GetTableSchemaVariables = {
1326
2703
  } & FetcherExtraProps;
1327
2704
  declare const getTableSchema: (variables: GetTableSchemaVariables) => Promise<GetTableSchemaResponse>;
1328
2705
  declare type SetTableSchemaPathParams = {
2706
+ /**
2707
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2708
+ */
1329
2709
  dbBranchName: DBBranchName;
2710
+ /**
2711
+ * The Table name
2712
+ */
1330
2713
  tableName: TableName;
1331
2714
  workspace: string;
1332
2715
  };
@@ -1352,7 +2735,13 @@ declare type SetTableSchemaVariables = {
1352
2735
  } & FetcherExtraProps;
1353
2736
  declare const setTableSchema: (variables: SetTableSchemaVariables) => Promise<undefined>;
1354
2737
  declare type GetTableColumnsPathParams = {
2738
+ /**
2739
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2740
+ */
1355
2741
  dbBranchName: DBBranchName;
2742
+ /**
2743
+ * The Table name
2744
+ */
1356
2745
  tableName: TableName;
1357
2746
  workspace: string;
1358
2747
  };
@@ -1378,7 +2767,13 @@ declare type GetTableColumnsVariables = {
1378
2767
  */
1379
2768
  declare const getTableColumns: (variables: GetTableColumnsVariables) => Promise<GetTableColumnsResponse>;
1380
2769
  declare type AddTableColumnPathParams = {
2770
+ /**
2771
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2772
+ */
1381
2773
  dbBranchName: DBBranchName;
2774
+ /**
2775
+ * The Table name
2776
+ */
1382
2777
  tableName: TableName;
1383
2778
  workspace: string;
1384
2779
  };
@@ -1403,8 +2798,17 @@ declare type AddTableColumnVariables = {
1403
2798
  */
1404
2799
  declare const addTableColumn: (variables: AddTableColumnVariables) => Promise<MigrationIdResponse>;
1405
2800
  declare type GetColumnPathParams = {
2801
+ /**
2802
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2803
+ */
1406
2804
  dbBranchName: DBBranchName;
2805
+ /**
2806
+ * The Table name
2807
+ */
1407
2808
  tableName: TableName;
2809
+ /**
2810
+ * The Column name
2811
+ */
1408
2812
  columnName: ColumnName;
1409
2813
  workspace: string;
1410
2814
  };
@@ -1426,8 +2830,17 @@ declare type GetColumnVariables = {
1426
2830
  */
1427
2831
  declare const getColumn: (variables: GetColumnVariables) => Promise<Column>;
1428
2832
  declare type DeleteColumnPathParams = {
2833
+ /**
2834
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2835
+ */
1429
2836
  dbBranchName: DBBranchName;
2837
+ /**
2838
+ * The Table name
2839
+ */
1430
2840
  tableName: TableName;
2841
+ /**
2842
+ * The Column name
2843
+ */
1431
2844
  columnName: ColumnName;
1432
2845
  workspace: string;
1433
2846
  };
@@ -1449,8 +2862,17 @@ declare type DeleteColumnVariables = {
1449
2862
  */
1450
2863
  declare const deleteColumn: (variables: DeleteColumnVariables) => Promise<MigrationIdResponse>;
1451
2864
  declare type UpdateColumnPathParams = {
2865
+ /**
2866
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2867
+ */
1452
2868
  dbBranchName: DBBranchName;
2869
+ /**
2870
+ * The Table name
2871
+ */
1453
2872
  tableName: TableName;
2873
+ /**
2874
+ * The Column name
2875
+ */
1454
2876
  columnName: ColumnName;
1455
2877
  workspace: string;
1456
2878
  };
@@ -1465,6 +2887,9 @@ declare type UpdateColumnError = ErrorWrapper<{
1465
2887
  payload: SimpleError;
1466
2888
  }>;
1467
2889
  declare type UpdateColumnRequestBody = {
2890
+ /**
2891
+ * @minLength 1
2892
+ */
1468
2893
  name: string;
1469
2894
  };
1470
2895
  declare type UpdateColumnVariables = {
@@ -1476,10 +2901,22 @@ declare type UpdateColumnVariables = {
1476
2901
  */
1477
2902
  declare const updateColumn: (variables: UpdateColumnVariables) => Promise<MigrationIdResponse>;
1478
2903
  declare type InsertRecordPathParams = {
2904
+ /**
2905
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2906
+ */
1479
2907
  dbBranchName: DBBranchName;
2908
+ /**
2909
+ * The Table name
2910
+ */
1480
2911
  tableName: TableName;
1481
2912
  workspace: string;
1482
2913
  };
2914
+ declare type InsertRecordQueryParams = {
2915
+ /**
2916
+ * Column filters
2917
+ */
2918
+ columns?: ColumnsProjection;
2919
+ };
1483
2920
  declare type InsertRecordError = ErrorWrapper<{
1484
2921
  status: 400;
1485
2922
  payload: BadRequestError;
@@ -1490,27 +2927,35 @@ declare type InsertRecordError = ErrorWrapper<{
1490
2927
  status: 404;
1491
2928
  payload: SimpleError;
1492
2929
  }>;
1493
- declare type InsertRecordResponse = {
1494
- id: string;
1495
- xata: {
1496
- version: number;
1497
- };
1498
- };
1499
2930
  declare type InsertRecordVariables = {
1500
2931
  body?: Record<string, any>;
1501
2932
  pathParams: InsertRecordPathParams;
2933
+ queryParams?: InsertRecordQueryParams;
1502
2934
  } & FetcherExtraProps;
1503
2935
  /**
1504
2936
  * Insert a new Record into the Table
1505
2937
  */
1506
- declare const insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
2938
+ declare const insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
1507
2939
  declare type InsertRecordWithIDPathParams = {
2940
+ /**
2941
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2942
+ */
1508
2943
  dbBranchName: DBBranchName;
2944
+ /**
2945
+ * The Table name
2946
+ */
1509
2947
  tableName: TableName;
2948
+ /**
2949
+ * The Record name
2950
+ */
1510
2951
  recordId: RecordID;
1511
2952
  workspace: string;
1512
2953
  };
1513
2954
  declare type InsertRecordWithIDQueryParams = {
2955
+ /**
2956
+ * Column filters
2957
+ */
2958
+ columns?: ColumnsProjection;
1514
2959
  createOnly?: boolean;
1515
2960
  ifVersion?: number;
1516
2961
  };
@@ -1537,12 +2982,25 @@ declare type InsertRecordWithIDVariables = {
1537
2982
  */
1538
2983
  declare const insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
1539
2984
  declare type UpdateRecordWithIDPathParams = {
2985
+ /**
2986
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2987
+ */
1540
2988
  dbBranchName: DBBranchName;
2989
+ /**
2990
+ * The Table name
2991
+ */
1541
2992
  tableName: TableName;
2993
+ /**
2994
+ * The Record name
2995
+ */
1542
2996
  recordId: RecordID;
1543
2997
  workspace: string;
1544
2998
  };
1545
2999
  declare type UpdateRecordWithIDQueryParams = {
3000
+ /**
3001
+ * Column filters
3002
+ */
3003
+ columns?: ColumnsProjection;
1546
3004
  ifVersion?: number;
1547
3005
  };
1548
3006
  declare type UpdateRecordWithIDError = ErrorWrapper<{
@@ -1565,12 +3023,25 @@ declare type UpdateRecordWithIDVariables = {
1565
3023
  } & FetcherExtraProps;
1566
3024
  declare const updateRecordWithID: (variables: UpdateRecordWithIDVariables) => Promise<RecordUpdateResponse>;
1567
3025
  declare type UpsertRecordWithIDPathParams = {
3026
+ /**
3027
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
3028
+ */
1568
3029
  dbBranchName: DBBranchName;
3030
+ /**
3031
+ * The Table name
3032
+ */
1569
3033
  tableName: TableName;
3034
+ /**
3035
+ * The Record name
3036
+ */
1570
3037
  recordId: RecordID;
1571
3038
  workspace: string;
1572
3039
  };
1573
3040
  declare type UpsertRecordWithIDQueryParams = {
3041
+ /**
3042
+ * Column filters
3043
+ */
3044
+ columns?: ColumnsProjection;
1574
3045
  ifVersion?: number;
1575
3046
  };
1576
3047
  declare type UpsertRecordWithIDError = ErrorWrapper<{
@@ -1593,11 +3064,26 @@ declare type UpsertRecordWithIDVariables = {
1593
3064
  } & FetcherExtraProps;
1594
3065
  declare const upsertRecordWithID: (variables: UpsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
1595
3066
  declare type DeleteRecordPathParams = {
3067
+ /**
3068
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
3069
+ */
1596
3070
  dbBranchName: DBBranchName;
3071
+ /**
3072
+ * The Table name
3073
+ */
1597
3074
  tableName: TableName;
3075
+ /**
3076
+ * The Record name
3077
+ */
1598
3078
  recordId: RecordID;
1599
3079
  workspace: string;
1600
3080
  };
3081
+ declare type DeleteRecordQueryParams = {
3082
+ /**
3083
+ * Column filters
3084
+ */
3085
+ columns?: ColumnsProjection;
3086
+ };
1601
3087
  declare type DeleteRecordError = ErrorWrapper<{
1602
3088
  status: 400;
1603
3089
  payload: BadRequestError;
@@ -1610,14 +3096,30 @@ declare type DeleteRecordError = ErrorWrapper<{
1610
3096
  }>;
1611
3097
  declare type DeleteRecordVariables = {
1612
3098
  pathParams: DeleteRecordPathParams;
3099
+ queryParams?: DeleteRecordQueryParams;
1613
3100
  } & FetcherExtraProps;
1614
- declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
3101
+ declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
1615
3102
  declare type GetRecordPathParams = {
3103
+ /**
3104
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
3105
+ */
1616
3106
  dbBranchName: DBBranchName;
3107
+ /**
3108
+ * The Table name
3109
+ */
1617
3110
  tableName: TableName;
3111
+ /**
3112
+ * The Record name
3113
+ */
1618
3114
  recordId: RecordID;
1619
3115
  workspace: string;
1620
3116
  };
3117
+ declare type GetRecordQueryParams = {
3118
+ /**
3119
+ * Column filters
3120
+ */
3121
+ columns?: ColumnsProjection;
3122
+ };
1621
3123
  declare type GetRecordError = ErrorWrapper<{
1622
3124
  status: 400;
1623
3125
  payload: BadRequestError;
@@ -1628,22 +3130,31 @@ declare type GetRecordError = ErrorWrapper<{
1628
3130
  status: 404;
1629
3131
  payload: SimpleError;
1630
3132
  }>;
1631
- declare type GetRecordRequestBody = {
1632
- columns?: ColumnsFilter;
1633
- };
1634
3133
  declare type GetRecordVariables = {
1635
- body?: GetRecordRequestBody;
1636
3134
  pathParams: GetRecordPathParams;
3135
+ queryParams?: GetRecordQueryParams;
1637
3136
  } & FetcherExtraProps;
1638
3137
  /**
1639
3138
  * Retrieve record by ID
1640
3139
  */
1641
3140
  declare const getRecord: (variables: GetRecordVariables) => Promise<XataRecord$1>;
1642
3141
  declare type BulkInsertTableRecordsPathParams = {
3142
+ /**
3143
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
3144
+ */
1643
3145
  dbBranchName: DBBranchName;
3146
+ /**
3147
+ * The Table name
3148
+ */
1644
3149
  tableName: TableName;
1645
3150
  workspace: string;
1646
3151
  };
3152
+ declare type BulkInsertTableRecordsQueryParams = {
3153
+ /**
3154
+ * Column filters
3155
+ */
3156
+ columns?: ColumnsProjection;
3157
+ };
1647
3158
  declare type BulkInsertTableRecordsError = ErrorWrapper<{
1648
3159
  status: 400;
1649
3160
  payload: BulkError;
@@ -1653,23 +3164,30 @@ declare type BulkInsertTableRecordsError = ErrorWrapper<{
1653
3164
  } | {
1654
3165
  status: 404;
1655
3166
  payload: SimpleError;
3167
+ } | {
3168
+ status: 422;
3169
+ payload: SimpleError;
1656
3170
  }>;
1657
- declare type BulkInsertTableRecordsResponse = {
1658
- recordIDs: string[];
1659
- };
1660
3171
  declare type BulkInsertTableRecordsRequestBody = {
1661
3172
  records: Record<string, any>[];
1662
3173
  };
1663
3174
  declare type BulkInsertTableRecordsVariables = {
1664
3175
  body: BulkInsertTableRecordsRequestBody;
1665
3176
  pathParams: BulkInsertTableRecordsPathParams;
3177
+ queryParams?: BulkInsertTableRecordsQueryParams;
1666
3178
  } & FetcherExtraProps;
1667
3179
  /**
1668
3180
  * Bulk insert records
1669
3181
  */
1670
- declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
3182
+ declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
1671
3183
  declare type QueryTablePathParams = {
3184
+ /**
3185
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
3186
+ */
1672
3187
  dbBranchName: DBBranchName;
3188
+ /**
3189
+ * The Table name
3190
+ */
1673
3191
  tableName: TableName;
1674
3192
  workspace: string;
1675
3193
  };
@@ -1687,7 +3205,7 @@ declare type QueryTableRequestBody = {
1687
3205
  filter?: FilterExpression;
1688
3206
  sort?: SortExpression;
1689
3207
  page?: PageConfig;
1690
- columns?: ColumnsFilter;
3208
+ columns?: ColumnsProjection;
1691
3209
  };
1692
3210
  declare type QueryTableVariables = {
1693
3211
  body?: QueryTableRequestBody;
@@ -1723,8 +3241,9 @@ declare type QueryTableVariables = {
1723
3241
  * If the `columns` array is not specified, all columns are included. For link
1724
3242
  * fields, only the ID column of the linked records is included in the response.
1725
3243
  *
1726
- * If the `columns` array is specified, only the selected columns are included.
1727
- * The `*` wildcard can be used to select all columns of the given array
3244
+ * If the `columns` array is specified, only the selected and internal
3245
+ * columns `id` and `xata` are included. The `*` wildcard can be used to
3246
+ * select all columns.
1728
3247
  *
1729
3248
  * For objects and link fields, if the column name of the object is specified, we
1730
3249
  * include all of its sub-keys. If only some sub-keys are specified (via dotted
@@ -1750,7 +3269,11 @@ declare type QueryTableVariables = {
1750
3269
  * "link": {
1751
3270
  * "table": "users"
1752
3271
  * }
1753
- * }
3272
+ * },
3273
+ * {
3274
+ * "name": "foundedDate",
3275
+ * "type": "datetime"
3276
+ * },
1754
3277
  * ]
1755
3278
  * },
1756
3279
  * {
@@ -1836,6 +3359,10 @@ declare type QueryTableVariables = {
1836
3359
  *
1837
3360
  * ```json
1838
3361
  * {
3362
+ * "id": "id1"
3363
+ * "xata": {
3364
+ * "version": 0
3365
+ * }
1839
3366
  * "name": "Kilian",
1840
3367
  * "address": {
1841
3368
  * "street": "New street"
@@ -1855,6 +3382,10 @@ declare type QueryTableVariables = {
1855
3382
  *
1856
3383
  * ```json
1857
3384
  * {
3385
+ * "id": "id1"
3386
+ * "xata": {
3387
+ * "version": 0
3388
+ * }
1858
3389
  * "name": "Kilian",
1859
3390
  * "email": "kilian@gmail.com",
1860
3391
  * "address": {
@@ -1884,6 +3415,10 @@ declare type QueryTableVariables = {
1884
3415
  *
1885
3416
  * ```json
1886
3417
  * {
3418
+ * "id": "id1"
3419
+ * "xata": {
3420
+ * "version": 0
3421
+ * }
1887
3422
  * "name": "Kilian",
1888
3423
  * "email": "kilian@gmail.com",
1889
3424
  * "address": {
@@ -1897,7 +3432,8 @@ declare type QueryTableVariables = {
1897
3432
  * "version": 0
1898
3433
  * },
1899
3434
  * "name": "first team",
1900
- * "code": "A1"
3435
+ * "code": "A1",
3436
+ * "foundedDate": "2020-03-04T10:43:54.32Z"
1901
3437
  * }
1902
3438
  * }
1903
3439
  * ```
@@ -1912,7 +3448,7 @@ declare type QueryTableVariables = {
1912
3448
  * `$none`, etc.
1913
3449
  *
1914
3450
  * All operators start with an `$` to differentiate them from column names
1915
- * (which are not allowed to start with an dollar sign).
3451
+ * (which are not allowed to start with a dollar sign).
1916
3452
  *
1917
3453
  * #### Exact matching and control operators
1918
3454
  *
@@ -2092,12 +3628,18 @@ declare type QueryTableVariables = {
2092
3628
  * {
2093
3629
  * "filter": {
2094
3630
  * "<column_name>": {
2095
- * "$pattern": "v*alue*"
3631
+ * "$pattern": "v*alu?"
2096
3632
  * }
2097
3633
  * }
2098
3634
  * }
2099
3635
  * ```
2100
3636
  *
3637
+ * The `$pattern` operator accepts two wildcard characters:
3638
+ * * `*` matches zero or more characters
3639
+ * * `?` matches exactly one character
3640
+ *
3641
+ * 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.
3642
+ *
2101
3643
  * We could also have `$endsWith` and `$startsWith` operators:
2102
3644
  *
2103
3645
  * ```json
@@ -2113,7 +3655,7 @@ declare type QueryTableVariables = {
2113
3655
  * }
2114
3656
  * ```
2115
3657
  *
2116
- * #### Numeric ranges
3658
+ * #### Numeric or datetime ranges
2117
3659
  *
2118
3660
  * ```json
2119
3661
  * {
@@ -2125,7 +3667,18 @@ declare type QueryTableVariables = {
2125
3667
  * }
2126
3668
  * }
2127
3669
  * ```
2128
- *
3670
+ * Date ranges support the same operators, with the date using the format defined in
3671
+ * [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339):
3672
+ * ```json
3673
+ * {
3674
+ * "filter": {
3675
+ * "<column_name>": {
3676
+ * "$gt": "2019-10-12T07:20:50.52Z",
3677
+ * "$lt": "2021-10-12T07:20:50.52Z"
3678
+ * }
3679
+ * }
3680
+ * }
3681
+ * ```
2129
3682
  * The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
2130
3683
  *
2131
3684
  * #### Negations
@@ -2292,8 +3845,8 @@ declare type QueryTableVariables = {
2292
3845
  *
2293
3846
  * ### Pagination
2294
3847
  *
2295
- * We offer cursor pagination and offset pagination. The offset pagination is limited
2296
- * in the amount of data it can retrieve, so we recommend the cursor pagination if you have more than 1000 records.
3848
+ * We offer cursor pagination and offset pagination. For queries that are expected to return more than 1000 records,
3849
+ * cursor pagination is needed in order to retrieve all of their results. The offset pagination method is limited to 1000 records.
2297
3850
  *
2298
3851
  * Example of size + offset pagination:
2299
3852
  *
@@ -2393,7 +3946,57 @@ declare type QueryTableVariables = {
2393
3946
  * ```
2394
3947
  */
2395
3948
  declare const queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
3949
+ declare type SearchTablePathParams = {
3950
+ /**
3951
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
3952
+ */
3953
+ dbBranchName: DBBranchName;
3954
+ /**
3955
+ * The Table name
3956
+ */
3957
+ tableName: TableName;
3958
+ workspace: string;
3959
+ };
3960
+ declare type SearchTableError = ErrorWrapper<{
3961
+ status: 400;
3962
+ payload: BadRequestError;
3963
+ } | {
3964
+ status: 401;
3965
+ payload: AuthError;
3966
+ } | {
3967
+ status: 404;
3968
+ payload: SimpleError;
3969
+ }>;
3970
+ declare type SearchTableRequestBody = {
3971
+ /**
3972
+ * The query string.
3973
+ *
3974
+ * @minLength 1
3975
+ */
3976
+ query: string;
3977
+ fuzziness?: FuzzinessExpression;
3978
+ target?: TargetExpression;
3979
+ prefix?: PrefixExpression;
3980
+ filter?: FilterExpression;
3981
+ highlight?: HighlightExpression;
3982
+ boosters?: BoosterExpression[];
3983
+ };
3984
+ declare type SearchTableVariables = {
3985
+ body: SearchTableRequestBody;
3986
+ pathParams: SearchTablePathParams;
3987
+ } & FetcherExtraProps;
3988
+ /**
3989
+ * Run a free text search operation in a particular table.
3990
+ *
3991
+ * 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:
3992
+ * * filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of type `text`
3993
+ * * filtering on columns of type `multiple` is currently unsupported
3994
+ */
3995
+ declare const searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2396
3996
  declare type SearchBranchPathParams = {
3997
+ /**
3998
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
3999
+ */
2397
4000
  dbBranchName: DBBranchName;
2398
4001
  workspace: string;
2399
4002
  };
@@ -2408,9 +4011,27 @@ declare type SearchBranchError = ErrorWrapper<{
2408
4011
  payload: SimpleError;
2409
4012
  }>;
2410
4013
  declare type SearchBranchRequestBody = {
2411
- tables?: string[];
4014
+ /**
4015
+ * 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.
4016
+ */
4017
+ tables?: (string | {
4018
+ /**
4019
+ * The name of the table.
4020
+ */
4021
+ table: string;
4022
+ filter?: FilterExpression;
4023
+ target?: TargetExpression;
4024
+ boosters?: BoosterExpression[];
4025
+ })[];
4026
+ /**
4027
+ * The query string.
4028
+ *
4029
+ * @minLength 1
4030
+ */
2412
4031
  query: string;
2413
- fuzziness?: number;
4032
+ fuzziness?: FuzzinessExpression;
4033
+ prefix?: PrefixExpression;
4034
+ highlight?: HighlightExpression;
2414
4035
  };
2415
4036
  declare type SearchBranchVariables = {
2416
4037
  body: SearchBranchRequestBody;
@@ -2420,6 +4041,79 @@ declare type SearchBranchVariables = {
2420
4041
  * Run a free text search operation across the database branch.
2421
4042
  */
2422
4043
  declare const searchBranch: (variables: SearchBranchVariables) => Promise<SearchResponse>;
4044
+ declare type SummarizeTablePathParams = {
4045
+ /**
4046
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
4047
+ */
4048
+ dbBranchName: DBBranchName;
4049
+ /**
4050
+ * The Table name
4051
+ */
4052
+ tableName: TableName;
4053
+ workspace: string;
4054
+ };
4055
+ declare type SummarizeTableError = ErrorWrapper<{
4056
+ status: 400;
4057
+ payload: BadRequestError;
4058
+ } | {
4059
+ status: 401;
4060
+ payload: AuthError;
4061
+ } | {
4062
+ status: 404;
4063
+ payload: SimpleError;
4064
+ }>;
4065
+ declare type SummarizeTableRequestBody = {
4066
+ filters?: FilterExpression;
4067
+ columns?: ColumnsProjection;
4068
+ summaries?: SummaryExpressionList;
4069
+ sort?: SortExpression;
4070
+ };
4071
+ declare type SummarizeTableVariables = {
4072
+ body?: SummarizeTableRequestBody;
4073
+ pathParams: SummarizeTablePathParams;
4074
+ } & FetcherExtraProps;
4075
+ /**
4076
+ * This endpoint allows you to (optionally) define groups, and then to run
4077
+ * calculations on the values in each group. This is most helpful when you'd
4078
+ * like to understand the data you have in your database.
4079
+ *
4080
+ * A group is a combination of unique values. If you create a group for `sold_by`,
4081
+ * `product_name`, we will return one row for every combination of `sold_by` and
4082
+ * `product_name` you have in your database. When you want to calculate statistics,
4083
+ * you define these groups and ask Xata to calculate data on each group.
4084
+ *
4085
+ * **Some questions you can ask of your data:**
4086
+ *
4087
+ * How many records do I have in this table?
4088
+ * - Set `columns: []` as we we want data from the entire table, so we ask for no groups.
4089
+ * - Set `summaries: {"total": {"count": "*"}}` in order to see the count of all records.
4090
+ * We use `count: *` here we'd like to know the total amount of rows; ignoring whether
4091
+ * they are `null` or not.
4092
+ *
4093
+ * What are the top total sales for each product in July 2022?
4094
+ * - Set `filter: {soldAt: {"$ge": "2022-07-01T00:00:00.000Z", "$lt": "2022-08-01T00:00:00.000Z"}}` in order to limit the result set to sales recorded in July 2022.
4095
+ * - Set `columns: [product_name]` as we'd like to run calculations on each unique product
4096
+ * name in our table. Setting `columns` like this will produce one row per unique product
4097
+ * name.
4098
+ * - Set `summaries: {"total_sales": {"count": "product_name"}}` as we'd like to create a
4099
+ * field called "total_sales" for each group. This field will count all rows in each group
4100
+ * with non-null product names.
4101
+ * - Set `sort: [{"total_sales": "desc"}]` in order to bring the rows with the highest
4102
+ * total_sales field to the top.
4103
+ *
4104
+ * `columns`: tells Xata how to create each group. If you add `product_id` we will create
4105
+ * a new group for every unique `product_id`.
4106
+ *
4107
+ * `summaries`: tells Xata which calculations to run on each group.
4108
+ *
4109
+ * `sort`: tells Xata in which order you'd like to see results. You may sort by fields
4110
+ * specified in `columns` as well as the summary names defined in `summaries`.
4111
+ *
4112
+ * note: Sorting on summarized values can be slower on very large tables; this will impact
4113
+ * your rate limit significantly more than other queries. Try use `filter` [coming soon] to
4114
+ * reduce the amount of data being processed in order to reduce impact on your limits.
4115
+ */
4116
+ declare const summarizeTable: (variables: SummarizeTableVariables) => Promise<SummarizeResponse>;
2423
4117
  declare const operationsByTag: {
2424
4118
  users: {
2425
4119
  getUser: (variables: GetUserVariables) => Promise<UserWithID>;
@@ -2439,6 +4133,7 @@ declare const operationsByTag: {
2439
4133
  updateWorkspaceMemberRole: (variables: UpdateWorkspaceMemberRoleVariables) => Promise<undefined>;
2440
4134
  removeWorkspaceMember: (variables: RemoveWorkspaceMemberVariables) => Promise<undefined>;
2441
4135
  inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<WorkspaceInvite>;
4136
+ updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
2442
4137
  cancelWorkspaceMemberInvite: (variables: CancelWorkspaceMemberInviteVariables) => Promise<undefined>;
2443
4138
  resendWorkspaceMemberInvite: (variables: ResendWorkspaceMemberInviteVariables) => Promise<undefined>;
2444
4139
  acceptWorkspaceMemberInvite: (variables: AcceptWorkspaceMemberInviteVariables) => Promise<undefined>;
@@ -2447,21 +4142,45 @@ declare const operationsByTag: {
2447
4142
  getDatabaseList: (variables: GetDatabaseListVariables) => Promise<ListDatabasesResponse>;
2448
4143
  createDatabase: (variables: CreateDatabaseVariables) => Promise<CreateDatabaseResponse>;
2449
4144
  deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
4145
+ getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
4146
+ updateDatabaseMetadata: (variables: UpdateDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
4147
+ getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
4148
+ addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
4149
+ removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
4150
+ resolveBranch: (variables: ResolveBranchVariables) => Promise<ResolveBranchResponse>;
2450
4151
  };
2451
4152
  branch: {
2452
4153
  getBranchList: (variables: GetBranchListVariables) => Promise<ListBranchesResponse>;
2453
4154
  getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
2454
- createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
4155
+ createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
2455
4156
  deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
2456
4157
  updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
2457
4158
  getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
4159
+ getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
4160
+ };
4161
+ migrationRequests: {
4162
+ listMigrationRequests: (variables: ListMigrationRequestsVariables) => Promise<ListMigrationRequestsResponse>;
4163
+ createMigrationRequest: (variables: CreateMigrationRequestVariables) => Promise<CreateMigrationRequestResponse>;
4164
+ getMigrationRequest: (variables: GetMigrationRequestVariables) => Promise<MigrationRequest>;
4165
+ updateMigrationRequest: (variables: UpdateMigrationRequestVariables) => Promise<undefined>;
4166
+ listMigrationRequestsCommits: (variables: ListMigrationRequestsCommitsVariables) => Promise<ListMigrationRequestsCommitsResponse>;
4167
+ compareMigrationRequest: (variables: CompareMigrationRequestVariables) => Promise<SchemaCompareResponse>;
4168
+ getMigrationRequestIsMerged: (variables: GetMigrationRequestIsMergedVariables) => Promise<GetMigrationRequestIsMergedResponse>;
4169
+ mergeMigrationRequest: (variables: MergeMigrationRequestVariables) => Promise<Commit>;
4170
+ };
4171
+ branchSchema: {
2458
4172
  getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
2459
4173
  executeBranchMigrationPlan: (variables: ExecuteBranchMigrationPlanVariables) => Promise<undefined>;
2460
4174
  getBranchMigrationPlan: (variables: GetBranchMigrationPlanVariables) => Promise<BranchMigrationPlan>;
2461
- getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
4175
+ compareBranchWithUserSchema: (variables: CompareBranchWithUserSchemaVariables) => Promise<SchemaCompareResponse>;
4176
+ compareBranchSchemas: (variables: CompareBranchSchemasVariables) => Promise<SchemaCompareResponse>;
4177
+ updateBranchSchema: (variables: UpdateBranchSchemaVariables) => Promise<UpdateBranchSchemaResponse>;
4178
+ previewBranchSchemaEdit: (variables: PreviewBranchSchemaEditVariables) => Promise<PreviewBranchSchemaEditResponse>;
4179
+ applyBranchSchemaEdit: (variables: ApplyBranchSchemaEditVariables) => Promise<ApplyBranchSchemaEditResponse>;
4180
+ getBranchSchemaHistory: (variables: GetBranchSchemaHistoryVariables) => Promise<GetBranchSchemaHistoryResponse>;
2462
4181
  };
2463
4182
  table: {
2464
- createTable: (variables: CreateTableVariables) => Promise<undefined>;
4183
+ createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
2465
4184
  deleteTable: (variables: DeleteTableVariables) => Promise<undefined>;
2466
4185
  updateTable: (variables: UpdateTableVariables) => Promise<undefined>;
2467
4186
  getTableSchema: (variables: GetTableSchemaVariables) => Promise<GetTableSchemaResponse>;
@@ -2473,15 +4192,17 @@ declare const operationsByTag: {
2473
4192
  updateColumn: (variables: UpdateColumnVariables) => Promise<MigrationIdResponse>;
2474
4193
  };
2475
4194
  records: {
2476
- insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
4195
+ insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
2477
4196
  insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2478
4197
  updateRecordWithID: (variables: UpdateRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2479
4198
  upsertRecordWithID: (variables: UpsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2480
- deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
4199
+ deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
2481
4200
  getRecord: (variables: GetRecordVariables) => Promise<XataRecord$1>;
2482
- bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
4201
+ bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
2483
4202
  queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
4203
+ searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2484
4204
  searchBranch: (variables: SearchBranchVariables) => Promise<SearchResponse>;
4205
+ summarizeTable: (variables: SummarizeTableVariables) => Promise<SummarizeResponse>;
2485
4206
  };
2486
4207
  };
2487
4208
 
@@ -2496,6 +4217,7 @@ interface XataApiClientOptions {
2496
4217
  fetch?: FetchImpl;
2497
4218
  apiKey?: string;
2498
4219
  host?: HostProvider;
4220
+ trace?: TraceFunction;
2499
4221
  }
2500
4222
  declare class XataApiClient {
2501
4223
  #private;
@@ -2506,6 +4228,8 @@ declare class XataApiClient {
2506
4228
  get branches(): BranchApi;
2507
4229
  get tables(): TableApi;
2508
4230
  get records(): RecordsApi;
4231
+ get migrationRequests(): MigrationRequestsApi;
4232
+ get branchSchema(): BranchSchemaApi;
2509
4233
  }
2510
4234
  declare class UserApi {
2511
4235
  private extraProps;
@@ -2529,6 +4253,7 @@ declare class WorkspaceApi {
2529
4253
  updateWorkspaceMemberRole(workspaceId: WorkspaceID, userId: UserID, role: Role): Promise<void>;
2530
4254
  removeWorkspaceMember(workspaceId: WorkspaceID, userId: UserID): Promise<void>;
2531
4255
  inviteWorkspaceMember(workspaceId: WorkspaceID, email: string, role: Role): Promise<WorkspaceInvite>;
4256
+ updateWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID, role: Role): Promise<WorkspaceInvite>;
2532
4257
  cancelWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2533
4258
  resendWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2534
4259
  acceptWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteKey: InviteKey): Promise<void>;
@@ -2539,25 +4264,28 @@ declare class DatabaseApi {
2539
4264
  getDatabaseList(workspace: WorkspaceID): Promise<ListDatabasesResponse>;
2540
4265
  createDatabase(workspace: WorkspaceID, dbName: DBName, options?: CreateDatabaseRequestBody): Promise<CreateDatabaseResponse>;
2541
4266
  deleteDatabase(workspace: WorkspaceID, dbName: DBName): Promise<void>;
4267
+ getDatabaseMetadata(workspace: WorkspaceID, dbName: DBName): Promise<DatabaseMetadata>;
4268
+ updateDatabaseMetadata(workspace: WorkspaceID, dbName: DBName, options?: UpdateDatabaseMetadataRequestBody): Promise<DatabaseMetadata>;
4269
+ getGitBranchesMapping(workspace: WorkspaceID, dbName: DBName): Promise<ListGitBranchesResponse>;
4270
+ addGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, body: AddGitBranchesEntryRequestBody): Promise<AddGitBranchesEntryResponse>;
4271
+ removeGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<void>;
4272
+ resolveBranch(workspace: WorkspaceID, dbName: DBName, gitBranch?: string, fallbackBranch?: string): Promise<ResolveBranchResponse>;
2542
4273
  }
2543
4274
  declare class BranchApi {
2544
4275
  private extraProps;
2545
4276
  constructor(extraProps: FetcherExtraProps);
2546
4277
  getBranchList(workspace: WorkspaceID, dbName: DBName): Promise<ListBranchesResponse>;
2547
4278
  getBranchDetails(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<DBBranch>;
2548
- createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<void>;
4279
+ createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<CreateBranchResponse>;
2549
4280
  deleteBranch(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<void>;
2550
4281
  updateBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName, metadata?: BranchMetadata): Promise<void>;
2551
4282
  getBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<BranchMetadata>;
2552
- getBranchMigrationHistory(workspace: WorkspaceID, database: DBName, branch: BranchName, options?: GetBranchMigrationHistoryRequestBody): Promise<GetBranchMigrationHistoryResponse>;
2553
- executeBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, migrationPlan: ExecuteBranchMigrationPlanRequestBody): Promise<void>;
2554
- getBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, schema: Schema): Promise<BranchMigrationPlan>;
2555
4283
  getBranchStats(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<GetBranchStatsResponse>;
2556
4284
  }
2557
4285
  declare class TableApi {
2558
4286
  private extraProps;
2559
4287
  constructor(extraProps: FetcherExtraProps);
2560
- createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
4288
+ createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<CreateTableResponse>;
2561
4289
  deleteTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
2562
4290
  updateTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, options: UpdateTableRequestBody): Promise<void>;
2563
4291
  getTableSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<GetTableSchemaResponse>;
@@ -2571,15 +4299,42 @@ declare class TableApi {
2571
4299
  declare class RecordsApi {
2572
4300
  private extraProps;
2573
4301
  constructor(extraProps: FetcherExtraProps);
2574
- insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>): Promise<InsertRecordResponse>;
4302
+ insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>, options?: InsertRecordQueryParams): Promise<RecordUpdateResponse>;
2575
4303
  insertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: InsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2576
4304
  updateRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpdateRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2577
4305
  upsertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2578
- deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID): Promise<void>;
2579
- getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordRequestBody): Promise<XataRecord$1>;
2580
- bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[]): Promise<BulkInsertTableRecordsResponse>;
4306
+ deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: DeleteRecordQueryParams): Promise<RecordUpdateResponse>;
4307
+ getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordQueryParams): Promise<XataRecord$1>;
4308
+ bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[], options?: BulkInsertTableRecordsQueryParams): Promise<BulkInsertResponse>;
2581
4309
  queryTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: QueryTableRequestBody): Promise<QueryResponse>;
4310
+ searchTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: SearchTableRequestBody): Promise<SearchResponse>;
2582
4311
  searchBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, query: SearchBranchRequestBody): Promise<SearchResponse>;
4312
+ summarizeTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: SummarizeTableRequestBody): Promise<SummarizeResponse>;
4313
+ }
4314
+ declare class MigrationRequestsApi {
4315
+ private extraProps;
4316
+ constructor(extraProps: FetcherExtraProps);
4317
+ listMigrationRequests(workspace: WorkspaceID, database: DBName, options?: ListMigrationRequestsRequestBody): Promise<ListMigrationRequestsResponse>;
4318
+ createMigrationRequest(workspace: WorkspaceID, database: DBName, options: CreateMigrationRequestRequestBody): Promise<CreateMigrationRequestResponse>;
4319
+ getMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<MigrationRequest>;
4320
+ updateMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number, options: UpdateMigrationRequestRequestBody): Promise<void>;
4321
+ listMigrationRequestsCommits(workspace: WorkspaceID, database: DBName, migrationRequest: number, options?: ListMigrationRequestsCommitsRequestBody): Promise<ListMigrationRequestsCommitsResponse>;
4322
+ compareMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<SchemaCompareResponse>;
4323
+ getMigrationRequestIsMerged(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<GetMigrationRequestIsMergedResponse>;
4324
+ mergeMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<Commit>;
4325
+ }
4326
+ declare class BranchSchemaApi {
4327
+ private extraProps;
4328
+ constructor(extraProps: FetcherExtraProps);
4329
+ getBranchMigrationHistory(workspace: WorkspaceID, database: DBName, branch: BranchName, options?: GetBranchMigrationHistoryRequestBody): Promise<GetBranchMigrationHistoryResponse>;
4330
+ executeBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, migrationPlan: ExecuteBranchMigrationPlanRequestBody): Promise<void>;
4331
+ getBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, schema: Schema): Promise<BranchMigrationPlan>;
4332
+ compareBranchWithUserSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, schema: Schema): Promise<SchemaCompareResponse>;
4333
+ compareBranchSchemas(workspace: WorkspaceID, database: DBName, branch: BranchName, branchName: BranchName, schema: Schema): Promise<SchemaCompareResponse>;
4334
+ updateBranchSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, migration: Migration): Promise<UpdateBranchSchemaResponse>;
4335
+ previewBranchSchemaEdit(workspace: WorkspaceID, database: DBName, branch: BranchName, migration: Migration): Promise<PreviewBranchSchemaEditResponse>;
4336
+ applyBranchSchemaEdit(workspace: WorkspaceID, database: DBName, branch: BranchName, edits: SchemaEditScript): Promise<ApplyBranchSchemaEditResponse>;
4337
+ getBranchSchemaHistory(workspace: WorkspaceID, database: DBName, branch: BranchName, options?: GetBranchSchemaHistoryRequestBody): Promise<GetBranchSchemaHistoryResponse>;
2583
4338
  }
2584
4339
 
2585
4340
  declare class XataApiPlugin implements XataPlugin {
@@ -2592,28 +4347,29 @@ declare type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) ex
2592
4347
  declare type If<Condition, Then, Else> = Condition extends true ? Then : Else;
2593
4348
  declare type IsObject<T> = T extends Record<string, any> ? true : false;
2594
4349
  declare type IsArray<T> = T extends Array<any> ? true : false;
2595
- declare type NonEmptyArray<T> = T[] & {
2596
- 0: T;
2597
- };
2598
4350
  declare type RequiredBy<T, K extends keyof T> = T & {
2599
4351
  [P in K]-?: NonNullable<T[P]>;
2600
4352
  };
2601
4353
  declare type GetArrayInnerType<T extends readonly any[]> = T[number];
2602
4354
  declare type SingleOrArray<T> = T | T[];
2603
- declare type Dictionary<T> = Record<string, T>;
4355
+ declare type OmitBy<T, K extends keyof T> = T extends any ? Omit<T, K> : never;
4356
+ declare type Without<T, U> = {
4357
+ [P in Exclude<keyof T, keyof U>]?: never;
4358
+ };
4359
+ declare type ExclusiveOr<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
2604
4360
 
2605
4361
  declare type SelectableColumn<O, RecursivePath extends any[] = []> = '*' | 'id' | DataProps<O> | NestedColumns<O, RecursivePath>;
2606
- declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord & UnionToIntersection<Values<{
2607
- [K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord;
4362
+ declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord<O> & UnionToIntersection<Values<{
4363
+ [K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord<O>;
2608
4364
  }>>;
2609
- 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]> ? {
2610
- V: ValueAtColumn<O[K], V>;
2611
- } : never) : O[K]> : never : never;
4365
+ 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> ? {
4366
+ V: ValueAtColumn<Item, V>;
4367
+ } : never : O[K] : never> : never : never;
2612
4368
  declare type MAX_RECURSION = 5;
2613
4369
  declare type NestedColumns<O, RecursivePath extends any[]> = RecursivePath['length'] extends MAX_RECURSION ? never : If<IsObject<O>, Values<{
2614
- [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
2615
- 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
2616
- K>>;
4370
+ [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
4371
+ 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
4372
+ K>> : never;
2617
4373
  }>, never>;
2618
4374
  declare type DataProps<O> = Exclude<StringKeys<O>, StringKeys<XataRecord>>;
2619
4375
  declare type NestedValueAtColumn<O, Key extends SelectableColumn<O>> = Key extends `${infer N}.${infer M}` ? N extends DataProps<O> ? {
@@ -2640,56 +4396,67 @@ interface BaseData {
2640
4396
  /**
2641
4397
  * Represents a persisted record from the database.
2642
4398
  */
2643
- interface XataRecord extends Identifiable {
4399
+ interface XataRecord<OriginalRecord extends XataRecord<any> = XataRecord<any>> extends Identifiable {
2644
4400
  /**
2645
- * Metadata of this record.
4401
+ * Get metadata of this record.
2646
4402
  */
2647
- xata: {
2648
- /**
2649
- * Number that is increased every time the record is updated.
2650
- */
2651
- version: number;
2652
- };
4403
+ getMetadata(): XataRecordMetadata;
4404
+ /**
4405
+ * Retrieves a refreshed copy of the current record from the database.
4406
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
4407
+ * @returns The persisted record with the selected columns, null if not found.
4408
+ */
4409
+ read<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
2653
4410
  /**
2654
4411
  * Retrieves a refreshed copy of the current record from the database.
4412
+ * @returns The persisted record with all first level properties, null if not found.
4413
+ */
4414
+ read(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
4415
+ /**
4416
+ * Performs a partial update of the current record. On success a new object is
4417
+ * returned and the current object is not mutated.
4418
+ * @param partialUpdate The columns and their values that have to be updated.
4419
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
4420
+ * @returns The persisted record with the selected columns, null if not found.
2655
4421
  */
2656
- read(): Promise<Readonly<SelectedPick<this, ['*']>> | null>;
4422
+ update<K extends SelectableColumn<OriginalRecord>>(partialUpdate: Partial<EditableData<OriginalRecord>>, columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
2657
4423
  /**
2658
4424
  * Performs a partial update of the current record. On success a new object is
2659
4425
  * returned and the current object is not mutated.
2660
- * @param data The columns and their values that have to be updated.
2661
- * @returns A new record containing the latest values for all the columns of the current record.
4426
+ * @param partialUpdate The columns and their values that have to be updated.
4427
+ * @returns The persisted record with all first level properties, null if not found.
2662
4428
  */
2663
- update(partialUpdate: Partial<EditableData<Omit<this, keyof XataRecord>>>): Promise<Readonly<SelectedPick<this, ['*']>>>;
4429
+ update(partialUpdate: Partial<EditableData<OriginalRecord>>): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2664
4430
  /**
2665
4431
  * Performs a deletion of the current record in the database.
2666
- *
2667
- * @throws If the record was already deleted or if an error happened while performing the deletion.
4432
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
4433
+ * @returns The deleted record, null if not found.
2668
4434
  */
2669
- delete(): Promise<void>;
2670
- }
2671
- declare type Link<Record extends XataRecord> = Omit<XataRecord, 'read' | 'update'> & {
4435
+ delete<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
2672
4436
  /**
2673
- * Retrieves a refreshed copy of the current record from the database.
4437
+ * Performs a deletion of the current record in the database.
4438
+ * @returns The deleted record, null if not found.
4439
+
2674
4440
  */
2675
- read(): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4441
+ delete(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
4442
+ }
4443
+ declare type Link<Record extends XataRecord> = XataRecord<Record>;
4444
+ declare type XataRecordMetadata = {
2676
4445
  /**
2677
- * Performs a partial update of the current record. On success a new object is
2678
- * returned and the current object is not mutated.
2679
- * @param data The columns and their values that have to be updated.
2680
- * @returns A new record containing the latest values for all the columns of the current record.
4446
+ * Number that is increased every time the record is updated.
2681
4447
  */
2682
- update(partialUpdate: Partial<EditableData<Omit<Record, keyof XataRecord>>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4448
+ version: number;
4449
+ warnings?: string[];
2683
4450
  };
2684
4451
  declare function isIdentifiable(x: any): x is Identifiable & Record<string, unknown>;
2685
4452
  declare function isXataRecord(x: any): x is XataRecord & Record<string, unknown>;
2686
- declare type EditableData<O extends BaseData> = {
4453
+ declare type EditableData<O extends XataRecord> = Identifiable & Omit<{
2687
4454
  [K in keyof O]: O[K] extends XataRecord ? {
2688
4455
  id: string;
2689
- } : NonNullable<O[K]> extends XataRecord ? {
4456
+ } | string : NonNullable<O[K]> extends XataRecord ? {
2690
4457
  id: string;
2691
- } | null | undefined : O[K];
2692
- };
4458
+ } | string | null | undefined : O[K];
4459
+ }, keyof XataRecord>;
2693
4460
 
2694
4461
  /**
2695
4462
  * PropertyMatchFilter
@@ -2764,8 +4531,8 @@ declare type ValueTypeFilters<T> = T | T extends string ? StringTypeFilter : T e
2764
4531
  ],
2765
4532
  }
2766
4533
  */
2767
- declare type AggregatorFilter<Record> = {
2768
- [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<Record>>;
4534
+ declare type AggregatorFilter<T> = {
4535
+ [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<T>>;
2769
4536
  };
2770
4537
  /**
2771
4538
  * Existance filter
@@ -2780,10 +4547,104 @@ declare type BaseApiFilter<Record> = PropertyAccessFilter<Record> | AggregatorFi
2780
4547
  * Injects the Api filters on nested properties
2781
4548
  * Example: { filter: { settings: { plan: { $any: ['free', 'trial'] } } } }
2782
4549
  */
2783
- declare type NestedApiFilter<T> = T extends Record<string, any> ? {
4550
+ declare type NestedApiFilter<T> = {
2784
4551
  [key in keyof T]?: T[key] extends Record<string, any> ? SingleOrArray<Filter<T[key]>> : PropertyFilter<T[key]>;
2785
- } : PropertyFilter<T>;
2786
- declare type Filter<Record> = BaseApiFilter<Record> | NestedApiFilter<Record>;
4552
+ };
4553
+ 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>;
4554
+
4555
+ declare type DateBooster = {
4556
+ origin?: string;
4557
+ scale: string;
4558
+ decay: number;
4559
+ };
4560
+ declare type NumericBooster = {
4561
+ factor: number;
4562
+ };
4563
+ declare type ValueBooster<T extends string | number | boolean> = {
4564
+ value: T;
4565
+ factor: number;
4566
+ };
4567
+ declare type Boosters<O extends XataRecord> = Values<{
4568
+ [K in SelectableColumn<O>]: NonNullable<ValueAtColumn<O, K>> extends Date ? {
4569
+ dateBooster: {
4570
+ column: K;
4571
+ } & DateBooster;
4572
+ } : NonNullable<ValueAtColumn<O, K>> extends number ? ExclusiveOr<{
4573
+ numericBooster?: {
4574
+ column: K;
4575
+ } & NumericBooster;
4576
+ }, {
4577
+ valueBooster?: {
4578
+ column: K;
4579
+ } & ValueBooster<number>;
4580
+ }> : NonNullable<ValueAtColumn<O, K>> extends string | boolean ? {
4581
+ valueBooster: {
4582
+ column: K;
4583
+ } & ValueBooster<NonNullable<ValueAtColumn<O, K>>>;
4584
+ } : never;
4585
+ }>;
4586
+
4587
+ declare type TargetColumn<T extends XataRecord> = SelectableColumn<T> | {
4588
+ /**
4589
+ * The name of the column.
4590
+ */
4591
+ column: SelectableColumn<T>;
4592
+ /**
4593
+ * The weight of the column.
4594
+ *
4595
+ * @default 1
4596
+ * @maximum 10
4597
+ * @minimum 1
4598
+ */
4599
+ weight?: number;
4600
+ };
4601
+
4602
+ declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
4603
+ fuzziness?: FuzzinessExpression;
4604
+ prefix?: PrefixExpression;
4605
+ highlight?: HighlightExpression;
4606
+ tables?: Array<Tables | Values<{
4607
+ [Model in GetArrayInnerType<NonNullable<Tables[]>>]: {
4608
+ table: Model;
4609
+ target?: TargetColumn<Schemas[Model] & XataRecord>[];
4610
+ filter?: Filter<SelectedPick<Schemas[Model] & XataRecord, ['*']>>;
4611
+ boosters?: Boosters<Schemas[Model] & XataRecord>[];
4612
+ };
4613
+ }>>;
4614
+ };
4615
+ declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
4616
+ all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
4617
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]: {
4618
+ table: Model;
4619
+ record: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>>;
4620
+ };
4621
+ }>[]>;
4622
+ byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
4623
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]?: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>[]>;
4624
+ }>;
4625
+ };
4626
+ declare class SearchPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin {
4627
+ #private;
4628
+ private db;
4629
+ constructor(db: SchemaPluginResult<Schemas>, schemaTables?: Schemas.Table[]);
4630
+ build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
4631
+ }
4632
+ declare type SearchXataRecord<Record extends XataRecord> = Omit<Record, 'getMetadata'> & {
4633
+ getMetadata: () => XataRecordMetadata & SearchExtraProperties;
4634
+ };
4635
+ declare type SearchExtraProperties = {
4636
+ table: string;
4637
+ highlight?: {
4638
+ [key: string]: string[] | {
4639
+ [key: string]: any;
4640
+ };
4641
+ };
4642
+ score?: number;
4643
+ };
4644
+ declare type ReturnTable<Table, Tables> = Table extends Tables ? Table : never;
4645
+ 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 {
4646
+ table: infer Table;
4647
+ } ? ReturnTable<Table, Tables> : never;
2787
4648
 
2788
4649
  declare type SortDirection = 'asc' | 'desc';
2789
4650
  declare type SortFilterExtended<T extends XataRecord> = {
@@ -2795,13 +4656,21 @@ declare type SortFilterBase<T extends XataRecord> = {
2795
4656
  [Key in StringKeys<T>]: SortDirection;
2796
4657
  };
2797
4658
 
2798
- declare type QueryOptions<T extends XataRecord> = {
2799
- page?: PaginationOptions;
2800
- columns?: NonEmptyArray<SelectableColumn<T>>;
4659
+ declare type BaseOptions<T extends XataRecord> = {
4660
+ columns?: SelectableColumn<T>[];
4661
+ cache?: number;
4662
+ };
4663
+ declare type CursorQueryOptions = {
4664
+ pagination?: CursorNavigationOptions & OffsetNavigationOptions;
4665
+ filter?: never;
4666
+ sort?: never;
4667
+ };
4668
+ declare type OffsetQueryOptions<T extends XataRecord> = {
4669
+ pagination?: OffsetNavigationOptions;
2801
4670
  filter?: FilterExpression;
2802
4671
  sort?: SortFilter<T> | SortFilter<T>[];
2803
- cache?: number;
2804
4672
  };
4673
+ declare type QueryOptions<T extends XataRecord> = BaseOptions<T> & (CursorQueryOptions | OffsetQueryOptions<T>);
2805
4674
  /**
2806
4675
  * Query objects contain the information of all filters, sorting, etc. to be included in the database query.
2807
4676
  *
@@ -2811,8 +4680,11 @@ declare type QueryOptions<T extends XataRecord> = {
2811
4680
  declare class Query<Record extends XataRecord, Result extends XataRecord = Record> implements Paginable<Record, Result> {
2812
4681
  #private;
2813
4682
  readonly meta: PaginationQueryMeta;
2814
- readonly records: Result[];
2815
- constructor(repository: Repository<Record> | null, table: string, data: Partial<QueryOptions<Record>>, parent?: Partial<QueryOptions<Record>>);
4683
+ readonly records: RecordArray<Result>;
4684
+ constructor(repository: Repository<Record> | null, table: {
4685
+ name: string;
4686
+ schema?: Table;
4687
+ }, data: Partial<QueryOptions<Record>>, rawParent?: Partial<QueryOptions<Record>>);
2816
4688
  getQueryOptions(): QueryOptions<Record>;
2817
4689
  key(): string;
2818
4690
  /**
@@ -2844,73 +4716,203 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
2844
4716
  *
2845
4717
  * ```
2846
4718
  * query.filter("columnName", columnValue)
2847
- * query.filter({
2848
- * "columnName": columnValue
2849
- * })
4719
+ * query.filter("columnName", operator(columnValue)) // Use gt, gte, lt, lte, startsWith,...
4720
+ * ```
4721
+ *
4722
+ * @param column The name of the column to filter.
4723
+ * @param value The value to filter.
4724
+ * @returns A new Query object.
4725
+ */
4726
+ filter<F extends SelectableColumn<Record>>(column: F, value: Filter<NonNullable<ValueAtColumn<Record, F>>>): Query<Record, Result>;
4727
+ /**
4728
+ * Builds a new query object adding one or more constraints. Examples:
4729
+ *
4730
+ * ```
4731
+ * query.filter({ "columnName": columnValue })
2850
4732
  * query.filter({
2851
4733
  * "columnName": operator(columnValue) // Use gt, gte, lt, lte, startsWith,...
2852
4734
  * })
2853
4735
  * ```
2854
4736
  *
4737
+ * @param filters A filter object
2855
4738
  * @returns A new Query object.
2856
4739
  */
2857
- filter(filters: Filter<Record>): Query<Record, Result>;
2858
- filter<F extends SelectableColumn<Record>>(column: F, value: Filter<ValueAtColumn<Record, F>>): Query<Record, Result>;
4740
+ filter(filters?: Filter<Record>): Query<Record, Result>;
2859
4741
  /**
2860
4742
  * Builds a new query with a new sort option.
2861
4743
  * @param column The column name.
2862
4744
  * @param direction The direction. Either ascending or descending.
2863
4745
  * @returns A new Query object.
2864
4746
  */
2865
- sort<F extends SelectableColumn<Record>>(column: F, direction: SortDirection): Query<Record, Result>;
4747
+ sort<F extends SelectableColumn<Record>>(column: F, direction?: SortDirection): Query<Record, Result>;
2866
4748
  /**
2867
4749
  * Builds a new query specifying the set of columns to be returned in the query response.
2868
4750
  * @param columns Array of column names to be returned by the query.
2869
4751
  * @returns A new Query object.
2870
4752
  */
2871
- select<K extends SelectableColumn<Record>>(columns: NonEmptyArray<K>): Query<Record, SelectedPick<Record, NonEmptyArray<K>>>;
4753
+ select<K extends SelectableColumn<Record>>(columns: K[]): Query<Record, SelectedPick<Record, K[]>>;
4754
+ /**
4755
+ * Get paginated results
4756
+ *
4757
+ * @returns A page of results
4758
+ */
2872
4759
  getPaginated(): Promise<Page<Record, Result>>;
2873
- getPaginated(options: Omit<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
4760
+ /**
4761
+ * Get paginated results
4762
+ *
4763
+ * @param options Pagination options
4764
+ * @returns A page of results
4765
+ */
4766
+ getPaginated(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
4767
+ /**
4768
+ * Get paginated results
4769
+ *
4770
+ * @param options Pagination options
4771
+ * @returns A page of results
4772
+ */
2874
4773
  getPaginated<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<Page<Record, SelectedPick<Record, typeof options['columns']>>>;
4774
+ /**
4775
+ * Get results in an iterator
4776
+ *
4777
+ * @async
4778
+ * @returns Async interable of results
4779
+ */
2875
4780
  [Symbol.asyncIterator](): AsyncIterableIterator<Result>;
2876
- getIterator(chunk: number): AsyncGenerator<Result[]>;
2877
- getIterator(chunk: number, options: Omit<QueryOptions<Record>, 'columns' | 'page'>): AsyncGenerator<Result[]>;
2878
- getIterator<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(chunk: number, options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
2879
4781
  /**
2880
- * Performs the query in the database and returns a set of results.
4782
+ * Build an iterator of results
4783
+ *
4784
+ * @returns Async generator of results array
4785
+ */
4786
+ getIterator(): AsyncGenerator<Result[]>;
4787
+ /**
4788
+ * Build an iterator of results
4789
+ *
4790
+ * @param options Pagination options with batchSize
4791
+ * @returns Async generator of results array
4792
+ */
4793
+ getIterator(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
4794
+ batchSize?: number;
4795
+ }): AsyncGenerator<Result[]>;
4796
+ /**
4797
+ * Build an iterator of results
4798
+ *
4799
+ * @param options Pagination options with batchSize
4800
+ * @returns Async generator of results array
4801
+ */
4802
+ getIterator<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
4803
+ batchSize?: number;
4804
+ }>(options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
4805
+ /**
4806
+ * Performs the query in the database and returns a set of results.
4807
+ * @returns An array of records from the database.
4808
+ */
4809
+ getMany(): Promise<RecordArray<Result>>;
4810
+ /**
4811
+ * Performs the query in the database and returns a set of results.
4812
+ * @param options Additional options to be used when performing the query.
4813
+ * @returns An array of records from the database.
4814
+ */
4815
+ getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<RecordArray<SelectedPick<Record, typeof options['columns']>>>;
4816
+ /**
4817
+ * Performs the query in the database and returns a set of results.
4818
+ * @param options Additional options to be used when performing the query.
4819
+ * @returns An array of records from the database.
4820
+ */
4821
+ getMany(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<RecordArray<Result>>;
4822
+ /**
4823
+ * Performs the query in the database and returns all the results.
4824
+ * Warning: If there are a large number of results, this method can have performance implications.
4825
+ * @returns An array of records from the database.
4826
+ */
4827
+ getAll(): Promise<Result[]>;
4828
+ /**
4829
+ * Performs the query in the database and returns all the results.
4830
+ * Warning: If there are a large number of results, this method can have performance implications.
4831
+ * @param options Additional options to be used when performing the query.
4832
+ * @returns An array of records from the database.
4833
+ */
4834
+ getAll<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
4835
+ batchSize?: number;
4836
+ }>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
4837
+ /**
4838
+ * Performs the query in the database and returns all the results.
4839
+ * Warning: If there are a large number of results, this method can have performance implications.
4840
+ * @param options Additional options to be used when performing the query.
4841
+ * @returns An array of records from the database.
4842
+ */
4843
+ getAll(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
4844
+ batchSize?: number;
4845
+ }): Promise<Result[]>;
4846
+ /**
4847
+ * Performs the query in the database and returns the first result.
4848
+ * @returns The first record that matches the query, or null if no record matched the query.
4849
+ */
4850
+ getFirst(): Promise<Result | null>;
4851
+ /**
4852
+ * Performs the query in the database and returns the first result.
4853
+ * @param options Additional options to be used when performing the query.
4854
+ * @returns The first record that matches the query, or null if no record matched the query.
4855
+ */
4856
+ getFirst<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
4857
+ /**
4858
+ * Performs the query in the database and returns the first result.
2881
4859
  * @param options Additional options to be used when performing the query.
2882
- * @returns An array of records from the database.
4860
+ * @returns The first record that matches the query, or null if no record matched the query.
2883
4861
  */
2884
- getMany(): Promise<Result[]>;
2885
- getMany(options: Omit<QueryOptions<Record>, 'columns'>): Promise<Result[]>;
2886
- getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
4862
+ getFirst(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result | null>;
2887
4863
  /**
2888
- * Performs the query in the database and returns all the results.
2889
- * Warning: If there are a large number of results, this method can have performance implications.
4864
+ * Performs the query in the database and returns the first result.
4865
+ * @returns The first record that matches the query, or null if no record matched the query.
4866
+ * @throws if there are no results.
4867
+ */
4868
+ getFirstOrThrow(): Promise<Result>;
4869
+ /**
4870
+ * Performs the query in the database and returns the first result.
2890
4871
  * @param options Additional options to be used when performing the query.
2891
- * @returns An array of records from the database.
4872
+ * @returns The first record that matches the query, or null if no record matched the query.
4873
+ * @throws if there are no results.
2892
4874
  */
2893
- getAll(chunk?: number): Promise<Result[]>;
2894
- getAll(chunk: number | undefined, options: Omit<QueryOptions<Record>, 'columns' | 'page'>): Promise<Result[]>;
2895
- getAll<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(chunk: number | undefined, options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
4875
+ getFirstOrThrow<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>>;
2896
4876
  /**
2897
4877
  * Performs the query in the database and returns the first result.
2898
4878
  * @param options Additional options to be used when performing the query.
2899
4879
  * @returns The first record that matches the query, or null if no record matched the query.
4880
+ * @throws if there are no results.
2900
4881
  */
2901
- getFirst(): Promise<Result | null>;
2902
- getFirst(options: Omit<QueryOptions<Record>, 'columns' | 'page'>): Promise<Result | null>;
2903
- getFirst<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
4882
+ getFirstOrThrow(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result>;
2904
4883
  /**
2905
4884
  * Builds a new query object adding a cache TTL in milliseconds.
2906
4885
  * @param ttl The cache TTL in milliseconds.
2907
4886
  * @returns A new Query object.
2908
4887
  */
2909
4888
  cache(ttl: number): Query<Record, Result>;
4889
+ /**
4890
+ * Retrieve next page of records
4891
+ *
4892
+ * @returns A new page object.
4893
+ */
2910
4894
  nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4895
+ /**
4896
+ * Retrieve previous page of records
4897
+ *
4898
+ * @returns A new page object
4899
+ */
2911
4900
  previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4901
+ /**
4902
+ * Retrieve first page of records
4903
+ *
4904
+ * @returns A new page object
4905
+ */
2912
4906
  firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4907
+ /**
4908
+ * Retrieve last page of records
4909
+ *
4910
+ * @returns A new page object
4911
+ */
2913
4912
  lastPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4913
+ /**
4914
+ * @returns Boolean indicating if there is a next page
4915
+ */
2914
4916
  hasNextPage(): boolean;
2915
4917
  }
2916
4918
 
@@ -2922,7 +4924,7 @@ declare type PaginationQueryMeta = {
2922
4924
  };
2923
4925
  interface Paginable<Record extends XataRecord, Result extends XataRecord = Record> {
2924
4926
  meta: PaginationQueryMeta;
2925
- records: Result[];
4927
+ records: RecordArray<Result>;
2926
4928
  nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
2927
4929
  previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
2928
4930
  firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
@@ -2942,7 +4944,7 @@ declare class Page<Record extends XataRecord, Result extends XataRecord = Record
2942
4944
  /**
2943
4945
  * The set of results for this page.
2944
4946
  */
2945
- readonly records: Result[];
4947
+ readonly records: RecordArray<Result>;
2946
4948
  constructor(query: Query<Record, Result>, meta: PaginationQueryMeta, records?: Result[]);
2947
4949
  /**
2948
4950
  * Retrieves the next page of results.
@@ -2990,103 +4992,440 @@ declare type OffsetNavigationOptions = {
2990
4992
  size?: number;
2991
4993
  offset?: number;
2992
4994
  };
2993
- declare type PaginationOptions = CursorNavigationOptions & OffsetNavigationOptions;
2994
4995
  declare const PAGINATION_MAX_SIZE = 200;
2995
- declare const PAGINATION_DEFAULT_SIZE = 200;
4996
+ declare const PAGINATION_DEFAULT_SIZE = 20;
2996
4997
  declare const PAGINATION_MAX_OFFSET = 800;
2997
4998
  declare const PAGINATION_DEFAULT_OFFSET = 0;
4999
+ declare function isCursorPaginationOptions(options: Record<string, unknown> | undefined | null): options is CursorNavigationOptions;
5000
+ declare class RecordArray<Result extends XataRecord> extends Array<Result> {
5001
+ #private;
5002
+ constructor(page: Paginable<any, Result>, overrideRecords?: Result[]);
5003
+ static parseConstructorParams(...args: any[]): any[];
5004
+ toArray(): Result[];
5005
+ map<U>(callbackfn: (value: Result, index: number, array: Result[]) => U, thisArg?: any): U[];
5006
+ /**
5007
+ * Retrieve next page of records
5008
+ *
5009
+ * @returns A new array of objects
5010
+ */
5011
+ nextPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
5012
+ /**
5013
+ * Retrieve previous page of records
5014
+ *
5015
+ * @returns A new array of objects
5016
+ */
5017
+ previousPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
5018
+ /**
5019
+ * Retrieve first page of records
5020
+ *
5021
+ * @returns A new array of objects
5022
+ */
5023
+ firstPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
5024
+ /**
5025
+ * Retrieve last page of records
5026
+ *
5027
+ * @returns A new array of objects
5028
+ */
5029
+ lastPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
5030
+ /**
5031
+ * @returns Boolean indicating if there is a next page
5032
+ */
5033
+ hasNextPage(): boolean;
5034
+ }
2998
5035
 
2999
- declare type TableLink = string[];
3000
- declare type LinkDictionary = Dictionary<TableLink[]>;
3001
5036
  /**
3002
5037
  * Common interface for performing operations on a table.
3003
5038
  */
3004
- declare abstract class Repository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
3005
- abstract create(object: EditableData<Data> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5039
+ declare abstract class Repository<Record extends XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
5040
+ abstract create<K extends SelectableColumn<Record>>(object: Omit<EditableData<Record>, 'id'> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5041
+ abstract create(object: Omit<EditableData<Record>, 'id'> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5042
+ /**
5043
+ * Creates a single record in the table with a unique id.
5044
+ * @param id The unique id.
5045
+ * @param object Object containing the column names with their values to be stored in the table.
5046
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5047
+ * @returns The full persisted record.
5048
+ */
5049
+ abstract create<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3006
5050
  /**
3007
5051
  * Creates a single record in the table with a unique id.
3008
5052
  * @param id The unique id.
3009
5053
  * @param object Object containing the column names with their values to be stored in the table.
3010
5054
  * @returns The full persisted record.
3011
5055
  */
3012
- abstract create(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5056
+ abstract create(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3013
5057
  /**
3014
5058
  * Creates multiple records in the table.
3015
5059
  * @param objects Array of objects with the column names and the values to be stored in the table.
3016
- * @returns Array of the persisted records.
5060
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5061
+ * @returns Array of the persisted records in order.
5062
+ */
5063
+ abstract create<K extends SelectableColumn<Record>>(objects: Array<Omit<EditableData<Record>, 'id'> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
5064
+ /**
5065
+ * Creates multiple records in the table.
5066
+ * @param objects Array of objects with the column names and the values to be stored in the table.
5067
+ * @returns Array of the persisted records in order.
5068
+ */
5069
+ abstract create(objects: Array<Omit<EditableData<Record>, 'id'> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
5070
+ /**
5071
+ * Queries a single record from the table given its unique id.
5072
+ * @param id The unique id.
5073
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5074
+ * @returns The persisted record for the given id or null if the record could not be found.
3017
5075
  */
3018
- abstract create(objects: Array<EditableData<Data> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
5076
+ abstract read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
3019
5077
  /**
3020
5078
  * Queries a single record from the table given its unique id.
3021
5079
  * @param id The unique id.
3022
5080
  * @returns The persisted record for the given id or null if the record could not be found.
3023
5081
  */
3024
5082
  abstract read(id: string): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
5083
+ /**
5084
+ * Queries multiple records from the table given their unique id.
5085
+ * @param ids The unique ids array.
5086
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5087
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
5088
+ */
5089
+ abstract read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
5090
+ /**
5091
+ * Queries multiple records from the table given their unique id.
5092
+ * @param ids The unique ids array.
5093
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
5094
+ */
5095
+ abstract read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
5096
+ /**
5097
+ * Queries a single record from the table by the id in the object.
5098
+ * @param object Object containing the id of the record.
5099
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5100
+ * @returns The persisted record for the given id or null if the record could not be found.
5101
+ */
5102
+ abstract read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
5103
+ /**
5104
+ * Queries a single record from the table by the id in the object.
5105
+ * @param object Object containing the id of the record.
5106
+ * @returns The persisted record for the given id or null if the record could not be found.
5107
+ */
5108
+ abstract read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
5109
+ /**
5110
+ * Queries multiple records from the table by the ids in the objects.
5111
+ * @param objects Array of objects containing the ids of the records.
5112
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5113
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
5114
+ */
5115
+ abstract read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
5116
+ /**
5117
+ * Queries multiple records from the table by the ids in the objects.
5118
+ * @param objects Array of objects containing the ids of the records.
5119
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
5120
+ */
5121
+ abstract read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
5122
+ /**
5123
+ * Queries a single record from the table given its unique id.
5124
+ * @param id The unique id.
5125
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5126
+ * @returns The persisted record for the given id.
5127
+ * @throws If the record could not be found.
5128
+ */
5129
+ abstract readOrThrow<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5130
+ /**
5131
+ * Queries a single record from the table given its unique id.
5132
+ * @param id The unique id.
5133
+ * @returns The persisted record for the given id.
5134
+ * @throws If the record could not be found.
5135
+ */
5136
+ abstract readOrThrow(id: string): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5137
+ /**
5138
+ * Queries multiple records from the table given their unique id.
5139
+ * @param ids The unique ids array.
5140
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
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<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
5145
+ /**
5146
+ * Queries multiple records from the table given their unique id.
5147
+ * @param ids The unique ids array.
5148
+ * @returns The persisted records for the given ids in order.
5149
+ * @throws If one or more records could not be found.
5150
+ */
5151
+ abstract readOrThrow(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
5152
+ /**
5153
+ * Queries a single record from the table by the id in the object.
5154
+ * @param object Object containing the id of the record.
5155
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5156
+ * @returns The persisted record for the given id.
5157
+ * @throws If the record could not be found.
5158
+ */
5159
+ abstract readOrThrow<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5160
+ /**
5161
+ * Queries a single record from the table by the id in the object.
5162
+ * @param object Object containing the id of the record.
5163
+ * @returns The persisted record for the given id.
5164
+ * @throws If the record could not be found.
5165
+ */
5166
+ abstract readOrThrow(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5167
+ /**
5168
+ * Queries multiple records from the table by the ids in the objects.
5169
+ * @param objects Array of objects containing the ids of the records.
5170
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5171
+ * @returns The persisted records for the given ids in order.
5172
+ * @throws If one or more records could not be found.
5173
+ */
5174
+ abstract readOrThrow<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
5175
+ /**
5176
+ * Queries multiple records from the table by the ids in the objects.
5177
+ * @param objects Array of objects containing the ids of the records.
5178
+ * @returns The persisted records for the given ids in order.
5179
+ * @throws If one or more records could not be found.
5180
+ */
5181
+ abstract readOrThrow(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3025
5182
  /**
3026
5183
  * Partially update a single record.
3027
5184
  * @param object An object with its id and the columns to be updated.
5185
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5186
+ * @returns The full persisted record, null if the record could not be found.
5187
+ */
5188
+ abstract update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
5189
+ /**
5190
+ * Partially update a single record.
5191
+ * @param object An object with its id and the columns to be updated.
5192
+ * @returns The full persisted record, null if the record could not be found.
5193
+ */
5194
+ abstract update(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
5195
+ /**
5196
+ * Partially update a single record given its unique id.
5197
+ * @param id The unique id.
5198
+ * @param object The column names and their values that have to be updated.
5199
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5200
+ * @returns The full persisted record, null if the record could not be found.
5201
+ */
5202
+ abstract update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
5203
+ /**
5204
+ * Partially update a single record given its unique id.
5205
+ * @param id The unique id.
5206
+ * @param object The column names and their values that have to be updated.
5207
+ * @returns The full persisted record, null if the record could not be found.
5208
+ */
5209
+ abstract update(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
5210
+ /**
5211
+ * Partially updates multiple records.
5212
+ * @param objects An array of objects with their ids and columns to be updated.
5213
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5214
+ * @returns Array of the persisted records in order (if a record could not be found null is returned).
5215
+ */
5216
+ abstract update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
5217
+ /**
5218
+ * Partially updates multiple records.
5219
+ * @param objects An array of objects with their ids and columns to be updated.
5220
+ * @returns Array of the persisted records in order (if a record could not be found null is returned).
5221
+ */
5222
+ abstract update(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
5223
+ /**
5224
+ * Partially update a single record.
5225
+ * @param object An object with its id and the columns to be updated.
5226
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5227
+ * @returns The full persisted record.
5228
+ * @throws If the record could not be found.
5229
+ */
5230
+ abstract updateOrThrow<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5231
+ /**
5232
+ * Partially update a single record.
5233
+ * @param object An object with its id and the columns to be updated.
5234
+ * @returns The full persisted record.
5235
+ * @throws If the record could not be found.
5236
+ */
5237
+ abstract updateOrThrow(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5238
+ /**
5239
+ * Partially update a single record given its unique id.
5240
+ * @param id The unique id.
5241
+ * @param object The column names and their values that have to be updated.
5242
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3028
5243
  * @returns The full persisted record.
5244
+ * @throws If the record could not be found.
3029
5245
  */
3030
- abstract update(object: Partial<EditableData<Data>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5246
+ abstract updateOrThrow<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3031
5247
  /**
3032
5248
  * Partially update a single record given its unique id.
3033
5249
  * @param id The unique id.
3034
5250
  * @param object The column names and their values that have to be updated.
3035
5251
  * @returns The full persisted record.
5252
+ * @throws If the record could not be found.
3036
5253
  */
3037
- abstract update(id: string, object: Partial<EditableData<Data>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5254
+ abstract updateOrThrow(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3038
5255
  /**
3039
5256
  * Partially updates multiple records.
3040
5257
  * @param objects An array of objects with their ids and columns to be updated.
3041
- * @returns Array of the persisted records.
5258
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5259
+ * @returns Array of the persisted records in order.
5260
+ * @throws If one or more records could not be found.
5261
+ */
5262
+ abstract updateOrThrow<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
5263
+ /**
5264
+ * Partially updates multiple records.
5265
+ * @param objects An array of objects with their ids and columns to be updated.
5266
+ * @returns Array of the persisted records in order.
5267
+ * @throws If one or more records could not be found.
5268
+ */
5269
+ abstract updateOrThrow(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
5270
+ /**
5271
+ * Creates or updates a single record. If a record exists with the given id,
5272
+ * it will be update, otherwise a new record will be created.
5273
+ * @param object Object containing the column names with their values to be persisted in the table.
5274
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5275
+ * @returns The full persisted record.
3042
5276
  */
3043
- abstract update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
5277
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Record> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3044
5278
  /**
3045
5279
  * Creates or updates a single record. If a record exists with the given id,
3046
5280
  * it will be update, otherwise a new record will be created.
3047
5281
  * @param object Object containing the column names with their values to be persisted in the table.
3048
5282
  * @returns The full persisted record.
3049
5283
  */
3050
- abstract createOrUpdate(object: EditableData<Data> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5284
+ abstract createOrUpdate(object: EditableData<Record> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3051
5285
  /**
3052
5286
  * Creates or updates a single record. If a record exists with the given id,
3053
5287
  * it will be update, otherwise a new record will be created.
3054
5288
  * @param id A unique id.
3055
5289
  * @param object The column names and the values to be persisted.
5290
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3056
5291
  * @returns The full persisted record.
3057
5292
  */
3058
- abstract createOrUpdate(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5293
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5294
+ /**
5295
+ * Creates or updates a single record. If a record exists with the given id,
5296
+ * it will be update, otherwise a new record will be created.
5297
+ * @param id A unique id.
5298
+ * @param object The column names and the values to be persisted.
5299
+ * @returns The full persisted record.
5300
+ */
5301
+ abstract createOrUpdate(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5302
+ /**
5303
+ * Creates or updates a single record. If a record exists with the given id,
5304
+ * it will be update, otherwise a new record will be created.
5305
+ * @param objects Array of objects with the column names and the values to be stored in the table.
5306
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5307
+ * @returns Array of the persisted records.
5308
+ */
5309
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3059
5310
  /**
3060
5311
  * Creates or updates a single record. If a record exists with the given id,
3061
5312
  * it will be update, otherwise a new record will be created.
3062
5313
  * @param objects Array of objects with the column names and the values to be stored in the table.
3063
5314
  * @returns Array of the persisted records.
3064
5315
  */
3065
- abstract createOrUpdate(objects: Array<EditableData<Data> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
5316
+ abstract createOrUpdate(objects: Array<EditableData<Record> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
5317
+ /**
5318
+ * Deletes a record given its unique id.
5319
+ * @param object An object with a unique id.
5320
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5321
+ * @returns The deleted record, null if the record could not be found.
5322
+ */
5323
+ abstract delete<K extends SelectableColumn<Record>>(object: Identifiable & Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3066
5324
  /**
3067
5325
  * Deletes a record given its unique id.
5326
+ * @param object An object with a unique id.
5327
+ * @returns The deleted record, null if the record could not be found.
5328
+ */
5329
+ abstract delete(object: Identifiable & Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
5330
+ /**
5331
+ * Deletes a record given a unique id.
5332
+ * @param id The unique id.
5333
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5334
+ * @returns The deleted record, null if the record could not be found.
5335
+ */
5336
+ abstract delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
5337
+ /**
5338
+ * Deletes a record given a unique id.
3068
5339
  * @param id The unique id.
3069
- * @throws If the record could not be found or there was an error while performing the deletion.
5340
+ * @returns The deleted record, null if the record could not be found.
5341
+ */
5342
+ abstract delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
5343
+ /**
5344
+ * Deletes multiple records given an array of objects with ids.
5345
+ * @param objects An array of objects with unique ids.
5346
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5347
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
5348
+ */
5349
+ abstract delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
5350
+ /**
5351
+ * Deletes multiple records given an array of objects with ids.
5352
+ * @param objects An array of objects with unique ids.
5353
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
5354
+ */
5355
+ abstract delete(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
5356
+ /**
5357
+ * Deletes multiple records given an array of unique ids.
5358
+ * @param objects An array of ids.
5359
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5360
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
5361
+ */
5362
+ abstract delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
5363
+ /**
5364
+ * Deletes multiple records given an array of unique ids.
5365
+ * @param objects An array of ids.
5366
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
5367
+ */
5368
+ abstract delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
5369
+ /**
5370
+ * Deletes a record given its unique id.
5371
+ * @param object An object with a unique id.
5372
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5373
+ * @returns The deleted record, null if the record could not be found.
5374
+ * @throws If the record could not be found.
3070
5375
  */
3071
- abstract delete(id: string): Promise<void>;
5376
+ abstract deleteOrThrow<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3072
5377
  /**
3073
5378
  * Deletes a record given its unique id.
3074
- * @param id An object with a unique id.
3075
- * @throws If the record could not be found or there was an error while performing the deletion.
5379
+ * @param object An object with a unique id.
5380
+ * @returns The deleted record, null if the record could not be found.
5381
+ * @throws If the record could not be found.
3076
5382
  */
3077
- abstract delete(id: Identifiable): Promise<void>;
5383
+ abstract deleteOrThrow(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3078
5384
  /**
3079
- * Deletes a record given a list of unique ids.
3080
- * @param ids The array of unique ids.
3081
- * @throws If the record could not be found or there was an error while performing the deletion.
5385
+ * Deletes a record given a unique id.
5386
+ * @param id The unique id.
5387
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5388
+ * @returns The deleted record, null if the record could not be found.
5389
+ * @throws If the record could not be found.
5390
+ */
5391
+ abstract deleteOrThrow<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5392
+ /**
5393
+ * Deletes a record given a unique id.
5394
+ * @param id The unique id.
5395
+ * @returns The deleted record, null if the record could not be found.
5396
+ * @throws If the record could not be found.
5397
+ */
5398
+ abstract deleteOrThrow(id: string): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5399
+ /**
5400
+ * Deletes multiple records given an array of objects with ids.
5401
+ * @param objects An array of objects with unique ids.
5402
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5403
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
5404
+ * @throws If one or more records could not be found.
5405
+ */
5406
+ abstract deleteOrThrow<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
5407
+ /**
5408
+ * Deletes multiple records given an array of objects with ids.
5409
+ * @param objects An array of objects with unique ids.
5410
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
5411
+ * @throws If one or more records could not be found.
3082
5412
  */
3083
- abstract delete(ids: string[]): Promise<void>;
5413
+ abstract deleteOrThrow(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3084
5414
  /**
3085
- * Deletes a record given a list of unique ids.
3086
- * @param ids An array of objects with unique ids.
3087
- * @throws If the record could not be found or there was an error while performing the deletion.
5415
+ * Deletes multiple records given an array of unique ids.
5416
+ * @param objects An array of ids.
5417
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
5418
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
5419
+ * @throws If one or more records could not be found.
3088
5420
  */
3089
- abstract delete(ids: Identifiable[]): Promise<void>;
5421
+ abstract deleteOrThrow<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
5422
+ /**
5423
+ * Deletes multiple records given an array of unique ids.
5424
+ * @param objects An array of ids.
5425
+ * @returns Array of the deleted records in order.
5426
+ * @throws If one or more records could not be found.
5427
+ */
5428
+ abstract deleteOrThrow(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3090
5429
  /**
3091
5430
  * Search for records in the table.
3092
5431
  * @param query The query to search for.
@@ -3094,36 +5433,152 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3094
5433
  * @returns The found records.
3095
5434
  */
3096
5435
  abstract search(query: string, options?: {
3097
- fuzziness?: number;
3098
- }): Promise<SelectedPick<Record, ['*']>[]>;
5436
+ fuzziness?: FuzzinessExpression;
5437
+ prefix?: PrefixExpression;
5438
+ highlight?: HighlightExpression;
5439
+ filter?: Filter<Record>;
5440
+ boosters?: Boosters<Record>[];
5441
+ }): Promise<SearchXataRecord<SelectedPick<Record, ['*']>>[]>;
3099
5442
  abstract query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3100
5443
  }
3101
- declare class RestRepository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Data, Record> {
5444
+ declare class RestRepository<Record extends XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Record> {
3102
5445
  #private;
3103
- db: SchemaPluginResult<any>;
3104
5446
  constructor(options: {
3105
5447
  table: string;
3106
- links?: LinkDictionary;
3107
5448
  db: SchemaPluginResult<any>;
3108
5449
  pluginOptions: XataPluginOptions;
5450
+ schemaTables?: Table[];
3109
5451
  });
3110
- create(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3111
- create(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3112
- create(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3113
- read(recordId: string): Promise<SelectedPick<Record, ['*']> | null>;
3114
- update(object: Partial<EditableData<Data>> & Identifiable): Promise<SelectedPick<Record, ['*']>>;
3115
- update(recordId: string, object: Partial<EditableData<Data>>): Promise<SelectedPick<Record, ['*']>>;
3116
- update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<SelectedPick<Record, ['*']>[]>;
3117
- createOrUpdate(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3118
- createOrUpdate(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3119
- createOrUpdate(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3120
- delete(a: string | Identifiable | Array<string | Identifiable>): Promise<void>;
5452
+ create<K extends SelectableColumn<Record>>(object: EditableData<Record> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5453
+ create(object: EditableData<Record> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5454
+ create<K extends SelectableColumn<Record>>(id: string, object: EditableData<Record>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5455
+ create(id: string, object: EditableData<Record>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5456
+ create<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
5457
+ create(objects: Array<EditableData<Record> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
5458
+ read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
5459
+ read(id: string): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
5460
+ read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
5461
+ read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
5462
+ read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
5463
+ read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
5464
+ read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
5465
+ read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
5466
+ readOrThrow<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5467
+ readOrThrow(id: string): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5468
+ readOrThrow<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
5469
+ readOrThrow(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
5470
+ readOrThrow<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5471
+ readOrThrow(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5472
+ readOrThrow<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
5473
+ readOrThrow(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
5474
+ update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
5475
+ update(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
5476
+ update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
5477
+ update(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
5478
+ update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
5479
+ update(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
5480
+ updateOrThrow<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5481
+ updateOrThrow(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5482
+ updateOrThrow<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5483
+ updateOrThrow(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5484
+ updateOrThrow<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
5485
+ updateOrThrow(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
5486
+ createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Record> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5487
+ createOrUpdate(object: EditableData<Record> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5488
+ createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5489
+ createOrUpdate(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5490
+ createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
5491
+ createOrUpdate(objects: Array<EditableData<Record> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
5492
+ delete<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
5493
+ delete(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
5494
+ delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
5495
+ delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
5496
+ delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
5497
+ delete(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
5498
+ delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
5499
+ delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
5500
+ deleteOrThrow<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5501
+ deleteOrThrow(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5502
+ deleteOrThrow<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
5503
+ deleteOrThrow(id: string): Promise<Readonly<SelectedPick<Record, ['*']>>>;
5504
+ deleteOrThrow<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
5505
+ deleteOrThrow(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
5506
+ deleteOrThrow<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
5507
+ deleteOrThrow(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3121
5508
  search(query: string, options?: {
3122
- fuzziness?: number;
3123
- }): Promise<SelectedPick<Record, ['*']>[]>;
5509
+ fuzziness?: FuzzinessExpression;
5510
+ prefix?: PrefixExpression;
5511
+ highlight?: HighlightExpression;
5512
+ filter?: Filter<Record>;
5513
+ boosters?: Boosters<Record>[];
5514
+ }): Promise<any>;
3124
5515
  query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3125
5516
  }
3126
5517
 
5518
+ declare type BaseSchema = {
5519
+ name: string;
5520
+ columns: readonly ({
5521
+ name: string;
5522
+ type: Column['type'];
5523
+ notNull?: boolean;
5524
+ } | {
5525
+ name: string;
5526
+ type: 'link';
5527
+ link: {
5528
+ table: string;
5529
+ };
5530
+ } | {
5531
+ name: string;
5532
+ type: 'object';
5533
+ columns: {
5534
+ name: string;
5535
+ type: string;
5536
+ }[];
5537
+ })[];
5538
+ };
5539
+ declare type SchemaInference<T extends readonly BaseSchema[]> = T extends never[] ? Record<string, Record<string, any>> : T extends readonly unknown[] ? T[number] extends {
5540
+ name: string;
5541
+ columns: readonly unknown[];
5542
+ } ? {
5543
+ [K in T[number]['name']]: TableType<T[number], K>;
5544
+ } : never : never;
5545
+ declare type TableType<Tables, TableName> = Tables & {
5546
+ name: TableName;
5547
+ } extends infer Table ? Table extends {
5548
+ name: string;
5549
+ columns: infer Columns;
5550
+ } ? Columns extends readonly unknown[] ? Columns[number] extends {
5551
+ name: string;
5552
+ type: string;
5553
+ } ? Identifiable & UnionToIntersection<Values<{
5554
+ [K in Columns[number]['name']]: PropertyType<Tables, Columns[number], K>;
5555
+ }>> : never : never : never : never;
5556
+ declare type PropertyType<Tables, Properties, PropertyName extends PropertyKey> = Properties & {
5557
+ name: PropertyName;
5558
+ } extends infer Property ? Property extends {
5559
+ name: string;
5560
+ type: infer Type;
5561
+ link?: {
5562
+ table: infer LinkedTable;
5563
+ };
5564
+ columns?: infer ObjectColumns;
5565
+ notNull?: infer NotNull;
5566
+ } ? NotNull extends true ? {
5567
+ [K in PropertyName]: InnerType<Type, ObjectColumns, Tables, LinkedTable>;
5568
+ } : {
5569
+ [K in PropertyName]?: InnerType<Type, ObjectColumns, Tables, LinkedTable> | null;
5570
+ } : never : never;
5571
+ 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 {
5572
+ name: string;
5573
+ type: string;
5574
+ } ? UnionToIntersection<Values<{
5575
+ [K in ObjectColumns[number]['name']]: PropertyType<Tables, ObjectColumns[number], K>;
5576
+ }>> : never : never : Type extends 'link' ? TableType<Tables, LinkedTable> & XataRecord : never;
5577
+
5578
+ /**
5579
+ * Operator to restrict results to only values that are greater than the given value.
5580
+ */
5581
+ declare const greaterThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3127
5582
  /**
3128
5583
  * Operator to restrict results to only values that are greater than the given value.
3129
5584
  */
@@ -3131,15 +5586,35 @@ declare const gt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T
3131
5586
  /**
3132
5587
  * Operator to restrict results to only values that are greater than or equal to the given value.
3133
5588
  */
3134
- declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
5589
+ declare const greaterThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
5590
+ /**
5591
+ * Operator to restrict results to only values that are greater than or equal to the given value.
5592
+ */
5593
+ declare const greaterEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3135
5594
  /**
3136
5595
  * Operator to restrict results to only values that are greater than or equal to the given value.
3137
5596
  */
3138
5597
  declare const gte: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
5598
+ /**
5599
+ * Operator to restrict results to only values that are greater than or equal to the given value.
5600
+ */
5601
+ declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
5602
+ /**
5603
+ * Operator to restrict results to only values that are lower than the given value.
5604
+ */
5605
+ declare const lessThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3139
5606
  /**
3140
5607
  * Operator to restrict results to only values that are lower than the given value.
3141
5608
  */
3142
5609
  declare const lt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
5610
+ /**
5611
+ * Operator to restrict results to only values that are lower than or equal to the given value.
5612
+ */
5613
+ declare const lessThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
5614
+ /**
5615
+ * Operator to restrict results to only values that are lower than or equal to the given value.
5616
+ */
5617
+ declare const lessEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3143
5618
  /**
3144
5619
  * Operator to restrict results to only values that are lower than or equal to the given value.
3145
5620
  */
@@ -3172,6 +5647,10 @@ declare const pattern: (value: string) => StringTypeFilter;
3172
5647
  * Operator to restrict results to only values that are equal to the given value.
3173
5648
  */
3174
5649
  declare const is: <T>(value: T) => PropertyFilter<T>;
5650
+ /**
5651
+ * Operator to restrict results to only values that are equal to the given value.
5652
+ */
5653
+ declare const equals: <T>(value: T) => PropertyFilter<T>;
3175
5654
  /**
3176
5655
  * Operator to restrict results to only values that are not equal to the given value.
3177
5656
  */
@@ -3199,47 +5678,16 @@ declare const includesAny: <T>(value: T) => ArrayFilter<T>;
3199
5678
 
3200
5679
  declare type SchemaDefinition = {
3201
5680
  table: string;
3202
- links?: LinkDictionary;
3203
5681
  };
3204
- declare type SchemaPluginResult<Schemas extends Record<string, BaseData>> = {
5682
+ declare type SchemaPluginResult<Schemas extends Record<string, XataRecord>> = {
3205
5683
  [Key in keyof Schemas]: Repository<Schemas[Key]>;
3206
5684
  };
3207
- declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
5685
+ declare class SchemaPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin {
3208
5686
  #private;
3209
- private links?;
3210
- private tableNames?;
3211
- constructor(links?: LinkDictionary | undefined, tableNames?: string[] | undefined);
5687
+ constructor(schemaTables?: Schemas.Table[]);
3212
5688
  build(pluginOptions: XataPluginOptions): SchemaPluginResult<Schemas>;
3213
5689
  }
3214
5690
 
3215
- declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3216
- fuzziness?: number;
3217
- tables?: Tables[];
3218
- };
3219
- declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3220
- all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3221
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]: {
3222
- table: Model;
3223
- record: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>>;
3224
- };
3225
- }>[]>;
3226
- byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3227
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]?: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>[]>;
3228
- }>;
3229
- };
3230
- declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
3231
- #private;
3232
- private db;
3233
- private links;
3234
- constructor(db: SchemaPluginResult<Schemas>, links: LinkDictionary);
3235
- build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
3236
- }
3237
- declare type SearchXataRecord = XataRecord & {
3238
- xata: {
3239
- table: string;
3240
- };
3241
- };
3242
-
3243
5691
  declare type BranchStrategyValue = string | undefined | null;
3244
5692
  declare type BranchStrategyBuilder = () => BranchStrategyValue | Promise<BranchStrategyValue>;
3245
5693
  declare type BranchStrategy = BranchStrategyValue | BranchStrategyBuilder;
@@ -3251,20 +5699,35 @@ declare type BaseClientOptions = {
3251
5699
  databaseURL?: string;
3252
5700
  branch?: BranchStrategyOption;
3253
5701
  cache?: CacheImpl;
5702
+ trace?: TraceFunction;
3254
5703
  };
3255
5704
  declare const buildClient: <Plugins extends Record<string, XataPlugin> = {}>(plugins?: Plugins | undefined) => ClientConstructor<Plugins>;
3256
5705
  interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
3257
- new <Schemas extends Record<string, BaseData>>(options?: Partial<BaseClientOptions>, links?: LinkDictionary): Omit<{
5706
+ new <Schemas extends Record<string, XataRecord> = {}>(options?: Partial<BaseClientOptions>, schemaTables?: readonly BaseSchema[]): Omit<{
3258
5707
  db: Awaited<ReturnType<SchemaPlugin<Schemas>['build']>>;
3259
5708
  search: Awaited<ReturnType<SearchPlugin<Schemas>['build']>>;
3260
5709
  }, keyof Plugins> & {
3261
5710
  [Key in StringKeys<NonNullable<Plugins>>]: Awaited<ReturnType<NonNullable<Plugins>[Key]['build']>>;
5711
+ } & {
5712
+ getConfig(): Promise<{
5713
+ databaseURL: string;
5714
+ branch: string;
5715
+ }>;
3262
5716
  };
3263
5717
  }
3264
5718
  declare const BaseClient_base: ClientConstructor<{}>;
3265
5719
  declare class BaseClient extends BaseClient_base<Record<string, any>> {
3266
5720
  }
3267
5721
 
5722
+ declare class Serializer {
5723
+ classes: Record<string, any>;
5724
+ add(clazz: any): void;
5725
+ toJSON<T>(data: T): string;
5726
+ fromJSON<T>(json: string): T;
5727
+ }
5728
+ declare const serialize: <T>(data: T) => string;
5729
+ declare const deserialize: <T>(json: string) => T;
5730
+
3268
5731
  declare type BranchResolutionOptions = {
3269
5732
  databaseURL?: string;
3270
5733
  apiKey?: string;
@@ -3276,9 +5739,89 @@ declare function getDatabaseURL(): string | undefined;
3276
5739
 
3277
5740
  declare function getAPIKey(): string | undefined;
3278
5741
 
5742
+ interface Body {
5743
+ arrayBuffer(): Promise<ArrayBuffer>;
5744
+ blob(): Promise<Blob>;
5745
+ formData(): Promise<FormData>;
5746
+ json(): Promise<any>;
5747
+ text(): Promise<string>;
5748
+ }
5749
+ interface Blob {
5750
+ readonly size: number;
5751
+ readonly type: string;
5752
+ arrayBuffer(): Promise<ArrayBuffer>;
5753
+ slice(start?: number, end?: number, contentType?: string): Blob;
5754
+ text(): Promise<string>;
5755
+ }
5756
+ /** Provides information about files and allows JavaScript in a web page to access their content. */
5757
+ interface File extends Blob {
5758
+ readonly lastModified: number;
5759
+ readonly name: string;
5760
+ readonly webkitRelativePath: string;
5761
+ }
5762
+ declare type FormDataEntryValue = File | string;
5763
+ /** 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". */
5764
+ interface FormData {
5765
+ append(name: string, value: string | Blob, fileName?: string): void;
5766
+ delete(name: string): void;
5767
+ get(name: string): FormDataEntryValue | null;
5768
+ getAll(name: string): FormDataEntryValue[];
5769
+ has(name: string): boolean;
5770
+ set(name: string, value: string | Blob, fileName?: string): void;
5771
+ forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void;
5772
+ }
5773
+ /** 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. */
5774
+ interface Headers {
5775
+ append(name: string, value: string): void;
5776
+ delete(name: string): void;
5777
+ get(name: string): string | null;
5778
+ has(name: string): boolean;
5779
+ set(name: string, value: string): void;
5780
+ forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void;
5781
+ }
5782
+ interface Request extends Body {
5783
+ /** Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching. */
5784
+ readonly cache: 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload';
5785
+ /** 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. */
5786
+ readonly credentials: 'include' | 'omit' | 'same-origin';
5787
+ /** Returns the kind of resource requested by request, e.g., "document" or "script". */
5788
+ readonly destination: '' | 'audio' | 'audioworklet' | 'document' | 'embed' | 'font' | 'frame' | 'iframe' | 'image' | 'manifest' | 'object' | 'paintworklet' | 'report' | 'script' | 'sharedworker' | 'style' | 'track' | 'video' | 'worker' | 'xslt';
5789
+ /** 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. */
5790
+ readonly headers: Headers;
5791
+ /** 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] */
5792
+ readonly integrity: string;
5793
+ /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
5794
+ readonly keepalive: boolean;
5795
+ /** Returns request's HTTP method, which is "GET" by default. */
5796
+ readonly method: string;
5797
+ /** 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. */
5798
+ readonly mode: 'cors' | 'navigate' | 'no-cors' | 'same-origin';
5799
+ /** 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. */
5800
+ readonly redirect: 'error' | 'follow' | 'manual';
5801
+ /** 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. */
5802
+ readonly referrer: string;
5803
+ /** Returns the referrer policy associated with request. This is used during fetching to compute the value of the request's referrer. */
5804
+ readonly referrerPolicy: '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
5805
+ /** Returns the URL of request as a string. */
5806
+ readonly url: string;
5807
+ clone(): Request;
5808
+ }
5809
+
5810
+ declare type XataWorkerContext<XataClient> = {
5811
+ xata: XataClient;
5812
+ request: Request;
5813
+ env: Record<string, string | undefined>;
5814
+ };
5815
+ declare type RemoveFirst<T> = T extends [any, ...infer U] ? U : never;
5816
+ declare type WorkerRunnerConfig = {
5817
+ workspace: string;
5818
+ worker: string;
5819
+ };
5820
+ 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>>>;
5821
+
3279
5822
  declare class XataError extends Error {
3280
5823
  readonly status: number;
3281
5824
  constructor(message: string, status: number);
3282
5825
  }
3283
5826
 
3284
- export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, 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, GetRecordError, GetRecordPathParams, GetRecordRequestBody, GetRecordVariables, GetTableColumnsError, GetTableColumnsPathParams, GetTableColumnsResponse, GetTableColumnsVariables, GetTableSchemaError, GetTableSchemaPathParams, GetTableSchemaResponse, GetTableSchemaVariables, GetUserAPIKeysError, GetUserAPIKeysResponse, GetUserAPIKeysVariables, GetUserError, GetUserVariables, GetWorkspaceError, GetWorkspaceMembersListError, GetWorkspaceMembersListPathParams, GetWorkspaceMembersListVariables, GetWorkspacePathParams, GetWorkspaceVariables, GetWorkspacesListError, GetWorkspacesListResponse, GetWorkspacesListVariables, Identifiable, InsertRecordError, InsertRecordPathParams, InsertRecordResponse, InsertRecordVariables, InsertRecordWithIDError, InsertRecordWithIDPathParams, InsertRecordWithIDQueryParams, InsertRecordWithIDVariables, InviteWorkspaceMemberError, InviteWorkspaceMemberPathParams, InviteWorkspaceMemberRequestBody, InviteWorkspaceMemberVariables, LinkDictionary, OffsetNavigationOptions, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Paginable, PaginationOptions, PaginationQueryMeta, Query, QueryTableError, QueryTablePathParams, QueryTableRequestBody, QueryTableVariables, RemoveWorkspaceMemberError, RemoveWorkspaceMemberPathParams, RemoveWorkspaceMemberVariables, Repository, ResendWorkspaceMemberInviteError, ResendWorkspaceMemberInvitePathParams, ResendWorkspaceMemberInviteVariables, responses as Responses, RestRepository, SchemaDefinition, SchemaPlugin, SchemaPluginResult, schemas as Schemas, SearchBranchError, SearchBranchPathParams, SearchBranchRequestBody, SearchBranchVariables, SearchOptions, SearchPlugin, SearchPluginResult, SelectableColumn, SelectedPick, SetTableSchemaError, SetTableSchemaPathParams, SetTableSchemaRequestBody, SetTableSchemaVariables, SimpleCache, SimpleCacheOptions, UpdateBranchMetadataError, UpdateBranchMetadataPathParams, UpdateBranchMetadataVariables, UpdateColumnError, UpdateColumnPathParams, UpdateColumnRequestBody, UpdateColumnVariables, UpdateRecordWithIDError, UpdateRecordWithIDPathParams, UpdateRecordWithIDQueryParams, UpdateRecordWithIDVariables, UpdateTableError, UpdateTablePathParams, UpdateTableRequestBody, UpdateTableVariables, UpdateUserError, UpdateUserVariables, UpdateWorkspaceError, UpdateWorkspaceMemberRoleError, UpdateWorkspaceMemberRolePathParams, UpdateWorkspaceMemberRoleRequestBody, UpdateWorkspaceMemberRoleVariables, UpdateWorkspacePathParams, UpdateWorkspaceVariables, UpsertRecordWithIDError, UpsertRecordWithIDPathParams, UpsertRecordWithIDQueryParams, UpsertRecordWithIDVariables, ValueAtColumn, XataApiClient, XataApiClientOptions, XataApiPlugin, XataError, XataPlugin, XataPluginOptions, XataRecord, acceptWorkspaceMemberInvite, addTableColumn, buildClient, bulkInsertTableRecords, cancelWorkspaceMemberInvite, contains, createBranch, createDatabase, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, endsWith, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseURL, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isIdentifiable, isNot, isXataRecord, le, lt, lte, notExists, operationsByTag, pattern, queryTable, removeWorkspaceMember, resendWorkspaceMemberInvite, searchBranch, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberRole, upsertRecordWithID };
5827
+ 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 };