@xata.io/client 0.0.0-alpha.vf89b33e → 0.0.0-alpha.vf8b33c9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,8 @@
1
+ declare type AttributeDictionary = Record<string, string | number | boolean | undefined>;
2
+ declare type TraceFunction = <T>(name: string, fn: (options: {
3
+ setAttributes: (attrs: AttributeDictionary) => void;
4
+ }) => T, options?: AttributeDictionary) => Promise<T>;
5
+
1
6
  declare type FetchImpl = (url: string, init?: {
2
7
  body?: string;
3
8
  headers?: Record<string, string>;
@@ -5,25 +10,56 @@ declare type FetchImpl = (url: string, init?: {
5
10
  }) => Promise<{
6
11
  ok: boolean;
7
12
  status: number;
13
+ url: string;
8
14
  json(): Promise<any>;
15
+ headers?: {
16
+ get(name: string): string | null;
17
+ };
9
18
  }>;
10
- declare type WorkspaceApiUrlBuilder = (path: string, pathParams: Record<string, string>) => string;
19
+ declare type WorkspaceApiUrlBuilder = (path: string, pathParams: Partial<Record<string, string | number>>) => string;
11
20
  declare type FetcherExtraProps = {
12
21
  apiUrl: string;
13
22
  workspacesApiUrl: string | WorkspaceApiUrlBuilder;
14
23
  fetchImpl: FetchImpl;
15
24
  apiKey: string;
25
+ trace: TraceFunction;
16
26
  };
17
27
  declare type ErrorWrapper<TError> = TError | {
18
28
  status: 'unknown';
19
29
  payload: string;
20
30
  };
21
31
 
32
+ interface CacheImpl {
33
+ defaultQueryTTL: number;
34
+ getAll(): Promise<Record<string, unknown>>;
35
+ get: <T>(key: string) => Promise<T | null>;
36
+ set: <T>(key: string, value: T) => Promise<void>;
37
+ delete: (key: string) => Promise<void>;
38
+ clear: () => Promise<void>;
39
+ }
40
+ interface SimpleCacheOptions {
41
+ max?: number;
42
+ defaultQueryTTL?: number;
43
+ }
44
+ declare class SimpleCache implements CacheImpl {
45
+ #private;
46
+ capacity: number;
47
+ defaultQueryTTL: number;
48
+ constructor(options?: SimpleCacheOptions);
49
+ getAll(): Promise<Record<string, unknown>>;
50
+ get<T>(key: string): Promise<T | null>;
51
+ set<T>(key: string, value: T): Promise<void>;
52
+ delete(key: string): Promise<void>;
53
+ clear(): Promise<void>;
54
+ }
55
+
22
56
  declare abstract class XataPlugin {
23
57
  abstract build(options: XataPluginOptions): unknown | Promise<unknown>;
24
58
  }
25
59
  declare type XataPluginOptions = {
26
60
  getFetchProps: () => Promise<FetcherExtraProps>;
61
+ cache: CacheImpl;
62
+ trace?: TraceFunction;
27
63
  };
28
64
 
29
65
  /**
@@ -63,7 +99,7 @@ declare type WorkspaceID = string;
63
99
  declare type Role = 'owner' | 'maintainer';
64
100
  declare type WorkspaceMeta = {
65
101
  name: string;
66
- slug: string;
102
+ slug?: string;
67
103
  };
68
104
  declare type Workspace = WorkspaceMeta & {
69
105
  id: WorkspaceID;
@@ -94,22 +130,30 @@ declare type WorkspaceMembers = {
94
130
  * @pattern ^ik_[a-zA-Z0-9]+
95
131
  */
96
132
  declare type InviteKey = string;
133
+ /**
134
+ * Metadata of databases
135
+ */
136
+ declare type DatabaseMetadata = {
137
+ name: string;
138
+ createdAt: DateTime;
139
+ numberOfBranches: number;
140
+ ui?: {
141
+ color?: string;
142
+ };
143
+ };
97
144
  declare type ListDatabasesResponse = {
98
- databases?: {
99
- name: string;
100
- displayName: string;
101
- createdAt: DateTime;
102
- numberOfBranches: number;
103
- ui?: {
104
- color?: string;
105
- };
106
- }[];
145
+ databases?: DatabaseMetadata[];
107
146
  };
108
147
  declare type ListBranchesResponse = {
109
148
  databaseName: string;
110
- displayName: string;
111
149
  branches: Branch[];
112
150
  };
151
+ declare type ListGitBranchesResponse = {
152
+ mapping: {
153
+ gitBranch: string;
154
+ xataBranch: string;
155
+ }[];
156
+ };
113
157
  declare type Branch = {
114
158
  name: string;
115
159
  createdAt: DateTime;
@@ -147,21 +191,39 @@ declare type Schema = {
147
191
  tables: Table[];
148
192
  tablesOrder?: string[];
149
193
  };
194
+ /**
195
+ * @x-internal true
196
+ */
197
+ declare type SchemaEditScript = {
198
+ sourceMigrationID?: string;
199
+ targetMigrationID?: string;
200
+ tables: TableEdit[];
201
+ };
150
202
  declare type Table = {
151
203
  id?: string;
152
204
  name: TableName;
153
205
  columns: Column[];
154
206
  revLinks?: RevLink[];
155
207
  };
208
+ /**
209
+ * @x-internal true
210
+ */
211
+ declare type TableEdit = {
212
+ oldName?: string;
213
+ newName?: string;
214
+ columns?: MigrationColumnOp[];
215
+ };
156
216
  /**
157
217
  * @x-go-type xata.Column
158
218
  */
159
219
  declare type Column = {
160
220
  name: string;
161
- type: 'bool' | 'int' | 'float' | 'string' | 'text' | 'email' | 'multiple' | 'link' | 'object';
221
+ type: 'bool' | 'int' | 'float' | 'string' | 'text' | 'email' | 'multiple' | 'link' | 'object' | 'datetime';
162
222
  link?: {
163
223
  table: string;
164
224
  };
225
+ notNull?: boolean;
226
+ unique?: boolean;
165
227
  columns?: Column[];
166
228
  };
167
229
  declare type RevLink = {
@@ -228,12 +290,135 @@ declare type ColumnMigration = {
228
290
  old: Column;
229
291
  ['new']: Column;
230
292
  };
293
+ /**
294
+ * @x-internal true
295
+ */
296
+ declare type Commit = {
297
+ meta?: {
298
+ title?: string;
299
+ message?: string;
300
+ id: string;
301
+ parentID?: string;
302
+ mergeParentID?: string;
303
+ status: string;
304
+ createdAt: DateTime;
305
+ modifiedAt?: DateTime;
306
+ };
307
+ operations: MigrationOp[];
308
+ };
309
+ /**
310
+ * Branch schema migration.
311
+ *
312
+ * @x-internal true
313
+ */
314
+ declare type Migration = {
315
+ parentID?: string;
316
+ operations: MigrationOp[];
317
+ };
318
+ /**
319
+ * Branch schema migration operations.
320
+ *
321
+ * @x-internal true
322
+ */
323
+ declare type MigrationOp = MigrationTableOp | MigrationColumnOp;
324
+ /**
325
+ * @x-internal true
326
+ */
327
+ declare type MigrationTableOp = {
328
+ addTable: TableOpAdd;
329
+ } | {
330
+ removeTable: TableOpRemove;
331
+ } | {
332
+ renameTable: TableOpRename;
333
+ };
334
+ /**
335
+ * @x-internal true
336
+ */
337
+ declare type MigrationColumnOp = {
338
+ addColumn: ColumnOpAdd;
339
+ } | {
340
+ removeColumn: ColumnOpRemove;
341
+ } | {
342
+ renameColumn: ColumnOpRename;
343
+ };
344
+ /**
345
+ * @x-internal true
346
+ */
347
+ declare type TableOpAdd = {
348
+ table: string;
349
+ };
350
+ /**
351
+ * @x-internal true
352
+ */
353
+ declare type TableOpRemove = {
354
+ table: string;
355
+ };
356
+ /**
357
+ * @x-internal true
358
+ */
359
+ declare type TableOpRename = {
360
+ oldName: string;
361
+ newName: string;
362
+ };
363
+ /**
364
+ * @x-internal true
365
+ */
366
+ declare type ColumnOpAdd = {
367
+ table?: string;
368
+ column: Column;
369
+ };
370
+ /**
371
+ * @x-internal true
372
+ */
373
+ declare type ColumnOpRemove = {
374
+ table?: string;
375
+ column: string;
376
+ };
377
+ /**
378
+ * @x-internal true
379
+ */
380
+ declare type ColumnOpRename = {
381
+ table?: string;
382
+ oldName: string;
383
+ newName: string;
384
+ };
385
+ declare type MigrationRequest = {
386
+ number: number;
387
+ createdAt: DateTime;
388
+ modifiedAt?: DateTime;
389
+ closedAt?: DateTime;
390
+ mergedAt?: DateTime;
391
+ status: 'open' | 'closed' | 'merging' | 'merged';
392
+ title: string;
393
+ body: string;
394
+ source: string;
395
+ target: string;
396
+ };
231
397
  declare type SortExpression = string[] | {
232
398
  [key: string]: SortOrder;
233
399
  } | {
234
400
  [key: string]: SortOrder;
235
401
  }[];
236
402
  declare type SortOrder = 'asc' | 'desc';
403
+ /**
404
+ * Maximum [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) for the search terms. The Levenshtein
405
+ * distance is the number of one 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';
418
+ /**
419
+ * The target expression is used to filter the search results by the target columns.
420
+ */
421
+ declare type TargetExpression = string[];
237
422
  /**
238
423
  * @minProperties 1
239
424
  */
@@ -247,6 +432,48 @@ declare type FilterExpression = {
247
432
  } & {
248
433
  [key: string]: FilterColumn;
249
434
  };
435
+ declare type HighlightExpression = {
436
+ enabled?: boolean;
437
+ encodeHTML?: boolean;
438
+ };
439
+ /**
440
+ * Booster Expression
441
+ *
442
+ * @x-go-type xata.BoosterExpression
443
+ */
444
+ declare type BoosterExpression = {
445
+ valueBooster?: ValueBooster$1;
446
+ } | {
447
+ numericBooster?: NumericBooster$1;
448
+ } | {
449
+ dateBooster?: DateBooster$1;
450
+ };
451
+ /**
452
+ * Boost records with a particular value for a column.
453
+ */
454
+ declare type ValueBooster$1 = {
455
+ column: string;
456
+ value: string | number | boolean;
457
+ factor: number;
458
+ };
459
+ /**
460
+ * Boost records based on the value of a numeric column.
461
+ */
462
+ declare type NumericBooster$1 = {
463
+ column: string;
464
+ factor: number;
465
+ };
466
+ /**
467
+ * Boost records based on the value of a datetime column. It is configured via "origin", "scale", and "decay". The further away from the "origin",
468
+ * 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
469
+ * 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.
470
+ */
471
+ declare type DateBooster$1 = {
472
+ column: string;
473
+ origin?: string;
474
+ scale: string;
475
+ decay: number;
476
+ };
250
477
  declare type FilterList = FilterExpression | FilterExpression[];
251
478
  declare type FilterColumn = FilterColumnIncludes | FilterPredicate | FilterList;
252
479
  /**
@@ -303,7 +530,24 @@ declare type PageConfig = {
303
530
  size?: number;
304
531
  offset?: number;
305
532
  };
306
- declare type ColumnsFilter = string[];
533
+ declare type ColumnsProjection = string[];
534
+ /**
535
+ * Xata Table Record Metadata
536
+ */
537
+ declare type RecordMeta = {
538
+ id: RecordID;
539
+ xata: {
540
+ version: number;
541
+ table?: string;
542
+ highlight?: {
543
+ [key: string]: string[] | {
544
+ [key: string]: any;
545
+ };
546
+ };
547
+ score?: number;
548
+ warnings?: string[];
549
+ };
550
+ };
307
551
  /**
308
552
  * @pattern [a-zA-Z0-9_-~:]+
309
553
  */
@@ -325,16 +569,9 @@ declare type RecordsMetadata = {
325
569
  };
326
570
  };
327
571
  /**
328
- * Xata Table Record
572
+ * Xata Table Record Metadata
329
573
  */
330
- declare type XataRecord$1 = {
331
- id: RecordID;
332
- xata: {
333
- version: number;
334
- table?: string;
335
- warnings?: string[];
336
- };
337
- } & {
574
+ declare type XataRecord$1 = RecordMeta & {
338
575
  [key: string]: any;
339
576
  };
340
577
 
@@ -352,14 +589,18 @@ type schemas_InviteID = InviteID;
352
589
  type schemas_WorkspaceInvite = WorkspaceInvite;
353
590
  type schemas_WorkspaceMembers = WorkspaceMembers;
354
591
  type schemas_InviteKey = InviteKey;
592
+ type schemas_DatabaseMetadata = DatabaseMetadata;
355
593
  type schemas_ListDatabasesResponse = ListDatabasesResponse;
356
594
  type schemas_ListBranchesResponse = ListBranchesResponse;
595
+ type schemas_ListGitBranchesResponse = ListGitBranchesResponse;
357
596
  type schemas_Branch = Branch;
358
597
  type schemas_BranchMetadata = BranchMetadata;
359
598
  type schemas_DBBranch = DBBranch;
360
599
  type schemas_StartedFromMetadata = StartedFromMetadata;
361
600
  type schemas_Schema = Schema;
601
+ type schemas_SchemaEditScript = SchemaEditScript;
362
602
  type schemas_Table = Table;
603
+ type schemas_TableEdit = TableEdit;
363
604
  type schemas_Column = Column;
364
605
  type schemas_RevLink = RevLink;
365
606
  type schemas_BranchName = BranchName;
@@ -372,9 +613,26 @@ type schemas_MetricsLatency = MetricsLatency;
372
613
  type schemas_BranchMigration = BranchMigration;
373
614
  type schemas_TableMigration = TableMigration;
374
615
  type schemas_ColumnMigration = ColumnMigration;
616
+ type schemas_Commit = Commit;
617
+ type schemas_Migration = Migration;
618
+ type schemas_MigrationOp = MigrationOp;
619
+ type schemas_MigrationTableOp = MigrationTableOp;
620
+ type schemas_MigrationColumnOp = MigrationColumnOp;
621
+ type schemas_TableOpAdd = TableOpAdd;
622
+ type schemas_TableOpRemove = TableOpRemove;
623
+ type schemas_TableOpRename = TableOpRename;
624
+ type schemas_ColumnOpAdd = ColumnOpAdd;
625
+ type schemas_ColumnOpRemove = ColumnOpRemove;
626
+ type schemas_ColumnOpRename = ColumnOpRename;
627
+ type schemas_MigrationRequest = MigrationRequest;
375
628
  type schemas_SortExpression = SortExpression;
376
629
  type schemas_SortOrder = SortOrder;
630
+ type schemas_FuzzinessExpression = FuzzinessExpression;
631
+ type schemas_PrefixExpression = PrefixExpression;
632
+ type schemas_TargetExpression = TargetExpression;
377
633
  type schemas_FilterExpression = FilterExpression;
634
+ type schemas_HighlightExpression = HighlightExpression;
635
+ type schemas_BoosterExpression = BoosterExpression;
378
636
  type schemas_FilterList = FilterList;
379
637
  type schemas_FilterColumn = FilterColumn;
380
638
  type schemas_FilterColumnIncludes = FilterColumnIncludes;
@@ -384,7 +642,8 @@ type schemas_FilterPredicateRangeOp = FilterPredicateRangeOp;
384
642
  type schemas_FilterRangeValue = FilterRangeValue;
385
643
  type schemas_FilterValue = FilterValue;
386
644
  type schemas_PageConfig = PageConfig;
387
- type schemas_ColumnsFilter = ColumnsFilter;
645
+ type schemas_ColumnsProjection = ColumnsProjection;
646
+ type schemas_RecordMeta = RecordMeta;
388
647
  type schemas_RecordID = RecordID;
389
648
  type schemas_TableRename = TableRename;
390
649
  type schemas_RecordsMetadata = RecordsMetadata;
@@ -404,14 +663,18 @@ declare namespace schemas {
404
663
  schemas_WorkspaceInvite as WorkspaceInvite,
405
664
  schemas_WorkspaceMembers as WorkspaceMembers,
406
665
  schemas_InviteKey as InviteKey,
666
+ schemas_DatabaseMetadata as DatabaseMetadata,
407
667
  schemas_ListDatabasesResponse as ListDatabasesResponse,
408
668
  schemas_ListBranchesResponse as ListBranchesResponse,
669
+ schemas_ListGitBranchesResponse as ListGitBranchesResponse,
409
670
  schemas_Branch as Branch,
410
671
  schemas_BranchMetadata as BranchMetadata,
411
672
  schemas_DBBranch as DBBranch,
412
673
  schemas_StartedFromMetadata as StartedFromMetadata,
413
674
  schemas_Schema as Schema,
675
+ schemas_SchemaEditScript as SchemaEditScript,
414
676
  schemas_Table as Table,
677
+ schemas_TableEdit as TableEdit,
415
678
  schemas_Column as Column,
416
679
  schemas_RevLink as RevLink,
417
680
  schemas_BranchName as BranchName,
@@ -424,9 +687,29 @@ declare namespace schemas {
424
687
  schemas_BranchMigration as BranchMigration,
425
688
  schemas_TableMigration as TableMigration,
426
689
  schemas_ColumnMigration as ColumnMigration,
690
+ schemas_Commit as Commit,
691
+ schemas_Migration as Migration,
692
+ schemas_MigrationOp as MigrationOp,
693
+ schemas_MigrationTableOp as MigrationTableOp,
694
+ schemas_MigrationColumnOp as MigrationColumnOp,
695
+ schemas_TableOpAdd as TableOpAdd,
696
+ schemas_TableOpRemove as TableOpRemove,
697
+ schemas_TableOpRename as TableOpRename,
698
+ schemas_ColumnOpAdd as ColumnOpAdd,
699
+ schemas_ColumnOpRemove as ColumnOpRemove,
700
+ schemas_ColumnOpRename as ColumnOpRename,
701
+ schemas_MigrationRequest as MigrationRequest,
427
702
  schemas_SortExpression as SortExpression,
428
703
  schemas_SortOrder as SortOrder,
704
+ schemas_FuzzinessExpression as FuzzinessExpression,
705
+ schemas_PrefixExpression as PrefixExpression,
706
+ schemas_TargetExpression as TargetExpression,
429
707
  schemas_FilterExpression as FilterExpression,
708
+ schemas_HighlightExpression as HighlightExpression,
709
+ schemas_BoosterExpression as BoosterExpression,
710
+ ValueBooster$1 as ValueBooster,
711
+ NumericBooster$1 as NumericBooster,
712
+ DateBooster$1 as DateBooster,
430
713
  schemas_FilterList as FilterList,
431
714
  schemas_FilterColumn as FilterColumn,
432
715
  schemas_FilterColumnIncludes as FilterColumnIncludes,
@@ -436,7 +719,8 @@ declare namespace schemas {
436
719
  schemas_FilterRangeValue as FilterRangeValue,
437
720
  schemas_FilterValue as FilterValue,
438
721
  schemas_PageConfig as PageConfig,
439
- schemas_ColumnsFilter as ColumnsFilter,
722
+ schemas_ColumnsProjection as ColumnsProjection,
723
+ schemas_RecordMeta as RecordMeta,
440
724
  schemas_RecordID as RecordID,
441
725
  schemas_TableRename as TableRename,
442
726
  schemas_RecordsMetadata as RecordsMetadata,
@@ -471,11 +755,22 @@ declare type BulkError = {
471
755
  status?: number;
472
756
  }[];
473
757
  };
758
+ declare type BulkInsertResponse = {
759
+ recordIDs: string[];
760
+ } | {
761
+ records: XataRecord$1[];
762
+ };
474
763
  declare type BranchMigrationPlan = {
475
764
  version: number;
476
765
  migration: BranchMigration;
477
766
  };
478
- declare type RecordUpdateResponse = {
767
+ declare type RecordResponse = XataRecord$1;
768
+ declare type SchemaCompareResponse = {
769
+ source: Schema;
770
+ target: Schema;
771
+ edits: SchemaEditScript;
772
+ };
773
+ declare type RecordUpdateResponse = XataRecord$1 | {
479
774
  id: string;
480
775
  xata: {
481
776
  version: number;
@@ -499,7 +794,10 @@ type responses_SimpleError = SimpleError;
499
794
  type responses_BadRequestError = BadRequestError;
500
795
  type responses_AuthError = AuthError;
501
796
  type responses_BulkError = BulkError;
797
+ type responses_BulkInsertResponse = BulkInsertResponse;
502
798
  type responses_BranchMigrationPlan = BranchMigrationPlan;
799
+ type responses_RecordResponse = RecordResponse;
800
+ type responses_SchemaCompareResponse = SchemaCompareResponse;
503
801
  type responses_RecordUpdateResponse = RecordUpdateResponse;
504
802
  type responses_QueryResponse = QueryResponse;
505
803
  type responses_SearchResponse = SearchResponse;
@@ -510,7 +808,10 @@ declare namespace responses {
510
808
  responses_BadRequestError as BadRequestError,
511
809
  responses_AuthError as AuthError,
512
810
  responses_BulkError as BulkError,
811
+ responses_BulkInsertResponse as BulkInsertResponse,
513
812
  responses_BranchMigrationPlan as BranchMigrationPlan,
813
+ responses_RecordResponse as RecordResponse,
814
+ responses_SchemaCompareResponse as SchemaCompareResponse,
514
815
  responses_RecordUpdateResponse as RecordUpdateResponse,
515
816
  responses_QueryResponse as QueryResponse,
516
817
  responses_SearchResponse as SearchResponse,
@@ -816,6 +1117,9 @@ declare type InviteWorkspaceMemberError = ErrorWrapper<{
816
1117
  } | {
817
1118
  status: 404;
818
1119
  payload: SimpleError;
1120
+ } | {
1121
+ status: 409;
1122
+ payload: SimpleError;
819
1123
  }>;
820
1124
  declare type InviteWorkspaceMemberRequestBody = {
821
1125
  email: string;
@@ -829,6 +1133,34 @@ declare type InviteWorkspaceMemberVariables = {
829
1133
  * Invite some user to join the workspace with the given role
830
1134
  */
831
1135
  declare const inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<WorkspaceInvite>;
1136
+ declare type UpdateWorkspaceMemberInvitePathParams = {
1137
+ workspaceId: WorkspaceID;
1138
+ inviteId: InviteID;
1139
+ };
1140
+ declare type UpdateWorkspaceMemberInviteError = ErrorWrapper<{
1141
+ status: 400;
1142
+ payload: BadRequestError;
1143
+ } | {
1144
+ status: 401;
1145
+ payload: AuthError;
1146
+ } | {
1147
+ status: 404;
1148
+ payload: SimpleError;
1149
+ } | {
1150
+ status: 422;
1151
+ payload: SimpleError;
1152
+ }>;
1153
+ declare type UpdateWorkspaceMemberInviteRequestBody = {
1154
+ role: Role;
1155
+ };
1156
+ declare type UpdateWorkspaceMemberInviteVariables = {
1157
+ body: UpdateWorkspaceMemberInviteRequestBody;
1158
+ pathParams: UpdateWorkspaceMemberInvitePathParams;
1159
+ } & FetcherExtraProps;
1160
+ /**
1161
+ * 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.
1162
+ */
1163
+ declare const updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
832
1164
  declare type CancelWorkspaceMemberInvitePathParams = {
833
1165
  workspaceId: WorkspaceID;
834
1166
  inviteId: InviteID;
@@ -946,7 +1278,6 @@ declare type CreateDatabaseResponse = {
946
1278
  branchName?: string;
947
1279
  };
948
1280
  declare type CreateDatabaseRequestBody = {
949
- displayName?: string;
950
1281
  branchName?: string;
951
1282
  ui?: {
952
1283
  color?: string;
@@ -982,11 +1313,11 @@ declare type DeleteDatabaseVariables = {
982
1313
  * Delete a database and all of its branches and tables permanently.
983
1314
  */
984
1315
  declare const deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
985
- declare type GetBranchDetailsPathParams = {
986
- dbBranchName: DBBranchName;
1316
+ declare type GetDatabaseMetadataPathParams = {
1317
+ dbName: DBName;
987
1318
  workspace: string;
988
1319
  };
989
- declare type GetBranchDetailsError = ErrorWrapper<{
1320
+ declare type GetDatabaseMetadataError = ErrorWrapper<{
990
1321
  status: 400;
991
1322
  payload: BadRequestError;
992
1323
  } | {
@@ -996,18 +1327,18 @@ declare type GetBranchDetailsError = ErrorWrapper<{
996
1327
  status: 404;
997
1328
  payload: SimpleError;
998
1329
  }>;
999
- declare type GetBranchDetailsVariables = {
1000
- pathParams: GetBranchDetailsPathParams;
1330
+ declare type GetDatabaseMetadataVariables = {
1331
+ pathParams: GetDatabaseMetadataPathParams;
1001
1332
  } & FetcherExtraProps;
1002
- declare const getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
1003
- declare type CreateBranchPathParams = {
1004
- dbBranchName: DBBranchName;
1333
+ /**
1334
+ * Retrieve metadata of the given database
1335
+ */
1336
+ declare const getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
1337
+ declare type UpdateDatabaseMetadataPathParams = {
1338
+ dbName: DBName;
1005
1339
  workspace: string;
1006
1340
  };
1007
- declare type CreateBranchQueryParams = {
1008
- from?: string;
1009
- };
1010
- declare type CreateBranchError = ErrorWrapper<{
1341
+ declare type UpdateDatabaseMetadataError = ErrorWrapper<{
1011
1342
  status: 400;
1012
1343
  payload: BadRequestError;
1013
1344
  } | {
@@ -1017,109 +1348,653 @@ declare type CreateBranchError = ErrorWrapper<{
1017
1348
  status: 404;
1018
1349
  payload: SimpleError;
1019
1350
  }>;
1020
- declare type CreateBranchRequestBody = {
1021
- from?: string;
1022
- metadata?: BranchMetadata;
1351
+ declare type UpdateDatabaseMetadataRequestBody = {
1352
+ ui?: {
1353
+ color?: string;
1354
+ };
1023
1355
  };
1024
- declare type CreateBranchVariables = {
1025
- body?: CreateBranchRequestBody;
1026
- pathParams: CreateBranchPathParams;
1027
- queryParams?: CreateBranchQueryParams;
1356
+ declare type UpdateDatabaseMetadataVariables = {
1357
+ body?: UpdateDatabaseMetadataRequestBody;
1358
+ pathParams: UpdateDatabaseMetadataPathParams;
1028
1359
  } & FetcherExtraProps;
1029
- declare const createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
1030
- declare type DeleteBranchPathParams = {
1031
- dbBranchName: DBBranchName;
1360
+ /**
1361
+ * Update the color of the selected database
1362
+ */
1363
+ declare const updateDatabaseMetadata: (variables: UpdateDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
1364
+ declare type GetGitBranchesMappingPathParams = {
1365
+ dbName: DBName;
1032
1366
  workspace: string;
1033
1367
  };
1034
- declare type DeleteBranchError = ErrorWrapper<{
1368
+ declare type GetGitBranchesMappingError = ErrorWrapper<{
1035
1369
  status: 400;
1036
1370
  payload: BadRequestError;
1037
1371
  } | {
1038
1372
  status: 401;
1039
1373
  payload: AuthError;
1040
- } | {
1041
- status: 404;
1042
- payload: SimpleError;
1043
1374
  }>;
1044
- declare type DeleteBranchVariables = {
1045
- pathParams: DeleteBranchPathParams;
1375
+ declare type GetGitBranchesMappingVariables = {
1376
+ pathParams: GetGitBranchesMappingPathParams;
1046
1377
  } & FetcherExtraProps;
1047
1378
  /**
1048
- * Delete the branch in the database and all its resources
1379
+ * Lists all the git branches in the mapping, and their associated Xata branches.
1380
+ *
1381
+ * Example response:
1382
+ *
1383
+ * ```json
1384
+ * {
1385
+ * "mappings": [
1386
+ * {
1387
+ * "gitBranch": "main",
1388
+ * "xataBranch": "main"
1389
+ * },
1390
+ * {
1391
+ * "gitBranch": "gitBranch1",
1392
+ * "xataBranch": "xataBranch1"
1393
+ * }
1394
+ * {
1395
+ * "gitBranch": "xataBranch2",
1396
+ * "xataBranch": "xataBranch2"
1397
+ * }
1398
+ * ]
1399
+ * }
1400
+ * ```
1049
1401
  */
1050
- declare const deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
1051
- declare type UpdateBranchMetadataPathParams = {
1052
- dbBranchName: DBBranchName;
1402
+ declare const getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
1403
+ declare type AddGitBranchesEntryPathParams = {
1404
+ dbName: DBName;
1053
1405
  workspace: string;
1054
1406
  };
1055
- declare type UpdateBranchMetadataError = ErrorWrapper<{
1407
+ declare type AddGitBranchesEntryError = ErrorWrapper<{
1056
1408
  status: 400;
1057
1409
  payload: BadRequestError;
1058
1410
  } | {
1059
1411
  status: 401;
1060
1412
  payload: AuthError;
1061
- } | {
1062
- status: 404;
1063
- payload: SimpleError;
1064
1413
  }>;
1065
- declare type UpdateBranchMetadataVariables = {
1066
- body?: BranchMetadata;
1067
- pathParams: UpdateBranchMetadataPathParams;
1414
+ declare type AddGitBranchesEntryResponse = {
1415
+ warning?: string;
1416
+ };
1417
+ declare type AddGitBranchesEntryRequestBody = {
1418
+ gitBranch: string;
1419
+ xataBranch: BranchName;
1420
+ };
1421
+ declare type AddGitBranchesEntryVariables = {
1422
+ body: AddGitBranchesEntryRequestBody;
1423
+ pathParams: AddGitBranchesEntryPathParams;
1068
1424
  } & FetcherExtraProps;
1069
1425
  /**
1070
- * Update the branch metadata
1426
+ * Adds an entry to the mapping of git branches to Xata branches. The git branch and the Xata branch must be present in the body of the request. If the Xata branch doesn't exist, a 400 error is returned.
1427
+ *
1428
+ * If the git branch is already present in the mapping, the old entry is overwritten, and a warning message is included in the response. If the git branch is added and didn't exist before, the response code is 204. If the git branch existed and it was overwritten, the response code is 201.
1429
+ *
1430
+ * Example request:
1431
+ *
1432
+ * ```json
1433
+ * // POST https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches
1434
+ * {
1435
+ * "gitBranch": "fix/bug123",
1436
+ * "xataBranch": "fix_bug"
1437
+ * }
1438
+ * ```
1071
1439
  */
1072
- declare const updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
1073
- declare type GetBranchMetadataPathParams = {
1074
- dbBranchName: DBBranchName;
1440
+ declare const addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
1441
+ declare type RemoveGitBranchesEntryPathParams = {
1442
+ dbName: DBName;
1075
1443
  workspace: string;
1076
1444
  };
1077
- declare type GetBranchMetadataError = ErrorWrapper<{
1445
+ declare type RemoveGitBranchesEntryQueryParams = {
1446
+ gitBranch: string;
1447
+ };
1448
+ declare type RemoveGitBranchesEntryError = ErrorWrapper<{
1078
1449
  status: 400;
1079
1450
  payload: BadRequestError;
1080
1451
  } | {
1081
1452
  status: 401;
1082
1453
  payload: AuthError;
1083
- } | {
1084
- status: 404;
1085
- payload: SimpleError;
1086
1454
  }>;
1087
- declare type GetBranchMetadataVariables = {
1088
- pathParams: GetBranchMetadataPathParams;
1455
+ declare type RemoveGitBranchesEntryVariables = {
1456
+ pathParams: RemoveGitBranchesEntryPathParams;
1457
+ queryParams: RemoveGitBranchesEntryQueryParams;
1089
1458
  } & FetcherExtraProps;
1090
- declare const getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
1091
- declare type GetBranchMigrationHistoryPathParams = {
1092
- dbBranchName: DBBranchName;
1459
+ /**
1460
+ * Removes an entry from the mapping of git branches to Xata branches. The name of the git branch must be passed as a query parameter. If the git branch is not found, the endpoint returns a 404 status code.
1461
+ *
1462
+ * Example request:
1463
+ *
1464
+ * ```json
1465
+ * // DELETE https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches?gitBranch=fix%2Fbug123
1466
+ * ```
1467
+ */
1468
+ declare const removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
1469
+ declare type ResolveBranchPathParams = {
1470
+ dbName: DBName;
1093
1471
  workspace: string;
1094
1472
  };
1095
- declare type GetBranchMigrationHistoryError = ErrorWrapper<{
1473
+ declare type ResolveBranchQueryParams = {
1474
+ gitBranch?: string;
1475
+ fallbackBranch?: string;
1476
+ };
1477
+ declare type ResolveBranchError = ErrorWrapper<{
1096
1478
  status: 400;
1097
1479
  payload: BadRequestError;
1098
1480
  } | {
1099
1481
  status: 401;
1100
1482
  payload: AuthError;
1101
- } | {
1102
- status: 404;
1103
- payload: SimpleError;
1104
1483
  }>;
1105
- declare type GetBranchMigrationHistoryResponse = {
1106
- startedFrom?: StartedFromMetadata;
1107
- migrations?: BranchMigration[];
1108
- };
1109
- declare type GetBranchMigrationHistoryRequestBody = {
1110
- limit?: number;
1111
- startFrom?: string;
1484
+ declare type ResolveBranchResponse = {
1485
+ branch: string;
1486
+ reason: {
1487
+ code: 'FOUND_IN_MAPPING' | 'BRANCH_EXISTS' | 'FALLBACK_BRANCH' | 'DEFAULT_BRANCH';
1488
+ message: string;
1489
+ };
1112
1490
  };
1113
- declare type GetBranchMigrationHistoryVariables = {
1114
- body?: GetBranchMigrationHistoryRequestBody;
1115
- pathParams: GetBranchMigrationHistoryPathParams;
1491
+ declare type ResolveBranchVariables = {
1492
+ pathParams: ResolveBranchPathParams;
1493
+ queryParams?: ResolveBranchQueryParams;
1494
+ } & FetcherExtraProps;
1495
+ /**
1496
+ * In order to resolve the database branch, the following algorithm is used:
1497
+ * * 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
1498
+ * * else, if a Xata branch with the exact same name as `gitBranch` exists, return it
1499
+ * * else, if `fallbackBranch` is provided and a branch with that name exists, return it
1500
+ * * else, return the default branch of the DB (`main` or the first branch)
1501
+ *
1502
+ * Example call:
1503
+ *
1504
+ * ```json
1505
+ * // GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test&fallbackBranch=tsg
1506
+ * ```
1507
+ *
1508
+ * Example response:
1509
+ *
1510
+ * ```json
1511
+ * {
1512
+ * "branch": "main",
1513
+ * "reason": {
1514
+ * "code": "DEFAULT_BRANCH",
1515
+ * "message": "Default branch for this database (main)"
1516
+ * }
1517
+ * }
1518
+ * ```
1519
+ */
1520
+ declare const resolveBranch: (variables: ResolveBranchVariables) => Promise<ResolveBranchResponse>;
1521
+ declare type ListMigrationRequestsPathParams = {
1522
+ dbName: DBName;
1523
+ workspace: string;
1524
+ };
1525
+ declare type ListMigrationRequestsError = ErrorWrapper<{
1526
+ status: 400;
1527
+ payload: BadRequestError;
1528
+ } | {
1529
+ status: 401;
1530
+ payload: AuthError;
1531
+ } | {
1532
+ status: 404;
1533
+ payload: SimpleError;
1534
+ }>;
1535
+ declare type ListMigrationRequestsResponse = {
1536
+ migrationRequests: MigrationRequest[];
1537
+ meta: RecordsMetadata;
1538
+ };
1539
+ declare type ListMigrationRequestsRequestBody = {
1540
+ filter?: FilterExpression;
1541
+ sort?: SortExpression;
1542
+ page?: PageConfig;
1543
+ columns?: ColumnsProjection;
1544
+ };
1545
+ declare type ListMigrationRequestsVariables = {
1546
+ body?: ListMigrationRequestsRequestBody;
1547
+ pathParams: ListMigrationRequestsPathParams;
1548
+ } & FetcherExtraProps;
1549
+ declare const listMigrationRequests: (variables: ListMigrationRequestsVariables) => Promise<ListMigrationRequestsResponse>;
1550
+ declare type CreateMigrationRequestPathParams = {
1551
+ dbName: DBName;
1552
+ workspace: string;
1553
+ };
1554
+ declare type CreateMigrationRequestError = ErrorWrapper<{
1555
+ status: 400;
1556
+ payload: BadRequestError;
1557
+ } | {
1558
+ status: 401;
1559
+ payload: AuthError;
1560
+ } | {
1561
+ status: 404;
1562
+ payload: SimpleError;
1563
+ }>;
1564
+ declare type CreateMigrationRequestResponse = {
1565
+ number: number;
1566
+ };
1567
+ declare type CreateMigrationRequestRequestBody = {
1568
+ source: string;
1569
+ target: string;
1570
+ title: string;
1571
+ body?: string;
1572
+ };
1573
+ declare type CreateMigrationRequestVariables = {
1574
+ body: CreateMigrationRequestRequestBody;
1575
+ pathParams: CreateMigrationRequestPathParams;
1576
+ } & FetcherExtraProps;
1577
+ declare const createMigrationRequest: (variables: CreateMigrationRequestVariables) => Promise<CreateMigrationRequestResponse>;
1578
+ declare type GetMigrationRequestPathParams = {
1579
+ dbName: DBName;
1580
+ mrNumber: number;
1581
+ workspace: string;
1582
+ };
1583
+ declare type GetMigrationRequestError = ErrorWrapper<{
1584
+ status: 400;
1585
+ payload: BadRequestError;
1586
+ } | {
1587
+ status: 401;
1588
+ payload: AuthError;
1589
+ } | {
1590
+ status: 404;
1591
+ payload: SimpleError;
1592
+ }>;
1593
+ declare type GetMigrationRequestVariables = {
1594
+ pathParams: GetMigrationRequestPathParams;
1595
+ } & FetcherExtraProps;
1596
+ declare const getMigrationRequest: (variables: GetMigrationRequestVariables) => Promise<MigrationRequest>;
1597
+ declare type UpdateMigrationRequestPathParams = {
1598
+ dbName: DBName;
1599
+ mrNumber: number;
1600
+ workspace: string;
1601
+ };
1602
+ declare type UpdateMigrationRequestError = ErrorWrapper<{
1603
+ status: 400;
1604
+ payload: BadRequestError;
1605
+ } | {
1606
+ status: 401;
1607
+ payload: AuthError;
1608
+ } | {
1609
+ status: 404;
1610
+ payload: SimpleError;
1611
+ }>;
1612
+ declare type UpdateMigrationRequestRequestBody = {
1613
+ title?: string;
1614
+ body?: string;
1615
+ status?: 'open' | 'closed';
1616
+ };
1617
+ declare type UpdateMigrationRequestVariables = {
1618
+ body?: UpdateMigrationRequestRequestBody;
1619
+ pathParams: UpdateMigrationRequestPathParams;
1620
+ } & FetcherExtraProps;
1621
+ declare const updateMigrationRequest: (variables: UpdateMigrationRequestVariables) => Promise<undefined>;
1622
+ declare type ListMigrationRequestsCommitsPathParams = {
1623
+ dbName: DBName;
1624
+ mrNumber: number;
1625
+ workspace: string;
1626
+ };
1627
+ declare type ListMigrationRequestsCommitsError = ErrorWrapper<{
1628
+ status: 400;
1629
+ payload: BadRequestError;
1630
+ } | {
1631
+ status: 401;
1632
+ payload: AuthError;
1633
+ } | {
1634
+ status: 404;
1635
+ payload: SimpleError;
1636
+ }>;
1637
+ declare type ListMigrationRequestsCommitsResponse = {
1638
+ meta: {
1639
+ cursor: string;
1640
+ more: boolean;
1641
+ };
1642
+ logs: Commit[];
1643
+ };
1644
+ declare type ListMigrationRequestsCommitsRequestBody = {
1645
+ page?: {
1646
+ after?: string;
1647
+ before?: string;
1648
+ size?: number;
1649
+ };
1650
+ };
1651
+ declare type ListMigrationRequestsCommitsVariables = {
1652
+ body?: ListMigrationRequestsCommitsRequestBody;
1653
+ pathParams: ListMigrationRequestsCommitsPathParams;
1654
+ } & FetcherExtraProps;
1655
+ declare const listMigrationRequestsCommits: (variables: ListMigrationRequestsCommitsVariables) => Promise<ListMigrationRequestsCommitsResponse>;
1656
+ declare type CompareMigrationRequestPathParams = {
1657
+ dbName: DBName;
1658
+ mrNumber: number;
1659
+ workspace: string;
1660
+ };
1661
+ declare type CompareMigrationRequestError = ErrorWrapper<{
1662
+ status: 400;
1663
+ payload: BadRequestError;
1664
+ } | {
1665
+ status: 401;
1666
+ payload: AuthError;
1667
+ } | {
1668
+ status: 404;
1669
+ payload: SimpleError;
1670
+ }>;
1671
+ declare type CompareMigrationRequestVariables = {
1672
+ pathParams: CompareMigrationRequestPathParams;
1673
+ } & FetcherExtraProps;
1674
+ declare const compareMigrationRequest: (variables: CompareMigrationRequestVariables) => Promise<SchemaCompareResponse>;
1675
+ declare type GetMigrationRequestIsMergedPathParams = {
1676
+ dbName: DBName;
1677
+ mrNumber: number;
1678
+ workspace: string;
1679
+ };
1680
+ declare type GetMigrationRequestIsMergedError = ErrorWrapper<{
1681
+ status: 400;
1682
+ payload: BadRequestError;
1683
+ } | {
1684
+ status: 401;
1685
+ payload: AuthError;
1686
+ } | {
1687
+ status: 404;
1688
+ payload: SimpleError;
1689
+ }>;
1690
+ declare type GetMigrationRequestIsMergedResponse = {
1691
+ merged?: boolean;
1692
+ };
1693
+ declare type GetMigrationRequestIsMergedVariables = {
1694
+ pathParams: GetMigrationRequestIsMergedPathParams;
1695
+ } & FetcherExtraProps;
1696
+ declare const getMigrationRequestIsMerged: (variables: GetMigrationRequestIsMergedVariables) => Promise<GetMigrationRequestIsMergedResponse>;
1697
+ declare type MergeMigrationRequestPathParams = {
1698
+ dbName: DBName;
1699
+ mrNumber: number;
1700
+ workspace: string;
1701
+ };
1702
+ declare type MergeMigrationRequestError = ErrorWrapper<{
1703
+ status: 400;
1704
+ payload: BadRequestError;
1705
+ } | {
1706
+ status: 401;
1707
+ payload: AuthError;
1708
+ } | {
1709
+ status: 404;
1710
+ payload: SimpleError;
1711
+ }>;
1712
+ declare type MergeMigrationRequestVariables = {
1713
+ pathParams: MergeMigrationRequestPathParams;
1714
+ } & FetcherExtraProps;
1715
+ declare const mergeMigrationRequest: (variables: MergeMigrationRequestVariables) => Promise<Commit>;
1716
+ declare type GetBranchDetailsPathParams = {
1717
+ dbBranchName: DBBranchName;
1718
+ workspace: string;
1719
+ };
1720
+ declare type GetBranchDetailsError = ErrorWrapper<{
1721
+ status: 400;
1722
+ payload: BadRequestError;
1723
+ } | {
1724
+ status: 401;
1725
+ payload: AuthError;
1726
+ } | {
1727
+ status: 404;
1728
+ payload: SimpleError;
1729
+ }>;
1730
+ declare type GetBranchDetailsVariables = {
1731
+ pathParams: GetBranchDetailsPathParams;
1732
+ } & FetcherExtraProps;
1733
+ declare const getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
1734
+ declare type CreateBranchPathParams = {
1735
+ dbBranchName: DBBranchName;
1736
+ workspace: string;
1737
+ };
1738
+ declare type CreateBranchQueryParams = {
1739
+ from?: string;
1740
+ };
1741
+ declare type CreateBranchError = ErrorWrapper<{
1742
+ status: 400;
1743
+ payload: BadRequestError;
1744
+ } | {
1745
+ status: 401;
1746
+ payload: AuthError;
1747
+ } | {
1748
+ status: 404;
1749
+ payload: SimpleError;
1750
+ }>;
1751
+ declare type CreateBranchResponse = {
1752
+ databaseName: string;
1753
+ branchName: string;
1754
+ };
1755
+ declare type CreateBranchRequestBody = {
1756
+ from?: string;
1757
+ metadata?: BranchMetadata;
1758
+ };
1759
+ declare type CreateBranchVariables = {
1760
+ body?: CreateBranchRequestBody;
1761
+ pathParams: CreateBranchPathParams;
1762
+ queryParams?: CreateBranchQueryParams;
1763
+ } & FetcherExtraProps;
1764
+ declare const createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
1765
+ declare type DeleteBranchPathParams = {
1766
+ dbBranchName: DBBranchName;
1767
+ workspace: string;
1768
+ };
1769
+ declare type DeleteBranchError = ErrorWrapper<{
1770
+ status: 400;
1771
+ payload: BadRequestError;
1772
+ } | {
1773
+ status: 401;
1774
+ payload: AuthError;
1775
+ } | {
1776
+ status: 404;
1777
+ payload: SimpleError;
1778
+ }>;
1779
+ declare type DeleteBranchVariables = {
1780
+ pathParams: DeleteBranchPathParams;
1781
+ } & FetcherExtraProps;
1782
+ /**
1783
+ * Delete the branch in the database and all its resources
1784
+ */
1785
+ declare const deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
1786
+ declare type UpdateBranchMetadataPathParams = {
1787
+ dbBranchName: DBBranchName;
1788
+ workspace: string;
1789
+ };
1790
+ declare type UpdateBranchMetadataError = ErrorWrapper<{
1791
+ status: 400;
1792
+ payload: BadRequestError;
1793
+ } | {
1794
+ status: 401;
1795
+ payload: AuthError;
1796
+ } | {
1797
+ status: 404;
1798
+ payload: SimpleError;
1799
+ }>;
1800
+ declare type UpdateBranchMetadataVariables = {
1801
+ body?: BranchMetadata;
1802
+ pathParams: UpdateBranchMetadataPathParams;
1803
+ } & FetcherExtraProps;
1804
+ /**
1805
+ * Update the branch metadata
1806
+ */
1807
+ declare const updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
1808
+ declare type GetBranchMetadataPathParams = {
1809
+ dbBranchName: DBBranchName;
1810
+ workspace: string;
1811
+ };
1812
+ declare type GetBranchMetadataError = ErrorWrapper<{
1813
+ status: 400;
1814
+ payload: BadRequestError;
1815
+ } | {
1816
+ status: 401;
1817
+ payload: AuthError;
1818
+ } | {
1819
+ status: 404;
1820
+ payload: SimpleError;
1821
+ }>;
1822
+ declare type GetBranchMetadataVariables = {
1823
+ pathParams: GetBranchMetadataPathParams;
1824
+ } & FetcherExtraProps;
1825
+ declare const getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
1826
+ declare type GetBranchMigrationHistoryPathParams = {
1827
+ dbBranchName: DBBranchName;
1828
+ workspace: string;
1829
+ };
1830
+ declare type GetBranchMigrationHistoryError = ErrorWrapper<{
1831
+ status: 400;
1832
+ payload: BadRequestError;
1833
+ } | {
1834
+ status: 401;
1835
+ payload: AuthError;
1836
+ } | {
1837
+ status: 404;
1838
+ payload: SimpleError;
1839
+ }>;
1840
+ declare type GetBranchMigrationHistoryResponse = {
1841
+ startedFrom?: StartedFromMetadata;
1842
+ migrations?: BranchMigration[];
1843
+ };
1844
+ declare type GetBranchMigrationHistoryRequestBody = {
1845
+ limit?: number;
1846
+ startFrom?: string;
1847
+ };
1848
+ declare type GetBranchMigrationHistoryVariables = {
1849
+ body?: GetBranchMigrationHistoryRequestBody;
1850
+ pathParams: GetBranchMigrationHistoryPathParams;
1116
1851
  } & FetcherExtraProps;
1117
1852
  declare const getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
1118
1853
  declare type ExecuteBranchMigrationPlanPathParams = {
1119
1854
  dbBranchName: DBBranchName;
1120
1855
  workspace: string;
1121
1856
  };
1122
- declare type ExecuteBranchMigrationPlanError = ErrorWrapper<{
1857
+ declare type ExecuteBranchMigrationPlanError = ErrorWrapper<{
1858
+ status: 400;
1859
+ payload: BadRequestError;
1860
+ } | {
1861
+ status: 401;
1862
+ payload: AuthError;
1863
+ } | {
1864
+ status: 404;
1865
+ payload: SimpleError;
1866
+ }>;
1867
+ declare type ExecuteBranchMigrationPlanRequestBody = {
1868
+ version: number;
1869
+ migration: BranchMigration;
1870
+ };
1871
+ declare type ExecuteBranchMigrationPlanVariables = {
1872
+ body: ExecuteBranchMigrationPlanRequestBody;
1873
+ pathParams: ExecuteBranchMigrationPlanPathParams;
1874
+ } & FetcherExtraProps;
1875
+ /**
1876
+ * Apply a migration plan to the branch
1877
+ */
1878
+ declare const executeBranchMigrationPlan: (variables: ExecuteBranchMigrationPlanVariables) => Promise<undefined>;
1879
+ declare type GetBranchMigrationPlanPathParams = {
1880
+ dbBranchName: DBBranchName;
1881
+ workspace: string;
1882
+ };
1883
+ declare type GetBranchMigrationPlanError = ErrorWrapper<{
1884
+ status: 400;
1885
+ payload: BadRequestError;
1886
+ } | {
1887
+ status: 401;
1888
+ payload: AuthError;
1889
+ } | {
1890
+ status: 404;
1891
+ payload: SimpleError;
1892
+ }>;
1893
+ declare type GetBranchMigrationPlanVariables = {
1894
+ body: Schema;
1895
+ pathParams: GetBranchMigrationPlanPathParams;
1896
+ } & FetcherExtraProps;
1897
+ /**
1898
+ * Compute a migration plan from a target schema the branch should be migrated too.
1899
+ */
1900
+ declare const getBranchMigrationPlan: (variables: GetBranchMigrationPlanVariables) => Promise<BranchMigrationPlan>;
1901
+ declare type CompareBranchWithUserSchemaPathParams = {
1902
+ dbBranchName: DBBranchName;
1903
+ workspace: string;
1904
+ };
1905
+ declare type CompareBranchWithUserSchemaError = ErrorWrapper<{
1906
+ status: 400;
1907
+ payload: BadRequestError;
1908
+ } | {
1909
+ status: 401;
1910
+ payload: AuthError;
1911
+ } | {
1912
+ status: 404;
1913
+ payload: SimpleError;
1914
+ }>;
1915
+ declare type CompareBranchWithUserSchemaRequestBody = {
1916
+ schema: Schema;
1917
+ };
1918
+ declare type CompareBranchWithUserSchemaVariables = {
1919
+ body: CompareBranchWithUserSchemaRequestBody;
1920
+ pathParams: CompareBranchWithUserSchemaPathParams;
1921
+ } & FetcherExtraProps;
1922
+ declare const compareBranchWithUserSchema: (variables: CompareBranchWithUserSchemaVariables) => Promise<SchemaCompareResponse>;
1923
+ declare type CompareBranchSchemasPathParams = {
1924
+ dbBranchName: DBBranchName;
1925
+ branchName: BranchName;
1926
+ workspace: string;
1927
+ };
1928
+ declare type CompareBranchSchemasError = ErrorWrapper<{
1929
+ status: 400;
1930
+ payload: BadRequestError;
1931
+ } | {
1932
+ status: 401;
1933
+ payload: AuthError;
1934
+ } | {
1935
+ status: 404;
1936
+ payload: SimpleError;
1937
+ }>;
1938
+ declare type CompareBranchSchemasVariables = {
1939
+ body?: Record<string, any>;
1940
+ pathParams: CompareBranchSchemasPathParams;
1941
+ } & FetcherExtraProps;
1942
+ declare const compareBranchSchemas: (variables: CompareBranchSchemasVariables) => Promise<SchemaCompareResponse>;
1943
+ declare type UpdateBranchSchemaPathParams = {
1944
+ dbBranchName: DBBranchName;
1945
+ workspace: string;
1946
+ };
1947
+ declare type UpdateBranchSchemaError = 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 UpdateBranchSchemaResponse = {
1958
+ id: string;
1959
+ parentID: string;
1960
+ };
1961
+ declare type UpdateBranchSchemaVariables = {
1962
+ body: Migration;
1963
+ pathParams: UpdateBranchSchemaPathParams;
1964
+ } & FetcherExtraProps;
1965
+ declare const updateBranchSchema: (variables: UpdateBranchSchemaVariables) => Promise<UpdateBranchSchemaResponse>;
1966
+ declare type PreviewBranchSchemaEditPathParams = {
1967
+ dbBranchName: DBBranchName;
1968
+ workspace: string;
1969
+ };
1970
+ declare type PreviewBranchSchemaEditError = ErrorWrapper<{
1971
+ status: 400;
1972
+ payload: BadRequestError;
1973
+ } | {
1974
+ status: 401;
1975
+ payload: AuthError;
1976
+ } | {
1977
+ status: 404;
1978
+ payload: SimpleError;
1979
+ }>;
1980
+ declare type PreviewBranchSchemaEditResponse = {
1981
+ original: Schema;
1982
+ updated: Schema;
1983
+ };
1984
+ declare type PreviewBranchSchemaEditRequestBody = {
1985
+ edits?: SchemaEditScript;
1986
+ operations?: MigrationOp[];
1987
+ };
1988
+ declare type PreviewBranchSchemaEditVariables = {
1989
+ body?: PreviewBranchSchemaEditRequestBody;
1990
+ pathParams: PreviewBranchSchemaEditPathParams;
1991
+ } & FetcherExtraProps;
1992
+ declare const previewBranchSchemaEdit: (variables: PreviewBranchSchemaEditVariables) => Promise<PreviewBranchSchemaEditResponse>;
1993
+ declare type ApplyBranchSchemaEditPathParams = {
1994
+ dbBranchName: DBBranchName;
1995
+ workspace: string;
1996
+ };
1997
+ declare type ApplyBranchSchemaEditError = ErrorWrapper<{
1123
1998
  status: 400;
1124
1999
  payload: BadRequestError;
1125
2000
  } | {
@@ -1129,23 +2004,23 @@ declare type ExecuteBranchMigrationPlanError = ErrorWrapper<{
1129
2004
  status: 404;
1130
2005
  payload: SimpleError;
1131
2006
  }>;
1132
- declare type ExecuteBranchMigrationPlanRequestBody = {
1133
- version: number;
1134
- migration: BranchMigration;
2007
+ declare type ApplyBranchSchemaEditResponse = {
2008
+ id: string;
2009
+ parentID: string;
1135
2010
  };
1136
- declare type ExecuteBranchMigrationPlanVariables = {
1137
- body: ExecuteBranchMigrationPlanRequestBody;
1138
- pathParams: ExecuteBranchMigrationPlanPathParams;
2011
+ declare type ApplyBranchSchemaEditRequestBody = {
2012
+ edits: SchemaEditScript;
2013
+ };
2014
+ declare type ApplyBranchSchemaEditVariables = {
2015
+ body: ApplyBranchSchemaEditRequestBody;
2016
+ pathParams: ApplyBranchSchemaEditPathParams;
1139
2017
  } & FetcherExtraProps;
1140
- /**
1141
- * Apply a migration plan to the branch
1142
- */
1143
- declare const executeBranchMigrationPlan: (variables: ExecuteBranchMigrationPlanVariables) => Promise<undefined>;
1144
- declare type GetBranchMigrationPlanPathParams = {
2018
+ declare const applyBranchSchemaEdit: (variables: ApplyBranchSchemaEditVariables) => Promise<ApplyBranchSchemaEditResponse>;
2019
+ declare type GetBranchSchemaHistoryPathParams = {
1145
2020
  dbBranchName: DBBranchName;
1146
2021
  workspace: string;
1147
2022
  };
1148
- declare type GetBranchMigrationPlanError = ErrorWrapper<{
2023
+ declare type GetBranchSchemaHistoryError = ErrorWrapper<{
1149
2024
  status: 400;
1150
2025
  payload: BadRequestError;
1151
2026
  } | {
@@ -1155,14 +2030,25 @@ declare type GetBranchMigrationPlanError = ErrorWrapper<{
1155
2030
  status: 404;
1156
2031
  payload: SimpleError;
1157
2032
  }>;
1158
- declare type GetBranchMigrationPlanVariables = {
1159
- body: Schema;
1160
- pathParams: GetBranchMigrationPlanPathParams;
2033
+ declare type GetBranchSchemaHistoryResponse = {
2034
+ meta: {
2035
+ cursor: string;
2036
+ more: boolean;
2037
+ };
2038
+ logs: Commit[];
2039
+ };
2040
+ declare type GetBranchSchemaHistoryRequestBody = {
2041
+ page?: {
2042
+ after?: string;
2043
+ before?: string;
2044
+ size?: number;
2045
+ };
2046
+ };
2047
+ declare type GetBranchSchemaHistoryVariables = {
2048
+ body?: GetBranchSchemaHistoryRequestBody;
2049
+ pathParams: GetBranchSchemaHistoryPathParams;
1161
2050
  } & FetcherExtraProps;
1162
- /**
1163
- * Compute a migration plan from a target schema the branch should be migrated too.
1164
- */
1165
- declare const getBranchMigrationPlan: (variables: GetBranchMigrationPlanVariables) => Promise<BranchMigrationPlan>;
2051
+ declare const getBranchSchemaHistory: (variables: GetBranchSchemaHistoryVariables) => Promise<GetBranchSchemaHistoryResponse>;
1166
2052
  declare type GetBranchStatsPathParams = {
1167
2053
  dbBranchName: DBBranchName;
1168
2054
  workspace: string;
@@ -1213,13 +2099,17 @@ declare type CreateTableError = ErrorWrapper<{
1213
2099
  status: 422;
1214
2100
  payload: SimpleError;
1215
2101
  }>;
2102
+ declare type CreateTableResponse = {
2103
+ branchName: string;
2104
+ tableName: string;
2105
+ };
1216
2106
  declare type CreateTableVariables = {
1217
2107
  pathParams: CreateTablePathParams;
1218
2108
  } & FetcherExtraProps;
1219
2109
  /**
1220
2110
  * Creates a new table with the given name. Returns 422 if a table with the same name already exists.
1221
2111
  */
1222
- declare const createTable: (variables: CreateTableVariables) => Promise<undefined>;
2112
+ declare const createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
1223
2113
  declare type DeleteTablePathParams = {
1224
2114
  dbBranchName: DBBranchName;
1225
2115
  tableName: TableName;
@@ -1266,8 +2156,9 @@ declare type UpdateTableVariables = {
1266
2156
  *
1267
2157
  * In the example below, we rename a table from “users” to “people”:
1268
2158
  *
1269
- * ```jsx
1270
- * PATCH /db/test:main/tables/users
2159
+ * ```json
2160
+ * // PATCH /db/test:main/tables/users
2161
+ *
1271
2162
  * {
1272
2163
  * "name": "people"
1273
2164
  * }
@@ -1451,6 +2342,9 @@ declare type InsertRecordPathParams = {
1451
2342
  tableName: TableName;
1452
2343
  workspace: string;
1453
2344
  };
2345
+ declare type InsertRecordQueryParams = {
2346
+ columns?: ColumnsProjection;
2347
+ };
1454
2348
  declare type InsertRecordError = ErrorWrapper<{
1455
2349
  status: 400;
1456
2350
  payload: BadRequestError;
@@ -1461,20 +2355,15 @@ declare type InsertRecordError = ErrorWrapper<{
1461
2355
  status: 404;
1462
2356
  payload: SimpleError;
1463
2357
  }>;
1464
- declare type InsertRecordResponse = {
1465
- id: string;
1466
- xata: {
1467
- version: number;
1468
- };
1469
- };
1470
2358
  declare type InsertRecordVariables = {
1471
2359
  body?: Record<string, any>;
1472
2360
  pathParams: InsertRecordPathParams;
2361
+ queryParams?: InsertRecordQueryParams;
1473
2362
  } & FetcherExtraProps;
1474
2363
  /**
1475
2364
  * Insert a new Record into the Table
1476
2365
  */
1477
- declare const insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
2366
+ declare const insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
1478
2367
  declare type InsertRecordWithIDPathParams = {
1479
2368
  dbBranchName: DBBranchName;
1480
2369
  tableName: TableName;
@@ -1482,6 +2371,7 @@ declare type InsertRecordWithIDPathParams = {
1482
2371
  workspace: string;
1483
2372
  };
1484
2373
  declare type InsertRecordWithIDQueryParams = {
2374
+ columns?: ColumnsProjection;
1485
2375
  createOnly?: boolean;
1486
2376
  ifVersion?: number;
1487
2377
  };
@@ -1514,6 +2404,7 @@ declare type UpdateRecordWithIDPathParams = {
1514
2404
  workspace: string;
1515
2405
  };
1516
2406
  declare type UpdateRecordWithIDQueryParams = {
2407
+ columns?: ColumnsProjection;
1517
2408
  ifVersion?: number;
1518
2409
  };
1519
2410
  declare type UpdateRecordWithIDError = ErrorWrapper<{
@@ -1542,6 +2433,7 @@ declare type UpsertRecordWithIDPathParams = {
1542
2433
  workspace: string;
1543
2434
  };
1544
2435
  declare type UpsertRecordWithIDQueryParams = {
2436
+ columns?: ColumnsProjection;
1545
2437
  ifVersion?: number;
1546
2438
  };
1547
2439
  declare type UpsertRecordWithIDError = ErrorWrapper<{
@@ -1569,6 +2461,9 @@ declare type DeleteRecordPathParams = {
1569
2461
  recordId: RecordID;
1570
2462
  workspace: string;
1571
2463
  };
2464
+ declare type DeleteRecordQueryParams = {
2465
+ columns?: ColumnsProjection;
2466
+ };
1572
2467
  declare type DeleteRecordError = ErrorWrapper<{
1573
2468
  status: 400;
1574
2469
  payload: BadRequestError;
@@ -1581,14 +2476,18 @@ declare type DeleteRecordError = ErrorWrapper<{
1581
2476
  }>;
1582
2477
  declare type DeleteRecordVariables = {
1583
2478
  pathParams: DeleteRecordPathParams;
2479
+ queryParams?: DeleteRecordQueryParams;
1584
2480
  } & FetcherExtraProps;
1585
- declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
2481
+ declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
1586
2482
  declare type GetRecordPathParams = {
1587
2483
  dbBranchName: DBBranchName;
1588
2484
  tableName: TableName;
1589
2485
  recordId: RecordID;
1590
2486
  workspace: string;
1591
2487
  };
2488
+ declare type GetRecordQueryParams = {
2489
+ columns?: ColumnsProjection;
2490
+ };
1592
2491
  declare type GetRecordError = ErrorWrapper<{
1593
2492
  status: 400;
1594
2493
  payload: BadRequestError;
@@ -1599,12 +2498,9 @@ declare type GetRecordError = ErrorWrapper<{
1599
2498
  status: 404;
1600
2499
  payload: SimpleError;
1601
2500
  }>;
1602
- declare type GetRecordRequestBody = {
1603
- columns?: ColumnsFilter;
1604
- };
1605
2501
  declare type GetRecordVariables = {
1606
- body?: GetRecordRequestBody;
1607
2502
  pathParams: GetRecordPathParams;
2503
+ queryParams?: GetRecordQueryParams;
1608
2504
  } & FetcherExtraProps;
1609
2505
  /**
1610
2506
  * Retrieve record by ID
@@ -1615,6 +2511,9 @@ declare type BulkInsertTableRecordsPathParams = {
1615
2511
  tableName: TableName;
1616
2512
  workspace: string;
1617
2513
  };
2514
+ declare type BulkInsertTableRecordsQueryParams = {
2515
+ columns?: ColumnsProjection;
2516
+ };
1618
2517
  declare type BulkInsertTableRecordsError = ErrorWrapper<{
1619
2518
  status: 400;
1620
2519
  payload: BulkError;
@@ -1624,21 +2523,22 @@ declare type BulkInsertTableRecordsError = ErrorWrapper<{
1624
2523
  } | {
1625
2524
  status: 404;
1626
2525
  payload: SimpleError;
2526
+ } | {
2527
+ status: 422;
2528
+ payload: SimpleError;
1627
2529
  }>;
1628
- declare type BulkInsertTableRecordsResponse = {
1629
- recordIDs: string[];
1630
- };
1631
2530
  declare type BulkInsertTableRecordsRequestBody = {
1632
2531
  records: Record<string, any>[];
1633
2532
  };
1634
2533
  declare type BulkInsertTableRecordsVariables = {
1635
2534
  body: BulkInsertTableRecordsRequestBody;
1636
2535
  pathParams: BulkInsertTableRecordsPathParams;
2536
+ queryParams?: BulkInsertTableRecordsQueryParams;
1637
2537
  } & FetcherExtraProps;
1638
2538
  /**
1639
2539
  * Bulk insert records
1640
2540
  */
1641
- declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
2541
+ declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
1642
2542
  declare type QueryTablePathParams = {
1643
2543
  dbBranchName: DBBranchName;
1644
2544
  tableName: TableName;
@@ -1658,7 +2558,7 @@ declare type QueryTableRequestBody = {
1658
2558
  filter?: FilterExpression;
1659
2559
  sort?: SortExpression;
1660
2560
  page?: PageConfig;
1661
- columns?: ColumnsFilter;
2561
+ columns?: ColumnsProjection;
1662
2562
  };
1663
2563
  declare type QueryTableVariables = {
1664
2564
  body?: QueryTableRequestBody;
@@ -1675,7 +2575,7 @@ declare type QueryTableVariables = {
1675
2575
  * {
1676
2576
  * "columns": [...],
1677
2577
  * "filter": {
1678
- * "$all": [...]
2578
+ * "$all": [...],
1679
2579
  * "$any": [...]
1680
2580
  * ...
1681
2581
  * },
@@ -1721,7 +2621,11 @@ declare type QueryTableVariables = {
1721
2621
  * "link": {
1722
2622
  * "table": "users"
1723
2623
  * }
1724
- * }
2624
+ * },
2625
+ * {
2626
+ * "name": "foundedDate",
2627
+ * "type": "datetime"
2628
+ * },
1725
2629
  * ]
1726
2630
  * },
1727
2631
  * {
@@ -1809,7 +2713,7 @@ declare type QueryTableVariables = {
1809
2713
  * {
1810
2714
  * "name": "Kilian",
1811
2715
  * "address": {
1812
- * "street": "New street",
2716
+ * "street": "New street"
1813
2717
  * }
1814
2718
  * }
1815
2719
  * ```
@@ -1818,10 +2722,7 @@ declare type QueryTableVariables = {
1818
2722
  *
1819
2723
  * ```json
1820
2724
  * {
1821
- * "columns": [
1822
- * "*",
1823
- * "team.name"
1824
- * ]
2725
+ * "columns": ["*", "team.name"]
1825
2726
  * }
1826
2727
  * ```
1827
2728
  *
@@ -1839,7 +2740,7 @@ declare type QueryTableVariables = {
1839
2740
  * "team": {
1840
2741
  * "id": "XX",
1841
2742
  * "xata": {
1842
- * "version": 0,
2743
+ * "version": 0
1843
2744
  * },
1844
2745
  * "name": "first team"
1845
2746
  * }
@@ -1850,10 +2751,7 @@ declare type QueryTableVariables = {
1850
2751
  *
1851
2752
  * ```json
1852
2753
  * {
1853
- * "columns": [
1854
- * "*",
1855
- * "team.*"
1856
- * ]
2754
+ * "columns": ["*", "team.*"]
1857
2755
  * }
1858
2756
  * ```
1859
2757
  *
@@ -1871,10 +2769,11 @@ declare type QueryTableVariables = {
1871
2769
  * "team": {
1872
2770
  * "id": "XX",
1873
2771
  * "xata": {
1874
- * "version": 0,
2772
+ * "version": 0
1875
2773
  * },
1876
2774
  * "name": "first team",
1877
- * "code": "A1"
2775
+ * "code": "A1",
2776
+ * "foundedDate": "2020-03-04T10:43:54.32Z"
1878
2777
  * }
1879
2778
  * }
1880
2779
  * ```
@@ -1889,7 +2788,7 @@ declare type QueryTableVariables = {
1889
2788
  * `$none`, etc.
1890
2789
  *
1891
2790
  * All operators start with an `$` to differentiate them from column names
1892
- * (which are not allowed to start with an dollar sign).
2791
+ * (which are not allowed to start with a dollar sign).
1893
2792
  *
1894
2793
  * #### Exact matching and control operators
1895
2794
  *
@@ -1920,7 +2819,7 @@ declare type QueryTableVariables = {
1920
2819
  * ```json
1921
2820
  * {
1922
2821
  * "filter": {
1923
- * "name": "r2",
2822
+ * "name": "r2"
1924
2823
  * }
1925
2824
  * }
1926
2825
  * ```
@@ -1942,7 +2841,7 @@ declare type QueryTableVariables = {
1942
2841
  * ```json
1943
2842
  * {
1944
2843
  * "filter": {
1945
- * "settings.plan": "free",
2844
+ * "settings.plan": "free"
1946
2845
  * }
1947
2846
  * }
1948
2847
  * ```
@@ -1952,8 +2851,8 @@ declare type QueryTableVariables = {
1952
2851
  * "filter": {
1953
2852
  * "settings": {
1954
2853
  * "plan": "free"
1955
- * },
1956
- * },
2854
+ * }
2855
+ * }
1957
2856
  * }
1958
2857
  * ```
1959
2858
  *
@@ -1962,8 +2861,8 @@ declare type QueryTableVariables = {
1962
2861
  * ```json
1963
2862
  * {
1964
2863
  * "filter": {
1965
- * "settings.plan": {"$any": ["free", "paid"]}
1966
- * },
2864
+ * "settings.plan": { "$any": ["free", "paid"] }
2865
+ * }
1967
2866
  * }
1968
2867
  * ```
1969
2868
  *
@@ -1972,9 +2871,9 @@ declare type QueryTableVariables = {
1972
2871
  * ```json
1973
2872
  * {
1974
2873
  * "filter": {
1975
- * "settings.dark": true,
1976
- * "settings.plan": "free",
1977
- * },
2874
+ * "settings.dark": true,
2875
+ * "settings.plan": "free"
2876
+ * }
1978
2877
  * }
1979
2878
  * ```
1980
2879
  *
@@ -1985,11 +2884,11 @@ declare type QueryTableVariables = {
1985
2884
  * ```json
1986
2885
  * {
1987
2886
  * "filter": {
1988
- * "$any": {
1989
- * "settings.dark": true,
1990
- * "settings.plan": "free"
1991
- * }
1992
- * },
2887
+ * "$any": {
2888
+ * "settings.dark": true,
2889
+ * "settings.plan": "free"
2890
+ * }
2891
+ * }
1993
2892
  * }
1994
2893
  * ```
1995
2894
  *
@@ -2000,10 +2899,10 @@ declare type QueryTableVariables = {
2000
2899
  * "filter": {
2001
2900
  * "$any": [
2002
2901
  * {
2003
- * "name": "r1",
2902
+ * "name": "r1"
2004
2903
  * },
2005
2904
  * {
2006
- * "name": "r2",
2905
+ * "name": "r2"
2007
2906
  * }
2008
2907
  * ]
2009
2908
  * }
@@ -2015,7 +2914,7 @@ declare type QueryTableVariables = {
2015
2914
  * ```json
2016
2915
  * {
2017
2916
  * "filter": {
2018
- * "$exists": "settings",
2917
+ * "$exists": "settings"
2019
2918
  * }
2020
2919
  * }
2021
2920
  * ```
@@ -2027,10 +2926,10 @@ declare type QueryTableVariables = {
2027
2926
  * "filter": {
2028
2927
  * "$all": [
2029
2928
  * {
2030
- * "$exists": "settings",
2929
+ * "$exists": "settings"
2031
2930
  * },
2032
2931
  * {
2033
- * "$exists": "name",
2932
+ * "$exists": "name"
2034
2933
  * }
2035
2934
  * ]
2036
2935
  * }
@@ -2042,7 +2941,7 @@ declare type QueryTableVariables = {
2042
2941
  * ```json
2043
2942
  * {
2044
2943
  * "filter": {
2045
- * "$notExists": "settings",
2944
+ * "$notExists": "settings"
2046
2945
  * }
2047
2946
  * }
2048
2947
  * ```
@@ -2069,43 +2968,59 @@ declare type QueryTableVariables = {
2069
2968
  * {
2070
2969
  * "filter": {
2071
2970
  * "<column_name>": {
2072
- * "$pattern": "v*alue*"
2971
+ * "$pattern": "v*alu?"
2073
2972
  * }
2074
2973
  * }
2075
2974
  * }
2076
2975
  * ```
2077
2976
  *
2977
+ * The `$pattern` operator accepts two wildcard characters:
2978
+ * * `*` matches zero or more characters
2979
+ * * `?` matches exactly one character
2980
+ *
2981
+ * 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.
2982
+ *
2078
2983
  * We could also have `$endsWith` and `$startsWith` operators:
2079
2984
  *
2080
2985
  * ```json
2081
2986
  * {
2082
2987
  * "filter": {
2083
2988
  * "<column_name>": {
2084
- * "$endsWith": ".gz"
2989
+ * "$endsWith": ".gz"
2085
2990
  * },
2086
2991
  * "<column_name>": {
2087
- * "$startsWith": "tmp-"
2992
+ * "$startsWith": "tmp-"
2088
2993
  * }
2089
2994
  * }
2090
2995
  * }
2091
2996
  * ```
2092
2997
  *
2093
- * #### Numeric ranges
2998
+ * #### Numeric or datetime ranges
2094
2999
  *
2095
3000
  * ```json
2096
3001
  * {
2097
3002
  * "filter": {
2098
- * "<column_name>": {
2099
- * "$ge": 0,
2100
- * "$lt": 100
2101
- * }
3003
+ * "<column_name>": {
3004
+ * "$ge": 0,
3005
+ * "$lt": 100
3006
+ * }
3007
+ * }
3008
+ * }
3009
+ * ```
3010
+ * Date ranges support the same operators, with the date using the format defined in
3011
+ * [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339):
3012
+ * ```json
3013
+ * {
3014
+ * "filter": {
3015
+ * "<column_name>": {
3016
+ * "$gt": "2019-10-12T07:20:50.52Z",
3017
+ * "$lt": "2021-10-12T07:20:50.52Z"
3018
+ * }
2102
3019
  * }
2103
3020
  * }
2104
3021
  * ```
2105
- *
2106
3022
  * The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
2107
3023
  *
2108
- *
2109
3024
  * #### Negations
2110
3025
  *
2111
3026
  * A general `$not` operator can inverse any operation.
@@ -2130,15 +3045,21 @@ declare type QueryTableVariables = {
2130
3045
  * {
2131
3046
  * "filter": {
2132
3047
  * "$not": {
2133
- * "$any": [{
2134
- * "<column_name1>": "value1"
2135
- * }, {
2136
- * "$all": [{
2137
- * "<column_name2>": "value2"
2138
- * }, {
2139
- * "<column_name3>": "value3"
2140
- * }]
2141
- * }]
3048
+ * "$any": [
3049
+ * {
3050
+ * "<column_name1>": "value1"
3051
+ * },
3052
+ * {
3053
+ * "$all": [
3054
+ * {
3055
+ * "<column_name2>": "value2"
3056
+ * },
3057
+ * {
3058
+ * "<column_name3>": "value3"
3059
+ * }
3060
+ * ]
3061
+ * }
3062
+ * ]
2142
3063
  * }
2143
3064
  * }
2144
3065
  * }
@@ -2193,8 +3114,8 @@ declare type QueryTableVariables = {
2193
3114
  * "<array name>": {
2194
3115
  * "$includes": {
2195
3116
  * "$all": [
2196
- * {"$contains": "label"},
2197
- * {"$not": {"$endsWith": "-debug"}}
3117
+ * { "$contains": "label" },
3118
+ * { "$not": { "$endsWith": "-debug" } }
2198
3119
  * ]
2199
3120
  * }
2200
3121
  * }
@@ -2214,9 +3135,7 @@ declare type QueryTableVariables = {
2214
3135
  * {
2215
3136
  * "filter": {
2216
3137
  * "settings.labels": {
2217
- * "$includesAll": [
2218
- * {"$contains": "label"},
2219
- * ]
3138
+ * "$includesAll": [{ "$contains": "label" }]
2220
3139
  * }
2221
3140
  * }
2222
3141
  * }
@@ -2264,7 +3183,6 @@ declare type QueryTableVariables = {
2264
3183
  * }
2265
3184
  * ```
2266
3185
  *
2267
- *
2268
3186
  * ### Pagination
2269
3187
  *
2270
3188
  * We offer cursor pagination and offset pagination. The offset pagination is limited
@@ -2330,8 +3248,8 @@ declare type QueryTableVariables = {
2330
3248
  * can be queried by update `page.after` to the returned cursor while keeping the
2331
3249
  * `page.before` cursor from the first range query.
2332
3250
  *
2333
- * The `filter` , `columns`, `sort` , and `page.size` configuration will be
2334
- * encoded with the cursor. The pagination request will be invalid if
3251
+ * The `filter` , `columns`, `sort` , and `page.size` configuration will be
3252
+ * encoded with the cursor. The pagination request will be invalid if
2335
3253
  * `filter` or `sort` is set. The columns returned and page size can be changed
2336
3254
  * anytime by passing the `columns` or `page.size` settings to the next query.
2337
3255
  *
@@ -2368,6 +3286,42 @@ declare type QueryTableVariables = {
2368
3286
  * ```
2369
3287
  */
2370
3288
  declare const queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
3289
+ declare type SearchTablePathParams = {
3290
+ dbBranchName: DBBranchName;
3291
+ tableName: TableName;
3292
+ workspace: string;
3293
+ };
3294
+ declare type SearchTableError = ErrorWrapper<{
3295
+ status: 400;
3296
+ payload: BadRequestError;
3297
+ } | {
3298
+ status: 401;
3299
+ payload: AuthError;
3300
+ } | {
3301
+ status: 404;
3302
+ payload: SimpleError;
3303
+ }>;
3304
+ declare type SearchTableRequestBody = {
3305
+ query: string;
3306
+ fuzziness?: FuzzinessExpression;
3307
+ target?: TargetExpression;
3308
+ prefix?: PrefixExpression;
3309
+ filter?: FilterExpression;
3310
+ highlight?: HighlightExpression;
3311
+ boosters?: BoosterExpression[];
3312
+ };
3313
+ declare type SearchTableVariables = {
3314
+ body: SearchTableRequestBody;
3315
+ pathParams: SearchTablePathParams;
3316
+ } & FetcherExtraProps;
3317
+ /**
3318
+ * Run a free text search operation in a particular table.
3319
+ *
3320
+ * 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:
3321
+ * * filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of type `text`
3322
+ * * filtering on columns of type `multiple` is currently unsupported
3323
+ */
3324
+ declare const searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2371
3325
  declare type SearchBranchPathParams = {
2372
3326
  dbBranchName: DBBranchName;
2373
3327
  workspace: string;
@@ -2383,9 +3337,17 @@ declare type SearchBranchError = ErrorWrapper<{
2383
3337
  payload: SimpleError;
2384
3338
  }>;
2385
3339
  declare type SearchBranchRequestBody = {
2386
- tables?: string[];
3340
+ tables?: (string | {
3341
+ table: string;
3342
+ filter?: FilterExpression;
3343
+ boosters?: BoosterExpression[];
3344
+ })[];
2387
3345
  query: string;
2388
- fuzziness?: number;
3346
+ fuzziness?: FuzzinessExpression;
3347
+ target?: TargetExpression;
3348
+ prefix?: PrefixExpression;
3349
+ filter?: FilterExpression;
3350
+ highlight?: HighlightExpression;
2389
3351
  };
2390
3352
  declare type SearchBranchVariables = {
2391
3353
  body: SearchBranchRequestBody;
@@ -2414,6 +3376,7 @@ declare const operationsByTag: {
2414
3376
  updateWorkspaceMemberRole: (variables: UpdateWorkspaceMemberRoleVariables) => Promise<undefined>;
2415
3377
  removeWorkspaceMember: (variables: RemoveWorkspaceMemberVariables) => Promise<undefined>;
2416
3378
  inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<WorkspaceInvite>;
3379
+ updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
2417
3380
  cancelWorkspaceMemberInvite: (variables: CancelWorkspaceMemberInviteVariables) => Promise<undefined>;
2418
3381
  resendWorkspaceMemberInvite: (variables: ResendWorkspaceMemberInviteVariables) => Promise<undefined>;
2419
3382
  acceptWorkspaceMemberInvite: (variables: AcceptWorkspaceMemberInviteVariables) => Promise<undefined>;
@@ -2422,21 +3385,45 @@ declare const operationsByTag: {
2422
3385
  getDatabaseList: (variables: GetDatabaseListVariables) => Promise<ListDatabasesResponse>;
2423
3386
  createDatabase: (variables: CreateDatabaseVariables) => Promise<CreateDatabaseResponse>;
2424
3387
  deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
3388
+ getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
3389
+ updateDatabaseMetadata: (variables: UpdateDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
3390
+ getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
3391
+ addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
3392
+ removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
3393
+ resolveBranch: (variables: ResolveBranchVariables) => Promise<ResolveBranchResponse>;
2425
3394
  };
2426
3395
  branch: {
2427
3396
  getBranchList: (variables: GetBranchListVariables) => Promise<ListBranchesResponse>;
2428
3397
  getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
2429
- createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
3398
+ createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
2430
3399
  deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
2431
3400
  updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
2432
3401
  getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
3402
+ getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
3403
+ };
3404
+ migrationRequests: {
3405
+ listMigrationRequests: (variables: ListMigrationRequestsVariables) => Promise<ListMigrationRequestsResponse>;
3406
+ createMigrationRequest: (variables: CreateMigrationRequestVariables) => Promise<CreateMigrationRequestResponse>;
3407
+ getMigrationRequest: (variables: GetMigrationRequestVariables) => Promise<MigrationRequest>;
3408
+ updateMigrationRequest: (variables: UpdateMigrationRequestVariables) => Promise<undefined>;
3409
+ listMigrationRequestsCommits: (variables: ListMigrationRequestsCommitsVariables) => Promise<ListMigrationRequestsCommitsResponse>;
3410
+ compareMigrationRequest: (variables: CompareMigrationRequestVariables) => Promise<SchemaCompareResponse>;
3411
+ getMigrationRequestIsMerged: (variables: GetMigrationRequestIsMergedVariables) => Promise<GetMigrationRequestIsMergedResponse>;
3412
+ mergeMigrationRequest: (variables: MergeMigrationRequestVariables) => Promise<Commit>;
3413
+ };
3414
+ branchSchema: {
2433
3415
  getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
2434
3416
  executeBranchMigrationPlan: (variables: ExecuteBranchMigrationPlanVariables) => Promise<undefined>;
2435
3417
  getBranchMigrationPlan: (variables: GetBranchMigrationPlanVariables) => Promise<BranchMigrationPlan>;
2436
- getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
3418
+ compareBranchWithUserSchema: (variables: CompareBranchWithUserSchemaVariables) => Promise<SchemaCompareResponse>;
3419
+ compareBranchSchemas: (variables: CompareBranchSchemasVariables) => Promise<SchemaCompareResponse>;
3420
+ updateBranchSchema: (variables: UpdateBranchSchemaVariables) => Promise<UpdateBranchSchemaResponse>;
3421
+ previewBranchSchemaEdit: (variables: PreviewBranchSchemaEditVariables) => Promise<PreviewBranchSchemaEditResponse>;
3422
+ applyBranchSchemaEdit: (variables: ApplyBranchSchemaEditVariables) => Promise<ApplyBranchSchemaEditResponse>;
3423
+ getBranchSchemaHistory: (variables: GetBranchSchemaHistoryVariables) => Promise<GetBranchSchemaHistoryResponse>;
2437
3424
  };
2438
3425
  table: {
2439
- createTable: (variables: CreateTableVariables) => Promise<undefined>;
3426
+ createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
2440
3427
  deleteTable: (variables: DeleteTableVariables) => Promise<undefined>;
2441
3428
  updateTable: (variables: UpdateTableVariables) => Promise<undefined>;
2442
3429
  getTableSchema: (variables: GetTableSchemaVariables) => Promise<GetTableSchemaResponse>;
@@ -2448,14 +3435,15 @@ declare const operationsByTag: {
2448
3435
  updateColumn: (variables: UpdateColumnVariables) => Promise<MigrationIdResponse>;
2449
3436
  };
2450
3437
  records: {
2451
- insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
3438
+ insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
2452
3439
  insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2453
3440
  updateRecordWithID: (variables: UpdateRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2454
3441
  upsertRecordWithID: (variables: UpsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2455
- deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
3442
+ deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
2456
3443
  getRecord: (variables: GetRecordVariables) => Promise<XataRecord$1>;
2457
- bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
3444
+ bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
2458
3445
  queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
3446
+ searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2459
3447
  searchBranch: (variables: SearchBranchVariables) => Promise<SearchResponse>;
2460
3448
  };
2461
3449
  };
@@ -2471,6 +3459,7 @@ interface XataApiClientOptions {
2471
3459
  fetch?: FetchImpl;
2472
3460
  apiKey?: string;
2473
3461
  host?: HostProvider;
3462
+ trace?: TraceFunction;
2474
3463
  }
2475
3464
  declare class XataApiClient {
2476
3465
  #private;
@@ -2481,6 +3470,8 @@ declare class XataApiClient {
2481
3470
  get branches(): BranchApi;
2482
3471
  get tables(): TableApi;
2483
3472
  get records(): RecordsApi;
3473
+ get migrationRequests(): MigrationRequestsApi;
3474
+ get branchSchema(): BranchSchemaApi;
2484
3475
  }
2485
3476
  declare class UserApi {
2486
3477
  private extraProps;
@@ -2504,6 +3495,7 @@ declare class WorkspaceApi {
2504
3495
  updateWorkspaceMemberRole(workspaceId: WorkspaceID, userId: UserID, role: Role): Promise<void>;
2505
3496
  removeWorkspaceMember(workspaceId: WorkspaceID, userId: UserID): Promise<void>;
2506
3497
  inviteWorkspaceMember(workspaceId: WorkspaceID, email: string, role: Role): Promise<WorkspaceInvite>;
3498
+ updateWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID, role: Role): Promise<WorkspaceInvite>;
2507
3499
  cancelWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2508
3500
  resendWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2509
3501
  acceptWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteKey: InviteKey): Promise<void>;
@@ -2514,25 +3506,28 @@ declare class DatabaseApi {
2514
3506
  getDatabaseList(workspace: WorkspaceID): Promise<ListDatabasesResponse>;
2515
3507
  createDatabase(workspace: WorkspaceID, dbName: DBName, options?: CreateDatabaseRequestBody): Promise<CreateDatabaseResponse>;
2516
3508
  deleteDatabase(workspace: WorkspaceID, dbName: DBName): Promise<void>;
3509
+ getDatabaseMetadata(workspace: WorkspaceID, dbName: DBName): Promise<DatabaseMetadata>;
3510
+ updateDatabaseMetadata(workspace: WorkspaceID, dbName: DBName, options?: UpdateDatabaseMetadataRequestBody): Promise<DatabaseMetadata>;
3511
+ getGitBranchesMapping(workspace: WorkspaceID, dbName: DBName): Promise<ListGitBranchesResponse>;
3512
+ addGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, body: AddGitBranchesEntryRequestBody): Promise<AddGitBranchesEntryResponse>;
3513
+ removeGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<void>;
3514
+ resolveBranch(workspace: WorkspaceID, dbName: DBName, gitBranch?: string, fallbackBranch?: string): Promise<ResolveBranchResponse>;
2517
3515
  }
2518
3516
  declare class BranchApi {
2519
3517
  private extraProps;
2520
3518
  constructor(extraProps: FetcherExtraProps);
2521
3519
  getBranchList(workspace: WorkspaceID, dbName: DBName): Promise<ListBranchesResponse>;
2522
3520
  getBranchDetails(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<DBBranch>;
2523
- createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<void>;
3521
+ createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<CreateBranchResponse>;
2524
3522
  deleteBranch(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<void>;
2525
3523
  updateBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName, metadata?: BranchMetadata): Promise<void>;
2526
3524
  getBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<BranchMetadata>;
2527
- getBranchMigrationHistory(workspace: WorkspaceID, database: DBName, branch: BranchName, options?: GetBranchMigrationHistoryRequestBody): Promise<GetBranchMigrationHistoryResponse>;
2528
- executeBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, migrationPlan: ExecuteBranchMigrationPlanRequestBody): Promise<void>;
2529
- getBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, schema: Schema): Promise<BranchMigrationPlan>;
2530
3525
  getBranchStats(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<GetBranchStatsResponse>;
2531
3526
  }
2532
3527
  declare class TableApi {
2533
3528
  private extraProps;
2534
3529
  constructor(extraProps: FetcherExtraProps);
2535
- createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
3530
+ createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<CreateTableResponse>;
2536
3531
  deleteTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
2537
3532
  updateTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, options: UpdateTableRequestBody): Promise<void>;
2538
3533
  getTableSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<GetTableSchemaResponse>;
@@ -2546,16 +3541,42 @@ declare class TableApi {
2546
3541
  declare class RecordsApi {
2547
3542
  private extraProps;
2548
3543
  constructor(extraProps: FetcherExtraProps);
2549
- insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>): Promise<InsertRecordResponse>;
3544
+ insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>, options?: InsertRecordQueryParams): Promise<RecordUpdateResponse>;
2550
3545
  insertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: InsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2551
3546
  updateRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpdateRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2552
3547
  upsertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2553
- deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID): Promise<void>;
2554
- getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordRequestBody): Promise<XataRecord$1>;
2555
- bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[]): Promise<BulkInsertTableRecordsResponse>;
3548
+ deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: DeleteRecordQueryParams): Promise<RecordUpdateResponse>;
3549
+ getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordQueryParams): Promise<XataRecord$1>;
3550
+ bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[], options?: BulkInsertTableRecordsQueryParams): Promise<BulkInsertResponse>;
2556
3551
  queryTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: QueryTableRequestBody): Promise<QueryResponse>;
3552
+ searchTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: SearchTableRequestBody): Promise<SearchResponse>;
2557
3553
  searchBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, query: SearchBranchRequestBody): Promise<SearchResponse>;
2558
3554
  }
3555
+ declare class MigrationRequestsApi {
3556
+ private extraProps;
3557
+ constructor(extraProps: FetcherExtraProps);
3558
+ listMigrationRequests(workspace: WorkspaceID, database: DBName, options?: ListMigrationRequestsRequestBody): Promise<ListMigrationRequestsResponse>;
3559
+ createMigrationRequest(workspace: WorkspaceID, database: DBName, options: CreateMigrationRequestRequestBody): Promise<CreateMigrationRequestResponse>;
3560
+ getMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<MigrationRequest>;
3561
+ updateMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number, options: UpdateMigrationRequestRequestBody): Promise<void>;
3562
+ listMigrationRequestsCommits(workspace: WorkspaceID, database: DBName, migrationRequest: number, options?: ListMigrationRequestsCommitsRequestBody): Promise<ListMigrationRequestsCommitsResponse>;
3563
+ compareMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<SchemaCompareResponse>;
3564
+ getMigrationRequestIsMerged(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<GetMigrationRequestIsMergedResponse>;
3565
+ mergeMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<Commit>;
3566
+ }
3567
+ declare class BranchSchemaApi {
3568
+ private extraProps;
3569
+ constructor(extraProps: FetcherExtraProps);
3570
+ getBranchMigrationHistory(workspace: WorkspaceID, database: DBName, branch: BranchName, options?: GetBranchMigrationHistoryRequestBody): Promise<GetBranchMigrationHistoryResponse>;
3571
+ executeBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, migrationPlan: ExecuteBranchMigrationPlanRequestBody): Promise<void>;
3572
+ getBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, schema: Schema): Promise<BranchMigrationPlan>;
3573
+ compareBranchWithUserSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, schema: Schema): Promise<SchemaCompareResponse>;
3574
+ compareBranchSchemas(workspace: WorkspaceID, database: DBName, branch: BranchName, branchName: BranchName, schema: Schema): Promise<SchemaCompareResponse>;
3575
+ updateBranchSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, migration: Migration): Promise<UpdateBranchSchemaResponse>;
3576
+ previewBranchSchemaEdit(workspace: WorkspaceID, database: DBName, branch: BranchName, migration: Migration): Promise<PreviewBranchSchemaEditResponse>;
3577
+ applyBranchSchemaEdit(workspace: WorkspaceID, database: DBName, branch: BranchName, edits: SchemaEditScript): Promise<ApplyBranchSchemaEditResponse>;
3578
+ getBranchSchemaHistory(workspace: WorkspaceID, database: DBName, branch: BranchName, options?: GetBranchSchemaHistoryRequestBody): Promise<GetBranchSchemaHistoryResponse>;
3579
+ }
2559
3580
 
2560
3581
  declare class XataApiPlugin implements XataPlugin {
2561
3582
  build(options: XataPluginOptions): Promise<XataApiClient>;
@@ -2567,28 +3588,29 @@ declare type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) ex
2567
3588
  declare type If<Condition, Then, Else> = Condition extends true ? Then : Else;
2568
3589
  declare type IsObject<T> = T extends Record<string, any> ? true : false;
2569
3590
  declare type IsArray<T> = T extends Array<any> ? true : false;
2570
- declare type NonEmptyArray<T> = T[] & {
2571
- 0: T;
2572
- };
2573
3591
  declare type RequiredBy<T, K extends keyof T> = T & {
2574
3592
  [P in K]-?: NonNullable<T[P]>;
2575
3593
  };
2576
3594
  declare type GetArrayInnerType<T extends readonly any[]> = T[number];
2577
3595
  declare type SingleOrArray<T> = T | T[];
2578
- declare type Dictionary<T> = Record<string, T>;
3596
+ declare type OmitBy<T, K extends keyof T> = T extends any ? Omit<T, K> : never;
3597
+ declare type Without<T, U> = {
3598
+ [P in Exclude<keyof T, keyof U>]?: never;
3599
+ };
3600
+ declare type ExclusiveOr<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
2579
3601
 
2580
3602
  declare type SelectableColumn<O, RecursivePath extends any[] = []> = '*' | 'id' | DataProps<O> | NestedColumns<O, RecursivePath>;
2581
- declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord & UnionToIntersection<Values<{
2582
- [K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord;
3603
+ declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord<O> & UnionToIntersection<Values<{
3604
+ [K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord<O>;
2583
3605
  }>>;
2584
- declare type ValueAtColumn<O, P extends SelectableColumn<O>> = P extends '*' ? Values<O> : P extends 'id' ? string : P extends keyof O ? O[P] : P extends `${infer K}.${infer V}` ? K extends keyof O ? Values<O[K] extends XataRecord ? (V extends SelectableColumn<O[K]> ? {
2585
- V: ValueAtColumn<O[K], V>;
2586
- } : never) : O[K]> : never : never;
3606
+ 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> ? {
3607
+ V: ValueAtColumn<Item, V>;
3608
+ } : never : O[K] : never> : never : never;
2587
3609
  declare type MAX_RECURSION = 5;
2588
3610
  declare type NestedColumns<O, RecursivePath extends any[]> = RecursivePath['length'] extends MAX_RECURSION ? never : If<IsObject<O>, Values<{
2589
- [K in DataProps<O>]: If<IsArray<NonNullable<O[K]>>, K, // If the property is an array, we stop recursion. We don't support object arrays yet
2590
- If<IsObject<NonNullable<O[K]>>, NonNullable<O[K]> extends XataRecord ? SelectableColumn<NonNullable<O[K]>, [...RecursivePath, O[K]]> extends string ? K | `${K}.${SelectableColumn<NonNullable<O[K]>, [...RecursivePath, O[K]]>}` : never : `${K}.${StringKeys<NonNullable<O[K]>> | '*'}`, // This allows usage of objects that are not links
2591
- K>>;
3611
+ [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
3612
+ 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
3613
+ K>> : never;
2592
3614
  }>, never>;
2593
3615
  declare type DataProps<O> = Exclude<StringKeys<O>, StringKeys<XataRecord>>;
2594
3616
  declare type NestedValueAtColumn<O, Key extends SelectableColumn<O>> = Key extends `${infer N}.${infer M}` ? N extends DataProps<O> ? {
@@ -2615,56 +3637,67 @@ interface BaseData {
2615
3637
  /**
2616
3638
  * Represents a persisted record from the database.
2617
3639
  */
2618
- interface XataRecord extends Identifiable {
3640
+ interface XataRecord<OriginalRecord extends XataRecord<any> = XataRecord<any>> extends Identifiable {
2619
3641
  /**
2620
- * Metadata of this record.
3642
+ * Get metadata of this record.
2621
3643
  */
2622
- xata: {
2623
- /**
2624
- * Number that is increased every time the record is updated.
2625
- */
2626
- version: number;
2627
- };
3644
+ getMetadata(): XataRecordMetadata;
3645
+ /**
3646
+ * Retrieves a refreshed copy of the current record from the database.
3647
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3648
+ * @returns The persisted record with the selected columns, null if not found.
3649
+ */
3650
+ read<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
2628
3651
  /**
2629
3652
  * Retrieves a refreshed copy of the current record from the database.
3653
+ * @returns The persisted record with all first level properties, null if not found.
2630
3654
  */
2631
- read(): Promise<Readonly<SelectedPick<this, ['*']>> | null>;
3655
+ read(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2632
3656
  /**
2633
3657
  * Performs a partial update of the current record. On success a new object is
2634
3658
  * returned and the current object is not mutated.
2635
- * @param data The columns and their values that have to be updated.
2636
- * @returns A new record containing the latest values for all the columns of the current record.
3659
+ * @param partialUpdate The columns and their values that have to be updated.
3660
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3661
+ * @returns The persisted record with the selected columns, null if not found.
2637
3662
  */
2638
- update(partialUpdate: Partial<EditableData<Omit<this, keyof XataRecord>>>): Promise<Readonly<SelectedPick<this, ['*']>>>;
3663
+ update<K extends SelectableColumn<OriginalRecord>>(partialUpdate: Partial<EditableData<OriginalRecord>>, columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
3664
+ /**
3665
+ * Performs a partial update of the current record. On success a new object is
3666
+ * returned and the current object is not mutated.
3667
+ * @param partialUpdate The columns and their values that have to be updated.
3668
+ * @returns The persisted record with all first level properties, null if not found.
3669
+ */
3670
+ update(partialUpdate: Partial<EditableData<OriginalRecord>>): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2639
3671
  /**
2640
3672
  * Performs a deletion of the current record in the database.
2641
- *
2642
- * @throws If the record was already deleted or if an error happened while performing the deletion.
3673
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3674
+ * @returns The deleted record, null if not found.
2643
3675
  */
2644
- delete(): Promise<void>;
2645
- }
2646
- declare type Link<Record extends XataRecord> = Omit<XataRecord, 'read' | 'update'> & {
3676
+ delete<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
2647
3677
  /**
2648
- * Retrieves a refreshed copy of the current record from the database.
3678
+ * Performs a deletion of the current record in the database.
3679
+ * @returns The deleted record, null if not found.
3680
+
2649
3681
  */
2650
- read(): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3682
+ delete(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
3683
+ }
3684
+ declare type Link<Record extends XataRecord> = XataRecord<Record>;
3685
+ declare type XataRecordMetadata = {
2651
3686
  /**
2652
- * Performs a partial update of the current record. On success a new object is
2653
- * returned and the current object is not mutated.
2654
- * @param data The columns and their values that have to be updated.
2655
- * @returns A new record containing the latest values for all the columns of the current record.
3687
+ * Number that is increased every time the record is updated.
2656
3688
  */
2657
- update(partialUpdate: Partial<EditableData<Omit<Record, keyof XataRecord>>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3689
+ version: number;
3690
+ warnings?: string[];
2658
3691
  };
2659
3692
  declare function isIdentifiable(x: any): x is Identifiable & Record<string, unknown>;
2660
3693
  declare function isXataRecord(x: any): x is XataRecord & Record<string, unknown>;
2661
- declare type EditableData<O extends BaseData> = {
3694
+ declare type EditableData<O extends XataRecord> = Identifiable & Omit<{
2662
3695
  [K in keyof O]: O[K] extends XataRecord ? {
2663
3696
  id: string;
2664
- } : NonNullable<O[K]> extends XataRecord ? {
3697
+ } | string : NonNullable<O[K]> extends XataRecord ? {
2665
3698
  id: string;
2666
- } | null | undefined : O[K];
2667
- };
3699
+ } | string | null | undefined : O[K];
3700
+ }, keyof XataRecord>;
2668
3701
 
2669
3702
  /**
2670
3703
  * PropertyMatchFilter
@@ -2739,8 +3772,8 @@ declare type ValueTypeFilters<T> = T | T extends string ? StringTypeFilter : T e
2739
3772
  ],
2740
3773
  }
2741
3774
  */
2742
- declare type AggregatorFilter<Record> = {
2743
- [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<Record>>;
3775
+ declare type AggregatorFilter<T> = {
3776
+ [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<T>>;
2744
3777
  };
2745
3778
  /**
2746
3779
  * Existance filter
@@ -2755,10 +3788,88 @@ declare type BaseApiFilter<Record> = PropertyAccessFilter<Record> | AggregatorFi
2755
3788
  * Injects the Api filters on nested properties
2756
3789
  * Example: { filter: { settings: { plan: { $any: ['free', 'trial'] } } } }
2757
3790
  */
2758
- declare type NestedApiFilter<T> = T extends Record<string, any> ? {
3791
+ declare type NestedApiFilter<T> = {
2759
3792
  [key in keyof T]?: T[key] extends Record<string, any> ? SingleOrArray<Filter<T[key]>> : PropertyFilter<T[key]>;
2760
- } : PropertyFilter<T>;
2761
- declare type Filter<Record> = BaseApiFilter<Record> | NestedApiFilter<Record>;
3793
+ };
3794
+ 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>;
3795
+
3796
+ declare type DateBooster = {
3797
+ origin?: string;
3798
+ scale: string;
3799
+ decay: number;
3800
+ };
3801
+ declare type NumericBooster = {
3802
+ factor: number;
3803
+ };
3804
+ declare type ValueBooster<T extends string | number | boolean> = {
3805
+ value: T;
3806
+ factor: number;
3807
+ };
3808
+ declare type Boosters<O extends XataRecord> = Values<{
3809
+ [K in SelectableColumn<O>]: NonNullable<ValueAtColumn<O, K>> extends Date ? {
3810
+ dateBooster: {
3811
+ column: K;
3812
+ } & DateBooster;
3813
+ } : NonNullable<ValueAtColumn<O, K>> extends number ? ExclusiveOr<{
3814
+ numericBooster?: {
3815
+ column: K;
3816
+ } & NumericBooster;
3817
+ }, {
3818
+ valueBooster?: {
3819
+ column: K;
3820
+ } & ValueBooster<number>;
3821
+ }> : NonNullable<ValueAtColumn<O, K>> extends string | boolean ? {
3822
+ valueBooster: {
3823
+ column: K;
3824
+ } & ValueBooster<NonNullable<ValueAtColumn<O, K>>>;
3825
+ } : never;
3826
+ }>;
3827
+
3828
+ declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3829
+ fuzziness?: FuzzinessExpression;
3830
+ prefix?: PrefixExpression;
3831
+ highlight?: HighlightExpression;
3832
+ tables?: Array<Tables | Values<{
3833
+ [Model in GetArrayInnerType<NonNullable<Tables[]>>]: {
3834
+ table: Model;
3835
+ filter?: Filter<SelectedPick<Schemas[Model] & XataRecord, ['*']>>;
3836
+ boosters?: Boosters<Schemas[Model] & XataRecord>[];
3837
+ };
3838
+ }>>;
3839
+ };
3840
+ declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3841
+ all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3842
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]: {
3843
+ table: Model;
3844
+ record: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>>;
3845
+ };
3846
+ }>[]>;
3847
+ byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3848
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]?: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>[]>;
3849
+ }>;
3850
+ };
3851
+ declare class SearchPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin {
3852
+ #private;
3853
+ private db;
3854
+ constructor(db: SchemaPluginResult<Schemas>, schemaTables?: Schemas.Table[]);
3855
+ build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
3856
+ }
3857
+ declare type SearchXataRecord<Record extends XataRecord> = Omit<Record, 'getMetadata'> & {
3858
+ getMetadata: () => XataRecordMetadata & SearchExtraProperties;
3859
+ };
3860
+ declare type SearchExtraProperties = {
3861
+ table: string;
3862
+ highlight?: {
3863
+ [key: string]: string[] | {
3864
+ [key: string]: any;
3865
+ };
3866
+ };
3867
+ score?: number;
3868
+ };
3869
+ declare type ReturnTable<Table, Tables> = Table extends Tables ? Table : never;
3870
+ 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 {
3871
+ table: infer Table;
3872
+ } ? ReturnTable<Table, Tables> : never;
2762
3873
 
2763
3874
  declare type SortDirection = 'asc' | 'desc';
2764
3875
  declare type SortFilterExtended<T extends XataRecord> = {
@@ -2770,12 +3881,21 @@ declare type SortFilterBase<T extends XataRecord> = {
2770
3881
  [Key in StringKeys<T>]: SortDirection;
2771
3882
  };
2772
3883
 
2773
- declare type QueryOptions<T extends XataRecord> = {
2774
- page?: PaginationOptions;
2775
- columns?: NonEmptyArray<SelectableColumn<T>>;
3884
+ declare type BaseOptions<T extends XataRecord> = {
3885
+ columns?: SelectableColumn<T>[];
3886
+ cache?: number;
3887
+ };
3888
+ declare type CursorQueryOptions = {
3889
+ pagination?: CursorNavigationOptions & OffsetNavigationOptions;
3890
+ filter?: never;
3891
+ sort?: never;
3892
+ };
3893
+ declare type OffsetQueryOptions<T extends XataRecord> = {
3894
+ pagination?: OffsetNavigationOptions;
2776
3895
  filter?: FilterExpression;
2777
3896
  sort?: SortFilter<T> | SortFilter<T>[];
2778
3897
  };
3898
+ declare type QueryOptions<T extends XataRecord> = BaseOptions<T> & (CursorQueryOptions | OffsetQueryOptions<T>);
2779
3899
  /**
2780
3900
  * Query objects contain the information of all filters, sorting, etc. to be included in the database query.
2781
3901
  *
@@ -2785,9 +3905,13 @@ declare type QueryOptions<T extends XataRecord> = {
2785
3905
  declare class Query<Record extends XataRecord, Result extends XataRecord = Record> implements Paginable<Record, Result> {
2786
3906
  #private;
2787
3907
  readonly meta: PaginationQueryMeta;
2788
- readonly records: Result[];
2789
- constructor(repository: Repository<Record> | null, table: string, data: Partial<QueryOptions<Record>>, parent?: Partial<QueryOptions<Record>>);
3908
+ readonly records: RecordArray<Result>;
3909
+ constructor(repository: Repository<Record> | null, table: {
3910
+ name: string;
3911
+ schema?: Table;
3912
+ }, data: Partial<QueryOptions<Record>>, rawParent?: Partial<QueryOptions<Record>>);
2790
3913
  getQueryOptions(): QueryOptions<Record>;
3914
+ key(): string;
2791
3915
  /**
2792
3916
  * Builds a new query object representing a logical OR between the given subqueries.
2793
3917
  * @param queries An array of subqueries.
@@ -2817,67 +3941,206 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
2817
3941
  *
2818
3942
  * ```
2819
3943
  * query.filter("columnName", columnValue)
2820
- * query.filter({
2821
- * "columnName": columnValue
2822
- * })
3944
+ * query.filter("columnName", operator(columnValue)) // Use gt, gte, lt, lte, startsWith,...
3945
+ * ```
3946
+ *
3947
+ * @param column The name of the column to filter.
3948
+ * @param value The value to filter.
3949
+ * @returns A new Query object.
3950
+ */
3951
+ filter<F extends SelectableColumn<Record>>(column: F, value: Filter<NonNullable<ValueAtColumn<Record, F>>>): Query<Record, Result>;
3952
+ /**
3953
+ * Builds a new query object adding one or more constraints. Examples:
3954
+ *
3955
+ * ```
3956
+ * query.filter({ "columnName": columnValue })
2823
3957
  * query.filter({
2824
3958
  * "columnName": operator(columnValue) // Use gt, gte, lt, lte, startsWith,...
2825
3959
  * })
2826
3960
  * ```
2827
3961
  *
3962
+ * @param filters A filter object
2828
3963
  * @returns A new Query object.
2829
3964
  */
2830
- filter(filters: Filter<Record>): Query<Record, Result>;
2831
- filter<F extends SelectableColumn<Record>>(column: F, value: Filter<ValueAtColumn<Record, F>>): Query<Record, Result>;
3965
+ filter(filters?: Filter<Record>): Query<Record, Result>;
3966
+ defaultFilter<T>(column: string, value: T): T | {
3967
+ $includes: (T & string) | (T & string[]);
3968
+ };
2832
3969
  /**
2833
3970
  * Builds a new query with a new sort option.
2834
3971
  * @param column The column name.
2835
3972
  * @param direction The direction. Either ascending or descending.
2836
3973
  * @returns A new Query object.
2837
3974
  */
2838
- sort<F extends SelectableColumn<Record>>(column: F, direction: SortDirection): Query<Record, Result>;
3975
+ sort<F extends SelectableColumn<Record>>(column: F, direction?: SortDirection): Query<Record, Result>;
2839
3976
  /**
2840
3977
  * Builds a new query specifying the set of columns to be returned in the query response.
2841
3978
  * @param columns Array of column names to be returned by the query.
2842
3979
  * @returns A new Query object.
2843
3980
  */
2844
- select<K extends SelectableColumn<Record>>(columns: NonEmptyArray<K>): Query<Record, SelectedPick<Record, NonEmptyArray<K>>>;
3981
+ select<K extends SelectableColumn<Record>>(columns: K[]): Query<Record, SelectedPick<Record, K[]>>;
3982
+ /**
3983
+ * Get paginated results
3984
+ *
3985
+ * @returns A page of results
3986
+ */
2845
3987
  getPaginated(): Promise<Page<Record, Result>>;
2846
- getPaginated(options: Omit<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
3988
+ /**
3989
+ * Get paginated results
3990
+ *
3991
+ * @param options Pagination options
3992
+ * @returns A page of results
3993
+ */
3994
+ getPaginated(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
3995
+ /**
3996
+ * Get paginated results
3997
+ *
3998
+ * @param options Pagination options
3999
+ * @returns A page of results
4000
+ */
2847
4001
  getPaginated<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<Page<Record, SelectedPick<Record, typeof options['columns']>>>;
4002
+ /**
4003
+ * Get results in an iterator
4004
+ *
4005
+ * @async
4006
+ * @returns Async interable of results
4007
+ */
2848
4008
  [Symbol.asyncIterator](): AsyncIterableIterator<Result>;
2849
- getIterator(chunk: number): AsyncGenerator<Result[]>;
2850
- getIterator(chunk: number, options: Omit<QueryOptions<Record>, 'columns' | 'page'>): AsyncGenerator<Result[]>;
2851
- getIterator<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(chunk: number, options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
4009
+ /**
4010
+ * Build an iterator of results
4011
+ *
4012
+ * @returns Async generator of results array
4013
+ */
4014
+ getIterator(): AsyncGenerator<Result[]>;
4015
+ /**
4016
+ * Build an iterator of results
4017
+ *
4018
+ * @param options Pagination options with batchSize
4019
+ * @returns Async generator of results array
4020
+ */
4021
+ getIterator(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
4022
+ batchSize?: number;
4023
+ }): AsyncGenerator<Result[]>;
4024
+ /**
4025
+ * Build an iterator of results
4026
+ *
4027
+ * @param options Pagination options with batchSize
4028
+ * @returns Async generator of results array
4029
+ */
4030
+ getIterator<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
4031
+ batchSize?: number;
4032
+ }>(options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
4033
+ /**
4034
+ * Performs the query in the database and returns a set of results.
4035
+ * @returns An array of records from the database.
4036
+ */
4037
+ getMany(): Promise<RecordArray<Result>>;
4038
+ /**
4039
+ * Performs the query in the database and returns a set of results.
4040
+ * @param options Additional options to be used when performing the query.
4041
+ * @returns An array of records from the database.
4042
+ */
4043
+ getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<RecordArray<SelectedPick<Record, typeof options['columns']>>>;
2852
4044
  /**
2853
4045
  * Performs the query in the database and returns a set of results.
2854
4046
  * @param options Additional options to be used when performing the query.
2855
- * @returns An array of records from the database.
4047
+ * @returns An array of records from the database.
4048
+ */
4049
+ getMany(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<RecordArray<Result>>;
4050
+ /**
4051
+ * Performs the query in the database and returns all the results.
4052
+ * Warning: If there are a large number of results, this method can have performance implications.
4053
+ * @returns An array of records from the database.
4054
+ */
4055
+ getAll(): Promise<Result[]>;
4056
+ /**
4057
+ * Performs the query in the database and returns all the results.
4058
+ * Warning: If there are a large number of results, this method can have performance implications.
4059
+ * @param options Additional options to be used when performing the query.
4060
+ * @returns An array of records from the database.
4061
+ */
4062
+ getAll<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
4063
+ batchSize?: number;
4064
+ }>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
4065
+ /**
4066
+ * Performs the query in the database and returns all the results.
4067
+ * Warning: If there are a large number of results, this method can have performance implications.
4068
+ * @param options Additional options to be used when performing the query.
4069
+ * @returns An array of records from the database.
4070
+ */
4071
+ getAll(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
4072
+ batchSize?: number;
4073
+ }): Promise<Result[]>;
4074
+ /**
4075
+ * Performs the query in the database and returns the first result.
4076
+ * @returns The first record that matches the query, or null if no record matched the query.
4077
+ */
4078
+ getFirst(): Promise<Result | null>;
4079
+ /**
4080
+ * Performs the query in the database and returns the first result.
4081
+ * @param options Additional options to be used when performing the query.
4082
+ * @returns The first record that matches the query, or null if no record matched the query.
4083
+ */
4084
+ getFirst<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
4085
+ /**
4086
+ * Performs the query in the database and returns the first result.
4087
+ * @param options Additional options to be used when performing the query.
4088
+ * @returns The first record that matches the query, or null if no record matched the query.
2856
4089
  */
2857
- getMany(): Promise<Result[]>;
2858
- getMany(options: Omit<QueryOptions<Record>, 'columns'>): Promise<Result[]>;
2859
- getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
4090
+ getFirst(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result | null>;
2860
4091
  /**
2861
- * Performs the query in the database and returns all the results.
2862
- * Warning: If there are a large number of results, this method can have performance implications.
4092
+ * Performs the query in the database and returns the first result.
4093
+ * @returns The first record that matches the query, or null if no record matched the query.
4094
+ * @throws if there are no results.
4095
+ */
4096
+ getFirstOrThrow(): Promise<Result>;
4097
+ /**
4098
+ * Performs the query in the database and returns the first result.
2863
4099
  * @param options Additional options to be used when performing the query.
2864
- * @returns An array of records from the database.
4100
+ * @returns The first record that matches the query, or null if no record matched the query.
4101
+ * @throws if there are no results.
2865
4102
  */
2866
- getAll(chunk?: number): Promise<Result[]>;
2867
- getAll(chunk: number | undefined, options: Omit<QueryOptions<Record>, 'columns' | 'page'>): Promise<Result[]>;
2868
- getAll<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(chunk: number | undefined, options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
4103
+ getFirstOrThrow<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>>;
2869
4104
  /**
2870
4105
  * Performs the query in the database and returns the first result.
2871
4106
  * @param options Additional options to be used when performing the query.
2872
4107
  * @returns The first record that matches the query, or null if no record matched the query.
4108
+ * @throws if there are no results.
4109
+ */
4110
+ getFirstOrThrow(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result>;
4111
+ /**
4112
+ * Builds a new query object adding a cache TTL in milliseconds.
4113
+ * @param ttl The cache TTL in milliseconds.
4114
+ * @returns A new Query object.
4115
+ */
4116
+ cache(ttl: number): Query<Record, Result>;
4117
+ /**
4118
+ * Retrieve next page of records
4119
+ *
4120
+ * @returns A new page object.
2873
4121
  */
2874
- getOne(): Promise<Result | null>;
2875
- getOne(options: Omit<QueryOptions<Record>, 'columns' | 'page'>): Promise<Result | null>;
2876
- getOne<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
2877
4122
  nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4123
+ /**
4124
+ * Retrieve previous page of records
4125
+ *
4126
+ * @returns A new page object
4127
+ */
2878
4128
  previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4129
+ /**
4130
+ * Retrieve first page of records
4131
+ *
4132
+ * @returns A new page object
4133
+ */
2879
4134
  firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4135
+ /**
4136
+ * Retrieve last page of records
4137
+ *
4138
+ * @returns A new page object
4139
+ */
2880
4140
  lastPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4141
+ /**
4142
+ * @returns Boolean indicating if there is a next page
4143
+ */
2881
4144
  hasNextPage(): boolean;
2882
4145
  }
2883
4146
 
@@ -2889,7 +4152,7 @@ declare type PaginationQueryMeta = {
2889
4152
  };
2890
4153
  interface Paginable<Record extends XataRecord, Result extends XataRecord = Record> {
2891
4154
  meta: PaginationQueryMeta;
2892
- records: Result[];
4155
+ records: RecordArray<Result>;
2893
4156
  nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
2894
4157
  previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
2895
4158
  firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
@@ -2909,7 +4172,7 @@ declare class Page<Record extends XataRecord, Result extends XataRecord = Record
2909
4172
  /**
2910
4173
  * The set of results for this page.
2911
4174
  */
2912
- readonly records: Result[];
4175
+ readonly records: RecordArray<Result>;
2913
4176
  constructor(query: Query<Record, Result>, meta: PaginationQueryMeta, records?: Result[]);
2914
4177
  /**
2915
4178
  * Retrieves the next page of results.
@@ -2957,103 +4220,440 @@ declare type OffsetNavigationOptions = {
2957
4220
  size?: number;
2958
4221
  offset?: number;
2959
4222
  };
2960
- declare type PaginationOptions = CursorNavigationOptions & OffsetNavigationOptions;
2961
4223
  declare const PAGINATION_MAX_SIZE = 200;
2962
- declare const PAGINATION_DEFAULT_SIZE = 200;
4224
+ declare const PAGINATION_DEFAULT_SIZE = 20;
2963
4225
  declare const PAGINATION_MAX_OFFSET = 800;
2964
4226
  declare const PAGINATION_DEFAULT_OFFSET = 0;
4227
+ declare function isCursorPaginationOptions(options: Record<string, unknown> | undefined | null): options is CursorNavigationOptions;
4228
+ declare class RecordArray<Result extends XataRecord> extends Array<Result> {
4229
+ #private;
4230
+ constructor(page: Paginable<any, Result>, overrideRecords?: Result[]);
4231
+ static parseConstructorParams(...args: any[]): any[];
4232
+ toArray(): Result[];
4233
+ map<U>(callbackfn: (value: Result, index: number, array: Result[]) => U, thisArg?: any): U[];
4234
+ /**
4235
+ * Retrieve next page of records
4236
+ *
4237
+ * @returns A new array of objects
4238
+ */
4239
+ nextPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4240
+ /**
4241
+ * Retrieve previous page of records
4242
+ *
4243
+ * @returns A new array of objects
4244
+ */
4245
+ previousPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4246
+ /**
4247
+ * Retrieve first page of records
4248
+ *
4249
+ * @returns A new array of objects
4250
+ */
4251
+ firstPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4252
+ /**
4253
+ * Retrieve last page of records
4254
+ *
4255
+ * @returns A new array of objects
4256
+ */
4257
+ lastPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4258
+ /**
4259
+ * @returns Boolean indicating if there is a next page
4260
+ */
4261
+ hasNextPage(): boolean;
4262
+ }
2965
4263
 
2966
- declare type TableLink = string[];
2967
- declare type LinkDictionary = Dictionary<TableLink[]>;
2968
4264
  /**
2969
4265
  * Common interface for performing operations on a table.
2970
4266
  */
2971
- declare abstract class Repository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
2972
- abstract create(object: EditableData<Data> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4267
+ declare abstract class Repository<Record extends XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
4268
+ abstract create<K extends SelectableColumn<Record>>(object: Omit<EditableData<Record>, 'id'> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4269
+ abstract create(object: Omit<EditableData<Record>, 'id'> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4270
+ /**
4271
+ * Creates a single record in the table with a unique id.
4272
+ * @param id The unique id.
4273
+ * @param object Object containing the column names with their values to be stored in the table.
4274
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4275
+ * @returns The full persisted record.
4276
+ */
4277
+ abstract create<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
2973
4278
  /**
2974
4279
  * Creates a single record in the table with a unique id.
2975
4280
  * @param id The unique id.
2976
4281
  * @param object Object containing the column names with their values to be stored in the table.
2977
4282
  * @returns The full persisted record.
2978
4283
  */
2979
- abstract create(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4284
+ abstract create(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
2980
4285
  /**
2981
4286
  * Creates multiple records in the table.
2982
4287
  * @param objects Array of objects with the column names and the values to be stored in the table.
2983
- * @returns Array of the persisted records.
4288
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4289
+ * @returns Array of the persisted records in order.
4290
+ */
4291
+ abstract create<K extends SelectableColumn<Record>>(objects: Array<Omit<EditableData<Record>, 'id'> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4292
+ /**
4293
+ * Creates multiple records in the table.
4294
+ * @param objects Array of objects with the column names and the values to be stored in the table.
4295
+ * @returns Array of the persisted records in order.
4296
+ */
4297
+ abstract create(objects: Array<Omit<EditableData<Record>, 'id'> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4298
+ /**
4299
+ * Queries a single record from the table given its unique id.
4300
+ * @param id The unique id.
4301
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4302
+ * @returns The persisted record for the given id or null if the record could not be found.
2984
4303
  */
2985
- abstract create(objects: Array<EditableData<Data> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4304
+ abstract read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
2986
4305
  /**
2987
4306
  * Queries a single record from the table given its unique id.
2988
4307
  * @param id The unique id.
2989
4308
  * @returns The persisted record for the given id or null if the record could not be found.
2990
4309
  */
2991
4310
  abstract read(id: string): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4311
+ /**
4312
+ * Queries multiple records from the table given their unique id.
4313
+ * @param ids The unique ids array.
4314
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4315
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4316
+ */
4317
+ abstract read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4318
+ /**
4319
+ * Queries multiple records from the table given their unique id.
4320
+ * @param ids The unique ids array.
4321
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4322
+ */
4323
+ abstract read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4324
+ /**
4325
+ * Queries a single record from the table by the id in the object.
4326
+ * @param object Object containing the id of the record.
4327
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4328
+ * @returns The persisted record for the given id or null if the record could not be found.
4329
+ */
4330
+ abstract read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
4331
+ /**
4332
+ * Queries a single record from the table by the id in the object.
4333
+ * @param object Object containing the id of the record.
4334
+ * @returns The persisted record for the given id or null if the record could not be found.
4335
+ */
4336
+ abstract read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4337
+ /**
4338
+ * Queries multiple records from the table by the ids in the objects.
4339
+ * @param objects Array of objects containing the ids of the records.
4340
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4341
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4342
+ */
4343
+ abstract read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4344
+ /**
4345
+ * Queries multiple records from the table by the ids in the objects.
4346
+ * @param objects Array of objects containing the ids of the records.
4347
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4348
+ */
4349
+ abstract read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4350
+ /**
4351
+ * Queries a single record from the table given its unique id.
4352
+ * @param id The unique id.
4353
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4354
+ * @returns The persisted record for the given id.
4355
+ * @throws If the record could not be found.
4356
+ */
4357
+ abstract readOrThrow<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4358
+ /**
4359
+ * Queries a single record from the table given its unique id.
4360
+ * @param id The unique id.
4361
+ * @returns The persisted record for the given id.
4362
+ * @throws If the record could not be found.
4363
+ */
4364
+ abstract readOrThrow(id: string): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4365
+ /**
4366
+ * Queries multiple records from the table given their unique id.
4367
+ * @param ids The unique ids array.
4368
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4369
+ * @returns The persisted records for the given ids in order.
4370
+ * @throws If one or more records could not be found.
4371
+ */
4372
+ abstract readOrThrow<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
4373
+ /**
4374
+ * Queries multiple records from the table given their unique id.
4375
+ * @param ids The unique ids array.
4376
+ * @returns The persisted records for the given ids in order.
4377
+ * @throws If one or more records could not be found.
4378
+ */
4379
+ abstract readOrThrow(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
4380
+ /**
4381
+ * Queries a single record from the table by the id in the object.
4382
+ * @param object Object containing the id of the record.
4383
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4384
+ * @returns The persisted record for the given id.
4385
+ * @throws If the record could not be found.
4386
+ */
4387
+ abstract readOrThrow<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4388
+ /**
4389
+ * Queries a single record from the table by the id in the object.
4390
+ * @param object Object containing the id of the record.
4391
+ * @returns The persisted record for the given id.
4392
+ * @throws If the record could not be found.
4393
+ */
4394
+ abstract readOrThrow(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4395
+ /**
4396
+ * Queries multiple records from the table by the ids in the objects.
4397
+ * @param objects Array of objects containing the ids of the records.
4398
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4399
+ * @returns The persisted records for the given ids in order.
4400
+ * @throws If one or more records could not be found.
4401
+ */
4402
+ abstract readOrThrow<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
4403
+ /**
4404
+ * Queries multiple records from the table by the ids in the objects.
4405
+ * @param objects Array of objects containing the ids of the records.
4406
+ * @returns The persisted records for the given ids in order.
4407
+ * @throws If one or more records could not be found.
4408
+ */
4409
+ abstract readOrThrow(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
2992
4410
  /**
2993
4411
  * Partially update a single record.
2994
4412
  * @param object An object with its id and the columns to be updated.
4413
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4414
+ * @returns The full persisted record, null if the record could not be found.
4415
+ */
4416
+ abstract update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4417
+ /**
4418
+ * Partially update a single record.
4419
+ * @param object An object with its id and the columns to be updated.
4420
+ * @returns The full persisted record, null if the record could not be found.
4421
+ */
4422
+ abstract update(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4423
+ /**
4424
+ * Partially update a single record given its unique id.
4425
+ * @param id The unique id.
4426
+ * @param object The column names and their values that have to be updated.
4427
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4428
+ * @returns The full persisted record, null if the record could not be found.
4429
+ */
4430
+ abstract update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4431
+ /**
4432
+ * Partially update a single record given its unique id.
4433
+ * @param id The unique id.
4434
+ * @param object The column names and their values that have to be updated.
4435
+ * @returns The full persisted record, null if the record could not be found.
4436
+ */
4437
+ abstract update(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4438
+ /**
4439
+ * Partially updates multiple records.
4440
+ * @param objects An array of objects with their ids and columns to be updated.
4441
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4442
+ * @returns Array of the persisted records in order (if a record could not be found null is returned).
4443
+ */
4444
+ abstract update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4445
+ /**
4446
+ * Partially updates multiple records.
4447
+ * @param objects An array of objects with their ids and columns to be updated.
4448
+ * @returns Array of the persisted records in order (if a record could not be found null is returned).
4449
+ */
4450
+ abstract update(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4451
+ /**
4452
+ * Partially update a single record.
4453
+ * @param object An object with its id and the columns to be updated.
4454
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4455
+ * @returns The full persisted record.
4456
+ * @throws If the record could not be found.
4457
+ */
4458
+ abstract updateOrThrow<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4459
+ /**
4460
+ * Partially update a single record.
4461
+ * @param object An object with its id and the columns to be updated.
4462
+ * @returns The full persisted record.
4463
+ * @throws If the record could not be found.
4464
+ */
4465
+ abstract updateOrThrow(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4466
+ /**
4467
+ * Partially update a single record given its unique id.
4468
+ * @param id The unique id.
4469
+ * @param object The column names and their values that have to be updated.
4470
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
2995
4471
  * @returns The full persisted record.
4472
+ * @throws If the record could not be found.
2996
4473
  */
2997
- abstract update(object: Partial<EditableData<Data>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4474
+ abstract updateOrThrow<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
2998
4475
  /**
2999
4476
  * Partially update a single record given its unique id.
3000
4477
  * @param id The unique id.
3001
4478
  * @param object The column names and their values that have to be updated.
3002
4479
  * @returns The full persisted record.
4480
+ * @throws If the record could not be found.
3003
4481
  */
3004
- abstract update(id: string, object: Partial<EditableData<Data>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4482
+ abstract updateOrThrow(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3005
4483
  /**
3006
4484
  * Partially updates multiple records.
3007
4485
  * @param objects An array of objects with their ids and columns to be updated.
3008
- * @returns Array of the persisted records.
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.
4488
+ * @throws If one or more records could not be found.
4489
+ */
4490
+ abstract updateOrThrow<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4491
+ /**
4492
+ * Partially updates multiple records.
4493
+ * @param objects An array of objects with their ids and columns to be updated.
4494
+ * @returns Array of the persisted records in order.
4495
+ * @throws If one or more records could not be found.
4496
+ */
4497
+ abstract updateOrThrow(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4498
+ /**
4499
+ * Creates or updates a single record. If a record exists with the given id,
4500
+ * it will be update, otherwise a new record will be created.
4501
+ * @param object Object containing the column names with their values to be persisted in the table.
4502
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4503
+ * @returns The full persisted record.
3009
4504
  */
3010
- abstract update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4505
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Record> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3011
4506
  /**
3012
4507
  * Creates or updates a single record. If a record exists with the given id,
3013
4508
  * it will be update, otherwise a new record will be created.
3014
4509
  * @param object Object containing the column names with their values to be persisted in the table.
3015
4510
  * @returns The full persisted record.
3016
4511
  */
3017
- abstract createOrUpdate(object: EditableData<Data> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4512
+ abstract createOrUpdate(object: EditableData<Record> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3018
4513
  /**
3019
4514
  * Creates or updates a single record. If a record exists with the given id,
3020
4515
  * it will be update, otherwise a new record will be created.
3021
4516
  * @param id A unique id.
3022
4517
  * @param object The column names and the values to be persisted.
4518
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3023
4519
  * @returns The full persisted record.
3024
4520
  */
3025
- abstract createOrUpdate(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4521
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4522
+ /**
4523
+ * Creates or updates a single record. If a record exists with the given id,
4524
+ * it will be update, otherwise a new record will be created.
4525
+ * @param id A unique id.
4526
+ * @param object The column names and the values to be persisted.
4527
+ * @returns The full persisted record.
4528
+ */
4529
+ abstract createOrUpdate(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4530
+ /**
4531
+ * Creates or updates a single record. If a record exists with the given id,
4532
+ * it will be update, otherwise a new record will be created.
4533
+ * @param objects Array of objects with the column names and the values to be stored in the table.
4534
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4535
+ * @returns Array of the persisted records.
4536
+ */
4537
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3026
4538
  /**
3027
4539
  * Creates or updates a single record. If a record exists with the given id,
3028
4540
  * it will be update, otherwise a new record will be created.
3029
4541
  * @param objects Array of objects with the column names and the values to be stored in the table.
3030
4542
  * @returns Array of the persisted records.
3031
4543
  */
3032
- abstract createOrUpdate(objects: Array<EditableData<Data> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4544
+ abstract createOrUpdate(objects: Array<EditableData<Record> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4545
+ /**
4546
+ * Deletes a record given its unique id.
4547
+ * @param object An object with a unique id.
4548
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4549
+ * @returns The deleted record, null if the record could not be found.
4550
+ */
4551
+ abstract delete<K extends SelectableColumn<Record>>(object: Identifiable & Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3033
4552
  /**
3034
4553
  * Deletes a record given its unique id.
4554
+ * @param object An object with a unique id.
4555
+ * @returns The deleted record, null if the record could not be found.
4556
+ */
4557
+ abstract delete(object: Identifiable & Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4558
+ /**
4559
+ * Deletes a record given a unique id.
4560
+ * @param id The unique id.
4561
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4562
+ * @returns The deleted record, null if the record could not be found.
4563
+ */
4564
+ abstract delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4565
+ /**
4566
+ * Deletes a record given a unique id.
3035
4567
  * @param id The unique id.
3036
- * @throws If the record could not be found or there was an error while performing the deletion.
4568
+ * @returns The deleted record, null if the record could not be found.
4569
+ */
4570
+ abstract delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4571
+ /**
4572
+ * Deletes multiple records given an array of objects with ids.
4573
+ * @param objects An array of objects with unique ids.
4574
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4575
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4576
+ */
4577
+ abstract delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4578
+ /**
4579
+ * Deletes multiple records given an array of objects with ids.
4580
+ * @param objects An array of objects with unique ids.
4581
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4582
+ */
4583
+ abstract delete(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4584
+ /**
4585
+ * Deletes multiple records given an array of unique ids.
4586
+ * @param objects An array of ids.
4587
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4588
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4589
+ */
4590
+ abstract delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4591
+ /**
4592
+ * Deletes multiple records given an array of unique ids.
4593
+ * @param objects An array of ids.
4594
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4595
+ */
4596
+ abstract delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4597
+ /**
4598
+ * Deletes a record given its unique id.
4599
+ * @param object An object with a unique id.
4600
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4601
+ * @returns The deleted record, null if the record could not be found.
4602
+ * @throws If the record could not be found.
3037
4603
  */
3038
- abstract delete(id: string): Promise<void>;
4604
+ abstract deleteOrThrow<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3039
4605
  /**
3040
4606
  * Deletes a record given its unique id.
3041
- * @param id An object with a unique id.
3042
- * @throws If the record could not be found or there was an error while performing the deletion.
4607
+ * @param object An object with a unique id.
4608
+ * @returns The deleted record, null if the record could not be found.
4609
+ * @throws If the record could not be found.
3043
4610
  */
3044
- abstract delete(id: Identifiable): Promise<void>;
4611
+ abstract deleteOrThrow(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3045
4612
  /**
3046
- * Deletes a record given a list of unique ids.
3047
- * @param ids The array of unique ids.
3048
- * @throws If the record could not be found or there was an error while performing the deletion.
4613
+ * Deletes a record given a unique id.
4614
+ * @param id The unique id.
4615
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4616
+ * @returns The deleted record, null if the record could not be found.
4617
+ * @throws If the record could not be found.
4618
+ */
4619
+ abstract deleteOrThrow<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4620
+ /**
4621
+ * Deletes a record given a unique id.
4622
+ * @param id The unique id.
4623
+ * @returns The deleted record, null if the record could not be found.
4624
+ * @throws If the record could not be found.
4625
+ */
4626
+ abstract deleteOrThrow(id: string): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4627
+ /**
4628
+ * Deletes multiple records given an array of objects with ids.
4629
+ * @param objects An array of objects with unique ids.
4630
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4631
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4632
+ * @throws If one or more records could not be found.
4633
+ */
4634
+ abstract deleteOrThrow<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
4635
+ /**
4636
+ * Deletes multiple records given an array of objects with ids.
4637
+ * @param objects An array of objects with unique ids.
4638
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4639
+ * @throws If one or more records could not be found.
3049
4640
  */
3050
- abstract delete(ids: string[]): Promise<void>;
4641
+ abstract deleteOrThrow(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3051
4642
  /**
3052
- * Deletes a record given a list of unique ids.
3053
- * @param ids An array of objects with unique ids.
3054
- * @throws If the record could not be found or there was an error while performing the deletion.
4643
+ * Deletes multiple records given an array of unique ids.
4644
+ * @param objects An array of ids.
4645
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4646
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4647
+ * @throws If one or more records could not be found.
3055
4648
  */
3056
- abstract delete(ids: Identifiable[]): Promise<void>;
4649
+ abstract deleteOrThrow<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
4650
+ /**
4651
+ * Deletes multiple records given an array of unique ids.
4652
+ * @param objects An array of ids.
4653
+ * @returns Array of the deleted records in order.
4654
+ * @throws If one or more records could not be found.
4655
+ */
4656
+ abstract deleteOrThrow(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3057
4657
  /**
3058
4658
  * Search for records in the table.
3059
4659
  * @param query The query to search for.
@@ -3061,36 +4661,152 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3061
4661
  * @returns The found records.
3062
4662
  */
3063
4663
  abstract search(query: string, options?: {
3064
- fuzziness?: number;
3065
- }): Promise<SelectedPick<Record, ['*']>[]>;
4664
+ fuzziness?: FuzzinessExpression;
4665
+ prefix?: PrefixExpression;
4666
+ highlight?: HighlightExpression;
4667
+ filter?: Filter<Record>;
4668
+ boosters?: Boosters<Record>[];
4669
+ }): Promise<SearchXataRecord<SelectedPick<Record, ['*']>>[]>;
3066
4670
  abstract query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3067
4671
  }
3068
- declare class RestRepository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Data, Record> {
4672
+ declare class RestRepository<Record extends XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Record> {
3069
4673
  #private;
3070
- db: SchemaPluginResult<any>;
3071
4674
  constructor(options: {
3072
4675
  table: string;
3073
- links?: LinkDictionary;
3074
- getFetchProps: () => Promise<FetcherExtraProps>;
3075
4676
  db: SchemaPluginResult<any>;
4677
+ pluginOptions: XataPluginOptions;
4678
+ schemaTables?: Table[];
3076
4679
  });
3077
- create(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3078
- create(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3079
- create(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3080
- read(recordId: string): Promise<SelectedPick<Record, ['*']> | null>;
3081
- update(object: Partial<EditableData<Data>> & Identifiable): Promise<SelectedPick<Record, ['*']>>;
3082
- update(recordId: string, object: Partial<EditableData<Data>>): Promise<SelectedPick<Record, ['*']>>;
3083
- update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<SelectedPick<Record, ['*']>[]>;
3084
- createOrUpdate(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3085
- createOrUpdate(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3086
- createOrUpdate(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3087
- delete(recordId: string | Identifiable | Array<string | Identifiable>): Promise<void>;
4680
+ create<K extends SelectableColumn<Record>>(object: EditableData<Record> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4681
+ create(object: EditableData<Record> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4682
+ create<K extends SelectableColumn<Record>>(id: string, object: EditableData<Record>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4683
+ create(id: string, object: EditableData<Record>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4684
+ create<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4685
+ create(objects: Array<EditableData<Record> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4686
+ read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
4687
+ read(id: string): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4688
+ read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4689
+ read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4690
+ read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
4691
+ read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4692
+ read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4693
+ read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4694
+ readOrThrow<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4695
+ readOrThrow(id: string): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4696
+ readOrThrow<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
4697
+ readOrThrow(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
4698
+ readOrThrow<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4699
+ readOrThrow(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4700
+ readOrThrow<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
4701
+ readOrThrow(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
4702
+ update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4703
+ update(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4704
+ update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4705
+ update(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4706
+ update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4707
+ update(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4708
+ updateOrThrow<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4709
+ updateOrThrow(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4710
+ updateOrThrow<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4711
+ updateOrThrow(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4712
+ updateOrThrow<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4713
+ updateOrThrow(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4714
+ createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Record> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4715
+ createOrUpdate(object: EditableData<Record> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4716
+ createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4717
+ createOrUpdate(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4718
+ createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4719
+ createOrUpdate(objects: Array<EditableData<Record> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4720
+ delete<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4721
+ delete(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4722
+ delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4723
+ delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4724
+ delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4725
+ delete(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4726
+ delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4727
+ delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4728
+ deleteOrThrow<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4729
+ deleteOrThrow(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4730
+ deleteOrThrow<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4731
+ deleteOrThrow(id: string): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4732
+ deleteOrThrow<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
4733
+ deleteOrThrow(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
4734
+ deleteOrThrow<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
4735
+ deleteOrThrow(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3088
4736
  search(query: string, options?: {
3089
- fuzziness?: number;
3090
- }): Promise<SelectedPick<Record, ['*']>[]>;
4737
+ fuzziness?: FuzzinessExpression;
4738
+ prefix?: PrefixExpression;
4739
+ highlight?: HighlightExpression;
4740
+ filter?: Filter<Record>;
4741
+ boosters?: Boosters<Record>[];
4742
+ }): Promise<any>;
3091
4743
  query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3092
4744
  }
3093
4745
 
4746
+ declare type BaseSchema = {
4747
+ name: string;
4748
+ columns: readonly ({
4749
+ name: string;
4750
+ type: Column['type'];
4751
+ notNull?: boolean;
4752
+ } | {
4753
+ name: string;
4754
+ type: 'link';
4755
+ link: {
4756
+ table: string;
4757
+ };
4758
+ } | {
4759
+ name: string;
4760
+ type: 'object';
4761
+ columns: {
4762
+ name: string;
4763
+ type: string;
4764
+ }[];
4765
+ })[];
4766
+ };
4767
+ declare type SchemaInference<T extends readonly BaseSchema[]> = T extends never[] ? Record<string, Record<string, any>> : T extends readonly unknown[] ? T[number] extends {
4768
+ name: string;
4769
+ columns: readonly unknown[];
4770
+ } ? {
4771
+ [K in T[number]['name']]: TableType<T[number], K>;
4772
+ } : never : never;
4773
+ declare type TableType<Tables, TableName> = Tables & {
4774
+ name: TableName;
4775
+ } extends infer Table ? Table extends {
4776
+ name: string;
4777
+ columns: infer Columns;
4778
+ } ? Columns extends readonly unknown[] ? Columns[number] extends {
4779
+ name: string;
4780
+ type: string;
4781
+ } ? Identifiable & UnionToIntersection<Values<{
4782
+ [K in Columns[number]['name']]: PropertyType<Tables, Columns[number], K>;
4783
+ }>> : never : never : never : never;
4784
+ declare type PropertyType<Tables, Properties, PropertyName extends PropertyKey> = Properties & {
4785
+ name: PropertyName;
4786
+ } extends infer Property ? Property extends {
4787
+ name: string;
4788
+ type: infer Type;
4789
+ link?: {
4790
+ table: infer LinkedTable;
4791
+ };
4792
+ columns?: infer ObjectColumns;
4793
+ notNull?: infer NotNull;
4794
+ } ? NotNull extends true ? {
4795
+ [K in PropertyName]: InnerType<Type, ObjectColumns, Tables, LinkedTable>;
4796
+ } : {
4797
+ [K in PropertyName]?: InnerType<Type, ObjectColumns, Tables, LinkedTable> | null;
4798
+ } : never : never;
4799
+ 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 {
4800
+ name: string;
4801
+ type: string;
4802
+ } ? UnionToIntersection<Values<{
4803
+ [K in ObjectColumns[number]['name']]: PropertyType<Tables, ObjectColumns[number], K>;
4804
+ }>> : never : never : Type extends 'link' ? TableType<Tables, LinkedTable> & XataRecord : never;
4805
+
4806
+ /**
4807
+ * Operator to restrict results to only values that are greater than the given value.
4808
+ */
4809
+ declare const greaterThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3094
4810
  /**
3095
4811
  * Operator to restrict results to only values that are greater than the given value.
3096
4812
  */
@@ -3098,15 +4814,35 @@ declare const gt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T
3098
4814
  /**
3099
4815
  * Operator to restrict results to only values that are greater than or equal to the given value.
3100
4816
  */
3101
- declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4817
+ declare const greaterThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4818
+ /**
4819
+ * Operator to restrict results to only values that are greater than or equal to the given value.
4820
+ */
4821
+ declare const greaterEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3102
4822
  /**
3103
4823
  * Operator to restrict results to only values that are greater than or equal to the given value.
3104
4824
  */
3105
4825
  declare const gte: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4826
+ /**
4827
+ * Operator to restrict results to only values that are greater than or equal to the given value.
4828
+ */
4829
+ declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4830
+ /**
4831
+ * Operator to restrict results to only values that are lower than the given value.
4832
+ */
4833
+ declare const lessThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3106
4834
  /**
3107
4835
  * Operator to restrict results to only values that are lower than the given value.
3108
4836
  */
3109
4837
  declare const lt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4838
+ /**
4839
+ * Operator to restrict results to only values that are lower than or equal to the given value.
4840
+ */
4841
+ declare const lessThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4842
+ /**
4843
+ * Operator to restrict results to only values that are lower than or equal to the given value.
4844
+ */
4845
+ declare const lessEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3110
4846
  /**
3111
4847
  * Operator to restrict results to only values that are lower than or equal to the given value.
3112
4848
  */
@@ -3139,6 +4875,10 @@ declare const pattern: (value: string) => StringTypeFilter;
3139
4875
  * Operator to restrict results to only values that are equal to the given value.
3140
4876
  */
3141
4877
  declare const is: <T>(value: T) => PropertyFilter<T>;
4878
+ /**
4879
+ * Operator to restrict results to only values that are equal to the given value.
4880
+ */
4881
+ declare const equals: <T>(value: T) => PropertyFilter<T>;
3142
4882
  /**
3143
4883
  * Operator to restrict results to only values that are not equal to the given value.
3144
4884
  */
@@ -3166,46 +4906,15 @@ declare const includesAny: <T>(value: T) => ArrayFilter<T>;
3166
4906
 
3167
4907
  declare type SchemaDefinition = {
3168
4908
  table: string;
3169
- links?: LinkDictionary;
3170
4909
  };
3171
- declare type SchemaPluginResult<Schemas extends Record<string, BaseData>> = {
4910
+ declare type SchemaPluginResult<Schemas extends Record<string, XataRecord>> = {
3172
4911
  [Key in keyof Schemas]: Repository<Schemas[Key]>;
3173
4912
  };
3174
- declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
3175
- #private;
3176
- private links?;
3177
- private tableNames?;
3178
- constructor(links?: LinkDictionary | undefined, tableNames?: string[] | undefined);
3179
- build(options: XataPluginOptions): SchemaPluginResult<Schemas>;
3180
- }
3181
-
3182
- declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3183
- fuzziness?: number;
3184
- tables?: Tables[];
3185
- };
3186
- declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3187
- all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3188
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]: {
3189
- table: Model;
3190
- record: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>>;
3191
- };
3192
- }>[]>;
3193
- byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3194
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]?: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>[]>;
3195
- }>;
3196
- };
3197
- declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
4913
+ declare class SchemaPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin {
3198
4914
  #private;
3199
- private db;
3200
- private links;
3201
- constructor(db: SchemaPluginResult<Schemas>, links: LinkDictionary);
3202
- build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
4915
+ constructor(schemaTables?: Schemas.Table[]);
4916
+ build(pluginOptions: XataPluginOptions): SchemaPluginResult<Schemas>;
3203
4917
  }
3204
- declare type SearchXataRecord = XataRecord & {
3205
- xata: {
3206
- table: string;
3207
- };
3208
- };
3209
4918
 
3210
4919
  declare type BranchStrategyValue = string | undefined | null;
3211
4920
  declare type BranchStrategyBuilder = () => BranchStrategyValue | Promise<BranchStrategyValue>;
@@ -3217,20 +4926,36 @@ declare type BaseClientOptions = {
3217
4926
  apiKey?: string;
3218
4927
  databaseURL?: string;
3219
4928
  branch?: BranchStrategyOption;
4929
+ cache?: CacheImpl;
4930
+ trace?: TraceFunction;
3220
4931
  };
3221
4932
  declare const buildClient: <Plugins extends Record<string, XataPlugin> = {}>(plugins?: Plugins | undefined) => ClientConstructor<Plugins>;
3222
4933
  interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
3223
- new <Schemas extends Record<string, BaseData>>(options?: Partial<BaseClientOptions>, links?: LinkDictionary): Omit<{
4934
+ new <Schemas extends Record<string, XataRecord> = {}>(options?: Partial<BaseClientOptions>, schemaTables?: readonly BaseSchema[]): Omit<{
3224
4935
  db: Awaited<ReturnType<SchemaPlugin<Schemas>['build']>>;
3225
4936
  search: Awaited<ReturnType<SearchPlugin<Schemas>['build']>>;
3226
4937
  }, keyof Plugins> & {
3227
4938
  [Key in StringKeys<NonNullable<Plugins>>]: Awaited<ReturnType<NonNullable<Plugins>[Key]['build']>>;
4939
+ } & {
4940
+ getConfig(): Promise<{
4941
+ databaseURL: string;
4942
+ branch: string;
4943
+ }>;
3228
4944
  };
3229
4945
  }
3230
4946
  declare const BaseClient_base: ClientConstructor<{}>;
3231
4947
  declare class BaseClient extends BaseClient_base<Record<string, any>> {
3232
4948
  }
3233
4949
 
4950
+ declare class Serializer {
4951
+ classes: Record<string, any>;
4952
+ add(clazz: any): void;
4953
+ toJSON<T>(data: T): string;
4954
+ fromJSON<T>(json: string): T;
4955
+ }
4956
+ declare const serialize: <T>(data: T) => string;
4957
+ declare const deserialize: <T>(json: string) => T;
4958
+
3234
4959
  declare type BranchResolutionOptions = {
3235
4960
  databaseURL?: string;
3236
4961
  apiKey?: string;
@@ -3242,9 +4967,89 @@ declare function getDatabaseURL(): string | undefined;
3242
4967
 
3243
4968
  declare function getAPIKey(): string | undefined;
3244
4969
 
4970
+ interface Body {
4971
+ arrayBuffer(): Promise<ArrayBuffer>;
4972
+ blob(): Promise<Blob>;
4973
+ formData(): Promise<FormData>;
4974
+ json(): Promise<any>;
4975
+ text(): Promise<string>;
4976
+ }
4977
+ interface Blob {
4978
+ readonly size: number;
4979
+ readonly type: string;
4980
+ arrayBuffer(): Promise<ArrayBuffer>;
4981
+ slice(start?: number, end?: number, contentType?: string): Blob;
4982
+ text(): Promise<string>;
4983
+ }
4984
+ /** Provides information about files and allows JavaScript in a web page to access their content. */
4985
+ interface File extends Blob {
4986
+ readonly lastModified: number;
4987
+ readonly name: string;
4988
+ readonly webkitRelativePath: string;
4989
+ }
4990
+ declare type FormDataEntryValue = File | string;
4991
+ /** 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". */
4992
+ interface FormData {
4993
+ append(name: string, value: string | Blob, fileName?: string): void;
4994
+ delete(name: string): void;
4995
+ get(name: string): FormDataEntryValue | null;
4996
+ getAll(name: string): FormDataEntryValue[];
4997
+ has(name: string): boolean;
4998
+ set(name: string, value: string | Blob, fileName?: string): void;
4999
+ forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void;
5000
+ }
5001
+ /** 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. */
5002
+ interface Headers {
5003
+ append(name: string, value: string): void;
5004
+ delete(name: string): void;
5005
+ get(name: string): string | null;
5006
+ has(name: string): boolean;
5007
+ set(name: string, value: string): void;
5008
+ forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void;
5009
+ }
5010
+ interface Request extends Body {
5011
+ /** Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching. */
5012
+ readonly cache: 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload';
5013
+ /** 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. */
5014
+ readonly credentials: 'include' | 'omit' | 'same-origin';
5015
+ /** Returns the kind of resource requested by request, e.g., "document" or "script". */
5016
+ readonly destination: '' | 'audio' | 'audioworklet' | 'document' | 'embed' | 'font' | 'frame' | 'iframe' | 'image' | 'manifest' | 'object' | 'paintworklet' | 'report' | 'script' | 'sharedworker' | 'style' | 'track' | 'video' | 'worker' | 'xslt';
5017
+ /** 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. */
5018
+ readonly headers: Headers;
5019
+ /** 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] */
5020
+ readonly integrity: string;
5021
+ /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
5022
+ readonly keepalive: boolean;
5023
+ /** Returns request's HTTP method, which is "GET" by default. */
5024
+ readonly method: string;
5025
+ /** 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. */
5026
+ readonly mode: 'cors' | 'navigate' | 'no-cors' | 'same-origin';
5027
+ /** 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. */
5028
+ readonly redirect: 'error' | 'follow' | 'manual';
5029
+ /** 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. */
5030
+ readonly referrer: string;
5031
+ /** Returns the referrer policy associated with request. This is used during fetching to compute the value of the request's referrer. */
5032
+ readonly referrerPolicy: '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
5033
+ /** Returns the URL of request as a string. */
5034
+ readonly url: string;
5035
+ clone(): Request;
5036
+ }
5037
+
5038
+ declare type XataWorkerContext<XataClient> = {
5039
+ xata: XataClient;
5040
+ request: Request;
5041
+ env: Record<string, string | undefined>;
5042
+ };
5043
+ declare type RemoveFirst<T> = T extends [any, ...infer U] ? U : never;
5044
+ declare type WorkerRunnerConfig = {
5045
+ workspace: string;
5046
+ worker: string;
5047
+ };
5048
+ 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>>>;
5049
+
3245
5050
  declare class XataError extends Error {
3246
5051
  readonly status: number;
3247
5052
  constructor(message: string, status: number);
3248
5053
  }
3249
5054
 
3250
- export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, AddTableColumnError, AddTableColumnPathParams, AddTableColumnVariables, BaseClient, BaseClientOptions, BaseData, BulkInsertTableRecordsError, BulkInsertTableRecordsPathParams, BulkInsertTableRecordsRequestBody, BulkInsertTableRecordsResponse, BulkInsertTableRecordsVariables, CancelWorkspaceMemberInviteError, CancelWorkspaceMemberInvitePathParams, CancelWorkspaceMemberInviteVariables, ClientConstructor, CreateBranchError, CreateBranchPathParams, CreateBranchQueryParams, CreateBranchRequestBody, CreateBranchVariables, CreateDatabaseError, CreateDatabasePathParams, CreateDatabaseRequestBody, CreateDatabaseResponse, CreateDatabaseVariables, CreateTableError, CreateTablePathParams, CreateTableVariables, CreateUserAPIKeyError, CreateUserAPIKeyPathParams, CreateUserAPIKeyResponse, CreateUserAPIKeyVariables, CreateWorkspaceError, CreateWorkspaceVariables, CursorNavigationOptions, DeleteBranchError, DeleteBranchPathParams, DeleteBranchVariables, DeleteColumnError, DeleteColumnPathParams, DeleteColumnVariables, DeleteDatabaseError, DeleteDatabasePathParams, DeleteDatabaseVariables, DeleteRecordError, DeleteRecordPathParams, DeleteRecordVariables, DeleteTableError, DeleteTablePathParams, DeleteTableVariables, DeleteUserAPIKeyError, DeleteUserAPIKeyPathParams, DeleteUserAPIKeyVariables, DeleteUserError, DeleteUserVariables, DeleteWorkspaceError, DeleteWorkspacePathParams, DeleteWorkspaceVariables, EditableData, ExecuteBranchMigrationPlanError, ExecuteBranchMigrationPlanPathParams, ExecuteBranchMigrationPlanRequestBody, ExecuteBranchMigrationPlanVariables, FetchImpl, FetcherExtraProps, GetBranchDetailsError, GetBranchDetailsPathParams, GetBranchDetailsVariables, GetBranchListError, GetBranchListPathParams, GetBranchListVariables, GetBranchMetadataError, GetBranchMetadataPathParams, GetBranchMetadataVariables, GetBranchMigrationHistoryError, GetBranchMigrationHistoryPathParams, GetBranchMigrationHistoryRequestBody, GetBranchMigrationHistoryResponse, GetBranchMigrationHistoryVariables, GetBranchMigrationPlanError, GetBranchMigrationPlanPathParams, GetBranchMigrationPlanVariables, GetBranchStatsError, GetBranchStatsPathParams, GetBranchStatsResponse, GetBranchStatsVariables, GetColumnError, GetColumnPathParams, GetColumnVariables, GetDatabaseListError, GetDatabaseListPathParams, GetDatabaseListVariables, GetRecordError, GetRecordPathParams, GetRecordRequestBody, GetRecordVariables, GetTableColumnsError, GetTableColumnsPathParams, GetTableColumnsResponse, GetTableColumnsVariables, GetTableSchemaError, GetTableSchemaPathParams, GetTableSchemaResponse, GetTableSchemaVariables, GetUserAPIKeysError, GetUserAPIKeysResponse, GetUserAPIKeysVariables, GetUserError, GetUserVariables, GetWorkspaceError, GetWorkspaceMembersListError, GetWorkspaceMembersListPathParams, GetWorkspaceMembersListVariables, GetWorkspacePathParams, GetWorkspaceVariables, GetWorkspacesListError, GetWorkspacesListResponse, GetWorkspacesListVariables, Identifiable, InsertRecordError, InsertRecordPathParams, InsertRecordResponse, InsertRecordVariables, InsertRecordWithIDError, InsertRecordWithIDPathParams, InsertRecordWithIDQueryParams, InsertRecordWithIDVariables, InviteWorkspaceMemberError, InviteWorkspaceMemberPathParams, InviteWorkspaceMemberRequestBody, InviteWorkspaceMemberVariables, LinkDictionary, OffsetNavigationOptions, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Paginable, PaginationOptions, PaginationQueryMeta, Query, QueryTableError, QueryTablePathParams, QueryTableRequestBody, QueryTableVariables, RemoveWorkspaceMemberError, RemoveWorkspaceMemberPathParams, RemoveWorkspaceMemberVariables, Repository, ResendWorkspaceMemberInviteError, ResendWorkspaceMemberInvitePathParams, ResendWorkspaceMemberInviteVariables, responses as Responses, RestRepository, SchemaDefinition, SchemaPlugin, SchemaPluginResult, schemas as Schemas, SearchBranchError, SearchBranchPathParams, SearchBranchRequestBody, SearchBranchVariables, SearchOptions, SearchPlugin, SearchPluginResult, SelectableColumn, SelectedPick, SetTableSchemaError, SetTableSchemaPathParams, SetTableSchemaRequestBody, SetTableSchemaVariables, UpdateBranchMetadataError, UpdateBranchMetadataPathParams, UpdateBranchMetadataVariables, UpdateColumnError, UpdateColumnPathParams, UpdateColumnRequestBody, UpdateColumnVariables, UpdateRecordWithIDError, UpdateRecordWithIDPathParams, UpdateRecordWithIDQueryParams, UpdateRecordWithIDVariables, UpdateTableError, UpdateTablePathParams, UpdateTableRequestBody, UpdateTableVariables, UpdateUserError, UpdateUserVariables, UpdateWorkspaceError, UpdateWorkspaceMemberRoleError, UpdateWorkspaceMemberRolePathParams, UpdateWorkspaceMemberRoleRequestBody, UpdateWorkspaceMemberRoleVariables, UpdateWorkspacePathParams, UpdateWorkspaceVariables, UpsertRecordWithIDError, UpsertRecordWithIDPathParams, UpsertRecordWithIDQueryParams, UpsertRecordWithIDVariables, ValueAtColumn, XataApiClient, XataApiClientOptions, XataApiPlugin, XataError, XataPlugin, XataPluginOptions, XataRecord, acceptWorkspaceMemberInvite, addTableColumn, buildClient, bulkInsertTableRecords, cancelWorkspaceMemberInvite, contains, createBranch, createDatabase, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, endsWith, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseURL, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isIdentifiable, isNot, isXataRecord, le, lt, lte, notExists, operationsByTag, pattern, queryTable, removeWorkspaceMember, resendWorkspaceMemberInvite, searchBranch, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberRole, upsertRecordWithID };
5055
+ 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, 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, updateBranchMetadata, updateBranchSchema, updateColumn, updateDatabaseMetadata, updateMigrationRequest, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };