@xata.io/client 0.0.0-alpha.vfd071d9 → 0.0.0-alpha.vfd1a215

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
  /**
@@ -122,16 +130,20 @@ 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
+ displayName: string;
139
+ createdAt: DateTime;
140
+ numberOfBranches: number;
141
+ ui?: {
142
+ color?: string;
143
+ };
144
+ };
125
145
  declare type ListDatabasesResponse = {
126
- databases?: {
127
- name: string;
128
- displayName: string;
129
- createdAt: DateTime;
130
- numberOfBranches: number;
131
- ui?: {
132
- color?: string;
133
- };
134
- }[];
146
+ databases?: DatabaseMetadata[];
135
147
  };
136
148
  declare type ListBranchesResponse = {
137
149
  databaseName: string;
@@ -181,12 +193,28 @@ declare type Schema = {
181
193
  tables: Table[];
182
194
  tablesOrder?: string[];
183
195
  };
196
+ /**
197
+ * @x-internal true
198
+ */
199
+ declare type SchemaEditScript = {
200
+ sourceMigrationID?: string;
201
+ targetMigrationID?: string;
202
+ tables: TableEdit[];
203
+ };
184
204
  declare type Table = {
185
205
  id?: string;
186
206
  name: TableName;
187
207
  columns: Column[];
188
208
  revLinks?: RevLink[];
189
209
  };
210
+ /**
211
+ * @x-internal true
212
+ */
213
+ declare type TableEdit = {
214
+ oldName?: string;
215
+ newName?: string;
216
+ columns?: MigrationColumnOp[];
217
+ };
190
218
  /**
191
219
  * @x-go-type xata.Column
192
220
  */
@@ -262,12 +290,131 @@ declare type ColumnMigration = {
262
290
  old: Column;
263
291
  ['new']: Column;
264
292
  };
293
+ /**
294
+ * @x-internal true
295
+ */
296
+ declare type Commit = {
297
+ meta?: {
298
+ title?: string;
299
+ message?: string;
300
+ id: string;
301
+ parentID?: string;
302
+ mergeParentID?: string;
303
+ status: string;
304
+ createdAt: DateTime;
305
+ modifiedAt?: DateTime;
306
+ };
307
+ operations: MigrationOp[];
308
+ };
309
+ /**
310
+ * Branch schema migration.
311
+ *
312
+ * @x-internal true
313
+ */
314
+ declare type Migration = {
315
+ parentID?: string;
316
+ operations: MigrationOp[];
317
+ };
318
+ /**
319
+ * Branch schema migration operations.
320
+ *
321
+ * @x-internal true
322
+ */
323
+ declare type MigrationOp = MigrationTableOp | MigrationColumnOp;
324
+ /**
325
+ * @x-internal true
326
+ */
327
+ declare type MigrationTableOp = {
328
+ addTable: TableOpAdd;
329
+ } | {
330
+ removeTable: TableOpRemove;
331
+ } | {
332
+ renameTable: TableOpRename;
333
+ };
334
+ /**
335
+ * @x-internal true
336
+ */
337
+ declare type MigrationColumnOp = {
338
+ addColumn: ColumnOpAdd;
339
+ } | {
340
+ removeColumn: ColumnOpRemove;
341
+ } | {
342
+ renameColumn: ColumnOpRename;
343
+ };
344
+ /**
345
+ * @x-internal true
346
+ */
347
+ declare type TableOpAdd = {
348
+ table: string;
349
+ };
350
+ /**
351
+ * @x-internal true
352
+ */
353
+ declare type TableOpRemove = {
354
+ table: string;
355
+ };
356
+ /**
357
+ * @x-internal true
358
+ */
359
+ declare type TableOpRename = {
360
+ oldName: string;
361
+ newName: string;
362
+ };
363
+ /**
364
+ * @x-internal true
365
+ */
366
+ declare type ColumnOpAdd = {
367
+ table?: string;
368
+ column: Column;
369
+ };
370
+ /**
371
+ * @x-internal true
372
+ */
373
+ declare type ColumnOpRemove = {
374
+ table?: string;
375
+ column: string;
376
+ };
377
+ /**
378
+ * @x-internal true
379
+ */
380
+ declare type ColumnOpRename = {
381
+ table?: string;
382
+ oldName: string;
383
+ newName: string;
384
+ };
385
+ declare type MigrationRequest = {
386
+ number: number;
387
+ createdAt: DateTime;
388
+ modifiedAt?: DateTime;
389
+ closedAt?: DateTime;
390
+ mergedAt?: DateTime;
391
+ status: 'open' | 'closed' | 'merging' | 'merged';
392
+ title: string;
393
+ body: string;
394
+ source: string;
395
+ target: string;
396
+ };
265
397
  declare type SortExpression = string[] | {
266
398
  [key: string]: SortOrder;
267
399
  } | {
268
400
  [key: string]: SortOrder;
269
401
  }[];
270
402
  declare type SortOrder = 'asc' | 'desc';
403
+ /**
404
+ * Maximum [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) for the search terms. The Levenshtein
405
+ * distance is the number of one charcter changes needed to make two strings equal. The default is 1, meaning that single
406
+ * character typos per word are tollerated by search. You can set it to 0 to remove the typo tollerance or set it to 2
407
+ * to allow two typos in a word.
408
+ *
409
+ * @default 1
410
+ * @maximum 2
411
+ * @minimum 0
412
+ */
413
+ declare type FuzzinessExpression = number;
414
+ /**
415
+ * If the prefix type is set to "disabled" (the default), the search only matches full words. If the prefix type is set to "phrase", the search will return results that match prefixes of the search phrase.
416
+ */
417
+ declare type PrefixExpression = 'phrase' | 'disabled';
271
418
  /**
272
419
  * @minProperties 1
273
420
  */
@@ -281,6 +428,48 @@ declare type FilterExpression = {
281
428
  } & {
282
429
  [key: string]: FilterColumn;
283
430
  };
431
+ declare type HighlightExpression = {
432
+ enabled?: boolean;
433
+ encodeHTML?: boolean;
434
+ };
435
+ /**
436
+ * Booster Expression
437
+ *
438
+ * @x-go-type xata.BoosterExpression
439
+ */
440
+ declare type BoosterExpression = {
441
+ valueBooster?: ValueBooster$1;
442
+ } | {
443
+ numericBooster?: NumericBooster$1;
444
+ } | {
445
+ dateBooster?: DateBooster$1;
446
+ };
447
+ /**
448
+ * Boost records with a particular value for a column.
449
+ */
450
+ declare type ValueBooster$1 = {
451
+ column: string;
452
+ value: string | number | boolean;
453
+ factor: number;
454
+ };
455
+ /**
456
+ * Boost records based on the value of a numeric column.
457
+ */
458
+ declare type NumericBooster$1 = {
459
+ column: string;
460
+ factor: number;
461
+ };
462
+ /**
463
+ * Boost records based on the value of a datetime column. It is configured via "origin", "scale", and "decay". The further away from the "origin",
464
+ * 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
465
+ * 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.
466
+ */
467
+ declare type DateBooster$1 = {
468
+ column: string;
469
+ origin?: string;
470
+ scale: string;
471
+ decay: number;
472
+ };
284
473
  declare type FilterList = FilterExpression | FilterExpression[];
285
474
  declare type FilterColumn = FilterColumnIncludes | FilterPredicate | FilterList;
286
475
  /**
@@ -337,7 +526,24 @@ declare type PageConfig = {
337
526
  size?: number;
338
527
  offset?: number;
339
528
  };
340
- declare type ColumnsFilter = string[];
529
+ declare type ColumnsProjection = string[];
530
+ /**
531
+ * Xata Table Record Metadata
532
+ */
533
+ declare type RecordMeta = {
534
+ id: RecordID;
535
+ xata: {
536
+ version: number;
537
+ table?: string;
538
+ highlight?: {
539
+ [key: string]: string[] | {
540
+ [key: string]: any;
541
+ };
542
+ };
543
+ score?: number;
544
+ warnings?: string[];
545
+ };
546
+ };
341
547
  /**
342
548
  * @pattern [a-zA-Z0-9_-~:]+
343
549
  */
@@ -359,16 +565,9 @@ declare type RecordsMetadata = {
359
565
  };
360
566
  };
361
567
  /**
362
- * Xata Table Record
568
+ * Xata Table Record Metadata
363
569
  */
364
- declare type XataRecord$1 = {
365
- id: RecordID;
366
- xata: {
367
- version: number;
368
- table?: string;
369
- warnings?: string[];
370
- };
371
- } & {
570
+ declare type XataRecord$1 = RecordMeta & {
372
571
  [key: string]: any;
373
572
  };
374
573
 
@@ -386,6 +585,7 @@ type schemas_InviteID = InviteID;
386
585
  type schemas_WorkspaceInvite = WorkspaceInvite;
387
586
  type schemas_WorkspaceMembers = WorkspaceMembers;
388
587
  type schemas_InviteKey = InviteKey;
588
+ type schemas_DatabaseMetadata = DatabaseMetadata;
389
589
  type schemas_ListDatabasesResponse = ListDatabasesResponse;
390
590
  type schemas_ListBranchesResponse = ListBranchesResponse;
391
591
  type schemas_ListGitBranchesResponse = ListGitBranchesResponse;
@@ -394,7 +594,9 @@ type schemas_BranchMetadata = BranchMetadata;
394
594
  type schemas_DBBranch = DBBranch;
395
595
  type schemas_StartedFromMetadata = StartedFromMetadata;
396
596
  type schemas_Schema = Schema;
597
+ type schemas_SchemaEditScript = SchemaEditScript;
397
598
  type schemas_Table = Table;
599
+ type schemas_TableEdit = TableEdit;
398
600
  type schemas_Column = Column;
399
601
  type schemas_RevLink = RevLink;
400
602
  type schemas_BranchName = BranchName;
@@ -407,9 +609,25 @@ type schemas_MetricsLatency = MetricsLatency;
407
609
  type schemas_BranchMigration = BranchMigration;
408
610
  type schemas_TableMigration = TableMigration;
409
611
  type schemas_ColumnMigration = ColumnMigration;
612
+ type schemas_Commit = Commit;
613
+ type schemas_Migration = Migration;
614
+ type schemas_MigrationOp = MigrationOp;
615
+ type schemas_MigrationTableOp = MigrationTableOp;
616
+ type schemas_MigrationColumnOp = MigrationColumnOp;
617
+ type schemas_TableOpAdd = TableOpAdd;
618
+ type schemas_TableOpRemove = TableOpRemove;
619
+ type schemas_TableOpRename = TableOpRename;
620
+ type schemas_ColumnOpAdd = ColumnOpAdd;
621
+ type schemas_ColumnOpRemove = ColumnOpRemove;
622
+ type schemas_ColumnOpRename = ColumnOpRename;
623
+ type schemas_MigrationRequest = MigrationRequest;
410
624
  type schemas_SortExpression = SortExpression;
411
625
  type schemas_SortOrder = SortOrder;
626
+ type schemas_FuzzinessExpression = FuzzinessExpression;
627
+ type schemas_PrefixExpression = PrefixExpression;
412
628
  type schemas_FilterExpression = FilterExpression;
629
+ type schemas_HighlightExpression = HighlightExpression;
630
+ type schemas_BoosterExpression = BoosterExpression;
413
631
  type schemas_FilterList = FilterList;
414
632
  type schemas_FilterColumn = FilterColumn;
415
633
  type schemas_FilterColumnIncludes = FilterColumnIncludes;
@@ -419,7 +637,8 @@ type schemas_FilterPredicateRangeOp = FilterPredicateRangeOp;
419
637
  type schemas_FilterRangeValue = FilterRangeValue;
420
638
  type schemas_FilterValue = FilterValue;
421
639
  type schemas_PageConfig = PageConfig;
422
- type schemas_ColumnsFilter = ColumnsFilter;
640
+ type schemas_ColumnsProjection = ColumnsProjection;
641
+ type schemas_RecordMeta = RecordMeta;
423
642
  type schemas_RecordID = RecordID;
424
643
  type schemas_TableRename = TableRename;
425
644
  type schemas_RecordsMetadata = RecordsMetadata;
@@ -439,6 +658,7 @@ declare namespace schemas {
439
658
  schemas_WorkspaceInvite as WorkspaceInvite,
440
659
  schemas_WorkspaceMembers as WorkspaceMembers,
441
660
  schemas_InviteKey as InviteKey,
661
+ schemas_DatabaseMetadata as DatabaseMetadata,
442
662
  schemas_ListDatabasesResponse as ListDatabasesResponse,
443
663
  schemas_ListBranchesResponse as ListBranchesResponse,
444
664
  schemas_ListGitBranchesResponse as ListGitBranchesResponse,
@@ -447,7 +667,9 @@ declare namespace schemas {
447
667
  schemas_DBBranch as DBBranch,
448
668
  schemas_StartedFromMetadata as StartedFromMetadata,
449
669
  schemas_Schema as Schema,
670
+ schemas_SchemaEditScript as SchemaEditScript,
450
671
  schemas_Table as Table,
672
+ schemas_TableEdit as TableEdit,
451
673
  schemas_Column as Column,
452
674
  schemas_RevLink as RevLink,
453
675
  schemas_BranchName as BranchName,
@@ -460,9 +682,28 @@ declare namespace schemas {
460
682
  schemas_BranchMigration as BranchMigration,
461
683
  schemas_TableMigration as TableMigration,
462
684
  schemas_ColumnMigration as ColumnMigration,
685
+ schemas_Commit as Commit,
686
+ schemas_Migration as Migration,
687
+ schemas_MigrationOp as MigrationOp,
688
+ schemas_MigrationTableOp as MigrationTableOp,
689
+ schemas_MigrationColumnOp as MigrationColumnOp,
690
+ schemas_TableOpAdd as TableOpAdd,
691
+ schemas_TableOpRemove as TableOpRemove,
692
+ schemas_TableOpRename as TableOpRename,
693
+ schemas_ColumnOpAdd as ColumnOpAdd,
694
+ schemas_ColumnOpRemove as ColumnOpRemove,
695
+ schemas_ColumnOpRename as ColumnOpRename,
696
+ schemas_MigrationRequest as MigrationRequest,
463
697
  schemas_SortExpression as SortExpression,
464
698
  schemas_SortOrder as SortOrder,
699
+ schemas_FuzzinessExpression as FuzzinessExpression,
700
+ schemas_PrefixExpression as PrefixExpression,
465
701
  schemas_FilterExpression as FilterExpression,
702
+ schemas_HighlightExpression as HighlightExpression,
703
+ schemas_BoosterExpression as BoosterExpression,
704
+ ValueBooster$1 as ValueBooster,
705
+ NumericBooster$1 as NumericBooster,
706
+ DateBooster$1 as DateBooster,
466
707
  schemas_FilterList as FilterList,
467
708
  schemas_FilterColumn as FilterColumn,
468
709
  schemas_FilterColumnIncludes as FilterColumnIncludes,
@@ -472,7 +713,8 @@ declare namespace schemas {
472
713
  schemas_FilterRangeValue as FilterRangeValue,
473
714
  schemas_FilterValue as FilterValue,
474
715
  schemas_PageConfig as PageConfig,
475
- schemas_ColumnsFilter as ColumnsFilter,
716
+ schemas_ColumnsProjection as ColumnsProjection,
717
+ schemas_RecordMeta as RecordMeta,
476
718
  schemas_RecordID as RecordID,
477
719
  schemas_TableRename as TableRename,
478
720
  schemas_RecordsMetadata as RecordsMetadata,
@@ -507,11 +749,22 @@ declare type BulkError = {
507
749
  status?: number;
508
750
  }[];
509
751
  };
752
+ declare type BulkInsertResponse = {
753
+ recordIDs: string[];
754
+ } | {
755
+ records: XataRecord$1[];
756
+ };
510
757
  declare type BranchMigrationPlan = {
511
758
  version: number;
512
759
  migration: BranchMigration;
513
760
  };
514
- declare type RecordUpdateResponse = {
761
+ declare type RecordResponse = XataRecord$1;
762
+ declare type SchemaCompareResponse = {
763
+ source: Schema;
764
+ target: Schema;
765
+ edits: SchemaEditScript;
766
+ };
767
+ declare type RecordUpdateResponse = XataRecord$1 | {
515
768
  id: string;
516
769
  xata: {
517
770
  version: number;
@@ -535,7 +788,10 @@ type responses_SimpleError = SimpleError;
535
788
  type responses_BadRequestError = BadRequestError;
536
789
  type responses_AuthError = AuthError;
537
790
  type responses_BulkError = BulkError;
791
+ type responses_BulkInsertResponse = BulkInsertResponse;
538
792
  type responses_BranchMigrationPlan = BranchMigrationPlan;
793
+ type responses_RecordResponse = RecordResponse;
794
+ type responses_SchemaCompareResponse = SchemaCompareResponse;
539
795
  type responses_RecordUpdateResponse = RecordUpdateResponse;
540
796
  type responses_QueryResponse = QueryResponse;
541
797
  type responses_SearchResponse = SearchResponse;
@@ -546,7 +802,10 @@ declare namespace responses {
546
802
  responses_BadRequestError as BadRequestError,
547
803
  responses_AuthError as AuthError,
548
804
  responses_BulkError as BulkError,
805
+ responses_BulkInsertResponse as BulkInsertResponse,
549
806
  responses_BranchMigrationPlan as BranchMigrationPlan,
807
+ responses_RecordResponse as RecordResponse,
808
+ responses_SchemaCompareResponse as SchemaCompareResponse,
550
809
  responses_RecordUpdateResponse as RecordUpdateResponse,
551
810
  responses_QueryResponse as QueryResponse,
552
811
  responses_SearchResponse as SearchResponse,
@@ -852,6 +1111,9 @@ declare type InviteWorkspaceMemberError = ErrorWrapper<{
852
1111
  } | {
853
1112
  status: 404;
854
1113
  payload: SimpleError;
1114
+ } | {
1115
+ status: 409;
1116
+ payload: SimpleError;
855
1117
  }>;
856
1118
  declare type InviteWorkspaceMemberRequestBody = {
857
1119
  email: string;
@@ -865,6 +1127,34 @@ declare type InviteWorkspaceMemberVariables = {
865
1127
  * Invite some user to join the workspace with the given role
866
1128
  */
867
1129
  declare const inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<WorkspaceInvite>;
1130
+ declare type UpdateWorkspaceMemberInvitePathParams = {
1131
+ workspaceId: WorkspaceID;
1132
+ inviteId: InviteID;
1133
+ };
1134
+ declare type UpdateWorkspaceMemberInviteError = ErrorWrapper<{
1135
+ status: 400;
1136
+ payload: BadRequestError;
1137
+ } | {
1138
+ status: 401;
1139
+ payload: AuthError;
1140
+ } | {
1141
+ status: 404;
1142
+ payload: SimpleError;
1143
+ } | {
1144
+ status: 422;
1145
+ payload: SimpleError;
1146
+ }>;
1147
+ declare type UpdateWorkspaceMemberInviteRequestBody = {
1148
+ role: Role;
1149
+ };
1150
+ declare type UpdateWorkspaceMemberInviteVariables = {
1151
+ body: UpdateWorkspaceMemberInviteRequestBody;
1152
+ pathParams: UpdateWorkspaceMemberInvitePathParams;
1153
+ } & FetcherExtraProps;
1154
+ /**
1155
+ * 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.
1156
+ */
1157
+ declare const updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
868
1158
  declare type CancelWorkspaceMemberInvitePathParams = {
869
1159
  workspaceId: WorkspaceID;
870
1160
  inviteId: InviteID;
@@ -1018,6 +1308,27 @@ declare type DeleteDatabaseVariables = {
1018
1308
  * Delete a database and all of its branches and tables permanently.
1019
1309
  */
1020
1310
  declare const deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
1311
+ declare type GetDatabaseMetadataPathParams = {
1312
+ dbName: DBName;
1313
+ workspace: string;
1314
+ };
1315
+ declare type GetDatabaseMetadataError = ErrorWrapper<{
1316
+ status: 400;
1317
+ payload: BadRequestError;
1318
+ } | {
1319
+ status: 401;
1320
+ payload: AuthError;
1321
+ } | {
1322
+ status: 404;
1323
+ payload: SimpleError;
1324
+ }>;
1325
+ declare type GetDatabaseMetadataVariables = {
1326
+ pathParams: GetDatabaseMetadataPathParams;
1327
+ } & FetcherExtraProps;
1328
+ /**
1329
+ * Retrieve metadata of the given database
1330
+ */
1331
+ declare const getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
1021
1332
  declare type GetGitBranchesMappingPathParams = {
1022
1333
  dbName: DBName;
1023
1334
  workspace: string;
@@ -1151,14 +1462,15 @@ declare type ResolveBranchVariables = {
1151
1462
  } & FetcherExtraProps;
1152
1463
  /**
1153
1464
  * 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
1465
+ * * 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
1466
  * * 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)
1467
+ * * else, if `fallbackBranch` is provided and a branch with that name exists, return it
1468
+ * * else, return the default branch of the DB (`main` or the first branch)
1157
1469
  *
1158
1470
  * Example call:
1159
1471
  *
1160
1472
  * ```json
1161
- * // GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test?fallbackBranch=tsg
1473
+ * // GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test&fallbackBranch=tsg
1162
1474
  * ```
1163
1475
  *
1164
1476
  * Example response:
@@ -1174,11 +1486,11 @@ declare type ResolveBranchVariables = {
1174
1486
  * ```
1175
1487
  */
1176
1488
  declare const resolveBranch: (variables: ResolveBranchVariables) => Promise<ResolveBranchResponse>;
1177
- declare type GetBranchDetailsPathParams = {
1178
- dbBranchName: DBBranchName;
1489
+ declare type ListMigrationRequestsPathParams = {
1490
+ dbName: DBName;
1179
1491
  workspace: string;
1180
1492
  };
1181
- declare type GetBranchDetailsError = ErrorWrapper<{
1493
+ declare type ListMigrationRequestsError = ErrorWrapper<{
1182
1494
  status: 400;
1183
1495
  payload: BadRequestError;
1184
1496
  } | {
@@ -1188,18 +1500,26 @@ declare type GetBranchDetailsError = ErrorWrapper<{
1188
1500
  status: 404;
1189
1501
  payload: SimpleError;
1190
1502
  }>;
1191
- declare type GetBranchDetailsVariables = {
1192
- pathParams: GetBranchDetailsPathParams;
1503
+ declare type ListMigrationRequestsResponse = {
1504
+ migrationRequests: MigrationRequest[];
1505
+ meta: RecordsMetadata;
1506
+ };
1507
+ declare type ListMigrationRequestsRequestBody = {
1508
+ filter?: FilterExpression;
1509
+ sort?: SortExpression;
1510
+ page?: PageConfig;
1511
+ columns?: ColumnsProjection;
1512
+ };
1513
+ declare type ListMigrationRequestsVariables = {
1514
+ body?: ListMigrationRequestsRequestBody;
1515
+ pathParams: ListMigrationRequestsPathParams;
1193
1516
  } & FetcherExtraProps;
1194
- declare const getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
1195
- declare type CreateBranchPathParams = {
1196
- dbBranchName: DBBranchName;
1517
+ declare const listMigrationRequests: (variables: ListMigrationRequestsVariables) => Promise<ListMigrationRequestsResponse>;
1518
+ declare type CreateMigrationRequestPathParams = {
1519
+ dbName: DBName;
1197
1520
  workspace: string;
1198
1521
  };
1199
- declare type CreateBranchQueryParams = {
1200
- from?: string;
1201
- };
1202
- declare type CreateBranchError = ErrorWrapper<{
1522
+ declare type CreateMigrationRequestError = ErrorWrapper<{
1203
1523
  status: 400;
1204
1524
  payload: BadRequestError;
1205
1525
  } | {
@@ -1209,21 +1529,26 @@ declare type CreateBranchError = ErrorWrapper<{
1209
1529
  status: 404;
1210
1530
  payload: SimpleError;
1211
1531
  }>;
1212
- declare type CreateBranchRequestBody = {
1213
- from?: string;
1214
- metadata?: BranchMetadata;
1532
+ declare type CreateMigrationRequestResponse = {
1533
+ number: number;
1215
1534
  };
1216
- declare type CreateBranchVariables = {
1217
- body?: CreateBranchRequestBody;
1218
- pathParams: CreateBranchPathParams;
1219
- queryParams?: CreateBranchQueryParams;
1535
+ declare type CreateMigrationRequestRequestBody = {
1536
+ source: string;
1537
+ target: string;
1538
+ title: string;
1539
+ body?: string;
1540
+ };
1541
+ declare type CreateMigrationRequestVariables = {
1542
+ body: CreateMigrationRequestRequestBody;
1543
+ pathParams: CreateMigrationRequestPathParams;
1220
1544
  } & FetcherExtraProps;
1221
- declare const createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
1222
- declare type DeleteBranchPathParams = {
1223
- dbBranchName: DBBranchName;
1545
+ declare const createMigrationRequest: (variables: CreateMigrationRequestVariables) => Promise<CreateMigrationRequestResponse>;
1546
+ declare type GetMigrationRequestPathParams = {
1547
+ dbName: DBName;
1548
+ mrNumber: number;
1224
1549
  workspace: string;
1225
1550
  };
1226
- declare type DeleteBranchError = ErrorWrapper<{
1551
+ declare type GetMigrationRequestError = ErrorWrapper<{
1227
1552
  status: 400;
1228
1553
  payload: BadRequestError;
1229
1554
  } | {
@@ -1233,18 +1558,16 @@ declare type DeleteBranchError = ErrorWrapper<{
1233
1558
  status: 404;
1234
1559
  payload: SimpleError;
1235
1560
  }>;
1236
- declare type DeleteBranchVariables = {
1237
- pathParams: DeleteBranchPathParams;
1561
+ declare type GetMigrationRequestVariables = {
1562
+ pathParams: GetMigrationRequestPathParams;
1238
1563
  } & 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;
1564
+ declare const getMigrationRequest: (variables: GetMigrationRequestVariables) => Promise<MigrationRequest>;
1565
+ declare type UpdateMigrationRequestPathParams = {
1566
+ dbName: DBName;
1567
+ mrNumber: number;
1245
1568
  workspace: string;
1246
1569
  };
1247
- declare type UpdateBranchMetadataError = ErrorWrapper<{
1570
+ declare type UpdateMigrationRequestError = ErrorWrapper<{
1248
1571
  status: 400;
1249
1572
  payload: BadRequestError;
1250
1573
  } | {
@@ -1254,19 +1577,22 @@ declare type UpdateBranchMetadataError = ErrorWrapper<{
1254
1577
  status: 404;
1255
1578
  payload: SimpleError;
1256
1579
  }>;
1257
- declare type UpdateBranchMetadataVariables = {
1258
- body?: BranchMetadata;
1259
- pathParams: UpdateBranchMetadataPathParams;
1580
+ declare type UpdateMigrationRequestRequestBody = {
1581
+ title?: string;
1582
+ body?: string;
1583
+ status?: 'open' | 'closed';
1584
+ };
1585
+ declare type UpdateMigrationRequestVariables = {
1586
+ body?: UpdateMigrationRequestRequestBody;
1587
+ pathParams: UpdateMigrationRequestPathParams;
1260
1588
  } & FetcherExtraProps;
1261
- /**
1262
- * Update the branch metadata
1263
- */
1264
- declare const updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
1265
- declare type GetBranchMetadataPathParams = {
1266
- dbBranchName: DBBranchName;
1589
+ declare const updateMigrationRequest: (variables: UpdateMigrationRequestVariables) => Promise<undefined>;
1590
+ declare type ListMigrationRequestsCommitsPathParams = {
1591
+ dbName: DBName;
1592
+ mrNumber: number;
1267
1593
  workspace: string;
1268
1594
  };
1269
- declare type GetBranchMetadataError = ErrorWrapper<{
1595
+ declare type ListMigrationRequestsCommitsError = ErrorWrapper<{
1270
1596
  status: 400;
1271
1597
  payload: BadRequestError;
1272
1598
  } | {
@@ -1276,15 +1602,31 @@ declare type GetBranchMetadataError = ErrorWrapper<{
1276
1602
  status: 404;
1277
1603
  payload: SimpleError;
1278
1604
  }>;
1279
- declare type GetBranchMetadataVariables = {
1280
- pathParams: GetBranchMetadataPathParams;
1605
+ declare type ListMigrationRequestsCommitsResponse = {
1606
+ meta: {
1607
+ cursor: string;
1608
+ more: boolean;
1609
+ };
1610
+ logs: Commit[];
1611
+ };
1612
+ declare type ListMigrationRequestsCommitsRequestBody = {
1613
+ page?: {
1614
+ after?: string;
1615
+ before?: string;
1616
+ size?: number;
1617
+ };
1618
+ };
1619
+ declare type ListMigrationRequestsCommitsVariables = {
1620
+ body?: ListMigrationRequestsCommitsRequestBody;
1621
+ pathParams: ListMigrationRequestsCommitsPathParams;
1281
1622
  } & FetcherExtraProps;
1282
- declare const getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
1283
- declare type GetBranchMigrationHistoryPathParams = {
1284
- dbBranchName: DBBranchName;
1623
+ declare const listMigrationRequestsCommits: (variables: ListMigrationRequestsCommitsVariables) => Promise<ListMigrationRequestsCommitsResponse>;
1624
+ declare type CompareMigrationRequestPathParams = {
1625
+ dbName: DBName;
1626
+ mrNumber: number;
1285
1627
  workspace: string;
1286
1628
  };
1287
- declare type GetBranchMigrationHistoryError = ErrorWrapper<{
1629
+ declare type CompareMigrationRequestError = ErrorWrapper<{
1288
1630
  status: 400;
1289
1631
  payload: BadRequestError;
1290
1632
  } | {
@@ -1294,24 +1636,16 @@ declare type GetBranchMigrationHistoryError = ErrorWrapper<{
1294
1636
  status: 404;
1295
1637
  payload: SimpleError;
1296
1638
  }>;
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;
1639
+ declare type CompareMigrationRequestVariables = {
1640
+ pathParams: CompareMigrationRequestPathParams;
1308
1641
  } & FetcherExtraProps;
1309
- declare const getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
1310
- declare type ExecuteBranchMigrationPlanPathParams = {
1311
- dbBranchName: DBBranchName;
1642
+ declare const compareMigrationRequest: (variables: CompareMigrationRequestVariables) => Promise<SchemaCompareResponse>;
1643
+ declare type GetMigrationRequestIsMergedPathParams = {
1644
+ dbName: DBName;
1645
+ mrNumber: number;
1312
1646
  workspace: string;
1313
1647
  };
1314
- declare type ExecuteBranchMigrationPlanError = ErrorWrapper<{
1648
+ declare type GetMigrationRequestIsMergedError = ErrorWrapper<{
1315
1649
  status: 400;
1316
1650
  payload: BadRequestError;
1317
1651
  } | {
@@ -1321,23 +1655,19 @@ declare type ExecuteBranchMigrationPlanError = ErrorWrapper<{
1321
1655
  status: 404;
1322
1656
  payload: SimpleError;
1323
1657
  }>;
1324
- declare type ExecuteBranchMigrationPlanRequestBody = {
1325
- version: number;
1326
- migration: BranchMigration;
1658
+ declare type GetMigrationRequestIsMergedResponse = {
1659
+ merged?: boolean;
1327
1660
  };
1328
- declare type ExecuteBranchMigrationPlanVariables = {
1329
- body: ExecuteBranchMigrationPlanRequestBody;
1330
- pathParams: ExecuteBranchMigrationPlanPathParams;
1661
+ declare type GetMigrationRequestIsMergedVariables = {
1662
+ pathParams: GetMigrationRequestIsMergedPathParams;
1331
1663
  } & FetcherExtraProps;
1332
- /**
1333
- * Apply a migration plan to the branch
1334
- */
1335
- declare const executeBranchMigrationPlan: (variables: ExecuteBranchMigrationPlanVariables) => Promise<undefined>;
1336
- declare type GetBranchMigrationPlanPathParams = {
1337
- dbBranchName: DBBranchName;
1664
+ declare const getMigrationRequestIsMerged: (variables: GetMigrationRequestIsMergedVariables) => Promise<GetMigrationRequestIsMergedResponse>;
1665
+ declare type MergeMigrationRequestPathParams = {
1666
+ dbName: DBName;
1667
+ mrNumber: number;
1338
1668
  workspace: string;
1339
1669
  };
1340
- declare type GetBranchMigrationPlanError = ErrorWrapper<{
1670
+ declare type MergeMigrationRequestError = ErrorWrapper<{
1341
1671
  status: 400;
1342
1672
  payload: BadRequestError;
1343
1673
  } | {
@@ -1347,14 +1677,346 @@ declare type GetBranchMigrationPlanError = ErrorWrapper<{
1347
1677
  status: 404;
1348
1678
  payload: SimpleError;
1349
1679
  }>;
1350
- declare type GetBranchMigrationPlanVariables = {
1351
- body: Schema;
1352
- pathParams: GetBranchMigrationPlanPathParams;
1680
+ declare type MergeMigrationRequestVariables = {
1681
+ pathParams: MergeMigrationRequestPathParams;
1353
1682
  } & FetcherExtraProps;
1354
- /**
1683
+ declare const mergeMigrationRequest: (variables: MergeMigrationRequestVariables) => Promise<Commit>;
1684
+ declare type GetBranchDetailsPathParams = {
1685
+ dbBranchName: DBBranchName;
1686
+ workspace: string;
1687
+ };
1688
+ declare type GetBranchDetailsError = ErrorWrapper<{
1689
+ status: 400;
1690
+ payload: BadRequestError;
1691
+ } | {
1692
+ status: 401;
1693
+ payload: AuthError;
1694
+ } | {
1695
+ status: 404;
1696
+ payload: SimpleError;
1697
+ }>;
1698
+ declare type GetBranchDetailsVariables = {
1699
+ pathParams: GetBranchDetailsPathParams;
1700
+ } & FetcherExtraProps;
1701
+ declare const getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
1702
+ declare type CreateBranchPathParams = {
1703
+ dbBranchName: DBBranchName;
1704
+ workspace: string;
1705
+ };
1706
+ declare type CreateBranchQueryParams = {
1707
+ from?: string;
1708
+ };
1709
+ declare type CreateBranchError = ErrorWrapper<{
1710
+ status: 400;
1711
+ payload: BadRequestError;
1712
+ } | {
1713
+ status: 401;
1714
+ payload: AuthError;
1715
+ } | {
1716
+ status: 404;
1717
+ payload: SimpleError;
1718
+ }>;
1719
+ declare type CreateBranchResponse = {
1720
+ databaseName: string;
1721
+ branchName: string;
1722
+ };
1723
+ declare type CreateBranchRequestBody = {
1724
+ from?: string;
1725
+ metadata?: BranchMetadata;
1726
+ };
1727
+ declare type CreateBranchVariables = {
1728
+ body?: CreateBranchRequestBody;
1729
+ pathParams: CreateBranchPathParams;
1730
+ queryParams?: CreateBranchQueryParams;
1731
+ } & FetcherExtraProps;
1732
+ declare const createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
1733
+ declare type DeleteBranchPathParams = {
1734
+ dbBranchName: DBBranchName;
1735
+ workspace: string;
1736
+ };
1737
+ declare type DeleteBranchError = ErrorWrapper<{
1738
+ status: 400;
1739
+ payload: BadRequestError;
1740
+ } | {
1741
+ status: 401;
1742
+ payload: AuthError;
1743
+ } | {
1744
+ status: 404;
1745
+ payload: SimpleError;
1746
+ }>;
1747
+ declare type DeleteBranchVariables = {
1748
+ pathParams: DeleteBranchPathParams;
1749
+ } & FetcherExtraProps;
1750
+ /**
1751
+ * Delete the branch in the database and all its resources
1752
+ */
1753
+ declare const deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
1754
+ declare type UpdateBranchMetadataPathParams = {
1755
+ dbBranchName: DBBranchName;
1756
+ workspace: string;
1757
+ };
1758
+ declare type UpdateBranchMetadataError = ErrorWrapper<{
1759
+ status: 400;
1760
+ payload: BadRequestError;
1761
+ } | {
1762
+ status: 401;
1763
+ payload: AuthError;
1764
+ } | {
1765
+ status: 404;
1766
+ payload: SimpleError;
1767
+ }>;
1768
+ declare type UpdateBranchMetadataVariables = {
1769
+ body?: BranchMetadata;
1770
+ pathParams: UpdateBranchMetadataPathParams;
1771
+ } & FetcherExtraProps;
1772
+ /**
1773
+ * Update the branch metadata
1774
+ */
1775
+ declare const updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
1776
+ declare type GetBranchMetadataPathParams = {
1777
+ dbBranchName: DBBranchName;
1778
+ workspace: string;
1779
+ };
1780
+ declare type GetBranchMetadataError = ErrorWrapper<{
1781
+ status: 400;
1782
+ payload: BadRequestError;
1783
+ } | {
1784
+ status: 401;
1785
+ payload: AuthError;
1786
+ } | {
1787
+ status: 404;
1788
+ payload: SimpleError;
1789
+ }>;
1790
+ declare type GetBranchMetadataVariables = {
1791
+ pathParams: GetBranchMetadataPathParams;
1792
+ } & FetcherExtraProps;
1793
+ declare const getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
1794
+ declare type GetBranchMigrationHistoryPathParams = {
1795
+ dbBranchName: DBBranchName;
1796
+ workspace: string;
1797
+ };
1798
+ declare type GetBranchMigrationHistoryError = ErrorWrapper<{
1799
+ status: 400;
1800
+ payload: BadRequestError;
1801
+ } | {
1802
+ status: 401;
1803
+ payload: AuthError;
1804
+ } | {
1805
+ status: 404;
1806
+ payload: SimpleError;
1807
+ }>;
1808
+ declare type GetBranchMigrationHistoryResponse = {
1809
+ startedFrom?: StartedFromMetadata;
1810
+ migrations?: BranchMigration[];
1811
+ };
1812
+ declare type GetBranchMigrationHistoryRequestBody = {
1813
+ limit?: number;
1814
+ startFrom?: string;
1815
+ };
1816
+ declare type GetBranchMigrationHistoryVariables = {
1817
+ body?: GetBranchMigrationHistoryRequestBody;
1818
+ pathParams: GetBranchMigrationHistoryPathParams;
1819
+ } & FetcherExtraProps;
1820
+ declare const getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
1821
+ declare type ExecuteBranchMigrationPlanPathParams = {
1822
+ dbBranchName: DBBranchName;
1823
+ workspace: string;
1824
+ };
1825
+ declare type ExecuteBranchMigrationPlanError = ErrorWrapper<{
1826
+ status: 400;
1827
+ payload: BadRequestError;
1828
+ } | {
1829
+ status: 401;
1830
+ payload: AuthError;
1831
+ } | {
1832
+ status: 404;
1833
+ payload: SimpleError;
1834
+ }>;
1835
+ declare type ExecuteBranchMigrationPlanRequestBody = {
1836
+ version: number;
1837
+ migration: BranchMigration;
1838
+ };
1839
+ declare type ExecuteBranchMigrationPlanVariables = {
1840
+ body: ExecuteBranchMigrationPlanRequestBody;
1841
+ pathParams: ExecuteBranchMigrationPlanPathParams;
1842
+ } & FetcherExtraProps;
1843
+ /**
1844
+ * Apply a migration plan to the branch
1845
+ */
1846
+ declare const executeBranchMigrationPlan: (variables: ExecuteBranchMigrationPlanVariables) => Promise<undefined>;
1847
+ declare type GetBranchMigrationPlanPathParams = {
1848
+ dbBranchName: DBBranchName;
1849
+ workspace: string;
1850
+ };
1851
+ declare type GetBranchMigrationPlanError = ErrorWrapper<{
1852
+ status: 400;
1853
+ payload: BadRequestError;
1854
+ } | {
1855
+ status: 401;
1856
+ payload: AuthError;
1857
+ } | {
1858
+ status: 404;
1859
+ payload: SimpleError;
1860
+ }>;
1861
+ declare type GetBranchMigrationPlanVariables = {
1862
+ body: Schema;
1863
+ pathParams: GetBranchMigrationPlanPathParams;
1864
+ } & FetcherExtraProps;
1865
+ /**
1355
1866
  * Compute a migration plan from a target schema the branch should be migrated too.
1356
1867
  */
1357
1868
  declare const getBranchMigrationPlan: (variables: GetBranchMigrationPlanVariables) => Promise<BranchMigrationPlan>;
1869
+ declare type CompareBranchWithUserSchemaPathParams = {
1870
+ dbBranchName: DBBranchName;
1871
+ workspace: string;
1872
+ };
1873
+ declare type CompareBranchWithUserSchemaError = ErrorWrapper<{
1874
+ status: 400;
1875
+ payload: BadRequestError;
1876
+ } | {
1877
+ status: 401;
1878
+ payload: AuthError;
1879
+ } | {
1880
+ status: 404;
1881
+ payload: SimpleError;
1882
+ }>;
1883
+ declare type CompareBranchWithUserSchemaRequestBody = {
1884
+ schema: Schema;
1885
+ };
1886
+ declare type CompareBranchWithUserSchemaVariables = {
1887
+ body: CompareBranchWithUserSchemaRequestBody;
1888
+ pathParams: CompareBranchWithUserSchemaPathParams;
1889
+ } & FetcherExtraProps;
1890
+ declare const compareBranchWithUserSchema: (variables: CompareBranchWithUserSchemaVariables) => Promise<SchemaCompareResponse>;
1891
+ declare type CompareBranchSchemasPathParams = {
1892
+ dbBranchName: DBBranchName;
1893
+ branchName: BranchName;
1894
+ workspace: string;
1895
+ };
1896
+ declare type CompareBranchSchemasError = ErrorWrapper<{
1897
+ status: 400;
1898
+ payload: BadRequestError;
1899
+ } | {
1900
+ status: 401;
1901
+ payload: AuthError;
1902
+ } | {
1903
+ status: 404;
1904
+ payload: SimpleError;
1905
+ }>;
1906
+ declare type CompareBranchSchemasVariables = {
1907
+ body?: Record<string, any>;
1908
+ pathParams: CompareBranchSchemasPathParams;
1909
+ } & FetcherExtraProps;
1910
+ declare const compareBranchSchemas: (variables: CompareBranchSchemasVariables) => Promise<SchemaCompareResponse>;
1911
+ declare type UpdateBranchSchemaPathParams = {
1912
+ dbBranchName: DBBranchName;
1913
+ workspace: string;
1914
+ };
1915
+ declare type UpdateBranchSchemaError = ErrorWrapper<{
1916
+ status: 400;
1917
+ payload: BadRequestError;
1918
+ } | {
1919
+ status: 401;
1920
+ payload: AuthError;
1921
+ } | {
1922
+ status: 404;
1923
+ payload: SimpleError;
1924
+ }>;
1925
+ declare type UpdateBranchSchemaResponse = {
1926
+ id: string;
1927
+ parentID: string;
1928
+ };
1929
+ declare type UpdateBranchSchemaVariables = {
1930
+ body: Migration;
1931
+ pathParams: UpdateBranchSchemaPathParams;
1932
+ } & FetcherExtraProps;
1933
+ declare const updateBranchSchema: (variables: UpdateBranchSchemaVariables) => Promise<UpdateBranchSchemaResponse>;
1934
+ declare type PreviewBranchSchemaEditPathParams = {
1935
+ dbBranchName: DBBranchName;
1936
+ workspace: string;
1937
+ };
1938
+ declare type PreviewBranchSchemaEditError = ErrorWrapper<{
1939
+ status: 400;
1940
+ payload: BadRequestError;
1941
+ } | {
1942
+ status: 401;
1943
+ payload: AuthError;
1944
+ } | {
1945
+ status: 404;
1946
+ payload: SimpleError;
1947
+ }>;
1948
+ declare type PreviewBranchSchemaEditResponse = {
1949
+ original: Schema;
1950
+ updated: Schema;
1951
+ };
1952
+ declare type PreviewBranchSchemaEditRequestBody = {
1953
+ edits?: SchemaEditScript;
1954
+ operations?: MigrationOp[];
1955
+ };
1956
+ declare type PreviewBranchSchemaEditVariables = {
1957
+ body?: PreviewBranchSchemaEditRequestBody;
1958
+ pathParams: PreviewBranchSchemaEditPathParams;
1959
+ } & FetcherExtraProps;
1960
+ declare const previewBranchSchemaEdit: (variables: PreviewBranchSchemaEditVariables) => Promise<PreviewBranchSchemaEditResponse>;
1961
+ declare type ApplyBranchSchemaEditPathParams = {
1962
+ dbBranchName: DBBranchName;
1963
+ workspace: string;
1964
+ };
1965
+ declare type ApplyBranchSchemaEditError = ErrorWrapper<{
1966
+ status: 400;
1967
+ payload: BadRequestError;
1968
+ } | {
1969
+ status: 401;
1970
+ payload: AuthError;
1971
+ } | {
1972
+ status: 404;
1973
+ payload: SimpleError;
1974
+ }>;
1975
+ declare type ApplyBranchSchemaEditResponse = {
1976
+ id: string;
1977
+ parentID: string;
1978
+ };
1979
+ declare type ApplyBranchSchemaEditRequestBody = {
1980
+ edits: SchemaEditScript;
1981
+ };
1982
+ declare type ApplyBranchSchemaEditVariables = {
1983
+ body: ApplyBranchSchemaEditRequestBody;
1984
+ pathParams: ApplyBranchSchemaEditPathParams;
1985
+ } & FetcherExtraProps;
1986
+ declare const applyBranchSchemaEdit: (variables: ApplyBranchSchemaEditVariables) => Promise<ApplyBranchSchemaEditResponse>;
1987
+ declare type GetBranchSchemaHistoryPathParams = {
1988
+ dbBranchName: DBBranchName;
1989
+ workspace: string;
1990
+ };
1991
+ declare type GetBranchSchemaHistoryError = ErrorWrapper<{
1992
+ status: 400;
1993
+ payload: BadRequestError;
1994
+ } | {
1995
+ status: 401;
1996
+ payload: AuthError;
1997
+ } | {
1998
+ status: 404;
1999
+ payload: SimpleError;
2000
+ }>;
2001
+ declare type GetBranchSchemaHistoryResponse = {
2002
+ meta: {
2003
+ cursor: string;
2004
+ more: boolean;
2005
+ };
2006
+ logs: Commit[];
2007
+ };
2008
+ declare type GetBranchSchemaHistoryRequestBody = {
2009
+ page?: {
2010
+ after?: string;
2011
+ before?: string;
2012
+ size?: number;
2013
+ };
2014
+ };
2015
+ declare type GetBranchSchemaHistoryVariables = {
2016
+ body?: GetBranchSchemaHistoryRequestBody;
2017
+ pathParams: GetBranchSchemaHistoryPathParams;
2018
+ } & FetcherExtraProps;
2019
+ declare const getBranchSchemaHistory: (variables: GetBranchSchemaHistoryVariables) => Promise<GetBranchSchemaHistoryResponse>;
1358
2020
  declare type GetBranchStatsPathParams = {
1359
2021
  dbBranchName: DBBranchName;
1360
2022
  workspace: string;
@@ -1405,13 +2067,17 @@ declare type CreateTableError = ErrorWrapper<{
1405
2067
  status: 422;
1406
2068
  payload: SimpleError;
1407
2069
  }>;
2070
+ declare type CreateTableResponse = {
2071
+ branchName: string;
2072
+ tableName: string;
2073
+ };
1408
2074
  declare type CreateTableVariables = {
1409
2075
  pathParams: CreateTablePathParams;
1410
2076
  } & FetcherExtraProps;
1411
2077
  /**
1412
2078
  * Creates a new table with the given name. Returns 422 if a table with the same name already exists.
1413
2079
  */
1414
- declare const createTable: (variables: CreateTableVariables) => Promise<undefined>;
2080
+ declare const createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
1415
2081
  declare type DeleteTablePathParams = {
1416
2082
  dbBranchName: DBBranchName;
1417
2083
  tableName: TableName;
@@ -1458,8 +2124,9 @@ declare type UpdateTableVariables = {
1458
2124
  *
1459
2125
  * In the example below, we rename a table from “users” to “people”:
1460
2126
  *
1461
- * ```jsx
1462
- * PATCH /db/test:main/tables/users
2127
+ * ```json
2128
+ * // PATCH /db/test:main/tables/users
2129
+ *
1463
2130
  * {
1464
2131
  * "name": "people"
1465
2132
  * }
@@ -1643,6 +2310,9 @@ declare type InsertRecordPathParams = {
1643
2310
  tableName: TableName;
1644
2311
  workspace: string;
1645
2312
  };
2313
+ declare type InsertRecordQueryParams = {
2314
+ columns?: ColumnsProjection;
2315
+ };
1646
2316
  declare type InsertRecordError = ErrorWrapper<{
1647
2317
  status: 400;
1648
2318
  payload: BadRequestError;
@@ -1653,20 +2323,15 @@ declare type InsertRecordError = ErrorWrapper<{
1653
2323
  status: 404;
1654
2324
  payload: SimpleError;
1655
2325
  }>;
1656
- declare type InsertRecordResponse = {
1657
- id: string;
1658
- xata: {
1659
- version: number;
1660
- };
1661
- };
1662
2326
  declare type InsertRecordVariables = {
1663
2327
  body?: Record<string, any>;
1664
2328
  pathParams: InsertRecordPathParams;
2329
+ queryParams?: InsertRecordQueryParams;
1665
2330
  } & FetcherExtraProps;
1666
2331
  /**
1667
2332
  * Insert a new Record into the Table
1668
2333
  */
1669
- declare const insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
2334
+ declare const insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
1670
2335
  declare type InsertRecordWithIDPathParams = {
1671
2336
  dbBranchName: DBBranchName;
1672
2337
  tableName: TableName;
@@ -1674,6 +2339,7 @@ declare type InsertRecordWithIDPathParams = {
1674
2339
  workspace: string;
1675
2340
  };
1676
2341
  declare type InsertRecordWithIDQueryParams = {
2342
+ columns?: ColumnsProjection;
1677
2343
  createOnly?: boolean;
1678
2344
  ifVersion?: number;
1679
2345
  };
@@ -1706,6 +2372,7 @@ declare type UpdateRecordWithIDPathParams = {
1706
2372
  workspace: string;
1707
2373
  };
1708
2374
  declare type UpdateRecordWithIDQueryParams = {
2375
+ columns?: ColumnsProjection;
1709
2376
  ifVersion?: number;
1710
2377
  };
1711
2378
  declare type UpdateRecordWithIDError = ErrorWrapper<{
@@ -1734,6 +2401,7 @@ declare type UpsertRecordWithIDPathParams = {
1734
2401
  workspace: string;
1735
2402
  };
1736
2403
  declare type UpsertRecordWithIDQueryParams = {
2404
+ columns?: ColumnsProjection;
1737
2405
  ifVersion?: number;
1738
2406
  };
1739
2407
  declare type UpsertRecordWithIDError = ErrorWrapper<{
@@ -1761,6 +2429,9 @@ declare type DeleteRecordPathParams = {
1761
2429
  recordId: RecordID;
1762
2430
  workspace: string;
1763
2431
  };
2432
+ declare type DeleteRecordQueryParams = {
2433
+ columns?: ColumnsProjection;
2434
+ };
1764
2435
  declare type DeleteRecordError = ErrorWrapper<{
1765
2436
  status: 400;
1766
2437
  payload: BadRequestError;
@@ -1773,14 +2444,18 @@ declare type DeleteRecordError = ErrorWrapper<{
1773
2444
  }>;
1774
2445
  declare type DeleteRecordVariables = {
1775
2446
  pathParams: DeleteRecordPathParams;
2447
+ queryParams?: DeleteRecordQueryParams;
1776
2448
  } & FetcherExtraProps;
1777
- declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
2449
+ declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
1778
2450
  declare type GetRecordPathParams = {
1779
2451
  dbBranchName: DBBranchName;
1780
2452
  tableName: TableName;
1781
2453
  recordId: RecordID;
1782
2454
  workspace: string;
1783
2455
  };
2456
+ declare type GetRecordQueryParams = {
2457
+ columns?: ColumnsProjection;
2458
+ };
1784
2459
  declare type GetRecordError = ErrorWrapper<{
1785
2460
  status: 400;
1786
2461
  payload: BadRequestError;
@@ -1791,12 +2466,9 @@ declare type GetRecordError = ErrorWrapper<{
1791
2466
  status: 404;
1792
2467
  payload: SimpleError;
1793
2468
  }>;
1794
- declare type GetRecordRequestBody = {
1795
- columns?: ColumnsFilter;
1796
- };
1797
2469
  declare type GetRecordVariables = {
1798
- body?: GetRecordRequestBody;
1799
2470
  pathParams: GetRecordPathParams;
2471
+ queryParams?: GetRecordQueryParams;
1800
2472
  } & FetcherExtraProps;
1801
2473
  /**
1802
2474
  * Retrieve record by ID
@@ -1807,6 +2479,9 @@ declare type BulkInsertTableRecordsPathParams = {
1807
2479
  tableName: TableName;
1808
2480
  workspace: string;
1809
2481
  };
2482
+ declare type BulkInsertTableRecordsQueryParams = {
2483
+ columns?: ColumnsProjection;
2484
+ };
1810
2485
  declare type BulkInsertTableRecordsError = ErrorWrapper<{
1811
2486
  status: 400;
1812
2487
  payload: BulkError;
@@ -1816,21 +2491,22 @@ declare type BulkInsertTableRecordsError = ErrorWrapper<{
1816
2491
  } | {
1817
2492
  status: 404;
1818
2493
  payload: SimpleError;
2494
+ } | {
2495
+ status: 422;
2496
+ payload: SimpleError;
1819
2497
  }>;
1820
- declare type BulkInsertTableRecordsResponse = {
1821
- recordIDs: string[];
1822
- };
1823
2498
  declare type BulkInsertTableRecordsRequestBody = {
1824
2499
  records: Record<string, any>[];
1825
2500
  };
1826
2501
  declare type BulkInsertTableRecordsVariables = {
1827
2502
  body: BulkInsertTableRecordsRequestBody;
1828
2503
  pathParams: BulkInsertTableRecordsPathParams;
2504
+ queryParams?: BulkInsertTableRecordsQueryParams;
1829
2505
  } & FetcherExtraProps;
1830
2506
  /**
1831
2507
  * Bulk insert records
1832
2508
  */
1833
- declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
2509
+ declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
1834
2510
  declare type QueryTablePathParams = {
1835
2511
  dbBranchName: DBBranchName;
1836
2512
  tableName: TableName;
@@ -1850,7 +2526,7 @@ declare type QueryTableRequestBody = {
1850
2526
  filter?: FilterExpression;
1851
2527
  sort?: SortExpression;
1852
2528
  page?: PageConfig;
1853
- columns?: ColumnsFilter;
2529
+ columns?: ColumnsProjection;
1854
2530
  };
1855
2531
  declare type QueryTableVariables = {
1856
2532
  body?: QueryTableRequestBody;
@@ -1867,7 +2543,7 @@ declare type QueryTableVariables = {
1867
2543
  * {
1868
2544
  * "columns": [...],
1869
2545
  * "filter": {
1870
- * "$all": [...]
2546
+ * "$all": [...],
1871
2547
  * "$any": [...]
1872
2548
  * ...
1873
2549
  * },
@@ -2005,7 +2681,7 @@ declare type QueryTableVariables = {
2005
2681
  * {
2006
2682
  * "name": "Kilian",
2007
2683
  * "address": {
2008
- * "street": "New street",
2684
+ * "street": "New street"
2009
2685
  * }
2010
2686
  * }
2011
2687
  * ```
@@ -2014,10 +2690,7 @@ declare type QueryTableVariables = {
2014
2690
  *
2015
2691
  * ```json
2016
2692
  * {
2017
- * "columns": [
2018
- * "*",
2019
- * "team.name"
2020
- * ]
2693
+ * "columns": ["*", "team.name"]
2021
2694
  * }
2022
2695
  * ```
2023
2696
  *
@@ -2035,7 +2708,7 @@ declare type QueryTableVariables = {
2035
2708
  * "team": {
2036
2709
  * "id": "XX",
2037
2710
  * "xata": {
2038
- * "version": 0,
2711
+ * "version": 0
2039
2712
  * },
2040
2713
  * "name": "first team"
2041
2714
  * }
@@ -2046,10 +2719,7 @@ declare type QueryTableVariables = {
2046
2719
  *
2047
2720
  * ```json
2048
2721
  * {
2049
- * "columns": [
2050
- * "*",
2051
- * "team.*"
2052
- * ]
2722
+ * "columns": ["*", "team.*"]
2053
2723
  * }
2054
2724
  * ```
2055
2725
  *
@@ -2067,7 +2737,7 @@ declare type QueryTableVariables = {
2067
2737
  * "team": {
2068
2738
  * "id": "XX",
2069
2739
  * "xata": {
2070
- * "version": 0,
2740
+ * "version": 0
2071
2741
  * },
2072
2742
  * "name": "first team",
2073
2743
  * "code": "A1",
@@ -2117,7 +2787,7 @@ declare type QueryTableVariables = {
2117
2787
  * ```json
2118
2788
  * {
2119
2789
  * "filter": {
2120
- * "name": "r2",
2790
+ * "name": "r2"
2121
2791
  * }
2122
2792
  * }
2123
2793
  * ```
@@ -2139,7 +2809,7 @@ declare type QueryTableVariables = {
2139
2809
  * ```json
2140
2810
  * {
2141
2811
  * "filter": {
2142
- * "settings.plan": "free",
2812
+ * "settings.plan": "free"
2143
2813
  * }
2144
2814
  * }
2145
2815
  * ```
@@ -2149,8 +2819,8 @@ declare type QueryTableVariables = {
2149
2819
  * "filter": {
2150
2820
  * "settings": {
2151
2821
  * "plan": "free"
2152
- * },
2153
- * },
2822
+ * }
2823
+ * }
2154
2824
  * }
2155
2825
  * ```
2156
2826
  *
@@ -2159,8 +2829,8 @@ declare type QueryTableVariables = {
2159
2829
  * ```json
2160
2830
  * {
2161
2831
  * "filter": {
2162
- * "settings.plan": {"$any": ["free", "paid"]}
2163
- * },
2832
+ * "settings.plan": { "$any": ["free", "paid"] }
2833
+ * }
2164
2834
  * }
2165
2835
  * ```
2166
2836
  *
@@ -2169,9 +2839,9 @@ declare type QueryTableVariables = {
2169
2839
  * ```json
2170
2840
  * {
2171
2841
  * "filter": {
2172
- * "settings.dark": true,
2173
- * "settings.plan": "free",
2174
- * },
2842
+ * "settings.dark": true,
2843
+ * "settings.plan": "free"
2844
+ * }
2175
2845
  * }
2176
2846
  * ```
2177
2847
  *
@@ -2182,11 +2852,11 @@ declare type QueryTableVariables = {
2182
2852
  * ```json
2183
2853
  * {
2184
2854
  * "filter": {
2185
- * "$any": {
2186
- * "settings.dark": true,
2187
- * "settings.plan": "free"
2188
- * }
2189
- * },
2855
+ * "$any": {
2856
+ * "settings.dark": true,
2857
+ * "settings.plan": "free"
2858
+ * }
2859
+ * }
2190
2860
  * }
2191
2861
  * ```
2192
2862
  *
@@ -2197,10 +2867,10 @@ declare type QueryTableVariables = {
2197
2867
  * "filter": {
2198
2868
  * "$any": [
2199
2869
  * {
2200
- * "name": "r1",
2870
+ * "name": "r1"
2201
2871
  * },
2202
2872
  * {
2203
- * "name": "r2",
2873
+ * "name": "r2"
2204
2874
  * }
2205
2875
  * ]
2206
2876
  * }
@@ -2212,7 +2882,7 @@ declare type QueryTableVariables = {
2212
2882
  * ```json
2213
2883
  * {
2214
2884
  * "filter": {
2215
- * "$exists": "settings",
2885
+ * "$exists": "settings"
2216
2886
  * }
2217
2887
  * }
2218
2888
  * ```
@@ -2224,10 +2894,10 @@ declare type QueryTableVariables = {
2224
2894
  * "filter": {
2225
2895
  * "$all": [
2226
2896
  * {
2227
- * "$exists": "settings",
2897
+ * "$exists": "settings"
2228
2898
  * },
2229
2899
  * {
2230
- * "$exists": "name",
2900
+ * "$exists": "name"
2231
2901
  * }
2232
2902
  * ]
2233
2903
  * }
@@ -2239,7 +2909,7 @@ declare type QueryTableVariables = {
2239
2909
  * ```json
2240
2910
  * {
2241
2911
  * "filter": {
2242
- * "$notExists": "settings",
2912
+ * "$notExists": "settings"
2243
2913
  * }
2244
2914
  * }
2245
2915
  * ```
@@ -2266,22 +2936,28 @@ declare type QueryTableVariables = {
2266
2936
  * {
2267
2937
  * "filter": {
2268
2938
  * "<column_name>": {
2269
- * "$pattern": "v*alue*"
2939
+ * "$pattern": "v*alu?"
2270
2940
  * }
2271
2941
  * }
2272
2942
  * }
2273
2943
  * ```
2274
2944
  *
2945
+ * The `$pattern` operator accepts two wildcard characters:
2946
+ * * `*` matches zero or more characters
2947
+ * * `?` matches exactly one character
2948
+ *
2949
+ * 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.
2950
+ *
2275
2951
  * We could also have `$endsWith` and `$startsWith` operators:
2276
2952
  *
2277
2953
  * ```json
2278
2954
  * {
2279
2955
  * "filter": {
2280
2956
  * "<column_name>": {
2281
- * "$endsWith": ".gz"
2957
+ * "$endsWith": ".gz"
2282
2958
  * },
2283
2959
  * "<column_name>": {
2284
- * "$startsWith": "tmp-"
2960
+ * "$startsWith": "tmp-"
2285
2961
  * }
2286
2962
  * }
2287
2963
  * }
@@ -2292,10 +2968,10 @@ declare type QueryTableVariables = {
2292
2968
  * ```json
2293
2969
  * {
2294
2970
  * "filter": {
2295
- * "<column_name>": {
2296
- * "$ge": 0,
2297
- * "$lt": 100
2298
- * }
2971
+ * "<column_name>": {
2972
+ * "$ge": 0,
2973
+ * "$lt": 100
2974
+ * }
2299
2975
  * }
2300
2976
  * }
2301
2977
  * ```
@@ -2313,7 +2989,6 @@ declare type QueryTableVariables = {
2313
2989
  * ```
2314
2990
  * The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
2315
2991
  *
2316
- *
2317
2992
  * #### Negations
2318
2993
  *
2319
2994
  * A general `$not` operator can inverse any operation.
@@ -2338,15 +3013,21 @@ declare type QueryTableVariables = {
2338
3013
  * {
2339
3014
  * "filter": {
2340
3015
  * "$not": {
2341
- * "$any": [{
2342
- * "<column_name1>": "value1"
2343
- * }, {
2344
- * "$all": [{
2345
- * "<column_name2>": "value2"
2346
- * }, {
2347
- * "<column_name3>": "value3"
2348
- * }]
2349
- * }]
3016
+ * "$any": [
3017
+ * {
3018
+ * "<column_name1>": "value1"
3019
+ * },
3020
+ * {
3021
+ * "$all": [
3022
+ * {
3023
+ * "<column_name2>": "value2"
3024
+ * },
3025
+ * {
3026
+ * "<column_name3>": "value3"
3027
+ * }
3028
+ * ]
3029
+ * }
3030
+ * ]
2350
3031
  * }
2351
3032
  * }
2352
3033
  * }
@@ -2401,8 +3082,8 @@ declare type QueryTableVariables = {
2401
3082
  * "<array name>": {
2402
3083
  * "$includes": {
2403
3084
  * "$all": [
2404
- * {"$contains": "label"},
2405
- * {"$not": {"$endsWith": "-debug"}}
3085
+ * { "$contains": "label" },
3086
+ * { "$not": { "$endsWith": "-debug" } }
2406
3087
  * ]
2407
3088
  * }
2408
3089
  * }
@@ -2422,9 +3103,7 @@ declare type QueryTableVariables = {
2422
3103
  * {
2423
3104
  * "filter": {
2424
3105
  * "settings.labels": {
2425
- * "$includesAll": [
2426
- * {"$contains": "label"},
2427
- * ]
3106
+ * "$includesAll": [{ "$contains": "label" }]
2428
3107
  * }
2429
3108
  * }
2430
3109
  * }
@@ -2472,7 +3151,6 @@ declare type QueryTableVariables = {
2472
3151
  * }
2473
3152
  * ```
2474
3153
  *
2475
- *
2476
3154
  * ### Pagination
2477
3155
  *
2478
3156
  * We offer cursor pagination and offset pagination. The offset pagination is limited
@@ -2538,8 +3216,8 @@ declare type QueryTableVariables = {
2538
3216
  * can be queried by update `page.after` to the returned cursor while keeping the
2539
3217
  * `page.before` cursor from the first range query.
2540
3218
  *
2541
- * The `filter` , `columns`, `sort` , and `page.size` configuration will be
2542
- * encoded with the cursor. The pagination request will be invalid if
3219
+ * The `filter` , `columns`, `sort` , and `page.size` configuration will be
3220
+ * encoded with the cursor. The pagination request will be invalid if
2543
3221
  * `filter` or `sort` is set. The columns returned and page size can be changed
2544
3222
  * anytime by passing the `columns` or `page.size` settings to the next query.
2545
3223
  *
@@ -2576,6 +3254,41 @@ declare type QueryTableVariables = {
2576
3254
  * ```
2577
3255
  */
2578
3256
  declare const queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
3257
+ declare type SearchTablePathParams = {
3258
+ dbBranchName: DBBranchName;
3259
+ tableName: TableName;
3260
+ workspace: string;
3261
+ };
3262
+ declare type SearchTableError = ErrorWrapper<{
3263
+ status: 400;
3264
+ payload: BadRequestError;
3265
+ } | {
3266
+ status: 401;
3267
+ payload: AuthError;
3268
+ } | {
3269
+ status: 404;
3270
+ payload: SimpleError;
3271
+ }>;
3272
+ declare type SearchTableRequestBody = {
3273
+ query: string;
3274
+ fuzziness?: FuzzinessExpression;
3275
+ prefix?: PrefixExpression;
3276
+ filter?: FilterExpression;
3277
+ highlight?: HighlightExpression;
3278
+ boosters?: BoosterExpression[];
3279
+ };
3280
+ declare type SearchTableVariables = {
3281
+ body: SearchTableRequestBody;
3282
+ pathParams: SearchTablePathParams;
3283
+ } & FetcherExtraProps;
3284
+ /**
3285
+ * Run a free text search operation in a particular table.
3286
+ *
3287
+ * 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:
3288
+ * * filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of type `text`
3289
+ * * filtering on columns of type `multiple` is currently unsupported
3290
+ */
3291
+ declare const searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2579
3292
  declare type SearchBranchPathParams = {
2580
3293
  dbBranchName: DBBranchName;
2581
3294
  workspace: string;
@@ -2591,9 +3304,14 @@ declare type SearchBranchError = ErrorWrapper<{
2591
3304
  payload: SimpleError;
2592
3305
  }>;
2593
3306
  declare type SearchBranchRequestBody = {
2594
- tables?: string[];
3307
+ tables?: (string | {
3308
+ table: string;
3309
+ filter?: FilterExpression;
3310
+ boosters?: BoosterExpression[];
3311
+ })[];
2595
3312
  query: string;
2596
- fuzziness?: number;
3313
+ fuzziness?: FuzzinessExpression;
3314
+ highlight?: HighlightExpression;
2597
3315
  };
2598
3316
  declare type SearchBranchVariables = {
2599
3317
  body: SearchBranchRequestBody;
@@ -2622,6 +3340,7 @@ declare const operationsByTag: {
2622
3340
  updateWorkspaceMemberRole: (variables: UpdateWorkspaceMemberRoleVariables) => Promise<undefined>;
2623
3341
  removeWorkspaceMember: (variables: RemoveWorkspaceMemberVariables) => Promise<undefined>;
2624
3342
  inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<WorkspaceInvite>;
3343
+ updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
2625
3344
  cancelWorkspaceMemberInvite: (variables: CancelWorkspaceMemberInviteVariables) => Promise<undefined>;
2626
3345
  resendWorkspaceMemberInvite: (variables: ResendWorkspaceMemberInviteVariables) => Promise<undefined>;
2627
3346
  acceptWorkspaceMemberInvite: (variables: AcceptWorkspaceMemberInviteVariables) => Promise<undefined>;
@@ -2630,6 +3349,7 @@ declare const operationsByTag: {
2630
3349
  getDatabaseList: (variables: GetDatabaseListVariables) => Promise<ListDatabasesResponse>;
2631
3350
  createDatabase: (variables: CreateDatabaseVariables) => Promise<CreateDatabaseResponse>;
2632
3351
  deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
3352
+ getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
2633
3353
  getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
2634
3354
  addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
2635
3355
  removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
@@ -2638,17 +3358,35 @@ declare const operationsByTag: {
2638
3358
  branch: {
2639
3359
  getBranchList: (variables: GetBranchListVariables) => Promise<ListBranchesResponse>;
2640
3360
  getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
2641
- createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
3361
+ createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
2642
3362
  deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
2643
3363
  updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
2644
3364
  getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
3365
+ getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
3366
+ };
3367
+ migrationRequests: {
3368
+ listMigrationRequests: (variables: ListMigrationRequestsVariables) => Promise<ListMigrationRequestsResponse>;
3369
+ createMigrationRequest: (variables: CreateMigrationRequestVariables) => Promise<CreateMigrationRequestResponse>;
3370
+ getMigrationRequest: (variables: GetMigrationRequestVariables) => Promise<MigrationRequest>;
3371
+ updateMigrationRequest: (variables: UpdateMigrationRequestVariables) => Promise<undefined>;
3372
+ listMigrationRequestsCommits: (variables: ListMigrationRequestsCommitsVariables) => Promise<ListMigrationRequestsCommitsResponse>;
3373
+ compareMigrationRequest: (variables: CompareMigrationRequestVariables) => Promise<SchemaCompareResponse>;
3374
+ getMigrationRequestIsMerged: (variables: GetMigrationRequestIsMergedVariables) => Promise<GetMigrationRequestIsMergedResponse>;
3375
+ mergeMigrationRequest: (variables: MergeMigrationRequestVariables) => Promise<Commit>;
3376
+ };
3377
+ branchSchema: {
2645
3378
  getBranchMigrationHistory: (variables: GetBranchMigrationHistoryVariables) => Promise<GetBranchMigrationHistoryResponse>;
2646
3379
  executeBranchMigrationPlan: (variables: ExecuteBranchMigrationPlanVariables) => Promise<undefined>;
2647
3380
  getBranchMigrationPlan: (variables: GetBranchMigrationPlanVariables) => Promise<BranchMigrationPlan>;
2648
- getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
3381
+ compareBranchWithUserSchema: (variables: CompareBranchWithUserSchemaVariables) => Promise<SchemaCompareResponse>;
3382
+ compareBranchSchemas: (variables: CompareBranchSchemasVariables) => Promise<SchemaCompareResponse>;
3383
+ updateBranchSchema: (variables: UpdateBranchSchemaVariables) => Promise<UpdateBranchSchemaResponse>;
3384
+ previewBranchSchemaEdit: (variables: PreviewBranchSchemaEditVariables) => Promise<PreviewBranchSchemaEditResponse>;
3385
+ applyBranchSchemaEdit: (variables: ApplyBranchSchemaEditVariables) => Promise<ApplyBranchSchemaEditResponse>;
3386
+ getBranchSchemaHistory: (variables: GetBranchSchemaHistoryVariables) => Promise<GetBranchSchemaHistoryResponse>;
2649
3387
  };
2650
3388
  table: {
2651
- createTable: (variables: CreateTableVariables) => Promise<undefined>;
3389
+ createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
2652
3390
  deleteTable: (variables: DeleteTableVariables) => Promise<undefined>;
2653
3391
  updateTable: (variables: UpdateTableVariables) => Promise<undefined>;
2654
3392
  getTableSchema: (variables: GetTableSchemaVariables) => Promise<GetTableSchemaResponse>;
@@ -2660,14 +3398,15 @@ declare const operationsByTag: {
2660
3398
  updateColumn: (variables: UpdateColumnVariables) => Promise<MigrationIdResponse>;
2661
3399
  };
2662
3400
  records: {
2663
- insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
3401
+ insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
2664
3402
  insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2665
3403
  updateRecordWithID: (variables: UpdateRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2666
3404
  upsertRecordWithID: (variables: UpsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2667
- deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
3405
+ deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
2668
3406
  getRecord: (variables: GetRecordVariables) => Promise<XataRecord$1>;
2669
- bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
3407
+ bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
2670
3408
  queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
3409
+ searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2671
3410
  searchBranch: (variables: SearchBranchVariables) => Promise<SearchResponse>;
2672
3411
  };
2673
3412
  };
@@ -2683,10 +3422,8 @@ interface XataApiClientOptions {
2683
3422
  fetch?: FetchImpl;
2684
3423
  apiKey?: string;
2685
3424
  host?: HostProvider;
3425
+ trace?: TraceFunction;
2686
3426
  }
2687
- /**
2688
- * @deprecated Use XataApiPlugin instead
2689
- */
2690
3427
  declare class XataApiClient {
2691
3428
  #private;
2692
3429
  constructor(options?: XataApiClientOptions);
@@ -2696,6 +3433,8 @@ declare class XataApiClient {
2696
3433
  get branches(): BranchApi;
2697
3434
  get tables(): TableApi;
2698
3435
  get records(): RecordsApi;
3436
+ get migrationRequests(): MigrationRequestsApi;
3437
+ get branchSchema(): BranchSchemaApi;
2699
3438
  }
2700
3439
  declare class UserApi {
2701
3440
  private extraProps;
@@ -2719,6 +3458,7 @@ declare class WorkspaceApi {
2719
3458
  updateWorkspaceMemberRole(workspaceId: WorkspaceID, userId: UserID, role: Role): Promise<void>;
2720
3459
  removeWorkspaceMember(workspaceId: WorkspaceID, userId: UserID): Promise<void>;
2721
3460
  inviteWorkspaceMember(workspaceId: WorkspaceID, email: string, role: Role): Promise<WorkspaceInvite>;
3461
+ updateWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID, role: Role): Promise<WorkspaceInvite>;
2722
3462
  cancelWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2723
3463
  resendWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2724
3464
  acceptWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteKey: InviteKey): Promise<void>;
@@ -2729,29 +3469,27 @@ declare class DatabaseApi {
2729
3469
  getDatabaseList(workspace: WorkspaceID): Promise<ListDatabasesResponse>;
2730
3470
  createDatabase(workspace: WorkspaceID, dbName: DBName, options?: CreateDatabaseRequestBody): Promise<CreateDatabaseResponse>;
2731
3471
  deleteDatabase(workspace: WorkspaceID, dbName: DBName): Promise<void>;
3472
+ getDatabaseMetadata(workspace: WorkspaceID, dbName: DBName): Promise<DatabaseMetadata>;
2732
3473
  getGitBranchesMapping(workspace: WorkspaceID, dbName: DBName): Promise<ListGitBranchesResponse>;
2733
3474
  addGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, body: AddGitBranchesEntryRequestBody): Promise<AddGitBranchesEntryResponse>;
2734
3475
  removeGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<void>;
2735
- resolveBranch(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<ResolveBranchResponse>;
3476
+ resolveBranch(workspace: WorkspaceID, dbName: DBName, gitBranch?: string, fallbackBranch?: string): Promise<ResolveBranchResponse>;
2736
3477
  }
2737
3478
  declare class BranchApi {
2738
3479
  private extraProps;
2739
3480
  constructor(extraProps: FetcherExtraProps);
2740
3481
  getBranchList(workspace: WorkspaceID, dbName: DBName): Promise<ListBranchesResponse>;
2741
3482
  getBranchDetails(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<DBBranch>;
2742
- createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<void>;
3483
+ createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<CreateBranchResponse>;
2743
3484
  deleteBranch(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<void>;
2744
3485
  updateBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName, metadata?: BranchMetadata): Promise<void>;
2745
3486
  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
3487
  getBranchStats(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<GetBranchStatsResponse>;
2750
3488
  }
2751
3489
  declare class TableApi {
2752
3490
  private extraProps;
2753
3491
  constructor(extraProps: FetcherExtraProps);
2754
- createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
3492
+ createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<CreateTableResponse>;
2755
3493
  deleteTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
2756
3494
  updateTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, options: UpdateTableRequestBody): Promise<void>;
2757
3495
  getTableSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<GetTableSchemaResponse>;
@@ -2765,16 +3503,42 @@ declare class TableApi {
2765
3503
  declare class RecordsApi {
2766
3504
  private extraProps;
2767
3505
  constructor(extraProps: FetcherExtraProps);
2768
- insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>): Promise<InsertRecordResponse>;
3506
+ insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>, options?: InsertRecordQueryParams): Promise<RecordUpdateResponse>;
2769
3507
  insertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: InsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2770
3508
  updateRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpdateRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2771
3509
  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>;
3510
+ deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: DeleteRecordQueryParams): Promise<RecordUpdateResponse>;
3511
+ getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordQueryParams): Promise<XataRecord$1>;
3512
+ bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[], options?: BulkInsertTableRecordsQueryParams): Promise<BulkInsertResponse>;
2775
3513
  queryTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: QueryTableRequestBody): Promise<QueryResponse>;
3514
+ searchTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: SearchTableRequestBody): Promise<SearchResponse>;
2776
3515
  searchBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, query: SearchBranchRequestBody): Promise<SearchResponse>;
2777
3516
  }
3517
+ declare class MigrationRequestsApi {
3518
+ private extraProps;
3519
+ constructor(extraProps: FetcherExtraProps);
3520
+ listMigrationRequests(workspace: WorkspaceID, database: DBName, options?: ListMigrationRequestsRequestBody): Promise<ListMigrationRequestsResponse>;
3521
+ createMigrationRequest(workspace: WorkspaceID, database: DBName, options: CreateMigrationRequestRequestBody): Promise<CreateMigrationRequestResponse>;
3522
+ getMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<MigrationRequest>;
3523
+ updateMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number, options: UpdateMigrationRequestRequestBody): Promise<void>;
3524
+ listMigrationRequestsCommits(workspace: WorkspaceID, database: DBName, migrationRequest: number, options?: ListMigrationRequestsCommitsRequestBody): Promise<ListMigrationRequestsCommitsResponse>;
3525
+ compareMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<SchemaCompareResponse>;
3526
+ getMigrationRequestIsMerged(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<GetMigrationRequestIsMergedResponse>;
3527
+ mergeMigrationRequest(workspace: WorkspaceID, database: DBName, migrationRequest: number): Promise<Commit>;
3528
+ }
3529
+ declare class BranchSchemaApi {
3530
+ private extraProps;
3531
+ constructor(extraProps: FetcherExtraProps);
3532
+ getBranchMigrationHistory(workspace: WorkspaceID, database: DBName, branch: BranchName, options?: GetBranchMigrationHistoryRequestBody): Promise<GetBranchMigrationHistoryResponse>;
3533
+ executeBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, migrationPlan: ExecuteBranchMigrationPlanRequestBody): Promise<void>;
3534
+ getBranchMigrationPlan(workspace: WorkspaceID, database: DBName, branch: BranchName, schema: Schema): Promise<BranchMigrationPlan>;
3535
+ compareBranchWithUserSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, schema: Schema): Promise<SchemaCompareResponse>;
3536
+ compareBranchSchemas(workspace: WorkspaceID, database: DBName, branch: BranchName, branchName: BranchName, schema: Schema): Promise<SchemaCompareResponse>;
3537
+ updateBranchSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, migration: Migration): Promise<UpdateBranchSchemaResponse>;
3538
+ previewBranchSchemaEdit(workspace: WorkspaceID, database: DBName, branch: BranchName, migration: Migration): Promise<PreviewBranchSchemaEditResponse>;
3539
+ applyBranchSchemaEdit(workspace: WorkspaceID, database: DBName, branch: BranchName, edits: SchemaEditScript): Promise<ApplyBranchSchemaEditResponse>;
3540
+ getBranchSchemaHistory(workspace: WorkspaceID, database: DBName, branch: BranchName, options?: GetBranchSchemaHistoryRequestBody): Promise<GetBranchSchemaHistoryResponse>;
3541
+ }
2778
3542
 
2779
3543
  declare class XataApiPlugin implements XataPlugin {
2780
3544
  build(options: XataPluginOptions): Promise<XataApiClient>;
@@ -2786,28 +3550,29 @@ declare type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) ex
2786
3550
  declare type If<Condition, Then, Else> = Condition extends true ? Then : Else;
2787
3551
  declare type IsObject<T> = T extends Record<string, any> ? true : false;
2788
3552
  declare type IsArray<T> = T extends Array<any> ? true : false;
2789
- declare type NonEmptyArray<T> = T[] & {
2790
- 0: T;
2791
- };
2792
3553
  declare type RequiredBy<T, K extends keyof T> = T & {
2793
3554
  [P in K]-?: NonNullable<T[P]>;
2794
3555
  };
2795
3556
  declare type GetArrayInnerType<T extends readonly any[]> = T[number];
2796
3557
  declare type SingleOrArray<T> = T | T[];
2797
- declare type Dictionary<T> = Record<string, T>;
3558
+ declare type OmitBy<T, K extends keyof T> = T extends any ? Omit<T, K> : never;
3559
+ declare type Without<T, U> = {
3560
+ [P in Exclude<keyof T, keyof U>]?: never;
3561
+ };
3562
+ declare type ExclusiveOr<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
2798
3563
 
2799
3564
  declare type SelectableColumn<O, RecursivePath extends any[] = []> = '*' | 'id' | DataProps<O> | NestedColumns<O, RecursivePath>;
2800
- declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord & UnionToIntersection<Values<{
2801
- [K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord;
3565
+ declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord<O> & UnionToIntersection<Values<{
3566
+ [K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord<O>;
2802
3567
  }>>;
2803
- 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]> ? {
2804
- V: ValueAtColumn<O[K], V>;
2805
- } : never) : O[K]> : never : never;
3568
+ 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> ? {
3569
+ V: ValueAtColumn<Item, V>;
3570
+ } : never : O[K] : never> : never : never;
2806
3571
  declare type MAX_RECURSION = 5;
2807
3572
  declare type NestedColumns<O, RecursivePath extends any[]> = RecursivePath['length'] extends MAX_RECURSION ? never : If<IsObject<O>, Values<{
2808
- [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
2809
- 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
2810
- K>>;
3573
+ [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
3574
+ 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
3575
+ K>> : never;
2811
3576
  }>, never>;
2812
3577
  declare type DataProps<O> = Exclude<StringKeys<O>, StringKeys<XataRecord>>;
2813
3578
  declare type NestedValueAtColumn<O, Key extends SelectableColumn<O>> = Key extends `${infer N}.${infer M}` ? N extends DataProps<O> ? {
@@ -2834,56 +3599,85 @@ interface BaseData {
2834
3599
  /**
2835
3600
  * Represents a persisted record from the database.
2836
3601
  */
2837
- interface XataRecord extends Identifiable {
3602
+ interface XataRecord<OriginalRecord extends XataRecord<any> = XataRecord<any>> extends Identifiable {
2838
3603
  /**
2839
- * Metadata of this record.
3604
+ * Get metadata of this record.
2840
3605
  */
2841
- xata: {
2842
- /**
2843
- * Number that is increased every time the record is updated.
2844
- */
2845
- version: number;
2846
- };
3606
+ getMetadata(): XataRecordMetadata;
3607
+ /**
3608
+ * Retrieves a refreshed copy of the current record from the database.
3609
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3610
+ * @returns The persisted record with the selected columns, null if not found.
3611
+ */
3612
+ read<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
2847
3613
  /**
2848
3614
  * Retrieves a refreshed copy of the current record from the database.
3615
+ * @returns The persisted record with all first level properties, null if not found.
2849
3616
  */
2850
- read(): Promise<Readonly<SelectedPick<this, ['*']>> | null>;
3617
+ read(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2851
3618
  /**
2852
3619
  * Performs a partial update of the current record. On success a new object is
2853
3620
  * returned and the current object is not mutated.
2854
- * @param data The columns and their values that have to be updated.
2855
- * @returns A new record containing the latest values for all the columns of the current record.
3621
+ * @param partialUpdate The columns and their values that have to be updated.
3622
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3623
+ * @returns The persisted record with the selected columns, null if not found.
3624
+ */
3625
+ update<K extends SelectableColumn<OriginalRecord>>(partialUpdate: Partial<EditableData<OriginalRecord>>, columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
3626
+ /**
3627
+ * Performs a partial update of the current record. On success a new object is
3628
+ * returned and the current object is not mutated.
3629
+ * @param partialUpdate The columns and their values that have to be updated.
3630
+ * @returns The persisted record with all first level properties, null if not found.
2856
3631
  */
2857
- update(partialUpdate: Partial<EditableData<Omit<this, keyof XataRecord>>>): Promise<Readonly<SelectedPick<this, ['*']>>>;
3632
+ update(partialUpdate: Partial<EditableData<OriginalRecord>>): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2858
3633
  /**
2859
3634
  * Performs a deletion of the current record in the database.
2860
- *
2861
- * @throws If the record was already deleted or if an error happened while performing the deletion.
3635
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3636
+ * @returns The deleted record, null if not found.
2862
3637
  */
2863
- delete(): Promise<void>;
3638
+ delete<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
3639
+ /**
3640
+ * Performs a deletion of the current record in the database.
3641
+ * @returns The deleted record, null if not found.
3642
+
3643
+ */
3644
+ delete(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2864
3645
  }
2865
3646
  declare type Link<Record extends XataRecord> = Omit<XataRecord, 'read' | 'update'> & {
2866
3647
  /**
2867
3648
  * Retrieves a refreshed copy of the current record from the database.
2868
3649
  */
2869
- read(): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3650
+ read<K extends SelectableColumn<Record>>(columns?: K[]): Promise<Readonly<SelectedPick<Record, typeof columns extends SelectableColumn<Record>[] ? typeof columns : ['*']>> | null>;
2870
3651
  /**
2871
3652
  * Performs a partial update of the current record. On success a new object is
2872
3653
  * returned and the current object is not mutated.
2873
- * @param data The columns and their values that have to be updated.
3654
+ * @param partialUpdate The columns and their values that have to be updated.
2874
3655
  * @returns A new record containing the latest values for all the columns of the current record.
2875
3656
  */
2876
- update(partialUpdate: Partial<EditableData<Omit<Record, keyof XataRecord>>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3657
+ update<K extends SelectableColumn<Record>>(partialUpdate: Partial<EditableData<Record>>, columns?: K[]): Promise<Readonly<SelectedPick<Record, typeof columns extends SelectableColumn<Record>[] ? typeof columns : ['*']>>>;
3658
+ /**
3659
+ * Performs a deletion of the current record in the database.
3660
+ *
3661
+ * @throws If the record was already deleted or if an error happened while performing the deletion.
3662
+ */
3663
+ delete(): Promise<void>;
3664
+ };
3665
+ declare type XataRecordMetadata = {
3666
+ /**
3667
+ * Number that is increased every time the record is updated.
3668
+ */
3669
+ version: number;
3670
+ warnings?: string[];
2877
3671
  };
2878
3672
  declare function isIdentifiable(x: any): x is Identifiable & Record<string, unknown>;
2879
3673
  declare function isXataRecord(x: any): x is XataRecord & Record<string, unknown>;
2880
- declare type EditableData<O extends BaseData> = {
3674
+ declare type EditableData<O extends XataRecord> = Identifiable & Omit<{
2881
3675
  [K in keyof O]: O[K] extends XataRecord ? {
2882
3676
  id: string;
2883
- } : NonNullable<O[K]> extends XataRecord ? {
3677
+ } | string : NonNullable<O[K]> extends XataRecord ? {
2884
3678
  id: string;
2885
- } | null | undefined : O[K];
2886
- };
3679
+ } | string | null | undefined : O[K];
3680
+ }, keyof XataRecord>;
2887
3681
 
2888
3682
  /**
2889
3683
  * PropertyMatchFilter
@@ -2958,8 +3752,8 @@ declare type ValueTypeFilters<T> = T | T extends string ? StringTypeFilter : T e
2958
3752
  ],
2959
3753
  }
2960
3754
  */
2961
- declare type AggregatorFilter<Record> = {
2962
- [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<Record>>;
3755
+ declare type AggregatorFilter<T> = {
3756
+ [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<T>>;
2963
3757
  };
2964
3758
  /**
2965
3759
  * Existance filter
@@ -2968,16 +3762,94 @@ declare type AggregatorFilter<Record> = {
2968
3762
  declare type ExistanceFilter<Record> = {
2969
3763
  [key in '$exists' | '$notExists']?: SelectableColumn<Record>;
2970
3764
  };
2971
- declare type BaseApiFilter<Record> = PropertyAccessFilter<Record> | AggregatorFilter<Record> | ExistanceFilter<Record>;
2972
- /**
2973
- * Nested filter
2974
- * Injects the Api filters on nested properties
2975
- * Example: { filter: { settings: { plan: { $any: ['free', 'trial'] } } } }
2976
- */
2977
- declare type NestedApiFilter<T> = T extends Record<string, any> ? {
2978
- [key in keyof T]?: T[key] extends Record<string, any> ? SingleOrArray<Filter<T[key]>> : PropertyFilter<T[key]>;
2979
- } : PropertyFilter<T>;
2980
- declare type Filter<Record> = BaseApiFilter<Record> | NestedApiFilter<Record>;
3765
+ declare type BaseApiFilter<Record> = PropertyAccessFilter<Record> | AggregatorFilter<Record> | ExistanceFilter<Record>;
3766
+ /**
3767
+ * Nested filter
3768
+ * Injects the Api filters on nested properties
3769
+ * Example: { filter: { settings: { plan: { $any: ['free', 'trial'] } } } }
3770
+ */
3771
+ declare type NestedApiFilter<T> = {
3772
+ [key in keyof T]?: T[key] extends Record<string, any> ? SingleOrArray<Filter<T[key]>> : PropertyFilter<T[key]>;
3773
+ };
3774
+ 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>;
3775
+
3776
+ declare type DateBooster = {
3777
+ origin?: string;
3778
+ scale: string;
3779
+ decay: number;
3780
+ };
3781
+ declare type NumericBooster = {
3782
+ factor: number;
3783
+ };
3784
+ declare type ValueBooster<T extends string | number | boolean> = {
3785
+ value: T;
3786
+ factor: number;
3787
+ };
3788
+ declare type Boosters<O extends XataRecord> = Values<{
3789
+ [K in SelectableColumn<O>]: NonNullable<ValueAtColumn<O, K>> extends Date ? {
3790
+ dateBooster: {
3791
+ column: K;
3792
+ } & DateBooster;
3793
+ } : NonNullable<ValueAtColumn<O, K>> extends number ? ExclusiveOr<{
3794
+ numericBooster?: {
3795
+ column: K;
3796
+ } & NumericBooster;
3797
+ }, {
3798
+ valueBooster?: {
3799
+ column: K;
3800
+ } & ValueBooster<number>;
3801
+ }> : NonNullable<ValueAtColumn<O, K>> extends string | boolean ? {
3802
+ valueBooster: {
3803
+ column: K;
3804
+ } & ValueBooster<NonNullable<ValueAtColumn<O, K>>>;
3805
+ } : never;
3806
+ }>;
3807
+
3808
+ declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3809
+ fuzziness?: FuzzinessExpression;
3810
+ prefix?: PrefixExpression;
3811
+ highlight?: HighlightExpression;
3812
+ tables?: Array<Tables | Values<{
3813
+ [Model in GetArrayInnerType<NonNullable<Tables[]>>]: {
3814
+ table: Model;
3815
+ filter?: Filter<SelectedPick<Schemas[Model] & XataRecord, ['*']>>;
3816
+ boosters?: Boosters<Schemas[Model] & XataRecord>[];
3817
+ };
3818
+ }>>;
3819
+ };
3820
+ declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3821
+ all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3822
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]: {
3823
+ table: Model;
3824
+ record: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>>;
3825
+ };
3826
+ }>[]>;
3827
+ byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3828
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]?: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>[]>;
3829
+ }>;
3830
+ };
3831
+ declare class SearchPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin {
3832
+ #private;
3833
+ private db;
3834
+ constructor(db: SchemaPluginResult<Schemas>, schemaTables?: Schemas.Table[]);
3835
+ build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
3836
+ }
3837
+ declare type SearchXataRecord<Record extends XataRecord> = Omit<Record, 'getMetadata'> & {
3838
+ getMetadata: () => XataRecordMetadata & SearchExtraProperties;
3839
+ };
3840
+ declare type SearchExtraProperties = {
3841
+ table: string;
3842
+ highlight?: {
3843
+ [key: string]: string[] | {
3844
+ [key: string]: any;
3845
+ };
3846
+ };
3847
+ score?: number;
3848
+ };
3849
+ declare type ReturnTable<Table, Tables> = Table extends Tables ? Table : never;
3850
+ 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 {
3851
+ table: infer Table;
3852
+ } ? ReturnTable<Table, Tables> : never;
2981
3853
 
2982
3854
  declare type SortDirection = 'asc' | 'desc';
2983
3855
  declare type SortFilterExtended<T extends XataRecord> = {
@@ -2989,13 +3861,21 @@ declare type SortFilterBase<T extends XataRecord> = {
2989
3861
  [Key in StringKeys<T>]: SortDirection;
2990
3862
  };
2991
3863
 
2992
- declare type QueryOptions<T extends XataRecord> = {
2993
- page?: PaginationOptions;
2994
- columns?: NonEmptyArray<SelectableColumn<T>>;
3864
+ declare type BaseOptions<T extends XataRecord> = {
3865
+ columns?: SelectableColumn<T>[];
3866
+ cache?: number;
3867
+ };
3868
+ declare type CursorQueryOptions = {
3869
+ pagination?: CursorNavigationOptions & OffsetNavigationOptions;
3870
+ filter?: never;
3871
+ sort?: never;
3872
+ };
3873
+ declare type OffsetQueryOptions<T extends XataRecord> = {
3874
+ pagination?: OffsetNavigationOptions;
2995
3875
  filter?: FilterExpression;
2996
3876
  sort?: SortFilter<T> | SortFilter<T>[];
2997
- cache?: number;
2998
3877
  };
3878
+ declare type QueryOptions<T extends XataRecord> = BaseOptions<T> & (CursorQueryOptions | OffsetQueryOptions<T>);
2999
3879
  /**
3000
3880
  * Query objects contain the information of all filters, sorting, etc. to be included in the database query.
3001
3881
  *
@@ -3005,8 +3885,11 @@ declare type QueryOptions<T extends XataRecord> = {
3005
3885
  declare class Query<Record extends XataRecord, Result extends XataRecord = Record> implements Paginable<Record, Result> {
3006
3886
  #private;
3007
3887
  readonly meta: PaginationQueryMeta;
3008
- readonly records: Result[];
3009
- constructor(repository: Repository<Record> | null, table: string, data: Partial<QueryOptions<Record>>, parent?: Partial<QueryOptions<Record>>);
3888
+ readonly records: RecordArray<Result>;
3889
+ constructor(repository: Repository<Record> | null, table: {
3890
+ name: string;
3891
+ schema?: Table;
3892
+ }, data: Partial<QueryOptions<Record>>, rawParent?: Partial<QueryOptions<Record>>);
3010
3893
  getQueryOptions(): QueryOptions<Record>;
3011
3894
  key(): string;
3012
3895
  /**
@@ -3038,73 +3921,186 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3038
3921
  *
3039
3922
  * ```
3040
3923
  * query.filter("columnName", columnValue)
3041
- * query.filter({
3042
- * "columnName": columnValue
3043
- * })
3924
+ * query.filter("columnName", operator(columnValue)) // Use gt, gte, lt, lte, startsWith,...
3925
+ * ```
3926
+ *
3927
+ * @param column The name of the column to filter.
3928
+ * @param value The value to filter.
3929
+ * @returns A new Query object.
3930
+ */
3931
+ filter<F extends SelectableColumn<Record>>(column: F, value: Filter<NonNullable<ValueAtColumn<Record, F>>>): Query<Record, Result>;
3932
+ /**
3933
+ * Builds a new query object adding one or more constraints. Examples:
3934
+ *
3935
+ * ```
3936
+ * query.filter({ "columnName": columnValue })
3044
3937
  * query.filter({
3045
3938
  * "columnName": operator(columnValue) // Use gt, gte, lt, lte, startsWith,...
3046
3939
  * })
3047
3940
  * ```
3048
3941
  *
3942
+ * @param filters A filter object
3049
3943
  * @returns A new Query object.
3050
3944
  */
3051
- filter(filters: Filter<Record>): Query<Record, Result>;
3052
- filter<F extends SelectableColumn<Record>>(column: F, value: Filter<ValueAtColumn<Record, F>>): Query<Record, Result>;
3945
+ filter(filters?: Filter<Record>): Query<Record, Result>;
3946
+ defaultFilter<T>(column: string, value: T): T | {
3947
+ $includes: (T & string) | (T & string[]);
3948
+ };
3053
3949
  /**
3054
3950
  * Builds a new query with a new sort option.
3055
3951
  * @param column The column name.
3056
3952
  * @param direction The direction. Either ascending or descending.
3057
3953
  * @returns A new Query object.
3058
3954
  */
3059
- sort<F extends SelectableColumn<Record>>(column: F, direction: SortDirection): Query<Record, Result>;
3955
+ sort<F extends SelectableColumn<Record>>(column: F, direction?: SortDirection): Query<Record, Result>;
3060
3956
  /**
3061
3957
  * Builds a new query specifying the set of columns to be returned in the query response.
3062
3958
  * @param columns Array of column names to be returned by the query.
3063
3959
  * @returns A new Query object.
3064
3960
  */
3065
- select<K extends SelectableColumn<Record>>(columns: NonEmptyArray<K>): Query<Record, SelectedPick<Record, NonEmptyArray<K>>>;
3961
+ select<K extends SelectableColumn<Record>>(columns: K[]): Query<Record, SelectedPick<Record, K[]>>;
3962
+ /**
3963
+ * Get paginated results
3964
+ *
3965
+ * @returns A page of results
3966
+ */
3066
3967
  getPaginated(): Promise<Page<Record, Result>>;
3067
- getPaginated(options: Omit<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
3968
+ /**
3969
+ * Get paginated results
3970
+ *
3971
+ * @param options Pagination options
3972
+ * @returns A page of results
3973
+ */
3974
+ getPaginated(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
3975
+ /**
3976
+ * Get paginated results
3977
+ *
3978
+ * @param options Pagination options
3979
+ * @returns A page of results
3980
+ */
3068
3981
  getPaginated<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<Page<Record, SelectedPick<Record, typeof options['columns']>>>;
3982
+ /**
3983
+ * Get results in an iterator
3984
+ *
3985
+ * @async
3986
+ * @returns Async interable of results
3987
+ */
3069
3988
  [Symbol.asyncIterator](): AsyncIterableIterator<Result>;
3070
- getIterator(chunk: number): AsyncGenerator<Result[]>;
3071
- getIterator(chunk: number, options: Omit<QueryOptions<Record>, 'columns' | 'page'>): AsyncGenerator<Result[]>;
3072
- getIterator<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(chunk: number, options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
3989
+ /**
3990
+ * Build an iterator of results
3991
+ *
3992
+ * @returns Async generator of results array
3993
+ */
3994
+ getIterator(): AsyncGenerator<Result[]>;
3995
+ /**
3996
+ * Build an iterator of results
3997
+ *
3998
+ * @param options Pagination options with batchSize
3999
+ * @returns Async generator of results array
4000
+ */
4001
+ getIterator(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
4002
+ batchSize?: number;
4003
+ }): AsyncGenerator<Result[]>;
4004
+ /**
4005
+ * Build an iterator of results
4006
+ *
4007
+ * @param options Pagination options with batchSize
4008
+ * @returns Async generator of results array
4009
+ */
4010
+ getIterator<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
4011
+ batchSize?: number;
4012
+ }>(options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
4013
+ /**
4014
+ * Performs the query in the database and returns a set of results.
4015
+ * @returns An array of records from the database.
4016
+ */
4017
+ getMany(): Promise<RecordArray<Result>>;
4018
+ /**
4019
+ * Performs the query in the database and returns a set of results.
4020
+ * @param options Additional options to be used when performing the query.
4021
+ * @returns An array of records from the database.
4022
+ */
4023
+ getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<RecordArray<SelectedPick<Record, typeof options['columns']>>>;
3073
4024
  /**
3074
4025
  * Performs the query in the database and returns a set of results.
3075
4026
  * @param options Additional options to be used when performing the query.
3076
4027
  * @returns An array of records from the database.
3077
4028
  */
3078
- getMany(): Promise<Result[]>;
3079
- getMany(options: Omit<QueryOptions<Record>, 'columns'>): Promise<Result[]>;
3080
- getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
4029
+ getMany(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<RecordArray<Result>>;
4030
+ /**
4031
+ * Performs the query in the database and returns all the results.
4032
+ * Warning: If there are a large number of results, this method can have performance implications.
4033
+ * @returns An array of records from the database.
4034
+ */
4035
+ getAll(): Promise<Result[]>;
3081
4036
  /**
3082
4037
  * Performs the query in the database and returns all the results.
3083
4038
  * Warning: If there are a large number of results, this method can have performance implications.
3084
4039
  * @param options Additional options to be used when performing the query.
3085
4040
  * @returns An array of records from the database.
3086
4041
  */
3087
- getAll(chunk?: number): Promise<Result[]>;
3088
- getAll(chunk: number | undefined, options: Omit<QueryOptions<Record>, 'columns' | 'page'>): Promise<Result[]>;
3089
- getAll<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(chunk: number | undefined, options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
4042
+ getAll<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
4043
+ batchSize?: number;
4044
+ }>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
3090
4045
  /**
3091
- * Performs the query in the database and returns the first result.
4046
+ * Performs the query in the database and returns all the results.
4047
+ * Warning: If there are a large number of results, this method can have performance implications.
3092
4048
  * @param options Additional options to be used when performing the query.
4049
+ * @returns An array of records from the database.
4050
+ */
4051
+ getAll(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
4052
+ batchSize?: number;
4053
+ }): Promise<Result[]>;
4054
+ /**
4055
+ * Performs the query in the database and returns the first result.
3093
4056
  * @returns The first record that matches the query, or null if no record matched the query.
3094
4057
  */
3095
4058
  getFirst(): Promise<Result | null>;
3096
- getFirst(options: Omit<QueryOptions<Record>, 'columns' | 'page'>): Promise<Result | null>;
3097
- getFirst<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
4059
+ /**
4060
+ * Performs the query in the database and returns the first result.
4061
+ * @param options Additional options to be used when performing the query.
4062
+ * @returns The first record that matches the query, or null if no record matched the query.
4063
+ */
4064
+ getFirst<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
4065
+ /**
4066
+ * Performs the query in the database and returns the first result.
4067
+ * @param options Additional options to be used when performing the query.
4068
+ * @returns The first record that matches the query, or null if no record matched the query.
4069
+ */
4070
+ getFirst(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result | null>;
3098
4071
  /**
3099
4072
  * Builds a new query object adding a cache TTL in milliseconds.
3100
4073
  * @param ttl The cache TTL in milliseconds.
3101
4074
  * @returns A new Query object.
3102
4075
  */
3103
4076
  cache(ttl: number): Query<Record, Result>;
4077
+ /**
4078
+ * Retrieve next page of records
4079
+ *
4080
+ * @returns A new page object.
4081
+ */
3104
4082
  nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4083
+ /**
4084
+ * Retrieve previous page of records
4085
+ *
4086
+ * @returns A new page object
4087
+ */
3105
4088
  previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4089
+ /**
4090
+ * Retrieve first page of records
4091
+ *
4092
+ * @returns A new page object
4093
+ */
3106
4094
  firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4095
+ /**
4096
+ * Retrieve last page of records
4097
+ *
4098
+ * @returns A new page object
4099
+ */
3107
4100
  lastPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
4101
+ /**
4102
+ * @returns Boolean indicating if there is a next page
4103
+ */
3108
4104
  hasNextPage(): boolean;
3109
4105
  }
3110
4106
 
@@ -3116,7 +4112,7 @@ declare type PaginationQueryMeta = {
3116
4112
  };
3117
4113
  interface Paginable<Record extends XataRecord, Result extends XataRecord = Record> {
3118
4114
  meta: PaginationQueryMeta;
3119
- records: Result[];
4115
+ records: RecordArray<Result>;
3120
4116
  nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
3121
4117
  previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
3122
4118
  firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
@@ -3136,7 +4132,7 @@ declare class Page<Record extends XataRecord, Result extends XataRecord = Record
3136
4132
  /**
3137
4133
  * The set of results for this page.
3138
4134
  */
3139
- readonly records: Result[];
4135
+ readonly records: RecordArray<Result>;
3140
4136
  constructor(query: Query<Record, Result>, meta: PaginationQueryMeta, records?: Result[]);
3141
4137
  /**
3142
4138
  * Retrieves the next page of results.
@@ -3184,64 +4180,198 @@ declare type OffsetNavigationOptions = {
3184
4180
  size?: number;
3185
4181
  offset?: number;
3186
4182
  };
3187
- declare type PaginationOptions = CursorNavigationOptions & OffsetNavigationOptions;
3188
4183
  declare const PAGINATION_MAX_SIZE = 200;
3189
- declare const PAGINATION_DEFAULT_SIZE = 200;
4184
+ declare const PAGINATION_DEFAULT_SIZE = 20;
3190
4185
  declare const PAGINATION_MAX_OFFSET = 800;
3191
4186
  declare const PAGINATION_DEFAULT_OFFSET = 0;
4187
+ declare function isCursorPaginationOptions(options: Record<string, unknown> | undefined | null): options is CursorNavigationOptions;
4188
+ declare class RecordArray<Result extends XataRecord> extends Array<Result> {
4189
+ #private;
4190
+ constructor(page: Paginable<any, Result>, overrideRecords?: Result[]);
4191
+ static parseConstructorParams(...args: any[]): any[];
4192
+ toArray(): Result[];
4193
+ map<U>(callbackfn: (value: Result, index: number, array: Result[]) => U, thisArg?: any): U[];
4194
+ /**
4195
+ * Retrieve next page of records
4196
+ *
4197
+ * @returns A new array of objects
4198
+ */
4199
+ nextPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4200
+ /**
4201
+ * Retrieve previous page of records
4202
+ *
4203
+ * @returns A new array of objects
4204
+ */
4205
+ previousPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4206
+ /**
4207
+ * Retrieve first page of records
4208
+ *
4209
+ * @returns A new array of objects
4210
+ */
4211
+ firstPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4212
+ /**
4213
+ * Retrieve last page of records
4214
+ *
4215
+ * @returns A new array of objects
4216
+ */
4217
+ lastPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
4218
+ /**
4219
+ * @returns Boolean indicating if there is a next page
4220
+ */
4221
+ hasNextPage(): boolean;
4222
+ }
3192
4223
 
3193
- declare type TableLink = string[];
3194
- declare type LinkDictionary = Dictionary<TableLink[]>;
3195
4224
  /**
3196
4225
  * Common interface for performing operations on a table.
3197
4226
  */
3198
- declare abstract class Repository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
3199
- abstract create(object: EditableData<Data> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4227
+ declare abstract class Repository<Record extends XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
4228
+ abstract create<K extends SelectableColumn<Record>>(object: Omit<EditableData<Record>, 'id'> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4229
+ abstract create(object: Omit<EditableData<Record>, 'id'> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4230
+ /**
4231
+ * Creates a single record in the table with a unique id.
4232
+ * @param id The unique id.
4233
+ * @param object Object containing the column names with their values to be stored in the table.
4234
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4235
+ * @returns The full persisted record.
4236
+ */
4237
+ abstract create<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3200
4238
  /**
3201
4239
  * Creates a single record in the table with a unique id.
3202
4240
  * @param id The unique id.
3203
4241
  * @param object Object containing the column names with their values to be stored in the table.
3204
4242
  * @returns The full persisted record.
3205
4243
  */
3206
- abstract create(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4244
+ abstract create(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3207
4245
  /**
3208
4246
  * Creates multiple records in the table.
3209
4247
  * @param objects Array of objects with the column names and the values to be stored in the table.
3210
- * @returns Array of the persisted records.
4248
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4249
+ * @returns Array of the persisted records in order.
4250
+ */
4251
+ abstract create<K extends SelectableColumn<Record>>(objects: Array<Omit<EditableData<Record>, 'id'> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4252
+ /**
4253
+ * Creates multiple records in the table.
4254
+ * @param objects Array of objects with the column names and the values to be stored in the table.
4255
+ * @returns Array of the persisted records in order.
3211
4256
  */
3212
- abstract create(objects: Array<EditableData<Data> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4257
+ abstract create(objects: Array<Omit<EditableData<Record>, 'id'> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4258
+ /**
4259
+ * Queries a single record from the table given its unique id.
4260
+ * @param id The unique id.
4261
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4262
+ * @returns The persisted record for the given id or null if the record could not be found.
4263
+ */
4264
+ abstract read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
3213
4265
  /**
3214
4266
  * Queries a single record from the table given its unique id.
3215
4267
  * @param id The unique id.
3216
4268
  * @returns The persisted record for the given id or null if the record could not be found.
3217
4269
  */
3218
4270
  abstract read(id: string): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4271
+ /**
4272
+ * Queries multiple records from the table given their unique id.
4273
+ * @param ids The unique ids array.
4274
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4275
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4276
+ */
4277
+ abstract read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4278
+ /**
4279
+ * Queries multiple records from the table given their unique id.
4280
+ * @param ids The unique ids array.
4281
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4282
+ */
4283
+ abstract read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4284
+ /**
4285
+ * Queries a single record from the table by the id in the object.
4286
+ * @param object Object containing the id of the record.
4287
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4288
+ * @returns The persisted record for the given id or null if the record could not be found.
4289
+ */
4290
+ abstract read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
4291
+ /**
4292
+ * Queries a single record from the table by the id in the object.
4293
+ * @param object Object containing the id of the record.
4294
+ * @returns The persisted record for the given id or null if the record could not be found.
4295
+ */
4296
+ abstract read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4297
+ /**
4298
+ * Queries multiple records from the table by the ids in the objects.
4299
+ * @param objects Array of objects containing the ids of the records.
4300
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4301
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4302
+ */
4303
+ abstract read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4304
+ /**
4305
+ * Queries multiple records from the table by the ids in the objects.
4306
+ * @param objects Array of objects containing the ids of the records.
4307
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
4308
+ */
4309
+ abstract read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3219
4310
  /**
3220
4311
  * Partially update a single record.
3221
4312
  * @param object An object with its id and the columns to be updated.
3222
- * @returns The full persisted record.
4313
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4314
+ * @returns The full persisted record, null if the record could not be found.
4315
+ */
4316
+ abstract update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4317
+ /**
4318
+ * Partially update a single record.
4319
+ * @param object An object with its id and the columns to be updated.
4320
+ * @returns The full persisted record, null if the record could not be found.
3223
4321
  */
3224
- abstract update(object: Partial<EditableData<Data>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4322
+ abstract update(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3225
4323
  /**
3226
4324
  * Partially update a single record given its unique id.
3227
4325
  * @param id The unique id.
3228
4326
  * @param object The column names and their values that have to be updated.
3229
- * @returns The full persisted record.
4327
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4328
+ * @returns The full persisted record, null if the record could not be found.
4329
+ */
4330
+ abstract update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4331
+ /**
4332
+ * Partially update a single record given its unique id.
4333
+ * @param id The unique id.
4334
+ * @param object The column names and their values that have to be updated.
4335
+ * @returns The full persisted record, null if the record could not be found.
3230
4336
  */
3231
- abstract update(id: string, object: Partial<EditableData<Data>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4337
+ abstract update(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3232
4338
  /**
3233
4339
  * Partially updates multiple records.
3234
4340
  * @param objects An array of objects with their ids and columns to be updated.
3235
- * @returns Array of the persisted records.
4341
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4342
+ * @returns Array of the persisted records in order (if a record could not be found null is returned).
4343
+ */
4344
+ abstract update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4345
+ /**
4346
+ * Partially updates multiple records.
4347
+ * @param objects An array of objects with their ids and columns to be updated.
4348
+ * @returns Array of the persisted records in order (if a record could not be found null is returned).
4349
+ */
4350
+ abstract update(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4351
+ /**
4352
+ * Creates or updates a single record. If a record exists with the given id,
4353
+ * it will be update, otherwise a new record will be created.
4354
+ * @param object Object containing the column names with their values to be persisted in the table.
4355
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4356
+ * @returns The full persisted record.
3236
4357
  */
3237
- abstract update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4358
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Record> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3238
4359
  /**
3239
4360
  * Creates or updates a single record. If a record exists with the given id,
3240
4361
  * it will be update, otherwise a new record will be created.
3241
4362
  * @param object Object containing the column names with their values to be persisted in the table.
3242
4363
  * @returns The full persisted record.
3243
4364
  */
3244
- abstract createOrUpdate(object: EditableData<Data> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4365
+ abstract createOrUpdate(object: EditableData<Record> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4366
+ /**
4367
+ * Creates or updates a single record. If a record exists with the given id,
4368
+ * it will be update, otherwise a new record will be created.
4369
+ * @param id A unique id.
4370
+ * @param object The column names and the values to be persisted.
4371
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4372
+ * @returns The full persisted record.
4373
+ */
4374
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3245
4375
  /**
3246
4376
  * Creates or updates a single record. If a record exists with the given id,
3247
4377
  * it will be update, otherwise a new record will be created.
@@ -3249,38 +4379,74 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3249
4379
  * @param object The column names and the values to be persisted.
3250
4380
  * @returns The full persisted record.
3251
4381
  */
3252
- abstract createOrUpdate(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4382
+ abstract createOrUpdate(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3253
4383
  /**
3254
4384
  * Creates or updates a single record. If a record exists with the given id,
3255
4385
  * it will be update, otherwise a new record will be created.
3256
4386
  * @param objects Array of objects with the column names and the values to be stored in the table.
4387
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3257
4388
  * @returns Array of the persisted records.
3258
4389
  */
3259
- abstract createOrUpdate(objects: Array<EditableData<Data> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4390
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4391
+ /**
4392
+ * Creates or updates a single record. If a record exists with the given id,
4393
+ * it will be update, otherwise a new record will be created.
4394
+ * @param objects Array of objects with the column names and the values to be stored in the table.
4395
+ * @returns Array of the persisted records.
4396
+ */
4397
+ abstract createOrUpdate(objects: Array<EditableData<Record> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3260
4398
  /**
3261
4399
  * Deletes a record given its unique id.
3262
- * @param id The unique id.
3263
- * @throws If the record could not be found or there was an error while performing the deletion.
4400
+ * @param object An object with a unique id.
4401
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4402
+ * @returns The deleted record, null if the record could not be found.
3264
4403
  */
3265
- abstract delete(id: string): Promise<void>;
4404
+ abstract delete<K extends SelectableColumn<Record>>(object: Identifiable & Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3266
4405
  /**
3267
4406
  * Deletes a record given its unique id.
3268
- * @param id An object with a unique id.
3269
- * @throws If the record could not be found or there was an error while performing the deletion.
4407
+ * @param object An object with a unique id.
4408
+ * @returns The deleted record, null if the record could not be found.
4409
+ */
4410
+ abstract delete(object: Identifiable & Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4411
+ /**
4412
+ * Deletes a record given a unique id.
4413
+ * @param id The unique id.
4414
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4415
+ * @returns The deleted record, null if the record could not be found.
4416
+ */
4417
+ abstract delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4418
+ /**
4419
+ * Deletes a record given a unique id.
4420
+ * @param id The unique id.
4421
+ * @returns The deleted record, null if the record could not be found.
4422
+ */
4423
+ abstract delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4424
+ /**
4425
+ * Deletes multiple records given an array of objects with ids.
4426
+ * @param objects An array of objects with unique ids.
4427
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4428
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4429
+ */
4430
+ abstract delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4431
+ /**
4432
+ * Deletes multiple records given an array of objects with ids.
4433
+ * @param objects An array of objects with unique ids.
4434
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
3270
4435
  */
3271
- abstract delete(id: Identifiable): Promise<void>;
4436
+ abstract delete(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3272
4437
  /**
3273
- * Deletes a record given a list of unique ids.
3274
- * @param ids The array of unique ids.
3275
- * @throws If the record could not be found or there was an error while performing the deletion.
4438
+ * Deletes multiple records given an array of unique ids.
4439
+ * @param objects An array of ids.
4440
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4441
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
3276
4442
  */
3277
- abstract delete(ids: string[]): Promise<void>;
4443
+ abstract delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3278
4444
  /**
3279
- * Deletes a record given a list of unique ids.
3280
- * @param ids An array of objects with unique ids.
3281
- * @throws If the record could not be found or there was an error while performing the deletion.
4445
+ * Deletes multiple records given an array of unique ids.
4446
+ * @param objects An array of ids.
4447
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
3282
4448
  */
3283
- abstract delete(ids: Identifiable[]): Promise<void>;
4449
+ abstract delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3284
4450
  /**
3285
4451
  * Search for records in the table.
3286
4452
  * @param query The query to search for.
@@ -3288,36 +4454,123 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3288
4454
  * @returns The found records.
3289
4455
  */
3290
4456
  abstract search(query: string, options?: {
3291
- fuzziness?: number;
3292
- }): Promise<SelectedPick<Record, ['*']>[]>;
4457
+ fuzziness?: FuzzinessExpression;
4458
+ prefix?: PrefixExpression;
4459
+ highlight?: HighlightExpression;
4460
+ filter?: Filter<Record>;
4461
+ boosters?: Boosters<Record>[];
4462
+ }): Promise<SearchXataRecord<SelectedPick<Record, ['*']>>[]>;
3293
4463
  abstract query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3294
4464
  }
3295
- declare class RestRepository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Data, Record> {
4465
+ declare class RestRepository<Record extends XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Record> {
3296
4466
  #private;
3297
- db: SchemaPluginResult<any>;
3298
4467
  constructor(options: {
3299
4468
  table: string;
3300
- links?: LinkDictionary;
3301
4469
  db: SchemaPluginResult<any>;
3302
4470
  pluginOptions: XataPluginOptions;
4471
+ schemaTables?: Table[];
3303
4472
  });
3304
- create(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3305
- create(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3306
- create(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3307
- read(recordId: string): Promise<SelectedPick<Record, ['*']> | null>;
3308
- update(object: Partial<EditableData<Data>> & Identifiable): Promise<SelectedPick<Record, ['*']>>;
3309
- update(recordId: string, object: Partial<EditableData<Data>>): Promise<SelectedPick<Record, ['*']>>;
3310
- update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<SelectedPick<Record, ['*']>[]>;
3311
- createOrUpdate(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3312
- createOrUpdate(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3313
- createOrUpdate(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3314
- delete(a: string | Identifiable | Array<string | Identifiable>): Promise<void>;
4473
+ create<K extends SelectableColumn<Record>>(object: EditableData<Record> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4474
+ create(object: EditableData<Record> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4475
+ create<K extends SelectableColumn<Record>>(id: string, object: EditableData<Record>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4476
+ create(id: string, object: EditableData<Record>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4477
+ create<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4478
+ create(objects: Array<EditableData<Record> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4479
+ read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
4480
+ read(id: string): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4481
+ read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4482
+ read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4483
+ read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
4484
+ read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4485
+ read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4486
+ read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4487
+ update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4488
+ update(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4489
+ update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4490
+ update(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4491
+ update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4492
+ update(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4493
+ createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Record> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4494
+ createOrUpdate(object: EditableData<Record> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4495
+ createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4496
+ createOrUpdate(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4497
+ createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4498
+ createOrUpdate(objects: Array<EditableData<Record> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4499
+ delete<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4500
+ delete(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4501
+ delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4502
+ delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4503
+ delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4504
+ delete(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4505
+ delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4506
+ delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3315
4507
  search(query: string, options?: {
3316
- fuzziness?: number;
3317
- }): Promise<SelectedPick<Record, ['*']>[]>;
4508
+ fuzziness?: FuzzinessExpression;
4509
+ prefix?: PrefixExpression;
4510
+ highlight?: HighlightExpression;
4511
+ filter?: Filter<Record>;
4512
+ boosters?: Boosters<Record>[];
4513
+ }): Promise<any>;
3318
4514
  query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3319
4515
  }
3320
4516
 
4517
+ declare type BaseSchema = {
4518
+ name: string;
4519
+ columns: readonly ({
4520
+ name: string;
4521
+ type: Column['type'];
4522
+ } | {
4523
+ name: string;
4524
+ type: 'link';
4525
+ link: {
4526
+ table: string;
4527
+ };
4528
+ } | {
4529
+ name: string;
4530
+ type: 'object';
4531
+ columns: {
4532
+ name: string;
4533
+ type: string;
4534
+ }[];
4535
+ })[];
4536
+ };
4537
+ declare type SchemaInference<T extends readonly BaseSchema[]> = T extends never[] ? Record<string, Record<string, any>> : T extends readonly unknown[] ? T[number] extends {
4538
+ name: string;
4539
+ columns: readonly unknown[];
4540
+ } ? {
4541
+ [K in T[number]['name']]: TableType<T[number], K>;
4542
+ } : never : never;
4543
+ declare type TableType<Tables, TableName> = Tables & {
4544
+ name: TableName;
4545
+ } extends infer Table ? Table extends {
4546
+ name: string;
4547
+ columns: infer Columns;
4548
+ } ? Columns extends readonly unknown[] ? Columns[number] extends {
4549
+ name: string;
4550
+ type: string;
4551
+ } ? Identifiable & {
4552
+ [K in Columns[number]['name']]?: PropertyType<Tables, Columns[number], K>;
4553
+ } : never : never : never : never;
4554
+ declare type PropertyType<Tables, Properties, PropertyName> = Properties & {
4555
+ name: PropertyName;
4556
+ } extends infer Property ? Property extends {
4557
+ name: string;
4558
+ type: infer Type;
4559
+ link?: {
4560
+ table: infer LinkedTable;
4561
+ };
4562
+ columns?: infer ObjectColumns;
4563
+ } ? (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 {
4564
+ name: string;
4565
+ type: string;
4566
+ } ? {
4567
+ [K in ObjectColumns[number]['name']]?: PropertyType<Tables, ObjectColumns[number], K>;
4568
+ } : never : never : Type extends 'link' ? TableType<Tables, LinkedTable> & XataRecord : never) | null : never : never;
4569
+
4570
+ /**
4571
+ * Operator to restrict results to only values that are greater than the given value.
4572
+ */
4573
+ declare const greaterThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3321
4574
  /**
3322
4575
  * Operator to restrict results to only values that are greater than the given value.
3323
4576
  */
@@ -3325,15 +4578,35 @@ declare const gt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T
3325
4578
  /**
3326
4579
  * Operator to restrict results to only values that are greater than or equal to the given value.
3327
4580
  */
3328
- declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4581
+ declare const greaterThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4582
+ /**
4583
+ * Operator to restrict results to only values that are greater than or equal to the given value.
4584
+ */
4585
+ declare const greaterEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3329
4586
  /**
3330
4587
  * Operator to restrict results to only values that are greater than or equal to the given value.
3331
4588
  */
3332
4589
  declare const gte: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4590
+ /**
4591
+ * Operator to restrict results to only values that are greater than or equal to the given value.
4592
+ */
4593
+ declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4594
+ /**
4595
+ * Operator to restrict results to only values that are lower than the given value.
4596
+ */
4597
+ declare const lessThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3333
4598
  /**
3334
4599
  * Operator to restrict results to only values that are lower than the given value.
3335
4600
  */
3336
4601
  declare const lt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4602
+ /**
4603
+ * Operator to restrict results to only values that are lower than or equal to the given value.
4604
+ */
4605
+ declare const lessThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4606
+ /**
4607
+ * Operator to restrict results to only values that are lower than or equal to the given value.
4608
+ */
4609
+ declare const lessEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3337
4610
  /**
3338
4611
  * Operator to restrict results to only values that are lower than or equal to the given value.
3339
4612
  */
@@ -3366,6 +4639,10 @@ declare const pattern: (value: string) => StringTypeFilter;
3366
4639
  * Operator to restrict results to only values that are equal to the given value.
3367
4640
  */
3368
4641
  declare const is: <T>(value: T) => PropertyFilter<T>;
4642
+ /**
4643
+ * Operator to restrict results to only values that are equal to the given value.
4644
+ */
4645
+ declare const equals: <T>(value: T) => PropertyFilter<T>;
3369
4646
  /**
3370
4647
  * Operator to restrict results to only values that are not equal to the given value.
3371
4648
  */
@@ -3393,49 +4670,16 @@ declare const includesAny: <T>(value: T) => ArrayFilter<T>;
3393
4670
 
3394
4671
  declare type SchemaDefinition = {
3395
4672
  table: string;
3396
- links?: LinkDictionary;
3397
4673
  };
3398
- declare type SchemaPluginResult<Schemas extends Record<string, BaseData>> = {
4674
+ declare type SchemaPluginResult<Schemas extends Record<string, XataRecord>> = {
3399
4675
  [Key in keyof Schemas]: Repository<Schemas[Key]>;
3400
- } & {
3401
- [key: string]: Repository<XataRecord$1>;
3402
4676
  };
3403
- declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
4677
+ declare class SchemaPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin {
3404
4678
  #private;
3405
- private links?;
3406
- private tableNames?;
3407
- constructor(links?: LinkDictionary | undefined, tableNames?: string[] | undefined);
4679
+ constructor(schemaTables?: Schemas.Table[]);
3408
4680
  build(pluginOptions: XataPluginOptions): SchemaPluginResult<Schemas>;
3409
4681
  }
3410
4682
 
3411
- declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3412
- fuzziness?: number;
3413
- tables?: Tables[];
3414
- };
3415
- declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3416
- all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3417
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]: {
3418
- table: Model;
3419
- record: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>>;
3420
- };
3421
- }>[]>;
3422
- byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3423
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]?: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>[]>;
3424
- }>;
3425
- };
3426
- declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
3427
- #private;
3428
- private db;
3429
- private links;
3430
- constructor(db: SchemaPluginResult<Schemas>, links: LinkDictionary);
3431
- build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
3432
- }
3433
- declare type SearchXataRecord = XataRecord & {
3434
- xata: {
3435
- table: string;
3436
- };
3437
- };
3438
-
3439
4683
  declare type BranchStrategyValue = string | undefined | null;
3440
4684
  declare type BranchStrategyBuilder = () => BranchStrategyValue | Promise<BranchStrategyValue>;
3441
4685
  declare type BranchStrategy = BranchStrategyValue | BranchStrategyBuilder;
@@ -3447,20 +4691,35 @@ declare type BaseClientOptions = {
3447
4691
  databaseURL?: string;
3448
4692
  branch?: BranchStrategyOption;
3449
4693
  cache?: CacheImpl;
4694
+ trace?: TraceFunction;
3450
4695
  };
3451
4696
  declare const buildClient: <Plugins extends Record<string, XataPlugin> = {}>(plugins?: Plugins | undefined) => ClientConstructor<Plugins>;
3452
4697
  interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
3453
- new <Schemas extends Record<string, BaseData> = {}>(options?: Partial<BaseClientOptions>, links?: LinkDictionary): Omit<{
4698
+ new <Schemas extends Record<string, XataRecord> = {}>(options?: Partial<BaseClientOptions>, schemaTables?: readonly BaseSchema[]): Omit<{
3454
4699
  db: Awaited<ReturnType<SchemaPlugin<Schemas>['build']>>;
3455
4700
  search: Awaited<ReturnType<SearchPlugin<Schemas>['build']>>;
3456
4701
  }, keyof Plugins> & {
3457
4702
  [Key in StringKeys<NonNullable<Plugins>>]: Awaited<ReturnType<NonNullable<Plugins>[Key]['build']>>;
4703
+ } & {
4704
+ getConfig(): Promise<{
4705
+ databaseURL: string;
4706
+ branch: string;
4707
+ }>;
3458
4708
  };
3459
4709
  }
3460
4710
  declare const BaseClient_base: ClientConstructor<{}>;
3461
4711
  declare class BaseClient extends BaseClient_base<Record<string, any>> {
3462
4712
  }
3463
4713
 
4714
+ declare class Serializer {
4715
+ classes: Record<string, any>;
4716
+ add(clazz: any): void;
4717
+ toJSON<T>(data: T): string;
4718
+ fromJSON<T>(json: string): T;
4719
+ }
4720
+ declare const serialize: <T>(data: T) => string;
4721
+ declare const deserialize: <T>(json: string) => T;
4722
+
3464
4723
  declare type BranchResolutionOptions = {
3465
4724
  databaseURL?: string;
3466
4725
  apiKey?: string;
@@ -3472,9 +4731,89 @@ declare function getDatabaseURL(): string | undefined;
3472
4731
 
3473
4732
  declare function getAPIKey(): string | undefined;
3474
4733
 
4734
+ interface Body {
4735
+ arrayBuffer(): Promise<ArrayBuffer>;
4736
+ blob(): Promise<Blob>;
4737
+ formData(): Promise<FormData>;
4738
+ json(): Promise<any>;
4739
+ text(): Promise<string>;
4740
+ }
4741
+ interface Blob {
4742
+ readonly size: number;
4743
+ readonly type: string;
4744
+ arrayBuffer(): Promise<ArrayBuffer>;
4745
+ slice(start?: number, end?: number, contentType?: string): Blob;
4746
+ text(): Promise<string>;
4747
+ }
4748
+ /** Provides information about files and allows JavaScript in a web page to access their content. */
4749
+ interface File extends Blob {
4750
+ readonly lastModified: number;
4751
+ readonly name: string;
4752
+ readonly webkitRelativePath: string;
4753
+ }
4754
+ declare type FormDataEntryValue = File | string;
4755
+ /** 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". */
4756
+ interface FormData {
4757
+ append(name: string, value: string | Blob, fileName?: string): void;
4758
+ delete(name: string): void;
4759
+ get(name: string): FormDataEntryValue | null;
4760
+ getAll(name: string): FormDataEntryValue[];
4761
+ has(name: string): boolean;
4762
+ set(name: string, value: string | Blob, fileName?: string): void;
4763
+ forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void;
4764
+ }
4765
+ /** 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. */
4766
+ interface Headers {
4767
+ append(name: string, value: string): void;
4768
+ delete(name: string): void;
4769
+ get(name: string): string | null;
4770
+ has(name: string): boolean;
4771
+ set(name: string, value: string): void;
4772
+ forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void;
4773
+ }
4774
+ interface Request extends Body {
4775
+ /** Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching. */
4776
+ readonly cache: 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload';
4777
+ /** 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. */
4778
+ readonly credentials: 'include' | 'omit' | 'same-origin';
4779
+ /** Returns the kind of resource requested by request, e.g., "document" or "script". */
4780
+ readonly destination: '' | 'audio' | 'audioworklet' | 'document' | 'embed' | 'font' | 'frame' | 'iframe' | 'image' | 'manifest' | 'object' | 'paintworklet' | 'report' | 'script' | 'sharedworker' | 'style' | 'track' | 'video' | 'worker' | 'xslt';
4781
+ /** 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. */
4782
+ readonly headers: Headers;
4783
+ /** 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] */
4784
+ readonly integrity: string;
4785
+ /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
4786
+ readonly keepalive: boolean;
4787
+ /** Returns request's HTTP method, which is "GET" by default. */
4788
+ readonly method: string;
4789
+ /** 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. */
4790
+ readonly mode: 'cors' | 'navigate' | 'no-cors' | 'same-origin';
4791
+ /** 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. */
4792
+ readonly redirect: 'error' | 'follow' | 'manual';
4793
+ /** 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. */
4794
+ readonly referrer: string;
4795
+ /** Returns the referrer policy associated with request. This is used during fetching to compute the value of the request's referrer. */
4796
+ readonly referrerPolicy: '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
4797
+ /** Returns the URL of request as a string. */
4798
+ readonly url: string;
4799
+ clone(): Request;
4800
+ }
4801
+
4802
+ declare type XataWorkerContext<XataClient> = {
4803
+ xata: XataClient;
4804
+ request: Request;
4805
+ env: Record<string, string | undefined>;
4806
+ };
4807
+ declare type RemoveFirst<T> = T extends [any, ...infer U] ? U : never;
4808
+ declare type WorkerRunnerConfig = {
4809
+ workspace: string;
4810
+ worker: string;
4811
+ };
4812
+ 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>>>;
4813
+
3475
4814
  declare class XataError extends Error {
3476
4815
  readonly status: number;
3477
4816
  constructor(message: string, status: number);
3478
4817
  }
3479
4818
 
3480
- 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, LinkDictionary, OffsetNavigationOptions, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Paginable, PaginationOptions, PaginationQueryMeta, Query, QueryTableError, QueryTablePathParams, QueryTableRequestBody, QueryTableVariables, 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 };
4819
+ 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, 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, updateMigrationRequest, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };