@xata.io/client 0.0.0-alpha.vfd6aaf3 → 0.0.0-alpha.vfdcf483

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,
@@ -885,6 +957,9 @@ declare type InviteWorkspaceMemberError = ErrorWrapper<{
885
957
  } | {
886
958
  status: 404;
887
959
  payload: SimpleError;
960
+ } | {
961
+ status: 409;
962
+ payload: SimpleError;
888
963
  }>;
889
964
  declare type InviteWorkspaceMemberRequestBody = {
890
965
  email: string;
@@ -898,6 +973,34 @@ declare type InviteWorkspaceMemberVariables = {
898
973
  * Invite some user to join the workspace with the given role
899
974
  */
900
975
  declare const inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<WorkspaceInvite>;
976
+ declare type UpdateWorkspaceMemberInvitePathParams = {
977
+ workspaceId: WorkspaceID;
978
+ inviteId: InviteID;
979
+ };
980
+ declare type UpdateWorkspaceMemberInviteError = ErrorWrapper<{
981
+ status: 400;
982
+ payload: BadRequestError;
983
+ } | {
984
+ status: 401;
985
+ payload: AuthError;
986
+ } | {
987
+ status: 404;
988
+ payload: SimpleError;
989
+ } | {
990
+ status: 422;
991
+ payload: SimpleError;
992
+ }>;
993
+ declare type UpdateWorkspaceMemberInviteRequestBody = {
994
+ role: Role;
995
+ };
996
+ declare type UpdateWorkspaceMemberInviteVariables = {
997
+ body: UpdateWorkspaceMemberInviteRequestBody;
998
+ pathParams: UpdateWorkspaceMemberInvitePathParams;
999
+ } & FetcherExtraProps;
1000
+ /**
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.
1002
+ */
1003
+ declare const updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
901
1004
  declare type CancelWorkspaceMemberInvitePathParams = {
902
1005
  workspaceId: WorkspaceID;
903
1006
  inviteId: InviteID;
@@ -1051,6 +1154,27 @@ declare type DeleteDatabaseVariables = {
1051
1154
  * Delete a database and all of its branches and tables permanently.
1052
1155
  */
1053
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>;
1054
1178
  declare type GetGitBranchesMappingPathParams = {
1055
1179
  dbName: DBName;
1056
1180
  workspace: string;
@@ -1243,6 +1367,10 @@ declare type CreateBranchError = ErrorWrapper<{
1243
1367
  status: 404;
1244
1368
  payload: SimpleError;
1245
1369
  }>;
1370
+ declare type CreateBranchResponse = {
1371
+ databaseName: string;
1372
+ branchName: string;
1373
+ };
1246
1374
  declare type CreateBranchRequestBody = {
1247
1375
  from?: string;
1248
1376
  metadata?: BranchMetadata;
@@ -1252,7 +1380,7 @@ declare type CreateBranchVariables = {
1252
1380
  pathParams: CreateBranchPathParams;
1253
1381
  queryParams?: CreateBranchQueryParams;
1254
1382
  } & FetcherExtraProps;
1255
- declare const createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
1383
+ declare const createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
1256
1384
  declare type DeleteBranchPathParams = {
1257
1385
  dbBranchName: DBBranchName;
1258
1386
  workspace: string;
@@ -1439,13 +1567,17 @@ declare type CreateTableError = ErrorWrapper<{
1439
1567
  status: 422;
1440
1568
  payload: SimpleError;
1441
1569
  }>;
1570
+ declare type CreateTableResponse = {
1571
+ branchName: string;
1572
+ tableName: string;
1573
+ };
1442
1574
  declare type CreateTableVariables = {
1443
1575
  pathParams: CreateTablePathParams;
1444
1576
  } & FetcherExtraProps;
1445
1577
  /**
1446
1578
  * Creates a new table with the given name. Returns 422 if a table with the same name already exists.
1447
1579
  */
1448
- declare const createTable: (variables: CreateTableVariables) => Promise<undefined>;
1580
+ declare const createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
1449
1581
  declare type DeleteTablePathParams = {
1450
1582
  dbBranchName: DBBranchName;
1451
1583
  tableName: TableName;
@@ -1678,6 +1810,9 @@ declare type InsertRecordPathParams = {
1678
1810
  tableName: TableName;
1679
1811
  workspace: string;
1680
1812
  };
1813
+ declare type InsertRecordQueryParams = {
1814
+ columns?: ColumnsProjection;
1815
+ };
1681
1816
  declare type InsertRecordError = ErrorWrapper<{
1682
1817
  status: 400;
1683
1818
  payload: BadRequestError;
@@ -1688,20 +1823,15 @@ declare type InsertRecordError = ErrorWrapper<{
1688
1823
  status: 404;
1689
1824
  payload: SimpleError;
1690
1825
  }>;
1691
- declare type InsertRecordResponse = {
1692
- id: string;
1693
- xata: {
1694
- version: number;
1695
- };
1696
- };
1697
1826
  declare type InsertRecordVariables = {
1698
1827
  body?: Record<string, any>;
1699
1828
  pathParams: InsertRecordPathParams;
1829
+ queryParams?: InsertRecordQueryParams;
1700
1830
  } & FetcherExtraProps;
1701
1831
  /**
1702
1832
  * Insert a new Record into the Table
1703
1833
  */
1704
- declare const insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
1834
+ declare const insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
1705
1835
  declare type InsertRecordWithIDPathParams = {
1706
1836
  dbBranchName: DBBranchName;
1707
1837
  tableName: TableName;
@@ -1709,6 +1839,7 @@ declare type InsertRecordWithIDPathParams = {
1709
1839
  workspace: string;
1710
1840
  };
1711
1841
  declare type InsertRecordWithIDQueryParams = {
1842
+ columns?: ColumnsProjection;
1712
1843
  createOnly?: boolean;
1713
1844
  ifVersion?: number;
1714
1845
  };
@@ -1741,6 +1872,7 @@ declare type UpdateRecordWithIDPathParams = {
1741
1872
  workspace: string;
1742
1873
  };
1743
1874
  declare type UpdateRecordWithIDQueryParams = {
1875
+ columns?: ColumnsProjection;
1744
1876
  ifVersion?: number;
1745
1877
  };
1746
1878
  declare type UpdateRecordWithIDError = ErrorWrapper<{
@@ -1769,6 +1901,7 @@ declare type UpsertRecordWithIDPathParams = {
1769
1901
  workspace: string;
1770
1902
  };
1771
1903
  declare type UpsertRecordWithIDQueryParams = {
1904
+ columns?: ColumnsProjection;
1772
1905
  ifVersion?: number;
1773
1906
  };
1774
1907
  declare type UpsertRecordWithIDError = ErrorWrapper<{
@@ -1796,6 +1929,9 @@ declare type DeleteRecordPathParams = {
1796
1929
  recordId: RecordID;
1797
1930
  workspace: string;
1798
1931
  };
1932
+ declare type DeleteRecordQueryParams = {
1933
+ columns?: ColumnsProjection;
1934
+ };
1799
1935
  declare type DeleteRecordError = ErrorWrapper<{
1800
1936
  status: 400;
1801
1937
  payload: BadRequestError;
@@ -1808,14 +1944,18 @@ declare type DeleteRecordError = ErrorWrapper<{
1808
1944
  }>;
1809
1945
  declare type DeleteRecordVariables = {
1810
1946
  pathParams: DeleteRecordPathParams;
1947
+ queryParams?: DeleteRecordQueryParams;
1811
1948
  } & FetcherExtraProps;
1812
- declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
1949
+ declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
1813
1950
  declare type GetRecordPathParams = {
1814
1951
  dbBranchName: DBBranchName;
1815
1952
  tableName: TableName;
1816
1953
  recordId: RecordID;
1817
1954
  workspace: string;
1818
1955
  };
1956
+ declare type GetRecordQueryParams = {
1957
+ columns?: ColumnsProjection;
1958
+ };
1819
1959
  declare type GetRecordError = ErrorWrapper<{
1820
1960
  status: 400;
1821
1961
  payload: BadRequestError;
@@ -1826,12 +1966,9 @@ declare type GetRecordError = ErrorWrapper<{
1826
1966
  status: 404;
1827
1967
  payload: SimpleError;
1828
1968
  }>;
1829
- declare type GetRecordRequestBody = {
1830
- columns?: ColumnsFilter;
1831
- };
1832
1969
  declare type GetRecordVariables = {
1833
- body?: GetRecordRequestBody;
1834
1970
  pathParams: GetRecordPathParams;
1971
+ queryParams?: GetRecordQueryParams;
1835
1972
  } & FetcherExtraProps;
1836
1973
  /**
1837
1974
  * Retrieve record by ID
@@ -1842,6 +1979,9 @@ declare type BulkInsertTableRecordsPathParams = {
1842
1979
  tableName: TableName;
1843
1980
  workspace: string;
1844
1981
  };
1982
+ declare type BulkInsertTableRecordsQueryParams = {
1983
+ columns?: ColumnsProjection;
1984
+ };
1845
1985
  declare type BulkInsertTableRecordsError = ErrorWrapper<{
1846
1986
  status: 400;
1847
1987
  payload: BulkError;
@@ -1851,21 +1991,22 @@ declare type BulkInsertTableRecordsError = ErrorWrapper<{
1851
1991
  } | {
1852
1992
  status: 404;
1853
1993
  payload: SimpleError;
1994
+ } | {
1995
+ status: 422;
1996
+ payload: SimpleError;
1854
1997
  }>;
1855
- declare type BulkInsertTableRecordsResponse = {
1856
- recordIDs: string[];
1857
- };
1858
1998
  declare type BulkInsertTableRecordsRequestBody = {
1859
1999
  records: Record<string, any>[];
1860
2000
  };
1861
2001
  declare type BulkInsertTableRecordsVariables = {
1862
2002
  body: BulkInsertTableRecordsRequestBody;
1863
2003
  pathParams: BulkInsertTableRecordsPathParams;
2004
+ queryParams?: BulkInsertTableRecordsQueryParams;
1864
2005
  } & FetcherExtraProps;
1865
2006
  /**
1866
2007
  * Bulk insert records
1867
2008
  */
1868
- declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
2009
+ declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
1869
2010
  declare type QueryTablePathParams = {
1870
2011
  dbBranchName: DBBranchName;
1871
2012
  tableName: TableName;
@@ -1885,7 +2026,7 @@ declare type QueryTableRequestBody = {
1885
2026
  filter?: FilterExpression;
1886
2027
  sort?: SortExpression;
1887
2028
  page?: PageConfig;
1888
- columns?: ColumnsFilter;
2029
+ columns?: ColumnsProjection;
1889
2030
  };
1890
2031
  declare type QueryTableVariables = {
1891
2032
  body?: QueryTableRequestBody;
@@ -2634,6 +2775,7 @@ declare type SearchTableRequestBody = {
2634
2775
  prefix?: PrefixExpression;
2635
2776
  filter?: FilterExpression;
2636
2777
  highlight?: HighlightExpression;
2778
+ boosters?: BoosterExpression[];
2637
2779
  };
2638
2780
  declare type SearchTableVariables = {
2639
2781
  body: SearchTableRequestBody;
@@ -2665,6 +2807,7 @@ declare type SearchBranchRequestBody = {
2665
2807
  tables?: (string | {
2666
2808
  table: string;
2667
2809
  filter?: FilterExpression;
2810
+ boosters?: BoosterExpression[];
2668
2811
  })[];
2669
2812
  query: string;
2670
2813
  fuzziness?: FuzzinessExpression;
@@ -2697,6 +2840,7 @@ declare const operationsByTag: {
2697
2840
  updateWorkspaceMemberRole: (variables: UpdateWorkspaceMemberRoleVariables) => Promise<undefined>;
2698
2841
  removeWorkspaceMember: (variables: RemoveWorkspaceMemberVariables) => Promise<undefined>;
2699
2842
  inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<WorkspaceInvite>;
2843
+ updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
2700
2844
  cancelWorkspaceMemberInvite: (variables: CancelWorkspaceMemberInviteVariables) => Promise<undefined>;
2701
2845
  resendWorkspaceMemberInvite: (variables: ResendWorkspaceMemberInviteVariables) => Promise<undefined>;
2702
2846
  acceptWorkspaceMemberInvite: (variables: AcceptWorkspaceMemberInviteVariables) => Promise<undefined>;
@@ -2705,6 +2849,7 @@ declare const operationsByTag: {
2705
2849
  getDatabaseList: (variables: GetDatabaseListVariables) => Promise<ListDatabasesResponse>;
2706
2850
  createDatabase: (variables: CreateDatabaseVariables) => Promise<CreateDatabaseResponse>;
2707
2851
  deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
2852
+ getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
2708
2853
  getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
2709
2854
  addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
2710
2855
  removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
@@ -2713,7 +2858,7 @@ declare const operationsByTag: {
2713
2858
  branch: {
2714
2859
  getBranchList: (variables: GetBranchListVariables) => Promise<ListBranchesResponse>;
2715
2860
  getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
2716
- createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
2861
+ createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
2717
2862
  deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
2718
2863
  updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
2719
2864
  getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
@@ -2723,7 +2868,7 @@ declare const operationsByTag: {
2723
2868
  getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
2724
2869
  };
2725
2870
  table: {
2726
- createTable: (variables: CreateTableVariables) => Promise<undefined>;
2871
+ createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
2727
2872
  deleteTable: (variables: DeleteTableVariables) => Promise<undefined>;
2728
2873
  updateTable: (variables: UpdateTableVariables) => Promise<undefined>;
2729
2874
  getTableSchema: (variables: GetTableSchemaVariables) => Promise<GetTableSchemaResponse>;
@@ -2735,13 +2880,13 @@ declare const operationsByTag: {
2735
2880
  updateColumn: (variables: UpdateColumnVariables) => Promise<MigrationIdResponse>;
2736
2881
  };
2737
2882
  records: {
2738
- insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
2883
+ insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
2739
2884
  insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2740
2885
  updateRecordWithID: (variables: UpdateRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2741
2886
  upsertRecordWithID: (variables: UpsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2742
- deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
2887
+ deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
2743
2888
  getRecord: (variables: GetRecordVariables) => Promise<XataRecord$1>;
2744
- bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
2889
+ bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
2745
2890
  queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
2746
2891
  searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2747
2892
  searchBranch: (variables: SearchBranchVariables) => Promise<SearchResponse>;
@@ -2759,10 +2904,8 @@ interface XataApiClientOptions {
2759
2904
  fetch?: FetchImpl;
2760
2905
  apiKey?: string;
2761
2906
  host?: HostProvider;
2907
+ trace?: TraceFunction;
2762
2908
  }
2763
- /**
2764
- * @deprecated Use XataApiPlugin instead
2765
- */
2766
2909
  declare class XataApiClient {
2767
2910
  #private;
2768
2911
  constructor(options?: XataApiClientOptions);
@@ -2795,6 +2938,7 @@ declare class WorkspaceApi {
2795
2938
  updateWorkspaceMemberRole(workspaceId: WorkspaceID, userId: UserID, role: Role): Promise<void>;
2796
2939
  removeWorkspaceMember(workspaceId: WorkspaceID, userId: UserID): Promise<void>;
2797
2940
  inviteWorkspaceMember(workspaceId: WorkspaceID, email: string, role: Role): Promise<WorkspaceInvite>;
2941
+ updateWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID, role: Role): Promise<WorkspaceInvite>;
2798
2942
  cancelWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2799
2943
  resendWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2800
2944
  acceptWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteKey: InviteKey): Promise<void>;
@@ -2805,6 +2949,7 @@ declare class DatabaseApi {
2805
2949
  getDatabaseList(workspace: WorkspaceID): Promise<ListDatabasesResponse>;
2806
2950
  createDatabase(workspace: WorkspaceID, dbName: DBName, options?: CreateDatabaseRequestBody): Promise<CreateDatabaseResponse>;
2807
2951
  deleteDatabase(workspace: WorkspaceID, dbName: DBName): Promise<void>;
2952
+ getDatabaseMetadata(workspace: WorkspaceID, dbName: DBName): Promise<DatabaseMetadata>;
2808
2953
  getGitBranchesMapping(workspace: WorkspaceID, dbName: DBName): Promise<ListGitBranchesResponse>;
2809
2954
  addGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, body: AddGitBranchesEntryRequestBody): Promise<AddGitBranchesEntryResponse>;
2810
2955
  removeGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<void>;
@@ -2815,7 +2960,7 @@ declare class BranchApi {
2815
2960
  constructor(extraProps: FetcherExtraProps);
2816
2961
  getBranchList(workspace: WorkspaceID, dbName: DBName): Promise<ListBranchesResponse>;
2817
2962
  getBranchDetails(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<DBBranch>;
2818
- 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>;
2819
2964
  deleteBranch(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<void>;
2820
2965
  updateBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName, metadata?: BranchMetadata): Promise<void>;
2821
2966
  getBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<BranchMetadata>;
@@ -2827,7 +2972,7 @@ declare class BranchApi {
2827
2972
  declare class TableApi {
2828
2973
  private extraProps;
2829
2974
  constructor(extraProps: FetcherExtraProps);
2830
- createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
2975
+ createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<CreateTableResponse>;
2831
2976
  deleteTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
2832
2977
  updateTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, options: UpdateTableRequestBody): Promise<void>;
2833
2978
  getTableSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<GetTableSchemaResponse>;
@@ -2841,13 +2986,13 @@ declare class TableApi {
2841
2986
  declare class RecordsApi {
2842
2987
  private extraProps;
2843
2988
  constructor(extraProps: FetcherExtraProps);
2844
- 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>;
2845
2990
  insertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: InsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2846
2991
  updateRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpdateRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2847
2992
  upsertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2848
- deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID): Promise<void>;
2849
- getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordRequestBody): Promise<XataRecord$1>;
2850
- 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>;
2851
2996
  queryTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: QueryTableRequestBody): Promise<QueryResponse>;
2852
2997
  searchTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: SearchTableRequestBody): Promise<SearchResponse>;
2853
2998
  searchBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, query: SearchBranchRequestBody): Promise<SearchResponse>;
@@ -2863,19 +3008,20 @@ declare type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) ex
2863
3008
  declare type If<Condition, Then, Else> = Condition extends true ? Then : Else;
2864
3009
  declare type IsObject<T> = T extends Record<string, any> ? true : false;
2865
3010
  declare type IsArray<T> = T extends Array<any> ? true : false;
2866
- declare type NonEmptyArray<T> = T[] & {
2867
- 0: T;
2868
- };
2869
3011
  declare type RequiredBy<T, K extends keyof T> = T & {
2870
3012
  [P in K]-?: NonNullable<T[P]>;
2871
3013
  };
2872
3014
  declare type GetArrayInnerType<T extends readonly any[]> = T[number];
2873
3015
  declare type SingleOrArray<T> = T | T[];
2874
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;
2875
3021
 
2876
3022
  declare type SelectableColumn<O, RecursivePath extends any[] = []> = '*' | 'id' | DataProps<O> | NestedColumns<O, RecursivePath>;
2877
- declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord & UnionToIntersection<Values<{
2878
- [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>;
2879
3025
  }>>;
2880
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> ? {
2881
3027
  V: ValueAtColumn<Item, V>;
@@ -2911,41 +3057,68 @@ interface BaseData {
2911
3057
  /**
2912
3058
  * Represents a persisted record from the database.
2913
3059
  */
2914
- interface XataRecord<ExtraMetadata extends Record<string, unknown> = Record<string, unknown>> extends Identifiable {
3060
+ interface XataRecord<OriginalRecord extends XataRecord<any> = XataRecord<any>> extends Identifiable {
2915
3061
  /**
2916
3062
  * Get metadata of this record.
2917
3063
  */
2918
- getMetadata(): XataRecordMetadata & ExtraMetadata;
3064
+ getMetadata(): XataRecordMetadata;
2919
3065
  /**
2920
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, null if not found.
2921
3069
  */
2922
- 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, null if not found.
3074
+ */
3075
+ read(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2923
3076
  /**
2924
3077
  * Performs a partial update of the current record. On success a new object is
2925
3078
  * returned and the current object is not mutated.
2926
3079
  * @param partialUpdate The columns and their values that have to be updated.
2927
- * @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, null if not found.
3082
+ */
3083
+ update<K extends SelectableColumn<OriginalRecord>>(partialUpdate: Partial<EditableData<OriginalRecord>>, columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
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, null if not found.
2928
3089
  */
2929
- update(partialUpdate: Partial<EditableData<Omit<this, keyof XataRecord>>>): Promise<Readonly<SelectedPick<this, ['*']>>>;
3090
+ update(partialUpdate: Partial<EditableData<OriginalRecord>>): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2930
3091
  /**
2931
3092
  * Performs a deletion of the current record in the database.
2932
- *
2933
- * @throws If the record was already deleted or if an error happened while performing the deletion.
3093
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3094
+ * @returns The deleted record, null if not found.
2934
3095
  */
2935
- delete(): Promise<void>;
3096
+ delete<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
3097
+ /**
3098
+ * Performs a deletion of the current record in the database.
3099
+ * @returns The deleted record, null if not found.
3100
+
3101
+ */
3102
+ delete(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2936
3103
  }
2937
3104
  declare type Link<Record extends XataRecord> = Omit<XataRecord, 'read' | 'update'> & {
2938
3105
  /**
2939
3106
  * Retrieves a refreshed copy of the current record from the database.
2940
3107
  */
2941
- read(): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3108
+ read<K extends SelectableColumn<Record>>(columns?: K[]): Promise<Readonly<SelectedPick<Record, typeof columns extends SelectableColumn<Record>[] ? typeof columns : ['*']>> | null>;
2942
3109
  /**
2943
3110
  * Performs a partial update of the current record. On success a new object is
2944
3111
  * returned and the current object is not mutated.
2945
3112
  * @param partialUpdate The columns and their values that have to be updated.
2946
3113
  * @returns A new record containing the latest values for all the columns of the current record.
2947
3114
  */
2948
- update(partialUpdate: Partial<EditableData<Omit<Record, keyof XataRecord>>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3115
+ update<K extends SelectableColumn<Record>>(partialUpdate: Partial<EditableData<Record>>, columns?: K[]): Promise<Readonly<SelectedPick<Record, typeof columns extends SelectableColumn<Record>[] ? typeof columns : ['*']>>>;
3116
+ /**
3117
+ * Performs a deletion of the current record in the database.
3118
+ *
3119
+ * @throws If the record was already deleted or if an error happened while performing the deletion.
3120
+ */
3121
+ delete(): Promise<void>;
2949
3122
  };
2950
3123
  declare type XataRecordMetadata = {
2951
3124
  /**
@@ -2956,13 +3129,13 @@ declare type XataRecordMetadata = {
2956
3129
  };
2957
3130
  declare function isIdentifiable(x: any): x is Identifiable & Record<string, unknown>;
2958
3131
  declare function isXataRecord(x: any): x is XataRecord & Record<string, unknown>;
2959
- declare type EditableData<O extends BaseData> = {
3132
+ declare type EditableData<O extends XataRecord> = Identifiable & Omit<{
2960
3133
  [K in keyof O]: O[K] extends XataRecord ? {
2961
3134
  id: string;
2962
3135
  } | string : NonNullable<O[K]> extends XataRecord ? {
2963
3136
  id: string;
2964
3137
  } | string | null | undefined : O[K];
2965
- };
3138
+ }, keyof XataRecord>;
2966
3139
 
2967
3140
  /**
2968
3141
  * PropertyMatchFilter
@@ -3056,7 +3229,85 @@ declare type BaseApiFilter<Record> = PropertyAccessFilter<Record> | AggregatorFi
3056
3229
  declare type NestedApiFilter<T> = {
3057
3230
  [key in keyof T]?: T[key] extends Record<string, any> ? SingleOrArray<Filter<T[key]>> : PropertyFilter<T[key]>;
3058
3231
  };
3059
- declare type Filter<T> = T extends Record<string, any> ? BaseApiFilter<T> | NestedApiFilter<T> : PropertyFilter<T>;
3232
+ declare type Filter<T> = T extends Record<string, any> ? T extends Date ? PropertyFilter<T> : BaseApiFilter<T> | NestedApiFilter<T> : PropertyFilter<T>;
3233
+
3234
+ declare type DateBooster = {
3235
+ origin?: string;
3236
+ scale: string;
3237
+ decay: number;
3238
+ };
3239
+ declare type NumericBooster = {
3240
+ factor: number;
3241
+ };
3242
+ declare type ValueBooster<T extends string | number | boolean> = {
3243
+ value: T;
3244
+ factor: number;
3245
+ };
3246
+ declare type Boosters<O extends XataRecord> = Values<{
3247
+ [K in SelectableColumn<O>]: NonNullable<ValueAtColumn<O, K>> extends Date ? {
3248
+ dateBooster: {
3249
+ column: K;
3250
+ } & DateBooster;
3251
+ } : NonNullable<ValueAtColumn<O, K>> extends number ? ExclusiveOr<{
3252
+ numericBooster?: {
3253
+ column: K;
3254
+ } & NumericBooster;
3255
+ }, {
3256
+ valueBooster?: {
3257
+ column: K;
3258
+ } & ValueBooster<number>;
3259
+ }> : NonNullable<ValueAtColumn<O, K>> extends string | boolean ? {
3260
+ valueBooster: {
3261
+ column: K;
3262
+ } & ValueBooster<NonNullable<ValueAtColumn<O, K>>>;
3263
+ } : never;
3264
+ }>;
3265
+
3266
+ declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3267
+ fuzziness?: FuzzinessExpression;
3268
+ prefix?: PrefixExpression;
3269
+ highlight?: HighlightExpression;
3270
+ tables?: Array<Tables | Values<{
3271
+ [Model in GetArrayInnerType<NonNullable<Tables[]>>]: {
3272
+ table: Model;
3273
+ filter?: Filter<SelectedPick<Schemas[Model] & XataRecord, ['*']>>;
3274
+ boosters?: Boosters<Schemas[Model] & XataRecord>[];
3275
+ };
3276
+ }>>;
3277
+ };
3278
+ declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3279
+ all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3280
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]: {
3281
+ table: Model;
3282
+ record: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>>;
3283
+ };
3284
+ }>[]>;
3285
+ byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3286
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]?: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>[]>;
3287
+ }>;
3288
+ };
3289
+ declare class SearchPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin {
3290
+ #private;
3291
+ private db;
3292
+ constructor(db: SchemaPluginResult<Schemas>, schemaTables?: Schemas.Table[]);
3293
+ build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
3294
+ }
3295
+ declare type SearchXataRecord<Record extends XataRecord> = Omit<Record, 'getMetadata'> & {
3296
+ getMetadata: () => XataRecordMetadata & SearchExtraProperties;
3297
+ };
3298
+ declare type SearchExtraProperties = {
3299
+ table: string;
3300
+ highlight?: {
3301
+ [key: string]: string[] | {
3302
+ [key: string]: any;
3303
+ };
3304
+ };
3305
+ score?: number;
3306
+ };
3307
+ declare type ReturnTable<Table, Tables> = Table extends Tables ? Table : never;
3308
+ 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 {
3309
+ table: infer Table;
3310
+ } ? ReturnTable<Table, Tables> : never;
3060
3311
 
3061
3312
  declare type SortDirection = 'asc' | 'desc';
3062
3313
  declare type SortFilterExtended<T extends XataRecord> = {
@@ -3069,7 +3320,7 @@ declare type SortFilterBase<T extends XataRecord> = {
3069
3320
  };
3070
3321
 
3071
3322
  declare type BaseOptions<T extends XataRecord> = {
3072
- columns?: NonEmptyArray<SelectableColumn<T>>;
3323
+ columns?: SelectableColumn<T>[];
3073
3324
  cache?: number;
3074
3325
  };
3075
3326
  declare type CursorQueryOptions = {
@@ -3132,7 +3383,7 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3132
3383
  * @param value The value to filter.
3133
3384
  * @returns A new Query object.
3134
3385
  */
3135
- filter<F extends SelectableColumn<Record>>(column: F, value: Filter<ValueAtColumn<Record, F>>): Query<Record, Result>;
3386
+ filter<F extends SelectableColumn<Record>>(column: F, value: Filter<NonNullable<ValueAtColumn<Record, F>>>): Query<Record, Result>;
3136
3387
  /**
3137
3388
  * Builds a new query object adding one or more constraints. Examples:
3138
3389
  *
@@ -3153,13 +3404,13 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3153
3404
  * @param direction The direction. Either ascending or descending.
3154
3405
  * @returns A new Query object.
3155
3406
  */
3156
- sort<F extends SelectableColumn<Record>>(column: F, direction: SortDirection): Query<Record, Result>;
3407
+ sort<F extends SelectableColumn<Record>>(column: F, direction?: SortDirection): Query<Record, Result>;
3157
3408
  /**
3158
3409
  * Builds a new query specifying the set of columns to be returned in the query response.
3159
3410
  * @param columns Array of column names to be returned by the query.
3160
3411
  * @returns A new Query object.
3161
3412
  */
3162
- select<K extends SelectableColumn<Record>>(columns: NonEmptyArray<K>): Query<Record, SelectedPick<Record, NonEmptyArray<K>>>;
3413
+ select<K extends SelectableColumn<Record>>(columns: K[]): Query<Record, SelectedPick<Record, K[]>>;
3163
3414
  /**
3164
3415
  * Get paginated results
3165
3416
  *
@@ -3221,13 +3472,13 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3221
3472
  * @param options Additional options to be used when performing the query.
3222
3473
  * @returns An array of records from the database.
3223
3474
  */
3224
- getMany(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<RecordArray<Result>>;
3475
+ getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<RecordArray<SelectedPick<Record, typeof options['columns']>>>;
3225
3476
  /**
3226
3477
  * Performs the query in the database and returns a set of results.
3227
3478
  * @param options Additional options to be used when performing the query.
3228
3479
  * @returns An array of records from the database.
3229
3480
  */
3230
- getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<RecordArray<SelectedPick<Record, typeof options['columns']>>>;
3481
+ getMany(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<RecordArray<Result>>;
3231
3482
  /**
3232
3483
  * Performs the query in the database and returns all the results.
3233
3484
  * Warning: If there are a large number of results, this method can have performance implications.
@@ -3240,18 +3491,18 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3240
3491
  * @param options Additional options to be used when performing the query.
3241
3492
  * @returns An array of records from the database.
3242
3493
  */
3243
- getAll(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
3494
+ getAll<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
3244
3495
  batchSize?: number;
3245
- }): Promise<Result[]>;
3496
+ }>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
3246
3497
  /**
3247
3498
  * Performs the query in the database and returns all the results.
3248
3499
  * Warning: If there are a large number of results, this method can have performance implications.
3249
3500
  * @param options Additional options to be used when performing the query.
3250
3501
  * @returns An array of records from the database.
3251
3502
  */
3252
- getAll<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
3503
+ getAll(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
3253
3504
  batchSize?: number;
3254
- }>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
3505
+ }): Promise<Result[]>;
3255
3506
  /**
3256
3507
  * Performs the query in the database and returns the first result.
3257
3508
  * @returns The first record that matches the query, or null if no record matched the query.
@@ -3262,13 +3513,13 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3262
3513
  * @param options Additional options to be used when performing the query.
3263
3514
  * @returns The first record that matches the query, or null if no record matched the query.
3264
3515
  */
3265
- getFirst(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result | null>;
3516
+ getFirst<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
3266
3517
  /**
3267
3518
  * Performs the query in the database and returns the first result.
3268
3519
  * @param options Additional options to be used when performing the query.
3269
3520
  * @returns The first record that matches the query, or null if no record matched the query.
3270
3521
  */
3271
- getFirst<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
3522
+ getFirst(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result | null>;
3272
3523
  /**
3273
3524
  * Builds a new query object adding a cache TTL in milliseconds.
3274
3525
  * @param ttl The cache TTL in milliseconds.
@@ -3390,6 +3641,8 @@ declare class RecordArray<Result extends XataRecord> extends Array<Result> {
3390
3641
  #private;
3391
3642
  constructor(page: Paginable<any, Result>, overrideRecords?: Result[]);
3392
3643
  static parseConstructorParams(...args: any[]): any[];
3644
+ toArray(): Result[];
3645
+ map<U>(callbackfn: (value: Result, index: number, array: Result[]) => U, thisArg?: any): U[];
3393
3646
  /**
3394
3647
  * Retrieve next page of records
3395
3648
  *
@@ -3423,21 +3676,44 @@ declare class RecordArray<Result extends XataRecord> extends Array<Result> {
3423
3676
  /**
3424
3677
  * Common interface for performing operations on a table.
3425
3678
  */
3426
- declare abstract class Repository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
3427
- abstract create(object: EditableData<Data> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3679
+ declare abstract class Repository<Record extends XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
3680
+ abstract create<K extends SelectableColumn<Record>>(object: Omit<EditableData<Record>, 'id'> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3681
+ abstract create(object: Omit<EditableData<Record>, 'id'> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3428
3682
  /**
3429
3683
  * Creates a single record in the table with a unique id.
3430
3684
  * @param id The unique id.
3431
3685
  * @param object Object containing the column names with their values to be stored in the table.
3686
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3432
3687
  * @returns The full persisted record.
3433
3688
  */
3434
- abstract create(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3689
+ abstract create<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3690
+ /**
3691
+ * Creates a single record in the table with a unique id.
3692
+ * @param id The unique id.
3693
+ * @param object Object containing the column names with their values to be stored in the table.
3694
+ * @returns The full persisted record.
3695
+ */
3696
+ abstract create(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3435
3697
  /**
3436
3698
  * Creates multiple records in the table.
3437
3699
  * @param objects Array of objects with the column names and the values to be stored in the table.
3438
- * @returns Array of the persisted records.
3700
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3701
+ * @returns Array of the persisted records in order.
3439
3702
  */
3440
- abstract create(objects: Array<EditableData<Data> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3703
+ abstract create<K extends SelectableColumn<Record>>(objects: Array<Omit<EditableData<Record>, 'id'> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3704
+ /**
3705
+ * Creates multiple records in the table.
3706
+ * @param objects Array of objects with the column names and the values to be stored in the table.
3707
+ * @returns Array of the persisted records in order.
3708
+ */
3709
+ abstract create(objects: Array<Omit<EditableData<Record>, 'id'> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3710
+ /**
3711
+ * Queries a single record from the table given its unique id.
3712
+ * @param id The unique id.
3713
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3714
+ * @returns The persisted record for the given id or null if the record could not be found.
3715
+ */
3716
+ abstract read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
3441
3717
  /**
3442
3718
  * Queries a single record from the table given its unique id.
3443
3719
  * @param id The unique id.
@@ -3447,9 +3723,23 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3447
3723
  /**
3448
3724
  * Queries multiple records from the table given their unique id.
3449
3725
  * @param ids The unique ids array.
3450
- * @returns The persisted records for the given ids (if a record could not be found it is not returned).
3726
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
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<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3730
+ /**
3731
+ * Queries multiple records from the table given their unique id.
3732
+ * @param ids The unique ids array.
3733
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
3451
3734
  */
3452
- abstract read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3735
+ abstract read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3736
+ /**
3737
+ * Queries a single record from the table by the id in the object.
3738
+ * @param object Object containing the id of the record.
3739
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3740
+ * @returns The persisted record for the given id or null if the record could not be found.
3741
+ */
3742
+ abstract read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
3453
3743
  /**
3454
3744
  * Queries a single record from the table by the id in the object.
3455
3745
  * @param object Object containing the id of the record.
@@ -3459,74 +3749,156 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3459
3749
  /**
3460
3750
  * Queries multiple records from the table by the ids in the objects.
3461
3751
  * @param objects Array of objects containing the ids of the records.
3462
- * @returns The persisted records for the given ids (if a record could not be found it is not returned).
3752
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
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<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3756
+ /**
3757
+ * Queries multiple records from the table by the ids in the objects.
3758
+ * @param objects Array of objects containing the ids of the records.
3759
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
3463
3760
  */
3464
- abstract read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3761
+ abstract read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3465
3762
  /**
3466
3763
  * Partially update a single record.
3467
3764
  * @param object An object with its id and the columns to be updated.
3468
- * @returns The full persisted record.
3765
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3766
+ * @returns The full persisted record, null if the record could not be found.
3767
+ */
3768
+ abstract update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3769
+ /**
3770
+ * Partially update a single record.
3771
+ * @param object An object with its id and the columns to be updated.
3772
+ * @returns The full persisted record, null if the record could not be found.
3469
3773
  */
3470
- abstract update(object: Partial<EditableData<Data>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3774
+ abstract update(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3471
3775
  /**
3472
3776
  * Partially update a single record given its unique id.
3473
3777
  * @param id The unique id.
3474
3778
  * @param object The column names and their values that have to be updated.
3475
- * @returns The full persisted record.
3779
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3780
+ * @returns The full persisted record, null if the record could not be found.
3476
3781
  */
3477
- abstract update(id: string, object: Partial<EditableData<Data>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3782
+ abstract update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3783
+ /**
3784
+ * Partially update a single record given its unique id.
3785
+ * @param id The unique id.
3786
+ * @param object The column names and their values that have to be updated.
3787
+ * @returns The full persisted record, null if the record could not be found.
3788
+ */
3789
+ abstract update(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3478
3790
  /**
3479
3791
  * Partially updates multiple records.
3480
3792
  * @param objects An array of objects with their ids and columns to be updated.
3481
- * @returns Array of the persisted records.
3793
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3794
+ * @returns Array of the persisted records in order (if a record could not be found null is returned).
3482
3795
  */
3483
- abstract update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3796
+ abstract update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3797
+ /**
3798
+ * Partially updates multiple records.
3799
+ * @param objects An array of objects with their ids and columns to be updated.
3800
+ * @returns Array of the persisted records in order (if a record could not be found null is returned).
3801
+ */
3802
+ abstract update(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3484
3803
  /**
3485
3804
  * Creates or updates a single record. If a record exists with the given id,
3486
3805
  * it will be update, otherwise a new record will be created.
3487
3806
  * @param object Object containing the column names with their values to be persisted in the table.
3807
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3488
3808
  * @returns The full persisted record.
3489
3809
  */
3490
- abstract createOrUpdate(object: EditableData<Data> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3810
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Record> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3811
+ /**
3812
+ * Creates or updates a single record. If a record exists with the given id,
3813
+ * it will be update, otherwise a new record will be created.
3814
+ * @param object Object containing the column names with their values to be persisted in the table.
3815
+ * @returns The full persisted record.
3816
+ */
3817
+ abstract createOrUpdate(object: EditableData<Record> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3491
3818
  /**
3492
3819
  * Creates or updates a single record. If a record exists with the given id,
3493
3820
  * it will be update, otherwise a new record will be created.
3494
3821
  * @param id A unique id.
3495
3822
  * @param object The column names and the values to be persisted.
3823
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3496
3824
  * @returns The full persisted record.
3497
3825
  */
3498
- abstract createOrUpdate(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3826
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3827
+ /**
3828
+ * Creates or updates a single record. If a record exists with the given id,
3829
+ * it will be update, otherwise a new record will be created.
3830
+ * @param id A unique id.
3831
+ * @param object The column names and the values to be persisted.
3832
+ * @returns The full persisted record.
3833
+ */
3834
+ abstract createOrUpdate(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3835
+ /**
3836
+ * Creates or updates a single record. If a record exists with the given id,
3837
+ * it will be update, otherwise a new record will be created.
3838
+ * @param objects Array of objects with the column names and the values to be stored in the table.
3839
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3840
+ * @returns Array of the persisted records.
3841
+ */
3842
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3499
3843
  /**
3500
3844
  * Creates or updates a single record. If a record exists with the given id,
3501
3845
  * it will be update, otherwise a new record will be created.
3502
3846
  * @param objects Array of objects with the column names and the values to be stored in the table.
3503
3847
  * @returns Array of the persisted records.
3504
3848
  */
3505
- abstract createOrUpdate(objects: Array<EditableData<Data> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3849
+ abstract createOrUpdate(objects: Array<EditableData<Record> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3506
3850
  /**
3507
3851
  * Deletes a record given its unique id.
3508
- * @param id The unique id.
3509
- * @throws If the record could not be found or there was an error while performing the deletion.
3852
+ * @param object An object with a unique id.
3853
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3854
+ * @returns The deleted record, null if the record could not be found.
3510
3855
  */
3511
- abstract delete(id: string): Promise<void>;
3856
+ abstract delete<K extends SelectableColumn<Record>>(object: Identifiable & Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3512
3857
  /**
3513
3858
  * Deletes a record given its unique id.
3514
- * @param id An object with a unique id.
3515
- * @throws If the record could not be found or there was an error while performing the deletion.
3859
+ * @param object An object with a unique id.
3860
+ * @returns The deleted record, null if the record could not be found.
3861
+ */
3862
+ abstract delete(object: Identifiable & Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3863
+ /**
3864
+ * Deletes a record given a unique id.
3865
+ * @param id The unique id.
3866
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3867
+ * @returns The deleted record, null if the record could not be found.
3516
3868
  */
3517
- abstract delete(id: Identifiable): Promise<void>;
3869
+ abstract delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3518
3870
  /**
3519
- * Deletes a record given a list of unique ids.
3520
- * @param ids The array of unique ids.
3521
- * @throws If the record could not be found or there was an error while performing the deletion.
3871
+ * Deletes a record given a unique id.
3872
+ * @param id The unique id.
3873
+ * @returns The deleted record, null if the record could not be found.
3522
3874
  */
3523
- abstract delete(ids: string[]): Promise<void>;
3875
+ abstract delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3524
3876
  /**
3525
- * Deletes a record given a list of unique ids.
3526
- * @param ids An array of objects with unique ids.
3527
- * @throws If the record could not be found or there was an error while performing the deletion.
3877
+ * Deletes multiple records given an array of objects with ids.
3878
+ * @param objects An array of objects with unique ids.
3879
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3880
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
3528
3881
  */
3529
- abstract delete(ids: Identifiable[]): Promise<void>;
3882
+ abstract delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3883
+ /**
3884
+ * Deletes multiple records given an array of objects with ids.
3885
+ * @param objects An array of objects with unique ids.
3886
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
3887
+ */
3888
+ abstract delete(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3889
+ /**
3890
+ * Deletes multiple records given an array of unique ids.
3891
+ * @param objects An array of ids.
3892
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3893
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
3894
+ */
3895
+ abstract delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3896
+ /**
3897
+ * Deletes multiple records given an array of unique ids.
3898
+ * @param objects An array of ids.
3899
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
3900
+ */
3901
+ abstract delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3530
3902
  /**
3531
3903
  * Search for records in the table.
3532
3904
  * @param query The query to search for.
@@ -3535,41 +3907,122 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3535
3907
  */
3536
3908
  abstract search(query: string, options?: {
3537
3909
  fuzziness?: FuzzinessExpression;
3910
+ prefix?: PrefixExpression;
3538
3911
  highlight?: HighlightExpression;
3539
3912
  filter?: Filter<Record>;
3540
- }): Promise<SelectedPick<Record, ['*']>[]>;
3913
+ boosters?: Boosters<Record>[];
3914
+ }): Promise<SearchXataRecord<SelectedPick<Record, ['*']>>[]>;
3541
3915
  abstract query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3542
3916
  }
3543
- declare class RestRepository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Data, Record> {
3917
+ declare class RestRepository<Record extends XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Record> {
3544
3918
  #private;
3545
- db: SchemaPluginResult<any>;
3546
3919
  constructor(options: {
3547
3920
  table: string;
3548
3921
  db: SchemaPluginResult<any>;
3549
3922
  pluginOptions: XataPluginOptions;
3923
+ schemaTables?: Table[];
3550
3924
  });
3551
- create(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3552
- create(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3553
- create(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3554
- read(recordId: string): Promise<SelectedPick<Record, ['*']> | null>;
3555
- read(recordIds: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3556
- read(object: Identifiable): Promise<SelectedPick<Record, ['*']> | null>;
3557
- read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3558
- update(object: Partial<EditableData<Data>> & Identifiable): Promise<SelectedPick<Record, ['*']>>;
3559
- update(recordId: string, object: Partial<EditableData<Data>>): Promise<SelectedPick<Record, ['*']>>;
3560
- update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<SelectedPick<Record, ['*']>[]>;
3561
- createOrUpdate(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3562
- createOrUpdate(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3563
- createOrUpdate(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3564
- delete(a: string | Identifiable | Array<string | Identifiable>): Promise<void>;
3925
+ create<K extends SelectableColumn<Record>>(object: EditableData<Record> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3926
+ create(object: EditableData<Record> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3927
+ create<K extends SelectableColumn<Record>>(id: string, object: EditableData<Record>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3928
+ create(id: string, object: EditableData<Record>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3929
+ create<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3930
+ create(objects: Array<EditableData<Record> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3931
+ read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
3932
+ read(id: string): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
3933
+ read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3934
+ read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3935
+ read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
3936
+ read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
3937
+ read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3938
+ read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3939
+ update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3940
+ update(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3941
+ update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3942
+ update(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3943
+ update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3944
+ update(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3945
+ createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Record> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3946
+ createOrUpdate(object: EditableData<Record> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3947
+ createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3948
+ createOrUpdate(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3949
+ createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3950
+ createOrUpdate(objects: Array<EditableData<Record> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3951
+ delete<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3952
+ delete(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3953
+ delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3954
+ delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3955
+ delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3956
+ delete(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3957
+ delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3958
+ delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3565
3959
  search(query: string, options?: {
3566
3960
  fuzziness?: FuzzinessExpression;
3961
+ prefix?: PrefixExpression;
3567
3962
  highlight?: HighlightExpression;
3568
3963
  filter?: Filter<Record>;
3569
- }): Promise<SelectedPick<Record, ['*']>[]>;
3964
+ boosters?: Boosters<Record>[];
3965
+ }): Promise<any>;
3570
3966
  query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3571
3967
  }
3572
3968
 
3969
+ declare type BaseSchema = {
3970
+ name: string;
3971
+ columns: readonly ({
3972
+ name: string;
3973
+ type: Column['type'];
3974
+ } | {
3975
+ name: string;
3976
+ type: 'link';
3977
+ link: {
3978
+ table: string;
3979
+ };
3980
+ } | {
3981
+ name: string;
3982
+ type: 'object';
3983
+ columns: {
3984
+ name: string;
3985
+ type: string;
3986
+ }[];
3987
+ })[];
3988
+ };
3989
+ declare type SchemaInference<T extends readonly BaseSchema[]> = T extends never[] ? Record<string, Record<string, any>> : T extends readonly unknown[] ? T[number] extends {
3990
+ name: string;
3991
+ columns: readonly unknown[];
3992
+ } ? {
3993
+ [K in T[number]['name']]: TableType<T[number], K>;
3994
+ } : never : never;
3995
+ declare type TableType<Tables, TableName> = Tables & {
3996
+ name: TableName;
3997
+ } extends infer Table ? Table extends {
3998
+ name: string;
3999
+ columns: infer Columns;
4000
+ } ? Columns extends readonly unknown[] ? Columns[number] extends {
4001
+ name: string;
4002
+ type: string;
4003
+ } ? Identifiable & {
4004
+ [K in Columns[number]['name']]?: PropertyType<Tables, Columns[number], K>;
4005
+ } : never : never : never : never;
4006
+ declare type PropertyType<Tables, Properties, PropertyName> = Properties & {
4007
+ name: PropertyName;
4008
+ } extends infer Property ? Property extends {
4009
+ name: string;
4010
+ type: infer Type;
4011
+ link?: {
4012
+ table: infer LinkedTable;
4013
+ };
4014
+ columns?: infer ObjectColumns;
4015
+ } ? (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 {
4016
+ name: string;
4017
+ type: string;
4018
+ } ? {
4019
+ [K in ObjectColumns[number]['name']]?: PropertyType<Tables, ObjectColumns[number], K>;
4020
+ } : never : never : Type extends 'link' ? TableType<Tables, LinkedTable> & XataRecord : never) | null : never : never;
4021
+
4022
+ /**
4023
+ * Operator to restrict results to only values that are greater than the given value.
4024
+ */
4025
+ declare const greaterThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3573
4026
  /**
3574
4027
  * Operator to restrict results to only values that are greater than the given value.
3575
4028
  */
@@ -3577,15 +4030,35 @@ declare const gt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T
3577
4030
  /**
3578
4031
  * Operator to restrict results to only values that are greater than or equal to the given value.
3579
4032
  */
3580
- declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4033
+ declare const greaterThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4034
+ /**
4035
+ * Operator to restrict results to only values that are greater than or equal to the given value.
4036
+ */
4037
+ declare const greaterEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3581
4038
  /**
3582
4039
  * Operator to restrict results to only values that are greater than or equal to the given value.
3583
4040
  */
3584
4041
  declare const gte: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4042
+ /**
4043
+ * Operator to restrict results to only values that are greater than or equal to the given value.
4044
+ */
4045
+ declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4046
+ /**
4047
+ * Operator to restrict results to only values that are lower than the given value.
4048
+ */
4049
+ declare const lessThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3585
4050
  /**
3586
4051
  * Operator to restrict results to only values that are lower than the given value.
3587
4052
  */
3588
4053
  declare const lt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4054
+ /**
4055
+ * Operator to restrict results to only values that are lower than or equal to the given value.
4056
+ */
4057
+ declare const lessThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4058
+ /**
4059
+ * Operator to restrict results to only values that are lower than or equal to the given value.
4060
+ */
4061
+ declare const lessEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3589
4062
  /**
3590
4063
  * Operator to restrict results to only values that are lower than or equal to the given value.
3591
4064
  */
@@ -3618,6 +4091,10 @@ declare const pattern: (value: string) => StringTypeFilter;
3618
4091
  * Operator to restrict results to only values that are equal to the given value.
3619
4092
  */
3620
4093
  declare const is: <T>(value: T) => PropertyFilter<T>;
4094
+ /**
4095
+ * Operator to restrict results to only values that are equal to the given value.
4096
+ */
4097
+ declare const equals: <T>(value: T) => PropertyFilter<T>;
3621
4098
  /**
3622
4099
  * Operator to restrict results to only values that are not equal to the given value.
3623
4100
  */
@@ -3646,59 +4123,17 @@ declare const includesAny: <T>(value: T) => ArrayFilter<T>;
3646
4123
  declare type SchemaDefinition = {
3647
4124
  table: string;
3648
4125
  };
3649
- declare type SchemaPluginResult<Schemas extends Record<string, BaseData>> = {
4126
+ declare type SchemaPluginResult<Schemas extends Record<string, XataRecord>> = {
3650
4127
  [Key in keyof Schemas]: Repository<Schemas[Key]>;
3651
4128
  } & {
3652
- [key: string]: Repository<XataRecord$1>;
4129
+ [key: string]: Repository<XataRecord>;
3653
4130
  };
3654
- declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
4131
+ declare class SchemaPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin {
3655
4132
  #private;
3656
- private tableNames?;
3657
- constructor(tableNames?: string[] | undefined);
4133
+ constructor(schemaTables?: Schemas.Table[]);
3658
4134
  build(pluginOptions: XataPluginOptions): SchemaPluginResult<Schemas>;
3659
4135
  }
3660
4136
 
3661
- declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3662
- fuzziness?: FuzzinessExpression;
3663
- highlight?: HighlightExpression;
3664
- tables?: Array<Tables | Values<{
3665
- [Model in GetArrayInnerType<NonNullable<Tables[]>>]: {
3666
- table: Model;
3667
- filter?: Filter<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>>;
3668
- };
3669
- }>>;
3670
- };
3671
- declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3672
- all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3673
- [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]: {
3674
- table: Model;
3675
- record: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>>;
3676
- };
3677
- }>[]>;
3678
- byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3679
- [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]?: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>[]>;
3680
- }>;
3681
- };
3682
- declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
3683
- #private;
3684
- private db;
3685
- constructor(db: SchemaPluginResult<Schemas>);
3686
- build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
3687
- }
3688
- declare type SearchXataRecord = XataRecord<SearchExtraProperties>;
3689
- declare type SearchExtraProperties = {
3690
- table: string;
3691
- highlight?: {
3692
- [key: string]: string[] | {
3693
- [key: string]: any;
3694
- };
3695
- };
3696
- };
3697
- declare type ReturnTable<Table, Tables> = Table extends Tables ? Table : never;
3698
- 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 {
3699
- table: infer Table;
3700
- } ? ReturnTable<Table, Tables> : never;
3701
-
3702
4137
  declare type BranchStrategyValue = string | undefined | null;
3703
4138
  declare type BranchStrategyBuilder = () => BranchStrategyValue | Promise<BranchStrategyValue>;
3704
4139
  declare type BranchStrategy = BranchStrategyValue | BranchStrategyBuilder;
@@ -3710,20 +4145,35 @@ declare type BaseClientOptions = {
3710
4145
  databaseURL?: string;
3711
4146
  branch?: BranchStrategyOption;
3712
4147
  cache?: CacheImpl;
4148
+ trace?: TraceFunction;
3713
4149
  };
3714
4150
  declare const buildClient: <Plugins extends Record<string, XataPlugin> = {}>(plugins?: Plugins | undefined) => ClientConstructor<Plugins>;
3715
4151
  interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
3716
- new <Schemas extends Record<string, BaseData> = {}>(options?: Partial<BaseClientOptions>, tables?: string[]): Omit<{
4152
+ new <Schemas extends Record<string, XataRecord> = {}>(options?: Partial<BaseClientOptions>, schemaTables?: readonly BaseSchema[]): Omit<{
3717
4153
  db: Awaited<ReturnType<SchemaPlugin<Schemas>['build']>>;
3718
4154
  search: Awaited<ReturnType<SearchPlugin<Schemas>['build']>>;
3719
4155
  }, keyof Plugins> & {
3720
4156
  [Key in StringKeys<NonNullable<Plugins>>]: Awaited<ReturnType<NonNullable<Plugins>[Key]['build']>>;
4157
+ } & {
4158
+ getConfig(): Promise<{
4159
+ databaseURL: string;
4160
+ branch: string;
4161
+ }>;
3721
4162
  };
3722
4163
  }
3723
4164
  declare const BaseClient_base: ClientConstructor<{}>;
3724
4165
  declare class BaseClient extends BaseClient_base<Record<string, any>> {
3725
4166
  }
3726
4167
 
4168
+ declare class Serializer {
4169
+ classes: Record<string, any>;
4170
+ add(clazz: any): void;
4171
+ toJSON<T>(data: T): string;
4172
+ fromJSON<T>(json: string): T;
4173
+ }
4174
+ declare const serialize: <T>(data: T) => string;
4175
+ declare const deserialize: <T>(json: string) => T;
4176
+
3727
4177
  declare type BranchResolutionOptions = {
3728
4178
  databaseURL?: string;
3729
4179
  apiKey?: string;
@@ -3735,9 +4185,89 @@ declare function getDatabaseURL(): string | undefined;
3735
4185
 
3736
4186
  declare function getAPIKey(): string | undefined;
3737
4187
 
4188
+ interface Body {
4189
+ arrayBuffer(): Promise<ArrayBuffer>;
4190
+ blob(): Promise<Blob>;
4191
+ formData(): Promise<FormData>;
4192
+ json(): Promise<any>;
4193
+ text(): Promise<string>;
4194
+ }
4195
+ interface Blob {
4196
+ readonly size: number;
4197
+ readonly type: string;
4198
+ arrayBuffer(): Promise<ArrayBuffer>;
4199
+ slice(start?: number, end?: number, contentType?: string): Blob;
4200
+ text(): Promise<string>;
4201
+ }
4202
+ /** Provides information about files and allows JavaScript in a web page to access their content. */
4203
+ interface File extends Blob {
4204
+ readonly lastModified: number;
4205
+ readonly name: string;
4206
+ readonly webkitRelativePath: string;
4207
+ }
4208
+ declare type FormDataEntryValue = File | string;
4209
+ /** 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". */
4210
+ interface FormData {
4211
+ append(name: string, value: string | Blob, fileName?: string): void;
4212
+ delete(name: string): void;
4213
+ get(name: string): FormDataEntryValue | null;
4214
+ getAll(name: string): FormDataEntryValue[];
4215
+ has(name: string): boolean;
4216
+ set(name: string, value: string | Blob, fileName?: string): void;
4217
+ forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void;
4218
+ }
4219
+ /** 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. */
4220
+ interface Headers {
4221
+ append(name: string, value: string): void;
4222
+ delete(name: string): void;
4223
+ get(name: string): string | null;
4224
+ has(name: string): boolean;
4225
+ set(name: string, value: string): void;
4226
+ forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void;
4227
+ }
4228
+ interface Request extends Body {
4229
+ /** Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching. */
4230
+ readonly cache: 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload';
4231
+ /** 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. */
4232
+ readonly credentials: 'include' | 'omit' | 'same-origin';
4233
+ /** Returns the kind of resource requested by request, e.g., "document" or "script". */
4234
+ readonly destination: '' | 'audio' | 'audioworklet' | 'document' | 'embed' | 'font' | 'frame' | 'iframe' | 'image' | 'manifest' | 'object' | 'paintworklet' | 'report' | 'script' | 'sharedworker' | 'style' | 'track' | 'video' | 'worker' | 'xslt';
4235
+ /** 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. */
4236
+ readonly headers: Headers;
4237
+ /** 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] */
4238
+ readonly integrity: string;
4239
+ /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
4240
+ readonly keepalive: boolean;
4241
+ /** Returns request's HTTP method, which is "GET" by default. */
4242
+ readonly method: string;
4243
+ /** 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. */
4244
+ readonly mode: 'cors' | 'navigate' | 'no-cors' | 'same-origin';
4245
+ /** 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. */
4246
+ readonly redirect: 'error' | 'follow' | 'manual';
4247
+ /** 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. */
4248
+ readonly referrer: string;
4249
+ /** Returns the referrer policy associated with request. This is used during fetching to compute the value of the request's referrer. */
4250
+ readonly referrerPolicy: '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
4251
+ /** Returns the URL of request as a string. */
4252
+ readonly url: string;
4253
+ clone(): Request;
4254
+ }
4255
+
4256
+ declare type XataWorkerContext<XataClient> = {
4257
+ xata: XataClient;
4258
+ request: Request;
4259
+ env: Record<string, string | undefined>;
4260
+ };
4261
+ declare type RemoveFirst<T> = T extends [any, ...infer U] ? U : never;
4262
+ declare type WorkerRunnerConfig = {
4263
+ workspace: string;
4264
+ worker: string;
4265
+ };
4266
+ 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>>>;
4267
+
3738
4268
  declare class XataError extends Error {
3739
4269
  readonly status: number;
3740
4270
  constructor(message: string, status: number);
3741
4271
  }
3742
4272
 
3743
- 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 };
4273
+ 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 };