@xata.io/client 0.15.0 → 0.16.2

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,9 @@
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
+ onError: (message: string) => void;
5
+ }) => T, options?: AttributeDictionary) => Promise<T>;
6
+
1
7
  declare type FetchImpl = (url: string, init?: {
2
8
  body?: string;
3
9
  headers?: Record<string, string>;
@@ -5,6 +11,7 @@ declare type FetchImpl = (url: string, init?: {
5
11
  }) => Promise<{
6
12
  ok: boolean;
7
13
  status: number;
14
+ url: string;
8
15
  json(): Promise<any>;
9
16
  headers?: {
10
17
  get(name: string): string | null;
@@ -16,6 +23,7 @@ declare type FetcherExtraProps = {
16
23
  workspacesApiUrl: string | WorkspaceApiUrlBuilder;
17
24
  fetchImpl: FetchImpl;
18
25
  apiKey: string;
26
+ trace: TraceFunction;
19
27
  };
20
28
  declare type ErrorWrapper<TError> = TError | {
21
29
  status: 'unknown';
@@ -23,7 +31,6 @@ declare type ErrorWrapper<TError> = TError | {
23
31
  };
24
32
 
25
33
  interface CacheImpl {
26
- cacheRecords: boolean;
27
34
  defaultQueryTTL: number;
28
35
  getAll(): Promise<Record<string, unknown>>;
29
36
  get: <T>(key: string) => Promise<T | null>;
@@ -33,13 +40,11 @@ interface CacheImpl {
33
40
  }
34
41
  interface SimpleCacheOptions {
35
42
  max?: number;
36
- cacheRecords?: boolean;
37
43
  defaultQueryTTL?: number;
38
44
  }
39
45
  declare class SimpleCache implements CacheImpl {
40
46
  #private;
41
47
  capacity: number;
42
- cacheRecords: boolean;
43
48
  defaultQueryTTL: number;
44
49
  constructor(options?: SimpleCacheOptions);
45
50
  getAll(): Promise<Record<string, unknown>>;
@@ -55,6 +60,7 @@ declare abstract class XataPlugin {
55
60
  declare type XataPluginOptions = {
56
61
  getFetchProps: () => Promise<FetcherExtraProps>;
57
62
  cache: CacheImpl;
63
+ trace?: TraceFunction;
58
64
  };
59
65
 
60
66
  /**
@@ -125,16 +131,20 @@ declare type WorkspaceMembers = {
125
131
  * @pattern ^ik_[a-zA-Z0-9]+
126
132
  */
127
133
  declare type InviteKey = string;
134
+ /**
135
+ * Metadata of databases
136
+ */
137
+ declare type DatabaseMetadata = {
138
+ name: string;
139
+ displayName: string;
140
+ createdAt: DateTime;
141
+ numberOfBranches: number;
142
+ ui?: {
143
+ color?: string;
144
+ };
145
+ };
128
146
  declare type ListDatabasesResponse = {
129
- databases?: {
130
- name: string;
131
- displayName: string;
132
- createdAt: DateTime;
133
- numberOfBranches: number;
134
- ui?: {
135
- color?: string;
136
- };
137
- }[];
147
+ databases?: DatabaseMetadata[];
138
148
  };
139
149
  declare type ListBranchesResponse = {
140
150
  databaseName: string;
@@ -303,6 +313,44 @@ declare type HighlightExpression = {
303
313
  enabled?: boolean;
304
314
  encodeHTML?: boolean;
305
315
  };
316
+ /**
317
+ * Booster Expression
318
+ *
319
+ * @x-go-type xata.BoosterExpression
320
+ */
321
+ declare type BoosterExpression = {
322
+ valueBooster?: ValueBooster$1;
323
+ } | {
324
+ numericBooster?: NumericBooster$1;
325
+ } | {
326
+ dateBooster?: DateBooster$1;
327
+ };
328
+ /**
329
+ * Boost records with a particular value for a column.
330
+ */
331
+ declare type ValueBooster$1 = {
332
+ column: string;
333
+ value: string | number | boolean;
334
+ factor: number;
335
+ };
336
+ /**
337
+ * Boost records based on the value of a numeric column.
338
+ */
339
+ declare type NumericBooster$1 = {
340
+ column: string;
341
+ factor: number;
342
+ };
343
+ /**
344
+ * Boost records based on the value of a datetime column. It is configured via "origin", "scale", and "decay". The further away from the "origin",
345
+ * 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
346
+ * 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.
347
+ */
348
+ declare type DateBooster$1 = {
349
+ column: string;
350
+ origin?: string;
351
+ scale: string;
352
+ decay: number;
353
+ };
306
354
  declare type FilterList = FilterExpression | FilterExpression[];
307
355
  declare type FilterColumn = FilterColumnIncludes | FilterPredicate | FilterList;
308
356
  /**
@@ -359,7 +407,24 @@ declare type PageConfig = {
359
407
  size?: number;
360
408
  offset?: number;
361
409
  };
362
- declare type ColumnsFilter = string[];
410
+ declare type ColumnsProjection = string[];
411
+ /**
412
+ * Xata Table Record Metadata
413
+ */
414
+ declare type RecordMeta = {
415
+ id: RecordID;
416
+ xata: {
417
+ version: number;
418
+ table?: string;
419
+ highlight?: {
420
+ [key: string]: string[] | {
421
+ [key: string]: any;
422
+ };
423
+ };
424
+ score?: number;
425
+ warnings?: string[];
426
+ };
427
+ };
363
428
  /**
364
429
  * @pattern [a-zA-Z0-9_-~:]+
365
430
  */
@@ -381,21 +446,9 @@ declare type RecordsMetadata = {
381
446
  };
382
447
  };
383
448
  /**
384
- * Xata Table Record
449
+ * Xata Table Record Metadata
385
450
  */
386
- declare type XataRecord$1 = {
387
- id: RecordID;
388
- xata: {
389
- version: number;
390
- table?: string;
391
- highlight?: {
392
- [key: string]: string[] | {
393
- [key: string]: any;
394
- };
395
- };
396
- warnings?: string[];
397
- };
398
- } & {
451
+ declare type XataRecord$1 = RecordMeta & {
399
452
  [key: string]: any;
400
453
  };
401
454
 
@@ -413,6 +466,7 @@ type schemas_InviteID = InviteID;
413
466
  type schemas_WorkspaceInvite = WorkspaceInvite;
414
467
  type schemas_WorkspaceMembers = WorkspaceMembers;
415
468
  type schemas_InviteKey = InviteKey;
469
+ type schemas_DatabaseMetadata = DatabaseMetadata;
416
470
  type schemas_ListDatabasesResponse = ListDatabasesResponse;
417
471
  type schemas_ListBranchesResponse = ListBranchesResponse;
418
472
  type schemas_ListGitBranchesResponse = ListGitBranchesResponse;
@@ -440,6 +494,7 @@ type schemas_FuzzinessExpression = FuzzinessExpression;
440
494
  type schemas_PrefixExpression = PrefixExpression;
441
495
  type schemas_FilterExpression = FilterExpression;
442
496
  type schemas_HighlightExpression = HighlightExpression;
497
+ type schemas_BoosterExpression = BoosterExpression;
443
498
  type schemas_FilterList = FilterList;
444
499
  type schemas_FilterColumn = FilterColumn;
445
500
  type schemas_FilterColumnIncludes = FilterColumnIncludes;
@@ -449,7 +504,8 @@ type schemas_FilterPredicateRangeOp = FilterPredicateRangeOp;
449
504
  type schemas_FilterRangeValue = FilterRangeValue;
450
505
  type schemas_FilterValue = FilterValue;
451
506
  type schemas_PageConfig = PageConfig;
452
- type schemas_ColumnsFilter = ColumnsFilter;
507
+ type schemas_ColumnsProjection = ColumnsProjection;
508
+ type schemas_RecordMeta = RecordMeta;
453
509
  type schemas_RecordID = RecordID;
454
510
  type schemas_TableRename = TableRename;
455
511
  type schemas_RecordsMetadata = RecordsMetadata;
@@ -469,6 +525,7 @@ declare namespace schemas {
469
525
  schemas_WorkspaceInvite as WorkspaceInvite,
470
526
  schemas_WorkspaceMembers as WorkspaceMembers,
471
527
  schemas_InviteKey as InviteKey,
528
+ schemas_DatabaseMetadata as DatabaseMetadata,
472
529
  schemas_ListDatabasesResponse as ListDatabasesResponse,
473
530
  schemas_ListBranchesResponse as ListBranchesResponse,
474
531
  schemas_ListGitBranchesResponse as ListGitBranchesResponse,
@@ -496,6 +553,10 @@ declare namespace schemas {
496
553
  schemas_PrefixExpression as PrefixExpression,
497
554
  schemas_FilterExpression as FilterExpression,
498
555
  schemas_HighlightExpression as HighlightExpression,
556
+ schemas_BoosterExpression as BoosterExpression,
557
+ ValueBooster$1 as ValueBooster,
558
+ NumericBooster$1 as NumericBooster,
559
+ DateBooster$1 as DateBooster,
499
560
  schemas_FilterList as FilterList,
500
561
  schemas_FilterColumn as FilterColumn,
501
562
  schemas_FilterColumnIncludes as FilterColumnIncludes,
@@ -505,7 +566,8 @@ declare namespace schemas {
505
566
  schemas_FilterRangeValue as FilterRangeValue,
506
567
  schemas_FilterValue as FilterValue,
507
568
  schemas_PageConfig as PageConfig,
508
- schemas_ColumnsFilter as ColumnsFilter,
569
+ schemas_ColumnsProjection as ColumnsProjection,
570
+ schemas_RecordMeta as RecordMeta,
509
571
  schemas_RecordID as RecordID,
510
572
  schemas_TableRename as TableRename,
511
573
  schemas_RecordsMetadata as RecordsMetadata,
@@ -540,11 +602,17 @@ declare type BulkError = {
540
602
  status?: number;
541
603
  }[];
542
604
  };
605
+ declare type BulkInsertResponse = {
606
+ recordIDs: string[];
607
+ } | {
608
+ records: XataRecord$1[];
609
+ };
543
610
  declare type BranchMigrationPlan = {
544
611
  version: number;
545
612
  migration: BranchMigration;
546
613
  };
547
- declare type RecordUpdateResponse = {
614
+ declare type RecordResponse = XataRecord$1;
615
+ declare type RecordUpdateResponse = XataRecord$1 | {
548
616
  id: string;
549
617
  xata: {
550
618
  version: number;
@@ -568,7 +636,9 @@ type responses_SimpleError = SimpleError;
568
636
  type responses_BadRequestError = BadRequestError;
569
637
  type responses_AuthError = AuthError;
570
638
  type responses_BulkError = BulkError;
639
+ type responses_BulkInsertResponse = BulkInsertResponse;
571
640
  type responses_BranchMigrationPlan = BranchMigrationPlan;
641
+ type responses_RecordResponse = RecordResponse;
572
642
  type responses_RecordUpdateResponse = RecordUpdateResponse;
573
643
  type responses_QueryResponse = QueryResponse;
574
644
  type responses_SearchResponse = SearchResponse;
@@ -579,7 +649,9 @@ declare namespace responses {
579
649
  responses_BadRequestError as BadRequestError,
580
650
  responses_AuthError as AuthError,
581
651
  responses_BulkError as BulkError,
652
+ responses_BulkInsertResponse as BulkInsertResponse,
582
653
  responses_BranchMigrationPlan as BranchMigrationPlan,
654
+ responses_RecordResponse as RecordResponse,
583
655
  responses_RecordUpdateResponse as RecordUpdateResponse,
584
656
  responses_QueryResponse as QueryResponse,
585
657
  responses_SearchResponse as SearchResponse,
@@ -926,8 +998,7 @@ declare type UpdateWorkspaceMemberInviteVariables = {
926
998
  pathParams: UpdateWorkspaceMemberInvitePathParams;
927
999
  } & FetcherExtraProps;
928
1000
  /**
929
- * This operation provides a way to update an existing invite. Updates are performed in-place; they do not
930
- * change the invite link, the expiry time, nor do they re-notify the recipient of the invite.
1001
+ * 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.
931
1002
  */
932
1003
  declare const updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
933
1004
  declare type CancelWorkspaceMemberInvitePathParams = {
@@ -1083,6 +1154,27 @@ declare type DeleteDatabaseVariables = {
1083
1154
  * Delete a database and all of its branches and tables permanently.
1084
1155
  */
1085
1156
  declare const deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
1157
+ declare type GetDatabaseMetadataPathParams = {
1158
+ dbName: DBName;
1159
+ workspace: string;
1160
+ };
1161
+ declare type GetDatabaseMetadataError = ErrorWrapper<{
1162
+ status: 400;
1163
+ payload: BadRequestError;
1164
+ } | {
1165
+ status: 401;
1166
+ payload: AuthError;
1167
+ } | {
1168
+ status: 404;
1169
+ payload: SimpleError;
1170
+ }>;
1171
+ declare type GetDatabaseMetadataVariables = {
1172
+ pathParams: GetDatabaseMetadataPathParams;
1173
+ } & FetcherExtraProps;
1174
+ /**
1175
+ * Retrieve metadata of the given database
1176
+ */
1177
+ declare const getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
1086
1178
  declare type GetGitBranchesMappingPathParams = {
1087
1179
  dbName: DBName;
1088
1180
  workspace: string;
@@ -1275,6 +1367,10 @@ declare type CreateBranchError = ErrorWrapper<{
1275
1367
  status: 404;
1276
1368
  payload: SimpleError;
1277
1369
  }>;
1370
+ declare type CreateBranchResponse = {
1371
+ databaseName: string;
1372
+ branchName: string;
1373
+ };
1278
1374
  declare type CreateBranchRequestBody = {
1279
1375
  from?: string;
1280
1376
  metadata?: BranchMetadata;
@@ -1284,7 +1380,7 @@ declare type CreateBranchVariables = {
1284
1380
  pathParams: CreateBranchPathParams;
1285
1381
  queryParams?: CreateBranchQueryParams;
1286
1382
  } & FetcherExtraProps;
1287
- declare const createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
1383
+ declare const createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
1288
1384
  declare type DeleteBranchPathParams = {
1289
1385
  dbBranchName: DBBranchName;
1290
1386
  workspace: string;
@@ -1471,13 +1567,17 @@ declare type CreateTableError = ErrorWrapper<{
1471
1567
  status: 422;
1472
1568
  payload: SimpleError;
1473
1569
  }>;
1570
+ declare type CreateTableResponse = {
1571
+ branchName: string;
1572
+ tableName: string;
1573
+ };
1474
1574
  declare type CreateTableVariables = {
1475
1575
  pathParams: CreateTablePathParams;
1476
1576
  } & FetcherExtraProps;
1477
1577
  /**
1478
1578
  * Creates a new table with the given name. Returns 422 if a table with the same name already exists.
1479
1579
  */
1480
- declare const createTable: (variables: CreateTableVariables) => Promise<undefined>;
1580
+ declare const createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
1481
1581
  declare type DeleteTablePathParams = {
1482
1582
  dbBranchName: DBBranchName;
1483
1583
  tableName: TableName;
@@ -1710,6 +1810,9 @@ declare type InsertRecordPathParams = {
1710
1810
  tableName: TableName;
1711
1811
  workspace: string;
1712
1812
  };
1813
+ declare type InsertRecordQueryParams = {
1814
+ columns?: ColumnsProjection;
1815
+ };
1713
1816
  declare type InsertRecordError = ErrorWrapper<{
1714
1817
  status: 400;
1715
1818
  payload: BadRequestError;
@@ -1720,20 +1823,15 @@ declare type InsertRecordError = ErrorWrapper<{
1720
1823
  status: 404;
1721
1824
  payload: SimpleError;
1722
1825
  }>;
1723
- declare type InsertRecordResponse = {
1724
- id: string;
1725
- xata: {
1726
- version: number;
1727
- };
1728
- };
1729
1826
  declare type InsertRecordVariables = {
1730
1827
  body?: Record<string, any>;
1731
1828
  pathParams: InsertRecordPathParams;
1829
+ queryParams?: InsertRecordQueryParams;
1732
1830
  } & FetcherExtraProps;
1733
1831
  /**
1734
1832
  * Insert a new Record into the Table
1735
1833
  */
1736
- declare const insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
1834
+ declare const insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
1737
1835
  declare type InsertRecordWithIDPathParams = {
1738
1836
  dbBranchName: DBBranchName;
1739
1837
  tableName: TableName;
@@ -1741,6 +1839,7 @@ declare type InsertRecordWithIDPathParams = {
1741
1839
  workspace: string;
1742
1840
  };
1743
1841
  declare type InsertRecordWithIDQueryParams = {
1842
+ columns?: ColumnsProjection;
1744
1843
  createOnly?: boolean;
1745
1844
  ifVersion?: number;
1746
1845
  };
@@ -1773,6 +1872,7 @@ declare type UpdateRecordWithIDPathParams = {
1773
1872
  workspace: string;
1774
1873
  };
1775
1874
  declare type UpdateRecordWithIDQueryParams = {
1875
+ columns?: ColumnsProjection;
1776
1876
  ifVersion?: number;
1777
1877
  };
1778
1878
  declare type UpdateRecordWithIDError = ErrorWrapper<{
@@ -1801,6 +1901,7 @@ declare type UpsertRecordWithIDPathParams = {
1801
1901
  workspace: string;
1802
1902
  };
1803
1903
  declare type UpsertRecordWithIDQueryParams = {
1904
+ columns?: ColumnsProjection;
1804
1905
  ifVersion?: number;
1805
1906
  };
1806
1907
  declare type UpsertRecordWithIDError = ErrorWrapper<{
@@ -1828,6 +1929,9 @@ declare type DeleteRecordPathParams = {
1828
1929
  recordId: RecordID;
1829
1930
  workspace: string;
1830
1931
  };
1932
+ declare type DeleteRecordQueryParams = {
1933
+ columns?: ColumnsProjection;
1934
+ };
1831
1935
  declare type DeleteRecordError = ErrorWrapper<{
1832
1936
  status: 400;
1833
1937
  payload: BadRequestError;
@@ -1840,14 +1944,18 @@ declare type DeleteRecordError = ErrorWrapper<{
1840
1944
  }>;
1841
1945
  declare type DeleteRecordVariables = {
1842
1946
  pathParams: DeleteRecordPathParams;
1947
+ queryParams?: DeleteRecordQueryParams;
1843
1948
  } & FetcherExtraProps;
1844
- declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
1949
+ declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
1845
1950
  declare type GetRecordPathParams = {
1846
1951
  dbBranchName: DBBranchName;
1847
1952
  tableName: TableName;
1848
1953
  recordId: RecordID;
1849
1954
  workspace: string;
1850
1955
  };
1956
+ declare type GetRecordQueryParams = {
1957
+ columns?: ColumnsProjection;
1958
+ };
1851
1959
  declare type GetRecordError = ErrorWrapper<{
1852
1960
  status: 400;
1853
1961
  payload: BadRequestError;
@@ -1858,12 +1966,9 @@ declare type GetRecordError = ErrorWrapper<{
1858
1966
  status: 404;
1859
1967
  payload: SimpleError;
1860
1968
  }>;
1861
- declare type GetRecordRequestBody = {
1862
- columns?: ColumnsFilter;
1863
- };
1864
1969
  declare type GetRecordVariables = {
1865
- body?: GetRecordRequestBody;
1866
1970
  pathParams: GetRecordPathParams;
1971
+ queryParams?: GetRecordQueryParams;
1867
1972
  } & FetcherExtraProps;
1868
1973
  /**
1869
1974
  * Retrieve record by ID
@@ -1874,6 +1979,9 @@ declare type BulkInsertTableRecordsPathParams = {
1874
1979
  tableName: TableName;
1875
1980
  workspace: string;
1876
1981
  };
1982
+ declare type BulkInsertTableRecordsQueryParams = {
1983
+ columns?: ColumnsProjection;
1984
+ };
1877
1985
  declare type BulkInsertTableRecordsError = ErrorWrapper<{
1878
1986
  status: 400;
1879
1987
  payload: BulkError;
@@ -1887,20 +1995,18 @@ declare type BulkInsertTableRecordsError = ErrorWrapper<{
1887
1995
  status: 422;
1888
1996
  payload: SimpleError;
1889
1997
  }>;
1890
- declare type BulkInsertTableRecordsResponse = {
1891
- recordIDs: string[];
1892
- };
1893
1998
  declare type BulkInsertTableRecordsRequestBody = {
1894
1999
  records: Record<string, any>[];
1895
2000
  };
1896
2001
  declare type BulkInsertTableRecordsVariables = {
1897
2002
  body: BulkInsertTableRecordsRequestBody;
1898
2003
  pathParams: BulkInsertTableRecordsPathParams;
2004
+ queryParams?: BulkInsertTableRecordsQueryParams;
1899
2005
  } & FetcherExtraProps;
1900
2006
  /**
1901
2007
  * Bulk insert records
1902
2008
  */
1903
- declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
2009
+ declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
1904
2010
  declare type QueryTablePathParams = {
1905
2011
  dbBranchName: DBBranchName;
1906
2012
  tableName: TableName;
@@ -1920,7 +2026,7 @@ declare type QueryTableRequestBody = {
1920
2026
  filter?: FilterExpression;
1921
2027
  sort?: SortExpression;
1922
2028
  page?: PageConfig;
1923
- columns?: ColumnsFilter;
2029
+ columns?: ColumnsProjection;
1924
2030
  };
1925
2031
  declare type QueryTableVariables = {
1926
2032
  body?: QueryTableRequestBody;
@@ -2669,6 +2775,7 @@ declare type SearchTableRequestBody = {
2669
2775
  prefix?: PrefixExpression;
2670
2776
  filter?: FilterExpression;
2671
2777
  highlight?: HighlightExpression;
2778
+ boosters?: BoosterExpression[];
2672
2779
  };
2673
2780
  declare type SearchTableVariables = {
2674
2781
  body: SearchTableRequestBody;
@@ -2700,6 +2807,7 @@ declare type SearchBranchRequestBody = {
2700
2807
  tables?: (string | {
2701
2808
  table: string;
2702
2809
  filter?: FilterExpression;
2810
+ boosters?: BoosterExpression[];
2703
2811
  })[];
2704
2812
  query: string;
2705
2813
  fuzziness?: FuzzinessExpression;
@@ -2741,6 +2849,7 @@ declare const operationsByTag: {
2741
2849
  getDatabaseList: (variables: GetDatabaseListVariables) => Promise<ListDatabasesResponse>;
2742
2850
  createDatabase: (variables: CreateDatabaseVariables) => Promise<CreateDatabaseResponse>;
2743
2851
  deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
2852
+ getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
2744
2853
  getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
2745
2854
  addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
2746
2855
  removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
@@ -2749,7 +2858,7 @@ declare const operationsByTag: {
2749
2858
  branch: {
2750
2859
  getBranchList: (variables: GetBranchListVariables) => Promise<ListBranchesResponse>;
2751
2860
  getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
2752
- createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
2861
+ createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
2753
2862
  deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
2754
2863
  updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
2755
2864
  getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
@@ -2759,7 +2868,7 @@ declare const operationsByTag: {
2759
2868
  getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
2760
2869
  };
2761
2870
  table: {
2762
- createTable: (variables: CreateTableVariables) => Promise<undefined>;
2871
+ createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
2763
2872
  deleteTable: (variables: DeleteTableVariables) => Promise<undefined>;
2764
2873
  updateTable: (variables: UpdateTableVariables) => Promise<undefined>;
2765
2874
  getTableSchema: (variables: GetTableSchemaVariables) => Promise<GetTableSchemaResponse>;
@@ -2771,13 +2880,13 @@ declare const operationsByTag: {
2771
2880
  updateColumn: (variables: UpdateColumnVariables) => Promise<MigrationIdResponse>;
2772
2881
  };
2773
2882
  records: {
2774
- insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
2883
+ insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
2775
2884
  insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2776
2885
  updateRecordWithID: (variables: UpdateRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2777
2886
  upsertRecordWithID: (variables: UpsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2778
- deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
2887
+ deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
2779
2888
  getRecord: (variables: GetRecordVariables) => Promise<XataRecord$1>;
2780
- bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
2889
+ bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
2781
2890
  queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
2782
2891
  searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2783
2892
  searchBranch: (variables: SearchBranchVariables) => Promise<SearchResponse>;
@@ -2795,10 +2904,8 @@ interface XataApiClientOptions {
2795
2904
  fetch?: FetchImpl;
2796
2905
  apiKey?: string;
2797
2906
  host?: HostProvider;
2907
+ trace?: TraceFunction;
2798
2908
  }
2799
- /**
2800
- * @deprecated Use XataApiPlugin instead
2801
- */
2802
2909
  declare class XataApiClient {
2803
2910
  #private;
2804
2911
  constructor(options?: XataApiClientOptions);
@@ -2842,6 +2949,7 @@ declare class DatabaseApi {
2842
2949
  getDatabaseList(workspace: WorkspaceID): Promise<ListDatabasesResponse>;
2843
2950
  createDatabase(workspace: WorkspaceID, dbName: DBName, options?: CreateDatabaseRequestBody): Promise<CreateDatabaseResponse>;
2844
2951
  deleteDatabase(workspace: WorkspaceID, dbName: DBName): Promise<void>;
2952
+ getDatabaseMetadata(workspace: WorkspaceID, dbName: DBName): Promise<DatabaseMetadata>;
2845
2953
  getGitBranchesMapping(workspace: WorkspaceID, dbName: DBName): Promise<ListGitBranchesResponse>;
2846
2954
  addGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, body: AddGitBranchesEntryRequestBody): Promise<AddGitBranchesEntryResponse>;
2847
2955
  removeGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<void>;
@@ -2852,7 +2960,7 @@ declare class BranchApi {
2852
2960
  constructor(extraProps: FetcherExtraProps);
2853
2961
  getBranchList(workspace: WorkspaceID, dbName: DBName): Promise<ListBranchesResponse>;
2854
2962
  getBranchDetails(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<DBBranch>;
2855
- createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<void>;
2963
+ createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<CreateBranchResponse>;
2856
2964
  deleteBranch(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<void>;
2857
2965
  updateBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName, metadata?: BranchMetadata): Promise<void>;
2858
2966
  getBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<BranchMetadata>;
@@ -2864,7 +2972,7 @@ declare class BranchApi {
2864
2972
  declare class TableApi {
2865
2973
  private extraProps;
2866
2974
  constructor(extraProps: FetcherExtraProps);
2867
- createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
2975
+ createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<CreateTableResponse>;
2868
2976
  deleteTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
2869
2977
  updateTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, options: UpdateTableRequestBody): Promise<void>;
2870
2978
  getTableSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<GetTableSchemaResponse>;
@@ -2878,13 +2986,13 @@ declare class TableApi {
2878
2986
  declare class RecordsApi {
2879
2987
  private extraProps;
2880
2988
  constructor(extraProps: FetcherExtraProps);
2881
- insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>): Promise<InsertRecordResponse>;
2989
+ insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>, options?: InsertRecordQueryParams): Promise<RecordUpdateResponse>;
2882
2990
  insertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: InsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2883
2991
  updateRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpdateRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2884
2992
  upsertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2885
- deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID): Promise<void>;
2886
- getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordRequestBody): Promise<XataRecord$1>;
2887
- bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[]): Promise<BulkInsertTableRecordsResponse>;
2993
+ deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: DeleteRecordQueryParams): Promise<RecordUpdateResponse>;
2994
+ getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordQueryParams): Promise<XataRecord$1>;
2995
+ bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[], options?: BulkInsertTableRecordsQueryParams): Promise<BulkInsertResponse>;
2888
2996
  queryTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: QueryTableRequestBody): Promise<QueryResponse>;
2889
2997
  searchTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: SearchTableRequestBody): Promise<SearchResponse>;
2890
2998
  searchBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, query: SearchBranchRequestBody): Promise<SearchResponse>;
@@ -2900,19 +3008,20 @@ declare type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) ex
2900
3008
  declare type If<Condition, Then, Else> = Condition extends true ? Then : Else;
2901
3009
  declare type IsObject<T> = T extends Record<string, any> ? true : false;
2902
3010
  declare type IsArray<T> = T extends Array<any> ? true : false;
2903
- declare type NonEmptyArray<T> = T[] & {
2904
- 0: T;
2905
- };
2906
3011
  declare type RequiredBy<T, K extends keyof T> = T & {
2907
3012
  [P in K]-?: NonNullable<T[P]>;
2908
3013
  };
2909
3014
  declare type GetArrayInnerType<T extends readonly any[]> = T[number];
2910
3015
  declare type SingleOrArray<T> = T | T[];
2911
3016
  declare type OmitBy<T, K extends keyof T> = T extends any ? Omit<T, K> : never;
3017
+ declare type Without<T, U> = {
3018
+ [P in Exclude<keyof T, keyof U>]?: never;
3019
+ };
3020
+ declare type ExclusiveOr<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
2912
3021
 
2913
3022
  declare type SelectableColumn<O, RecursivePath extends any[] = []> = '*' | 'id' | DataProps<O> | NestedColumns<O, RecursivePath>;
2914
- declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord & UnionToIntersection<Values<{
2915
- [K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord;
3023
+ declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord<O> & UnionToIntersection<Values<{
3024
+ [K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord<O>;
2916
3025
  }>>;
2917
3026
  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> ? {
2918
3027
  V: ValueAtColumn<Item, V>;
@@ -2948,22 +3057,37 @@ interface BaseData {
2948
3057
  /**
2949
3058
  * Represents a persisted record from the database.
2950
3059
  */
2951
- interface XataRecord<ExtraMetadata extends Record<string, unknown> = Record<string, unknown>> extends Identifiable {
3060
+ interface XataRecord<OriginalRecord extends XataRecord<any> = XataRecord<any>> extends Identifiable {
2952
3061
  /**
2953
3062
  * Get metadata of this record.
2954
3063
  */
2955
- getMetadata(): XataRecordMetadata & ExtraMetadata;
3064
+ getMetadata(): XataRecordMetadata;
2956
3065
  /**
2957
3066
  * Retrieves a refreshed copy of the current record from the database.
3067
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3068
+ * @returns The persisted record with the selected columns.
2958
3069
  */
2959
- read(): Promise<Readonly<SelectedPick<this, ['*']>> | null>;
3070
+ read<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
3071
+ /**
3072
+ * Retrieves a refreshed copy of the current record from the database.
3073
+ * @returns The persisted record with all first level properties.
3074
+ */
3075
+ read(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2960
3076
  /**
2961
3077
  * Performs a partial update of the current record. On success a new object is
2962
3078
  * returned and the current object is not mutated.
2963
3079
  * @param partialUpdate The columns and their values that have to be updated.
2964
- * @returns A new record containing the latest values for all the columns of the current record.
3080
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3081
+ * @returns The persisted record with the selected columns.
3082
+ */
3083
+ update<K extends SelectableColumn<OriginalRecord>>(partialUpdate: Partial<EditableData<Omit<OriginalRecord, keyof XataRecord>>>, columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>>>;
3084
+ /**
3085
+ * Performs a partial update of the current record. On success a new object is
3086
+ * returned and the current object is not mutated.
3087
+ * @param partialUpdate The columns and their values that have to be updated.
3088
+ * @returns The persisted record with all first level properties.
2965
3089
  */
2966
- update(partialUpdate: Partial<EditableData<Omit<this, keyof XataRecord>>>): Promise<Readonly<SelectedPick<this, ['*']>>>;
3090
+ update(partialUpdate: Partial<EditableData<Omit<OriginalRecord, keyof XataRecord>>>): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>>>;
2967
3091
  /**
2968
3092
  * Performs a deletion of the current record in the database.
2969
3093
  *
@@ -2975,14 +3099,20 @@ declare type Link<Record extends XataRecord> = Omit<XataRecord, 'read' | 'update
2975
3099
  /**
2976
3100
  * Retrieves a refreshed copy of the current record from the database.
2977
3101
  */
2978
- read(): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3102
+ read<K extends SelectableColumn<Record>>(columns?: K[]): Promise<Readonly<SelectedPick<Record, typeof columns extends SelectableColumn<Record>[] ? typeof columns : ['*']>> | null>;
2979
3103
  /**
2980
3104
  * Performs a partial update of the current record. On success a new object is
2981
3105
  * returned and the current object is not mutated.
2982
3106
  * @param partialUpdate The columns and their values that have to be updated.
2983
3107
  * @returns A new record containing the latest values for all the columns of the current record.
2984
3108
  */
2985
- update(partialUpdate: Partial<EditableData<Omit<Record, keyof XataRecord>>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3109
+ 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 : ['*']>>>;
3110
+ /**
3111
+ * Performs a deletion of the current record in the database.
3112
+ *
3113
+ * @throws If the record was already deleted or if an error happened while performing the deletion.
3114
+ */
3115
+ delete(): Promise<void>;
2986
3116
  };
2987
3117
  declare type XataRecordMetadata = {
2988
3118
  /**
@@ -3093,7 +3223,85 @@ declare type BaseApiFilter<Record> = PropertyAccessFilter<Record> | AggregatorFi
3093
3223
  declare type NestedApiFilter<T> = {
3094
3224
  [key in keyof T]?: T[key] extends Record<string, any> ? SingleOrArray<Filter<T[key]>> : PropertyFilter<T[key]>;
3095
3225
  };
3096
- declare type Filter<T> = T extends Record<string, any> ? BaseApiFilter<T> | NestedApiFilter<T> : PropertyFilter<T>;
3226
+ declare type Filter<T> = T extends Record<string, any> ? T extends Date ? PropertyFilter<T> : BaseApiFilter<T> | NestedApiFilter<T> : PropertyFilter<T>;
3227
+
3228
+ declare type DateBooster = {
3229
+ origin?: string;
3230
+ scale: string;
3231
+ decay: number;
3232
+ };
3233
+ declare type NumericBooster = {
3234
+ factor: number;
3235
+ };
3236
+ declare type ValueBooster<T extends string | number | boolean> = {
3237
+ value: T;
3238
+ factor: number;
3239
+ };
3240
+ declare type Boosters<O extends XataRecord> = Values<{
3241
+ [K in SelectableColumn<O>]: NonNullable<ValueAtColumn<O, K>> extends Date ? {
3242
+ dateBooster: {
3243
+ column: K;
3244
+ } & DateBooster;
3245
+ } : NonNullable<ValueAtColumn<O, K>> extends number ? ExclusiveOr<{
3246
+ numericBooster?: {
3247
+ column: K;
3248
+ } & NumericBooster;
3249
+ }, {
3250
+ valueBooster?: {
3251
+ column: K;
3252
+ } & ValueBooster<number>;
3253
+ }> : NonNullable<ValueAtColumn<O, K>> extends string | boolean ? {
3254
+ valueBooster: {
3255
+ column: K;
3256
+ } & ValueBooster<NonNullable<ValueAtColumn<O, K>>>;
3257
+ } : never;
3258
+ }>;
3259
+
3260
+ declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3261
+ fuzziness?: FuzzinessExpression;
3262
+ prefix?: PrefixExpression;
3263
+ highlight?: HighlightExpression;
3264
+ tables?: Array<Tables | Values<{
3265
+ [Model in GetArrayInnerType<NonNullable<Tables[]>>]: {
3266
+ table: Model;
3267
+ filter?: Filter<SelectedPick<Schemas[Model] & XataRecord, ['*']>>;
3268
+ boosters?: Boosters<Schemas[Model] & XataRecord>[];
3269
+ };
3270
+ }>>;
3271
+ };
3272
+ declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3273
+ all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3274
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]: {
3275
+ table: Model;
3276
+ record: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>>;
3277
+ };
3278
+ }>[]>;
3279
+ byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3280
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]?: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>[]>;
3281
+ }>;
3282
+ };
3283
+ declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
3284
+ #private;
3285
+ private db;
3286
+ constructor(db: SchemaPluginResult<Schemas>, schemaTables?: Schemas.Table[]);
3287
+ build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
3288
+ }
3289
+ declare type SearchXataRecord<Record extends XataRecord> = Omit<Record, 'getMetadata'> & {
3290
+ getMetadata: () => XataRecordMetadata & SearchExtraProperties;
3291
+ };
3292
+ declare type SearchExtraProperties = {
3293
+ table: string;
3294
+ highlight?: {
3295
+ [key: string]: string[] | {
3296
+ [key: string]: any;
3297
+ };
3298
+ };
3299
+ score?: number;
3300
+ };
3301
+ declare type ReturnTable<Table, Tables> = Table extends Tables ? Table : never;
3302
+ 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 {
3303
+ table: infer Table;
3304
+ } ? ReturnTable<Table, Tables> : never;
3097
3305
 
3098
3306
  declare type SortDirection = 'asc' | 'desc';
3099
3307
  declare type SortFilterExtended<T extends XataRecord> = {
@@ -3106,7 +3314,7 @@ declare type SortFilterBase<T extends XataRecord> = {
3106
3314
  };
3107
3315
 
3108
3316
  declare type BaseOptions<T extends XataRecord> = {
3109
- columns?: NonEmptyArray<SelectableColumn<T>>;
3317
+ columns?: SelectableColumn<T>[];
3110
3318
  cache?: number;
3111
3319
  };
3112
3320
  declare type CursorQueryOptions = {
@@ -3169,7 +3377,7 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3169
3377
  * @param value The value to filter.
3170
3378
  * @returns A new Query object.
3171
3379
  */
3172
- filter<F extends SelectableColumn<Record>>(column: F, value: Filter<ValueAtColumn<Record, F>>): Query<Record, Result>;
3380
+ filter<F extends SelectableColumn<Record>>(column: F, value: Filter<NonNullable<ValueAtColumn<Record, F>>>): Query<Record, Result>;
3173
3381
  /**
3174
3382
  * Builds a new query object adding one or more constraints. Examples:
3175
3383
  *
@@ -3190,13 +3398,13 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3190
3398
  * @param direction The direction. Either ascending or descending.
3191
3399
  * @returns A new Query object.
3192
3400
  */
3193
- sort<F extends SelectableColumn<Record>>(column: F, direction: SortDirection): Query<Record, Result>;
3401
+ sort<F extends SelectableColumn<Record>>(column: F, direction?: SortDirection): Query<Record, Result>;
3194
3402
  /**
3195
3403
  * Builds a new query specifying the set of columns to be returned in the query response.
3196
3404
  * @param columns Array of column names to be returned by the query.
3197
3405
  * @returns A new Query object.
3198
3406
  */
3199
- select<K extends SelectableColumn<Record>>(columns: NonEmptyArray<K>): Query<Record, SelectedPick<Record, NonEmptyArray<K>>>;
3407
+ select<K extends SelectableColumn<Record>>(columns: K[]): Query<Record, SelectedPick<Record, K[]>>;
3200
3408
  /**
3201
3409
  * Get paginated results
3202
3410
  *
@@ -3463,7 +3671,16 @@ declare class RecordArray<Result extends XataRecord> extends Array<Result> {
3463
3671
  * Common interface for performing operations on a table.
3464
3672
  */
3465
3673
  declare abstract class Repository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
3674
+ abstract create<K extends SelectableColumn<Record>>(object: Omit<EditableData<Data>, 'id'> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3466
3675
  abstract create(object: Omit<EditableData<Data>, 'id'> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3676
+ /**
3677
+ * Creates a single record in the table with a unique id.
3678
+ * @param id The unique id.
3679
+ * @param object Object containing the column names with their values to be stored in the table.
3680
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3681
+ * @returns The full persisted record.
3682
+ */
3683
+ abstract create<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Data>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3467
3684
  /**
3468
3685
  * Creates a single record in the table with a unique id.
3469
3686
  * @param id The unique id.
@@ -3474,9 +3691,23 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3474
3691
  /**
3475
3692
  * Creates multiple records in the table.
3476
3693
  * @param objects Array of objects with the column names and the values to be stored in the table.
3477
- * @returns Array of the persisted records.
3694
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3695
+ * @returns Array of the persisted records in order.
3696
+ */
3697
+ abstract create<K extends SelectableColumn<Record>>(objects: Array<Omit<EditableData<Data>, 'id'> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3698
+ /**
3699
+ * Creates multiple records in the table.
3700
+ * @param objects Array of objects with the column names and the values to be stored in the table.
3701
+ * @returns Array of the persisted records in order.
3478
3702
  */
3479
3703
  abstract create(objects: Array<Omit<EditableData<Data>, 'id'> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3704
+ /**
3705
+ * Queries a single record from the table given its unique id.
3706
+ * @param id The unique id.
3707
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3708
+ * @returns The persisted record for the given id or null if the record could not be found.
3709
+ */
3710
+ abstract read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
3480
3711
  /**
3481
3712
  * Queries a single record from the table given its unique id.
3482
3713
  * @param id The unique id.
@@ -3486,9 +3717,23 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3486
3717
  /**
3487
3718
  * Queries multiple records from the table given their unique id.
3488
3719
  * @param ids The unique ids array.
3489
- * @returns The persisted records for the given ids (if a record could not be found it is not returned).
3720
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3721
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
3722
+ */
3723
+ abstract read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3724
+ /**
3725
+ * Queries multiple records from the table given their unique id.
3726
+ * @param ids The unique ids array.
3727
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
3728
+ */
3729
+ abstract read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3730
+ /**
3731
+ * Queries a single record from the table by the id in the object.
3732
+ * @param object Object containing the id of the record.
3733
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3734
+ * @returns The persisted record for the given id or null if the record could not be found.
3490
3735
  */
3491
- abstract read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3736
+ abstract read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
3492
3737
  /**
3493
3738
  * Queries a single record from the table by the id in the object.
3494
3739
  * @param object Object containing the id of the record.
@@ -3498,15 +3743,37 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3498
3743
  /**
3499
3744
  * Queries multiple records from the table by the ids in the objects.
3500
3745
  * @param objects Array of objects containing the ids of the records.
3501
- * @returns The persisted records for the given ids (if a record could not be found it is not returned).
3746
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3747
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
3748
+ */
3749
+ abstract read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3750
+ /**
3751
+ * Queries multiple records from the table by the ids in the objects.
3752
+ * @param objects Array of objects containing the ids of the records.
3753
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
3754
+ */
3755
+ abstract read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3756
+ /**
3757
+ * Partially update a single record.
3758
+ * @param object An object with its id and the columns to be updated.
3759
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3760
+ * @returns The full persisted record.
3502
3761
  */
3503
- abstract read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3762
+ abstract update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Data>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3504
3763
  /**
3505
3764
  * Partially update a single record.
3506
3765
  * @param object An object with its id and the columns to be updated.
3507
3766
  * @returns The full persisted record.
3508
3767
  */
3509
3768
  abstract update(object: Partial<EditableData<Data>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3769
+ /**
3770
+ * Partially update a single record given its unique id.
3771
+ * @param id The unique id.
3772
+ * @param object The column names and their values that have to be updated.
3773
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3774
+ * @returns The full persisted record.
3775
+ */
3776
+ abstract update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Data>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3510
3777
  /**
3511
3778
  * Partially update a single record given its unique id.
3512
3779
  * @param id The unique id.
@@ -3517,9 +3784,24 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3517
3784
  /**
3518
3785
  * Partially updates multiple records.
3519
3786
  * @param objects An array of objects with their ids and columns to be updated.
3520
- * @returns Array of the persisted records.
3787
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3788
+ * @returns Array of the persisted records in order.
3789
+ */
3790
+ abstract update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Data>> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3791
+ /**
3792
+ * Partially updates multiple records.
3793
+ * @param objects An array of objects with their ids and columns to be updated.
3794
+ * @returns Array of the persisted records in order.
3521
3795
  */
3522
3796
  abstract update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3797
+ /**
3798
+ * Creates or updates a single record. If a record exists with the given id,
3799
+ * it will be update, otherwise a new record will be created.
3800
+ * @param object Object containing the column names with their values to be persisted in the table.
3801
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3802
+ * @returns The full persisted record.
3803
+ */
3804
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Data> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3523
3805
  /**
3524
3806
  * Creates or updates a single record. If a record exists with the given id,
3525
3807
  * it will be update, otherwise a new record will be created.
@@ -3527,6 +3809,15 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3527
3809
  * @returns The full persisted record.
3528
3810
  */
3529
3811
  abstract createOrUpdate(object: EditableData<Data> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3812
+ /**
3813
+ * Creates or updates a single record. If a record exists with the given id,
3814
+ * it will be update, otherwise a new record will be created.
3815
+ * @param id A unique id.
3816
+ * @param object The column names and the values to be persisted.
3817
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3818
+ * @returns The full persisted record.
3819
+ */
3820
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Data>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3530
3821
  /**
3531
3822
  * Creates or updates a single record. If a record exists with the given id,
3532
3823
  * it will be update, otherwise a new record will be created.
@@ -3535,6 +3826,14 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3535
3826
  * @returns The full persisted record.
3536
3827
  */
3537
3828
  abstract createOrUpdate(id: string, object: Omit<EditableData<Data>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3829
+ /**
3830
+ * Creates or updates a single record. If a record exists with the given id,
3831
+ * it will be update, otherwise a new record will be created.
3832
+ * @param objects Array of objects with the column names and the values to be stored in the table.
3833
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3834
+ * @returns Array of the persisted records.
3835
+ */
3836
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Data> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3538
3837
  /**
3539
3838
  * Creates or updates a single record. If a record exists with the given id,
3540
3839
  * it will be update, otherwise a new record will be created.
@@ -3574,14 +3873,15 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3574
3873
  */
3575
3874
  abstract search(query: string, options?: {
3576
3875
  fuzziness?: FuzzinessExpression;
3876
+ prefix?: PrefixExpression;
3577
3877
  highlight?: HighlightExpression;
3578
3878
  filter?: Filter<Record>;
3579
- }): Promise<SelectedPick<Record, ['*']>[]>;
3879
+ boosters?: Boosters<Record>[];
3880
+ }): Promise<SearchXataRecord<SelectedPick<Record, ['*']>>[]>;
3580
3881
  abstract query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3581
3882
  }
3582
3883
  declare class RestRepository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Data, Record> {
3583
3884
  #private;
3584
- db: SchemaPluginResult<any>;
3585
3885
  constructor(options: {
3586
3886
  table: string;
3587
3887
  db: SchemaPluginResult<any>;
@@ -3591,22 +3891,37 @@ declare class RestRepository<Data extends BaseData, Record extends XataRecord =
3591
3891
  create(object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3592
3892
  create(recordId: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3593
3893
  create(objects: EditableData<Data>[]): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3594
- read(recordId: string): Promise<SelectedPick<Record, ['*']> | null>;
3894
+ create<K extends SelectableColumn<Record>>(object: EditableData<Data>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3895
+ create<K extends SelectableColumn<Record>>(recordId: string, object: EditableData<Data>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3896
+ create<K extends SelectableColumn<Record>>(objects: EditableData<Data>[], columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3897
+ read(recordId: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3595
3898
  read(recordIds: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3596
- read(object: Identifiable): Promise<SelectedPick<Record, ['*']> | null>;
3899
+ read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3597
3900
  read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3901
+ read<K extends SelectableColumn<Record>>(recordId: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3902
+ read<K extends SelectableColumn<Record>>(recordIds: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
3903
+ read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3904
+ read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
3598
3905
  update(object: Partial<EditableData<Data>> & Identifiable): Promise<SelectedPick<Record, ['*']>>;
3599
3906
  update(recordId: string, object: Partial<EditableData<Data>>): Promise<SelectedPick<Record, ['*']>>;
3600
3907
  update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<SelectedPick<Record, ['*']>[]>;
3908
+ update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Data>> & Identifiable, columns: K[]): Promise<SelectedPick<Record, typeof columns>>;
3909
+ update<K extends SelectableColumn<Record>>(recordId: string, object: Partial<EditableData<Data>>, columns: K[]): Promise<SelectedPick<Record, typeof columns>>;
3910
+ update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Data>> & Identifiable>, columns: K[]): Promise<SelectedPick<Record, typeof columns>[]>;
3601
3911
  createOrUpdate(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3602
3912
  createOrUpdate(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3603
3913
  createOrUpdate(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3914
+ createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Data>, columns: K[]): Promise<SelectedPick<Record, typeof columns>>;
3915
+ createOrUpdate<K extends SelectableColumn<Record>>(recordId: string, object: EditableData<Data>, columns: K[]): Promise<SelectedPick<Record, typeof columns>>;
3916
+ createOrUpdate<K extends SelectableColumn<Record>>(objects: EditableData<Data>[], columns: K[]): Promise<SelectedPick<Record, typeof columns>[]>;
3604
3917
  delete(a: string | Identifiable | Array<string | Identifiable>): Promise<void>;
3605
3918
  search(query: string, options?: {
3606
3919
  fuzziness?: FuzzinessExpression;
3920
+ prefix?: PrefixExpression;
3607
3921
  highlight?: HighlightExpression;
3608
3922
  filter?: Filter<Record>;
3609
- }): Promise<SelectedPick<Record, ['*']>[]>;
3923
+ boosters?: Boosters<Record>[];
3924
+ }): Promise<any>;
3610
3925
  query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3611
3926
  }
3612
3927
 
@@ -3663,6 +3978,10 @@ declare type PropertyType<Tables, Properties, PropertyName> = Properties & {
3663
3978
  [K in ObjectColumns[number]['name']]?: PropertyType<Tables, ObjectColumns[number], K>;
3664
3979
  } : never : never : Type extends 'link' ? TableType<Tables, LinkedTable> & XataRecord : never) | null : never : never;
3665
3980
 
3981
+ /**
3982
+ * Operator to restrict results to only values that are greater than the given value.
3983
+ */
3984
+ declare const greaterThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3666
3985
  /**
3667
3986
  * Operator to restrict results to only values that are greater than the given value.
3668
3987
  */
@@ -3670,15 +3989,35 @@ declare const gt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T
3670
3989
  /**
3671
3990
  * Operator to restrict results to only values that are greater than or equal to the given value.
3672
3991
  */
3673
- declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3992
+ declare const greaterThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3993
+ /**
3994
+ * Operator to restrict results to only values that are greater than or equal to the given value.
3995
+ */
3996
+ declare const greaterEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3674
3997
  /**
3675
3998
  * Operator to restrict results to only values that are greater than or equal to the given value.
3676
3999
  */
3677
4000
  declare const gte: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4001
+ /**
4002
+ * Operator to restrict results to only values that are greater than or equal to the given value.
4003
+ */
4004
+ declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4005
+ /**
4006
+ * Operator to restrict results to only values that are lower than the given value.
4007
+ */
4008
+ declare const lessThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3678
4009
  /**
3679
4010
  * Operator to restrict results to only values that are lower than the given value.
3680
4011
  */
3681
4012
  declare const lt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4013
+ /**
4014
+ * Operator to restrict results to only values that are lower than or equal to the given value.
4015
+ */
4016
+ declare const lessThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4017
+ /**
4018
+ * Operator to restrict results to only values that are lower than or equal to the given value.
4019
+ */
4020
+ declare const lessEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3682
4021
  /**
3683
4022
  * Operator to restrict results to only values that are lower than or equal to the given value.
3684
4023
  */
@@ -3711,6 +4050,10 @@ declare const pattern: (value: string) => StringTypeFilter;
3711
4050
  * Operator to restrict results to only values that are equal to the given value.
3712
4051
  */
3713
4052
  declare const is: <T>(value: T) => PropertyFilter<T>;
4053
+ /**
4054
+ * Operator to restrict results to only values that are equal to the given value.
4055
+ */
4056
+ declare const equals: <T>(value: T) => PropertyFilter<T>;
3714
4057
  /**
3715
4058
  * Operator to restrict results to only values that are not equal to the given value.
3716
4059
  */
@@ -3750,47 +4093,6 @@ declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends Xat
3750
4093
  build(pluginOptions: XataPluginOptions): SchemaPluginResult<Schemas>;
3751
4094
  }
3752
4095
 
3753
- declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3754
- fuzziness?: FuzzinessExpression;
3755
- highlight?: HighlightExpression;
3756
- tables?: Array<Tables | Values<{
3757
- [Model in GetArrayInnerType<NonNullable<Tables[]>>]: {
3758
- table: Model;
3759
- filter?: Filter<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>>;
3760
- };
3761
- }>>;
3762
- };
3763
- declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3764
- all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3765
- [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]: {
3766
- table: Model;
3767
- record: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>>;
3768
- };
3769
- }>[]>;
3770
- byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3771
- [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]?: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>[]>;
3772
- }>;
3773
- };
3774
- declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
3775
- #private;
3776
- private db;
3777
- constructor(db: SchemaPluginResult<Schemas>, schemaTables?: Schemas.Table[]);
3778
- build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
3779
- }
3780
- declare type SearchXataRecord = XataRecord<SearchExtraProperties>;
3781
- declare type SearchExtraProperties = {
3782
- table: string;
3783
- highlight?: {
3784
- [key: string]: string[] | {
3785
- [key: string]: any;
3786
- };
3787
- };
3788
- };
3789
- declare type ReturnTable<Table, Tables> = Table extends Tables ? Table : never;
3790
- 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 {
3791
- table: infer Table;
3792
- } ? ReturnTable<Table, Tables> : never;
3793
-
3794
4096
  declare type BranchStrategyValue = string | undefined | null;
3795
4097
  declare type BranchStrategyBuilder = () => BranchStrategyValue | Promise<BranchStrategyValue>;
3796
4098
  declare type BranchStrategy = BranchStrategyValue | BranchStrategyBuilder;
@@ -3802,6 +4104,7 @@ declare type BaseClientOptions = {
3802
4104
  databaseURL?: string;
3803
4105
  branch?: BranchStrategyOption;
3804
4106
  cache?: CacheImpl;
4107
+ trace?: TraceFunction;
3805
4108
  };
3806
4109
  declare const buildClient: <Plugins extends Record<string, XataPlugin> = {}>(plugins?: Plugins | undefined) => ClientConstructor<Plugins>;
3807
4110
  interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
@@ -3810,12 +4113,26 @@ interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
3810
4113
  search: Awaited<ReturnType<SearchPlugin<SchemaInference<NonNullable<typeof schemaTables>>>['build']>>;
3811
4114
  }, keyof Plugins> & {
3812
4115
  [Key in StringKeys<NonNullable<Plugins>>]: Awaited<ReturnType<NonNullable<Plugins>[Key]['build']>>;
4116
+ } & {
4117
+ getConfig(): Promise<{
4118
+ databaseURL: string;
4119
+ branch: string;
4120
+ }>;
3813
4121
  };
3814
4122
  }
3815
4123
  declare const BaseClient_base: ClientConstructor<{}>;
3816
4124
  declare class BaseClient extends BaseClient_base<[]> {
3817
4125
  }
3818
4126
 
4127
+ declare class Serializer {
4128
+ classes: Record<string, any>;
4129
+ add(clazz: any): void;
4130
+ toJSON<T>(data: T): string;
4131
+ fromJSON<T>(json: string): T;
4132
+ }
4133
+ declare const serialize: <T>(data: T) => string;
4134
+ declare const deserialize: <T>(json: string) => T;
4135
+
3819
4136
  declare type BranchResolutionOptions = {
3820
4137
  databaseURL?: string;
3821
4138
  apiKey?: string;
@@ -3827,9 +4144,89 @@ declare function getDatabaseURL(): string | undefined;
3827
4144
 
3828
4145
  declare function getAPIKey(): string | undefined;
3829
4146
 
4147
+ interface Body {
4148
+ arrayBuffer(): Promise<ArrayBuffer>;
4149
+ blob(): Promise<Blob>;
4150
+ formData(): Promise<FormData>;
4151
+ json(): Promise<any>;
4152
+ text(): Promise<string>;
4153
+ }
4154
+ interface Blob {
4155
+ readonly size: number;
4156
+ readonly type: string;
4157
+ arrayBuffer(): Promise<ArrayBuffer>;
4158
+ slice(start?: number, end?: number, contentType?: string): Blob;
4159
+ text(): Promise<string>;
4160
+ }
4161
+ /** Provides information about files and allows JavaScript in a web page to access their content. */
4162
+ interface File extends Blob {
4163
+ readonly lastModified: number;
4164
+ readonly name: string;
4165
+ readonly webkitRelativePath: string;
4166
+ }
4167
+ declare type FormDataEntryValue = File | string;
4168
+ /** 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". */
4169
+ interface FormData {
4170
+ append(name: string, value: string | Blob, fileName?: string): void;
4171
+ delete(name: string): void;
4172
+ get(name: string): FormDataEntryValue | null;
4173
+ getAll(name: string): FormDataEntryValue[];
4174
+ has(name: string): boolean;
4175
+ set(name: string, value: string | Blob, fileName?: string): void;
4176
+ forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void;
4177
+ }
4178
+ /** 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. */
4179
+ interface Headers {
4180
+ append(name: string, value: string): void;
4181
+ delete(name: string): void;
4182
+ get(name: string): string | null;
4183
+ has(name: string): boolean;
4184
+ set(name: string, value: string): void;
4185
+ forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void;
4186
+ }
4187
+ interface Request extends Body {
4188
+ /** Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching. */
4189
+ readonly cache: 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload';
4190
+ /** 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. */
4191
+ readonly credentials: 'include' | 'omit' | 'same-origin';
4192
+ /** Returns the kind of resource requested by request, e.g., "document" or "script". */
4193
+ readonly destination: '' | 'audio' | 'audioworklet' | 'document' | 'embed' | 'font' | 'frame' | 'iframe' | 'image' | 'manifest' | 'object' | 'paintworklet' | 'report' | 'script' | 'sharedworker' | 'style' | 'track' | 'video' | 'worker' | 'xslt';
4194
+ /** 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. */
4195
+ readonly headers: Headers;
4196
+ /** 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] */
4197
+ readonly integrity: string;
4198
+ /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
4199
+ readonly keepalive: boolean;
4200
+ /** Returns request's HTTP method, which is "GET" by default. */
4201
+ readonly method: string;
4202
+ /** 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. */
4203
+ readonly mode: 'cors' | 'navigate' | 'no-cors' | 'same-origin';
4204
+ /** 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. */
4205
+ readonly redirect: 'error' | 'follow' | 'manual';
4206
+ /** 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. */
4207
+ readonly referrer: string;
4208
+ /** Returns the referrer policy associated with request. This is used during fetching to compute the value of the request's referrer. */
4209
+ readonly referrerPolicy: '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
4210
+ /** Returns the URL of request as a string. */
4211
+ readonly url: string;
4212
+ clone(): Request;
4213
+ }
4214
+
4215
+ declare type XataWorkerContext<XataClient> = {
4216
+ xata: XataClient;
4217
+ request: Request;
4218
+ env: Record<string, string | undefined>;
4219
+ };
4220
+ declare type RemoveFirst<T> = T extends [any, ...infer U] ? U : never;
4221
+ declare type WorkerRunnerConfig = {
4222
+ workspace: string;
4223
+ worker: string;
4224
+ };
4225
+ 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>>>;
4226
+
3830
4227
  declare class XataError extends Error {
3831
4228
  readonly status: number;
3832
4229
  constructor(message: string, status: number);
3833
4230
  }
3834
4231
 
3835
- export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, AddGitBranchesEntryError, AddGitBranchesEntryPathParams, AddGitBranchesEntryRequestBody, AddGitBranchesEntryResponse, AddGitBranchesEntryVariables, AddTableColumnError, AddTableColumnPathParams, AddTableColumnVariables, BaseClient, BaseClientOptions, BaseData, BaseSchema, 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, 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, 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 };
4232
+ 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, GetDatabaseMetadataError, GetDatabaseMetadataPathParams, GetDatabaseMetadataVariables, 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, Serializer, 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, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, contains, createBranch, createDatabase, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getGitBranchesMapping, 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, lt, lte, notExists, operationsByTag, pattern, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };