@xata.io/client 0.0.0-alpha.vf7b5320 → 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,14 +10,19 @@ declare type FetchImpl = (url: string, init?: {
5
10
  }) => Promise<{
6
11
  ok: boolean;
7
12
  status: number;
13
+ url: string;
8
14
  json(): Promise<any>;
15
+ headers?: {
16
+ get(name: string): string | null;
17
+ };
9
18
  }>;
10
- declare type WorkspaceApiUrlBuilder = (path: string, pathParams: Record<string, string>) => string;
19
+ declare type WorkspaceApiUrlBuilder = (path: string, pathParams: Partial<Record<string, string | number>>) => string;
11
20
  declare type FetcherExtraProps = {
12
21
  apiUrl: string;
13
22
  workspacesApiUrl: string | WorkspaceApiUrlBuilder;
14
23
  fetchImpl: FetchImpl;
15
24
  apiKey: string;
25
+ trace: TraceFunction;
16
26
  };
17
27
  declare type ErrorWrapper<TError> = TError | {
18
28
  status: 'unknown';
@@ -20,7 +30,6 @@ declare type ErrorWrapper<TError> = TError | {
20
30
  };
21
31
 
22
32
  interface CacheImpl {
23
- cacheRecords: boolean;
24
33
  defaultQueryTTL: number;
25
34
  getAll(): Promise<Record<string, unknown>>;
26
35
  get: <T>(key: string) => Promise<T | null>;
@@ -30,13 +39,11 @@ interface CacheImpl {
30
39
  }
31
40
  interface SimpleCacheOptions {
32
41
  max?: number;
33
- cacheRecords?: boolean;
34
42
  defaultQueryTTL?: number;
35
43
  }
36
44
  declare class SimpleCache implements CacheImpl {
37
45
  #private;
38
46
  capacity: number;
39
- cacheRecords: boolean;
40
47
  defaultQueryTTL: number;
41
48
  constructor(options?: SimpleCacheOptions);
42
49
  getAll(): Promise<Record<string, unknown>>;
@@ -52,6 +59,7 @@ declare abstract class XataPlugin {
52
59
  declare type XataPluginOptions = {
53
60
  getFetchProps: () => Promise<FetcherExtraProps>;
54
61
  cache: CacheImpl;
62
+ trace?: TraceFunction;
55
63
  };
56
64
 
57
65
  /**
@@ -91,7 +99,7 @@ declare type WorkspaceID = string;
91
99
  declare type Role = 'owner' | 'maintainer';
92
100
  declare type WorkspaceMeta = {
93
101
  name: string;
94
- slug: string;
102
+ slug?: string;
95
103
  };
96
104
  declare type Workspace = WorkspaceMeta & {
97
105
  id: WorkspaceID;
@@ -122,20 +130,22 @@ declare type WorkspaceMembers = {
122
130
  * @pattern ^ik_[a-zA-Z0-9]+
123
131
  */
124
132
  declare type InviteKey = string;
133
+ /**
134
+ * Metadata of databases
135
+ */
136
+ declare type DatabaseMetadata = {
137
+ name: string;
138
+ createdAt: DateTime;
139
+ numberOfBranches: number;
140
+ ui?: {
141
+ color?: string;
142
+ };
143
+ };
125
144
  declare type ListDatabasesResponse = {
126
- databases?: {
127
- name: string;
128
- displayName: string;
129
- createdAt: DateTime;
130
- numberOfBranches: number;
131
- ui?: {
132
- color?: string;
133
- };
134
- }[];
145
+ databases?: DatabaseMetadata[];
135
146
  };
136
147
  declare type ListBranchesResponse = {
137
148
  databaseName: string;
138
- displayName: string;
139
149
  branches: Branch[];
140
150
  };
141
151
  declare type ListGitBranchesResponse = {
@@ -181,12 +191,28 @@ declare type Schema = {
181
191
  tables: Table[];
182
192
  tablesOrder?: string[];
183
193
  };
194
+ /**
195
+ * @x-internal true
196
+ */
197
+ declare type SchemaEditScript = {
198
+ sourceMigrationID?: string;
199
+ targetMigrationID?: string;
200
+ tables: TableEdit[];
201
+ };
184
202
  declare type Table = {
185
203
  id?: string;
186
204
  name: TableName;
187
205
  columns: Column[];
188
206
  revLinks?: RevLink[];
189
207
  };
208
+ /**
209
+ * @x-internal true
210
+ */
211
+ declare type TableEdit = {
212
+ oldName?: string;
213
+ newName?: string;
214
+ columns?: MigrationColumnOp[];
215
+ };
190
216
  /**
191
217
  * @x-go-type xata.Column
192
218
  */
@@ -196,6 +222,8 @@ declare type Column = {
196
222
  link?: {
197
223
  table: string;
198
224
  };
225
+ notNull?: boolean;
226
+ unique?: boolean;
199
227
  columns?: Column[];
200
228
  };
201
229
  declare type RevLink = {
@@ -262,12 +290,135 @@ declare type ColumnMigration = {
262
290
  old: Column;
263
291
  ['new']: Column;
264
292
  };
293
+ /**
294
+ * @x-internal true
295
+ */
296
+ declare type Commit = {
297
+ meta?: {
298
+ title?: string;
299
+ message?: string;
300
+ id: string;
301
+ parentID?: string;
302
+ mergeParentID?: string;
303
+ status: string;
304
+ createdAt: DateTime;
305
+ modifiedAt?: DateTime;
306
+ };
307
+ operations: MigrationOp[];
308
+ };
309
+ /**
310
+ * Branch schema migration.
311
+ *
312
+ * @x-internal true
313
+ */
314
+ declare type Migration = {
315
+ parentID?: string;
316
+ operations: MigrationOp[];
317
+ };
318
+ /**
319
+ * Branch schema migration operations.
320
+ *
321
+ * @x-internal true
322
+ */
323
+ declare type MigrationOp = MigrationTableOp | MigrationColumnOp;
324
+ /**
325
+ * @x-internal true
326
+ */
327
+ declare type MigrationTableOp = {
328
+ addTable: TableOpAdd;
329
+ } | {
330
+ removeTable: TableOpRemove;
331
+ } | {
332
+ renameTable: TableOpRename;
333
+ };
334
+ /**
335
+ * @x-internal true
336
+ */
337
+ declare type MigrationColumnOp = {
338
+ addColumn: ColumnOpAdd;
339
+ } | {
340
+ removeColumn: ColumnOpRemove;
341
+ } | {
342
+ renameColumn: ColumnOpRename;
343
+ };
344
+ /**
345
+ * @x-internal true
346
+ */
347
+ declare type TableOpAdd = {
348
+ table: string;
349
+ };
350
+ /**
351
+ * @x-internal true
352
+ */
353
+ declare type TableOpRemove = {
354
+ table: string;
355
+ };
356
+ /**
357
+ * @x-internal true
358
+ */
359
+ declare type TableOpRename = {
360
+ oldName: string;
361
+ newName: string;
362
+ };
363
+ /**
364
+ * @x-internal true
365
+ */
366
+ declare type ColumnOpAdd = {
367
+ table?: string;
368
+ column: Column;
369
+ };
370
+ /**
371
+ * @x-internal true
372
+ */
373
+ declare type ColumnOpRemove = {
374
+ table?: string;
375
+ column: string;
376
+ };
377
+ /**
378
+ * @x-internal true
379
+ */
380
+ declare type ColumnOpRename = {
381
+ table?: string;
382
+ oldName: string;
383
+ newName: string;
384
+ };
385
+ declare type MigrationRequest = {
386
+ number: number;
387
+ createdAt: DateTime;
388
+ modifiedAt?: DateTime;
389
+ closedAt?: DateTime;
390
+ mergedAt?: DateTime;
391
+ status: 'open' | 'closed' | 'merging' | 'merged';
392
+ title: string;
393
+ body: string;
394
+ source: string;
395
+ target: string;
396
+ };
265
397
  declare type SortExpression = string[] | {
266
398
  [key: string]: SortOrder;
267
399
  } | {
268
400
  [key: string]: SortOrder;
269
401
  }[];
270
402
  declare type SortOrder = 'asc' | 'desc';
403
+ /**
404
+ * Maximum [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) for the search terms. The Levenshtein
405
+ * distance is the number of one character changes needed to make two strings equal. The default is 1, meaning that single
406
+ * character typos per word are tollerated by search. You can set it to 0 to remove the typo tollerance or set it to 2
407
+ * to allow two typos in a word.
408
+ *
409
+ * @default 1
410
+ * @maximum 2
411
+ * @minimum 0
412
+ */
413
+ declare type FuzzinessExpression = number;
414
+ /**
415
+ * If the prefix type is set to "disabled" (the default), the search only matches full words. If the prefix type is set to "phrase", the search will return results that match prefixes of the search phrase.
416
+ */
417
+ declare type PrefixExpression = 'phrase' | 'disabled';
418
+ /**
419
+ * The target expression is used to filter the search results by the target columns.
420
+ */
421
+ declare type TargetExpression = string[];
271
422
  /**
272
423
  * @minProperties 1
273
424
  */
@@ -281,6 +432,48 @@ declare type FilterExpression = {
281
432
  } & {
282
433
  [key: string]: FilterColumn;
283
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
+ };
284
477
  declare type FilterList = FilterExpression | FilterExpression[];
285
478
  declare type FilterColumn = FilterColumnIncludes | FilterPredicate | FilterList;
286
479
  /**
@@ -337,7 +530,24 @@ declare type PageConfig = {
337
530
  size?: number;
338
531
  offset?: number;
339
532
  };
340
- 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
+ };
341
551
  /**
342
552
  * @pattern [a-zA-Z0-9_-~:]+
343
553
  */
@@ -359,16 +569,9 @@ declare type RecordsMetadata = {
359
569
  };
360
570
  };
361
571
  /**
362
- * Xata Table Record
572
+ * Xata Table Record Metadata
363
573
  */
364
- declare type XataRecord$1 = {
365
- id: RecordID;
366
- xata: {
367
- version: number;
368
- table?: string;
369
- warnings?: string[];
370
- };
371
- } & {
574
+ declare type XataRecord$1 = RecordMeta & {
372
575
  [key: string]: any;
373
576
  };
374
577
 
@@ -386,6 +589,7 @@ type schemas_InviteID = InviteID;
386
589
  type schemas_WorkspaceInvite = WorkspaceInvite;
387
590
  type schemas_WorkspaceMembers = WorkspaceMembers;
388
591
  type schemas_InviteKey = InviteKey;
592
+ type schemas_DatabaseMetadata = DatabaseMetadata;
389
593
  type schemas_ListDatabasesResponse = ListDatabasesResponse;
390
594
  type schemas_ListBranchesResponse = ListBranchesResponse;
391
595
  type schemas_ListGitBranchesResponse = ListGitBranchesResponse;
@@ -394,7 +598,9 @@ type schemas_BranchMetadata = BranchMetadata;
394
598
  type schemas_DBBranch = DBBranch;
395
599
  type schemas_StartedFromMetadata = StartedFromMetadata;
396
600
  type schemas_Schema = Schema;
601
+ type schemas_SchemaEditScript = SchemaEditScript;
397
602
  type schemas_Table = Table;
603
+ type schemas_TableEdit = TableEdit;
398
604
  type schemas_Column = Column;
399
605
  type schemas_RevLink = RevLink;
400
606
  type schemas_BranchName = BranchName;
@@ -407,9 +613,26 @@ type schemas_MetricsLatency = MetricsLatency;
407
613
  type schemas_BranchMigration = BranchMigration;
408
614
  type schemas_TableMigration = TableMigration;
409
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;
410
628
  type schemas_SortExpression = SortExpression;
411
629
  type schemas_SortOrder = SortOrder;
630
+ type schemas_FuzzinessExpression = FuzzinessExpression;
631
+ type schemas_PrefixExpression = PrefixExpression;
632
+ type schemas_TargetExpression = TargetExpression;
412
633
  type schemas_FilterExpression = FilterExpression;
634
+ type schemas_HighlightExpression = HighlightExpression;
635
+ type schemas_BoosterExpression = BoosterExpression;
413
636
  type schemas_FilterList = FilterList;
414
637
  type schemas_FilterColumn = FilterColumn;
415
638
  type schemas_FilterColumnIncludes = FilterColumnIncludes;
@@ -419,7 +642,8 @@ type schemas_FilterPredicateRangeOp = FilterPredicateRangeOp;
419
642
  type schemas_FilterRangeValue = FilterRangeValue;
420
643
  type schemas_FilterValue = FilterValue;
421
644
  type schemas_PageConfig = PageConfig;
422
- type schemas_ColumnsFilter = ColumnsFilter;
645
+ type schemas_ColumnsProjection = ColumnsProjection;
646
+ type schemas_RecordMeta = RecordMeta;
423
647
  type schemas_RecordID = RecordID;
424
648
  type schemas_TableRename = TableRename;
425
649
  type schemas_RecordsMetadata = RecordsMetadata;
@@ -439,6 +663,7 @@ declare namespace schemas {
439
663
  schemas_WorkspaceInvite as WorkspaceInvite,
440
664
  schemas_WorkspaceMembers as WorkspaceMembers,
441
665
  schemas_InviteKey as InviteKey,
666
+ schemas_DatabaseMetadata as DatabaseMetadata,
442
667
  schemas_ListDatabasesResponse as ListDatabasesResponse,
443
668
  schemas_ListBranchesResponse as ListBranchesResponse,
444
669
  schemas_ListGitBranchesResponse as ListGitBranchesResponse,
@@ -447,7 +672,9 @@ declare namespace schemas {
447
672
  schemas_DBBranch as DBBranch,
448
673
  schemas_StartedFromMetadata as StartedFromMetadata,
449
674
  schemas_Schema as Schema,
675
+ schemas_SchemaEditScript as SchemaEditScript,
450
676
  schemas_Table as Table,
677
+ schemas_TableEdit as TableEdit,
451
678
  schemas_Column as Column,
452
679
  schemas_RevLink as RevLink,
453
680
  schemas_BranchName as BranchName,
@@ -460,9 +687,29 @@ declare namespace schemas {
460
687
  schemas_BranchMigration as BranchMigration,
461
688
  schemas_TableMigration as TableMigration,
462
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,
463
702
  schemas_SortExpression as SortExpression,
464
703
  schemas_SortOrder as SortOrder,
704
+ schemas_FuzzinessExpression as FuzzinessExpression,
705
+ schemas_PrefixExpression as PrefixExpression,
706
+ schemas_TargetExpression as TargetExpression,
465
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,
466
713
  schemas_FilterList as FilterList,
467
714
  schemas_FilterColumn as FilterColumn,
468
715
  schemas_FilterColumnIncludes as FilterColumnIncludes,
@@ -472,7 +719,8 @@ declare namespace schemas {
472
719
  schemas_FilterRangeValue as FilterRangeValue,
473
720
  schemas_FilterValue as FilterValue,
474
721
  schemas_PageConfig as PageConfig,
475
- schemas_ColumnsFilter as ColumnsFilter,
722
+ schemas_ColumnsProjection as ColumnsProjection,
723
+ schemas_RecordMeta as RecordMeta,
476
724
  schemas_RecordID as RecordID,
477
725
  schemas_TableRename as TableRename,
478
726
  schemas_RecordsMetadata as RecordsMetadata,
@@ -507,11 +755,22 @@ declare type BulkError = {
507
755
  status?: number;
508
756
  }[];
509
757
  };
758
+ declare type BulkInsertResponse = {
759
+ recordIDs: string[];
760
+ } | {
761
+ records: XataRecord$1[];
762
+ };
510
763
  declare type BranchMigrationPlan = {
511
764
  version: number;
512
765
  migration: BranchMigration;
513
766
  };
514
- 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 | {
515
774
  id: string;
516
775
  xata: {
517
776
  version: number;
@@ -535,7 +794,10 @@ type responses_SimpleError = SimpleError;
535
794
  type responses_BadRequestError = BadRequestError;
536
795
  type responses_AuthError = AuthError;
537
796
  type responses_BulkError = BulkError;
797
+ type responses_BulkInsertResponse = BulkInsertResponse;
538
798
  type responses_BranchMigrationPlan = BranchMigrationPlan;
799
+ type responses_RecordResponse = RecordResponse;
800
+ type responses_SchemaCompareResponse = SchemaCompareResponse;
539
801
  type responses_RecordUpdateResponse = RecordUpdateResponse;
540
802
  type responses_QueryResponse = QueryResponse;
541
803
  type responses_SearchResponse = SearchResponse;
@@ -546,7 +808,10 @@ declare namespace responses {
546
808
  responses_BadRequestError as BadRequestError,
547
809
  responses_AuthError as AuthError,
548
810
  responses_BulkError as BulkError,
811
+ responses_BulkInsertResponse as BulkInsertResponse,
549
812
  responses_BranchMigrationPlan as BranchMigrationPlan,
813
+ responses_RecordResponse as RecordResponse,
814
+ responses_SchemaCompareResponse as SchemaCompareResponse,
550
815
  responses_RecordUpdateResponse as RecordUpdateResponse,
551
816
  responses_QueryResponse as QueryResponse,
552
817
  responses_SearchResponse as SearchResponse,
@@ -852,6 +1117,9 @@ declare type InviteWorkspaceMemberError = ErrorWrapper<{
852
1117
  } | {
853
1118
  status: 404;
854
1119
  payload: SimpleError;
1120
+ } | {
1121
+ status: 409;
1122
+ payload: SimpleError;
855
1123
  }>;
856
1124
  declare type InviteWorkspaceMemberRequestBody = {
857
1125
  email: string;
@@ -865,6 +1133,34 @@ declare type InviteWorkspaceMemberVariables = {
865
1133
  * Invite some user to join the workspace with the given role
866
1134
  */
867
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>;
868
1164
  declare type CancelWorkspaceMemberInvitePathParams = {
869
1165
  workspaceId: WorkspaceID;
870
1166
  inviteId: InviteID;
@@ -982,7 +1278,6 @@ declare type CreateDatabaseResponse = {
982
1278
  branchName?: string;
983
1279
  };
984
1280
  declare type CreateDatabaseRequestBody = {
985
- displayName?: string;
986
1281
  branchName?: string;
987
1282
  ui?: {
988
1283
  color?: string;
@@ -1018,6 +1313,54 @@ declare type DeleteDatabaseVariables = {
1018
1313
  * Delete a database and all of its branches and tables permanently.
1019
1314
  */
1020
1315
  declare const deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
1316
+ declare type GetDatabaseMetadataPathParams = {
1317
+ dbName: DBName;
1318
+ workspace: string;
1319
+ };
1320
+ declare type GetDatabaseMetadataError = ErrorWrapper<{
1321
+ status: 400;
1322
+ payload: BadRequestError;
1323
+ } | {
1324
+ status: 401;
1325
+ payload: AuthError;
1326
+ } | {
1327
+ status: 404;
1328
+ payload: SimpleError;
1329
+ }>;
1330
+ declare type GetDatabaseMetadataVariables = {
1331
+ pathParams: GetDatabaseMetadataPathParams;
1332
+ } & FetcherExtraProps;
1333
+ /**
1334
+ * Retrieve metadata of the given database
1335
+ */
1336
+ declare const getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
1337
+ declare type UpdateDatabaseMetadataPathParams = {
1338
+ dbName: DBName;
1339
+ workspace: string;
1340
+ };
1341
+ declare type UpdateDatabaseMetadataError = ErrorWrapper<{
1342
+ status: 400;
1343
+ payload: BadRequestError;
1344
+ } | {
1345
+ status: 401;
1346
+ payload: AuthError;
1347
+ } | {
1348
+ status: 404;
1349
+ payload: SimpleError;
1350
+ }>;
1351
+ declare type UpdateDatabaseMetadataRequestBody = {
1352
+ ui?: {
1353
+ color?: string;
1354
+ };
1355
+ };
1356
+ declare type UpdateDatabaseMetadataVariables = {
1357
+ body?: UpdateDatabaseMetadataRequestBody;
1358
+ pathParams: UpdateDatabaseMetadataPathParams;
1359
+ } & FetcherExtraProps;
1360
+ /**
1361
+ * Update the color of the selected database
1362
+ */
1363
+ declare const updateDatabaseMetadata: (variables: UpdateDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
1021
1364
  declare type GetGitBranchesMappingPathParams = {
1022
1365
  dbName: DBName;
1023
1366
  workspace: string;
@@ -1151,14 +1494,15 @@ declare type ResolveBranchVariables = {
1151
1494
  } & FetcherExtraProps;
1152
1495
  /**
1153
1496
  * In order to resolve the database branch, the following algorithm is used:
1154
- * * if the `gitBranch` is found in the [git branches mapping](), the associated Xata branch is returned
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
1155
1498
  * * else, if a Xata branch with the exact same name as `gitBranch` exists, return it
1156
- * * else, return the default branch of the DB (currently `main` or the first branch)
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)
1157
1501
  *
1158
1502
  * Example call:
1159
1503
  *
1160
1504
  * ```json
1161
- * // GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test?fallbackBranch=tsg
1505
+ * // GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test&fallbackBranch=tsg
1162
1506
  * ```
1163
1507
  *
1164
1508
  * Example response:
@@ -1174,11 +1518,11 @@ declare type ResolveBranchVariables = {
1174
1518
  * ```
1175
1519
  */
1176
1520
  declare const resolveBranch: (variables: ResolveBranchVariables) => Promise<ResolveBranchResponse>;
1177
- declare type GetBranchDetailsPathParams = {
1178
- dbBranchName: DBBranchName;
1521
+ declare type ListMigrationRequestsPathParams = {
1522
+ dbName: DBName;
1179
1523
  workspace: string;
1180
1524
  };
1181
- declare type GetBranchDetailsError = ErrorWrapper<{
1525
+ declare type ListMigrationRequestsError = ErrorWrapper<{
1182
1526
  status: 400;
1183
1527
  payload: BadRequestError;
1184
1528
  } | {
@@ -1188,18 +1532,26 @@ declare type GetBranchDetailsError = ErrorWrapper<{
1188
1532
  status: 404;
1189
1533
  payload: SimpleError;
1190
1534
  }>;
1191
- declare type GetBranchDetailsVariables = {
1192
- pathParams: GetBranchDetailsPathParams;
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;
1193
1548
  } & FetcherExtraProps;
1194
- declare const getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
1195
- declare type CreateBranchPathParams = {
1196
- dbBranchName: DBBranchName;
1549
+ declare const listMigrationRequests: (variables: ListMigrationRequestsVariables) => Promise<ListMigrationRequestsResponse>;
1550
+ declare type CreateMigrationRequestPathParams = {
1551
+ dbName: DBName;
1197
1552
  workspace: string;
1198
1553
  };
1199
- declare type CreateBranchQueryParams = {
1200
- from?: string;
1201
- };
1202
- declare type CreateBranchError = ErrorWrapper<{
1554
+ declare type CreateMigrationRequestError = ErrorWrapper<{
1203
1555
  status: 400;
1204
1556
  payload: BadRequestError;
1205
1557
  } | {
@@ -1209,21 +1561,26 @@ declare type CreateBranchError = ErrorWrapper<{
1209
1561
  status: 404;
1210
1562
  payload: SimpleError;
1211
1563
  }>;
1212
- declare type CreateBranchRequestBody = {
1213
- from?: string;
1214
- metadata?: BranchMetadata;
1564
+ declare type CreateMigrationRequestResponse = {
1565
+ number: number;
1215
1566
  };
1216
- declare type CreateBranchVariables = {
1217
- body?: CreateBranchRequestBody;
1218
- pathParams: CreateBranchPathParams;
1219
- queryParams?: CreateBranchQueryParams;
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;
1220
1576
  } & FetcherExtraProps;
1221
- declare const createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
1222
- declare type DeleteBranchPathParams = {
1223
- dbBranchName: DBBranchName;
1577
+ declare const createMigrationRequest: (variables: CreateMigrationRequestVariables) => Promise<CreateMigrationRequestResponse>;
1578
+ declare type GetMigrationRequestPathParams = {
1579
+ dbName: DBName;
1580
+ mrNumber: number;
1224
1581
  workspace: string;
1225
1582
  };
1226
- declare type DeleteBranchError = ErrorWrapper<{
1583
+ declare type GetMigrationRequestError = ErrorWrapper<{
1227
1584
  status: 400;
1228
1585
  payload: BadRequestError;
1229
1586
  } | {
@@ -1233,18 +1590,16 @@ declare type DeleteBranchError = ErrorWrapper<{
1233
1590
  status: 404;
1234
1591
  payload: SimpleError;
1235
1592
  }>;
1236
- declare type DeleteBranchVariables = {
1237
- pathParams: DeleteBranchPathParams;
1593
+ declare type GetMigrationRequestVariables = {
1594
+ pathParams: GetMigrationRequestPathParams;
1238
1595
  } & FetcherExtraProps;
1239
- /**
1240
- * Delete the branch in the database and all its resources
1241
- */
1242
- declare const deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
1243
- declare type UpdateBranchMetadataPathParams = {
1244
- dbBranchName: DBBranchName;
1596
+ declare const getMigrationRequest: (variables: GetMigrationRequestVariables) => Promise<MigrationRequest>;
1597
+ declare type UpdateMigrationRequestPathParams = {
1598
+ dbName: DBName;
1599
+ mrNumber: number;
1245
1600
  workspace: string;
1246
1601
  };
1247
- declare type UpdateBranchMetadataError = ErrorWrapper<{
1602
+ declare type UpdateMigrationRequestError = ErrorWrapper<{
1248
1603
  status: 400;
1249
1604
  payload: BadRequestError;
1250
1605
  } | {
@@ -1254,19 +1609,22 @@ declare type UpdateBranchMetadataError = ErrorWrapper<{
1254
1609
  status: 404;
1255
1610
  payload: SimpleError;
1256
1611
  }>;
1257
- declare type UpdateBranchMetadataVariables = {
1258
- body?: BranchMetadata;
1259
- pathParams: UpdateBranchMetadataPathParams;
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;
1260
1620
  } & FetcherExtraProps;
1261
- /**
1262
- * Update the branch metadata
1263
- */
1264
- declare const updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
1265
- declare type GetBranchMetadataPathParams = {
1266
- dbBranchName: DBBranchName;
1621
+ declare const updateMigrationRequest: (variables: UpdateMigrationRequestVariables) => Promise<undefined>;
1622
+ declare type ListMigrationRequestsCommitsPathParams = {
1623
+ dbName: DBName;
1624
+ mrNumber: number;
1267
1625
  workspace: string;
1268
1626
  };
1269
- declare type GetBranchMetadataError = ErrorWrapper<{
1627
+ declare type ListMigrationRequestsCommitsError = ErrorWrapper<{
1270
1628
  status: 400;
1271
1629
  payload: BadRequestError;
1272
1630
  } | {
@@ -1276,15 +1634,31 @@ declare type GetBranchMetadataError = ErrorWrapper<{
1276
1634
  status: 404;
1277
1635
  payload: SimpleError;
1278
1636
  }>;
1279
- declare type GetBranchMetadataVariables = {
1280
- pathParams: GetBranchMetadataPathParams;
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;
1281
1654
  } & FetcherExtraProps;
1282
- declare const getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
1283
- declare type GetBranchMigrationHistoryPathParams = {
1284
- dbBranchName: DBBranchName;
1655
+ declare const listMigrationRequestsCommits: (variables: ListMigrationRequestsCommitsVariables) => Promise<ListMigrationRequestsCommitsResponse>;
1656
+ declare type CompareMigrationRequestPathParams = {
1657
+ dbName: DBName;
1658
+ mrNumber: number;
1285
1659
  workspace: string;
1286
1660
  };
1287
- declare type GetBranchMigrationHistoryError = ErrorWrapper<{
1661
+ declare type CompareMigrationRequestError = ErrorWrapper<{
1288
1662
  status: 400;
1289
1663
  payload: BadRequestError;
1290
1664
  } | {
@@ -1294,21 +1668,190 @@ declare type GetBranchMigrationHistoryError = ErrorWrapper<{
1294
1668
  status: 404;
1295
1669
  payload: SimpleError;
1296
1670
  }>;
1297
- declare type GetBranchMigrationHistoryResponse = {
1298
- startedFrom?: StartedFromMetadata;
1299
- migrations?: BranchMigration[];
1300
- };
1301
- declare type GetBranchMigrationHistoryRequestBody = {
1302
- limit?: number;
1303
- startFrom?: string;
1304
- };
1305
- declare type GetBranchMigrationHistoryVariables = {
1306
- body?: GetBranchMigrationHistoryRequestBody;
1307
- pathParams: GetBranchMigrationHistoryPathParams;
1671
+ declare type CompareMigrationRequestVariables = {
1672
+ pathParams: CompareMigrationRequestPathParams;
1308
1673
  } & FetcherExtraProps;
1309
- declare const getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
1310
- declare type ExecuteBranchMigrationPlanPathParams = {
1311
- dbBranchName: DBBranchName;
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;
1851
+ } & FetcherExtraProps;
1852
+ declare const getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
1853
+ declare type ExecuteBranchMigrationPlanPathParams = {
1854
+ dbBranchName: DBBranchName;
1312
1855
  workspace: string;
1313
1856
  };
1314
1857
  declare type ExecuteBranchMigrationPlanError = ErrorWrapper<{
@@ -1355,6 +1898,157 @@ declare type GetBranchMigrationPlanVariables = {
1355
1898
  * Compute a migration plan from a target schema the branch should be migrated too.
1356
1899
  */
1357
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<{
1998
+ status: 400;
1999
+ payload: BadRequestError;
2000
+ } | {
2001
+ status: 401;
2002
+ payload: AuthError;
2003
+ } | {
2004
+ status: 404;
2005
+ payload: SimpleError;
2006
+ }>;
2007
+ declare type ApplyBranchSchemaEditResponse = {
2008
+ id: string;
2009
+ parentID: string;
2010
+ };
2011
+ declare type ApplyBranchSchemaEditRequestBody = {
2012
+ edits: SchemaEditScript;
2013
+ };
2014
+ declare type ApplyBranchSchemaEditVariables = {
2015
+ body: ApplyBranchSchemaEditRequestBody;
2016
+ pathParams: ApplyBranchSchemaEditPathParams;
2017
+ } & FetcherExtraProps;
2018
+ declare const applyBranchSchemaEdit: (variables: ApplyBranchSchemaEditVariables) => Promise<ApplyBranchSchemaEditResponse>;
2019
+ declare type GetBranchSchemaHistoryPathParams = {
2020
+ dbBranchName: DBBranchName;
2021
+ workspace: string;
2022
+ };
2023
+ declare type GetBranchSchemaHistoryError = ErrorWrapper<{
2024
+ status: 400;
2025
+ payload: BadRequestError;
2026
+ } | {
2027
+ status: 401;
2028
+ payload: AuthError;
2029
+ } | {
2030
+ status: 404;
2031
+ payload: SimpleError;
2032
+ }>;
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;
2050
+ } & FetcherExtraProps;
2051
+ declare const getBranchSchemaHistory: (variables: GetBranchSchemaHistoryVariables) => Promise<GetBranchSchemaHistoryResponse>;
1358
2052
  declare type GetBranchStatsPathParams = {
1359
2053
  dbBranchName: DBBranchName;
1360
2054
  workspace: string;
@@ -1405,13 +2099,17 @@ declare type CreateTableError = ErrorWrapper<{
1405
2099
  status: 422;
1406
2100
  payload: SimpleError;
1407
2101
  }>;
2102
+ declare type CreateTableResponse = {
2103
+ branchName: string;
2104
+ tableName: string;
2105
+ };
1408
2106
  declare type CreateTableVariables = {
1409
2107
  pathParams: CreateTablePathParams;
1410
2108
  } & FetcherExtraProps;
1411
2109
  /**
1412
2110
  * Creates a new table with the given name. Returns 422 if a table with the same name already exists.
1413
2111
  */
1414
- declare const createTable: (variables: CreateTableVariables) => Promise<undefined>;
2112
+ declare const createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
1415
2113
  declare type DeleteTablePathParams = {
1416
2114
  dbBranchName: DBBranchName;
1417
2115
  tableName: TableName;
@@ -1458,8 +2156,9 @@ declare type UpdateTableVariables = {
1458
2156
  *
1459
2157
  * In the example below, we rename a table from “users” to “people”:
1460
2158
  *
1461
- * ```jsx
1462
- * PATCH /db/test:main/tables/users
2159
+ * ```json
2160
+ * // PATCH /db/test:main/tables/users
2161
+ *
1463
2162
  * {
1464
2163
  * "name": "people"
1465
2164
  * }
@@ -1643,6 +2342,9 @@ declare type InsertRecordPathParams = {
1643
2342
  tableName: TableName;
1644
2343
  workspace: string;
1645
2344
  };
2345
+ declare type InsertRecordQueryParams = {
2346
+ columns?: ColumnsProjection;
2347
+ };
1646
2348
  declare type InsertRecordError = ErrorWrapper<{
1647
2349
  status: 400;
1648
2350
  payload: BadRequestError;
@@ -1653,20 +2355,15 @@ declare type InsertRecordError = ErrorWrapper<{
1653
2355
  status: 404;
1654
2356
  payload: SimpleError;
1655
2357
  }>;
1656
- declare type InsertRecordResponse = {
1657
- id: string;
1658
- xata: {
1659
- version: number;
1660
- };
1661
- };
1662
2358
  declare type InsertRecordVariables = {
1663
2359
  body?: Record<string, any>;
1664
2360
  pathParams: InsertRecordPathParams;
2361
+ queryParams?: InsertRecordQueryParams;
1665
2362
  } & FetcherExtraProps;
1666
2363
  /**
1667
2364
  * Insert a new Record into the Table
1668
2365
  */
1669
- declare const insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
2366
+ declare const insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
1670
2367
  declare type InsertRecordWithIDPathParams = {
1671
2368
  dbBranchName: DBBranchName;
1672
2369
  tableName: TableName;
@@ -1674,6 +2371,7 @@ declare type InsertRecordWithIDPathParams = {
1674
2371
  workspace: string;
1675
2372
  };
1676
2373
  declare type InsertRecordWithIDQueryParams = {
2374
+ columns?: ColumnsProjection;
1677
2375
  createOnly?: boolean;
1678
2376
  ifVersion?: number;
1679
2377
  };
@@ -1706,6 +2404,7 @@ declare type UpdateRecordWithIDPathParams = {
1706
2404
  workspace: string;
1707
2405
  };
1708
2406
  declare type UpdateRecordWithIDQueryParams = {
2407
+ columns?: ColumnsProjection;
1709
2408
  ifVersion?: number;
1710
2409
  };
1711
2410
  declare type UpdateRecordWithIDError = ErrorWrapper<{
@@ -1734,6 +2433,7 @@ declare type UpsertRecordWithIDPathParams = {
1734
2433
  workspace: string;
1735
2434
  };
1736
2435
  declare type UpsertRecordWithIDQueryParams = {
2436
+ columns?: ColumnsProjection;
1737
2437
  ifVersion?: number;
1738
2438
  };
1739
2439
  declare type UpsertRecordWithIDError = ErrorWrapper<{
@@ -1761,6 +2461,9 @@ declare type DeleteRecordPathParams = {
1761
2461
  recordId: RecordID;
1762
2462
  workspace: string;
1763
2463
  };
2464
+ declare type DeleteRecordQueryParams = {
2465
+ columns?: ColumnsProjection;
2466
+ };
1764
2467
  declare type DeleteRecordError = ErrorWrapper<{
1765
2468
  status: 400;
1766
2469
  payload: BadRequestError;
@@ -1773,14 +2476,18 @@ declare type DeleteRecordError = ErrorWrapper<{
1773
2476
  }>;
1774
2477
  declare type DeleteRecordVariables = {
1775
2478
  pathParams: DeleteRecordPathParams;
2479
+ queryParams?: DeleteRecordQueryParams;
1776
2480
  } & FetcherExtraProps;
1777
- declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
2481
+ declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
1778
2482
  declare type GetRecordPathParams = {
1779
2483
  dbBranchName: DBBranchName;
1780
2484
  tableName: TableName;
1781
2485
  recordId: RecordID;
1782
2486
  workspace: string;
1783
2487
  };
2488
+ declare type GetRecordQueryParams = {
2489
+ columns?: ColumnsProjection;
2490
+ };
1784
2491
  declare type GetRecordError = ErrorWrapper<{
1785
2492
  status: 400;
1786
2493
  payload: BadRequestError;
@@ -1791,12 +2498,9 @@ declare type GetRecordError = ErrorWrapper<{
1791
2498
  status: 404;
1792
2499
  payload: SimpleError;
1793
2500
  }>;
1794
- declare type GetRecordRequestBody = {
1795
- columns?: ColumnsFilter;
1796
- };
1797
2501
  declare type GetRecordVariables = {
1798
- body?: GetRecordRequestBody;
1799
2502
  pathParams: GetRecordPathParams;
2503
+ queryParams?: GetRecordQueryParams;
1800
2504
  } & FetcherExtraProps;
1801
2505
  /**
1802
2506
  * Retrieve record by ID
@@ -1807,6 +2511,9 @@ declare type BulkInsertTableRecordsPathParams = {
1807
2511
  tableName: TableName;
1808
2512
  workspace: string;
1809
2513
  };
2514
+ declare type BulkInsertTableRecordsQueryParams = {
2515
+ columns?: ColumnsProjection;
2516
+ };
1810
2517
  declare type BulkInsertTableRecordsError = ErrorWrapper<{
1811
2518
  status: 400;
1812
2519
  payload: BulkError;
@@ -1816,21 +2523,22 @@ declare type BulkInsertTableRecordsError = ErrorWrapper<{
1816
2523
  } | {
1817
2524
  status: 404;
1818
2525
  payload: SimpleError;
2526
+ } | {
2527
+ status: 422;
2528
+ payload: SimpleError;
1819
2529
  }>;
1820
- declare type BulkInsertTableRecordsResponse = {
1821
- recordIDs: string[];
1822
- };
1823
2530
  declare type BulkInsertTableRecordsRequestBody = {
1824
2531
  records: Record<string, any>[];
1825
2532
  };
1826
2533
  declare type BulkInsertTableRecordsVariables = {
1827
2534
  body: BulkInsertTableRecordsRequestBody;
1828
2535
  pathParams: BulkInsertTableRecordsPathParams;
2536
+ queryParams?: BulkInsertTableRecordsQueryParams;
1829
2537
  } & FetcherExtraProps;
1830
2538
  /**
1831
2539
  * Bulk insert records
1832
2540
  */
1833
- declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
2541
+ declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
1834
2542
  declare type QueryTablePathParams = {
1835
2543
  dbBranchName: DBBranchName;
1836
2544
  tableName: TableName;
@@ -1850,7 +2558,7 @@ declare type QueryTableRequestBody = {
1850
2558
  filter?: FilterExpression;
1851
2559
  sort?: SortExpression;
1852
2560
  page?: PageConfig;
1853
- columns?: ColumnsFilter;
2561
+ columns?: ColumnsProjection;
1854
2562
  };
1855
2563
  declare type QueryTableVariables = {
1856
2564
  body?: QueryTableRequestBody;
@@ -1867,7 +2575,7 @@ declare type QueryTableVariables = {
1867
2575
  * {
1868
2576
  * "columns": [...],
1869
2577
  * "filter": {
1870
- * "$all": [...]
2578
+ * "$all": [...],
1871
2579
  * "$any": [...]
1872
2580
  * ...
1873
2581
  * },
@@ -2005,7 +2713,7 @@ declare type QueryTableVariables = {
2005
2713
  * {
2006
2714
  * "name": "Kilian",
2007
2715
  * "address": {
2008
- * "street": "New street",
2716
+ * "street": "New street"
2009
2717
  * }
2010
2718
  * }
2011
2719
  * ```
@@ -2014,10 +2722,7 @@ declare type QueryTableVariables = {
2014
2722
  *
2015
2723
  * ```json
2016
2724
  * {
2017
- * "columns": [
2018
- * "*",
2019
- * "team.name"
2020
- * ]
2725
+ * "columns": ["*", "team.name"]
2021
2726
  * }
2022
2727
  * ```
2023
2728
  *
@@ -2035,7 +2740,7 @@ declare type QueryTableVariables = {
2035
2740
  * "team": {
2036
2741
  * "id": "XX",
2037
2742
  * "xata": {
2038
- * "version": 0,
2743
+ * "version": 0
2039
2744
  * },
2040
2745
  * "name": "first team"
2041
2746
  * }
@@ -2046,10 +2751,7 @@ declare type QueryTableVariables = {
2046
2751
  *
2047
2752
  * ```json
2048
2753
  * {
2049
- * "columns": [
2050
- * "*",
2051
- * "team.*"
2052
- * ]
2754
+ * "columns": ["*", "team.*"]
2053
2755
  * }
2054
2756
  * ```
2055
2757
  *
@@ -2067,7 +2769,7 @@ declare type QueryTableVariables = {
2067
2769
  * "team": {
2068
2770
  * "id": "XX",
2069
2771
  * "xata": {
2070
- * "version": 0,
2772
+ * "version": 0
2071
2773
  * },
2072
2774
  * "name": "first team",
2073
2775
  * "code": "A1",
@@ -2117,7 +2819,7 @@ declare type QueryTableVariables = {
2117
2819
  * ```json
2118
2820
  * {
2119
2821
  * "filter": {
2120
- * "name": "r2",
2822
+ * "name": "r2"
2121
2823
  * }
2122
2824
  * }
2123
2825
  * ```
@@ -2139,7 +2841,7 @@ declare type QueryTableVariables = {
2139
2841
  * ```json
2140
2842
  * {
2141
2843
  * "filter": {
2142
- * "settings.plan": "free",
2844
+ * "settings.plan": "free"
2143
2845
  * }
2144
2846
  * }
2145
2847
  * ```
@@ -2149,8 +2851,8 @@ declare type QueryTableVariables = {
2149
2851
  * "filter": {
2150
2852
  * "settings": {
2151
2853
  * "plan": "free"
2152
- * },
2153
- * },
2854
+ * }
2855
+ * }
2154
2856
  * }
2155
2857
  * ```
2156
2858
  *
@@ -2159,8 +2861,8 @@ declare type QueryTableVariables = {
2159
2861
  * ```json
2160
2862
  * {
2161
2863
  * "filter": {
2162
- * "settings.plan": {"$any": ["free", "paid"]}
2163
- * },
2864
+ * "settings.plan": { "$any": ["free", "paid"] }
2865
+ * }
2164
2866
  * }
2165
2867
  * ```
2166
2868
  *
@@ -2169,9 +2871,9 @@ declare type QueryTableVariables = {
2169
2871
  * ```json
2170
2872
  * {
2171
2873
  * "filter": {
2172
- * "settings.dark": true,
2173
- * "settings.plan": "free",
2174
- * },
2874
+ * "settings.dark": true,
2875
+ * "settings.plan": "free"
2876
+ * }
2175
2877
  * }
2176
2878
  * ```
2177
2879
  *
@@ -2182,11 +2884,11 @@ declare type QueryTableVariables = {
2182
2884
  * ```json
2183
2885
  * {
2184
2886
  * "filter": {
2185
- * "$any": {
2186
- * "settings.dark": true,
2187
- * "settings.plan": "free"
2188
- * }
2189
- * },
2887
+ * "$any": {
2888
+ * "settings.dark": true,
2889
+ * "settings.plan": "free"
2890
+ * }
2891
+ * }
2190
2892
  * }
2191
2893
  * ```
2192
2894
  *
@@ -2197,10 +2899,10 @@ declare type QueryTableVariables = {
2197
2899
  * "filter": {
2198
2900
  * "$any": [
2199
2901
  * {
2200
- * "name": "r1",
2902
+ * "name": "r1"
2201
2903
  * },
2202
2904
  * {
2203
- * "name": "r2",
2905
+ * "name": "r2"
2204
2906
  * }
2205
2907
  * ]
2206
2908
  * }
@@ -2212,7 +2914,7 @@ declare type QueryTableVariables = {
2212
2914
  * ```json
2213
2915
  * {
2214
2916
  * "filter": {
2215
- * "$exists": "settings",
2917
+ * "$exists": "settings"
2216
2918
  * }
2217
2919
  * }
2218
2920
  * ```
@@ -2224,10 +2926,10 @@ declare type QueryTableVariables = {
2224
2926
  * "filter": {
2225
2927
  * "$all": [
2226
2928
  * {
2227
- * "$exists": "settings",
2929
+ * "$exists": "settings"
2228
2930
  * },
2229
2931
  * {
2230
- * "$exists": "name",
2932
+ * "$exists": "name"
2231
2933
  * }
2232
2934
  * ]
2233
2935
  * }
@@ -2239,7 +2941,7 @@ declare type QueryTableVariables = {
2239
2941
  * ```json
2240
2942
  * {
2241
2943
  * "filter": {
2242
- * "$notExists": "settings",
2944
+ * "$notExists": "settings"
2243
2945
  * }
2244
2946
  * }
2245
2947
  * ```
@@ -2266,22 +2968,28 @@ declare type QueryTableVariables = {
2266
2968
  * {
2267
2969
  * "filter": {
2268
2970
  * "<column_name>": {
2269
- * "$pattern": "v*alue*"
2971
+ * "$pattern": "v*alu?"
2270
2972
  * }
2271
2973
  * }
2272
2974
  * }
2273
2975
  * ```
2274
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
+ *
2275
2983
  * We could also have `$endsWith` and `$startsWith` operators:
2276
2984
  *
2277
2985
  * ```json
2278
2986
  * {
2279
2987
  * "filter": {
2280
2988
  * "<column_name>": {
2281
- * "$endsWith": ".gz"
2989
+ * "$endsWith": ".gz"
2282
2990
  * },
2283
2991
  * "<column_name>": {
2284
- * "$startsWith": "tmp-"
2992
+ * "$startsWith": "tmp-"
2285
2993
  * }
2286
2994
  * }
2287
2995
  * }
@@ -2292,10 +3000,10 @@ declare type QueryTableVariables = {
2292
3000
  * ```json
2293
3001
  * {
2294
3002
  * "filter": {
2295
- * "<column_name>": {
2296
- * "$ge": 0,
2297
- * "$lt": 100
2298
- * }
3003
+ * "<column_name>": {
3004
+ * "$ge": 0,
3005
+ * "$lt": 100
3006
+ * }
2299
3007
  * }
2300
3008
  * }
2301
3009
  * ```
@@ -2313,7 +3021,6 @@ declare type QueryTableVariables = {
2313
3021
  * ```
2314
3022
  * The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
2315
3023
  *
2316
- *
2317
3024
  * #### Negations
2318
3025
  *
2319
3026
  * A general `$not` operator can inverse any operation.
@@ -2338,15 +3045,21 @@ declare type QueryTableVariables = {
2338
3045
  * {
2339
3046
  * "filter": {
2340
3047
  * "$not": {
2341
- * "$any": [{
2342
- * "<column_name1>": "value1"
2343
- * }, {
2344
- * "$all": [{
2345
- * "<column_name2>": "value2"
2346
- * }, {
2347
- * "<column_name3>": "value3"
2348
- * }]
2349
- * }]
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
+ * ]
2350
3063
  * }
2351
3064
  * }
2352
3065
  * }
@@ -2401,8 +3114,8 @@ declare type QueryTableVariables = {
2401
3114
  * "<array name>": {
2402
3115
  * "$includes": {
2403
3116
  * "$all": [
2404
- * {"$contains": "label"},
2405
- * {"$not": {"$endsWith": "-debug"}}
3117
+ * { "$contains": "label" },
3118
+ * { "$not": { "$endsWith": "-debug" } }
2406
3119
  * ]
2407
3120
  * }
2408
3121
  * }
@@ -2422,9 +3135,7 @@ declare type QueryTableVariables = {
2422
3135
  * {
2423
3136
  * "filter": {
2424
3137
  * "settings.labels": {
2425
- * "$includesAll": [
2426
- * {"$contains": "label"},
2427
- * ]
3138
+ * "$includesAll": [{ "$contains": "label" }]
2428
3139
  * }
2429
3140
  * }
2430
3141
  * }
@@ -2472,7 +3183,6 @@ declare type QueryTableVariables = {
2472
3183
  * }
2473
3184
  * ```
2474
3185
  *
2475
- *
2476
3186
  * ### Pagination
2477
3187
  *
2478
3188
  * We offer cursor pagination and offset pagination. The offset pagination is limited
@@ -2538,8 +3248,8 @@ declare type QueryTableVariables = {
2538
3248
  * can be queried by update `page.after` to the returned cursor while keeping the
2539
3249
  * `page.before` cursor from the first range query.
2540
3250
  *
2541
- * The `filter` , `columns`, `sort` , and `page.size` configuration will be
2542
- * 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
2543
3253
  * `filter` or `sort` is set. The columns returned and page size can be changed
2544
3254
  * anytime by passing the `columns` or `page.size` settings to the next query.
2545
3255
  *
@@ -2576,6 +3286,42 @@ declare type QueryTableVariables = {
2576
3286
  * ```
2577
3287
  */
2578
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>;
2579
3325
  declare type SearchBranchPathParams = {
2580
3326
  dbBranchName: DBBranchName;
2581
3327
  workspace: string;
@@ -2591,9 +3337,17 @@ declare type SearchBranchError = ErrorWrapper<{
2591
3337
  payload: SimpleError;
2592
3338
  }>;
2593
3339
  declare type SearchBranchRequestBody = {
2594
- tables?: string[];
3340
+ tables?: (string | {
3341
+ table: string;
3342
+ filter?: FilterExpression;
3343
+ boosters?: BoosterExpression[];
3344
+ })[];
2595
3345
  query: string;
2596
- fuzziness?: number;
3346
+ fuzziness?: FuzzinessExpression;
3347
+ target?: TargetExpression;
3348
+ prefix?: PrefixExpression;
3349
+ filter?: FilterExpression;
3350
+ highlight?: HighlightExpression;
2597
3351
  };
2598
3352
  declare type SearchBranchVariables = {
2599
3353
  body: SearchBranchRequestBody;
@@ -2622,6 +3376,7 @@ declare const operationsByTag: {
2622
3376
  updateWorkspaceMemberRole: (variables: UpdateWorkspaceMemberRoleVariables) => Promise<undefined>;
2623
3377
  removeWorkspaceMember: (variables: RemoveWorkspaceMemberVariables) => Promise<undefined>;
2624
3378
  inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<WorkspaceInvite>;
3379
+ updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
2625
3380
  cancelWorkspaceMemberInvite: (variables: CancelWorkspaceMemberInviteVariables) => Promise<undefined>;
2626
3381
  resendWorkspaceMemberInvite: (variables: ResendWorkspaceMemberInviteVariables) => Promise<undefined>;
2627
3382
  acceptWorkspaceMemberInvite: (variables: AcceptWorkspaceMemberInviteVariables) => Promise<undefined>;
@@ -2630,6 +3385,8 @@ declare const operationsByTag: {
2630
3385
  getDatabaseList: (variables: GetDatabaseListVariables) => Promise<ListDatabasesResponse>;
2631
3386
  createDatabase: (variables: CreateDatabaseVariables) => Promise<CreateDatabaseResponse>;
2632
3387
  deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
3388
+ getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
3389
+ updateDatabaseMetadata: (variables: UpdateDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
2633
3390
  getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
2634
3391
  addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
2635
3392
  removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
@@ -2638,17 +3395,35 @@ declare const operationsByTag: {
2638
3395
  branch: {
2639
3396
  getBranchList: (variables: GetBranchListVariables) => Promise<ListBranchesResponse>;
2640
3397
  getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
2641
- createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
3398
+ createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
2642
3399
  deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
2643
3400
  updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
2644
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: {
2645
3415
  getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
2646
3416
  executeBranchMigrationPlan: (variables: ExecuteBranchMigrationPlanVariables) => Promise<undefined>;
2647
3417
  getBranchMigrationPlan: (variables: GetBranchMigrationPlanVariables) => Promise<BranchMigrationPlan>;
2648
- 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>;
2649
3424
  };
2650
3425
  table: {
2651
- createTable: (variables: CreateTableVariables) => Promise<undefined>;
3426
+ createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
2652
3427
  deleteTable: (variables: DeleteTableVariables) => Promise<undefined>;
2653
3428
  updateTable: (variables: UpdateTableVariables) => Promise<undefined>;
2654
3429
  getTableSchema: (variables: GetTableSchemaVariables) => Promise<GetTableSchemaResponse>;
@@ -2660,14 +3435,15 @@ declare const operationsByTag: {
2660
3435
  updateColumn: (variables: UpdateColumnVariables) => Promise<MigrationIdResponse>;
2661
3436
  };
2662
3437
  records: {
2663
- insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
3438
+ insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
2664
3439
  insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2665
3440
  updateRecordWithID: (variables: UpdateRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2666
3441
  upsertRecordWithID: (variables: UpsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2667
- deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
3442
+ deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
2668
3443
  getRecord: (variables: GetRecordVariables) => Promise<XataRecord$1>;
2669
- bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
3444
+ bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
2670
3445
  queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
3446
+ searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2671
3447
  searchBranch: (variables: SearchBranchVariables) => Promise<SearchResponse>;
2672
3448
  };
2673
3449
  };
@@ -2683,10 +3459,8 @@ interface XataApiClientOptions {
2683
3459
  fetch?: FetchImpl;
2684
3460
  apiKey?: string;
2685
3461
  host?: HostProvider;
3462
+ trace?: TraceFunction;
2686
3463
  }
2687
- /**
2688
- * @deprecated Use XataApiPlugin instead
2689
- */
2690
3464
  declare class XataApiClient {
2691
3465
  #private;
2692
3466
  constructor(options?: XataApiClientOptions);
@@ -2696,6 +3470,8 @@ declare class XataApiClient {
2696
3470
  get branches(): BranchApi;
2697
3471
  get tables(): TableApi;
2698
3472
  get records(): RecordsApi;
3473
+ get migrationRequests(): MigrationRequestsApi;
3474
+ get branchSchema(): BranchSchemaApi;
2699
3475
  }
2700
3476
  declare class UserApi {
2701
3477
  private extraProps;
@@ -2719,6 +3495,7 @@ declare class WorkspaceApi {
2719
3495
  updateWorkspaceMemberRole(workspaceId: WorkspaceID, userId: UserID, role: Role): Promise<void>;
2720
3496
  removeWorkspaceMember(workspaceId: WorkspaceID, userId: UserID): Promise<void>;
2721
3497
  inviteWorkspaceMember(workspaceId: WorkspaceID, email: string, role: Role): Promise<WorkspaceInvite>;
3498
+ updateWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID, role: Role): Promise<WorkspaceInvite>;
2722
3499
  cancelWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2723
3500
  resendWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2724
3501
  acceptWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteKey: InviteKey): Promise<void>;
@@ -2729,29 +3506,28 @@ declare class DatabaseApi {
2729
3506
  getDatabaseList(workspace: WorkspaceID): Promise<ListDatabasesResponse>;
2730
3507
  createDatabase(workspace: WorkspaceID, dbName: DBName, options?: CreateDatabaseRequestBody): Promise<CreateDatabaseResponse>;
2731
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>;
2732
3511
  getGitBranchesMapping(workspace: WorkspaceID, dbName: DBName): Promise<ListGitBranchesResponse>;
2733
3512
  addGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, body: AddGitBranchesEntryRequestBody): Promise<AddGitBranchesEntryResponse>;
2734
3513
  removeGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<void>;
2735
- resolveBranch(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<ResolveBranchResponse>;
3514
+ resolveBranch(workspace: WorkspaceID, dbName: DBName, gitBranch?: string, fallbackBranch?: string): Promise<ResolveBranchResponse>;
2736
3515
  }
2737
3516
  declare class BranchApi {
2738
3517
  private extraProps;
2739
3518
  constructor(extraProps: FetcherExtraProps);
2740
3519
  getBranchList(workspace: WorkspaceID, dbName: DBName): Promise<ListBranchesResponse>;
2741
3520
  getBranchDetails(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<DBBranch>;
2742
- 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>;
2743
3522
  deleteBranch(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<void>;
2744
3523
  updateBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName, metadata?: BranchMetadata): Promise<void>;
2745
3524
  getBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<BranchMetadata>;
2746
- getBranchMigrationHistory(workspace: WorkspaceID, database: DBName, branch: BranchName, options?: GetBranchMigrationHistoryRequestBody): Promise<GetBranchMigrationHistoryResponse>;
2747
- executeBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, migrationPlan: ExecuteBranchMigrationPlanRequestBody): Promise<void>;
2748
- getBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, schema: Schema): Promise<BranchMigrationPlan>;
2749
3525
  getBranchStats(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<GetBranchStatsResponse>;
2750
3526
  }
2751
3527
  declare class TableApi {
2752
3528
  private extraProps;
2753
3529
  constructor(extraProps: FetcherExtraProps);
2754
- createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
3530
+ createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<CreateTableResponse>;
2755
3531
  deleteTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
2756
3532
  updateTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, options: UpdateTableRequestBody): Promise<void>;
2757
3533
  getTableSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<GetTableSchemaResponse>;
@@ -2765,16 +3541,42 @@ declare class TableApi {
2765
3541
  declare class RecordsApi {
2766
3542
  private extraProps;
2767
3543
  constructor(extraProps: FetcherExtraProps);
2768
- 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>;
2769
3545
  insertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: InsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2770
3546
  updateRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpdateRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2771
3547
  upsertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2772
- deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID): Promise<void>;
2773
- getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordRequestBody): Promise<XataRecord$1>;
2774
- bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[]): Promise<BulkInsertTableRecordsResponse>;
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>;
2775
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>;
2776
3553
  searchBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, query: SearchBranchRequestBody): Promise<SearchResponse>;
2777
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
+ }
2778
3580
 
2779
3581
  declare class XataApiPlugin implements XataPlugin {
2780
3582
  build(options: XataPluginOptions): Promise<XataApiClient>;
@@ -2786,27 +3588,29 @@ declare type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) ex
2786
3588
  declare type If<Condition, Then, Else> = Condition extends true ? Then : Else;
2787
3589
  declare type IsObject<T> = T extends Record<string, any> ? true : false;
2788
3590
  declare type IsArray<T> = T extends Array<any> ? true : false;
2789
- declare type NonEmptyArray<T> = T[] & {
2790
- 0: T;
2791
- };
2792
3591
  declare type RequiredBy<T, K extends keyof T> = T & {
2793
3592
  [P in K]-?: NonNullable<T[P]>;
2794
3593
  };
2795
3594
  declare type GetArrayInnerType<T extends readonly any[]> = T[number];
2796
3595
  declare type SingleOrArray<T> = T | 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;
2797
3601
 
2798
3602
  declare type SelectableColumn<O, RecursivePath extends any[] = []> = '*' | 'id' | DataProps<O> | NestedColumns<O, RecursivePath>;
2799
- declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord & UnionToIntersection<Values<{
2800
- [K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord;
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>;
2801
3605
  }>>;
2802
- declare type ValueAtColumn<O, P extends SelectableColumn<O>> = P extends '*' ? Values<O> : P extends 'id' ? string : P extends keyof O ? O[P] : P extends `${infer K}.${infer V}` ? K extends keyof O ? Values<O[K] extends XataRecord ? (V extends SelectableColumn<O[K]> ? {
2803
- V: ValueAtColumn<O[K], V>;
2804
- } : never) : O[K]> : never : never;
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;
2805
3609
  declare type MAX_RECURSION = 5;
2806
3610
  declare type NestedColumns<O, RecursivePath extends any[]> = RecursivePath['length'] extends MAX_RECURSION ? never : If<IsObject<O>, Values<{
2807
- [K in DataProps<O>]: If<IsArray<NonNullable<O[K]>>, K, // If the property is an array, we stop recursion. We don't support object arrays yet
2808
- If<IsObject<NonNullable<O[K]>>, NonNullable<O[K]> extends XataRecord ? SelectableColumn<NonNullable<O[K]>, [...RecursivePath, O[K]]> extends string ? K | `${K}.${SelectableColumn<NonNullable<O[K]>, [...RecursivePath, O[K]]>}` : never : `${K}.${StringKeys<NonNullable<O[K]>> | '*'}`, // This allows usage of objects that are not links
2809
- K>>;
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;
2810
3614
  }>, never>;
2811
3615
  declare type DataProps<O> = Exclude<StringKeys<O>, StringKeys<XataRecord>>;
2812
3616
  declare type NestedValueAtColumn<O, Key extends SelectableColumn<O>> = Key extends `${infer N}.${infer M}` ? N extends DataProps<O> ? {
@@ -2833,56 +3637,67 @@ interface BaseData {
2833
3637
  /**
2834
3638
  * Represents a persisted record from the database.
2835
3639
  */
2836
- interface XataRecord extends Identifiable {
3640
+ interface XataRecord<OriginalRecord extends XataRecord<any> = XataRecord<any>> extends Identifiable {
2837
3641
  /**
2838
- * Metadata of this record.
3642
+ * Get metadata of this record.
2839
3643
  */
2840
- xata: {
2841
- /**
2842
- * Number that is increased every time the record is updated.
2843
- */
2844
- version: number;
2845
- };
3644
+ getMetadata(): XataRecordMetadata;
2846
3645
  /**
2847
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.
2848
3649
  */
2849
- read(): Promise<Readonly<SelectedPick<this, ['*']>> | null>;
3650
+ read<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
3651
+ /**
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.
3654
+ */
3655
+ read(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
3656
+ /**
3657
+ * Performs a partial update of the current record. On success a new object is
3658
+ * returned and the current object is not mutated.
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.
3662
+ */
3663
+ update<K extends SelectableColumn<OriginalRecord>>(partialUpdate: Partial<EditableData<OriginalRecord>>, columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
2850
3664
  /**
2851
3665
  * Performs a partial update of the current record. On success a new object is
2852
3666
  * returned and the current object is not mutated.
2853
- * @param data The columns and their values that have to be updated.
2854
- * @returns A new record containing the latest values for all the columns of the current record.
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.
2855
3669
  */
2856
- update(partialUpdate: Partial<EditableData<Omit<this, keyof XataRecord>>>): Promise<Readonly<SelectedPick<this, ['*']>>>;
3670
+ update(partialUpdate: Partial<EditableData<OriginalRecord>>): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2857
3671
  /**
2858
3672
  * Performs a deletion of the current record in the database.
2859
- *
2860
- * @throws If the record was already deleted or if an error happened while performing the deletion.
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.
2861
3675
  */
2862
- delete(): Promise<void>;
2863
- }
2864
- 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>;
2865
3677
  /**
2866
- * 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
+
2867
3681
  */
2868
- 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 = {
2869
3686
  /**
2870
- * Performs a partial update of the current record. On success a new object is
2871
- * returned and the current object is not mutated.
2872
- * @param data The columns and their values that have to be updated.
2873
- * @returns A new record containing the latest values for all the columns of the current record.
3687
+ * Number that is increased every time the record is updated.
2874
3688
  */
2875
- update(partialUpdate: Partial<EditableData<Omit<Record, keyof XataRecord>>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3689
+ version: number;
3690
+ warnings?: string[];
2876
3691
  };
2877
3692
  declare function isIdentifiable(x: any): x is Identifiable & Record<string, unknown>;
2878
3693
  declare function isXataRecord(x: any): x is XataRecord & Record<string, unknown>;
2879
- declare type EditableData<O extends BaseData> = {
3694
+ declare type EditableData<O extends XataRecord> = Identifiable & Omit<{
2880
3695
  [K in keyof O]: O[K] extends XataRecord ? {
2881
3696
  id: string;
2882
- } : NonNullable<O[K]> extends XataRecord ? {
3697
+ } | string : NonNullable<O[K]> extends XataRecord ? {
2883
3698
  id: string;
2884
- } | null | undefined : O[K];
2885
- };
3699
+ } | string | null | undefined : O[K];
3700
+ }, keyof XataRecord>;
2886
3701
 
2887
3702
  /**
2888
3703
  * PropertyMatchFilter
@@ -2957,8 +3772,8 @@ declare type ValueTypeFilters<T> = T | T extends string ? StringTypeFilter : T e
2957
3772
  ],
2958
3773
  }
2959
3774
  */
2960
- declare type AggregatorFilter<Record> = {
2961
- [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<Record>>;
3775
+ declare type AggregatorFilter<T> = {
3776
+ [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<T>>;
2962
3777
  };
2963
3778
  /**
2964
3779
  * Existance filter
@@ -2973,10 +3788,88 @@ declare type BaseApiFilter<Record> = PropertyAccessFilter<Record> | AggregatorFi
2973
3788
  * Injects the Api filters on nested properties
2974
3789
  * Example: { filter: { settings: { plan: { $any: ['free', 'trial'] } } } }
2975
3790
  */
2976
- declare type NestedApiFilter<T> = T extends Record<string, any> ? {
3791
+ declare type NestedApiFilter<T> = {
2977
3792
  [key in keyof T]?: T[key] extends Record<string, any> ? SingleOrArray<Filter<T[key]>> : PropertyFilter<T[key]>;
2978
- } : PropertyFilter<T>;
2979
- declare type Filter<Record> = BaseApiFilter<Record> | NestedApiFilter<Record>;
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;
2980
3873
 
2981
3874
  declare type SortDirection = 'asc' | 'desc';
2982
3875
  declare type SortFilterExtended<T extends XataRecord> = {
@@ -2988,13 +3881,21 @@ declare type SortFilterBase<T extends XataRecord> = {
2988
3881
  [Key in StringKeys<T>]: SortDirection;
2989
3882
  };
2990
3883
 
2991
- declare type QueryOptions<T extends XataRecord> = {
2992
- pagination?: PaginationOptions;
2993
- 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;
2994
3895
  filter?: FilterExpression;
2995
3896
  sort?: SortFilter<T> | SortFilter<T>[];
2996
- cache?: number;
2997
3897
  };
3898
+ declare type QueryOptions<T extends XataRecord> = BaseOptions<T> & (CursorQueryOptions | OffsetQueryOptions<T>);
2998
3899
  /**
2999
3900
  * Query objects contain the information of all filters, sorting, etc. to be included in the database query.
3000
3901
  *
@@ -3004,8 +3905,11 @@ declare type QueryOptions<T extends XataRecord> = {
3004
3905
  declare class Query<Record extends XataRecord, Result extends XataRecord = Record> implements Paginable<Record, Result> {
3005
3906
  #private;
3006
3907
  readonly meta: PaginationQueryMeta;
3007
- readonly records: Result[];
3008
- 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>>);
3009
3913
  getQueryOptions(): QueryOptions<Record>;
3010
3914
  key(): string;
3011
3915
  /**
@@ -3037,73 +3941,206 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3037
3941
  *
3038
3942
  * ```
3039
3943
  * query.filter("columnName", columnValue)
3040
- * query.filter({
3041
- * "columnName": columnValue
3042
- * })
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 })
3043
3957
  * query.filter({
3044
3958
  * "columnName": operator(columnValue) // Use gt, gte, lt, lte, startsWith,...
3045
3959
  * })
3046
3960
  * ```
3047
3961
  *
3962
+ * @param filters A filter object
3048
3963
  * @returns A new Query object.
3049
3964
  */
3050
- filter(filters: Filter<Record>): Query<Record, Result>;
3051
- 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
+ };
3052
3969
  /**
3053
3970
  * Builds a new query with a new sort option.
3054
3971
  * @param column The column name.
3055
3972
  * @param direction The direction. Either ascending or descending.
3056
3973
  * @returns A new Query object.
3057
3974
  */
3058
- 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>;
3059
3976
  /**
3060
3977
  * Builds a new query specifying the set of columns to be returned in the query response.
3061
3978
  * @param columns Array of column names to be returned by the query.
3062
3979
  * @returns A new Query object.
3063
3980
  */
3064
- 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
+ */
3065
3987
  getPaginated(): Promise<Page<Record, Result>>;
3066
- 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
+ */
3067
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
+ */
3068
4008
  [Symbol.asyncIterator](): AsyncIterableIterator<Result>;
3069
- getIterator(chunk: number): AsyncGenerator<Result[]>;
3070
- getIterator(chunk: number, options: Omit<QueryOptions<Record>, 'columns' | 'page'>): AsyncGenerator<Result[]>;
3071
- getIterator<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(chunk: number, options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
3072
4009
  /**
3073
- * Performs the query in the database and returns a set of results.
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']>>>;
4044
+ /**
4045
+ * Performs the query in the database and returns a set of results.
4046
+ * @param options Additional options to be used when performing the query.
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.
3074
4087
  * @param options Additional options to be used when performing the query.
3075
- * @returns An array of records from the database.
4088
+ * @returns The first record that matches the query, or null if no record matched the query.
3076
4089
  */
3077
- getMany(): Promise<Result[]>;
3078
- getMany(options: Omit<QueryOptions<Record>, 'columns'>): Promise<Result[]>;
3079
- getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
4090
+ getFirst(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result | null>;
3080
4091
  /**
3081
- * Performs the query in the database and returns all the results.
3082
- * Warning: If there are a large number of results, this method can have performance implications.
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.
3083
4099
  * @param options Additional options to be used when performing the query.
3084
- * @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.
3085
4102
  */
3086
- getAll(chunk?: number): Promise<Result[]>;
3087
- getAll(chunk: number | undefined, options: Omit<QueryOptions<Record>, 'columns' | 'page'>): Promise<Result[]>;
3088
- getAll<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(chunk: number | undefined, options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
4103
+ getFirstOrThrow<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>>;
3089
4104
  /**
3090
4105
  * Performs the query in the database and returns the first result.
3091
4106
  * @param options Additional options to be used when performing the query.
3092
4107
  * @returns The first record that matches the query, or null if no record matched the query.
4108
+ * @throws if there are no results.
3093
4109
  */
3094
- getFirst(): Promise<Result | null>;
3095
- getFirst(options: Omit<QueryOptions<Record>, 'columns' | 'page'>): Promise<Result | null>;
3096
- getFirst<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
4110
+ getFirstOrThrow(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result>;
3097
4111
  /**
3098
4112
  * Builds a new query object adding a cache TTL in milliseconds.
3099
4113
  * @param ttl The cache TTL in milliseconds.
3100
4114
  * @returns A new Query object.
3101
4115
  */
3102
4116
  cache(ttl: number): Query<Record, Result>;
4117
+ /**
4118
+ * Retrieve next page of records
4119
+ *
4120
+ * @returns A new page object.
4121
+ */
3103
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
+ */
3104
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
+ */
3105
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
+ */
3106
4140
  lastPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4141
+ /**
4142
+ * @returns Boolean indicating if there is a next page
4143
+ */
3107
4144
  hasNextPage(): boolean;
3108
4145
  }
3109
4146
 
@@ -3115,7 +4152,7 @@ declare type PaginationQueryMeta = {
3115
4152
  };
3116
4153
  interface Paginable<Record extends XataRecord, Result extends XataRecord = Record> {
3117
4154
  meta: PaginationQueryMeta;
3118
- records: Result[];
4155
+ records: RecordArray<Result>;
3119
4156
  nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
3120
4157
  previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
3121
4158
  firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
@@ -3135,7 +4172,7 @@ declare class Page<Record extends XataRecord, Result extends XataRecord = Record
3135
4172
  /**
3136
4173
  * The set of results for this page.
3137
4174
  */
3138
- readonly records: Result[];
4175
+ readonly records: RecordArray<Result>;
3139
4176
  constructor(query: Query<Record, Result>, meta: PaginationQueryMeta, records?: Result[]);
3140
4177
  /**
3141
4178
  * Retrieves the next page of results.
@@ -3183,62 +4220,305 @@ declare type OffsetNavigationOptions = {
3183
4220
  size?: number;
3184
4221
  offset?: number;
3185
4222
  };
3186
- declare type PaginationOptions = CursorNavigationOptions & OffsetNavigationOptions;
3187
4223
  declare const PAGINATION_MAX_SIZE = 200;
3188
- declare const PAGINATION_DEFAULT_SIZE = 200;
4224
+ declare const PAGINATION_DEFAULT_SIZE = 20;
3189
4225
  declare const PAGINATION_MAX_OFFSET = 800;
3190
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
+ }
3191
4263
 
3192
4264
  /**
3193
4265
  * Common interface for performing operations on a table.
3194
4266
  */
3195
- declare abstract class Repository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
3196
- abstract create(object: EditableData<Data> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
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>>>;
3197
4278
  /**
3198
4279
  * Creates a single record in the table with a unique id.
3199
4280
  * @param id The unique id.
3200
4281
  * @param object Object containing the column names with their values to be stored in the table.
3201
4282
  * @returns The full persisted record.
3202
4283
  */
3203
- 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, ['*']>>>;
3204
4285
  /**
3205
4286
  * Creates multiple records in the table.
3206
4287
  * @param objects Array of objects with the column names and the values to be stored in the table.
3207
- * @returns Array of the persisted records.
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.
3208
4296
  */
3209
- abstract create(objects: Array<EditableData<Data> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
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.
4303
+ */
4304
+ abstract read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
3210
4305
  /**
3211
4306
  * Queries a single record from the table given its unique id.
3212
4307
  * @param id The unique id.
3213
4308
  * @returns The persisted record for the given id or null if the record could not be found.
3214
4309
  */
3215
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, ['*']>>>>;
4410
+ /**
4411
+ * Partially update a single record.
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>>>;
3216
4459
  /**
3217
4460
  * Partially update a single record.
3218
4461
  * @param object An object with its id and the columns to be updated.
3219
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.
4471
+ * @returns The full persisted record.
4472
+ * @throws If the record could not be found.
3220
4473
  */
3221
- 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>>>;
3222
4475
  /**
3223
4476
  * Partially update a single record given its unique id.
3224
4477
  * @param id The unique id.
3225
4478
  * @param object The column names and their values that have to be updated.
3226
4479
  * @returns The full persisted record.
4480
+ * @throws If the record could not be found.
3227
4481
  */
3228
- 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, ['*']>>>;
3229
4483
  /**
3230
4484
  * Partially updates multiple records.
3231
4485
  * @param objects An array of objects with their ids and columns to be updated.
3232
- * @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.
3233
4504
  */
3234
- 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>>>;
3235
4506
  /**
3236
4507
  * Creates or updates a single record. If a record exists with the given id,
3237
4508
  * it will be update, otherwise a new record will be created.
3238
4509
  * @param object Object containing the column names with their values to be persisted in the table.
3239
4510
  * @returns The full persisted record.
3240
4511
  */
3241
- abstract createOrUpdate(object: EditableData<Data> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4512
+ abstract createOrUpdate(object: EditableData<Record> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4513
+ /**
4514
+ * Creates or updates a single record. If a record exists with the given id,
4515
+ * it will be update, otherwise a new record will be created.
4516
+ * @param id A unique id.
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.
4519
+ * @returns The full persisted record.
4520
+ */
4521
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3242
4522
  /**
3243
4523
  * Creates or updates a single record. If a record exists with the given id,
3244
4524
  * it will be update, otherwise a new record will be created.
@@ -3246,38 +4526,134 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3246
4526
  * @param object The column names and the values to be persisted.
3247
4527
  * @returns The full persisted record.
3248
4528
  */
3249
- abstract createOrUpdate(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
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>>[]>;
3250
4538
  /**
3251
4539
  * Creates or updates a single record. If a record exists with the given id,
3252
4540
  * it will be update, otherwise a new record will be created.
3253
4541
  * @param objects Array of objects with the column names and the values to be stored in the table.
3254
4542
  * @returns Array of the persisted records.
3255
4543
  */
3256
- abstract createOrUpdate(objects: Array<EditableData<Data> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4544
+ abstract createOrUpdate(objects: Array<EditableData<Record> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3257
4545
  /**
3258
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>;
4552
+ /**
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.
3259
4567
  * @param id The unique id.
3260
- * @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).
3261
4582
  */
3262
- abstract delete(id: string): Promise<void>;
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>>;
3263
4597
  /**
3264
4598
  * Deletes a record given its unique id.
3265
- * @param id An object with a unique id.
3266
- * @throws If the record could not be found or there was an error while performing the deletion.
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.
4603
+ */
4604
+ abstract deleteOrThrow<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4605
+ /**
4606
+ * Deletes a record given its unique id.
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.
4610
+ */
4611
+ abstract deleteOrThrow(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4612
+ /**
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.
3267
4640
  */
3268
- abstract delete(id: Identifiable): Promise<void>;
4641
+ abstract deleteOrThrow(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3269
4642
  /**
3270
- * Deletes a record given a list of unique ids.
3271
- * @param ids The array of unique ids.
3272
- * @throws If the record could not be found or there was an error while performing the deletion.
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.
3273
4648
  */
3274
- abstract delete(ids: string[]): Promise<void>;
4649
+ abstract deleteOrThrow<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
3275
4650
  /**
3276
- * Deletes a record given a list of unique ids.
3277
- * @param ids An array of objects with unique ids.
3278
- * @throws If the record could not be found or there was an error while performing the deletion.
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.
3279
4655
  */
3280
- abstract delete(ids: Identifiable[]): Promise<void>;
4656
+ abstract deleteOrThrow(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3281
4657
  /**
3282
4658
  * Search for records in the table.
3283
4659
  * @param query The query to search for.
@@ -3285,35 +4661,152 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3285
4661
  * @returns The found records.
3286
4662
  */
3287
4663
  abstract search(query: string, options?: {
3288
- fuzziness?: number;
3289
- }): 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, ['*']>>[]>;
3290
4670
  abstract query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3291
4671
  }
3292
- 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> {
3293
4673
  #private;
3294
- db: SchemaPluginResult<any>;
3295
4674
  constructor(options: {
3296
4675
  table: string;
3297
4676
  db: SchemaPluginResult<any>;
3298
4677
  pluginOptions: XataPluginOptions;
4678
+ schemaTables?: Table[];
3299
4679
  });
3300
- create(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3301
- create(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3302
- create(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3303
- read(recordId: string): Promise<SelectedPick<Record, ['*']> | null>;
3304
- update(object: Partial<EditableData<Data>> & Identifiable): Promise<SelectedPick<Record, ['*']>>;
3305
- update(recordId: string, object: Partial<EditableData<Data>>): Promise<SelectedPick<Record, ['*']>>;
3306
- update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<SelectedPick<Record, ['*']>[]>;
3307
- createOrUpdate(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3308
- createOrUpdate(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3309
- createOrUpdate(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3310
- delete(a: string | Identifiable | Array<string | Identifiable>): Promise<void>;
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, ['*']>>>>;
3311
4736
  search(query: string, options?: {
3312
- fuzziness?: number;
3313
- }): Promise<SelectedPick<Record, ['*']>[]>;
4737
+ fuzziness?: FuzzinessExpression;
4738
+ prefix?: PrefixExpression;
4739
+ highlight?: HighlightExpression;
4740
+ filter?: Filter<Record>;
4741
+ boosters?: Boosters<Record>[];
4742
+ }): Promise<any>;
3314
4743
  query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3315
4744
  }
3316
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>;
3317
4810
  /**
3318
4811
  * Operator to restrict results to only values that are greater than the given value.
3319
4812
  */
@@ -3321,15 +4814,35 @@ declare const gt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T
3321
4814
  /**
3322
4815
  * Operator to restrict results to only values that are greater than or equal to the given value.
3323
4816
  */
3324
- 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>;
3325
4822
  /**
3326
4823
  * Operator to restrict results to only values that are greater than or equal to the given value.
3327
4824
  */
3328
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>;
3329
4834
  /**
3330
4835
  * Operator to restrict results to only values that are lower than the given value.
3331
4836
  */
3332
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>;
3333
4846
  /**
3334
4847
  * Operator to restrict results to only values that are lower than or equal to the given value.
3335
4848
  */
@@ -3362,6 +4875,10 @@ declare const pattern: (value: string) => StringTypeFilter;
3362
4875
  * Operator to restrict results to only values that are equal to the given value.
3363
4876
  */
3364
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>;
3365
4882
  /**
3366
4883
  * Operator to restrict results to only values that are not equal to the given value.
3367
4884
  */
@@ -3390,45 +4907,15 @@ declare const includesAny: <T>(value: T) => ArrayFilter<T>;
3390
4907
  declare type SchemaDefinition = {
3391
4908
  table: string;
3392
4909
  };
3393
- declare type SchemaPluginResult<Schemas extends Record<string, BaseData>> = {
4910
+ declare type SchemaPluginResult<Schemas extends Record<string, XataRecord>> = {
3394
4911
  [Key in keyof Schemas]: Repository<Schemas[Key]>;
3395
- } & {
3396
- [key: string]: Repository<XataRecord$1>;
3397
4912
  };
3398
- declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
4913
+ declare class SchemaPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin {
3399
4914
  #private;
3400
- private tableNames?;
3401
- constructor(tableNames?: string[] | undefined);
4915
+ constructor(schemaTables?: Schemas.Table[]);
3402
4916
  build(pluginOptions: XataPluginOptions): SchemaPluginResult<Schemas>;
3403
4917
  }
3404
4918
 
3405
- declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3406
- fuzziness?: number;
3407
- tables?: Tables[];
3408
- };
3409
- declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3410
- all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3411
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]: {
3412
- table: Model;
3413
- record: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>>;
3414
- };
3415
- }>[]>;
3416
- byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3417
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]?: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>[]>;
3418
- }>;
3419
- };
3420
- declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
3421
- #private;
3422
- private db;
3423
- constructor(db: SchemaPluginResult<Schemas>);
3424
- build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
3425
- }
3426
- declare type SearchXataRecord = XataRecord & {
3427
- xata: {
3428
- table: string;
3429
- };
3430
- };
3431
-
3432
4919
  declare type BranchStrategyValue = string | undefined | null;
3433
4920
  declare type BranchStrategyBuilder = () => BranchStrategyValue | Promise<BranchStrategyValue>;
3434
4921
  declare type BranchStrategy = BranchStrategyValue | BranchStrategyBuilder;
@@ -3440,20 +4927,35 @@ declare type BaseClientOptions = {
3440
4927
  databaseURL?: string;
3441
4928
  branch?: BranchStrategyOption;
3442
4929
  cache?: CacheImpl;
4930
+ trace?: TraceFunction;
3443
4931
  };
3444
4932
  declare const buildClient: <Plugins extends Record<string, XataPlugin> = {}>(plugins?: Plugins | undefined) => ClientConstructor<Plugins>;
3445
4933
  interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
3446
- new <Schemas extends Record<string, BaseData> = {}>(options?: Partial<BaseClientOptions>, tables?: string[]): Omit<{
4934
+ new <Schemas extends Record<string, XataRecord> = {}>(options?: Partial<BaseClientOptions>, schemaTables?: readonly BaseSchema[]): Omit<{
3447
4935
  db: Awaited<ReturnType<SchemaPlugin<Schemas>['build']>>;
3448
4936
  search: Awaited<ReturnType<SearchPlugin<Schemas>['build']>>;
3449
4937
  }, keyof Plugins> & {
3450
4938
  [Key in StringKeys<NonNullable<Plugins>>]: Awaited<ReturnType<NonNullable<Plugins>[Key]['build']>>;
4939
+ } & {
4940
+ getConfig(): Promise<{
4941
+ databaseURL: string;
4942
+ branch: string;
4943
+ }>;
3451
4944
  };
3452
4945
  }
3453
4946
  declare const BaseClient_base: ClientConstructor<{}>;
3454
4947
  declare class BaseClient extends BaseClient_base<Record<string, any>> {
3455
4948
  }
3456
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
+
3457
4959
  declare type BranchResolutionOptions = {
3458
4960
  databaseURL?: string;
3459
4961
  apiKey?: string;
@@ -3465,9 +4967,89 @@ declare function getDatabaseURL(): string | undefined;
3465
4967
 
3466
4968
  declare function getAPIKey(): string | undefined;
3467
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
+
3468
5050
  declare class XataError extends Error {
3469
5051
  readonly status: number;
3470
5052
  constructor(message: string, status: number);
3471
5053
  }
3472
5054
 
3473
- export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, AddGitBranchesEntryError, AddGitBranchesEntryPathParams, AddGitBranchesEntryRequestBody, AddGitBranchesEntryResponse, AddGitBranchesEntryVariables, AddTableColumnError, AddTableColumnPathParams, AddTableColumnVariables, BaseClient, BaseClientOptions, BaseData, BulkInsertTableRecordsError, BulkInsertTableRecordsPathParams, BulkInsertTableRecordsRequestBody, BulkInsertTableRecordsResponse, BulkInsertTableRecordsVariables, CacheImpl, CancelWorkspaceMemberInviteError, CancelWorkspaceMemberInvitePathParams, CancelWorkspaceMemberInviteVariables, ClientConstructor, CreateBranchError, CreateBranchPathParams, CreateBranchQueryParams, CreateBranchRequestBody, CreateBranchVariables, CreateDatabaseError, CreateDatabasePathParams, CreateDatabaseRequestBody, CreateDatabaseResponse, CreateDatabaseVariables, CreateTableError, CreateTablePathParams, CreateTableVariables, CreateUserAPIKeyError, CreateUserAPIKeyPathParams, CreateUserAPIKeyResponse, CreateUserAPIKeyVariables, CreateWorkspaceError, CreateWorkspaceVariables, CursorNavigationOptions, DeleteBranchError, DeleteBranchPathParams, DeleteBranchVariables, DeleteColumnError, DeleteColumnPathParams, DeleteColumnVariables, DeleteDatabaseError, DeleteDatabasePathParams, DeleteDatabaseVariables, DeleteRecordError, DeleteRecordPathParams, DeleteRecordVariables, DeleteTableError, DeleteTablePathParams, DeleteTableVariables, DeleteUserAPIKeyError, DeleteUserAPIKeyPathParams, DeleteUserAPIKeyVariables, DeleteUserError, DeleteUserVariables, DeleteWorkspaceError, DeleteWorkspacePathParams, DeleteWorkspaceVariables, EditableData, ExecuteBranchMigrationPlanError, ExecuteBranchMigrationPlanPathParams, ExecuteBranchMigrationPlanRequestBody, ExecuteBranchMigrationPlanVariables, FetchImpl, FetcherExtraProps, GetBranchDetailsError, GetBranchDetailsPathParams, GetBranchDetailsVariables, GetBranchListError, GetBranchListPathParams, GetBranchListVariables, GetBranchMetadataError, GetBranchMetadataPathParams, GetBranchMetadataVariables, GetBranchMigrationHistoryError, GetBranchMigrationHistoryPathParams, GetBranchMigrationHistoryRequestBody, GetBranchMigrationHistoryResponse, GetBranchMigrationHistoryVariables, GetBranchMigrationPlanError, GetBranchMigrationPlanPathParams, GetBranchMigrationPlanVariables, GetBranchStatsError, GetBranchStatsPathParams, GetBranchStatsResponse, GetBranchStatsVariables, GetColumnError, GetColumnPathParams, GetColumnVariables, GetDatabaseListError, GetDatabaseListPathParams, GetDatabaseListVariables, GetGitBranchesMappingError, GetGitBranchesMappingPathParams, GetGitBranchesMappingVariables, GetRecordError, GetRecordPathParams, GetRecordRequestBody, GetRecordVariables, GetTableColumnsError, GetTableColumnsPathParams, GetTableColumnsResponse, GetTableColumnsVariables, GetTableSchemaError, GetTableSchemaPathParams, GetTableSchemaResponse, GetTableSchemaVariables, GetUserAPIKeysError, GetUserAPIKeysResponse, GetUserAPIKeysVariables, GetUserError, GetUserVariables, GetWorkspaceError, GetWorkspaceMembersListError, GetWorkspaceMembersListPathParams, GetWorkspaceMembersListVariables, GetWorkspacePathParams, GetWorkspaceVariables, GetWorkspacesListError, GetWorkspacesListResponse, GetWorkspacesListVariables, Identifiable, InsertRecordError, InsertRecordPathParams, InsertRecordResponse, InsertRecordVariables, InsertRecordWithIDError, InsertRecordWithIDPathParams, InsertRecordWithIDQueryParams, InsertRecordWithIDVariables, InviteWorkspaceMemberError, InviteWorkspaceMemberPathParams, InviteWorkspaceMemberRequestBody, InviteWorkspaceMemberVariables, OffsetNavigationOptions, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Paginable, PaginationOptions, PaginationQueryMeta, Query, QueryTableError, QueryTablePathParams, QueryTableRequestBody, QueryTableVariables, RemoveGitBranchesEntryError, RemoveGitBranchesEntryPathParams, RemoveGitBranchesEntryQueryParams, RemoveGitBranchesEntryVariables, RemoveWorkspaceMemberError, RemoveWorkspaceMemberPathParams, RemoveWorkspaceMemberVariables, Repository, ResendWorkspaceMemberInviteError, ResendWorkspaceMemberInvitePathParams, ResendWorkspaceMemberInviteVariables, ResolveBranchError, ResolveBranchPathParams, ResolveBranchQueryParams, ResolveBranchResponse, ResolveBranchVariables, responses as Responses, RestRepository, SchemaDefinition, SchemaPlugin, SchemaPluginResult, schemas as Schemas, SearchBranchError, SearchBranchPathParams, SearchBranchRequestBody, SearchBranchVariables, SearchOptions, SearchPlugin, SearchPluginResult, SelectableColumn, SelectedPick, SetTableSchemaError, SetTableSchemaPathParams, SetTableSchemaRequestBody, SetTableSchemaVariables, SimpleCache, SimpleCacheOptions, UpdateBranchMetadataError, UpdateBranchMetadataPathParams, UpdateBranchMetadataVariables, UpdateColumnError, UpdateColumnPathParams, UpdateColumnRequestBody, UpdateColumnVariables, UpdateRecordWithIDError, UpdateRecordWithIDPathParams, UpdateRecordWithIDQueryParams, UpdateRecordWithIDVariables, UpdateTableError, UpdateTablePathParams, UpdateTableRequestBody, UpdateTableVariables, UpdateUserError, UpdateUserVariables, UpdateWorkspaceError, UpdateWorkspaceMemberRoleError, UpdateWorkspaceMemberRolePathParams, UpdateWorkspaceMemberRoleRequestBody, UpdateWorkspaceMemberRoleVariables, UpdateWorkspacePathParams, UpdateWorkspaceVariables, UpsertRecordWithIDError, UpsertRecordWithIDPathParams, UpsertRecordWithIDQueryParams, UpsertRecordWithIDVariables, ValueAtColumn, XataApiClient, XataApiClientOptions, XataApiPlugin, XataError, XataPlugin, XataPluginOptions, XataRecord, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, buildClient, bulkInsertTableRecords, cancelWorkspaceMemberInvite, contains, createBranch, createDatabase, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, endsWith, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseURL, getGitBranchesMapping, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isIdentifiable, isNot, isXataRecord, le, lt, lte, notExists, operationsByTag, pattern, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberRole, upsertRecordWithID };
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 };