@xata.io/client 0.13.4 → 0.16.0

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
@@ -23,7 +23,6 @@ declare type ErrorWrapper<TError> = TError | {
23
23
  };
24
24
 
25
25
  interface CacheImpl {
26
- cacheRecords: boolean;
27
26
  defaultQueryTTL: number;
28
27
  getAll(): Promise<Record<string, unknown>>;
29
28
  get: <T>(key: string) => Promise<T | null>;
@@ -33,13 +32,11 @@ interface CacheImpl {
33
32
  }
34
33
  interface SimpleCacheOptions {
35
34
  max?: number;
36
- cacheRecords?: boolean;
37
35
  defaultQueryTTL?: number;
38
36
  }
39
37
  declare class SimpleCache implements CacheImpl {
40
38
  #private;
41
39
  capacity: number;
42
- cacheRecords: boolean;
43
40
  defaultQueryTTL: number;
44
41
  constructor(options?: SimpleCacheOptions);
45
42
  getAll(): Promise<Record<string, unknown>>;
@@ -282,6 +279,10 @@ declare type SortOrder = 'asc' | 'desc';
282
279
  * @minimum 0
283
280
  */
284
281
  declare type FuzzinessExpression = number;
282
+ /**
283
+ * 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.
284
+ */
285
+ declare type PrefixExpression = 'phrase' | 'disabled';
285
286
  /**
286
287
  * @minProperties 1
287
288
  */
@@ -299,6 +300,44 @@ declare type HighlightExpression = {
299
300
  enabled?: boolean;
300
301
  encodeHTML?: boolean;
301
302
  };
303
+ /**
304
+ * Booster Expression
305
+ *
306
+ * @x-go-type xata.BoosterExpression
307
+ */
308
+ declare type BoosterExpression = {
309
+ valueBooster?: ValueBooster$1;
310
+ } | {
311
+ numericBooster?: NumericBooster$1;
312
+ } | {
313
+ dateBooster?: DateBooster$1;
314
+ };
315
+ /**
316
+ * Boost records with a particular value for a column.
317
+ */
318
+ declare type ValueBooster$1 = {
319
+ column: string;
320
+ value: string | number | boolean;
321
+ factor: number;
322
+ };
323
+ /**
324
+ * Boost records based on the value of a numeric column.
325
+ */
326
+ declare type NumericBooster$1 = {
327
+ column: string;
328
+ factor: number;
329
+ };
330
+ /**
331
+ * Boost records based on the value of a datetime column. It is configured via "origin", "scale", and "decay". The further away from the "origin",
332
+ * 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
333
+ * 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.
334
+ */
335
+ declare type DateBooster$1 = {
336
+ column: string;
337
+ origin?: string;
338
+ scale: string;
339
+ decay: number;
340
+ };
302
341
  declare type FilterList = FilterExpression | FilterExpression[];
303
342
  declare type FilterColumn = FilterColumnIncludes | FilterPredicate | FilterList;
304
343
  /**
@@ -355,7 +394,24 @@ declare type PageConfig = {
355
394
  size?: number;
356
395
  offset?: number;
357
396
  };
358
- declare type ColumnsFilter = string[];
397
+ declare type ColumnsProjection = string[];
398
+ /**
399
+ * Xata Table Record Metadata
400
+ */
401
+ declare type RecordMeta = {
402
+ id: RecordID;
403
+ xata: {
404
+ version: number;
405
+ table?: string;
406
+ highlight?: {
407
+ [key: string]: string[] | {
408
+ [key: string]: any;
409
+ };
410
+ };
411
+ score?: number;
412
+ warnings?: string[];
413
+ };
414
+ };
359
415
  /**
360
416
  * @pattern [a-zA-Z0-9_-~:]+
361
417
  */
@@ -377,21 +433,9 @@ declare type RecordsMetadata = {
377
433
  };
378
434
  };
379
435
  /**
380
- * Xata Table Record
436
+ * Xata Table Record Metadata
381
437
  */
382
- declare type XataRecord$1 = {
383
- id: RecordID;
384
- xata: {
385
- version: number;
386
- table?: string;
387
- highlight?: {
388
- [key: string]: string[] | {
389
- [key: string]: any;
390
- };
391
- };
392
- warnings?: string[];
393
- };
394
- } & {
438
+ declare type XataRecord$1 = RecordMeta & {
395
439
  [key: string]: any;
396
440
  };
397
441
 
@@ -433,8 +477,10 @@ type schemas_ColumnMigration = ColumnMigration;
433
477
  type schemas_SortExpression = SortExpression;
434
478
  type schemas_SortOrder = SortOrder;
435
479
  type schemas_FuzzinessExpression = FuzzinessExpression;
480
+ type schemas_PrefixExpression = PrefixExpression;
436
481
  type schemas_FilterExpression = FilterExpression;
437
482
  type schemas_HighlightExpression = HighlightExpression;
483
+ type schemas_BoosterExpression = BoosterExpression;
438
484
  type schemas_FilterList = FilterList;
439
485
  type schemas_FilterColumn = FilterColumn;
440
486
  type schemas_FilterColumnIncludes = FilterColumnIncludes;
@@ -444,7 +490,8 @@ type schemas_FilterPredicateRangeOp = FilterPredicateRangeOp;
444
490
  type schemas_FilterRangeValue = FilterRangeValue;
445
491
  type schemas_FilterValue = FilterValue;
446
492
  type schemas_PageConfig = PageConfig;
447
- type schemas_ColumnsFilter = ColumnsFilter;
493
+ type schemas_ColumnsProjection = ColumnsProjection;
494
+ type schemas_RecordMeta = RecordMeta;
448
495
  type schemas_RecordID = RecordID;
449
496
  type schemas_TableRename = TableRename;
450
497
  type schemas_RecordsMetadata = RecordsMetadata;
@@ -488,8 +535,13 @@ declare namespace schemas {
488
535
  schemas_SortExpression as SortExpression,
489
536
  schemas_SortOrder as SortOrder,
490
537
  schemas_FuzzinessExpression as FuzzinessExpression,
538
+ schemas_PrefixExpression as PrefixExpression,
491
539
  schemas_FilterExpression as FilterExpression,
492
540
  schemas_HighlightExpression as HighlightExpression,
541
+ schemas_BoosterExpression as BoosterExpression,
542
+ ValueBooster$1 as ValueBooster,
543
+ NumericBooster$1 as NumericBooster,
544
+ DateBooster$1 as DateBooster,
493
545
  schemas_FilterList as FilterList,
494
546
  schemas_FilterColumn as FilterColumn,
495
547
  schemas_FilterColumnIncludes as FilterColumnIncludes,
@@ -499,7 +551,8 @@ declare namespace schemas {
499
551
  schemas_FilterRangeValue as FilterRangeValue,
500
552
  schemas_FilterValue as FilterValue,
501
553
  schemas_PageConfig as PageConfig,
502
- schemas_ColumnsFilter as ColumnsFilter,
554
+ schemas_ColumnsProjection as ColumnsProjection,
555
+ schemas_RecordMeta as RecordMeta,
503
556
  schemas_RecordID as RecordID,
504
557
  schemas_TableRename as TableRename,
505
558
  schemas_RecordsMetadata as RecordsMetadata,
@@ -534,11 +587,17 @@ declare type BulkError = {
534
587
  status?: number;
535
588
  }[];
536
589
  };
590
+ declare type BulkInsertResponse = {
591
+ recordIDs: string[];
592
+ } | {
593
+ records: XataRecord$1[];
594
+ };
537
595
  declare type BranchMigrationPlan = {
538
596
  version: number;
539
597
  migration: BranchMigration;
540
598
  };
541
- declare type RecordUpdateResponse = {
599
+ declare type RecordResponse = XataRecord$1;
600
+ declare type RecordUpdateResponse = XataRecord$1 | {
542
601
  id: string;
543
602
  xata: {
544
603
  version: number;
@@ -562,7 +621,9 @@ type responses_SimpleError = SimpleError;
562
621
  type responses_BadRequestError = BadRequestError;
563
622
  type responses_AuthError = AuthError;
564
623
  type responses_BulkError = BulkError;
624
+ type responses_BulkInsertResponse = BulkInsertResponse;
565
625
  type responses_BranchMigrationPlan = BranchMigrationPlan;
626
+ type responses_RecordResponse = RecordResponse;
566
627
  type responses_RecordUpdateResponse = RecordUpdateResponse;
567
628
  type responses_QueryResponse = QueryResponse;
568
629
  type responses_SearchResponse = SearchResponse;
@@ -573,7 +634,9 @@ declare namespace responses {
573
634
  responses_BadRequestError as BadRequestError,
574
635
  responses_AuthError as AuthError,
575
636
  responses_BulkError as BulkError,
637
+ responses_BulkInsertResponse as BulkInsertResponse,
576
638
  responses_BranchMigrationPlan as BranchMigrationPlan,
639
+ responses_RecordResponse as RecordResponse,
577
640
  responses_RecordUpdateResponse as RecordUpdateResponse,
578
641
  responses_QueryResponse as QueryResponse,
579
642
  responses_SearchResponse as SearchResponse,
@@ -879,6 +942,9 @@ declare type InviteWorkspaceMemberError = ErrorWrapper<{
879
942
  } | {
880
943
  status: 404;
881
944
  payload: SimpleError;
945
+ } | {
946
+ status: 409;
947
+ payload: SimpleError;
882
948
  }>;
883
949
  declare type InviteWorkspaceMemberRequestBody = {
884
950
  email: string;
@@ -892,6 +958,34 @@ declare type InviteWorkspaceMemberVariables = {
892
958
  * Invite some user to join the workspace with the given role
893
959
  */
894
960
  declare const inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<WorkspaceInvite>;
961
+ declare type UpdateWorkspaceMemberInvitePathParams = {
962
+ workspaceId: WorkspaceID;
963
+ inviteId: InviteID;
964
+ };
965
+ declare type UpdateWorkspaceMemberInviteError = ErrorWrapper<{
966
+ status: 400;
967
+ payload: BadRequestError;
968
+ } | {
969
+ status: 401;
970
+ payload: AuthError;
971
+ } | {
972
+ status: 404;
973
+ payload: SimpleError;
974
+ } | {
975
+ status: 422;
976
+ payload: SimpleError;
977
+ }>;
978
+ declare type UpdateWorkspaceMemberInviteRequestBody = {
979
+ role: Role;
980
+ };
981
+ declare type UpdateWorkspaceMemberInviteVariables = {
982
+ body: UpdateWorkspaceMemberInviteRequestBody;
983
+ pathParams: UpdateWorkspaceMemberInvitePathParams;
984
+ } & FetcherExtraProps;
985
+ /**
986
+ * 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.
987
+ */
988
+ declare const updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
895
989
  declare type CancelWorkspaceMemberInvitePathParams = {
896
990
  workspaceId: WorkspaceID;
897
991
  inviteId: InviteID;
@@ -1237,6 +1331,10 @@ declare type CreateBranchError = ErrorWrapper<{
1237
1331
  status: 404;
1238
1332
  payload: SimpleError;
1239
1333
  }>;
1334
+ declare type CreateBranchResponse = {
1335
+ databaseName: string;
1336
+ branchName: string;
1337
+ };
1240
1338
  declare type CreateBranchRequestBody = {
1241
1339
  from?: string;
1242
1340
  metadata?: BranchMetadata;
@@ -1246,7 +1344,7 @@ declare type CreateBranchVariables = {
1246
1344
  pathParams: CreateBranchPathParams;
1247
1345
  queryParams?: CreateBranchQueryParams;
1248
1346
  } & FetcherExtraProps;
1249
- declare const createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
1347
+ declare const createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
1250
1348
  declare type DeleteBranchPathParams = {
1251
1349
  dbBranchName: DBBranchName;
1252
1350
  workspace: string;
@@ -1433,13 +1531,17 @@ declare type CreateTableError = ErrorWrapper<{
1433
1531
  status: 422;
1434
1532
  payload: SimpleError;
1435
1533
  }>;
1534
+ declare type CreateTableResponse = {
1535
+ branchName: string;
1536
+ tableName: string;
1537
+ };
1436
1538
  declare type CreateTableVariables = {
1437
1539
  pathParams: CreateTablePathParams;
1438
1540
  } & FetcherExtraProps;
1439
1541
  /**
1440
1542
  * Creates a new table with the given name. Returns 422 if a table with the same name already exists.
1441
1543
  */
1442
- declare const createTable: (variables: CreateTableVariables) => Promise<undefined>;
1544
+ declare const createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
1443
1545
  declare type DeleteTablePathParams = {
1444
1546
  dbBranchName: DBBranchName;
1445
1547
  tableName: TableName;
@@ -1672,6 +1774,9 @@ declare type InsertRecordPathParams = {
1672
1774
  tableName: TableName;
1673
1775
  workspace: string;
1674
1776
  };
1777
+ declare type InsertRecordQueryParams = {
1778
+ columns?: ColumnsProjection;
1779
+ };
1675
1780
  declare type InsertRecordError = ErrorWrapper<{
1676
1781
  status: 400;
1677
1782
  payload: BadRequestError;
@@ -1682,20 +1787,15 @@ declare type InsertRecordError = ErrorWrapper<{
1682
1787
  status: 404;
1683
1788
  payload: SimpleError;
1684
1789
  }>;
1685
- declare type InsertRecordResponse = {
1686
- id: string;
1687
- xata: {
1688
- version: number;
1689
- };
1690
- };
1691
1790
  declare type InsertRecordVariables = {
1692
1791
  body?: Record<string, any>;
1693
1792
  pathParams: InsertRecordPathParams;
1793
+ queryParams?: InsertRecordQueryParams;
1694
1794
  } & FetcherExtraProps;
1695
1795
  /**
1696
1796
  * Insert a new Record into the Table
1697
1797
  */
1698
- declare const insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
1798
+ declare const insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
1699
1799
  declare type InsertRecordWithIDPathParams = {
1700
1800
  dbBranchName: DBBranchName;
1701
1801
  tableName: TableName;
@@ -1703,6 +1803,7 @@ declare type InsertRecordWithIDPathParams = {
1703
1803
  workspace: string;
1704
1804
  };
1705
1805
  declare type InsertRecordWithIDQueryParams = {
1806
+ columns?: ColumnsProjection;
1706
1807
  createOnly?: boolean;
1707
1808
  ifVersion?: number;
1708
1809
  };
@@ -1735,6 +1836,7 @@ declare type UpdateRecordWithIDPathParams = {
1735
1836
  workspace: string;
1736
1837
  };
1737
1838
  declare type UpdateRecordWithIDQueryParams = {
1839
+ columns?: ColumnsProjection;
1738
1840
  ifVersion?: number;
1739
1841
  };
1740
1842
  declare type UpdateRecordWithIDError = ErrorWrapper<{
@@ -1763,6 +1865,7 @@ declare type UpsertRecordWithIDPathParams = {
1763
1865
  workspace: string;
1764
1866
  };
1765
1867
  declare type UpsertRecordWithIDQueryParams = {
1868
+ columns?: ColumnsProjection;
1766
1869
  ifVersion?: number;
1767
1870
  };
1768
1871
  declare type UpsertRecordWithIDError = ErrorWrapper<{
@@ -1790,6 +1893,9 @@ declare type DeleteRecordPathParams = {
1790
1893
  recordId: RecordID;
1791
1894
  workspace: string;
1792
1895
  };
1896
+ declare type DeleteRecordQueryParams = {
1897
+ columns?: ColumnsProjection;
1898
+ };
1793
1899
  declare type DeleteRecordError = ErrorWrapper<{
1794
1900
  status: 400;
1795
1901
  payload: BadRequestError;
@@ -1802,14 +1908,18 @@ declare type DeleteRecordError = ErrorWrapper<{
1802
1908
  }>;
1803
1909
  declare type DeleteRecordVariables = {
1804
1910
  pathParams: DeleteRecordPathParams;
1911
+ queryParams?: DeleteRecordQueryParams;
1805
1912
  } & FetcherExtraProps;
1806
- declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
1913
+ declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
1807
1914
  declare type GetRecordPathParams = {
1808
1915
  dbBranchName: DBBranchName;
1809
1916
  tableName: TableName;
1810
1917
  recordId: RecordID;
1811
1918
  workspace: string;
1812
1919
  };
1920
+ declare type GetRecordQueryParams = {
1921
+ columns?: ColumnsProjection;
1922
+ };
1813
1923
  declare type GetRecordError = ErrorWrapper<{
1814
1924
  status: 400;
1815
1925
  payload: BadRequestError;
@@ -1820,12 +1930,9 @@ declare type GetRecordError = ErrorWrapper<{
1820
1930
  status: 404;
1821
1931
  payload: SimpleError;
1822
1932
  }>;
1823
- declare type GetRecordRequestBody = {
1824
- columns?: ColumnsFilter;
1825
- };
1826
1933
  declare type GetRecordVariables = {
1827
- body?: GetRecordRequestBody;
1828
1934
  pathParams: GetRecordPathParams;
1935
+ queryParams?: GetRecordQueryParams;
1829
1936
  } & FetcherExtraProps;
1830
1937
  /**
1831
1938
  * Retrieve record by ID
@@ -1836,6 +1943,9 @@ declare type BulkInsertTableRecordsPathParams = {
1836
1943
  tableName: TableName;
1837
1944
  workspace: string;
1838
1945
  };
1946
+ declare type BulkInsertTableRecordsQueryParams = {
1947
+ columns?: ColumnsProjection;
1948
+ };
1839
1949
  declare type BulkInsertTableRecordsError = ErrorWrapper<{
1840
1950
  status: 400;
1841
1951
  payload: BulkError;
@@ -1845,21 +1955,22 @@ declare type BulkInsertTableRecordsError = ErrorWrapper<{
1845
1955
  } | {
1846
1956
  status: 404;
1847
1957
  payload: SimpleError;
1958
+ } | {
1959
+ status: 422;
1960
+ payload: SimpleError;
1848
1961
  }>;
1849
- declare type BulkInsertTableRecordsResponse = {
1850
- recordIDs: string[];
1851
- };
1852
1962
  declare type BulkInsertTableRecordsRequestBody = {
1853
1963
  records: Record<string, any>[];
1854
1964
  };
1855
1965
  declare type BulkInsertTableRecordsVariables = {
1856
1966
  body: BulkInsertTableRecordsRequestBody;
1857
1967
  pathParams: BulkInsertTableRecordsPathParams;
1968
+ queryParams?: BulkInsertTableRecordsQueryParams;
1858
1969
  } & FetcherExtraProps;
1859
1970
  /**
1860
1971
  * Bulk insert records
1861
1972
  */
1862
- declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
1973
+ declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
1863
1974
  declare type QueryTablePathParams = {
1864
1975
  dbBranchName: DBBranchName;
1865
1976
  tableName: TableName;
@@ -1879,7 +1990,7 @@ declare type QueryTableRequestBody = {
1879
1990
  filter?: FilterExpression;
1880
1991
  sort?: SortExpression;
1881
1992
  page?: PageConfig;
1882
- columns?: ColumnsFilter;
1993
+ columns?: ColumnsProjection;
1883
1994
  };
1884
1995
  declare type QueryTableVariables = {
1885
1996
  body?: QueryTableRequestBody;
@@ -2625,8 +2736,10 @@ declare type SearchTableError = ErrorWrapper<{
2625
2736
  declare type SearchTableRequestBody = {
2626
2737
  query: string;
2627
2738
  fuzziness?: FuzzinessExpression;
2739
+ prefix?: PrefixExpression;
2628
2740
  filter?: FilterExpression;
2629
2741
  highlight?: HighlightExpression;
2742
+ boosters?: BoosterExpression[];
2630
2743
  };
2631
2744
  declare type SearchTableVariables = {
2632
2745
  body: SearchTableRequestBody;
@@ -2658,6 +2771,7 @@ declare type SearchBranchRequestBody = {
2658
2771
  tables?: (string | {
2659
2772
  table: string;
2660
2773
  filter?: FilterExpression;
2774
+ boosters?: BoosterExpression[];
2661
2775
  })[];
2662
2776
  query: string;
2663
2777
  fuzziness?: FuzzinessExpression;
@@ -2690,6 +2804,7 @@ declare const operationsByTag: {
2690
2804
  updateWorkspaceMemberRole: (variables: UpdateWorkspaceMemberRoleVariables) => Promise<undefined>;
2691
2805
  removeWorkspaceMember: (variables: RemoveWorkspaceMemberVariables) => Promise<undefined>;
2692
2806
  inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<WorkspaceInvite>;
2807
+ updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
2693
2808
  cancelWorkspaceMemberInvite: (variables: CancelWorkspaceMemberInviteVariables) => Promise<undefined>;
2694
2809
  resendWorkspaceMemberInvite: (variables: ResendWorkspaceMemberInviteVariables) => Promise<undefined>;
2695
2810
  acceptWorkspaceMemberInvite: (variables: AcceptWorkspaceMemberInviteVariables) => Promise<undefined>;
@@ -2706,7 +2821,7 @@ declare const operationsByTag: {
2706
2821
  branch: {
2707
2822
  getBranchList: (variables: GetBranchListVariables) => Promise<ListBranchesResponse>;
2708
2823
  getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
2709
- createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
2824
+ createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
2710
2825
  deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
2711
2826
  updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
2712
2827
  getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
@@ -2716,7 +2831,7 @@ declare const operationsByTag: {
2716
2831
  getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
2717
2832
  };
2718
2833
  table: {
2719
- createTable: (variables: CreateTableVariables) => Promise<undefined>;
2834
+ createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
2720
2835
  deleteTable: (variables: DeleteTableVariables) => Promise<undefined>;
2721
2836
  updateTable: (variables: UpdateTableVariables) => Promise<undefined>;
2722
2837
  getTableSchema: (variables: GetTableSchemaVariables) => Promise<GetTableSchemaResponse>;
@@ -2728,13 +2843,13 @@ declare const operationsByTag: {
2728
2843
  updateColumn: (variables: UpdateColumnVariables) => Promise<MigrationIdResponse>;
2729
2844
  };
2730
2845
  records: {
2731
- insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
2846
+ insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
2732
2847
  insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2733
2848
  updateRecordWithID: (variables: UpdateRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2734
2849
  upsertRecordWithID: (variables: UpsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2735
- deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
2850
+ deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
2736
2851
  getRecord: (variables: GetRecordVariables) => Promise<XataRecord$1>;
2737
- bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
2852
+ bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
2738
2853
  queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
2739
2854
  searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2740
2855
  searchBranch: (variables: SearchBranchVariables) => Promise<SearchResponse>;
@@ -2788,6 +2903,7 @@ declare class WorkspaceApi {
2788
2903
  updateWorkspaceMemberRole(workspaceId: WorkspaceID, userId: UserID, role: Role): Promise<void>;
2789
2904
  removeWorkspaceMember(workspaceId: WorkspaceID, userId: UserID): Promise<void>;
2790
2905
  inviteWorkspaceMember(workspaceId: WorkspaceID, email: string, role: Role): Promise<WorkspaceInvite>;
2906
+ updateWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID, role: Role): Promise<WorkspaceInvite>;
2791
2907
  cancelWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2792
2908
  resendWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2793
2909
  acceptWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteKey: InviteKey): Promise<void>;
@@ -2808,7 +2924,7 @@ declare class BranchApi {
2808
2924
  constructor(extraProps: FetcherExtraProps);
2809
2925
  getBranchList(workspace: WorkspaceID, dbName: DBName): Promise<ListBranchesResponse>;
2810
2926
  getBranchDetails(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<DBBranch>;
2811
- createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<void>;
2927
+ createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<CreateBranchResponse>;
2812
2928
  deleteBranch(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<void>;
2813
2929
  updateBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName, metadata?: BranchMetadata): Promise<void>;
2814
2930
  getBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<BranchMetadata>;
@@ -2820,7 +2936,7 @@ declare class BranchApi {
2820
2936
  declare class TableApi {
2821
2937
  private extraProps;
2822
2938
  constructor(extraProps: FetcherExtraProps);
2823
- createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
2939
+ createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<CreateTableResponse>;
2824
2940
  deleteTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
2825
2941
  updateTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, options: UpdateTableRequestBody): Promise<void>;
2826
2942
  getTableSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<GetTableSchemaResponse>;
@@ -2834,13 +2950,13 @@ declare class TableApi {
2834
2950
  declare class RecordsApi {
2835
2951
  private extraProps;
2836
2952
  constructor(extraProps: FetcherExtraProps);
2837
- insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>): Promise<InsertRecordResponse>;
2953
+ insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>, options?: InsertRecordQueryParams): Promise<RecordUpdateResponse>;
2838
2954
  insertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: InsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2839
2955
  updateRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpdateRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2840
2956
  upsertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2841
- deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID): Promise<void>;
2842
- getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordRequestBody): Promise<XataRecord$1>;
2843
- bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[]): Promise<BulkInsertTableRecordsResponse>;
2957
+ deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: DeleteRecordQueryParams): Promise<RecordUpdateResponse>;
2958
+ getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordQueryParams): Promise<XataRecord$1>;
2959
+ bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[], options?: BulkInsertTableRecordsQueryParams): Promise<BulkInsertResponse>;
2844
2960
  queryTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: QueryTableRequestBody): Promise<QueryResponse>;
2845
2961
  searchTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: SearchTableRequestBody): Promise<SearchResponse>;
2846
2962
  searchBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, query: SearchBranchRequestBody): Promise<SearchResponse>;
@@ -2856,19 +2972,20 @@ declare type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) ex
2856
2972
  declare type If<Condition, Then, Else> = Condition extends true ? Then : Else;
2857
2973
  declare type IsObject<T> = T extends Record<string, any> ? true : false;
2858
2974
  declare type IsArray<T> = T extends Array<any> ? true : false;
2859
- declare type NonEmptyArray<T> = T[] & {
2860
- 0: T;
2861
- };
2862
2975
  declare type RequiredBy<T, K extends keyof T> = T & {
2863
2976
  [P in K]-?: NonNullable<T[P]>;
2864
2977
  };
2865
2978
  declare type GetArrayInnerType<T extends readonly any[]> = T[number];
2866
2979
  declare type SingleOrArray<T> = T | T[];
2867
2980
  declare type OmitBy<T, K extends keyof T> = T extends any ? Omit<T, K> : never;
2981
+ declare type Without<T, U> = {
2982
+ [P in Exclude<keyof T, keyof U>]?: never;
2983
+ };
2984
+ declare type ExclusiveOr<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
2868
2985
 
2869
2986
  declare type SelectableColumn<O, RecursivePath extends any[] = []> = '*' | 'id' | DataProps<O> | NestedColumns<O, RecursivePath>;
2870
- declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord & UnionToIntersection<Values<{
2871
- [K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord;
2987
+ declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord<O> & UnionToIntersection<Values<{
2988
+ [K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord<O>;
2872
2989
  }>>;
2873
2990
  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> ? {
2874
2991
  V: ValueAtColumn<Item, V>;
@@ -2904,22 +3021,37 @@ interface BaseData {
2904
3021
  /**
2905
3022
  * Represents a persisted record from the database.
2906
3023
  */
2907
- interface XataRecord<ExtraMetadata extends Record<string, unknown> = Record<string, unknown>> extends Identifiable {
3024
+ interface XataRecord<OriginalRecord extends XataRecord<any> = XataRecord<any>> extends Identifiable {
2908
3025
  /**
2909
3026
  * Get metadata of this record.
2910
3027
  */
2911
- getMetadata(): XataRecordMetadata & ExtraMetadata;
3028
+ getMetadata(): XataRecordMetadata;
2912
3029
  /**
2913
3030
  * Retrieves a refreshed copy of the current record from the database.
3031
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3032
+ * @returns The persisted record with the selected columns.
2914
3033
  */
2915
- read(): Promise<Readonly<SelectedPick<this, ['*']>> | null>;
3034
+ read<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
3035
+ /**
3036
+ * Retrieves a refreshed copy of the current record from the database.
3037
+ * @returns The persisted record with all first level properties.
3038
+ */
3039
+ read(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2916
3040
  /**
2917
3041
  * Performs a partial update of the current record. On success a new object is
2918
3042
  * returned and the current object is not mutated.
2919
3043
  * @param partialUpdate The columns and their values that have to be updated.
2920
- * @returns A new record containing the latest values for all the columns of the current record.
3044
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3045
+ * @returns The persisted record with the selected columns.
2921
3046
  */
2922
- update(partialUpdate: Partial<EditableData<Omit<this, keyof XataRecord>>>): Promise<Readonly<SelectedPick<this, ['*']>>>;
3047
+ update<K extends SelectableColumn<OriginalRecord>>(partialUpdate: Partial<EditableData<Omit<OriginalRecord, keyof XataRecord>>>, columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>>>;
3048
+ /**
3049
+ * Performs a partial update of the current record. On success a new object is
3050
+ * returned and the current object is not mutated.
3051
+ * @param partialUpdate The columns and their values that have to be updated.
3052
+ * @returns The persisted record with all first level properties.
3053
+ */
3054
+ update(partialUpdate: Partial<EditableData<Omit<OriginalRecord, keyof XataRecord>>>): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>>>;
2923
3055
  /**
2924
3056
  * Performs a deletion of the current record in the database.
2925
3057
  *
@@ -2931,14 +3063,20 @@ declare type Link<Record extends XataRecord> = Omit<XataRecord, 'read' | 'update
2931
3063
  /**
2932
3064
  * Retrieves a refreshed copy of the current record from the database.
2933
3065
  */
2934
- read(): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3066
+ read<K extends SelectableColumn<Record>>(columns?: K[]): Promise<Readonly<SelectedPick<Record, typeof columns extends SelectableColumn<Record>[] ? typeof columns : ['*']>> | null>;
2935
3067
  /**
2936
3068
  * Performs a partial update of the current record. On success a new object is
2937
3069
  * returned and the current object is not mutated.
2938
3070
  * @param partialUpdate The columns and their values that have to be updated.
2939
3071
  * @returns A new record containing the latest values for all the columns of the current record.
2940
3072
  */
2941
- update(partialUpdate: Partial<EditableData<Omit<Record, keyof XataRecord>>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3073
+ update<K extends SelectableColumn<Record>>(partialUpdate: Partial<EditableData<Omit<Record, keyof XataRecord>>>, columns?: K[]): Promise<Readonly<SelectedPick<Record, typeof columns extends SelectableColumn<Record>[] ? typeof columns : ['*']>>>;
3074
+ /**
3075
+ * Performs a deletion of the current record in the database.
3076
+ *
3077
+ * @throws If the record was already deleted or if an error happened while performing the deletion.
3078
+ */
3079
+ delete(): Promise<void>;
2942
3080
  };
2943
3081
  declare type XataRecordMetadata = {
2944
3082
  /**
@@ -3051,6 +3189,84 @@ declare type NestedApiFilter<T> = {
3051
3189
  };
3052
3190
  declare type Filter<T> = T extends Record<string, any> ? BaseApiFilter<T> | NestedApiFilter<T> : PropertyFilter<T>;
3053
3191
 
3192
+ declare type DateBooster = {
3193
+ origin?: string;
3194
+ scale: string;
3195
+ decay: number;
3196
+ };
3197
+ declare type NumericBooster = {
3198
+ factor: number;
3199
+ };
3200
+ declare type ValueBooster<T extends string | number | boolean> = {
3201
+ value: T;
3202
+ factor: number;
3203
+ };
3204
+ declare type Boosters<O extends XataRecord> = Values<{
3205
+ [K in SelectableColumn<O>]: NonNullable<ValueAtColumn<O, K>> extends Date ? {
3206
+ dateBooster: {
3207
+ column: K;
3208
+ } & DateBooster;
3209
+ } : NonNullable<ValueAtColumn<O, K>> extends number ? ExclusiveOr<{
3210
+ numericBooster?: {
3211
+ column: K;
3212
+ } & NumericBooster;
3213
+ }, {
3214
+ valueBooster?: {
3215
+ column: K;
3216
+ } & ValueBooster<number>;
3217
+ }> : NonNullable<ValueAtColumn<O, K>> extends string | boolean ? {
3218
+ valueBooster: {
3219
+ column: K;
3220
+ } & ValueBooster<NonNullable<ValueAtColumn<O, K>>>;
3221
+ } : never;
3222
+ }>;
3223
+
3224
+ declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3225
+ fuzziness?: FuzzinessExpression;
3226
+ prefix?: PrefixExpression;
3227
+ highlight?: HighlightExpression;
3228
+ tables?: Array<Tables | Values<{
3229
+ [Model in GetArrayInnerType<NonNullable<Tables[]>>]: {
3230
+ table: Model;
3231
+ filter?: Filter<SelectedPick<Schemas[Model] & XataRecord, ['*']>>;
3232
+ boosters?: Boosters<Schemas[Model] & XataRecord>[];
3233
+ };
3234
+ }>>;
3235
+ };
3236
+ declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3237
+ all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3238
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]: {
3239
+ table: Model;
3240
+ record: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>>;
3241
+ };
3242
+ }>[]>;
3243
+ byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3244
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]?: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>[]>;
3245
+ }>;
3246
+ };
3247
+ declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
3248
+ #private;
3249
+ private db;
3250
+ constructor(db: SchemaPluginResult<Schemas>, schemaTables?: Schemas.Table[]);
3251
+ build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
3252
+ }
3253
+ declare type SearchXataRecord<Record extends XataRecord> = Omit<Record, 'getMetadata'> & {
3254
+ getMetadata: () => XataRecordMetadata & SearchExtraProperties;
3255
+ };
3256
+ declare type SearchExtraProperties = {
3257
+ table: string;
3258
+ highlight?: {
3259
+ [key: string]: string[] | {
3260
+ [key: string]: any;
3261
+ };
3262
+ };
3263
+ score?: number;
3264
+ };
3265
+ declare type ReturnTable<Table, Tables> = Table extends Tables ? Table : never;
3266
+ 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 {
3267
+ table: infer Table;
3268
+ } ? ReturnTable<Table, Tables> : never;
3269
+
3054
3270
  declare type SortDirection = 'asc' | 'desc';
3055
3271
  declare type SortFilterExtended<T extends XataRecord> = {
3056
3272
  column: SelectableColumn<T>;
@@ -3062,7 +3278,7 @@ declare type SortFilterBase<T extends XataRecord> = {
3062
3278
  };
3063
3279
 
3064
3280
  declare type BaseOptions<T extends XataRecord> = {
3065
- columns?: NonEmptyArray<SelectableColumn<T>>;
3281
+ columns?: SelectableColumn<T>[];
3066
3282
  cache?: number;
3067
3283
  };
3068
3284
  declare type CursorQueryOptions = {
@@ -3152,7 +3368,7 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3152
3368
  * @param columns Array of column names to be returned by the query.
3153
3369
  * @returns A new Query object.
3154
3370
  */
3155
- select<K extends SelectableColumn<Record>>(columns: NonEmptyArray<K>): Query<Record, SelectedPick<Record, NonEmptyArray<K>>>;
3371
+ select<K extends SelectableColumn<Record>>(columns: K[]): Query<Record, SelectedPick<Record, K[]>>;
3156
3372
  /**
3157
3373
  * Get paginated results
3158
3374
  *
@@ -3214,13 +3430,13 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3214
3430
  * @param options Additional options to be used when performing the query.
3215
3431
  * @returns An array of records from the database.
3216
3432
  */
3217
- getMany(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<RecordArray<Result>>;
3433
+ getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<RecordArray<SelectedPick<Record, typeof options['columns']>>>;
3218
3434
  /**
3219
3435
  * Performs the query in the database and returns a set of results.
3220
3436
  * @param options Additional options to be used when performing the query.
3221
3437
  * @returns An array of records from the database.
3222
3438
  */
3223
- getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<RecordArray<SelectedPick<Record, typeof options['columns']>>>;
3439
+ getMany(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<RecordArray<Result>>;
3224
3440
  /**
3225
3441
  * Performs the query in the database and returns all the results.
3226
3442
  * Warning: If there are a large number of results, this method can have performance implications.
@@ -3233,18 +3449,18 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3233
3449
  * @param options Additional options to be used when performing the query.
3234
3450
  * @returns An array of records from the database.
3235
3451
  */
3236
- getAll(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
3452
+ getAll<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
3237
3453
  batchSize?: number;
3238
- }): Promise<Result[]>;
3454
+ }>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
3239
3455
  /**
3240
3456
  * Performs the query in the database and returns all the results.
3241
3457
  * Warning: If there are a large number of results, this method can have performance implications.
3242
3458
  * @param options Additional options to be used when performing the query.
3243
3459
  * @returns An array of records from the database.
3244
3460
  */
3245
- getAll<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
3461
+ getAll(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
3246
3462
  batchSize?: number;
3247
- }>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
3463
+ }): Promise<Result[]>;
3248
3464
  /**
3249
3465
  * Performs the query in the database and returns the first result.
3250
3466
  * @returns The first record that matches the query, or null if no record matched the query.
@@ -3255,13 +3471,13 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3255
3471
  * @param options Additional options to be used when performing the query.
3256
3472
  * @returns The first record that matches the query, or null if no record matched the query.
3257
3473
  */
3258
- getFirst(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result | null>;
3474
+ getFirst<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
3259
3475
  /**
3260
3476
  * Performs the query in the database and returns the first result.
3261
3477
  * @param options Additional options to be used when performing the query.
3262
3478
  * @returns The first record that matches the query, or null if no record matched the query.
3263
3479
  */
3264
- getFirst<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
3480
+ getFirst(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result | null>;
3265
3481
  /**
3266
3482
  * Builds a new query object adding a cache TTL in milliseconds.
3267
3483
  * @param ttl The cache TTL in milliseconds.
@@ -3383,6 +3599,8 @@ declare class RecordArray<Result extends XataRecord> extends Array<Result> {
3383
3599
  #private;
3384
3600
  constructor(page: Paginable<any, Result>, overrideRecords?: Result[]);
3385
3601
  static parseConstructorParams(...args: any[]): any[];
3602
+ toArray(): Result[];
3603
+ map<U>(callbackfn: (value: Result, index: number, array: Result[]) => U, thisArg?: any): U[];
3386
3604
  /**
3387
3605
  * Retrieve next page of records
3388
3606
  *
@@ -3417,20 +3635,43 @@ declare class RecordArray<Result extends XataRecord> extends Array<Result> {
3417
3635
  * Common interface for performing operations on a table.
3418
3636
  */
3419
3637
  declare abstract class Repository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
3420
- abstract create(object: EditableData<Data> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3638
+ abstract create<K extends SelectableColumn<Record>>(object: Omit<EditableData<Data>, 'id'> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3639
+ abstract create(object: Omit<EditableData<Data>, 'id'> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3421
3640
  /**
3422
3641
  * Creates a single record in the table with a unique id.
3423
3642
  * @param id The unique id.
3424
3643
  * @param object Object containing the column names with their values to be stored in the table.
3644
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3425
3645
  * @returns The full persisted record.
3426
3646
  */
3427
- abstract create(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3647
+ abstract create<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Data>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3648
+ /**
3649
+ * Creates a single record in the table with a unique id.
3650
+ * @param id The unique id.
3651
+ * @param object Object containing the column names with their values to be stored in the table.
3652
+ * @returns The full persisted record.
3653
+ */
3654
+ abstract create(id: string, object: Omit<EditableData<Data>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3428
3655
  /**
3429
3656
  * Creates multiple records in the table.
3430
3657
  * @param objects Array of objects with the column names and the values to be stored in the table.
3431
- * @returns Array of the persisted records.
3658
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3659
+ * @returns Array of the persisted records in order.
3660
+ */
3661
+ abstract create<K extends SelectableColumn<Record>>(objects: Array<Omit<EditableData<Data>, 'id'> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3662
+ /**
3663
+ * Creates multiple records in the table.
3664
+ * @param objects Array of objects with the column names and the values to be stored in the table.
3665
+ * @returns Array of the persisted records in order.
3432
3666
  */
3433
- abstract create(objects: Array<EditableData<Data> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3667
+ abstract create(objects: Array<Omit<EditableData<Data>, 'id'> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3668
+ /**
3669
+ * Queries a single record from the table given its unique id.
3670
+ * @param id The unique id.
3671
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3672
+ * @returns The persisted record for the given id or null if the record could not be found.
3673
+ */
3674
+ abstract read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
3434
3675
  /**
3435
3676
  * Queries a single record from the table given its unique id.
3436
3677
  * @param id The unique id.
@@ -3440,9 +3681,23 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3440
3681
  /**
3441
3682
  * Queries multiple records from the table given their unique id.
3442
3683
  * @param ids The unique ids array.
3443
- * @returns The persisted records for the given ids (if a record could not be found it is not returned).
3684
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3685
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
3444
3686
  */
3445
- abstract read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3687
+ abstract read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3688
+ /**
3689
+ * Queries multiple records from the table given their unique id.
3690
+ * @param ids The unique ids array.
3691
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
3692
+ */
3693
+ abstract read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3694
+ /**
3695
+ * Queries a single record from the table by the id in the object.
3696
+ * @param object Object containing the id of the record.
3697
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3698
+ * @returns The persisted record for the given id or null if the record could not be found.
3699
+ */
3700
+ abstract read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
3446
3701
  /**
3447
3702
  * Queries a single record from the table by the id in the object.
3448
3703
  * @param object Object containing the id of the record.
@@ -3452,15 +3707,37 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3452
3707
  /**
3453
3708
  * Queries multiple records from the table by the ids in the objects.
3454
3709
  * @param objects Array of objects containing the ids of the records.
3455
- * @returns The persisted records for the given ids (if a record could not be found it is not returned).
3710
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3711
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
3712
+ */
3713
+ abstract read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3714
+ /**
3715
+ * Queries multiple records from the table by the ids in the objects.
3716
+ * @param objects Array of objects containing the ids of the records.
3717
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
3718
+ */
3719
+ abstract read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3720
+ /**
3721
+ * Partially update a single record.
3722
+ * @param object An object with its id and the columns to be updated.
3723
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3724
+ * @returns The full persisted record.
3456
3725
  */
3457
- abstract read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3726
+ abstract update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Data>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3458
3727
  /**
3459
3728
  * Partially update a single record.
3460
3729
  * @param object An object with its id and the columns to be updated.
3461
3730
  * @returns The full persisted record.
3462
3731
  */
3463
3732
  abstract update(object: Partial<EditableData<Data>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3733
+ /**
3734
+ * Partially update a single record given its unique id.
3735
+ * @param id The unique id.
3736
+ * @param object The column names and their values that have to be updated.
3737
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3738
+ * @returns The full persisted record.
3739
+ */
3740
+ abstract update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Data>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3464
3741
  /**
3465
3742
  * Partially update a single record given its unique id.
3466
3743
  * @param id The unique id.
@@ -3471,9 +3748,24 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3471
3748
  /**
3472
3749
  * Partially updates multiple records.
3473
3750
  * @param objects An array of objects with their ids and columns to be updated.
3474
- * @returns Array of the persisted records.
3751
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3752
+ * @returns Array of the persisted records in order.
3753
+ */
3754
+ abstract update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Data>> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3755
+ /**
3756
+ * Partially updates multiple records.
3757
+ * @param objects An array of objects with their ids and columns to be updated.
3758
+ * @returns Array of the persisted records in order.
3475
3759
  */
3476
3760
  abstract update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3761
+ /**
3762
+ * Creates or updates a single record. If a record exists with the given id,
3763
+ * it will be update, otherwise a new record will be created.
3764
+ * @param object Object containing the column names with their values to be persisted in the table.
3765
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3766
+ * @returns The full persisted record.
3767
+ */
3768
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Data> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3477
3769
  /**
3478
3770
  * Creates or updates a single record. If a record exists with the given id,
3479
3771
  * it will be update, otherwise a new record will be created.
@@ -3481,6 +3773,15 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3481
3773
  * @returns The full persisted record.
3482
3774
  */
3483
3775
  abstract createOrUpdate(object: EditableData<Data> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3776
+ /**
3777
+ * Creates or updates a single record. If a record exists with the given id,
3778
+ * it will be update, otherwise a new record will be created.
3779
+ * @param id A unique id.
3780
+ * @param object The column names and the values to be persisted.
3781
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3782
+ * @returns The full persisted record.
3783
+ */
3784
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Data>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3484
3785
  /**
3485
3786
  * Creates or updates a single record. If a record exists with the given id,
3486
3787
  * it will be update, otherwise a new record will be created.
@@ -3488,7 +3789,15 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3488
3789
  * @param object The column names and the values to be persisted.
3489
3790
  * @returns The full persisted record.
3490
3791
  */
3491
- abstract createOrUpdate(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3792
+ abstract createOrUpdate(id: string, object: Omit<EditableData<Data>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3793
+ /**
3794
+ * Creates or updates a single record. If a record exists with the given id,
3795
+ * it will be update, otherwise a new record will be created.
3796
+ * @param objects Array of objects with the column names and the values to be stored in the table.
3797
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3798
+ * @returns Array of the persisted records.
3799
+ */
3800
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Data> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3492
3801
  /**
3493
3802
  * Creates or updates a single record. If a record exists with the given id,
3494
3803
  * it will be update, otherwise a new record will be created.
@@ -3528,9 +3837,11 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3528
3837
  */
3529
3838
  abstract search(query: string, options?: {
3530
3839
  fuzziness?: FuzzinessExpression;
3840
+ prefix?: PrefixExpression;
3531
3841
  highlight?: HighlightExpression;
3532
3842
  filter?: Filter<Record>;
3533
- }): Promise<SelectedPick<Record, ['*']>[]>;
3843
+ boosters?: Boosters<Record>[];
3844
+ }): Promise<SearchXataRecord<SelectedPick<Record, ['*']>>[]>;
3534
3845
  abstract query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3535
3846
  }
3536
3847
  declare class RestRepository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Data, Record> {
@@ -3540,29 +3851,98 @@ declare class RestRepository<Data extends BaseData, Record extends XataRecord =
3540
3851
  table: string;
3541
3852
  db: SchemaPluginResult<any>;
3542
3853
  pluginOptions: XataPluginOptions;
3854
+ schemaTables?: Table[];
3543
3855
  });
3544
- create(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3545
- create(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3546
- create(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3547
- read(recordId: string): Promise<SelectedPick<Record, ['*']> | null>;
3856
+ create(object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3857
+ create(recordId: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3858
+ create(objects: EditableData<Data>[]): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3859
+ create<K extends SelectableColumn<Record>>(object: EditableData<Data>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3860
+ create<K extends SelectableColumn<Record>>(recordId: string, object: EditableData<Data>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3861
+ create<K extends SelectableColumn<Record>>(objects: EditableData<Data>[], columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3862
+ read(recordId: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3548
3863
  read(recordIds: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3549
- read(object: Identifiable): Promise<SelectedPick<Record, ['*']> | null>;
3864
+ read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3550
3865
  read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3866
+ read<K extends SelectableColumn<Record>>(recordId: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3867
+ read<K extends SelectableColumn<Record>>(recordIds: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
3868
+ read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3869
+ read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
3551
3870
  update(object: Partial<EditableData<Data>> & Identifiable): Promise<SelectedPick<Record, ['*']>>;
3552
3871
  update(recordId: string, object: Partial<EditableData<Data>>): Promise<SelectedPick<Record, ['*']>>;
3553
3872
  update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<SelectedPick<Record, ['*']>[]>;
3873
+ update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Data>> & Identifiable, columns: K[]): Promise<SelectedPick<Record, typeof columns>>;
3874
+ update<K extends SelectableColumn<Record>>(recordId: string, object: Partial<EditableData<Data>>, columns: K[]): Promise<SelectedPick<Record, typeof columns>>;
3875
+ update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Data>> & Identifiable>, columns: K[]): Promise<SelectedPick<Record, typeof columns>[]>;
3554
3876
  createOrUpdate(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3555
3877
  createOrUpdate(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3556
3878
  createOrUpdate(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3879
+ createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Data>, columns: K[]): Promise<SelectedPick<Record, typeof columns>>;
3880
+ createOrUpdate<K extends SelectableColumn<Record>>(recordId: string, object: EditableData<Data>, columns: K[]): Promise<SelectedPick<Record, typeof columns>>;
3881
+ createOrUpdate<K extends SelectableColumn<Record>>(objects: EditableData<Data>[], columns: K[]): Promise<SelectedPick<Record, typeof columns>[]>;
3557
3882
  delete(a: string | Identifiable | Array<string | Identifiable>): Promise<void>;
3558
3883
  search(query: string, options?: {
3559
3884
  fuzziness?: FuzzinessExpression;
3885
+ prefix?: PrefixExpression;
3560
3886
  highlight?: HighlightExpression;
3561
3887
  filter?: Filter<Record>;
3562
- }): Promise<SelectedPick<Record, ['*']>[]>;
3888
+ boosters?: Boosters<Record>[];
3889
+ }): Promise<any>;
3563
3890
  query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3564
3891
  }
3565
3892
 
3893
+ declare type BaseSchema = {
3894
+ name: string;
3895
+ columns: readonly ({
3896
+ name: string;
3897
+ type: Column['type'];
3898
+ } | {
3899
+ name: string;
3900
+ type: 'link';
3901
+ link: {
3902
+ table: string;
3903
+ };
3904
+ } | {
3905
+ name: string;
3906
+ type: 'object';
3907
+ columns: {
3908
+ name: string;
3909
+ type: string;
3910
+ }[];
3911
+ })[];
3912
+ };
3913
+ declare type SchemaInference<T extends readonly BaseSchema[]> = T extends never[] ? Record<string, Record<string, any>> : T extends readonly unknown[] ? T[number] extends {
3914
+ name: string;
3915
+ columns: readonly unknown[];
3916
+ } ? {
3917
+ [K in T[number]['name']]: TableType<T[number], K>;
3918
+ } : never : never;
3919
+ declare type TableType<Tables, TableName> = Tables & {
3920
+ name: TableName;
3921
+ } extends infer Table ? Table extends {
3922
+ name: string;
3923
+ columns: infer Columns;
3924
+ } ? Columns extends readonly unknown[] ? Columns[number] extends {
3925
+ name: string;
3926
+ type: string;
3927
+ } ? Identifiable & {
3928
+ [K in Columns[number]['name']]?: PropertyType<Tables, Columns[number], K>;
3929
+ } : never : never : never : never;
3930
+ declare type PropertyType<Tables, Properties, PropertyName> = Properties & {
3931
+ name: PropertyName;
3932
+ } extends infer Property ? Property extends {
3933
+ name: string;
3934
+ type: infer Type;
3935
+ link?: {
3936
+ table: infer LinkedTable;
3937
+ };
3938
+ columns?: infer ObjectColumns;
3939
+ } ? (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 {
3940
+ name: string;
3941
+ type: string;
3942
+ } ? {
3943
+ [K in ObjectColumns[number]['name']]?: PropertyType<Tables, ObjectColumns[number], K>;
3944
+ } : never : never : Type extends 'link' ? TableType<Tables, LinkedTable> & XataRecord : never) | null : never : never;
3945
+
3566
3946
  /**
3567
3947
  * Operator to restrict results to only values that are greater than the given value.
3568
3948
  */
@@ -3646,52 +4026,10 @@ declare type SchemaPluginResult<Schemas extends Record<string, BaseData>> = {
3646
4026
  };
3647
4027
  declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
3648
4028
  #private;
3649
- private tableNames?;
3650
- constructor(tableNames?: string[] | undefined);
4029
+ constructor(schemaTables?: Schemas.Table[]);
3651
4030
  build(pluginOptions: XataPluginOptions): SchemaPluginResult<Schemas>;
3652
4031
  }
3653
4032
 
3654
- declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3655
- fuzziness?: FuzzinessExpression;
3656
- highlight?: HighlightExpression;
3657
- tables?: Array<Tables | Values<{
3658
- [Model in GetArrayInnerType<NonNullable<Tables[]>>]: {
3659
- table: Model;
3660
- filter?: Filter<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>>;
3661
- };
3662
- }>>;
3663
- };
3664
- declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3665
- all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3666
- [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]: {
3667
- table: Model;
3668
- record: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>>;
3669
- };
3670
- }>[]>;
3671
- byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3672
- [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]?: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>[]>;
3673
- }>;
3674
- };
3675
- declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
3676
- #private;
3677
- private db;
3678
- constructor(db: SchemaPluginResult<Schemas>);
3679
- build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
3680
- }
3681
- declare type SearchXataRecord = XataRecord<SearchExtraProperties>;
3682
- declare type SearchExtraProperties = {
3683
- table: string;
3684
- highlight?: {
3685
- [key: string]: string[] | {
3686
- [key: string]: any;
3687
- };
3688
- };
3689
- };
3690
- declare type ReturnTable<Table, Tables> = Table extends Tables ? Table : never;
3691
- 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 {
3692
- table: infer Table;
3693
- } ? ReturnTable<Table, Tables> : never;
3694
-
3695
4033
  declare type BranchStrategyValue = string | undefined | null;
3696
4034
  declare type BranchStrategyBuilder = () => BranchStrategyValue | Promise<BranchStrategyValue>;
3697
4035
  declare type BranchStrategy = BranchStrategyValue | BranchStrategyBuilder;
@@ -3706,15 +4044,15 @@ declare type BaseClientOptions = {
3706
4044
  };
3707
4045
  declare const buildClient: <Plugins extends Record<string, XataPlugin> = {}>(plugins?: Plugins | undefined) => ClientConstructor<Plugins>;
3708
4046
  interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
3709
- new <Schemas extends Record<string, BaseData> = {}>(options?: Partial<BaseClientOptions>, tables?: string[]): Omit<{
3710
- db: Awaited<ReturnType<SchemaPlugin<Schemas>['build']>>;
3711
- search: Awaited<ReturnType<SearchPlugin<Schemas>['build']>>;
4047
+ new <T extends readonly BaseSchema[]>(options?: Partial<BaseClientOptions>, schemaTables?: T): Omit<{
4048
+ db: Awaited<ReturnType<SchemaPlugin<SchemaInference<NonNullable<typeof schemaTables>>>['build']>>;
4049
+ search: Awaited<ReturnType<SearchPlugin<SchemaInference<NonNullable<typeof schemaTables>>>['build']>>;
3712
4050
  }, keyof Plugins> & {
3713
4051
  [Key in StringKeys<NonNullable<Plugins>>]: Awaited<ReturnType<NonNullable<Plugins>[Key]['build']>>;
3714
4052
  };
3715
4053
  }
3716
4054
  declare const BaseClient_base: ClientConstructor<{}>;
3717
- declare class BaseClient extends BaseClient_base<Record<string, any>> {
4055
+ declare class BaseClient extends BaseClient_base<[]> {
3718
4056
  }
3719
4057
 
3720
4058
  declare type BranchResolutionOptions = {
@@ -3733,4 +4071,4 @@ declare class XataError extends Error {
3733
4071
  constructor(message: string, status: number);
3734
4072
  }
3735
4073
 
3736
- export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, AddGitBranchesEntryError, AddGitBranchesEntryPathParams, AddGitBranchesEntryRequestBody, AddGitBranchesEntryResponse, AddGitBranchesEntryVariables, AddTableColumnError, AddTableColumnPathParams, AddTableColumnVariables, BaseClient, BaseClientOptions, BaseData, BulkInsertTableRecordsError, BulkInsertTableRecordsPathParams, BulkInsertTableRecordsRequestBody, BulkInsertTableRecordsResponse, BulkInsertTableRecordsVariables, CacheImpl, CancelWorkspaceMemberInviteError, CancelWorkspaceMemberInvitePathParams, CancelWorkspaceMemberInviteVariables, ClientConstructor, CreateBranchError, CreateBranchPathParams, CreateBranchQueryParams, CreateBranchRequestBody, CreateBranchVariables, CreateDatabaseError, CreateDatabasePathParams, CreateDatabaseRequestBody, CreateDatabaseResponse, CreateDatabaseVariables, CreateTableError, CreateTablePathParams, CreateTableVariables, CreateUserAPIKeyError, CreateUserAPIKeyPathParams, CreateUserAPIKeyResponse, CreateUserAPIKeyVariables, CreateWorkspaceError, CreateWorkspaceVariables, CursorNavigationOptions, DeleteBranchError, DeleteBranchPathParams, DeleteBranchVariables, DeleteColumnError, DeleteColumnPathParams, DeleteColumnVariables, DeleteDatabaseError, DeleteDatabasePathParams, DeleteDatabaseVariables, DeleteRecordError, DeleteRecordPathParams, DeleteRecordVariables, DeleteTableError, DeleteTablePathParams, DeleteTableVariables, DeleteUserAPIKeyError, DeleteUserAPIKeyPathParams, DeleteUserAPIKeyVariables, DeleteUserError, DeleteUserVariables, DeleteWorkspaceError, DeleteWorkspacePathParams, DeleteWorkspaceVariables, EditableData, ExecuteBranchMigrationPlanError, ExecuteBranchMigrationPlanPathParams, ExecuteBranchMigrationPlanRequestBody, ExecuteBranchMigrationPlanVariables, FetchImpl, FetcherExtraProps, GetBranchDetailsError, GetBranchDetailsPathParams, GetBranchDetailsVariables, GetBranchListError, GetBranchListPathParams, GetBranchListVariables, GetBranchMetadataError, GetBranchMetadataPathParams, GetBranchMetadataVariables, GetBranchMigrationHistoryError, GetBranchMigrationHistoryPathParams, GetBranchMigrationHistoryRequestBody, GetBranchMigrationHistoryResponse, GetBranchMigrationHistoryVariables, GetBranchMigrationPlanError, GetBranchMigrationPlanPathParams, GetBranchMigrationPlanVariables, GetBranchStatsError, GetBranchStatsPathParams, GetBranchStatsResponse, GetBranchStatsVariables, GetColumnError, GetColumnPathParams, GetColumnVariables, GetDatabaseListError, GetDatabaseListPathParams, GetDatabaseListVariables, GetGitBranchesMappingError, GetGitBranchesMappingPathParams, GetGitBranchesMappingVariables, GetRecordError, GetRecordPathParams, GetRecordRequestBody, GetRecordVariables, GetTableColumnsError, GetTableColumnsPathParams, GetTableColumnsResponse, GetTableColumnsVariables, GetTableSchemaError, GetTableSchemaPathParams, GetTableSchemaResponse, GetTableSchemaVariables, GetUserAPIKeysError, GetUserAPIKeysResponse, GetUserAPIKeysVariables, GetUserError, GetUserVariables, GetWorkspaceError, GetWorkspaceMembersListError, GetWorkspaceMembersListPathParams, GetWorkspaceMembersListVariables, GetWorkspacePathParams, GetWorkspaceVariables, GetWorkspacesListError, GetWorkspacesListResponse, GetWorkspacesListVariables, Identifiable, InsertRecordError, InsertRecordPathParams, InsertRecordResponse, InsertRecordVariables, InsertRecordWithIDError, InsertRecordWithIDPathParams, InsertRecordWithIDQueryParams, InsertRecordWithIDVariables, InviteWorkspaceMemberError, InviteWorkspaceMemberPathParams, InviteWorkspaceMemberRequestBody, InviteWorkspaceMemberVariables, OffsetNavigationOptions, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Paginable, PaginationQueryMeta, 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, SchemaPlugin, SchemaPluginResult, schemas as Schemas, SearchBranchError, SearchBranchPathParams, SearchBranchRequestBody, SearchBranchVariables, SearchOptions, SearchPlugin, SearchPluginResult, SearchTableError, SearchTablePathParams, SearchTableRequestBody, SearchTableVariables, 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, isCursorPaginationOptions, isIdentifiable, isNot, isXataRecord, le, lt, lte, notExists, operationsByTag, pattern, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberRole, upsertRecordWithID };
4074
+ export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, AddGitBranchesEntryError, AddGitBranchesEntryPathParams, AddGitBranchesEntryRequestBody, AddGitBranchesEntryResponse, AddGitBranchesEntryVariables, AddTableColumnError, AddTableColumnPathParams, AddTableColumnVariables, BaseClient, BaseClientOptions, BaseData, BaseSchema, BulkInsertTableRecordsError, BulkInsertTableRecordsPathParams, BulkInsertTableRecordsQueryParams, BulkInsertTableRecordsRequestBody, BulkInsertTableRecordsVariables, CacheImpl, CancelWorkspaceMemberInviteError, CancelWorkspaceMemberInvitePathParams, CancelWorkspaceMemberInviteVariables, ClientConstructor, CreateBranchError, CreateBranchPathParams, CreateBranchQueryParams, CreateBranchRequestBody, CreateBranchResponse, CreateBranchVariables, CreateDatabaseError, CreateDatabasePathParams, CreateDatabaseRequestBody, CreateDatabaseResponse, CreateDatabaseVariables, 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, GetBranchStatsError, GetBranchStatsPathParams, GetBranchStatsResponse, GetBranchStatsVariables, GetColumnError, GetColumnPathParams, GetColumnVariables, GetDatabaseListError, GetDatabaseListPathParams, GetDatabaseListVariables, GetGitBranchesMappingError, GetGitBranchesMappingPathParams, GetGitBranchesMappingVariables, 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, OffsetNavigationOptions, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Paginable, PaginationQueryMeta, 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, SetTableSchemaError, SetTableSchemaPathParams, SetTableSchemaRequestBody, SetTableSchemaVariables, SimpleCache, SimpleCacheOptions, UpdateBranchMetadataError, UpdateBranchMetadataPathParams, UpdateBranchMetadataVariables, UpdateColumnError, UpdateColumnPathParams, UpdateColumnRequestBody, UpdateColumnVariables, 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, 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, isCursorPaginationOptions, isIdentifiable, isNot, isXataRecord, le, lt, lte, notExists, operationsByTag, pattern, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };