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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,8 @@
1
+ declare type AttributeDictionary = Record<string, string | number | boolean | undefined>;
2
+ declare type TraceFunction = <T>(name: string, fn: (options: {
3
+ setAttributes: (attrs: AttributeDictionary) => void;
4
+ }) => T, options?: AttributeDictionary) => Promise<T>;
5
+
1
6
  declare type FetchImpl = (url: string, init?: {
2
7
  body?: string;
3
8
  headers?: Record<string, string>;
@@ -5,14 +10,19 @@ declare type FetchImpl = (url: string, init?: {
5
10
  }) => Promise<{
6
11
  ok: boolean;
7
12
  status: number;
13
+ url: string;
8
14
  json(): Promise<any>;
15
+ headers?: {
16
+ get(name: string): string | null;
17
+ };
9
18
  }>;
10
- declare type WorkspaceApiUrlBuilder = (path: string, pathParams: Record<string, string>) => string;
19
+ declare type WorkspaceApiUrlBuilder = (path: string, pathParams: Partial<Record<string, string | number>>) => string;
11
20
  declare type FetcherExtraProps = {
12
21
  apiUrl: string;
13
22
  workspacesApiUrl: string | WorkspaceApiUrlBuilder;
14
23
  fetchImpl: FetchImpl;
15
24
  apiKey: string;
25
+ trace: TraceFunction;
16
26
  };
17
27
  declare type ErrorWrapper<TError> = TError | {
18
28
  status: 'unknown';
@@ -20,7 +30,6 @@ declare type ErrorWrapper<TError> = TError | {
20
30
  };
21
31
 
22
32
  interface CacheImpl {
23
- cacheRecords: boolean;
24
33
  defaultQueryTTL: number;
25
34
  getAll(): Promise<Record<string, unknown>>;
26
35
  get: <T>(key: string) => Promise<T | null>;
@@ -30,13 +39,11 @@ interface CacheImpl {
30
39
  }
31
40
  interface SimpleCacheOptions {
32
41
  max?: number;
33
- cacheRecords?: boolean;
34
42
  defaultQueryTTL?: number;
35
43
  }
36
44
  declare class SimpleCache implements CacheImpl {
37
45
  #private;
38
46
  capacity: number;
39
- cacheRecords: boolean;
40
47
  defaultQueryTTL: number;
41
48
  constructor(options?: SimpleCacheOptions);
42
49
  getAll(): Promise<Record<string, unknown>>;
@@ -52,6 +59,7 @@ declare abstract class XataPlugin {
52
59
  declare type XataPluginOptions = {
53
60
  getFetchProps: () => Promise<FetcherExtraProps>;
54
61
  cache: CacheImpl;
62
+ trace?: TraceFunction;
55
63
  };
56
64
 
57
65
  /**
@@ -91,7 +99,7 @@ declare type WorkspaceID = string;
91
99
  declare type Role = 'owner' | 'maintainer';
92
100
  declare type WorkspaceMeta = {
93
101
  name: string;
94
- slug: string;
102
+ slug?: string;
95
103
  };
96
104
  declare type Workspace = WorkspaceMeta & {
97
105
  id: WorkspaceID;
@@ -122,20 +130,22 @@ declare type WorkspaceMembers = {
122
130
  * @pattern ^ik_[a-zA-Z0-9]+
123
131
  */
124
132
  declare type InviteKey = string;
133
+ /**
134
+ * Metadata of databases
135
+ */
136
+ declare type DatabaseMetadata = {
137
+ name: string;
138
+ createdAt: DateTime;
139
+ numberOfBranches: number;
140
+ ui?: {
141
+ color?: string;
142
+ };
143
+ };
125
144
  declare type ListDatabasesResponse = {
126
- databases?: {
127
- name: string;
128
- displayName: string;
129
- createdAt: DateTime;
130
- numberOfBranches: number;
131
- ui?: {
132
- color?: string;
133
- };
134
- }[];
145
+ databases?: DatabaseMetadata[];
135
146
  };
136
147
  declare type ListBranchesResponse = {
137
148
  databaseName: string;
138
- displayName: string;
139
149
  branches: Branch[];
140
150
  };
141
151
  declare type ListGitBranchesResponse = {
@@ -181,12 +191,28 @@ declare type Schema = {
181
191
  tables: Table[];
182
192
  tablesOrder?: string[];
183
193
  };
194
+ /**
195
+ * @x-internal true
196
+ */
197
+ declare type SchemaEditScript = {
198
+ sourceMigrationID?: string;
199
+ targetMigrationID?: string;
200
+ tables: TableEdit[];
201
+ };
184
202
  declare type Table = {
185
203
  id?: string;
186
204
  name: TableName;
187
205
  columns: Column[];
188
206
  revLinks?: RevLink[];
189
207
  };
208
+ /**
209
+ * @x-internal true
210
+ */
211
+ declare type TableEdit = {
212
+ oldName?: string;
213
+ newName?: string;
214
+ columns?: MigrationColumnOp[];
215
+ };
190
216
  /**
191
217
  * @x-go-type xata.Column
192
218
  */
@@ -196,6 +222,8 @@ declare type Column = {
196
222
  link?: {
197
223
  table: string;
198
224
  };
225
+ notNull?: boolean;
226
+ unique?: boolean;
199
227
  columns?: Column[];
200
228
  };
201
229
  declare type RevLink = {
@@ -262,12 +290,131 @@ declare type ColumnMigration = {
262
290
  old: Column;
263
291
  ['new']: Column;
264
292
  };
293
+ /**
294
+ * @x-internal true
295
+ */
296
+ declare type Commit = {
297
+ meta?: {
298
+ title?: string;
299
+ message?: string;
300
+ id: string;
301
+ parentID?: string;
302
+ mergeParentID?: string;
303
+ status: string;
304
+ createdAt: DateTime;
305
+ modifiedAt?: DateTime;
306
+ };
307
+ operations: MigrationOp[];
308
+ };
309
+ /**
310
+ * Branch schema migration.
311
+ *
312
+ * @x-internal true
313
+ */
314
+ declare type Migration = {
315
+ parentID?: string;
316
+ operations: MigrationOp[];
317
+ };
318
+ /**
319
+ * Branch schema migration operations.
320
+ *
321
+ * @x-internal true
322
+ */
323
+ declare type MigrationOp = MigrationTableOp | MigrationColumnOp;
324
+ /**
325
+ * @x-internal true
326
+ */
327
+ declare type MigrationTableOp = {
328
+ addTable: TableOpAdd;
329
+ } | {
330
+ removeTable: TableOpRemove;
331
+ } | {
332
+ renameTable: TableOpRename;
333
+ };
334
+ /**
335
+ * @x-internal true
336
+ */
337
+ declare type MigrationColumnOp = {
338
+ addColumn: ColumnOpAdd;
339
+ } | {
340
+ removeColumn: ColumnOpRemove;
341
+ } | {
342
+ renameColumn: ColumnOpRename;
343
+ };
344
+ /**
345
+ * @x-internal true
346
+ */
347
+ declare type TableOpAdd = {
348
+ table: string;
349
+ };
350
+ /**
351
+ * @x-internal true
352
+ */
353
+ declare type TableOpRemove = {
354
+ table: string;
355
+ };
356
+ /**
357
+ * @x-internal true
358
+ */
359
+ declare type TableOpRename = {
360
+ oldName: string;
361
+ newName: string;
362
+ };
363
+ /**
364
+ * @x-internal true
365
+ */
366
+ declare type ColumnOpAdd = {
367
+ table?: string;
368
+ column: Column;
369
+ };
370
+ /**
371
+ * @x-internal true
372
+ */
373
+ declare type ColumnOpRemove = {
374
+ table?: string;
375
+ column: string;
376
+ };
377
+ /**
378
+ * @x-internal true
379
+ */
380
+ declare type ColumnOpRename = {
381
+ table?: string;
382
+ oldName: string;
383
+ newName: string;
384
+ };
385
+ declare type MigrationRequest = {
386
+ number: number;
387
+ createdAt: DateTime;
388
+ modifiedAt?: DateTime;
389
+ closedAt?: DateTime;
390
+ mergedAt?: DateTime;
391
+ status: 'open' | 'closed' | 'merging' | 'merged';
392
+ title: string;
393
+ body: string;
394
+ source: string;
395
+ target: string;
396
+ };
265
397
  declare type SortExpression = string[] | {
266
398
  [key: string]: SortOrder;
267
399
  } | {
268
400
  [key: string]: SortOrder;
269
401
  }[];
270
402
  declare type SortOrder = 'asc' | 'desc';
403
+ /**
404
+ * Maximum [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) for the search terms. The Levenshtein
405
+ * distance is the number of one character changes needed to make two strings equal. The default is 1, meaning that single
406
+ * character typos per word are tollerated by search. You can set it to 0 to remove the typo tollerance or set it to 2
407
+ * to allow two typos in a word.
408
+ *
409
+ * @default 1
410
+ * @maximum 2
411
+ * @minimum 0
412
+ */
413
+ declare type FuzzinessExpression = number;
414
+ /**
415
+ * If the prefix type is set to "disabled" (the default), the search only matches full words. If the prefix type is set to "phrase", the search will return results that match prefixes of the search phrase.
416
+ */
417
+ declare type PrefixExpression = 'phrase' | 'disabled';
271
418
  /**
272
419
  * @minProperties 1
273
420
  */
@@ -281,6 +428,64 @@ declare type FilterExpression = {
281
428
  } & {
282
429
  [key: string]: FilterColumn;
283
430
  };
431
+ /**
432
+ * The full summary expression; the entire expression is a map of names to requests.
433
+ *
434
+ * @x-go-type xbquery.SummaryList
435
+ */
436
+ declare type SummaryExpressionList = {
437
+ [key: string]: SummaryExpression;
438
+ };
439
+ /**
440
+ * A single summary expression. The key represents an aggregation function; the value a column to aggregate.
441
+ *
442
+ * You may only call one aggregation per key.
443
+ *
444
+ * @x-go-type xbquery.Summary
445
+ */
446
+ declare type SummaryExpression = Record<string, any>;
447
+ declare type HighlightExpression = {
448
+ enabled?: boolean;
449
+ encodeHTML?: boolean;
450
+ };
451
+ /**
452
+ * Booster Expression
453
+ *
454
+ * @x-go-type xata.BoosterExpression
455
+ */
456
+ declare type BoosterExpression = {
457
+ valueBooster?: ValueBooster$1;
458
+ } | {
459
+ numericBooster?: NumericBooster$1;
460
+ } | {
461
+ dateBooster?: DateBooster$1;
462
+ };
463
+ /**
464
+ * Boost records with a particular value for a column.
465
+ */
466
+ declare type ValueBooster$1 = {
467
+ column: string;
468
+ value: string | number | boolean;
469
+ factor: number;
470
+ };
471
+ /**
472
+ * Boost records based on the value of a numeric column.
473
+ */
474
+ declare type NumericBooster$1 = {
475
+ column: string;
476
+ factor: number;
477
+ };
478
+ /**
479
+ * Boost records based on the value of a datetime column. It is configured via "origin", "scale", and "decay". The further away from the "origin",
480
+ * 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
481
+ * 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.
482
+ */
483
+ declare type DateBooster$1 = {
484
+ column: string;
485
+ origin?: string;
486
+ scale: string;
487
+ decay: number;
488
+ };
284
489
  declare type FilterList = FilterExpression | FilterExpression[];
285
490
  declare type FilterColumn = FilterColumnIncludes | FilterPredicate | FilterList;
286
491
  /**
@@ -337,7 +542,24 @@ declare type PageConfig = {
337
542
  size?: number;
338
543
  offset?: number;
339
544
  };
340
- declare type ColumnsFilter = string[];
545
+ declare type ColumnsProjection = string[];
546
+ /**
547
+ * Xata Table Record Metadata
548
+ */
549
+ declare type RecordMeta = {
550
+ id: RecordID;
551
+ xata: {
552
+ version: number;
553
+ table?: string;
554
+ highlight?: {
555
+ [key: string]: string[] | {
556
+ [key: string]: any;
557
+ };
558
+ };
559
+ score?: number;
560
+ warnings?: string[];
561
+ };
562
+ };
341
563
  /**
342
564
  * @pattern [a-zA-Z0-9_-~:]+
343
565
  */
@@ -359,16 +581,9 @@ declare type RecordsMetadata = {
359
581
  };
360
582
  };
361
583
  /**
362
- * Xata Table Record
584
+ * Xata Table Record Metadata
363
585
  */
364
- declare type XataRecord$1 = {
365
- id: RecordID;
366
- xata: {
367
- version: number;
368
- table?: string;
369
- warnings?: string[];
370
- };
371
- } & {
586
+ declare type XataRecord$1 = RecordMeta & {
372
587
  [key: string]: any;
373
588
  };
374
589
 
@@ -386,6 +601,7 @@ type schemas_InviteID = InviteID;
386
601
  type schemas_WorkspaceInvite = WorkspaceInvite;
387
602
  type schemas_WorkspaceMembers = WorkspaceMembers;
388
603
  type schemas_InviteKey = InviteKey;
604
+ type schemas_DatabaseMetadata = DatabaseMetadata;
389
605
  type schemas_ListDatabasesResponse = ListDatabasesResponse;
390
606
  type schemas_ListBranchesResponse = ListBranchesResponse;
391
607
  type schemas_ListGitBranchesResponse = ListGitBranchesResponse;
@@ -394,7 +610,9 @@ type schemas_BranchMetadata = BranchMetadata;
394
610
  type schemas_DBBranch = DBBranch;
395
611
  type schemas_StartedFromMetadata = StartedFromMetadata;
396
612
  type schemas_Schema = Schema;
613
+ type schemas_SchemaEditScript = SchemaEditScript;
397
614
  type schemas_Table = Table;
615
+ type schemas_TableEdit = TableEdit;
398
616
  type schemas_Column = Column;
399
617
  type schemas_RevLink = RevLink;
400
618
  type schemas_BranchName = BranchName;
@@ -407,9 +625,27 @@ type schemas_MetricsLatency = MetricsLatency;
407
625
  type schemas_BranchMigration = BranchMigration;
408
626
  type schemas_TableMigration = TableMigration;
409
627
  type schemas_ColumnMigration = ColumnMigration;
628
+ type schemas_Commit = Commit;
629
+ type schemas_Migration = Migration;
630
+ type schemas_MigrationOp = MigrationOp;
631
+ type schemas_MigrationTableOp = MigrationTableOp;
632
+ type schemas_MigrationColumnOp = MigrationColumnOp;
633
+ type schemas_TableOpAdd = TableOpAdd;
634
+ type schemas_TableOpRemove = TableOpRemove;
635
+ type schemas_TableOpRename = TableOpRename;
636
+ type schemas_ColumnOpAdd = ColumnOpAdd;
637
+ type schemas_ColumnOpRemove = ColumnOpRemove;
638
+ type schemas_ColumnOpRename = ColumnOpRename;
639
+ type schemas_MigrationRequest = MigrationRequest;
410
640
  type schemas_SortExpression = SortExpression;
411
641
  type schemas_SortOrder = SortOrder;
642
+ type schemas_FuzzinessExpression = FuzzinessExpression;
643
+ type schemas_PrefixExpression = PrefixExpression;
412
644
  type schemas_FilterExpression = FilterExpression;
645
+ type schemas_SummaryExpressionList = SummaryExpressionList;
646
+ type schemas_SummaryExpression = SummaryExpression;
647
+ type schemas_HighlightExpression = HighlightExpression;
648
+ type schemas_BoosterExpression = BoosterExpression;
413
649
  type schemas_FilterList = FilterList;
414
650
  type schemas_FilterColumn = FilterColumn;
415
651
  type schemas_FilterColumnIncludes = FilterColumnIncludes;
@@ -419,7 +655,8 @@ type schemas_FilterPredicateRangeOp = FilterPredicateRangeOp;
419
655
  type schemas_FilterRangeValue = FilterRangeValue;
420
656
  type schemas_FilterValue = FilterValue;
421
657
  type schemas_PageConfig = PageConfig;
422
- type schemas_ColumnsFilter = ColumnsFilter;
658
+ type schemas_ColumnsProjection = ColumnsProjection;
659
+ type schemas_RecordMeta = RecordMeta;
423
660
  type schemas_RecordID = RecordID;
424
661
  type schemas_TableRename = TableRename;
425
662
  type schemas_RecordsMetadata = RecordsMetadata;
@@ -439,6 +676,7 @@ declare namespace schemas {
439
676
  schemas_WorkspaceInvite as WorkspaceInvite,
440
677
  schemas_WorkspaceMembers as WorkspaceMembers,
441
678
  schemas_InviteKey as InviteKey,
679
+ schemas_DatabaseMetadata as DatabaseMetadata,
442
680
  schemas_ListDatabasesResponse as ListDatabasesResponse,
443
681
  schemas_ListBranchesResponse as ListBranchesResponse,
444
682
  schemas_ListGitBranchesResponse as ListGitBranchesResponse,
@@ -447,7 +685,9 @@ declare namespace schemas {
447
685
  schemas_DBBranch as DBBranch,
448
686
  schemas_StartedFromMetadata as StartedFromMetadata,
449
687
  schemas_Schema as Schema,
688
+ schemas_SchemaEditScript as SchemaEditScript,
450
689
  schemas_Table as Table,
690
+ schemas_TableEdit as TableEdit,
451
691
  schemas_Column as Column,
452
692
  schemas_RevLink as RevLink,
453
693
  schemas_BranchName as BranchName,
@@ -460,9 +700,30 @@ declare namespace schemas {
460
700
  schemas_BranchMigration as BranchMigration,
461
701
  schemas_TableMigration as TableMigration,
462
702
  schemas_ColumnMigration as ColumnMigration,
703
+ schemas_Commit as Commit,
704
+ schemas_Migration as Migration,
705
+ schemas_MigrationOp as MigrationOp,
706
+ schemas_MigrationTableOp as MigrationTableOp,
707
+ schemas_MigrationColumnOp as MigrationColumnOp,
708
+ schemas_TableOpAdd as TableOpAdd,
709
+ schemas_TableOpRemove as TableOpRemove,
710
+ schemas_TableOpRename as TableOpRename,
711
+ schemas_ColumnOpAdd as ColumnOpAdd,
712
+ schemas_ColumnOpRemove as ColumnOpRemove,
713
+ schemas_ColumnOpRename as ColumnOpRename,
714
+ schemas_MigrationRequest as MigrationRequest,
463
715
  schemas_SortExpression as SortExpression,
464
716
  schemas_SortOrder as SortOrder,
717
+ schemas_FuzzinessExpression as FuzzinessExpression,
718
+ schemas_PrefixExpression as PrefixExpression,
465
719
  schemas_FilterExpression as FilterExpression,
720
+ schemas_SummaryExpressionList as SummaryExpressionList,
721
+ schemas_SummaryExpression as SummaryExpression,
722
+ schemas_HighlightExpression as HighlightExpression,
723
+ schemas_BoosterExpression as BoosterExpression,
724
+ ValueBooster$1 as ValueBooster,
725
+ NumericBooster$1 as NumericBooster,
726
+ DateBooster$1 as DateBooster,
466
727
  schemas_FilterList as FilterList,
467
728
  schemas_FilterColumn as FilterColumn,
468
729
  schemas_FilterColumnIncludes as FilterColumnIncludes,
@@ -472,7 +733,8 @@ declare namespace schemas {
472
733
  schemas_FilterRangeValue as FilterRangeValue,
473
734
  schemas_FilterValue as FilterValue,
474
735
  schemas_PageConfig as PageConfig,
475
- schemas_ColumnsFilter as ColumnsFilter,
736
+ schemas_ColumnsProjection as ColumnsProjection,
737
+ schemas_RecordMeta as RecordMeta,
476
738
  schemas_RecordID as RecordID,
477
739
  schemas_TableRename as TableRename,
478
740
  schemas_RecordsMetadata as RecordsMetadata,
@@ -507,11 +769,22 @@ declare type BulkError = {
507
769
  status?: number;
508
770
  }[];
509
771
  };
772
+ declare type BulkInsertResponse = {
773
+ recordIDs: string[];
774
+ } | {
775
+ records: XataRecord$1[];
776
+ };
510
777
  declare type BranchMigrationPlan = {
511
778
  version: number;
512
779
  migration: BranchMigration;
513
780
  };
514
- declare type RecordUpdateResponse = {
781
+ declare type RecordResponse = XataRecord$1;
782
+ declare type SchemaCompareResponse = {
783
+ source: Schema;
784
+ target: Schema;
785
+ edits: SchemaEditScript;
786
+ };
787
+ declare type RecordUpdateResponse = XataRecord$1 | {
515
788
  id: string;
516
789
  xata: {
517
790
  version: number;
@@ -521,6 +794,9 @@ declare type QueryResponse = {
521
794
  records: XataRecord$1[];
522
795
  meta: RecordsMetadata;
523
796
  };
797
+ declare type SummarizeResponse = {
798
+ summary: Record<string, any>[];
799
+ };
524
800
  declare type SearchResponse = {
525
801
  records: XataRecord$1[];
526
802
  };
@@ -535,9 +811,13 @@ type responses_SimpleError = SimpleError;
535
811
  type responses_BadRequestError = BadRequestError;
536
812
  type responses_AuthError = AuthError;
537
813
  type responses_BulkError = BulkError;
814
+ type responses_BulkInsertResponse = BulkInsertResponse;
538
815
  type responses_BranchMigrationPlan = BranchMigrationPlan;
816
+ type responses_RecordResponse = RecordResponse;
817
+ type responses_SchemaCompareResponse = SchemaCompareResponse;
539
818
  type responses_RecordUpdateResponse = RecordUpdateResponse;
540
819
  type responses_QueryResponse = QueryResponse;
820
+ type responses_SummarizeResponse = SummarizeResponse;
541
821
  type responses_SearchResponse = SearchResponse;
542
822
  type responses_MigrationIdResponse = MigrationIdResponse;
543
823
  declare namespace responses {
@@ -546,9 +826,13 @@ declare namespace responses {
546
826
  responses_BadRequestError as BadRequestError,
547
827
  responses_AuthError as AuthError,
548
828
  responses_BulkError as BulkError,
829
+ responses_BulkInsertResponse as BulkInsertResponse,
549
830
  responses_BranchMigrationPlan as BranchMigrationPlan,
831
+ responses_RecordResponse as RecordResponse,
832
+ responses_SchemaCompareResponse as SchemaCompareResponse,
550
833
  responses_RecordUpdateResponse as RecordUpdateResponse,
551
834
  responses_QueryResponse as QueryResponse,
835
+ responses_SummarizeResponse as SummarizeResponse,
552
836
  responses_SearchResponse as SearchResponse,
553
837
  responses_MigrationIdResponse as MigrationIdResponse,
554
838
  };
@@ -852,6 +1136,9 @@ declare type InviteWorkspaceMemberError = ErrorWrapper<{
852
1136
  } | {
853
1137
  status: 404;
854
1138
  payload: SimpleError;
1139
+ } | {
1140
+ status: 409;
1141
+ payload: SimpleError;
855
1142
  }>;
856
1143
  declare type InviteWorkspaceMemberRequestBody = {
857
1144
  email: string;
@@ -865,6 +1152,34 @@ declare type InviteWorkspaceMemberVariables = {
865
1152
  * Invite some user to join the workspace with the given role
866
1153
  */
867
1154
  declare const inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<WorkspaceInvite>;
1155
+ declare type UpdateWorkspaceMemberInvitePathParams = {
1156
+ workspaceId: WorkspaceID;
1157
+ inviteId: InviteID;
1158
+ };
1159
+ declare type UpdateWorkspaceMemberInviteError = ErrorWrapper<{
1160
+ status: 400;
1161
+ payload: BadRequestError;
1162
+ } | {
1163
+ status: 401;
1164
+ payload: AuthError;
1165
+ } | {
1166
+ status: 404;
1167
+ payload: SimpleError;
1168
+ } | {
1169
+ status: 422;
1170
+ payload: SimpleError;
1171
+ }>;
1172
+ declare type UpdateWorkspaceMemberInviteRequestBody = {
1173
+ role: Role;
1174
+ };
1175
+ declare type UpdateWorkspaceMemberInviteVariables = {
1176
+ body: UpdateWorkspaceMemberInviteRequestBody;
1177
+ pathParams: UpdateWorkspaceMemberInvitePathParams;
1178
+ } & FetcherExtraProps;
1179
+ /**
1180
+ * 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.
1181
+ */
1182
+ declare const updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
868
1183
  declare type CancelWorkspaceMemberInvitePathParams = {
869
1184
  workspaceId: WorkspaceID;
870
1185
  inviteId: InviteID;
@@ -982,7 +1297,6 @@ declare type CreateDatabaseResponse = {
982
1297
  branchName?: string;
983
1298
  };
984
1299
  declare type CreateDatabaseRequestBody = {
985
- displayName?: string;
986
1300
  branchName?: string;
987
1301
  ui?: {
988
1302
  color?: string;
@@ -1018,6 +1332,54 @@ declare type DeleteDatabaseVariables = {
1018
1332
  * Delete a database and all of its branches and tables permanently.
1019
1333
  */
1020
1334
  declare const deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
1335
+ declare type GetDatabaseMetadataPathParams = {
1336
+ dbName: DBName;
1337
+ workspace: string;
1338
+ };
1339
+ declare type GetDatabaseMetadataError = ErrorWrapper<{
1340
+ status: 400;
1341
+ payload: BadRequestError;
1342
+ } | {
1343
+ status: 401;
1344
+ payload: AuthError;
1345
+ } | {
1346
+ status: 404;
1347
+ payload: SimpleError;
1348
+ }>;
1349
+ declare type GetDatabaseMetadataVariables = {
1350
+ pathParams: GetDatabaseMetadataPathParams;
1351
+ } & FetcherExtraProps;
1352
+ /**
1353
+ * Retrieve metadata of the given database
1354
+ */
1355
+ declare const getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
1356
+ declare type UpdateDatabaseMetadataPathParams = {
1357
+ dbName: DBName;
1358
+ workspace: string;
1359
+ };
1360
+ declare type UpdateDatabaseMetadataError = ErrorWrapper<{
1361
+ status: 400;
1362
+ payload: BadRequestError;
1363
+ } | {
1364
+ status: 401;
1365
+ payload: AuthError;
1366
+ } | {
1367
+ status: 404;
1368
+ payload: SimpleError;
1369
+ }>;
1370
+ declare type UpdateDatabaseMetadataRequestBody = {
1371
+ ui?: {
1372
+ color?: string;
1373
+ };
1374
+ };
1375
+ declare type UpdateDatabaseMetadataVariables = {
1376
+ body?: UpdateDatabaseMetadataRequestBody;
1377
+ pathParams: UpdateDatabaseMetadataPathParams;
1378
+ } & FetcherExtraProps;
1379
+ /**
1380
+ * Update the color of the selected database
1381
+ */
1382
+ declare const updateDatabaseMetadata: (variables: UpdateDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
1021
1383
  declare type GetGitBranchesMappingPathParams = {
1022
1384
  dbName: DBName;
1023
1385
  workspace: string;
@@ -1151,14 +1513,15 @@ declare type ResolveBranchVariables = {
1151
1513
  } & FetcherExtraProps;
1152
1514
  /**
1153
1515
  * In order to resolve the database branch, the following algorithm is used:
1154
- * * if the `gitBranch` is found in the [git branches mapping](), the associated Xata branch is returned
1516
+ * * if the `gitBranch` was provided and is found in the [git branches mapping](/api-reference/dbs/db_name/gitBranches), the associated Xata branch is returned
1155
1517
  * * else, if a Xata branch with the exact same name as `gitBranch` exists, return it
1156
- * * else, return the default branch of the DB (currently `main` or the first branch)
1518
+ * * else, if `fallbackBranch` is provided and a branch with that name exists, return it
1519
+ * * else, return the default branch of the DB (`main` or the first branch)
1157
1520
  *
1158
1521
  * Example call:
1159
1522
  *
1160
1523
  * ```json
1161
- * // GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test?fallbackBranch=tsg
1524
+ * // GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test&fallbackBranch=tsg
1162
1525
  * ```
1163
1526
  *
1164
1527
  * Example response:
@@ -1174,11 +1537,11 @@ declare type ResolveBranchVariables = {
1174
1537
  * ```
1175
1538
  */
1176
1539
  declare const resolveBranch: (variables: ResolveBranchVariables) => Promise<ResolveBranchResponse>;
1177
- declare type GetBranchDetailsPathParams = {
1178
- dbBranchName: DBBranchName;
1540
+ declare type ListMigrationRequestsPathParams = {
1541
+ dbName: DBName;
1179
1542
  workspace: string;
1180
1543
  };
1181
- declare type GetBranchDetailsError = ErrorWrapper<{
1544
+ declare type ListMigrationRequestsError = ErrorWrapper<{
1182
1545
  status: 400;
1183
1546
  payload: BadRequestError;
1184
1547
  } | {
@@ -1188,18 +1551,26 @@ declare type GetBranchDetailsError = ErrorWrapper<{
1188
1551
  status: 404;
1189
1552
  payload: SimpleError;
1190
1553
  }>;
1191
- declare type GetBranchDetailsVariables = {
1192
- pathParams: GetBranchDetailsPathParams;
1554
+ declare type ListMigrationRequestsResponse = {
1555
+ migrationRequests: MigrationRequest[];
1556
+ meta: RecordsMetadata;
1557
+ };
1558
+ declare type ListMigrationRequestsRequestBody = {
1559
+ filter?: FilterExpression;
1560
+ sort?: SortExpression;
1561
+ page?: PageConfig;
1562
+ columns?: ColumnsProjection;
1563
+ };
1564
+ declare type ListMigrationRequestsVariables = {
1565
+ body?: ListMigrationRequestsRequestBody;
1566
+ pathParams: ListMigrationRequestsPathParams;
1193
1567
  } & FetcherExtraProps;
1194
- declare const getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
1195
- declare type CreateBranchPathParams = {
1196
- dbBranchName: DBBranchName;
1568
+ declare const listMigrationRequests: (variables: ListMigrationRequestsVariables) => Promise<ListMigrationRequestsResponse>;
1569
+ declare type CreateMigrationRequestPathParams = {
1570
+ dbName: DBName;
1197
1571
  workspace: string;
1198
1572
  };
1199
- declare type CreateBranchQueryParams = {
1200
- from?: string;
1201
- };
1202
- declare type CreateBranchError = ErrorWrapper<{
1573
+ declare type CreateMigrationRequestError = ErrorWrapper<{
1203
1574
  status: 400;
1204
1575
  payload: BadRequestError;
1205
1576
  } | {
@@ -1209,21 +1580,26 @@ declare type CreateBranchError = ErrorWrapper<{
1209
1580
  status: 404;
1210
1581
  payload: SimpleError;
1211
1582
  }>;
1212
- declare type CreateBranchRequestBody = {
1213
- from?: string;
1214
- metadata?: BranchMetadata;
1583
+ declare type CreateMigrationRequestResponse = {
1584
+ number: number;
1215
1585
  };
1216
- declare type CreateBranchVariables = {
1217
- body?: CreateBranchRequestBody;
1218
- pathParams: CreateBranchPathParams;
1219
- queryParams?: CreateBranchQueryParams;
1586
+ declare type CreateMigrationRequestRequestBody = {
1587
+ source: string;
1588
+ target: string;
1589
+ title: string;
1590
+ body?: string;
1591
+ };
1592
+ declare type CreateMigrationRequestVariables = {
1593
+ body: CreateMigrationRequestRequestBody;
1594
+ pathParams: CreateMigrationRequestPathParams;
1220
1595
  } & FetcherExtraProps;
1221
- declare const createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
1222
- declare type DeleteBranchPathParams = {
1223
- dbBranchName: DBBranchName;
1596
+ declare const createMigrationRequest: (variables: CreateMigrationRequestVariables) => Promise<CreateMigrationRequestResponse>;
1597
+ declare type GetMigrationRequestPathParams = {
1598
+ dbName: DBName;
1599
+ mrNumber: number;
1224
1600
  workspace: string;
1225
1601
  };
1226
- declare type DeleteBranchError = ErrorWrapper<{
1602
+ declare type GetMigrationRequestError = ErrorWrapper<{
1227
1603
  status: 400;
1228
1604
  payload: BadRequestError;
1229
1605
  } | {
@@ -1233,18 +1609,16 @@ declare type DeleteBranchError = ErrorWrapper<{
1233
1609
  status: 404;
1234
1610
  payload: SimpleError;
1235
1611
  }>;
1236
- declare type DeleteBranchVariables = {
1237
- pathParams: DeleteBranchPathParams;
1612
+ declare type GetMigrationRequestVariables = {
1613
+ pathParams: GetMigrationRequestPathParams;
1238
1614
  } & FetcherExtraProps;
1239
- /**
1240
- * Delete the branch in the database and all its resources
1241
- */
1242
- declare const deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
1243
- declare type UpdateBranchMetadataPathParams = {
1244
- dbBranchName: DBBranchName;
1615
+ declare const getMigrationRequest: (variables: GetMigrationRequestVariables) => Promise<MigrationRequest>;
1616
+ declare type UpdateMigrationRequestPathParams = {
1617
+ dbName: DBName;
1618
+ mrNumber: number;
1245
1619
  workspace: string;
1246
1620
  };
1247
- declare type UpdateBranchMetadataError = ErrorWrapper<{
1621
+ declare type UpdateMigrationRequestError = ErrorWrapper<{
1248
1622
  status: 400;
1249
1623
  payload: BadRequestError;
1250
1624
  } | {
@@ -1254,19 +1628,22 @@ declare type UpdateBranchMetadataError = ErrorWrapper<{
1254
1628
  status: 404;
1255
1629
  payload: SimpleError;
1256
1630
  }>;
1257
- declare type UpdateBranchMetadataVariables = {
1258
- body?: BranchMetadata;
1259
- pathParams: UpdateBranchMetadataPathParams;
1631
+ declare type UpdateMigrationRequestRequestBody = {
1632
+ title?: string;
1633
+ body?: string;
1634
+ status?: 'open' | 'closed';
1635
+ };
1636
+ declare type UpdateMigrationRequestVariables = {
1637
+ body?: UpdateMigrationRequestRequestBody;
1638
+ pathParams: UpdateMigrationRequestPathParams;
1260
1639
  } & FetcherExtraProps;
1261
- /**
1262
- * Update the branch metadata
1263
- */
1264
- declare const updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
1265
- declare type GetBranchMetadataPathParams = {
1266
- dbBranchName: DBBranchName;
1640
+ declare const updateMigrationRequest: (variables: UpdateMigrationRequestVariables) => Promise<undefined>;
1641
+ declare type ListMigrationRequestsCommitsPathParams = {
1642
+ dbName: DBName;
1643
+ mrNumber: number;
1267
1644
  workspace: string;
1268
1645
  };
1269
- declare type GetBranchMetadataError = ErrorWrapper<{
1646
+ declare type ListMigrationRequestsCommitsError = ErrorWrapper<{
1270
1647
  status: 400;
1271
1648
  payload: BadRequestError;
1272
1649
  } | {
@@ -1276,15 +1653,31 @@ declare type GetBranchMetadataError = ErrorWrapper<{
1276
1653
  status: 404;
1277
1654
  payload: SimpleError;
1278
1655
  }>;
1279
- declare type GetBranchMetadataVariables = {
1280
- pathParams: GetBranchMetadataPathParams;
1656
+ declare type ListMigrationRequestsCommitsResponse = {
1657
+ meta: {
1658
+ cursor: string;
1659
+ more: boolean;
1660
+ };
1661
+ logs: Commit[];
1662
+ };
1663
+ declare type ListMigrationRequestsCommitsRequestBody = {
1664
+ page?: {
1665
+ after?: string;
1666
+ before?: string;
1667
+ size?: number;
1668
+ };
1669
+ };
1670
+ declare type ListMigrationRequestsCommitsVariables = {
1671
+ body?: ListMigrationRequestsCommitsRequestBody;
1672
+ pathParams: ListMigrationRequestsCommitsPathParams;
1281
1673
  } & FetcherExtraProps;
1282
- declare const getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
1283
- declare type GetBranchMigrationHistoryPathParams = {
1284
- dbBranchName: DBBranchName;
1674
+ declare const listMigrationRequestsCommits: (variables: ListMigrationRequestsCommitsVariables) => Promise<ListMigrationRequestsCommitsResponse>;
1675
+ declare type CompareMigrationRequestPathParams = {
1676
+ dbName: DBName;
1677
+ mrNumber: number;
1285
1678
  workspace: string;
1286
1679
  };
1287
- declare type GetBranchMigrationHistoryError = ErrorWrapper<{
1680
+ declare type CompareMigrationRequestError = ErrorWrapper<{
1288
1681
  status: 400;
1289
1682
  payload: BadRequestError;
1290
1683
  } | {
@@ -1294,11 +1687,180 @@ declare type GetBranchMigrationHistoryError = ErrorWrapper<{
1294
1687
  status: 404;
1295
1688
  payload: SimpleError;
1296
1689
  }>;
1297
- declare type GetBranchMigrationHistoryResponse = {
1298
- startedFrom?: StartedFromMetadata;
1299
- migrations?: BranchMigration[];
1690
+ declare type CompareMigrationRequestVariables = {
1691
+ pathParams: CompareMigrationRequestPathParams;
1692
+ } & FetcherExtraProps;
1693
+ declare const compareMigrationRequest: (variables: CompareMigrationRequestVariables) => Promise<SchemaCompareResponse>;
1694
+ declare type GetMigrationRequestIsMergedPathParams = {
1695
+ dbName: DBName;
1696
+ mrNumber: number;
1697
+ workspace: string;
1300
1698
  };
1301
- declare type GetBranchMigrationHistoryRequestBody = {
1699
+ declare type GetMigrationRequestIsMergedError = ErrorWrapper<{
1700
+ status: 400;
1701
+ payload: BadRequestError;
1702
+ } | {
1703
+ status: 401;
1704
+ payload: AuthError;
1705
+ } | {
1706
+ status: 404;
1707
+ payload: SimpleError;
1708
+ }>;
1709
+ declare type GetMigrationRequestIsMergedResponse = {
1710
+ merged?: boolean;
1711
+ };
1712
+ declare type GetMigrationRequestIsMergedVariables = {
1713
+ pathParams: GetMigrationRequestIsMergedPathParams;
1714
+ } & FetcherExtraProps;
1715
+ declare const getMigrationRequestIsMerged: (variables: GetMigrationRequestIsMergedVariables) => Promise<GetMigrationRequestIsMergedResponse>;
1716
+ declare type MergeMigrationRequestPathParams = {
1717
+ dbName: DBName;
1718
+ mrNumber: number;
1719
+ workspace: string;
1720
+ };
1721
+ declare type MergeMigrationRequestError = ErrorWrapper<{
1722
+ status: 400;
1723
+ payload: BadRequestError;
1724
+ } | {
1725
+ status: 401;
1726
+ payload: AuthError;
1727
+ } | {
1728
+ status: 404;
1729
+ payload: SimpleError;
1730
+ }>;
1731
+ declare type MergeMigrationRequestVariables = {
1732
+ pathParams: MergeMigrationRequestPathParams;
1733
+ } & FetcherExtraProps;
1734
+ declare const mergeMigrationRequest: (variables: MergeMigrationRequestVariables) => Promise<Commit>;
1735
+ declare type GetBranchDetailsPathParams = {
1736
+ dbBranchName: DBBranchName;
1737
+ workspace: string;
1738
+ };
1739
+ declare type GetBranchDetailsError = ErrorWrapper<{
1740
+ status: 400;
1741
+ payload: BadRequestError;
1742
+ } | {
1743
+ status: 401;
1744
+ payload: AuthError;
1745
+ } | {
1746
+ status: 404;
1747
+ payload: SimpleError;
1748
+ }>;
1749
+ declare type GetBranchDetailsVariables = {
1750
+ pathParams: GetBranchDetailsPathParams;
1751
+ } & FetcherExtraProps;
1752
+ declare const getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
1753
+ declare type CreateBranchPathParams = {
1754
+ dbBranchName: DBBranchName;
1755
+ workspace: string;
1756
+ };
1757
+ declare type CreateBranchQueryParams = {
1758
+ from?: string;
1759
+ };
1760
+ declare type CreateBranchError = ErrorWrapper<{
1761
+ status: 400;
1762
+ payload: BadRequestError;
1763
+ } | {
1764
+ status: 401;
1765
+ payload: AuthError;
1766
+ } | {
1767
+ status: 404;
1768
+ payload: SimpleError;
1769
+ }>;
1770
+ declare type CreateBranchResponse = {
1771
+ databaseName: string;
1772
+ branchName: string;
1773
+ };
1774
+ declare type CreateBranchRequestBody = {
1775
+ from?: string;
1776
+ metadata?: BranchMetadata;
1777
+ };
1778
+ declare type CreateBranchVariables = {
1779
+ body?: CreateBranchRequestBody;
1780
+ pathParams: CreateBranchPathParams;
1781
+ queryParams?: CreateBranchQueryParams;
1782
+ } & FetcherExtraProps;
1783
+ declare const createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
1784
+ declare type DeleteBranchPathParams = {
1785
+ dbBranchName: DBBranchName;
1786
+ workspace: string;
1787
+ };
1788
+ declare type DeleteBranchError = ErrorWrapper<{
1789
+ status: 400;
1790
+ payload: BadRequestError;
1791
+ } | {
1792
+ status: 401;
1793
+ payload: AuthError;
1794
+ } | {
1795
+ status: 404;
1796
+ payload: SimpleError;
1797
+ }>;
1798
+ declare type DeleteBranchVariables = {
1799
+ pathParams: DeleteBranchPathParams;
1800
+ } & FetcherExtraProps;
1801
+ /**
1802
+ * Delete the branch in the database and all its resources
1803
+ */
1804
+ declare const deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
1805
+ declare type UpdateBranchMetadataPathParams = {
1806
+ dbBranchName: DBBranchName;
1807
+ workspace: string;
1808
+ };
1809
+ declare type UpdateBranchMetadataError = ErrorWrapper<{
1810
+ status: 400;
1811
+ payload: BadRequestError;
1812
+ } | {
1813
+ status: 401;
1814
+ payload: AuthError;
1815
+ } | {
1816
+ status: 404;
1817
+ payload: SimpleError;
1818
+ }>;
1819
+ declare type UpdateBranchMetadataVariables = {
1820
+ body?: BranchMetadata;
1821
+ pathParams: UpdateBranchMetadataPathParams;
1822
+ } & FetcherExtraProps;
1823
+ /**
1824
+ * Update the branch metadata
1825
+ */
1826
+ declare const updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
1827
+ declare type GetBranchMetadataPathParams = {
1828
+ dbBranchName: DBBranchName;
1829
+ workspace: string;
1830
+ };
1831
+ declare type GetBranchMetadataError = ErrorWrapper<{
1832
+ status: 400;
1833
+ payload: BadRequestError;
1834
+ } | {
1835
+ status: 401;
1836
+ payload: AuthError;
1837
+ } | {
1838
+ status: 404;
1839
+ payload: SimpleError;
1840
+ }>;
1841
+ declare type GetBranchMetadataVariables = {
1842
+ pathParams: GetBranchMetadataPathParams;
1843
+ } & FetcherExtraProps;
1844
+ declare const getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
1845
+ declare type GetBranchMigrationHistoryPathParams = {
1846
+ dbBranchName: DBBranchName;
1847
+ workspace: string;
1848
+ };
1849
+ declare type GetBranchMigrationHistoryError = ErrorWrapper<{
1850
+ status: 400;
1851
+ payload: BadRequestError;
1852
+ } | {
1853
+ status: 401;
1854
+ payload: AuthError;
1855
+ } | {
1856
+ status: 404;
1857
+ payload: SimpleError;
1858
+ }>;
1859
+ declare type GetBranchMigrationHistoryResponse = {
1860
+ startedFrom?: StartedFromMetadata;
1861
+ migrations?: BranchMigration[];
1862
+ };
1863
+ declare type GetBranchMigrationHistoryRequestBody = {
1302
1864
  limit?: number;
1303
1865
  startFrom?: string;
1304
1866
  };
@@ -1355,6 +1917,157 @@ declare type GetBranchMigrationPlanVariables = {
1355
1917
  * Compute a migration plan from a target schema the branch should be migrated too.
1356
1918
  */
1357
1919
  declare const getBranchMigrationPlan: (variables: GetBranchMigrationPlanVariables) => Promise<BranchMigrationPlan>;
1920
+ declare type CompareBranchWithUserSchemaPathParams = {
1921
+ dbBranchName: DBBranchName;
1922
+ workspace: string;
1923
+ };
1924
+ declare type CompareBranchWithUserSchemaError = ErrorWrapper<{
1925
+ status: 400;
1926
+ payload: BadRequestError;
1927
+ } | {
1928
+ status: 401;
1929
+ payload: AuthError;
1930
+ } | {
1931
+ status: 404;
1932
+ payload: SimpleError;
1933
+ }>;
1934
+ declare type CompareBranchWithUserSchemaRequestBody = {
1935
+ schema: Schema;
1936
+ };
1937
+ declare type CompareBranchWithUserSchemaVariables = {
1938
+ body: CompareBranchWithUserSchemaRequestBody;
1939
+ pathParams: CompareBranchWithUserSchemaPathParams;
1940
+ } & FetcherExtraProps;
1941
+ declare const compareBranchWithUserSchema: (variables: CompareBranchWithUserSchemaVariables) => Promise<SchemaCompareResponse>;
1942
+ declare type CompareBranchSchemasPathParams = {
1943
+ dbBranchName: DBBranchName;
1944
+ branchName: BranchName;
1945
+ workspace: string;
1946
+ };
1947
+ declare type CompareBranchSchemasError = ErrorWrapper<{
1948
+ status: 400;
1949
+ payload: BadRequestError;
1950
+ } | {
1951
+ status: 401;
1952
+ payload: AuthError;
1953
+ } | {
1954
+ status: 404;
1955
+ payload: SimpleError;
1956
+ }>;
1957
+ declare type CompareBranchSchemasVariables = {
1958
+ body?: Record<string, any>;
1959
+ pathParams: CompareBranchSchemasPathParams;
1960
+ } & FetcherExtraProps;
1961
+ declare const compareBranchSchemas: (variables: CompareBranchSchemasVariables) => Promise<SchemaCompareResponse>;
1962
+ declare type UpdateBranchSchemaPathParams = {
1963
+ dbBranchName: DBBranchName;
1964
+ workspace: string;
1965
+ };
1966
+ declare type UpdateBranchSchemaError = ErrorWrapper<{
1967
+ status: 400;
1968
+ payload: BadRequestError;
1969
+ } | {
1970
+ status: 401;
1971
+ payload: AuthError;
1972
+ } | {
1973
+ status: 404;
1974
+ payload: SimpleError;
1975
+ }>;
1976
+ declare type UpdateBranchSchemaResponse = {
1977
+ id: string;
1978
+ parentID: string;
1979
+ };
1980
+ declare type UpdateBranchSchemaVariables = {
1981
+ body: Migration;
1982
+ pathParams: UpdateBranchSchemaPathParams;
1983
+ } & FetcherExtraProps;
1984
+ declare const updateBranchSchema: (variables: UpdateBranchSchemaVariables) => Promise<UpdateBranchSchemaResponse>;
1985
+ declare type PreviewBranchSchemaEditPathParams = {
1986
+ dbBranchName: DBBranchName;
1987
+ workspace: string;
1988
+ };
1989
+ declare type PreviewBranchSchemaEditError = ErrorWrapper<{
1990
+ status: 400;
1991
+ payload: BadRequestError;
1992
+ } | {
1993
+ status: 401;
1994
+ payload: AuthError;
1995
+ } | {
1996
+ status: 404;
1997
+ payload: SimpleError;
1998
+ }>;
1999
+ declare type PreviewBranchSchemaEditResponse = {
2000
+ original: Schema;
2001
+ updated: Schema;
2002
+ };
2003
+ declare type PreviewBranchSchemaEditRequestBody = {
2004
+ edits?: SchemaEditScript;
2005
+ operations?: MigrationOp[];
2006
+ };
2007
+ declare type PreviewBranchSchemaEditVariables = {
2008
+ body?: PreviewBranchSchemaEditRequestBody;
2009
+ pathParams: PreviewBranchSchemaEditPathParams;
2010
+ } & FetcherExtraProps;
2011
+ declare const previewBranchSchemaEdit: (variables: PreviewBranchSchemaEditVariables) => Promise<PreviewBranchSchemaEditResponse>;
2012
+ declare type ApplyBranchSchemaEditPathParams = {
2013
+ dbBranchName: DBBranchName;
2014
+ workspace: string;
2015
+ };
2016
+ declare type ApplyBranchSchemaEditError = ErrorWrapper<{
2017
+ status: 400;
2018
+ payload: BadRequestError;
2019
+ } | {
2020
+ status: 401;
2021
+ payload: AuthError;
2022
+ } | {
2023
+ status: 404;
2024
+ payload: SimpleError;
2025
+ }>;
2026
+ declare type ApplyBranchSchemaEditResponse = {
2027
+ id: string;
2028
+ parentID: string;
2029
+ };
2030
+ declare type ApplyBranchSchemaEditRequestBody = {
2031
+ edits: SchemaEditScript;
2032
+ };
2033
+ declare type ApplyBranchSchemaEditVariables = {
2034
+ body: ApplyBranchSchemaEditRequestBody;
2035
+ pathParams: ApplyBranchSchemaEditPathParams;
2036
+ } & FetcherExtraProps;
2037
+ declare const applyBranchSchemaEdit: (variables: ApplyBranchSchemaEditVariables) => Promise<ApplyBranchSchemaEditResponse>;
2038
+ declare type GetBranchSchemaHistoryPathParams = {
2039
+ dbBranchName: DBBranchName;
2040
+ workspace: string;
2041
+ };
2042
+ declare type GetBranchSchemaHistoryError = ErrorWrapper<{
2043
+ status: 400;
2044
+ payload: BadRequestError;
2045
+ } | {
2046
+ status: 401;
2047
+ payload: AuthError;
2048
+ } | {
2049
+ status: 404;
2050
+ payload: SimpleError;
2051
+ }>;
2052
+ declare type GetBranchSchemaHistoryResponse = {
2053
+ meta: {
2054
+ cursor: string;
2055
+ more: boolean;
2056
+ };
2057
+ logs: Commit[];
2058
+ };
2059
+ declare type GetBranchSchemaHistoryRequestBody = {
2060
+ page?: {
2061
+ after?: string;
2062
+ before?: string;
2063
+ size?: number;
2064
+ };
2065
+ };
2066
+ declare type GetBranchSchemaHistoryVariables = {
2067
+ body?: GetBranchSchemaHistoryRequestBody;
2068
+ pathParams: GetBranchSchemaHistoryPathParams;
2069
+ } & FetcherExtraProps;
2070
+ declare const getBranchSchemaHistory: (variables: GetBranchSchemaHistoryVariables) => Promise<GetBranchSchemaHistoryResponse>;
1358
2071
  declare type GetBranchStatsPathParams = {
1359
2072
  dbBranchName: DBBranchName;
1360
2073
  workspace: string;
@@ -1405,13 +2118,17 @@ declare type CreateTableError = ErrorWrapper<{
1405
2118
  status: 422;
1406
2119
  payload: SimpleError;
1407
2120
  }>;
2121
+ declare type CreateTableResponse = {
2122
+ branchName: string;
2123
+ tableName: string;
2124
+ };
1408
2125
  declare type CreateTableVariables = {
1409
2126
  pathParams: CreateTablePathParams;
1410
2127
  } & FetcherExtraProps;
1411
2128
  /**
1412
2129
  * Creates a new table with the given name. Returns 422 if a table with the same name already exists.
1413
2130
  */
1414
- declare const createTable: (variables: CreateTableVariables) => Promise<undefined>;
2131
+ declare const createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
1415
2132
  declare type DeleteTablePathParams = {
1416
2133
  dbBranchName: DBBranchName;
1417
2134
  tableName: TableName;
@@ -1458,8 +2175,9 @@ declare type UpdateTableVariables = {
1458
2175
  *
1459
2176
  * In the example below, we rename a table from “users” to “people”:
1460
2177
  *
1461
- * ```jsx
1462
- * PATCH /db/test:main/tables/users
2178
+ * ```json
2179
+ * // PATCH /db/test:main/tables/users
2180
+ *
1463
2181
  * {
1464
2182
  * "name": "people"
1465
2183
  * }
@@ -1643,6 +2361,9 @@ declare type InsertRecordPathParams = {
1643
2361
  tableName: TableName;
1644
2362
  workspace: string;
1645
2363
  };
2364
+ declare type InsertRecordQueryParams = {
2365
+ columns?: ColumnsProjection;
2366
+ };
1646
2367
  declare type InsertRecordError = ErrorWrapper<{
1647
2368
  status: 400;
1648
2369
  payload: BadRequestError;
@@ -1653,20 +2374,15 @@ declare type InsertRecordError = ErrorWrapper<{
1653
2374
  status: 404;
1654
2375
  payload: SimpleError;
1655
2376
  }>;
1656
- declare type InsertRecordResponse = {
1657
- id: string;
1658
- xata: {
1659
- version: number;
1660
- };
1661
- };
1662
2377
  declare type InsertRecordVariables = {
1663
2378
  body?: Record<string, any>;
1664
2379
  pathParams: InsertRecordPathParams;
2380
+ queryParams?: InsertRecordQueryParams;
1665
2381
  } & FetcherExtraProps;
1666
2382
  /**
1667
2383
  * Insert a new Record into the Table
1668
2384
  */
1669
- declare const insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
2385
+ declare const insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
1670
2386
  declare type InsertRecordWithIDPathParams = {
1671
2387
  dbBranchName: DBBranchName;
1672
2388
  tableName: TableName;
@@ -1674,6 +2390,7 @@ declare type InsertRecordWithIDPathParams = {
1674
2390
  workspace: string;
1675
2391
  };
1676
2392
  declare type InsertRecordWithIDQueryParams = {
2393
+ columns?: ColumnsProjection;
1677
2394
  createOnly?: boolean;
1678
2395
  ifVersion?: number;
1679
2396
  };
@@ -1706,6 +2423,7 @@ declare type UpdateRecordWithIDPathParams = {
1706
2423
  workspace: string;
1707
2424
  };
1708
2425
  declare type UpdateRecordWithIDQueryParams = {
2426
+ columns?: ColumnsProjection;
1709
2427
  ifVersion?: number;
1710
2428
  };
1711
2429
  declare type UpdateRecordWithIDError = ErrorWrapper<{
@@ -1734,6 +2452,7 @@ declare type UpsertRecordWithIDPathParams = {
1734
2452
  workspace: string;
1735
2453
  };
1736
2454
  declare type UpsertRecordWithIDQueryParams = {
2455
+ columns?: ColumnsProjection;
1737
2456
  ifVersion?: number;
1738
2457
  };
1739
2458
  declare type UpsertRecordWithIDError = ErrorWrapper<{
@@ -1761,6 +2480,9 @@ declare type DeleteRecordPathParams = {
1761
2480
  recordId: RecordID;
1762
2481
  workspace: string;
1763
2482
  };
2483
+ declare type DeleteRecordQueryParams = {
2484
+ columns?: ColumnsProjection;
2485
+ };
1764
2486
  declare type DeleteRecordError = ErrorWrapper<{
1765
2487
  status: 400;
1766
2488
  payload: BadRequestError;
@@ -1773,14 +2495,18 @@ declare type DeleteRecordError = ErrorWrapper<{
1773
2495
  }>;
1774
2496
  declare type DeleteRecordVariables = {
1775
2497
  pathParams: DeleteRecordPathParams;
2498
+ queryParams?: DeleteRecordQueryParams;
1776
2499
  } & FetcherExtraProps;
1777
- declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
2500
+ declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
1778
2501
  declare type GetRecordPathParams = {
1779
2502
  dbBranchName: DBBranchName;
1780
2503
  tableName: TableName;
1781
2504
  recordId: RecordID;
1782
2505
  workspace: string;
1783
2506
  };
2507
+ declare type GetRecordQueryParams = {
2508
+ columns?: ColumnsProjection;
2509
+ };
1784
2510
  declare type GetRecordError = ErrorWrapper<{
1785
2511
  status: 400;
1786
2512
  payload: BadRequestError;
@@ -1791,12 +2517,9 @@ declare type GetRecordError = ErrorWrapper<{
1791
2517
  status: 404;
1792
2518
  payload: SimpleError;
1793
2519
  }>;
1794
- declare type GetRecordRequestBody = {
1795
- columns?: ColumnsFilter;
1796
- };
1797
2520
  declare type GetRecordVariables = {
1798
- body?: GetRecordRequestBody;
1799
2521
  pathParams: GetRecordPathParams;
2522
+ queryParams?: GetRecordQueryParams;
1800
2523
  } & FetcherExtraProps;
1801
2524
  /**
1802
2525
  * Retrieve record by ID
@@ -1807,6 +2530,9 @@ declare type BulkInsertTableRecordsPathParams = {
1807
2530
  tableName: TableName;
1808
2531
  workspace: string;
1809
2532
  };
2533
+ declare type BulkInsertTableRecordsQueryParams = {
2534
+ columns?: ColumnsProjection;
2535
+ };
1810
2536
  declare type BulkInsertTableRecordsError = ErrorWrapper<{
1811
2537
  status: 400;
1812
2538
  payload: BulkError;
@@ -1816,21 +2542,22 @@ declare type BulkInsertTableRecordsError = ErrorWrapper<{
1816
2542
  } | {
1817
2543
  status: 404;
1818
2544
  payload: SimpleError;
2545
+ } | {
2546
+ status: 422;
2547
+ payload: SimpleError;
1819
2548
  }>;
1820
- declare type BulkInsertTableRecordsResponse = {
1821
- recordIDs: string[];
1822
- };
1823
2549
  declare type BulkInsertTableRecordsRequestBody = {
1824
2550
  records: Record<string, any>[];
1825
2551
  };
1826
2552
  declare type BulkInsertTableRecordsVariables = {
1827
2553
  body: BulkInsertTableRecordsRequestBody;
1828
2554
  pathParams: BulkInsertTableRecordsPathParams;
2555
+ queryParams?: BulkInsertTableRecordsQueryParams;
1829
2556
  } & FetcherExtraProps;
1830
2557
  /**
1831
2558
  * Bulk insert records
1832
2559
  */
1833
- declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
2560
+ declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
1834
2561
  declare type QueryTablePathParams = {
1835
2562
  dbBranchName: DBBranchName;
1836
2563
  tableName: TableName;
@@ -1850,7 +2577,7 @@ declare type QueryTableRequestBody = {
1850
2577
  filter?: FilterExpression;
1851
2578
  sort?: SortExpression;
1852
2579
  page?: PageConfig;
1853
- columns?: ColumnsFilter;
2580
+ columns?: ColumnsProjection;
1854
2581
  };
1855
2582
  declare type QueryTableVariables = {
1856
2583
  body?: QueryTableRequestBody;
@@ -1867,7 +2594,7 @@ declare type QueryTableVariables = {
1867
2594
  * {
1868
2595
  * "columns": [...],
1869
2596
  * "filter": {
1870
- * "$all": [...]
2597
+ * "$all": [...],
1871
2598
  * "$any": [...]
1872
2599
  * ...
1873
2600
  * },
@@ -2005,7 +2732,7 @@ declare type QueryTableVariables = {
2005
2732
  * {
2006
2733
  * "name": "Kilian",
2007
2734
  * "address": {
2008
- * "street": "New street",
2735
+ * "street": "New street"
2009
2736
  * }
2010
2737
  * }
2011
2738
  * ```
@@ -2014,10 +2741,7 @@ declare type QueryTableVariables = {
2014
2741
  *
2015
2742
  * ```json
2016
2743
  * {
2017
- * "columns": [
2018
- * "*",
2019
- * "team.name"
2020
- * ]
2744
+ * "columns": ["*", "team.name"]
2021
2745
  * }
2022
2746
  * ```
2023
2747
  *
@@ -2035,7 +2759,7 @@ declare type QueryTableVariables = {
2035
2759
  * "team": {
2036
2760
  * "id": "XX",
2037
2761
  * "xata": {
2038
- * "version": 0,
2762
+ * "version": 0
2039
2763
  * },
2040
2764
  * "name": "first team"
2041
2765
  * }
@@ -2046,10 +2770,7 @@ declare type QueryTableVariables = {
2046
2770
  *
2047
2771
  * ```json
2048
2772
  * {
2049
- * "columns": [
2050
- * "*",
2051
- * "team.*"
2052
- * ]
2773
+ * "columns": ["*", "team.*"]
2053
2774
  * }
2054
2775
  * ```
2055
2776
  *
@@ -2067,7 +2788,7 @@ declare type QueryTableVariables = {
2067
2788
  * "team": {
2068
2789
  * "id": "XX",
2069
2790
  * "xata": {
2070
- * "version": 0,
2791
+ * "version": 0
2071
2792
  * },
2072
2793
  * "name": "first team",
2073
2794
  * "code": "A1",
@@ -2117,7 +2838,7 @@ declare type QueryTableVariables = {
2117
2838
  * ```json
2118
2839
  * {
2119
2840
  * "filter": {
2120
- * "name": "r2",
2841
+ * "name": "r2"
2121
2842
  * }
2122
2843
  * }
2123
2844
  * ```
@@ -2139,7 +2860,7 @@ declare type QueryTableVariables = {
2139
2860
  * ```json
2140
2861
  * {
2141
2862
  * "filter": {
2142
- * "settings.plan": "free",
2863
+ * "settings.plan": "free"
2143
2864
  * }
2144
2865
  * }
2145
2866
  * ```
@@ -2149,8 +2870,8 @@ declare type QueryTableVariables = {
2149
2870
  * "filter": {
2150
2871
  * "settings": {
2151
2872
  * "plan": "free"
2152
- * },
2153
- * },
2873
+ * }
2874
+ * }
2154
2875
  * }
2155
2876
  * ```
2156
2877
  *
@@ -2159,8 +2880,8 @@ declare type QueryTableVariables = {
2159
2880
  * ```json
2160
2881
  * {
2161
2882
  * "filter": {
2162
- * "settings.plan": {"$any": ["free", "paid"]}
2163
- * },
2883
+ * "settings.plan": { "$any": ["free", "paid"] }
2884
+ * }
2164
2885
  * }
2165
2886
  * ```
2166
2887
  *
@@ -2169,9 +2890,9 @@ declare type QueryTableVariables = {
2169
2890
  * ```json
2170
2891
  * {
2171
2892
  * "filter": {
2172
- * "settings.dark": true,
2173
- * "settings.plan": "free",
2174
- * },
2893
+ * "settings.dark": true,
2894
+ * "settings.plan": "free"
2895
+ * }
2175
2896
  * }
2176
2897
  * ```
2177
2898
  *
@@ -2182,11 +2903,11 @@ declare type QueryTableVariables = {
2182
2903
  * ```json
2183
2904
  * {
2184
2905
  * "filter": {
2185
- * "$any": {
2186
- * "settings.dark": true,
2187
- * "settings.plan": "free"
2188
- * }
2189
- * },
2906
+ * "$any": {
2907
+ * "settings.dark": true,
2908
+ * "settings.plan": "free"
2909
+ * }
2910
+ * }
2190
2911
  * }
2191
2912
  * ```
2192
2913
  *
@@ -2197,10 +2918,10 @@ declare type QueryTableVariables = {
2197
2918
  * "filter": {
2198
2919
  * "$any": [
2199
2920
  * {
2200
- * "name": "r1",
2921
+ * "name": "r1"
2201
2922
  * },
2202
2923
  * {
2203
- * "name": "r2",
2924
+ * "name": "r2"
2204
2925
  * }
2205
2926
  * ]
2206
2927
  * }
@@ -2212,7 +2933,7 @@ declare type QueryTableVariables = {
2212
2933
  * ```json
2213
2934
  * {
2214
2935
  * "filter": {
2215
- * "$exists": "settings",
2936
+ * "$exists": "settings"
2216
2937
  * }
2217
2938
  * }
2218
2939
  * ```
@@ -2224,10 +2945,10 @@ declare type QueryTableVariables = {
2224
2945
  * "filter": {
2225
2946
  * "$all": [
2226
2947
  * {
2227
- * "$exists": "settings",
2948
+ * "$exists": "settings"
2228
2949
  * },
2229
2950
  * {
2230
- * "$exists": "name",
2951
+ * "$exists": "name"
2231
2952
  * }
2232
2953
  * ]
2233
2954
  * }
@@ -2239,7 +2960,7 @@ declare type QueryTableVariables = {
2239
2960
  * ```json
2240
2961
  * {
2241
2962
  * "filter": {
2242
- * "$notExists": "settings",
2963
+ * "$notExists": "settings"
2243
2964
  * }
2244
2965
  * }
2245
2966
  * ```
@@ -2266,22 +2987,28 @@ declare type QueryTableVariables = {
2266
2987
  * {
2267
2988
  * "filter": {
2268
2989
  * "<column_name>": {
2269
- * "$pattern": "v*alue*"
2990
+ * "$pattern": "v*alu?"
2270
2991
  * }
2271
2992
  * }
2272
2993
  * }
2273
2994
  * ```
2274
2995
  *
2996
+ * The `$pattern` operator accepts two wildcard characters:
2997
+ * * `*` matches zero or more characters
2998
+ * * `?` matches exactly one character
2999
+ *
3000
+ * 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.
3001
+ *
2275
3002
  * We could also have `$endsWith` and `$startsWith` operators:
2276
3003
  *
2277
3004
  * ```json
2278
3005
  * {
2279
3006
  * "filter": {
2280
3007
  * "<column_name>": {
2281
- * "$endsWith": ".gz"
3008
+ * "$endsWith": ".gz"
2282
3009
  * },
2283
3010
  * "<column_name>": {
2284
- * "$startsWith": "tmp-"
3011
+ * "$startsWith": "tmp-"
2285
3012
  * }
2286
3013
  * }
2287
3014
  * }
@@ -2292,10 +3019,10 @@ declare type QueryTableVariables = {
2292
3019
  * ```json
2293
3020
  * {
2294
3021
  * "filter": {
2295
- * "<column_name>": {
2296
- * "$ge": 0,
2297
- * "$lt": 100
2298
- * }
3022
+ * "<column_name>": {
3023
+ * "$ge": 0,
3024
+ * "$lt": 100
3025
+ * }
2299
3026
  * }
2300
3027
  * }
2301
3028
  * ```
@@ -2313,7 +3040,6 @@ declare type QueryTableVariables = {
2313
3040
  * ```
2314
3041
  * The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
2315
3042
  *
2316
- *
2317
3043
  * #### Negations
2318
3044
  *
2319
3045
  * A general `$not` operator can inverse any operation.
@@ -2338,15 +3064,21 @@ declare type QueryTableVariables = {
2338
3064
  * {
2339
3065
  * "filter": {
2340
3066
  * "$not": {
2341
- * "$any": [{
2342
- * "<column_name1>": "value1"
2343
- * }, {
2344
- * "$all": [{
2345
- * "<column_name2>": "value2"
2346
- * }, {
2347
- * "<column_name3>": "value3"
2348
- * }]
2349
- * }]
3067
+ * "$any": [
3068
+ * {
3069
+ * "<column_name1>": "value1"
3070
+ * },
3071
+ * {
3072
+ * "$all": [
3073
+ * {
3074
+ * "<column_name2>": "value2"
3075
+ * },
3076
+ * {
3077
+ * "<column_name3>": "value3"
3078
+ * }
3079
+ * ]
3080
+ * }
3081
+ * ]
2350
3082
  * }
2351
3083
  * }
2352
3084
  * }
@@ -2401,8 +3133,8 @@ declare type QueryTableVariables = {
2401
3133
  * "<array name>": {
2402
3134
  * "$includes": {
2403
3135
  * "$all": [
2404
- * {"$contains": "label"},
2405
- * {"$not": {"$endsWith": "-debug"}}
3136
+ * { "$contains": "label" },
3137
+ * { "$not": { "$endsWith": "-debug" } }
2406
3138
  * ]
2407
3139
  * }
2408
3140
  * }
@@ -2422,9 +3154,7 @@ declare type QueryTableVariables = {
2422
3154
  * {
2423
3155
  * "filter": {
2424
3156
  * "settings.labels": {
2425
- * "$includesAll": [
2426
- * {"$contains": "label"},
2427
- * ]
3157
+ * "$includesAll": [{ "$contains": "label" }]
2428
3158
  * }
2429
3159
  * }
2430
3160
  * }
@@ -2472,7 +3202,6 @@ declare type QueryTableVariables = {
2472
3202
  * }
2473
3203
  * ```
2474
3204
  *
2475
- *
2476
3205
  * ### Pagination
2477
3206
  *
2478
3207
  * We offer cursor pagination and offset pagination. The offset pagination is limited
@@ -2538,8 +3267,8 @@ declare type QueryTableVariables = {
2538
3267
  * can be queried by update `page.after` to the returned cursor while keeping the
2539
3268
  * `page.before` cursor from the first range query.
2540
3269
  *
2541
- * The `filter` , `columns`, `sort` , and `page.size` configuration will be
2542
- * encoded with the cursor. The pagination request will be invalid if
3270
+ * The `filter` , `columns`, `sort` , and `page.size` configuration will be
3271
+ * encoded with the cursor. The pagination request will be invalid if
2543
3272
  * `filter` or `sort` is set. The columns returned and page size can be changed
2544
3273
  * anytime by passing the `columns` or `page.size` settings to the next query.
2545
3274
  *
@@ -2576,6 +3305,41 @@ declare type QueryTableVariables = {
2576
3305
  * ```
2577
3306
  */
2578
3307
  declare const queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
3308
+ declare type SearchTablePathParams = {
3309
+ dbBranchName: DBBranchName;
3310
+ tableName: TableName;
3311
+ workspace: string;
3312
+ };
3313
+ declare type SearchTableError = ErrorWrapper<{
3314
+ status: 400;
3315
+ payload: BadRequestError;
3316
+ } | {
3317
+ status: 401;
3318
+ payload: AuthError;
3319
+ } | {
3320
+ status: 404;
3321
+ payload: SimpleError;
3322
+ }>;
3323
+ declare type SearchTableRequestBody = {
3324
+ query: string;
3325
+ fuzziness?: FuzzinessExpression;
3326
+ prefix?: PrefixExpression;
3327
+ filter?: FilterExpression;
3328
+ highlight?: HighlightExpression;
3329
+ boosters?: BoosterExpression[];
3330
+ };
3331
+ declare type SearchTableVariables = {
3332
+ body: SearchTableRequestBody;
3333
+ pathParams: SearchTablePathParams;
3334
+ } & FetcherExtraProps;
3335
+ /**
3336
+ * Run a free text search operation in a particular table.
3337
+ *
3338
+ * 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:
3339
+ * * filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of type `text`
3340
+ * * filtering on columns of type `multiple` is currently unsupported
3341
+ */
3342
+ declare const searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2579
3343
  declare type SearchBranchPathParams = {
2580
3344
  dbBranchName: DBBranchName;
2581
3345
  workspace: string;
@@ -2591,9 +3355,15 @@ declare type SearchBranchError = ErrorWrapper<{
2591
3355
  payload: SimpleError;
2592
3356
  }>;
2593
3357
  declare type SearchBranchRequestBody = {
2594
- tables?: string[];
3358
+ tables?: (string | {
3359
+ table: string;
3360
+ filter?: FilterExpression;
3361
+ boosters?: BoosterExpression[];
3362
+ })[];
2595
3363
  query: string;
2596
- fuzziness?: number;
3364
+ fuzziness?: FuzzinessExpression;
3365
+ prefix?: PrefixExpression;
3366
+ highlight?: HighlightExpression;
2597
3367
  };
2598
3368
  declare type SearchBranchVariables = {
2599
3369
  body: SearchBranchRequestBody;
@@ -2603,6 +3373,33 @@ declare type SearchBranchVariables = {
2603
3373
  * Run a free text search operation across the database branch.
2604
3374
  */
2605
3375
  declare const searchBranch: (variables: SearchBranchVariables) => Promise<SearchResponse>;
3376
+ declare type SummarizeTablePathParams = {
3377
+ dbBranchName: DBBranchName;
3378
+ tableName: TableName;
3379
+ workspace: string;
3380
+ };
3381
+ declare type SummarizeTableError = ErrorWrapper<{
3382
+ status: 400;
3383
+ payload: BadRequestError;
3384
+ } | {
3385
+ status: 401;
3386
+ payload: AuthError;
3387
+ } | {
3388
+ status: 404;
3389
+ payload: SimpleError;
3390
+ }>;
3391
+ declare type SummarizeTableRequestBody = {
3392
+ summaries?: SummaryExpressionList;
3393
+ columns?: ColumnsProjection;
3394
+ };
3395
+ declare type SummarizeTableVariables = {
3396
+ body?: SummarizeTableRequestBody;
3397
+ pathParams: SummarizeTablePathParams;
3398
+ } & FetcherExtraProps;
3399
+ /**
3400
+ * Summarize table
3401
+ */
3402
+ declare const summarizeTable: (variables: SummarizeTableVariables) => Promise<SummarizeResponse>;
2606
3403
  declare const operationsByTag: {
2607
3404
  users: {
2608
3405
  getUser: (variables: GetUserVariables) => Promise<UserWithID>;
@@ -2622,6 +3419,7 @@ declare const operationsByTag: {
2622
3419
  updateWorkspaceMemberRole: (variables: UpdateWorkspaceMemberRoleVariables) => Promise<undefined>;
2623
3420
  removeWorkspaceMember: (variables: RemoveWorkspaceMemberVariables) => Promise<undefined>;
2624
3421
  inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<WorkspaceInvite>;
3422
+ updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
2625
3423
  cancelWorkspaceMemberInvite: (variables: CancelWorkspaceMemberInviteVariables) => Promise<undefined>;
2626
3424
  resendWorkspaceMemberInvite: (variables: ResendWorkspaceMemberInviteVariables) => Promise<undefined>;
2627
3425
  acceptWorkspaceMemberInvite: (variables: AcceptWorkspaceMemberInviteVariables) => Promise<undefined>;
@@ -2630,6 +3428,8 @@ declare const operationsByTag: {
2630
3428
  getDatabaseList: (variables: GetDatabaseListVariables) => Promise<ListDatabasesResponse>;
2631
3429
  createDatabase: (variables: CreateDatabaseVariables) => Promise<CreateDatabaseResponse>;
2632
3430
  deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
3431
+ getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
3432
+ updateDatabaseMetadata: (variables: UpdateDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
2633
3433
  getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
2634
3434
  addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
2635
3435
  removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
@@ -2638,17 +3438,35 @@ declare const operationsByTag: {
2638
3438
  branch: {
2639
3439
  getBranchList: (variables: GetBranchListVariables) => Promise<ListBranchesResponse>;
2640
3440
  getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
2641
- createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
3441
+ createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
2642
3442
  deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
2643
3443
  updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
2644
3444
  getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
3445
+ getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
3446
+ };
3447
+ migrationRequests: {
3448
+ listMigrationRequests: (variables: ListMigrationRequestsVariables) => Promise<ListMigrationRequestsResponse>;
3449
+ createMigrationRequest: (variables: CreateMigrationRequestVariables) => Promise<CreateMigrationRequestResponse>;
3450
+ getMigrationRequest: (variables: GetMigrationRequestVariables) => Promise<MigrationRequest>;
3451
+ updateMigrationRequest: (variables: UpdateMigrationRequestVariables) => Promise<undefined>;
3452
+ listMigrationRequestsCommits: (variables: ListMigrationRequestsCommitsVariables) => Promise<ListMigrationRequestsCommitsResponse>;
3453
+ compareMigrationRequest: (variables: CompareMigrationRequestVariables) => Promise<SchemaCompareResponse>;
3454
+ getMigrationRequestIsMerged: (variables: GetMigrationRequestIsMergedVariables) => Promise<GetMigrationRequestIsMergedResponse>;
3455
+ mergeMigrationRequest: (variables: MergeMigrationRequestVariables) => Promise<Commit>;
3456
+ };
3457
+ branchSchema: {
2645
3458
  getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
2646
3459
  executeBranchMigrationPlan: (variables: ExecuteBranchMigrationPlanVariables) => Promise<undefined>;
2647
3460
  getBranchMigrationPlan: (variables: GetBranchMigrationPlanVariables) => Promise<BranchMigrationPlan>;
2648
- getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
3461
+ compareBranchWithUserSchema: (variables: CompareBranchWithUserSchemaVariables) => Promise<SchemaCompareResponse>;
3462
+ compareBranchSchemas: (variables: CompareBranchSchemasVariables) => Promise<SchemaCompareResponse>;
3463
+ updateBranchSchema: (variables: UpdateBranchSchemaVariables) => Promise<UpdateBranchSchemaResponse>;
3464
+ previewBranchSchemaEdit: (variables: PreviewBranchSchemaEditVariables) => Promise<PreviewBranchSchemaEditResponse>;
3465
+ applyBranchSchemaEdit: (variables: ApplyBranchSchemaEditVariables) => Promise<ApplyBranchSchemaEditResponse>;
3466
+ getBranchSchemaHistory: (variables: GetBranchSchemaHistoryVariables) => Promise<GetBranchSchemaHistoryResponse>;
2649
3467
  };
2650
3468
  table: {
2651
- createTable: (variables: CreateTableVariables) => Promise<undefined>;
3469
+ createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
2652
3470
  deleteTable: (variables: DeleteTableVariables) => Promise<undefined>;
2653
3471
  updateTable: (variables: UpdateTableVariables) => Promise<undefined>;
2654
3472
  getTableSchema: (variables: GetTableSchemaVariables) => Promise<GetTableSchemaResponse>;
@@ -2660,15 +3478,17 @@ declare const operationsByTag: {
2660
3478
  updateColumn: (variables: UpdateColumnVariables) => Promise<MigrationIdResponse>;
2661
3479
  };
2662
3480
  records: {
2663
- insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
3481
+ insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
2664
3482
  insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2665
3483
  updateRecordWithID: (variables: UpdateRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2666
3484
  upsertRecordWithID: (variables: UpsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2667
- deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
3485
+ deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
2668
3486
  getRecord: (variables: GetRecordVariables) => Promise<XataRecord$1>;
2669
- bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
3487
+ bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
2670
3488
  queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
3489
+ searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2671
3490
  searchBranch: (variables: SearchBranchVariables) => Promise<SearchResponse>;
3491
+ summarizeTable: (variables: SummarizeTableVariables) => Promise<SummarizeResponse>;
2672
3492
  };
2673
3493
  };
2674
3494
 
@@ -2683,10 +3503,8 @@ interface XataApiClientOptions {
2683
3503
  fetch?: FetchImpl;
2684
3504
  apiKey?: string;
2685
3505
  host?: HostProvider;
3506
+ trace?: TraceFunction;
2686
3507
  }
2687
- /**
2688
- * @deprecated Use XataApiPlugin instead
2689
- */
2690
3508
  declare class XataApiClient {
2691
3509
  #private;
2692
3510
  constructor(options?: XataApiClientOptions);
@@ -2696,6 +3514,8 @@ declare class XataApiClient {
2696
3514
  get branches(): BranchApi;
2697
3515
  get tables(): TableApi;
2698
3516
  get records(): RecordsApi;
3517
+ get migrationRequests(): MigrationRequestsApi;
3518
+ get branchSchema(): BranchSchemaApi;
2699
3519
  }
2700
3520
  declare class UserApi {
2701
3521
  private extraProps;
@@ -2719,6 +3539,7 @@ declare class WorkspaceApi {
2719
3539
  updateWorkspaceMemberRole(workspaceId: WorkspaceID, userId: UserID, role: Role): Promise<void>;
2720
3540
  removeWorkspaceMember(workspaceId: WorkspaceID, userId: UserID): Promise<void>;
2721
3541
  inviteWorkspaceMember(workspaceId: WorkspaceID, email: string, role: Role): Promise<WorkspaceInvite>;
3542
+ updateWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID, role: Role): Promise<WorkspaceInvite>;
2722
3543
  cancelWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2723
3544
  resendWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2724
3545
  acceptWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteKey: InviteKey): Promise<void>;
@@ -2729,29 +3550,28 @@ declare class DatabaseApi {
2729
3550
  getDatabaseList(workspace: WorkspaceID): Promise<ListDatabasesResponse>;
2730
3551
  createDatabase(workspace: WorkspaceID, dbName: DBName, options?: CreateDatabaseRequestBody): Promise<CreateDatabaseResponse>;
2731
3552
  deleteDatabase(workspace: WorkspaceID, dbName: DBName): Promise<void>;
3553
+ getDatabaseMetadata(workspace: WorkspaceID, dbName: DBName): Promise<DatabaseMetadata>;
3554
+ updateDatabaseMetadata(workspace: WorkspaceID, dbName: DBName, options?: UpdateDatabaseMetadataRequestBody): Promise<DatabaseMetadata>;
2732
3555
  getGitBranchesMapping(workspace: WorkspaceID, dbName: DBName): Promise<ListGitBranchesResponse>;
2733
3556
  addGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, body: AddGitBranchesEntryRequestBody): Promise<AddGitBranchesEntryResponse>;
2734
3557
  removeGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<void>;
2735
- resolveBranch(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<ResolveBranchResponse>;
3558
+ resolveBranch(workspace: WorkspaceID, dbName: DBName, gitBranch?: string, fallbackBranch?: string): Promise<ResolveBranchResponse>;
2736
3559
  }
2737
3560
  declare class BranchApi {
2738
3561
  private extraProps;
2739
3562
  constructor(extraProps: FetcherExtraProps);
2740
3563
  getBranchList(workspace: WorkspaceID, dbName: DBName): Promise<ListBranchesResponse>;
2741
3564
  getBranchDetails(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<DBBranch>;
2742
- createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<void>;
3565
+ createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<CreateBranchResponse>;
2743
3566
  deleteBranch(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<void>;
2744
3567
  updateBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName, metadata?: BranchMetadata): Promise<void>;
2745
3568
  getBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<BranchMetadata>;
2746
- getBranchMigrationHistory(workspace: WorkspaceID, database: DBName, branch: BranchName, options?: GetBranchMigrationHistoryRequestBody): Promise<GetBranchMigrationHistoryResponse>;
2747
- executeBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, migrationPlan: ExecuteBranchMigrationPlanRequestBody): Promise<void>;
2748
- getBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, schema: Schema): Promise<BranchMigrationPlan>;
2749
3569
  getBranchStats(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<GetBranchStatsResponse>;
2750
3570
  }
2751
3571
  declare class TableApi {
2752
3572
  private extraProps;
2753
3573
  constructor(extraProps: FetcherExtraProps);
2754
- createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
3574
+ createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<CreateTableResponse>;
2755
3575
  deleteTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
2756
3576
  updateTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, options: UpdateTableRequestBody): Promise<void>;
2757
3577
  getTableSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<GetTableSchemaResponse>;
@@ -2765,15 +3585,42 @@ declare class TableApi {
2765
3585
  declare class RecordsApi {
2766
3586
  private extraProps;
2767
3587
  constructor(extraProps: FetcherExtraProps);
2768
- insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>): Promise<InsertRecordResponse>;
3588
+ insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>, options?: InsertRecordQueryParams): Promise<RecordUpdateResponse>;
2769
3589
  insertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: InsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2770
3590
  updateRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpdateRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2771
3591
  upsertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2772
- deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID): Promise<void>;
2773
- getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordRequestBody): Promise<XataRecord$1>;
2774
- bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[]): Promise<BulkInsertTableRecordsResponse>;
3592
+ deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: DeleteRecordQueryParams): Promise<RecordUpdateResponse>;
3593
+ getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordQueryParams): Promise<XataRecord$1>;
3594
+ bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[], options?: BulkInsertTableRecordsQueryParams): Promise<BulkInsertResponse>;
2775
3595
  queryTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: QueryTableRequestBody): Promise<QueryResponse>;
3596
+ searchTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: SearchTableRequestBody): Promise<SearchResponse>;
2776
3597
  searchBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, query: SearchBranchRequestBody): Promise<SearchResponse>;
3598
+ summarizeTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: SummarizeTableRequestBody): Promise<SummarizeResponse>;
3599
+ }
3600
+ declare class MigrationRequestsApi {
3601
+ private extraProps;
3602
+ constructor(extraProps: FetcherExtraProps);
3603
+ listMigrationRequests(workspace: WorkspaceID, database: DBName, options?: ListMigrationRequestsRequestBody): Promise<ListMigrationRequestsResponse>;
3604
+ createMigrationRequest(workspace: WorkspaceID, database: DBName, options: CreateMigrationRequestRequestBody): Promise<CreateMigrationRequestResponse>;
3605
+ getMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<MigrationRequest>;
3606
+ updateMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number, options: UpdateMigrationRequestRequestBody): Promise<void>;
3607
+ listMigrationRequestsCommits(workspace: WorkspaceID, database: DBName, migrationRequest: number, options?: ListMigrationRequestsCommitsRequestBody): Promise<ListMigrationRequestsCommitsResponse>;
3608
+ compareMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<SchemaCompareResponse>;
3609
+ getMigrationRequestIsMerged(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<GetMigrationRequestIsMergedResponse>;
3610
+ mergeMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<Commit>;
3611
+ }
3612
+ declare class BranchSchemaApi {
3613
+ private extraProps;
3614
+ constructor(extraProps: FetcherExtraProps);
3615
+ getBranchMigrationHistory(workspace: WorkspaceID, database: DBName, branch: BranchName, options?: GetBranchMigrationHistoryRequestBody): Promise<GetBranchMigrationHistoryResponse>;
3616
+ executeBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, migrationPlan: ExecuteBranchMigrationPlanRequestBody): Promise<void>;
3617
+ getBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, schema: Schema): Promise<BranchMigrationPlan>;
3618
+ compareBranchWithUserSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, schema: Schema): Promise<SchemaCompareResponse>;
3619
+ compareBranchSchemas(workspace: WorkspaceID, database: DBName, branch: BranchName, branchName: BranchName, schema: Schema): Promise<SchemaCompareResponse>;
3620
+ updateBranchSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, migration: Migration): Promise<UpdateBranchSchemaResponse>;
3621
+ previewBranchSchemaEdit(workspace: WorkspaceID, database: DBName, branch: BranchName, migration: Migration): Promise<PreviewBranchSchemaEditResponse>;
3622
+ applyBranchSchemaEdit(workspace: WorkspaceID, database: DBName, branch: BranchName, edits: SchemaEditScript): Promise<ApplyBranchSchemaEditResponse>;
3623
+ getBranchSchemaHistory(workspace: WorkspaceID, database: DBName, branch: BranchName, options?: GetBranchSchemaHistoryRequestBody): Promise<GetBranchSchemaHistoryResponse>;
2777
3624
  }
2778
3625
 
2779
3626
  declare class XataApiPlugin implements XataPlugin {
@@ -2786,27 +3633,29 @@ declare type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) ex
2786
3633
  declare type If<Condition, Then, Else> = Condition extends true ? Then : Else;
2787
3634
  declare type IsObject<T> = T extends Record<string, any> ? true : false;
2788
3635
  declare type IsArray<T> = T extends Array<any> ? true : false;
2789
- declare type NonEmptyArray<T> = T[] & {
2790
- 0: T;
2791
- };
2792
3636
  declare type RequiredBy<T, K extends keyof T> = T & {
2793
3637
  [P in K]-?: NonNullable<T[P]>;
2794
3638
  };
2795
3639
  declare type GetArrayInnerType<T extends readonly any[]> = T[number];
2796
3640
  declare type SingleOrArray<T> = T | T[];
3641
+ declare type OmitBy<T, K extends keyof T> = T extends any ? Omit<T, K> : never;
3642
+ declare type Without<T, U> = {
3643
+ [P in Exclude<keyof T, keyof U>]?: never;
3644
+ };
3645
+ declare type ExclusiveOr<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
2797
3646
 
2798
3647
  declare type SelectableColumn<O, RecursivePath extends any[] = []> = '*' | 'id' | DataProps<O> | NestedColumns<O, RecursivePath>;
2799
- declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord & UnionToIntersection<Values<{
2800
- [K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord;
3648
+ declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord<O> & UnionToIntersection<Values<{
3649
+ [K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord<O>;
2801
3650
  }>>;
2802
- declare type ValueAtColumn<O, P extends SelectableColumn<O>> = P extends '*' ? Values<O> : P extends 'id' ? string : P extends keyof O ? O[P] : P extends `${infer K}.${infer V}` ? K extends keyof O ? Values<O[K] extends XataRecord ? (V extends SelectableColumn<O[K]> ? {
2803
- V: ValueAtColumn<O[K], V>;
2804
- } : never) : O[K]> : never : never;
3651
+ 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> ? {
3652
+ V: ValueAtColumn<Item, V>;
3653
+ } : never : O[K] : never> : never : never;
2805
3654
  declare type MAX_RECURSION = 5;
2806
3655
  declare type NestedColumns<O, RecursivePath extends any[]> = RecursivePath['length'] extends MAX_RECURSION ? never : If<IsObject<O>, Values<{
2807
- [K in DataProps<O>]: If<IsArray<NonNullable<O[K]>>, K, // If the property is an array, we stop recursion. We don't support object arrays yet
2808
- If<IsObject<NonNullable<O[K]>>, NonNullable<O[K]> extends XataRecord ? SelectableColumn<NonNullable<O[K]>, [...RecursivePath, O[K]]> extends string ? K | `${K}.${SelectableColumn<NonNullable<O[K]>, [...RecursivePath, O[K]]>}` : never : `${K}.${StringKeys<NonNullable<O[K]>> | '*'}`, // This allows usage of objects that are not links
2809
- K>>;
3656
+ [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
3657
+ 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
3658
+ K>> : never;
2810
3659
  }>, never>;
2811
3660
  declare type DataProps<O> = Exclude<StringKeys<O>, StringKeys<XataRecord>>;
2812
3661
  declare type NestedValueAtColumn<O, Key extends SelectableColumn<O>> = Key extends `${infer N}.${infer M}` ? N extends DataProps<O> ? {
@@ -2833,56 +3682,67 @@ interface BaseData {
2833
3682
  /**
2834
3683
  * Represents a persisted record from the database.
2835
3684
  */
2836
- interface XataRecord extends Identifiable {
3685
+ interface XataRecord<OriginalRecord extends XataRecord<any> = XataRecord<any>> extends Identifiable {
2837
3686
  /**
2838
- * Metadata of this record.
3687
+ * Get metadata of this record.
2839
3688
  */
2840
- xata: {
2841
- /**
2842
- * Number that is increased every time the record is updated.
2843
- */
2844
- version: number;
2845
- };
3689
+ getMetadata(): XataRecordMetadata;
3690
+ /**
3691
+ * Retrieves a refreshed copy of the current record from the database.
3692
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3693
+ * @returns The persisted record with the selected columns, null if not found.
3694
+ */
3695
+ read<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
2846
3696
  /**
2847
3697
  * Retrieves a refreshed copy of the current record from the database.
3698
+ * @returns The persisted record with all first level properties, null if not found.
3699
+ */
3700
+ read(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
3701
+ /**
3702
+ * Performs a partial update of the current record. On success a new object is
3703
+ * returned and the current object is not mutated.
3704
+ * @param partialUpdate The columns and their values that have to be updated.
3705
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3706
+ * @returns The persisted record with the selected columns, null if not found.
2848
3707
  */
2849
- read(): Promise<Readonly<SelectedPick<this, ['*']>> | null>;
3708
+ update<K extends SelectableColumn<OriginalRecord>>(partialUpdate: Partial<EditableData<OriginalRecord>>, columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
2850
3709
  /**
2851
3710
  * Performs a partial update of the current record. On success a new object is
2852
3711
  * returned and the current object is not mutated.
2853
- * @param data The columns and their values that have to be updated.
2854
- * @returns A new record containing the latest values for all the columns of the current record.
3712
+ * @param partialUpdate The columns and their values that have to be updated.
3713
+ * @returns The persisted record with all first level properties, null if not found.
2855
3714
  */
2856
- update(partialUpdate: Partial<EditableData<Omit<this, keyof XataRecord>>>): Promise<Readonly<SelectedPick<this, ['*']>>>;
3715
+ update(partialUpdate: Partial<EditableData<OriginalRecord>>): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2857
3716
  /**
2858
3717
  * Performs a deletion of the current record in the database.
2859
- *
2860
- * @throws If the record was already deleted or if an error happened while performing the deletion.
3718
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3719
+ * @returns The deleted record, null if not found.
2861
3720
  */
2862
- delete(): Promise<void>;
2863
- }
2864
- declare type Link<Record extends XataRecord> = Omit<XataRecord, 'read' | 'update'> & {
3721
+ delete<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
2865
3722
  /**
2866
- * Retrieves a refreshed copy of the current record from the database.
3723
+ * Performs a deletion of the current record in the database.
3724
+ * @returns The deleted record, null if not found.
3725
+
2867
3726
  */
2868
- read(): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3727
+ delete(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
3728
+ }
3729
+ declare type Link<Record extends XataRecord> = XataRecord<Record>;
3730
+ declare type XataRecordMetadata = {
2869
3731
  /**
2870
- * Performs a partial update of the current record. On success a new object is
2871
- * returned and the current object is not mutated.
2872
- * @param data The columns and their values that have to be updated.
2873
- * @returns A new record containing the latest values for all the columns of the current record.
3732
+ * Number that is increased every time the record is updated.
2874
3733
  */
2875
- update(partialUpdate: Partial<EditableData<Omit<Record, keyof XataRecord>>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3734
+ version: number;
3735
+ warnings?: string[];
2876
3736
  };
2877
3737
  declare function isIdentifiable(x: any): x is Identifiable & Record<string, unknown>;
2878
3738
  declare function isXataRecord(x: any): x is XataRecord & Record<string, unknown>;
2879
- declare type EditableData<O extends BaseData> = {
3739
+ declare type EditableData<O extends XataRecord> = Identifiable & Omit<{
2880
3740
  [K in keyof O]: O[K] extends XataRecord ? {
2881
3741
  id: string;
2882
- } : NonNullable<O[K]> extends XataRecord ? {
3742
+ } | string : NonNullable<O[K]> extends XataRecord ? {
2883
3743
  id: string;
2884
- } | null | undefined : O[K];
2885
- };
3744
+ } | string | null | undefined : O[K];
3745
+ }, keyof XataRecord>;
2886
3746
 
2887
3747
  /**
2888
3748
  * PropertyMatchFilter
@@ -2957,8 +3817,8 @@ declare type ValueTypeFilters<T> = T | T extends string ? StringTypeFilter : T e
2957
3817
  ],
2958
3818
  }
2959
3819
  */
2960
- declare type AggregatorFilter<Record> = {
2961
- [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<Record>>;
3820
+ declare type AggregatorFilter<T> = {
3821
+ [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<T>>;
2962
3822
  };
2963
3823
  /**
2964
3824
  * Existance filter
@@ -2973,10 +3833,88 @@ declare type BaseApiFilter<Record> = PropertyAccessFilter<Record> | AggregatorFi
2973
3833
  * Injects the Api filters on nested properties
2974
3834
  * Example: { filter: { settings: { plan: { $any: ['free', 'trial'] } } } }
2975
3835
  */
2976
- declare type NestedApiFilter<T> = T extends Record<string, any> ? {
3836
+ declare type NestedApiFilter<T> = {
2977
3837
  [key in keyof T]?: T[key] extends Record<string, any> ? SingleOrArray<Filter<T[key]>> : PropertyFilter<T[key]>;
2978
- } : PropertyFilter<T>;
2979
- declare type Filter<Record> = BaseApiFilter<Record> | NestedApiFilter<Record>;
3838
+ };
3839
+ 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>;
3840
+
3841
+ declare type DateBooster = {
3842
+ origin?: string;
3843
+ scale: string;
3844
+ decay: number;
3845
+ };
3846
+ declare type NumericBooster = {
3847
+ factor: number;
3848
+ };
3849
+ declare type ValueBooster<T extends string | number | boolean> = {
3850
+ value: T;
3851
+ factor: number;
3852
+ };
3853
+ declare type Boosters<O extends XataRecord> = Values<{
3854
+ [K in SelectableColumn<O>]: NonNullable<ValueAtColumn<O, K>> extends Date ? {
3855
+ dateBooster: {
3856
+ column: K;
3857
+ } & DateBooster;
3858
+ } : NonNullable<ValueAtColumn<O, K>> extends number ? ExclusiveOr<{
3859
+ numericBooster?: {
3860
+ column: K;
3861
+ } & NumericBooster;
3862
+ }, {
3863
+ valueBooster?: {
3864
+ column: K;
3865
+ } & ValueBooster<number>;
3866
+ }> : NonNullable<ValueAtColumn<O, K>> extends string | boolean ? {
3867
+ valueBooster: {
3868
+ column: K;
3869
+ } & ValueBooster<NonNullable<ValueAtColumn<O, K>>>;
3870
+ } : never;
3871
+ }>;
3872
+
3873
+ declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3874
+ fuzziness?: FuzzinessExpression;
3875
+ prefix?: PrefixExpression;
3876
+ highlight?: HighlightExpression;
3877
+ tables?: Array<Tables | Values<{
3878
+ [Model in GetArrayInnerType<NonNullable<Tables[]>>]: {
3879
+ table: Model;
3880
+ filter?: Filter<SelectedPick<Schemas[Model] & XataRecord, ['*']>>;
3881
+ boosters?: Boosters<Schemas[Model] & XataRecord>[];
3882
+ };
3883
+ }>>;
3884
+ };
3885
+ declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3886
+ all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3887
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]: {
3888
+ table: Model;
3889
+ record: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>>;
3890
+ };
3891
+ }>[]>;
3892
+ byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3893
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]?: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>[]>;
3894
+ }>;
3895
+ };
3896
+ declare class SearchPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin {
3897
+ #private;
3898
+ private db;
3899
+ constructor(db: SchemaPluginResult<Schemas>, schemaTables?: Schemas.Table[]);
3900
+ build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
3901
+ }
3902
+ declare type SearchXataRecord<Record extends XataRecord> = Omit<Record, 'getMetadata'> & {
3903
+ getMetadata: () => XataRecordMetadata & SearchExtraProperties;
3904
+ };
3905
+ declare type SearchExtraProperties = {
3906
+ table: string;
3907
+ highlight?: {
3908
+ [key: string]: string[] | {
3909
+ [key: string]: any;
3910
+ };
3911
+ };
3912
+ score?: number;
3913
+ };
3914
+ declare type ReturnTable<Table, Tables> = Table extends Tables ? Table : never;
3915
+ 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 {
3916
+ table: infer Table;
3917
+ } ? ReturnTable<Table, Tables> : never;
2980
3918
 
2981
3919
  declare type SortDirection = 'asc' | 'desc';
2982
3920
  declare type SortFilterExtended<T extends XataRecord> = {
@@ -2988,13 +3926,21 @@ declare type SortFilterBase<T extends XataRecord> = {
2988
3926
  [Key in StringKeys<T>]: SortDirection;
2989
3927
  };
2990
3928
 
2991
- declare type QueryOptions<T extends XataRecord> = {
2992
- pagination?: PaginationOptions;
2993
- columns?: NonEmptyArray<SelectableColumn<T>>;
3929
+ declare type BaseOptions<T extends XataRecord> = {
3930
+ columns?: SelectableColumn<T>[];
3931
+ cache?: number;
3932
+ };
3933
+ declare type CursorQueryOptions = {
3934
+ pagination?: CursorNavigationOptions & OffsetNavigationOptions;
3935
+ filter?: never;
3936
+ sort?: never;
3937
+ };
3938
+ declare type OffsetQueryOptions<T extends XataRecord> = {
3939
+ pagination?: OffsetNavigationOptions;
2994
3940
  filter?: FilterExpression;
2995
3941
  sort?: SortFilter<T> | SortFilter<T>[];
2996
- cache?: number;
2997
3942
  };
3943
+ declare type QueryOptions<T extends XataRecord> = BaseOptions<T> & (CursorQueryOptions | OffsetQueryOptions<T>);
2998
3944
  /**
2999
3945
  * Query objects contain the information of all filters, sorting, etc. to be included in the database query.
3000
3946
  *
@@ -3004,8 +3950,11 @@ declare type QueryOptions<T extends XataRecord> = {
3004
3950
  declare class Query<Record extends XataRecord, Result extends XataRecord = Record> implements Paginable<Record, Result> {
3005
3951
  #private;
3006
3952
  readonly meta: PaginationQueryMeta;
3007
- readonly records: Result[];
3008
- constructor(repository: Repository<Record> | null, table: string, data: Partial<QueryOptions<Record>>, parent?: Partial<QueryOptions<Record>>);
3953
+ readonly records: RecordArray<Result>;
3954
+ constructor(repository: Repository<Record> | null, table: {
3955
+ name: string;
3956
+ schema?: Table;
3957
+ }, data: Partial<QueryOptions<Record>>, rawParent?: Partial<QueryOptions<Record>>);
3009
3958
  getQueryOptions(): QueryOptions<Record>;
3010
3959
  key(): string;
3011
3960
  /**
@@ -3037,73 +3986,206 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3037
3986
  *
3038
3987
  * ```
3039
3988
  * query.filter("columnName", columnValue)
3040
- * query.filter({
3041
- * "columnName": columnValue
3042
- * })
3989
+ * query.filter("columnName", operator(columnValue)) // Use gt, gte, lt, lte, startsWith,...
3990
+ * ```
3991
+ *
3992
+ * @param column The name of the column to filter.
3993
+ * @param value The value to filter.
3994
+ * @returns A new Query object.
3995
+ */
3996
+ filter<F extends SelectableColumn<Record>>(column: F, value: Filter<NonNullable<ValueAtColumn<Record, F>>>): Query<Record, Result>;
3997
+ /**
3998
+ * Builds a new query object adding one or more constraints. Examples:
3999
+ *
4000
+ * ```
4001
+ * query.filter({ "columnName": columnValue })
3043
4002
  * query.filter({
3044
4003
  * "columnName": operator(columnValue) // Use gt, gte, lt, lte, startsWith,...
3045
4004
  * })
3046
4005
  * ```
3047
4006
  *
4007
+ * @param filters A filter object
3048
4008
  * @returns A new Query object.
3049
4009
  */
3050
- filter(filters: Filter<Record>): Query<Record, Result>;
3051
- filter<F extends SelectableColumn<Record>>(column: F, value: Filter<ValueAtColumn<Record, F>>): Query<Record, Result>;
4010
+ filter(filters?: Filter<Record>): Query<Record, Result>;
4011
+ defaultFilter<T>(column: string, value: T): T | {
4012
+ $includes: (T & string) | (T & string[]);
4013
+ };
3052
4014
  /**
3053
4015
  * Builds a new query with a new sort option.
3054
4016
  * @param column The column name.
3055
4017
  * @param direction The direction. Either ascending or descending.
3056
4018
  * @returns A new Query object.
3057
4019
  */
3058
- sort<F extends SelectableColumn<Record>>(column: F, direction: SortDirection): Query<Record, Result>;
4020
+ sort<F extends SelectableColumn<Record>>(column: F, direction?: SortDirection): Query<Record, Result>;
3059
4021
  /**
3060
4022
  * Builds a new query specifying the set of columns to be returned in the query response.
3061
4023
  * @param columns Array of column names to be returned by the query.
3062
4024
  * @returns A new Query object.
3063
4025
  */
3064
- select<K extends SelectableColumn<Record>>(columns: NonEmptyArray<K>): Query<Record, SelectedPick<Record, NonEmptyArray<K>>>;
4026
+ select<K extends SelectableColumn<Record>>(columns: K[]): Query<Record, SelectedPick<Record, K[]>>;
4027
+ /**
4028
+ * Get paginated results
4029
+ *
4030
+ * @returns A page of results
4031
+ */
3065
4032
  getPaginated(): Promise<Page<Record, Result>>;
3066
- getPaginated(options: Omit<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
4033
+ /**
4034
+ * Get paginated results
4035
+ *
4036
+ * @param options Pagination options
4037
+ * @returns A page of results
4038
+ */
4039
+ getPaginated(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
4040
+ /**
4041
+ * Get paginated results
4042
+ *
4043
+ * @param options Pagination options
4044
+ * @returns A page of results
4045
+ */
3067
4046
  getPaginated<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<Page<Record, SelectedPick<Record, typeof options['columns']>>>;
4047
+ /**
4048
+ * Get results in an iterator
4049
+ *
4050
+ * @async
4051
+ * @returns Async interable of results
4052
+ */
3068
4053
  [Symbol.asyncIterator](): AsyncIterableIterator<Result>;
3069
- getIterator(chunk: number): AsyncGenerator<Result[]>;
3070
- getIterator(chunk: number, options: Omit<QueryOptions<Record>, 'columns' | 'page'>): AsyncGenerator<Result[]>;
3071
- getIterator<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(chunk: number, options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
4054
+ /**
4055
+ * Build an iterator of results
4056
+ *
4057
+ * @returns Async generator of results array
4058
+ */
4059
+ getIterator(): AsyncGenerator<Result[]>;
4060
+ /**
4061
+ * Build an iterator of results
4062
+ *
4063
+ * @param options Pagination options with batchSize
4064
+ * @returns Async generator of results array
4065
+ */
4066
+ getIterator(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
4067
+ batchSize?: number;
4068
+ }): AsyncGenerator<Result[]>;
4069
+ /**
4070
+ * Build an iterator of results
4071
+ *
4072
+ * @param options Pagination options with batchSize
4073
+ * @returns Async generator of results array
4074
+ */
4075
+ getIterator<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
4076
+ batchSize?: number;
4077
+ }>(options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
4078
+ /**
4079
+ * Performs the query in the database and returns a set of results.
4080
+ * @returns An array of records from the database.
4081
+ */
4082
+ getMany(): Promise<RecordArray<Result>>;
4083
+ /**
4084
+ * Performs the query in the database and returns a set of results.
4085
+ * @param options Additional options to be used when performing the query.
4086
+ * @returns An array of records from the database.
4087
+ */
4088
+ getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<RecordArray<SelectedPick<Record, typeof options['columns']>>>;
3072
4089
  /**
3073
4090
  * Performs the query in the database and returns a set of results.
3074
4091
  * @param options Additional options to be used when performing the query.
3075
4092
  * @returns An array of records from the database.
3076
4093
  */
3077
- getMany(): Promise<Result[]>;
3078
- getMany(options: Omit<QueryOptions<Record>, 'columns'>): Promise<Result[]>;
3079
- getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
4094
+ getMany(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<RecordArray<Result>>;
4095
+ /**
4096
+ * Performs the query in the database and returns all the results.
4097
+ * Warning: If there are a large number of results, this method can have performance implications.
4098
+ * @returns An array of records from the database.
4099
+ */
4100
+ getAll(): Promise<Result[]>;
3080
4101
  /**
3081
4102
  * Performs the query in the database and returns all the results.
3082
4103
  * Warning: If there are a large number of results, this method can have performance implications.
3083
4104
  * @param options Additional options to be used when performing the query.
3084
4105
  * @returns An array of records from the database.
3085
4106
  */
3086
- getAll(chunk?: number): Promise<Result[]>;
3087
- getAll(chunk: number | undefined, options: Omit<QueryOptions<Record>, 'columns' | 'page'>): Promise<Result[]>;
3088
- getAll<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(chunk: number | undefined, options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
4107
+ getAll<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
4108
+ batchSize?: number;
4109
+ }>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
3089
4110
  /**
3090
- * Performs the query in the database and returns the first result.
4111
+ * Performs the query in the database and returns all the results.
4112
+ * Warning: If there are a large number of results, this method can have performance implications.
3091
4113
  * @param options Additional options to be used when performing the query.
4114
+ * @returns An array of records from the database.
4115
+ */
4116
+ getAll(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
4117
+ batchSize?: number;
4118
+ }): Promise<Result[]>;
4119
+ /**
4120
+ * Performs the query in the database and returns the first result.
3092
4121
  * @returns The first record that matches the query, or null if no record matched the query.
3093
4122
  */
3094
4123
  getFirst(): Promise<Result | null>;
3095
- getFirst(options: Omit<QueryOptions<Record>, 'columns' | 'page'>): Promise<Result | null>;
3096
- getFirst<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
4124
+ /**
4125
+ * Performs the query in the database and returns the first result.
4126
+ * @param options Additional options to be used when performing the query.
4127
+ * @returns The first record that matches the query, or null if no record matched the query.
4128
+ */
4129
+ getFirst<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
4130
+ /**
4131
+ * Performs the query in the database and returns the first result.
4132
+ * @param options Additional options to be used when performing the query.
4133
+ * @returns The first record that matches the query, or null if no record matched the query.
4134
+ */
4135
+ getFirst(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result | null>;
4136
+ /**
4137
+ * Performs the query in the database and returns the first result.
4138
+ * @returns The first record that matches the query, or null if no record matched the query.
4139
+ * @throws if there are no results.
4140
+ */
4141
+ getFirstOrThrow(): Promise<Result>;
4142
+ /**
4143
+ * Performs the query in the database and returns the first result.
4144
+ * @param options Additional options to be used when performing the query.
4145
+ * @returns The first record that matches the query, or null if no record matched the query.
4146
+ * @throws if there are no results.
4147
+ */
4148
+ getFirstOrThrow<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>>;
4149
+ /**
4150
+ * Performs the query in the database and returns the first result.
4151
+ * @param options Additional options to be used when performing the query.
4152
+ * @returns The first record that matches the query, or null if no record matched the query.
4153
+ * @throws if there are no results.
4154
+ */
4155
+ getFirstOrThrow(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result>;
3097
4156
  /**
3098
4157
  * Builds a new query object adding a cache TTL in milliseconds.
3099
4158
  * @param ttl The cache TTL in milliseconds.
3100
4159
  * @returns A new Query object.
3101
4160
  */
3102
4161
  cache(ttl: number): Query<Record, Result>;
4162
+ /**
4163
+ * Retrieve next page of records
4164
+ *
4165
+ * @returns A new page object.
4166
+ */
3103
4167
  nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4168
+ /**
4169
+ * Retrieve previous page of records
4170
+ *
4171
+ * @returns A new page object
4172
+ */
3104
4173
  previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4174
+ /**
4175
+ * Retrieve first page of records
4176
+ *
4177
+ * @returns A new page object
4178
+ */
3105
4179
  firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4180
+ /**
4181
+ * Retrieve last page of records
4182
+ *
4183
+ * @returns A new page object
4184
+ */
3106
4185
  lastPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4186
+ /**
4187
+ * @returns Boolean indicating if there is a next page
4188
+ */
3107
4189
  hasNextPage(): boolean;
3108
4190
  }
3109
4191
 
@@ -3115,7 +4197,7 @@ declare type PaginationQueryMeta = {
3115
4197
  };
3116
4198
  interface Paginable<Record extends XataRecord, Result extends XataRecord = Record> {
3117
4199
  meta: PaginationQueryMeta;
3118
- records: Result[];
4200
+ records: RecordArray<Result>;
3119
4201
  nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
3120
4202
  previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
3121
4203
  firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
@@ -3135,7 +4217,7 @@ declare class Page<Record extends XataRecord, Result extends XataRecord = Record
3135
4217
  /**
3136
4218
  * The set of results for this page.
3137
4219
  */
3138
- readonly records: Result[];
4220
+ readonly records: RecordArray<Result>;
3139
4221
  constructor(query: Query<Record, Result>, meta: PaginationQueryMeta, records?: Result[]);
3140
4222
  /**
3141
4223
  * Retrieves the next page of results.
@@ -3183,101 +4265,440 @@ declare type OffsetNavigationOptions = {
3183
4265
  size?: number;
3184
4266
  offset?: number;
3185
4267
  };
3186
- declare type PaginationOptions = CursorNavigationOptions & OffsetNavigationOptions;
3187
4268
  declare const PAGINATION_MAX_SIZE = 200;
3188
- declare const PAGINATION_DEFAULT_SIZE = 200;
4269
+ declare const PAGINATION_DEFAULT_SIZE = 20;
3189
4270
  declare const PAGINATION_MAX_OFFSET = 800;
3190
4271
  declare const PAGINATION_DEFAULT_OFFSET = 0;
4272
+ declare function isCursorPaginationOptions(options: Record<string, unknown> | undefined | null): options is CursorNavigationOptions;
4273
+ declare class RecordArray<Result extends XataRecord> extends Array<Result> {
4274
+ #private;
4275
+ constructor(page: Paginable<any, Result>, overrideRecords?: Result[]);
4276
+ static parseConstructorParams(...args: any[]): any[];
4277
+ toArray(): Result[];
4278
+ map<U>(callbackfn: (value: Result, index: number, array: Result[]) => U, thisArg?: any): U[];
4279
+ /**
4280
+ * Retrieve next page of records
4281
+ *
4282
+ * @returns A new array of objects
4283
+ */
4284
+ nextPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4285
+ /**
4286
+ * Retrieve previous page of records
4287
+ *
4288
+ * @returns A new array of objects
4289
+ */
4290
+ previousPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4291
+ /**
4292
+ * Retrieve first page of records
4293
+ *
4294
+ * @returns A new array of objects
4295
+ */
4296
+ firstPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4297
+ /**
4298
+ * Retrieve last page of records
4299
+ *
4300
+ * @returns A new array of objects
4301
+ */
4302
+ lastPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4303
+ /**
4304
+ * @returns Boolean indicating if there is a next page
4305
+ */
4306
+ hasNextPage(): boolean;
4307
+ }
3191
4308
 
3192
4309
  /**
3193
4310
  * Common interface for performing operations on a table.
3194
4311
  */
3195
- declare abstract class Repository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
3196
- abstract create(object: EditableData<Data> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4312
+ declare abstract class Repository<Record extends XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
4313
+ abstract create<K extends SelectableColumn<Record>>(object: Omit<EditableData<Record>, 'id'> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4314
+ abstract create(object: Omit<EditableData<Record>, 'id'> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4315
+ /**
4316
+ * Creates a single record in the table with a unique id.
4317
+ * @param id The unique id.
4318
+ * @param object Object containing the column names with their values to be stored in the table.
4319
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4320
+ * @returns The full persisted record.
4321
+ */
4322
+ abstract create<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3197
4323
  /**
3198
4324
  * Creates a single record in the table with a unique id.
3199
4325
  * @param id The unique id.
3200
4326
  * @param object Object containing the column names with their values to be stored in the table.
3201
4327
  * @returns The full persisted record.
3202
4328
  */
3203
- abstract create(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4329
+ abstract create(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3204
4330
  /**
3205
4331
  * Creates multiple records in the table.
3206
4332
  * @param objects Array of objects with the column names and the values to be stored in the table.
3207
- * @returns Array of the persisted records.
4333
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4334
+ * @returns Array of the persisted records in order.
4335
+ */
4336
+ abstract create<K extends SelectableColumn<Record>>(objects: Array<Omit<EditableData<Record>, 'id'> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4337
+ /**
4338
+ * Creates multiple records in the table.
4339
+ * @param objects Array of objects with the column names and the values to be stored in the table.
4340
+ * @returns Array of the persisted records in order.
3208
4341
  */
3209
- abstract create(objects: Array<EditableData<Data> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4342
+ abstract create(objects: Array<Omit<EditableData<Record>, 'id'> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4343
+ /**
4344
+ * Queries a single record from the table given its unique id.
4345
+ * @param id The unique id.
4346
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4347
+ * @returns The persisted record for the given id or null if the record could not be found.
4348
+ */
4349
+ abstract read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
3210
4350
  /**
3211
4351
  * Queries a single record from the table given its unique id.
3212
4352
  * @param id The unique id.
3213
4353
  * @returns The persisted record for the given id or null if the record could not be found.
3214
4354
  */
3215
4355
  abstract read(id: string): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4356
+ /**
4357
+ * Queries multiple records from the table given their unique id.
4358
+ * @param ids The unique ids array.
4359
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4360
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4361
+ */
4362
+ abstract read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4363
+ /**
4364
+ * Queries multiple records from the table given their unique id.
4365
+ * @param ids The unique ids array.
4366
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4367
+ */
4368
+ abstract read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4369
+ /**
4370
+ * Queries a single record from the table by the id in the object.
4371
+ * @param object Object containing the id of the record.
4372
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4373
+ * @returns The persisted record for the given id or null if the record could not be found.
4374
+ */
4375
+ abstract read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
4376
+ /**
4377
+ * Queries a single record from the table by the id in the object.
4378
+ * @param object Object containing the id of the record.
4379
+ * @returns The persisted record for the given id or null if the record could not be found.
4380
+ */
4381
+ abstract read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4382
+ /**
4383
+ * Queries multiple records from the table by the ids in the objects.
4384
+ * @param objects Array of objects containing the ids of the records.
4385
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4386
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4387
+ */
4388
+ abstract read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4389
+ /**
4390
+ * Queries multiple records from the table by the ids in the objects.
4391
+ * @param objects Array of objects containing the ids of the records.
4392
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4393
+ */
4394
+ abstract read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4395
+ /**
4396
+ * Queries a single record from the table given its unique id.
4397
+ * @param id The unique id.
4398
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4399
+ * @returns The persisted record for the given id.
4400
+ * @throws If the record could not be found.
4401
+ */
4402
+ abstract readOrThrow<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4403
+ /**
4404
+ * Queries a single record from the table given its unique id.
4405
+ * @param id The unique id.
4406
+ * @returns The persisted record for the given id.
4407
+ * @throws If the record could not be found.
4408
+ */
4409
+ abstract readOrThrow(id: string): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4410
+ /**
4411
+ * Queries multiple records from the table given their unique id.
4412
+ * @param ids The unique ids array.
4413
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4414
+ * @returns The persisted records for the given ids in order.
4415
+ * @throws If one or more records could not be found.
4416
+ */
4417
+ abstract readOrThrow<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
4418
+ /**
4419
+ * Queries multiple records from the table given their unique id.
4420
+ * @param ids The unique ids array.
4421
+ * @returns The persisted records for the given ids in order.
4422
+ * @throws If one or more records could not be found.
4423
+ */
4424
+ abstract readOrThrow(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
4425
+ /**
4426
+ * Queries a single record from the table by the id in the object.
4427
+ * @param object Object containing the id of the record.
4428
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4429
+ * @returns The persisted record for the given id.
4430
+ * @throws If the record could not be found.
4431
+ */
4432
+ abstract readOrThrow<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4433
+ /**
4434
+ * Queries a single record from the table by the id in the object.
4435
+ * @param object Object containing the id of the record.
4436
+ * @returns The persisted record for the given id.
4437
+ * @throws If the record could not be found.
4438
+ */
4439
+ abstract readOrThrow(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4440
+ /**
4441
+ * Queries multiple records from the table by the ids in the objects.
4442
+ * @param objects Array of objects containing the ids of the records.
4443
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4444
+ * @returns The persisted records for the given ids in order.
4445
+ * @throws If one or more records could not be found.
4446
+ */
4447
+ abstract readOrThrow<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
4448
+ /**
4449
+ * Queries multiple records from the table by the ids in the objects.
4450
+ * @param objects Array of objects containing the ids of the records.
4451
+ * @returns The persisted records for the given ids in order.
4452
+ * @throws If one or more records could not be found.
4453
+ */
4454
+ abstract readOrThrow(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3216
4455
  /**
3217
4456
  * Partially update a single record.
3218
4457
  * @param object An object with its id and the columns to be updated.
4458
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4459
+ * @returns The full persisted record, null if the record could not be found.
4460
+ */
4461
+ abstract update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4462
+ /**
4463
+ * Partially update a single record.
4464
+ * @param object An object with its id and the columns to be updated.
4465
+ * @returns The full persisted record, null if the record could not be found.
4466
+ */
4467
+ abstract update(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4468
+ /**
4469
+ * Partially update a single record given its unique id.
4470
+ * @param id The unique id.
4471
+ * @param object The column names and their values that have to be updated.
4472
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4473
+ * @returns The full persisted record, null if the record could not be found.
4474
+ */
4475
+ abstract update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4476
+ /**
4477
+ * Partially update a single record given its unique id.
4478
+ * @param id The unique id.
4479
+ * @param object The column names and their values that have to be updated.
4480
+ * @returns The full persisted record, null if the record could not be found.
4481
+ */
4482
+ abstract update(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4483
+ /**
4484
+ * Partially updates multiple records.
4485
+ * @param objects An array of objects with their ids and columns to be updated.
4486
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4487
+ * @returns Array of the persisted records in order (if a record could not be found null is returned).
4488
+ */
4489
+ abstract update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4490
+ /**
4491
+ * Partially updates multiple records.
4492
+ * @param objects An array of objects with their ids and columns to be updated.
4493
+ * @returns Array of the persisted records in order (if a record could not be found null is returned).
4494
+ */
4495
+ abstract update(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4496
+ /**
4497
+ * Partially update a single record.
4498
+ * @param object An object with its id and the columns to be updated.
4499
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3219
4500
  * @returns The full persisted record.
4501
+ * @throws If the record could not be found.
3220
4502
  */
3221
- abstract update(object: Partial<EditableData<Data>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4503
+ abstract updateOrThrow<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4504
+ /**
4505
+ * Partially update a single record.
4506
+ * @param object An object with its id and the columns to be updated.
4507
+ * @returns The full persisted record.
4508
+ * @throws If the record could not be found.
4509
+ */
4510
+ abstract updateOrThrow(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4511
+ /**
4512
+ * Partially update a single record given its unique id.
4513
+ * @param id The unique id.
4514
+ * @param object The column names and their values that have to be updated.
4515
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4516
+ * @returns The full persisted record.
4517
+ * @throws If the record could not be found.
4518
+ */
4519
+ abstract updateOrThrow<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3222
4520
  /**
3223
4521
  * Partially update a single record given its unique id.
3224
4522
  * @param id The unique id.
3225
4523
  * @param object The column names and their values that have to be updated.
3226
4524
  * @returns The full persisted record.
4525
+ * @throws If the record could not be found.
3227
4526
  */
3228
- abstract update(id: string, object: Partial<EditableData<Data>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4527
+ abstract updateOrThrow(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3229
4528
  /**
3230
4529
  * Partially updates multiple records.
3231
4530
  * @param objects An array of objects with their ids and columns to be updated.
3232
- * @returns Array of the persisted records.
4531
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4532
+ * @returns Array of the persisted records in order.
4533
+ * @throws If one or more records could not be found.
3233
4534
  */
3234
- abstract update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4535
+ abstract updateOrThrow<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4536
+ /**
4537
+ * Partially updates multiple records.
4538
+ * @param objects An array of objects with their ids and columns to be updated.
4539
+ * @returns Array of the persisted records in order.
4540
+ * @throws If one or more records could not be found.
4541
+ */
4542
+ abstract updateOrThrow(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3235
4543
  /**
3236
4544
  * Creates or updates a single record. If a record exists with the given id,
3237
4545
  * it will be update, otherwise a new record will be created.
3238
4546
  * @param object Object containing the column names with their values to be persisted in the table.
4547
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3239
4548
  * @returns The full persisted record.
3240
4549
  */
3241
- abstract createOrUpdate(object: EditableData<Data> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4550
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Record> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4551
+ /**
4552
+ * Creates or updates a single record. If a record exists with the given id,
4553
+ * it will be update, otherwise a new record will be created.
4554
+ * @param object Object containing the column names with their values to be persisted in the table.
4555
+ * @returns The full persisted record.
4556
+ */
4557
+ abstract createOrUpdate(object: EditableData<Record> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3242
4558
  /**
3243
4559
  * Creates or updates a single record. If a record exists with the given id,
3244
4560
  * it will be update, otherwise a new record will be created.
3245
4561
  * @param id A unique id.
3246
4562
  * @param object The column names and the values to be persisted.
4563
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3247
4564
  * @returns The full persisted record.
3248
4565
  */
3249
- abstract createOrUpdate(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4566
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4567
+ /**
4568
+ * Creates or updates a single record. If a record exists with the given id,
4569
+ * it will be update, otherwise a new record will be created.
4570
+ * @param id A unique id.
4571
+ * @param object The column names and the values to be persisted.
4572
+ * @returns The full persisted record.
4573
+ */
4574
+ abstract createOrUpdate(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4575
+ /**
4576
+ * Creates or updates a single record. If a record exists with the given id,
4577
+ * it will be update, otherwise a new record will be created.
4578
+ * @param objects Array of objects with the column names and the values to be stored in the table.
4579
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4580
+ * @returns Array of the persisted records.
4581
+ */
4582
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3250
4583
  /**
3251
4584
  * Creates or updates a single record. If a record exists with the given id,
3252
4585
  * it will be update, otherwise a new record will be created.
3253
4586
  * @param objects Array of objects with the column names and the values to be stored in the table.
3254
4587
  * @returns Array of the persisted records.
3255
4588
  */
3256
- abstract createOrUpdate(objects: Array<EditableData<Data> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4589
+ abstract createOrUpdate(objects: Array<EditableData<Record> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4590
+ /**
4591
+ * Deletes a record given its unique id.
4592
+ * @param object An object with a unique id.
4593
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4594
+ * @returns The deleted record, null if the record could not be found.
4595
+ */
4596
+ abstract delete<K extends SelectableColumn<Record>>(object: Identifiable & Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3257
4597
  /**
3258
4598
  * Deletes a record given its unique id.
4599
+ * @param object An object with a unique id.
4600
+ * @returns The deleted record, null if the record could not be found.
4601
+ */
4602
+ abstract delete(object: Identifiable & Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4603
+ /**
4604
+ * Deletes a record given a unique id.
3259
4605
  * @param id The unique id.
3260
- * @throws If the record could not be found or there was an error while performing the deletion.
4606
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4607
+ * @returns The deleted record, null if the record could not be found.
3261
4608
  */
3262
- abstract delete(id: string): Promise<void>;
4609
+ abstract delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4610
+ /**
4611
+ * Deletes a record given a unique id.
4612
+ * @param id The unique id.
4613
+ * @returns The deleted record, null if the record could not be found.
4614
+ */
4615
+ abstract delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4616
+ /**
4617
+ * Deletes multiple records given an array of objects with ids.
4618
+ * @param objects An array of objects with unique ids.
4619
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4620
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4621
+ */
4622
+ abstract delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4623
+ /**
4624
+ * Deletes multiple records given an array of objects with ids.
4625
+ * @param objects An array of objects with unique ids.
4626
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4627
+ */
4628
+ abstract delete(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4629
+ /**
4630
+ * Deletes multiple records given an array of unique ids.
4631
+ * @param objects An array of ids.
4632
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4633
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4634
+ */
4635
+ abstract delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4636
+ /**
4637
+ * Deletes multiple records given an array of unique ids.
4638
+ * @param objects An array of ids.
4639
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4640
+ */
4641
+ abstract delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4642
+ /**
4643
+ * Deletes a record given its unique id.
4644
+ * @param object An object with a unique id.
4645
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4646
+ * @returns The deleted record, null if the record could not be found.
4647
+ * @throws If the record could not be found.
4648
+ */
4649
+ abstract deleteOrThrow<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3263
4650
  /**
3264
4651
  * Deletes a record given its unique id.
3265
- * @param id An object with a unique id.
3266
- * @throws If the record could not be found or there was an error while performing the deletion.
4652
+ * @param object An object with a unique id.
4653
+ * @returns The deleted record, null if the record could not be found.
4654
+ * @throws If the record could not be found.
3267
4655
  */
3268
- abstract delete(id: Identifiable): Promise<void>;
4656
+ abstract deleteOrThrow(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3269
4657
  /**
3270
- * Deletes a record given a list of unique ids.
3271
- * @param ids The array of unique ids.
3272
- * @throws If the record could not be found or there was an error while performing the deletion.
4658
+ * Deletes a record given a unique id.
4659
+ * @param id The unique id.
4660
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4661
+ * @returns The deleted record, null if the record could not be found.
4662
+ * @throws If the record could not be found.
3273
4663
  */
3274
- abstract delete(ids: string[]): Promise<void>;
4664
+ abstract deleteOrThrow<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3275
4665
  /**
3276
- * Deletes a record given a list of unique ids.
3277
- * @param ids An array of objects with unique ids.
3278
- * @throws If the record could not be found or there was an error while performing the deletion.
4666
+ * Deletes a record given a unique id.
4667
+ * @param id The unique id.
4668
+ * @returns The deleted record, null if the record could not be found.
4669
+ * @throws If the record could not be found.
3279
4670
  */
3280
- abstract delete(ids: Identifiable[]): Promise<void>;
4671
+ abstract deleteOrThrow(id: string): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4672
+ /**
4673
+ * Deletes multiple records given an array of objects with ids.
4674
+ * @param objects An array of objects with unique ids.
4675
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4676
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4677
+ * @throws If one or more records could not be found.
4678
+ */
4679
+ abstract deleteOrThrow<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
4680
+ /**
4681
+ * Deletes multiple records given an array of objects with ids.
4682
+ * @param objects An array of objects with unique ids.
4683
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4684
+ * @throws If one or more records could not be found.
4685
+ */
4686
+ abstract deleteOrThrow(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
4687
+ /**
4688
+ * Deletes multiple records given an array of unique ids.
4689
+ * @param objects An array of ids.
4690
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4691
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4692
+ * @throws If one or more records could not be found.
4693
+ */
4694
+ abstract deleteOrThrow<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
4695
+ /**
4696
+ * Deletes multiple records given an array of unique ids.
4697
+ * @param objects An array of ids.
4698
+ * @returns Array of the deleted records in order.
4699
+ * @throws If one or more records could not be found.
4700
+ */
4701
+ abstract deleteOrThrow(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3281
4702
  /**
3282
4703
  * Search for records in the table.
3283
4704
  * @param query The query to search for.
@@ -3285,35 +4706,152 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3285
4706
  * @returns The found records.
3286
4707
  */
3287
4708
  abstract search(query: string, options?: {
3288
- fuzziness?: number;
3289
- }): Promise<SelectedPick<Record, ['*']>[]>;
4709
+ fuzziness?: FuzzinessExpression;
4710
+ prefix?: PrefixExpression;
4711
+ highlight?: HighlightExpression;
4712
+ filter?: Filter<Record>;
4713
+ boosters?: Boosters<Record>[];
4714
+ }): Promise<SearchXataRecord<SelectedPick<Record, ['*']>>[]>;
3290
4715
  abstract query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3291
4716
  }
3292
- declare class RestRepository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Data, Record> {
4717
+ declare class RestRepository<Record extends XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Record> {
3293
4718
  #private;
3294
- db: SchemaPluginResult<any>;
3295
4719
  constructor(options: {
3296
4720
  table: string;
3297
4721
  db: SchemaPluginResult<any>;
3298
4722
  pluginOptions: XataPluginOptions;
4723
+ schemaTables?: Table[];
3299
4724
  });
3300
- create(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3301
- create(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3302
- create(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3303
- read(recordId: string): Promise<SelectedPick<Record, ['*']> | null>;
3304
- update(object: Partial<EditableData<Data>> & Identifiable): Promise<SelectedPick<Record, ['*']>>;
3305
- update(recordId: string, object: Partial<EditableData<Data>>): Promise<SelectedPick<Record, ['*']>>;
3306
- update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<SelectedPick<Record, ['*']>[]>;
3307
- createOrUpdate(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3308
- createOrUpdate(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3309
- createOrUpdate(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3310
- delete(a: string | Identifiable | Array<string | Identifiable>): Promise<void>;
4725
+ create<K extends SelectableColumn<Record>>(object: EditableData<Record> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4726
+ create(object: EditableData<Record> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4727
+ create<K extends SelectableColumn<Record>>(id: string, object: EditableData<Record>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4728
+ create(id: string, object: EditableData<Record>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4729
+ create<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4730
+ create(objects: Array<EditableData<Record> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4731
+ read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
4732
+ read(id: string): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4733
+ read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4734
+ read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4735
+ read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
4736
+ read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4737
+ read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4738
+ read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4739
+ readOrThrow<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4740
+ readOrThrow(id: string): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4741
+ readOrThrow<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
4742
+ readOrThrow(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
4743
+ readOrThrow<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4744
+ readOrThrow(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4745
+ readOrThrow<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
4746
+ readOrThrow(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
4747
+ update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4748
+ update(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4749
+ update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4750
+ update(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4751
+ update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4752
+ update(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4753
+ updateOrThrow<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4754
+ updateOrThrow(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4755
+ updateOrThrow<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4756
+ updateOrThrow(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4757
+ updateOrThrow<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4758
+ updateOrThrow(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4759
+ createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Record> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4760
+ createOrUpdate(object: EditableData<Record> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4761
+ createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4762
+ createOrUpdate(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4763
+ createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4764
+ createOrUpdate(objects: Array<EditableData<Record> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4765
+ delete<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4766
+ delete(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4767
+ delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4768
+ delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4769
+ delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4770
+ delete(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4771
+ delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4772
+ delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4773
+ deleteOrThrow<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4774
+ deleteOrThrow(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4775
+ deleteOrThrow<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4776
+ deleteOrThrow(id: string): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4777
+ deleteOrThrow<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
4778
+ deleteOrThrow(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
4779
+ deleteOrThrow<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
4780
+ deleteOrThrow(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3311
4781
  search(query: string, options?: {
3312
- fuzziness?: number;
3313
- }): Promise<SelectedPick<Record, ['*']>[]>;
4782
+ fuzziness?: FuzzinessExpression;
4783
+ prefix?: PrefixExpression;
4784
+ highlight?: HighlightExpression;
4785
+ filter?: Filter<Record>;
4786
+ boosters?: Boosters<Record>[];
4787
+ }): Promise<any>;
3314
4788
  query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3315
4789
  }
3316
4790
 
4791
+ declare type BaseSchema = {
4792
+ name: string;
4793
+ columns: readonly ({
4794
+ name: string;
4795
+ type: Column['type'];
4796
+ notNull?: boolean;
4797
+ } | {
4798
+ name: string;
4799
+ type: 'link';
4800
+ link: {
4801
+ table: string;
4802
+ };
4803
+ } | {
4804
+ name: string;
4805
+ type: 'object';
4806
+ columns: {
4807
+ name: string;
4808
+ type: string;
4809
+ }[];
4810
+ })[];
4811
+ };
4812
+ declare type SchemaInference<T extends readonly BaseSchema[]> = T extends never[] ? Record<string, Record<string, any>> : T extends readonly unknown[] ? T[number] extends {
4813
+ name: string;
4814
+ columns: readonly unknown[];
4815
+ } ? {
4816
+ [K in T[number]['name']]: TableType<T[number], K>;
4817
+ } : never : never;
4818
+ declare type TableType<Tables, TableName> = Tables & {
4819
+ name: TableName;
4820
+ } extends infer Table ? Table extends {
4821
+ name: string;
4822
+ columns: infer Columns;
4823
+ } ? Columns extends readonly unknown[] ? Columns[number] extends {
4824
+ name: string;
4825
+ type: string;
4826
+ } ? Identifiable & UnionToIntersection<Values<{
4827
+ [K in Columns[number]['name']]: PropertyType<Tables, Columns[number], K>;
4828
+ }>> : never : never : never : never;
4829
+ declare type PropertyType<Tables, Properties, PropertyName extends PropertyKey> = Properties & {
4830
+ name: PropertyName;
4831
+ } extends infer Property ? Property extends {
4832
+ name: string;
4833
+ type: infer Type;
4834
+ link?: {
4835
+ table: infer LinkedTable;
4836
+ };
4837
+ columns?: infer ObjectColumns;
4838
+ notNull?: infer NotNull;
4839
+ } ? NotNull extends true ? {
4840
+ [K in PropertyName]: InnerType<Type, ObjectColumns, Tables, LinkedTable>;
4841
+ } : {
4842
+ [K in PropertyName]?: InnerType<Type, ObjectColumns, Tables, LinkedTable> | null;
4843
+ } : never : never;
4844
+ 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 {
4845
+ name: string;
4846
+ type: string;
4847
+ } ? UnionToIntersection<Values<{
4848
+ [K in ObjectColumns[number]['name']]: PropertyType<Tables, ObjectColumns[number], K>;
4849
+ }>> : never : never : Type extends 'link' ? TableType<Tables, LinkedTable> & XataRecord : never;
4850
+
4851
+ /**
4852
+ * Operator to restrict results to only values that are greater than the given value.
4853
+ */
4854
+ declare const greaterThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3317
4855
  /**
3318
4856
  * Operator to restrict results to only values that are greater than the given value.
3319
4857
  */
@@ -3321,15 +4859,35 @@ declare const gt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T
3321
4859
  /**
3322
4860
  * Operator to restrict results to only values that are greater than or equal to the given value.
3323
4861
  */
3324
- declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4862
+ declare const greaterThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4863
+ /**
4864
+ * Operator to restrict results to only values that are greater than or equal to the given value.
4865
+ */
4866
+ declare const greaterEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3325
4867
  /**
3326
4868
  * Operator to restrict results to only values that are greater than or equal to the given value.
3327
4869
  */
3328
4870
  declare const gte: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4871
+ /**
4872
+ * Operator to restrict results to only values that are greater than or equal to the given value.
4873
+ */
4874
+ declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4875
+ /**
4876
+ * Operator to restrict results to only values that are lower than the given value.
4877
+ */
4878
+ declare const lessThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3329
4879
  /**
3330
4880
  * Operator to restrict results to only values that are lower than the given value.
3331
4881
  */
3332
4882
  declare const lt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4883
+ /**
4884
+ * Operator to restrict results to only values that are lower than or equal to the given value.
4885
+ */
4886
+ declare const lessThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4887
+ /**
4888
+ * Operator to restrict results to only values that are lower than or equal to the given value.
4889
+ */
4890
+ declare const lessEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3333
4891
  /**
3334
4892
  * Operator to restrict results to only values that are lower than or equal to the given value.
3335
4893
  */
@@ -3362,6 +4920,10 @@ declare const pattern: (value: string) => StringTypeFilter;
3362
4920
  * Operator to restrict results to only values that are equal to the given value.
3363
4921
  */
3364
4922
  declare const is: <T>(value: T) => PropertyFilter<T>;
4923
+ /**
4924
+ * Operator to restrict results to only values that are equal to the given value.
4925
+ */
4926
+ declare const equals: <T>(value: T) => PropertyFilter<T>;
3365
4927
  /**
3366
4928
  * Operator to restrict results to only values that are not equal to the given value.
3367
4929
  */
@@ -3390,45 +4952,15 @@ declare const includesAny: <T>(value: T) => ArrayFilter<T>;
3390
4952
  declare type SchemaDefinition = {
3391
4953
  table: string;
3392
4954
  };
3393
- declare type SchemaPluginResult<Schemas extends Record<string, BaseData>> = {
4955
+ declare type SchemaPluginResult<Schemas extends Record<string, XataRecord>> = {
3394
4956
  [Key in keyof Schemas]: Repository<Schemas[Key]>;
3395
- } & {
3396
- [key: string]: Repository<XataRecord$1>;
3397
4957
  };
3398
- declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
4958
+ declare class SchemaPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin {
3399
4959
  #private;
3400
- private tableNames?;
3401
- constructor(tableNames?: string[] | undefined);
4960
+ constructor(schemaTables?: Schemas.Table[]);
3402
4961
  build(pluginOptions: XataPluginOptions): SchemaPluginResult<Schemas>;
3403
4962
  }
3404
4963
 
3405
- declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3406
- fuzziness?: number;
3407
- tables?: Tables[];
3408
- };
3409
- declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3410
- all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3411
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]: {
3412
- table: Model;
3413
- record: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>>;
3414
- };
3415
- }>[]>;
3416
- byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3417
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]?: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>[]>;
3418
- }>;
3419
- };
3420
- declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
3421
- #private;
3422
- private db;
3423
- constructor(db: SchemaPluginResult<Schemas>);
3424
- build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
3425
- }
3426
- declare type SearchXataRecord = XataRecord & {
3427
- xata: {
3428
- table: string;
3429
- };
3430
- };
3431
-
3432
4964
  declare type BranchStrategyValue = string | undefined | null;
3433
4965
  declare type BranchStrategyBuilder = () => BranchStrategyValue | Promise<BranchStrategyValue>;
3434
4966
  declare type BranchStrategy = BranchStrategyValue | BranchStrategyBuilder;
@@ -3440,20 +4972,35 @@ declare type BaseClientOptions = {
3440
4972
  databaseURL?: string;
3441
4973
  branch?: BranchStrategyOption;
3442
4974
  cache?: CacheImpl;
4975
+ trace?: TraceFunction;
3443
4976
  };
3444
4977
  declare const buildClient: <Plugins extends Record<string, XataPlugin> = {}>(plugins?: Plugins | undefined) => ClientConstructor<Plugins>;
3445
4978
  interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
3446
- new <Schemas extends Record<string, BaseData> = {}>(options?: Partial<BaseClientOptions>, tables?: string[]): Omit<{
4979
+ new <Schemas extends Record<string, XataRecord> = {}>(options?: Partial<BaseClientOptions>, schemaTables?: readonly BaseSchema[]): Omit<{
3447
4980
  db: Awaited<ReturnType<SchemaPlugin<Schemas>['build']>>;
3448
4981
  search: Awaited<ReturnType<SearchPlugin<Schemas>['build']>>;
3449
4982
  }, keyof Plugins> & {
3450
4983
  [Key in StringKeys<NonNullable<Plugins>>]: Awaited<ReturnType<NonNullable<Plugins>[Key]['build']>>;
4984
+ } & {
4985
+ getConfig(): Promise<{
4986
+ databaseURL: string;
4987
+ branch: string;
4988
+ }>;
3451
4989
  };
3452
4990
  }
3453
4991
  declare const BaseClient_base: ClientConstructor<{}>;
3454
4992
  declare class BaseClient extends BaseClient_base<Record<string, any>> {
3455
4993
  }
3456
4994
 
4995
+ declare class Serializer {
4996
+ classes: Record<string, any>;
4997
+ add(clazz: any): void;
4998
+ toJSON<T>(data: T): string;
4999
+ fromJSON<T>(json: string): T;
5000
+ }
5001
+ declare const serialize: <T>(data: T) => string;
5002
+ declare const deserialize: <T>(json: string) => T;
5003
+
3457
5004
  declare type BranchResolutionOptions = {
3458
5005
  databaseURL?: string;
3459
5006
  apiKey?: string;
@@ -3465,9 +5012,89 @@ declare function getDatabaseURL(): string | undefined;
3465
5012
 
3466
5013
  declare function getAPIKey(): string | undefined;
3467
5014
 
5015
+ interface Body {
5016
+ arrayBuffer(): Promise<ArrayBuffer>;
5017
+ blob(): Promise<Blob>;
5018
+ formData(): Promise<FormData>;
5019
+ json(): Promise<any>;
5020
+ text(): Promise<string>;
5021
+ }
5022
+ interface Blob {
5023
+ readonly size: number;
5024
+ readonly type: string;
5025
+ arrayBuffer(): Promise<ArrayBuffer>;
5026
+ slice(start?: number, end?: number, contentType?: string): Blob;
5027
+ text(): Promise<string>;
5028
+ }
5029
+ /** Provides information about files and allows JavaScript in a web page to access their content. */
5030
+ interface File extends Blob {
5031
+ readonly lastModified: number;
5032
+ readonly name: string;
5033
+ readonly webkitRelativePath: string;
5034
+ }
5035
+ declare type FormDataEntryValue = File | string;
5036
+ /** 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". */
5037
+ interface FormData {
5038
+ append(name: string, value: string | Blob, fileName?: string): void;
5039
+ delete(name: string): void;
5040
+ get(name: string): FormDataEntryValue | null;
5041
+ getAll(name: string): FormDataEntryValue[];
5042
+ has(name: string): boolean;
5043
+ set(name: string, value: string | Blob, fileName?: string): void;
5044
+ forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void;
5045
+ }
5046
+ /** 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. */
5047
+ interface Headers {
5048
+ append(name: string, value: string): void;
5049
+ delete(name: string): void;
5050
+ get(name: string): string | null;
5051
+ has(name: string): boolean;
5052
+ set(name: string, value: string): void;
5053
+ forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void;
5054
+ }
5055
+ interface Request extends Body {
5056
+ /** Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching. */
5057
+ readonly cache: 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload';
5058
+ /** 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. */
5059
+ readonly credentials: 'include' | 'omit' | 'same-origin';
5060
+ /** Returns the kind of resource requested by request, e.g., "document" or "script". */
5061
+ readonly destination: '' | 'audio' | 'audioworklet' | 'document' | 'embed' | 'font' | 'frame' | 'iframe' | 'image' | 'manifest' | 'object' | 'paintworklet' | 'report' | 'script' | 'sharedworker' | 'style' | 'track' | 'video' | 'worker' | 'xslt';
5062
+ /** 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. */
5063
+ readonly headers: Headers;
5064
+ /** 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] */
5065
+ readonly integrity: string;
5066
+ /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
5067
+ readonly keepalive: boolean;
5068
+ /** Returns request's HTTP method, which is "GET" by default. */
5069
+ readonly method: string;
5070
+ /** 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. */
5071
+ readonly mode: 'cors' | 'navigate' | 'no-cors' | 'same-origin';
5072
+ /** 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. */
5073
+ readonly redirect: 'error' | 'follow' | 'manual';
5074
+ /** 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. */
5075
+ readonly referrer: string;
5076
+ /** Returns the referrer policy associated with request. This is used during fetching to compute the value of the request's referrer. */
5077
+ readonly referrerPolicy: '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
5078
+ /** Returns the URL of request as a string. */
5079
+ readonly url: string;
5080
+ clone(): Request;
5081
+ }
5082
+
5083
+ declare type XataWorkerContext<XataClient> = {
5084
+ xata: XataClient;
5085
+ request: Request;
5086
+ env: Record<string, string | undefined>;
5087
+ };
5088
+ declare type RemoveFirst<T> = T extends [any, ...infer U] ? U : never;
5089
+ declare type WorkerRunnerConfig = {
5090
+ workspace: string;
5091
+ worker: string;
5092
+ };
5093
+ 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>>>;
5094
+
3468
5095
  declare class XataError extends Error {
3469
5096
  readonly status: number;
3470
5097
  constructor(message: string, status: number);
3471
5098
  }
3472
5099
 
3473
- export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, AddGitBranchesEntryError, AddGitBranchesEntryPathParams, AddGitBranchesEntryRequestBody, AddGitBranchesEntryResponse, AddGitBranchesEntryVariables, AddTableColumnError, AddTableColumnPathParams, AddTableColumnVariables, BaseClient, BaseClientOptions, BaseData, BulkInsertTableRecordsError, BulkInsertTableRecordsPathParams, BulkInsertTableRecordsRequestBody, BulkInsertTableRecordsResponse, BulkInsertTableRecordsVariables, CacheImpl, CancelWorkspaceMemberInviteError, CancelWorkspaceMemberInvitePathParams, CancelWorkspaceMemberInviteVariables, ClientConstructor, CreateBranchError, CreateBranchPathParams, CreateBranchQueryParams, CreateBranchRequestBody, CreateBranchVariables, CreateDatabaseError, CreateDatabasePathParams, CreateDatabaseRequestBody, CreateDatabaseResponse, CreateDatabaseVariables, CreateTableError, CreateTablePathParams, CreateTableVariables, CreateUserAPIKeyError, CreateUserAPIKeyPathParams, CreateUserAPIKeyResponse, CreateUserAPIKeyVariables, CreateWorkspaceError, CreateWorkspaceVariables, CursorNavigationOptions, DeleteBranchError, DeleteBranchPathParams, DeleteBranchVariables, DeleteColumnError, DeleteColumnPathParams, DeleteColumnVariables, DeleteDatabaseError, DeleteDatabasePathParams, DeleteDatabaseVariables, DeleteRecordError, DeleteRecordPathParams, DeleteRecordVariables, DeleteTableError, DeleteTablePathParams, DeleteTableVariables, DeleteUserAPIKeyError, DeleteUserAPIKeyPathParams, DeleteUserAPIKeyVariables, DeleteUserError, DeleteUserVariables, DeleteWorkspaceError, DeleteWorkspacePathParams, DeleteWorkspaceVariables, EditableData, ExecuteBranchMigrationPlanError, ExecuteBranchMigrationPlanPathParams, ExecuteBranchMigrationPlanRequestBody, ExecuteBranchMigrationPlanVariables, FetchImpl, FetcherExtraProps, GetBranchDetailsError, GetBranchDetailsPathParams, GetBranchDetailsVariables, GetBranchListError, GetBranchListPathParams, GetBranchListVariables, GetBranchMetadataError, GetBranchMetadataPathParams, GetBranchMetadataVariables, GetBranchMigrationHistoryError, GetBranchMigrationHistoryPathParams, GetBranchMigrationHistoryRequestBody, GetBranchMigrationHistoryResponse, GetBranchMigrationHistoryVariables, GetBranchMigrationPlanError, GetBranchMigrationPlanPathParams, GetBranchMigrationPlanVariables, GetBranchStatsError, GetBranchStatsPathParams, GetBranchStatsResponse, GetBranchStatsVariables, GetColumnError, GetColumnPathParams, GetColumnVariables, GetDatabaseListError, GetDatabaseListPathParams, GetDatabaseListVariables, GetGitBranchesMappingError, GetGitBranchesMappingPathParams, GetGitBranchesMappingVariables, GetRecordError, GetRecordPathParams, GetRecordRequestBody, GetRecordVariables, GetTableColumnsError, GetTableColumnsPathParams, GetTableColumnsResponse, GetTableColumnsVariables, GetTableSchemaError, GetTableSchemaPathParams, GetTableSchemaResponse, GetTableSchemaVariables, GetUserAPIKeysError, GetUserAPIKeysResponse, GetUserAPIKeysVariables, GetUserError, GetUserVariables, GetWorkspaceError, GetWorkspaceMembersListError, GetWorkspaceMembersListPathParams, GetWorkspaceMembersListVariables, GetWorkspacePathParams, GetWorkspaceVariables, GetWorkspacesListError, GetWorkspacesListResponse, GetWorkspacesListVariables, Identifiable, InsertRecordError, InsertRecordPathParams, InsertRecordResponse, InsertRecordVariables, InsertRecordWithIDError, InsertRecordWithIDPathParams, InsertRecordWithIDQueryParams, InsertRecordWithIDVariables, InviteWorkspaceMemberError, InviteWorkspaceMemberPathParams, InviteWorkspaceMemberRequestBody, InviteWorkspaceMemberVariables, OffsetNavigationOptions, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Paginable, PaginationOptions, PaginationQueryMeta, Query, QueryTableError, QueryTablePathParams, QueryTableRequestBody, QueryTableVariables, RemoveGitBranchesEntryError, RemoveGitBranchesEntryPathParams, RemoveGitBranchesEntryQueryParams, RemoveGitBranchesEntryVariables, RemoveWorkspaceMemberError, RemoveWorkspaceMemberPathParams, RemoveWorkspaceMemberVariables, Repository, ResendWorkspaceMemberInviteError, ResendWorkspaceMemberInvitePathParams, ResendWorkspaceMemberInviteVariables, ResolveBranchError, ResolveBranchPathParams, ResolveBranchQueryParams, ResolveBranchResponse, ResolveBranchVariables, responses as Responses, RestRepository, SchemaDefinition, SchemaPlugin, SchemaPluginResult, schemas as Schemas, SearchBranchError, SearchBranchPathParams, SearchBranchRequestBody, SearchBranchVariables, SearchOptions, SearchPlugin, SearchPluginResult, SelectableColumn, SelectedPick, SetTableSchemaError, SetTableSchemaPathParams, SetTableSchemaRequestBody, SetTableSchemaVariables, SimpleCache, SimpleCacheOptions, UpdateBranchMetadataError, UpdateBranchMetadataPathParams, UpdateBranchMetadataVariables, UpdateColumnError, UpdateColumnPathParams, UpdateColumnRequestBody, UpdateColumnVariables, UpdateRecordWithIDError, UpdateRecordWithIDPathParams, UpdateRecordWithIDQueryParams, UpdateRecordWithIDVariables, UpdateTableError, UpdateTablePathParams, UpdateTableRequestBody, UpdateTableVariables, UpdateUserError, UpdateUserVariables, UpdateWorkspaceError, UpdateWorkspaceMemberRoleError, UpdateWorkspaceMemberRolePathParams, UpdateWorkspaceMemberRoleRequestBody, UpdateWorkspaceMemberRoleVariables, UpdateWorkspacePathParams, UpdateWorkspaceVariables, UpsertRecordWithIDError, UpsertRecordWithIDPathParams, UpsertRecordWithIDQueryParams, UpsertRecordWithIDVariables, ValueAtColumn, XataApiClient, XataApiClientOptions, XataApiPlugin, XataError, XataPlugin, XataPluginOptions, XataRecord, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, buildClient, bulkInsertTableRecords, cancelWorkspaceMemberInvite, contains, createBranch, createDatabase, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, endsWith, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseURL, getGitBranchesMapping, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isIdentifiable, isNot, isXataRecord, le, lt, lte, notExists, operationsByTag, pattern, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberRole, upsertRecordWithID };
5100
+ 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 };