@xata.io/client 0.0.0-alpha.vfde9dcf → 0.0.0-alpha.vfeb24b1

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,7 +11,11 @@ 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>;
16
+ headers?: {
17
+ get(name: string): string | null;
18
+ };
9
19
  }>;
10
20
  declare type WorkspaceApiUrlBuilder = (path: string, pathParams: Record<string, string>) => string;
11
21
  declare type FetcherExtraProps = {
@@ -13,6 +23,7 @@ declare type FetcherExtraProps = {
13
23
  workspacesApiUrl: string | WorkspaceApiUrlBuilder;
14
24
  fetchImpl: FetchImpl;
15
25
  apiKey: string;
26
+ trace: TraceFunction;
16
27
  };
17
28
  declare type ErrorWrapper<TError> = TError | {
18
29
  status: 'unknown';
@@ -20,7 +31,6 @@ declare type ErrorWrapper<TError> = TError | {
20
31
  };
21
32
 
22
33
  interface CacheImpl {
23
- cacheRecords: boolean;
24
34
  defaultQueryTTL: number;
25
35
  getAll(): Promise<Record<string, unknown>>;
26
36
  get: <T>(key: string) => Promise<T | null>;
@@ -30,13 +40,11 @@ interface CacheImpl {
30
40
  }
31
41
  interface SimpleCacheOptions {
32
42
  max?: number;
33
- cacheRecords?: boolean;
34
43
  defaultQueryTTL?: number;
35
44
  }
36
45
  declare class SimpleCache implements CacheImpl {
37
46
  #private;
38
47
  capacity: number;
39
- cacheRecords: boolean;
40
48
  defaultQueryTTL: number;
41
49
  constructor(options?: SimpleCacheOptions);
42
50
  getAll(): Promise<Record<string, unknown>>;
@@ -52,6 +60,7 @@ declare abstract class XataPlugin {
52
60
  declare type XataPluginOptions = {
53
61
  getFetchProps: () => Promise<FetcherExtraProps>;
54
62
  cache: CacheImpl;
63
+ trace?: TraceFunction;
55
64
  };
56
65
 
57
66
  /**
@@ -122,16 +131,20 @@ declare type WorkspaceMembers = {
122
131
  * @pattern ^ik_[a-zA-Z0-9]+
123
132
  */
124
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
+ };
125
146
  declare type ListDatabasesResponse = {
126
- databases?: {
127
- name: string;
128
- displayName: string;
129
- createdAt: DateTime;
130
- numberOfBranches: number;
131
- ui?: {
132
- color?: string;
133
- };
134
- }[];
147
+ databases?: DatabaseMetadata[];
135
148
  };
136
149
  declare type ListBranchesResponse = {
137
150
  databaseName: string;
@@ -279,6 +292,10 @@ declare type SortOrder = 'asc' | 'desc';
279
292
  * @minimum 0
280
293
  */
281
294
  declare type FuzzinessExpression = number;
295
+ /**
296
+ * If the prefix type is set to "disabled" (the default), the search only matches full words. If the prefix type is set to "phrase", the search will return results that match prefixes of the search phrase.
297
+ */
298
+ declare type PrefixExpression = 'phrase' | 'disabled';
282
299
  /**
283
300
  * @minProperties 1
284
301
  */
@@ -292,6 +309,48 @@ declare type FilterExpression = {
292
309
  } & {
293
310
  [key: string]: FilterColumn;
294
311
  };
312
+ declare type HighlightExpression = {
313
+ enabled?: boolean;
314
+ encodeHTML?: boolean;
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
+ };
295
354
  declare type FilterList = FilterExpression | FilterExpression[];
296
355
  declare type FilterColumn = FilterColumnIncludes | FilterPredicate | FilterList;
297
356
  /**
@@ -348,7 +407,24 @@ declare type PageConfig = {
348
407
  size?: number;
349
408
  offset?: number;
350
409
  };
351
- 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
+ };
352
428
  /**
353
429
  * @pattern [a-zA-Z0-9_-~:]+
354
430
  */
@@ -370,16 +446,9 @@ declare type RecordsMetadata = {
370
446
  };
371
447
  };
372
448
  /**
373
- * Xata Table Record
449
+ * Xata Table Record Metadata
374
450
  */
375
- declare type XataRecord$1 = {
376
- id: RecordID;
377
- xata: {
378
- version: number;
379
- table?: string;
380
- warnings?: string[];
381
- };
382
- } & {
451
+ declare type XataRecord$1 = RecordMeta & {
383
452
  [key: string]: any;
384
453
  };
385
454
 
@@ -397,6 +466,7 @@ type schemas_InviteID = InviteID;
397
466
  type schemas_WorkspaceInvite = WorkspaceInvite;
398
467
  type schemas_WorkspaceMembers = WorkspaceMembers;
399
468
  type schemas_InviteKey = InviteKey;
469
+ type schemas_DatabaseMetadata = DatabaseMetadata;
400
470
  type schemas_ListDatabasesResponse = ListDatabasesResponse;
401
471
  type schemas_ListBranchesResponse = ListBranchesResponse;
402
472
  type schemas_ListGitBranchesResponse = ListGitBranchesResponse;
@@ -421,7 +491,10 @@ type schemas_ColumnMigration = ColumnMigration;
421
491
  type schemas_SortExpression = SortExpression;
422
492
  type schemas_SortOrder = SortOrder;
423
493
  type schemas_FuzzinessExpression = FuzzinessExpression;
494
+ type schemas_PrefixExpression = PrefixExpression;
424
495
  type schemas_FilterExpression = FilterExpression;
496
+ type schemas_HighlightExpression = HighlightExpression;
497
+ type schemas_BoosterExpression = BoosterExpression;
425
498
  type schemas_FilterList = FilterList;
426
499
  type schemas_FilterColumn = FilterColumn;
427
500
  type schemas_FilterColumnIncludes = FilterColumnIncludes;
@@ -431,7 +504,8 @@ type schemas_FilterPredicateRangeOp = FilterPredicateRangeOp;
431
504
  type schemas_FilterRangeValue = FilterRangeValue;
432
505
  type schemas_FilterValue = FilterValue;
433
506
  type schemas_PageConfig = PageConfig;
434
- type schemas_ColumnsFilter = ColumnsFilter;
507
+ type schemas_ColumnsProjection = ColumnsProjection;
508
+ type schemas_RecordMeta = RecordMeta;
435
509
  type schemas_RecordID = RecordID;
436
510
  type schemas_TableRename = TableRename;
437
511
  type schemas_RecordsMetadata = RecordsMetadata;
@@ -451,6 +525,7 @@ declare namespace schemas {
451
525
  schemas_WorkspaceInvite as WorkspaceInvite,
452
526
  schemas_WorkspaceMembers as WorkspaceMembers,
453
527
  schemas_InviteKey as InviteKey,
528
+ schemas_DatabaseMetadata as DatabaseMetadata,
454
529
  schemas_ListDatabasesResponse as ListDatabasesResponse,
455
530
  schemas_ListBranchesResponse as ListBranchesResponse,
456
531
  schemas_ListGitBranchesResponse as ListGitBranchesResponse,
@@ -475,7 +550,13 @@ declare namespace schemas {
475
550
  schemas_SortExpression as SortExpression,
476
551
  schemas_SortOrder as SortOrder,
477
552
  schemas_FuzzinessExpression as FuzzinessExpression,
553
+ schemas_PrefixExpression as PrefixExpression,
478
554
  schemas_FilterExpression as FilterExpression,
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,
479
560
  schemas_FilterList as FilterList,
480
561
  schemas_FilterColumn as FilterColumn,
481
562
  schemas_FilterColumnIncludes as FilterColumnIncludes,
@@ -485,7 +566,8 @@ declare namespace schemas {
485
566
  schemas_FilterRangeValue as FilterRangeValue,
486
567
  schemas_FilterValue as FilterValue,
487
568
  schemas_PageConfig as PageConfig,
488
- schemas_ColumnsFilter as ColumnsFilter,
569
+ schemas_ColumnsProjection as ColumnsProjection,
570
+ schemas_RecordMeta as RecordMeta,
489
571
  schemas_RecordID as RecordID,
490
572
  schemas_TableRename as TableRename,
491
573
  schemas_RecordsMetadata as RecordsMetadata,
@@ -520,11 +602,17 @@ declare type BulkError = {
520
602
  status?: number;
521
603
  }[];
522
604
  };
605
+ declare type BulkInsertResponse = {
606
+ recordIDs: string[];
607
+ } | {
608
+ records: XataRecord$1[];
609
+ };
523
610
  declare type BranchMigrationPlan = {
524
611
  version: number;
525
612
  migration: BranchMigration;
526
613
  };
527
- declare type RecordUpdateResponse = {
614
+ declare type RecordResponse = XataRecord$1;
615
+ declare type RecordUpdateResponse = XataRecord$1 | {
528
616
  id: string;
529
617
  xata: {
530
618
  version: number;
@@ -548,7 +636,9 @@ type responses_SimpleError = SimpleError;
548
636
  type responses_BadRequestError = BadRequestError;
549
637
  type responses_AuthError = AuthError;
550
638
  type responses_BulkError = BulkError;
639
+ type responses_BulkInsertResponse = BulkInsertResponse;
551
640
  type responses_BranchMigrationPlan = BranchMigrationPlan;
641
+ type responses_RecordResponse = RecordResponse;
552
642
  type responses_RecordUpdateResponse = RecordUpdateResponse;
553
643
  type responses_QueryResponse = QueryResponse;
554
644
  type responses_SearchResponse = SearchResponse;
@@ -559,7 +649,9 @@ declare namespace responses {
559
649
  responses_BadRequestError as BadRequestError,
560
650
  responses_AuthError as AuthError,
561
651
  responses_BulkError as BulkError,
652
+ responses_BulkInsertResponse as BulkInsertResponse,
562
653
  responses_BranchMigrationPlan as BranchMigrationPlan,
654
+ responses_RecordResponse as RecordResponse,
563
655
  responses_RecordUpdateResponse as RecordUpdateResponse,
564
656
  responses_QueryResponse as QueryResponse,
565
657
  responses_SearchResponse as SearchResponse,
@@ -865,6 +957,9 @@ declare type InviteWorkspaceMemberError = ErrorWrapper<{
865
957
  } | {
866
958
  status: 404;
867
959
  payload: SimpleError;
960
+ } | {
961
+ status: 409;
962
+ payload: SimpleError;
868
963
  }>;
869
964
  declare type InviteWorkspaceMemberRequestBody = {
870
965
  email: string;
@@ -878,6 +973,34 @@ declare type InviteWorkspaceMemberVariables = {
878
973
  * Invite some user to join the workspace with the given role
879
974
  */
880
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>;
881
1004
  declare type CancelWorkspaceMemberInvitePathParams = {
882
1005
  workspaceId: WorkspaceID;
883
1006
  inviteId: InviteID;
@@ -1031,6 +1154,27 @@ declare type DeleteDatabaseVariables = {
1031
1154
  * Delete a database and all of its branches and tables permanently.
1032
1155
  */
1033
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>;
1034
1178
  declare type GetGitBranchesMappingPathParams = {
1035
1179
  dbName: DBName;
1036
1180
  workspace: string;
@@ -1223,6 +1367,10 @@ declare type CreateBranchError = ErrorWrapper<{
1223
1367
  status: 404;
1224
1368
  payload: SimpleError;
1225
1369
  }>;
1370
+ declare type CreateBranchResponse = {
1371
+ databaseName: string;
1372
+ branchName: string;
1373
+ };
1226
1374
  declare type CreateBranchRequestBody = {
1227
1375
  from?: string;
1228
1376
  metadata?: BranchMetadata;
@@ -1232,7 +1380,7 @@ declare type CreateBranchVariables = {
1232
1380
  pathParams: CreateBranchPathParams;
1233
1381
  queryParams?: CreateBranchQueryParams;
1234
1382
  } & FetcherExtraProps;
1235
- declare const createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
1383
+ declare const createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
1236
1384
  declare type DeleteBranchPathParams = {
1237
1385
  dbBranchName: DBBranchName;
1238
1386
  workspace: string;
@@ -1419,13 +1567,17 @@ declare type CreateTableError = ErrorWrapper<{
1419
1567
  status: 422;
1420
1568
  payload: SimpleError;
1421
1569
  }>;
1570
+ declare type CreateTableResponse = {
1571
+ branchName: string;
1572
+ tableName: string;
1573
+ };
1422
1574
  declare type CreateTableVariables = {
1423
1575
  pathParams: CreateTablePathParams;
1424
1576
  } & FetcherExtraProps;
1425
1577
  /**
1426
1578
  * Creates a new table with the given name. Returns 422 if a table with the same name already exists.
1427
1579
  */
1428
- declare const createTable: (variables: CreateTableVariables) => Promise<undefined>;
1580
+ declare const createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
1429
1581
  declare type DeleteTablePathParams = {
1430
1582
  dbBranchName: DBBranchName;
1431
1583
  tableName: TableName;
@@ -1658,6 +1810,9 @@ declare type InsertRecordPathParams = {
1658
1810
  tableName: TableName;
1659
1811
  workspace: string;
1660
1812
  };
1813
+ declare type InsertRecordQueryParams = {
1814
+ columns?: ColumnsProjection;
1815
+ };
1661
1816
  declare type InsertRecordError = ErrorWrapper<{
1662
1817
  status: 400;
1663
1818
  payload: BadRequestError;
@@ -1668,20 +1823,15 @@ declare type InsertRecordError = ErrorWrapper<{
1668
1823
  status: 404;
1669
1824
  payload: SimpleError;
1670
1825
  }>;
1671
- declare type InsertRecordResponse = {
1672
- id: string;
1673
- xata: {
1674
- version: number;
1675
- };
1676
- };
1677
1826
  declare type InsertRecordVariables = {
1678
1827
  body?: Record<string, any>;
1679
1828
  pathParams: InsertRecordPathParams;
1829
+ queryParams?: InsertRecordQueryParams;
1680
1830
  } & FetcherExtraProps;
1681
1831
  /**
1682
1832
  * Insert a new Record into the Table
1683
1833
  */
1684
- declare const insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
1834
+ declare const insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
1685
1835
  declare type InsertRecordWithIDPathParams = {
1686
1836
  dbBranchName: DBBranchName;
1687
1837
  tableName: TableName;
@@ -1689,6 +1839,7 @@ declare type InsertRecordWithIDPathParams = {
1689
1839
  workspace: string;
1690
1840
  };
1691
1841
  declare type InsertRecordWithIDQueryParams = {
1842
+ columns?: ColumnsProjection;
1692
1843
  createOnly?: boolean;
1693
1844
  ifVersion?: number;
1694
1845
  };
@@ -1721,6 +1872,7 @@ declare type UpdateRecordWithIDPathParams = {
1721
1872
  workspace: string;
1722
1873
  };
1723
1874
  declare type UpdateRecordWithIDQueryParams = {
1875
+ columns?: ColumnsProjection;
1724
1876
  ifVersion?: number;
1725
1877
  };
1726
1878
  declare type UpdateRecordWithIDError = ErrorWrapper<{
@@ -1749,6 +1901,7 @@ declare type UpsertRecordWithIDPathParams = {
1749
1901
  workspace: string;
1750
1902
  };
1751
1903
  declare type UpsertRecordWithIDQueryParams = {
1904
+ columns?: ColumnsProjection;
1752
1905
  ifVersion?: number;
1753
1906
  };
1754
1907
  declare type UpsertRecordWithIDError = ErrorWrapper<{
@@ -1776,6 +1929,9 @@ declare type DeleteRecordPathParams = {
1776
1929
  recordId: RecordID;
1777
1930
  workspace: string;
1778
1931
  };
1932
+ declare type DeleteRecordQueryParams = {
1933
+ columns?: ColumnsProjection;
1934
+ };
1779
1935
  declare type DeleteRecordError = ErrorWrapper<{
1780
1936
  status: 400;
1781
1937
  payload: BadRequestError;
@@ -1788,14 +1944,18 @@ declare type DeleteRecordError = ErrorWrapper<{
1788
1944
  }>;
1789
1945
  declare type DeleteRecordVariables = {
1790
1946
  pathParams: DeleteRecordPathParams;
1947
+ queryParams?: DeleteRecordQueryParams;
1791
1948
  } & FetcherExtraProps;
1792
- declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
1949
+ declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
1793
1950
  declare type GetRecordPathParams = {
1794
1951
  dbBranchName: DBBranchName;
1795
1952
  tableName: TableName;
1796
1953
  recordId: RecordID;
1797
1954
  workspace: string;
1798
1955
  };
1956
+ declare type GetRecordQueryParams = {
1957
+ columns?: ColumnsProjection;
1958
+ };
1799
1959
  declare type GetRecordError = ErrorWrapper<{
1800
1960
  status: 400;
1801
1961
  payload: BadRequestError;
@@ -1806,12 +1966,9 @@ declare type GetRecordError = ErrorWrapper<{
1806
1966
  status: 404;
1807
1967
  payload: SimpleError;
1808
1968
  }>;
1809
- declare type GetRecordRequestBody = {
1810
- columns?: ColumnsFilter;
1811
- };
1812
1969
  declare type GetRecordVariables = {
1813
- body?: GetRecordRequestBody;
1814
1970
  pathParams: GetRecordPathParams;
1971
+ queryParams?: GetRecordQueryParams;
1815
1972
  } & FetcherExtraProps;
1816
1973
  /**
1817
1974
  * Retrieve record by ID
@@ -1822,6 +1979,9 @@ declare type BulkInsertTableRecordsPathParams = {
1822
1979
  tableName: TableName;
1823
1980
  workspace: string;
1824
1981
  };
1982
+ declare type BulkInsertTableRecordsQueryParams = {
1983
+ columns?: ColumnsProjection;
1984
+ };
1825
1985
  declare type BulkInsertTableRecordsError = ErrorWrapper<{
1826
1986
  status: 400;
1827
1987
  payload: BulkError;
@@ -1831,21 +1991,22 @@ declare type BulkInsertTableRecordsError = ErrorWrapper<{
1831
1991
  } | {
1832
1992
  status: 404;
1833
1993
  payload: SimpleError;
1994
+ } | {
1995
+ status: 422;
1996
+ payload: SimpleError;
1834
1997
  }>;
1835
- declare type BulkInsertTableRecordsResponse = {
1836
- recordIDs: string[];
1837
- };
1838
1998
  declare type BulkInsertTableRecordsRequestBody = {
1839
1999
  records: Record<string, any>[];
1840
2000
  };
1841
2001
  declare type BulkInsertTableRecordsVariables = {
1842
2002
  body: BulkInsertTableRecordsRequestBody;
1843
2003
  pathParams: BulkInsertTableRecordsPathParams;
2004
+ queryParams?: BulkInsertTableRecordsQueryParams;
1844
2005
  } & FetcherExtraProps;
1845
2006
  /**
1846
2007
  * Bulk insert records
1847
2008
  */
1848
- declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
2009
+ declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
1849
2010
  declare type QueryTablePathParams = {
1850
2011
  dbBranchName: DBBranchName;
1851
2012
  tableName: TableName;
@@ -1865,7 +2026,7 @@ declare type QueryTableRequestBody = {
1865
2026
  filter?: FilterExpression;
1866
2027
  sort?: SortExpression;
1867
2028
  page?: PageConfig;
1868
- columns?: ColumnsFilter;
2029
+ columns?: ColumnsProjection;
1869
2030
  };
1870
2031
  declare type QueryTableVariables = {
1871
2032
  body?: QueryTableRequestBody;
@@ -2611,7 +2772,10 @@ declare type SearchTableError = ErrorWrapper<{
2611
2772
  declare type SearchTableRequestBody = {
2612
2773
  query: string;
2613
2774
  fuzziness?: FuzzinessExpression;
2775
+ prefix?: PrefixExpression;
2614
2776
  filter?: FilterExpression;
2777
+ highlight?: HighlightExpression;
2778
+ boosters?: BoosterExpression[];
2615
2779
  };
2616
2780
  declare type SearchTableVariables = {
2617
2781
  body: SearchTableRequestBody;
@@ -2640,9 +2804,14 @@ declare type SearchBranchError = ErrorWrapper<{
2640
2804
  payload: SimpleError;
2641
2805
  }>;
2642
2806
  declare type SearchBranchRequestBody = {
2643
- tables?: string[];
2807
+ tables?: (string | {
2808
+ table: string;
2809
+ filter?: FilterExpression;
2810
+ boosters?: BoosterExpression[];
2811
+ })[];
2644
2812
  query: string;
2645
2813
  fuzziness?: FuzzinessExpression;
2814
+ highlight?: HighlightExpression;
2646
2815
  };
2647
2816
  declare type SearchBranchVariables = {
2648
2817
  body: SearchBranchRequestBody;
@@ -2671,6 +2840,7 @@ declare const operationsByTag: {
2671
2840
  updateWorkspaceMemberRole: (variables: UpdateWorkspaceMemberRoleVariables) => Promise<undefined>;
2672
2841
  removeWorkspaceMember: (variables: RemoveWorkspaceMemberVariables) => Promise<undefined>;
2673
2842
  inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<WorkspaceInvite>;
2843
+ updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
2674
2844
  cancelWorkspaceMemberInvite: (variables: CancelWorkspaceMemberInviteVariables) => Promise<undefined>;
2675
2845
  resendWorkspaceMemberInvite: (variables: ResendWorkspaceMemberInviteVariables) => Promise<undefined>;
2676
2846
  acceptWorkspaceMemberInvite: (variables: AcceptWorkspaceMemberInviteVariables) => Promise<undefined>;
@@ -2679,6 +2849,7 @@ declare const operationsByTag: {
2679
2849
  getDatabaseList: (variables: GetDatabaseListVariables) => Promise<ListDatabasesResponse>;
2680
2850
  createDatabase: (variables: CreateDatabaseVariables) => Promise<CreateDatabaseResponse>;
2681
2851
  deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
2852
+ getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
2682
2853
  getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
2683
2854
  addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
2684
2855
  removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
@@ -2687,7 +2858,7 @@ declare const operationsByTag: {
2687
2858
  branch: {
2688
2859
  getBranchList: (variables: GetBranchListVariables) => Promise<ListBranchesResponse>;
2689
2860
  getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
2690
- createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
2861
+ createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
2691
2862
  deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
2692
2863
  updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
2693
2864
  getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
@@ -2697,7 +2868,7 @@ declare const operationsByTag: {
2697
2868
  getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
2698
2869
  };
2699
2870
  table: {
2700
- createTable: (variables: CreateTableVariables) => Promise<undefined>;
2871
+ createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
2701
2872
  deleteTable: (variables: DeleteTableVariables) => Promise<undefined>;
2702
2873
  updateTable: (variables: UpdateTableVariables) => Promise<undefined>;
2703
2874
  getTableSchema: (variables: GetTableSchemaVariables) => Promise<GetTableSchemaResponse>;
@@ -2709,13 +2880,13 @@ declare const operationsByTag: {
2709
2880
  updateColumn: (variables: UpdateColumnVariables) => Promise<MigrationIdResponse>;
2710
2881
  };
2711
2882
  records: {
2712
- insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
2883
+ insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
2713
2884
  insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2714
2885
  updateRecordWithID: (variables: UpdateRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2715
2886
  upsertRecordWithID: (variables: UpsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2716
- deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
2887
+ deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
2717
2888
  getRecord: (variables: GetRecordVariables) => Promise<XataRecord$1>;
2718
- bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
2889
+ bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
2719
2890
  queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
2720
2891
  searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2721
2892
  searchBranch: (variables: SearchBranchVariables) => Promise<SearchResponse>;
@@ -2733,10 +2904,8 @@ interface XataApiClientOptions {
2733
2904
  fetch?: FetchImpl;
2734
2905
  apiKey?: string;
2735
2906
  host?: HostProvider;
2907
+ trace?: TraceFunction;
2736
2908
  }
2737
- /**
2738
- * @deprecated Use XataApiPlugin instead
2739
- */
2740
2909
  declare class XataApiClient {
2741
2910
  #private;
2742
2911
  constructor(options?: XataApiClientOptions);
@@ -2769,6 +2938,7 @@ declare class WorkspaceApi {
2769
2938
  updateWorkspaceMemberRole(workspaceId: WorkspaceID, userId: UserID, role: Role): Promise<void>;
2770
2939
  removeWorkspaceMember(workspaceId: WorkspaceID, userId: UserID): Promise<void>;
2771
2940
  inviteWorkspaceMember(workspaceId: WorkspaceID, email: string, role: Role): Promise<WorkspaceInvite>;
2941
+ updateWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID, role: Role): Promise<WorkspaceInvite>;
2772
2942
  cancelWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2773
2943
  resendWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2774
2944
  acceptWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteKey: InviteKey): Promise<void>;
@@ -2779,17 +2949,18 @@ declare class DatabaseApi {
2779
2949
  getDatabaseList(workspace: WorkspaceID): Promise<ListDatabasesResponse>;
2780
2950
  createDatabase(workspace: WorkspaceID, dbName: DBName, options?: CreateDatabaseRequestBody): Promise<CreateDatabaseResponse>;
2781
2951
  deleteDatabase(workspace: WorkspaceID, dbName: DBName): Promise<void>;
2952
+ getDatabaseMetadata(workspace: WorkspaceID, dbName: DBName): Promise<DatabaseMetadata>;
2782
2953
  getGitBranchesMapping(workspace: WorkspaceID, dbName: DBName): Promise<ListGitBranchesResponse>;
2783
2954
  addGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, body: AddGitBranchesEntryRequestBody): Promise<AddGitBranchesEntryResponse>;
2784
2955
  removeGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<void>;
2785
- resolveBranch(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<ResolveBranchResponse>;
2956
+ resolveBranch(workspace: WorkspaceID, dbName: DBName, gitBranch?: string, fallbackBranch?: string): Promise<ResolveBranchResponse>;
2786
2957
  }
2787
2958
  declare class BranchApi {
2788
2959
  private extraProps;
2789
2960
  constructor(extraProps: FetcherExtraProps);
2790
2961
  getBranchList(workspace: WorkspaceID, dbName: DBName): Promise<ListBranchesResponse>;
2791
2962
  getBranchDetails(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<DBBranch>;
2792
- 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>;
2793
2964
  deleteBranch(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<void>;
2794
2965
  updateBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName, metadata?: BranchMetadata): Promise<void>;
2795
2966
  getBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<BranchMetadata>;
@@ -2801,7 +2972,7 @@ declare class BranchApi {
2801
2972
  declare class TableApi {
2802
2973
  private extraProps;
2803
2974
  constructor(extraProps: FetcherExtraProps);
2804
- createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
2975
+ createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<CreateTableResponse>;
2805
2976
  deleteTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
2806
2977
  updateTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, options: UpdateTableRequestBody): Promise<void>;
2807
2978
  getTableSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<GetTableSchemaResponse>;
@@ -2815,13 +2986,13 @@ declare class TableApi {
2815
2986
  declare class RecordsApi {
2816
2987
  private extraProps;
2817
2988
  constructor(extraProps: FetcherExtraProps);
2818
- 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>;
2819
2990
  insertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: InsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2820
2991
  updateRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpdateRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2821
2992
  upsertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2822
- deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID): Promise<void>;
2823
- getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordRequestBody): Promise<XataRecord$1>;
2824
- 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>;
2825
2996
  queryTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: QueryTableRequestBody): Promise<QueryResponse>;
2826
2997
  searchTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: SearchTableRequestBody): Promise<SearchResponse>;
2827
2998
  searchBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, query: SearchBranchRequestBody): Promise<SearchResponse>;
@@ -2837,28 +3008,29 @@ declare type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) ex
2837
3008
  declare type If<Condition, Then, Else> = Condition extends true ? Then : Else;
2838
3009
  declare type IsObject<T> = T extends Record<string, any> ? true : false;
2839
3010
  declare type IsArray<T> = T extends Array<any> ? true : false;
2840
- declare type NonEmptyArray<T> = T[] & {
2841
- 0: T;
2842
- };
2843
3011
  declare type RequiredBy<T, K extends keyof T> = T & {
2844
3012
  [P in K]-?: NonNullable<T[P]>;
2845
3013
  };
2846
3014
  declare type GetArrayInnerType<T extends readonly any[]> = T[number];
2847
3015
  declare type SingleOrArray<T> = T | T[];
2848
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;
2849
3021
 
2850
3022
  declare type SelectableColumn<O, RecursivePath extends any[] = []> = '*' | 'id' | DataProps<O> | NestedColumns<O, RecursivePath>;
2851
- declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord & UnionToIntersection<Values<{
2852
- [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>;
2853
3025
  }>>;
2854
- declare type ValueAtColumn<O, P extends SelectableColumn<O>> = P extends '*' ? Values<O> : P extends 'id' ? string : P extends keyof O ? O[P] : P extends `${infer K}.${infer V}` ? K extends keyof O ? Values<O[K] extends XataRecord ? (V extends SelectableColumn<O[K]> ? {
2855
- V: ValueAtColumn<O[K], V>;
2856
- } : never) : O[K]> : never : never;
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> ? {
3027
+ V: ValueAtColumn<Item, V>;
3028
+ } : never : O[K] : never> : never : never;
2857
3029
  declare type MAX_RECURSION = 5;
2858
3030
  declare type NestedColumns<O, RecursivePath extends any[]> = RecursivePath['length'] extends MAX_RECURSION ? never : If<IsObject<O>, Values<{
2859
- [K in DataProps<O>]: If<IsArray<NonNullable<O[K]>>, K, // If the property is an array, we stop recursion. We don't support object arrays yet
2860
- If<IsObject<NonNullable<O[K]>>, NonNullable<O[K]> extends XataRecord ? SelectableColumn<NonNullable<O[K]>, [...RecursivePath, O[K]]> extends string ? K | `${K}.${SelectableColumn<NonNullable<O[K]>, [...RecursivePath, O[K]]>}` : never : `${K}.${StringKeys<NonNullable<O[K]>> | '*'}`, // This allows usage of objects that are not links
2861
- K>>;
3031
+ [K in DataProps<O>]: NonNullable<O[K]> extends infer Item ? If<IsArray<Item>, K, // If the property is an array, we stop recursion. We don't support object arrays yet
3032
+ If<IsObject<Item>, Item extends XataRecord ? SelectableColumn<Item, [...RecursivePath, Item]> extends infer Column ? Column extends string ? K | `${K}.${Column}` : never : never : Item extends Date ? K : `${K}.${StringKeys<Item> | '*'}`, // This allows usage of objects that are not links
3033
+ K>> : never;
2862
3034
  }>, never>;
2863
3035
  declare type DataProps<O> = Exclude<StringKeys<O>, StringKeys<XataRecord>>;
2864
3036
  declare type NestedValueAtColumn<O, Key extends SelectableColumn<O>> = Key extends `${infer N}.${infer M}` ? N extends DataProps<O> ? {
@@ -2885,55 +3057,84 @@ interface BaseData {
2885
3057
  /**
2886
3058
  * Represents a persisted record from the database.
2887
3059
  */
2888
- interface XataRecord extends Identifiable {
3060
+ interface XataRecord<OriginalRecord extends XataRecord<any> = XataRecord<any>> extends Identifiable {
2889
3061
  /**
2890
- * Metadata of this record.
3062
+ * Get metadata of this record.
2891
3063
  */
2892
- xata: {
2893
- /**
2894
- * Number that is increased every time the record is updated.
2895
- */
2896
- version: number;
2897
- };
3064
+ getMetadata(): XataRecordMetadata;
2898
3065
  /**
2899
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.
2900
3069
  */
2901
- 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>;
2902
3076
  /**
2903
3077
  * Performs a partial update of the current record. On success a new object is
2904
3078
  * returned and the current object is not mutated.
2905
- * @param data The columns and their values that have to be updated.
2906
- * @returns A new record containing the latest values for all the columns of the current record.
3079
+ * @param partialUpdate The columns and their values that have to be updated.
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.
2907
3082
  */
2908
- update(partialUpdate: Partial<EditableData<Omit<this, keyof XataRecord>>>): Promise<Readonly<SelectedPick<this, ['*']>>>;
3083
+ update<K extends SelectableColumn<OriginalRecord>>(partialUpdate: Partial<EditableData<Omit<OriginalRecord, keyof XataRecord>>>, 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.
3089
+ */
3090
+ update(partialUpdate: Partial<EditableData<Omit<OriginalRecord, keyof XataRecord>>>): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2909
3091
  /**
2910
3092
  * Performs a deletion of the current record in the database.
2911
- *
2912
- * @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.
2913
3095
  */
2914
- 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>;
2915
3103
  }
2916
3104
  declare type Link<Record extends XataRecord> = Omit<XataRecord, 'read' | 'update'> & {
2917
3105
  /**
2918
3106
  * Retrieves a refreshed copy of the current record from the database.
2919
3107
  */
2920
- 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>;
2921
3109
  /**
2922
3110
  * Performs a partial update of the current record. On success a new object is
2923
3111
  * returned and the current object is not mutated.
2924
- * @param data The columns and their values that have to be updated.
3112
+ * @param partialUpdate The columns and their values that have to be updated.
2925
3113
  * @returns A new record containing the latest values for all the columns of the current record.
2926
3114
  */
2927
- update(partialUpdate: Partial<EditableData<Omit<Record, keyof XataRecord>>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3115
+ update<K extends SelectableColumn<Record>>(partialUpdate: Partial<EditableData<Omit<Record, keyof XataRecord>>>, columns?: K[]): Promise<Readonly<SelectedPick<Record, typeof columns extends SelectableColumn<Record>[] ? typeof columns : ['*']>>>;
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>;
3122
+ };
3123
+ declare type XataRecordMetadata = {
3124
+ /**
3125
+ * Number that is increased every time the record is updated.
3126
+ */
3127
+ version: number;
3128
+ warnings?: string[];
2928
3129
  };
2929
3130
  declare function isIdentifiable(x: any): x is Identifiable & Record<string, unknown>;
2930
3131
  declare function isXataRecord(x: any): x is XataRecord & Record<string, unknown>;
2931
3132
  declare type EditableData<O extends BaseData> = {
2932
3133
  [K in keyof O]: O[K] extends XataRecord ? {
2933
3134
  id: string;
2934
- } : NonNullable<O[K]> extends XataRecord ? {
3135
+ } | string : NonNullable<O[K]> extends XataRecord ? {
2935
3136
  id: string;
2936
- } | null | undefined : O[K];
3137
+ } | string | null | undefined : O[K];
2937
3138
  };
2938
3139
 
2939
3140
  /**
@@ -3009,8 +3210,8 @@ declare type ValueTypeFilters<T> = T | T extends string ? StringTypeFilter : T e
3009
3210
  ],
3010
3211
  }
3011
3212
  */
3012
- declare type AggregatorFilter<Record> = {
3013
- [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<Record>>;
3213
+ declare type AggregatorFilter<T> = {
3214
+ [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<T>>;
3014
3215
  };
3015
3216
  /**
3016
3217
  * Existance filter
@@ -3025,10 +3226,88 @@ declare type BaseApiFilter<Record> = PropertyAccessFilter<Record> | AggregatorFi
3025
3226
  * Injects the Api filters on nested properties
3026
3227
  * Example: { filter: { settings: { plan: { $any: ['free', 'trial'] } } } }
3027
3228
  */
3028
- declare type NestedApiFilter<T> = T extends Record<string, any> ? {
3229
+ declare type NestedApiFilter<T> = {
3029
3230
  [key in keyof T]?: T[key] extends Record<string, any> ? SingleOrArray<Filter<T[key]>> : PropertyFilter<T[key]>;
3030
- } : PropertyFilter<T>;
3031
- declare type Filter<Record> = BaseApiFilter<Record> | NestedApiFilter<Record>;
3231
+ };
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, BaseData>> 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;
3032
3311
 
3033
3312
  declare type SortDirection = 'asc' | 'desc';
3034
3313
  declare type SortFilterExtended<T extends XataRecord> = {
@@ -3041,7 +3320,7 @@ declare type SortFilterBase<T extends XataRecord> = {
3041
3320
  };
3042
3321
 
3043
3322
  declare type BaseOptions<T extends XataRecord> = {
3044
- columns?: NonEmptyArray<SelectableColumn<T>>;
3323
+ columns?: SelectableColumn<T>[];
3045
3324
  cache?: number;
3046
3325
  };
3047
3326
  declare type CursorQueryOptions = {
@@ -3064,8 +3343,8 @@ declare type QueryOptions<T extends XataRecord> = BaseOptions<T> & (CursorQueryO
3064
3343
  declare class Query<Record extends XataRecord, Result extends XataRecord = Record> implements Paginable<Record, Result> {
3065
3344
  #private;
3066
3345
  readonly meta: PaginationQueryMeta;
3067
- readonly records: Result[];
3068
- constructor(repository: Repository<Record> | null, table: string, data: Partial<QueryOptions<Record>>, parent?: Partial<QueryOptions<Record>>);
3346
+ readonly records: RecordArray<Result>;
3347
+ constructor(repository: Repository<Record> | null, table: string, data: Partial<QueryOptions<Record>>, rawParent?: Partial<QueryOptions<Record>>);
3069
3348
  getQueryOptions(): QueryOptions<Record>;
3070
3349
  key(): string;
3071
3350
  /**
@@ -3097,81 +3376,203 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
3097
3376
  *
3098
3377
  * ```
3099
3378
  * query.filter("columnName", columnValue)
3100
- * query.filter({
3101
- * "columnName": columnValue
3102
- * })
3379
+ * query.filter("columnName", operator(columnValue)) // Use gt, gte, lt, lte, startsWith,...
3380
+ * ```
3381
+ *
3382
+ * @param column The name of the column to filter.
3383
+ * @param value The value to filter.
3384
+ * @returns A new Query object.
3385
+ */
3386
+ filter<F extends SelectableColumn<Record>>(column: F, value: Filter<NonNullable<ValueAtColumn<Record, F>>>): Query<Record, Result>;
3387
+ /**
3388
+ * Builds a new query object adding one or more constraints. Examples:
3389
+ *
3390
+ * ```
3391
+ * query.filter({ "columnName": columnValue })
3103
3392
  * query.filter({
3104
3393
  * "columnName": operator(columnValue) // Use gt, gte, lt, lte, startsWith,...
3105
3394
  * })
3106
3395
  * ```
3107
3396
  *
3397
+ * @param filters A filter object
3108
3398
  * @returns A new Query object.
3109
3399
  */
3110
3400
  filter(filters: Filter<Record>): Query<Record, Result>;
3111
- filter<F extends SelectableColumn<Record>>(column: F, value: Filter<ValueAtColumn<Record, F>>): Query<Record, Result>;
3112
3401
  /**
3113
3402
  * Builds a new query with a new sort option.
3114
3403
  * @param column The column name.
3115
3404
  * @param direction The direction. Either ascending or descending.
3116
3405
  * @returns A new Query object.
3117
3406
  */
3118
- 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>;
3119
3408
  /**
3120
3409
  * Builds a new query specifying the set of columns to be returned in the query response.
3121
3410
  * @param columns Array of column names to be returned by the query.
3122
3411
  * @returns A new Query object.
3123
3412
  */
3124
- 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[]>>;
3414
+ /**
3415
+ * Get paginated results
3416
+ *
3417
+ * @returns A page of results
3418
+ */
3125
3419
  getPaginated(): Promise<Page<Record, Result>>;
3420
+ /**
3421
+ * Get paginated results
3422
+ *
3423
+ * @param options Pagination options
3424
+ * @returns A page of results
3425
+ */
3126
3426
  getPaginated(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
3427
+ /**
3428
+ * Get paginated results
3429
+ *
3430
+ * @param options Pagination options
3431
+ * @returns A page of results
3432
+ */
3127
3433
  getPaginated<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<Page<Record, SelectedPick<Record, typeof options['columns']>>>;
3434
+ /**
3435
+ * Get results in an iterator
3436
+ *
3437
+ * @async
3438
+ * @returns Async interable of results
3439
+ */
3128
3440
  [Symbol.asyncIterator](): AsyncIterableIterator<Result>;
3441
+ /**
3442
+ * Build an iterator of results
3443
+ *
3444
+ * @returns Async generator of results array
3445
+ */
3129
3446
  getIterator(): AsyncGenerator<Result[]>;
3447
+ /**
3448
+ * Build an iterator of results
3449
+ *
3450
+ * @param options Pagination options with batchSize
3451
+ * @returns Async generator of results array
3452
+ */
3130
3453
  getIterator(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
3131
3454
  batchSize?: number;
3132
3455
  }): AsyncGenerator<Result[]>;
3456
+ /**
3457
+ * Build an iterator of results
3458
+ *
3459
+ * @param options Pagination options with batchSize
3460
+ * @returns Async generator of results array
3461
+ */
3133
3462
  getIterator<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
3134
3463
  batchSize?: number;
3135
3464
  }>(options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
3465
+ /**
3466
+ * Performs the query in the database and returns a set of results.
3467
+ * @returns An array of records from the database.
3468
+ */
3469
+ getMany(): Promise<RecordArray<Result>>;
3470
+ /**
3471
+ * Performs the query in the database and returns a set of results.
3472
+ * @param options Additional options to be used when performing the query.
3473
+ * @returns An array of records from the database.
3474
+ */
3475
+ getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<RecordArray<SelectedPick<Record, typeof options['columns']>>>;
3136
3476
  /**
3137
3477
  * Performs the query in the database and returns a set of results.
3138
3478
  * @param options Additional options to be used when performing the query.
3139
3479
  * @returns An array of records from the database.
3140
3480
  */
3141
- getMany(): Promise<Result[]>;
3142
- getMany(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<Result[]>;
3143
- getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
3481
+ getMany(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<RecordArray<Result>>;
3144
3482
  /**
3145
3483
  * Performs the query in the database and returns all the results.
3146
3484
  * Warning: If there are a large number of results, this method can have performance implications.
3147
- * @param options Additional options to be used when performing the query.
3148
3485
  * @returns An array of records from the database.
3149
3486
  */
3150
3487
  getAll(): Promise<Result[]>;
3151
- getAll(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
3152
- batchSize?: number;
3153
- }): Promise<Result[]>;
3488
+ /**
3489
+ * Performs the query in the database and returns all the results.
3490
+ * Warning: If there are a large number of results, this method can have performance implications.
3491
+ * @param options Additional options to be used when performing the query.
3492
+ * @returns An array of records from the database.
3493
+ */
3154
3494
  getAll<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
3155
3495
  batchSize?: number;
3156
3496
  }>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
3157
3497
  /**
3158
- * Performs the query in the database and returns the first result.
3498
+ * Performs the query in the database and returns all the results.
3499
+ * Warning: If there are a large number of results, this method can have performance implications.
3159
3500
  * @param options Additional options to be used when performing the query.
3501
+ * @returns An array of records from the database.
3502
+ */
3503
+ getAll(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
3504
+ batchSize?: number;
3505
+ }): Promise<Result[]>;
3506
+ /**
3507
+ * Performs the query in the database and returns the first result.
3160
3508
  * @returns The first record that matches the query, or null if no record matched the query.
3161
3509
  */
3162
3510
  getFirst(): Promise<Result | null>;
3163
- getFirst(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result | null>;
3511
+ /**
3512
+ * Performs the query in the database and returns the first result.
3513
+ * @param options Additional options to be used when performing the query.
3514
+ * @returns The first record that matches the query, or null if no record matched the query.
3515
+ */
3164
3516
  getFirst<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
3517
+ /**
3518
+ * Performs the query in the database and returns the first result.
3519
+ * @param options Additional options to be used when performing the query.
3520
+ * @returns The first record that matches the query, or null if no record matched the query.
3521
+ */
3522
+ getFirst(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result | null>;
3523
+ /**
3524
+ * Performs the query in the database and returns the first result.
3525
+ * @returns The first record that matches the query, or null if no record matched the query.
3526
+ * @throws if there are no results.
3527
+ */
3528
+ getFirstOrThrow(): Promise<Result>;
3529
+ /**
3530
+ * Performs the query in the database and returns the first result.
3531
+ * @param options Additional options to be used when performing the query.
3532
+ * @returns The first record that matches the query, or null if no record matched the query.
3533
+ * @throws if there are no results.
3534
+ */
3535
+ getFirstOrThrow<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>>;
3536
+ /**
3537
+ * Performs the query in the database and returns the first result.
3538
+ * @param options Additional options to be used when performing the query.
3539
+ * @returns The first record that matches the query, or null if no record matched the query.
3540
+ * @throws if there are no results.
3541
+ */
3542
+ getFirstOrThrow(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result>;
3165
3543
  /**
3166
3544
  * Builds a new query object adding a cache TTL in milliseconds.
3167
3545
  * @param ttl The cache TTL in milliseconds.
3168
3546
  * @returns A new Query object.
3169
3547
  */
3170
3548
  cache(ttl: number): Query<Record, Result>;
3549
+ /**
3550
+ * Retrieve next page of records
3551
+ *
3552
+ * @returns A new page object.
3553
+ */
3171
3554
  nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
3555
+ /**
3556
+ * Retrieve previous page of records
3557
+ *
3558
+ * @returns A new page object
3559
+ */
3172
3560
  previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
3561
+ /**
3562
+ * Retrieve first page of records
3563
+ *
3564
+ * @returns A new page object
3565
+ */
3173
3566
  firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
3567
+ /**
3568
+ * Retrieve last page of records
3569
+ *
3570
+ * @returns A new page object
3571
+ */
3174
3572
  lastPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
3573
+ /**
3574
+ * @returns Boolean indicating if there is a next page
3575
+ */
3175
3576
  hasNextPage(): boolean;
3176
3577
  }
3177
3578
 
@@ -3183,7 +3584,7 @@ declare type PaginationQueryMeta = {
3183
3584
  };
3184
3585
  interface Paginable<Record extends XataRecord, Result extends XataRecord = Record> {
3185
3586
  meta: PaginationQueryMeta;
3186
- records: Result[];
3587
+ records: RecordArray<Result>;
3187
3588
  nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
3188
3589
  previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
3189
3590
  firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
@@ -3203,7 +3604,7 @@ declare class Page<Record extends XataRecord, Result extends XataRecord = Record
3203
3604
  /**
3204
3605
  * The set of results for this page.
3205
3606
  */
3206
- readonly records: Result[];
3607
+ readonly records: RecordArray<Result>;
3207
3608
  constructor(query: Query<Record, Result>, meta: PaginationQueryMeta, records?: Result[]);
3208
3609
  /**
3209
3610
  * Retrieves the next page of results.
@@ -3252,54 +3653,288 @@ declare type OffsetNavigationOptions = {
3252
3653
  offset?: number;
3253
3654
  };
3254
3655
  declare const PAGINATION_MAX_SIZE = 200;
3255
- declare const PAGINATION_DEFAULT_SIZE = 200;
3656
+ declare const PAGINATION_DEFAULT_SIZE = 20;
3256
3657
  declare const PAGINATION_MAX_OFFSET = 800;
3257
3658
  declare const PAGINATION_DEFAULT_OFFSET = 0;
3258
3659
  declare function isCursorPaginationOptions(options: Record<string, unknown> | undefined | null): options is CursorNavigationOptions;
3660
+ declare class RecordArray<Result extends XataRecord> extends Array<Result> {
3661
+ #private;
3662
+ constructor(page: Paginable<any, Result>, overrideRecords?: Result[]);
3663
+ static parseConstructorParams(...args: any[]): any[];
3664
+ toArray(): Result[];
3665
+ map<U>(callbackfn: (value: Result, index: number, array: Result[]) => U, thisArg?: any): U[];
3666
+ /**
3667
+ * Retrieve next page of records
3668
+ *
3669
+ * @returns A new array of objects
3670
+ */
3671
+ nextPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
3672
+ /**
3673
+ * Retrieve previous page of records
3674
+ *
3675
+ * @returns A new array of objects
3676
+ */
3677
+ previousPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
3678
+ /**
3679
+ * Retrieve first page of records
3680
+ *
3681
+ * @returns A new array of objects
3682
+ */
3683
+ firstPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
3684
+ /**
3685
+ * Retrieve last page of records
3686
+ *
3687
+ * @returns A new array of objects
3688
+ */
3689
+ lastPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
3690
+ /**
3691
+ * @returns Boolean indicating if there is a next page
3692
+ */
3693
+ hasNextPage(): boolean;
3694
+ }
3259
3695
 
3260
3696
  /**
3261
3697
  * Common interface for performing operations on a table.
3262
3698
  */
3263
3699
  declare abstract class Repository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
3264
- abstract create(object: EditableData<Data> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3700
+ abstract create<K extends SelectableColumn<Record>>(object: Omit<EditableData<Data>, 'id'> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3701
+ abstract create(object: Omit<EditableData<Data>, 'id'> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3702
+ /**
3703
+ * Creates a single record in the table with a unique id.
3704
+ * @param id The unique id.
3705
+ * @param object Object containing the column names with their values to be stored in the table.
3706
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3707
+ * @returns The full persisted record.
3708
+ */
3709
+ abstract create<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Data>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3265
3710
  /**
3266
3711
  * Creates a single record in the table with a unique id.
3267
3712
  * @param id The unique id.
3268
3713
  * @param object Object containing the column names with their values to be stored in the table.
3269
3714
  * @returns The full persisted record.
3270
3715
  */
3271
- abstract create(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3716
+ abstract create(id: string, object: Omit<EditableData<Data>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3272
3717
  /**
3273
3718
  * Creates multiple records in the table.
3274
3719
  * @param objects Array of objects with the column names and the values to be stored in the table.
3275
- * @returns Array of the persisted records.
3720
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3721
+ * @returns Array of the persisted records in order.
3276
3722
  */
3277
- abstract create(objects: Array<EditableData<Data> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3723
+ abstract create<K extends SelectableColumn<Record>>(objects: Array<Omit<EditableData<Data>, 'id'> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3724
+ /**
3725
+ * Creates multiple records in the table.
3726
+ * @param objects Array of objects with the column names and the values to be stored in the table.
3727
+ * @returns Array of the persisted records in order.
3728
+ */
3729
+ abstract create(objects: Array<Omit<EditableData<Data>, 'id'> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3730
+ /**
3731
+ * Queries a single record from the table given its unique id.
3732
+ * @param id The unique id.
3733
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3734
+ * @returns The persisted record for the given id or null if the record could not be found.
3735
+ */
3736
+ abstract read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
3278
3737
  /**
3279
3738
  * Queries a single record from the table given its unique id.
3280
3739
  * @param id The unique id.
3281
3740
  * @returns The persisted record for the given id or null if the record could not be found.
3282
3741
  */
3283
3742
  abstract read(id: string): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
3743
+ /**
3744
+ * Queries multiple records from the table given their unique id.
3745
+ * @param ids The unique ids array.
3746
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3747
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
3748
+ */
3749
+ abstract read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3750
+ /**
3751
+ * Queries multiple records from the table given their unique id.
3752
+ * @param ids The unique ids array.
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(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3756
+ /**
3757
+ * Queries a single record from the table by the id in the object.
3758
+ * @param object Object containing the id of the record.
3759
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3760
+ * @returns The persisted record for the given id or null if the record could not be found.
3761
+ */
3762
+ abstract read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
3763
+ /**
3764
+ * Queries a single record from the table by the id in the object.
3765
+ * @param object Object containing the id of the record.
3766
+ * @returns The persisted record for the given id or null if the record could not be found.
3767
+ */
3768
+ abstract read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
3769
+ /**
3770
+ * Queries multiple records from the table by the ids in the objects.
3771
+ * @param objects Array of objects containing the ids of the records.
3772
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3773
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
3774
+ */
3775
+ abstract read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3776
+ /**
3777
+ * Queries multiple records from the table by the ids in the objects.
3778
+ * @param objects Array of objects containing the ids of the records.
3779
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
3780
+ */
3781
+ abstract read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3782
+ /**
3783
+ * Queries a single record from the table given its unique id.
3784
+ * @param id The unique id.
3785
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3786
+ * @returns The persisted record for the given id.
3787
+ * @throws If the record could not be found.
3788
+ */
3789
+ abstract readOrThrow<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3790
+ /**
3791
+ * Queries a single record from the table given its unique id.
3792
+ * @param id The unique id.
3793
+ * @returns The persisted record for the given id.
3794
+ * @throws If the record could not be found.
3795
+ */
3796
+ abstract readOrThrow(id: string): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3797
+ /**
3798
+ * Queries multiple records from the table given their unique id.
3799
+ * @param ids The unique ids array.
3800
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3801
+ * @returns The persisted records for the given ids in order.
3802
+ * @throws If one or more records could not be found.
3803
+ */
3804
+ abstract readOrThrow<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
3805
+ /**
3806
+ * Queries multiple records from the table given their unique id.
3807
+ * @param ids The unique ids array.
3808
+ * @returns The persisted records for the given ids in order.
3809
+ * @throws If one or more records could not be found.
3810
+ */
3811
+ abstract readOrThrow(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3812
+ /**
3813
+ * Queries a single record from the table by the id in the object.
3814
+ * @param object Object containing the id of the record.
3815
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3816
+ * @returns The persisted record for the given id.
3817
+ * @throws If the record could not be found.
3818
+ */
3819
+ abstract readOrThrow<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3820
+ /**
3821
+ * Queries a single record from the table by the id in the object.
3822
+ * @param object Object containing the id of the record.
3823
+ * @returns The persisted record for the given id.
3824
+ * @throws If the record could not be found.
3825
+ */
3826
+ abstract readOrThrow(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3827
+ /**
3828
+ * Queries multiple records from the table by the ids in the objects.
3829
+ * @param objects Array of objects containing the ids of the records.
3830
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3831
+ * @returns The persisted records for the given ids in order.
3832
+ * @throws If one or more records could not be found.
3833
+ */
3834
+ abstract readOrThrow<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
3835
+ /**
3836
+ * Queries multiple records from the table by the ids in the objects.
3837
+ * @param objects Array of objects containing the ids of the records.
3838
+ * @returns The persisted records for the given ids in order.
3839
+ * @throws If one or more records could not be found.
3840
+ */
3841
+ abstract readOrThrow(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3842
+ /**
3843
+ * Partially update a single record.
3844
+ * @param object An object with its id and the columns to be updated.
3845
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3846
+ * @returns The full persisted record, null if the record could not be found.
3847
+ */
3848
+ abstract update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Data>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3849
+ /**
3850
+ * Partially update a single record.
3851
+ * @param object An object with its id and the columns to be updated.
3852
+ * @returns The full persisted record, null if the record could not be found.
3853
+ */
3854
+ abstract update(object: Partial<EditableData<Data>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3855
+ /**
3856
+ * Partially update a single record given its unique id.
3857
+ * @param id The unique id.
3858
+ * @param object The column names and their values that have to be updated.
3859
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3860
+ * @returns The full persisted record, null if the record could not be found.
3861
+ */
3862
+ abstract update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Data>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3863
+ /**
3864
+ * Partially update a single record given its unique id.
3865
+ * @param id The unique id.
3866
+ * @param object The column names and their values that have to be updated.
3867
+ * @returns The full persisted record, null if the record could not be found.
3868
+ */
3869
+ abstract update(id: string, object: Partial<EditableData<Data>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3870
+ /**
3871
+ * Partially updates multiple records.
3872
+ * @param objects An array of objects with their ids and columns to be updated.
3873
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3874
+ * @returns Array of the persisted records in order (if a record could not be found null is returned).
3875
+ */
3876
+ abstract update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Data>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3877
+ /**
3878
+ * Partially updates multiple records.
3879
+ * @param objects An array of objects with their ids and columns to be updated.
3880
+ * @returns Array of the persisted records in order (if a record could not be found null is returned).
3881
+ */
3882
+ abstract update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3284
3883
  /**
3285
3884
  * Partially update a single record.
3286
3885
  * @param object An object with its id and the columns to be updated.
3886
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3887
+ * @returns The full persisted record.
3888
+ * @throws If the record could not be found.
3889
+ */
3890
+ abstract updateOrThrow<K extends SelectableColumn<Record>>(object: Partial<EditableData<Data>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3891
+ /**
3892
+ * Partially update a single record.
3893
+ * @param object An object with its id and the columns to be updated.
3894
+ * @returns The full persisted record.
3895
+ * @throws If the record could not be found.
3896
+ */
3897
+ abstract updateOrThrow(object: Partial<EditableData<Data>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3898
+ /**
3899
+ * Partially update a single record given its unique id.
3900
+ * @param id The unique id.
3901
+ * @param object The column names and their values that have to be updated.
3902
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3287
3903
  * @returns The full persisted record.
3904
+ * @throws If the record could not be found.
3288
3905
  */
3289
- abstract update(object: Partial<EditableData<Data>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3906
+ abstract updateOrThrow<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Data>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3290
3907
  /**
3291
3908
  * Partially update a single record given its unique id.
3292
3909
  * @param id The unique id.
3293
3910
  * @param object The column names and their values that have to be updated.
3294
3911
  * @returns The full persisted record.
3912
+ * @throws If the record could not be found.
3295
3913
  */
3296
- abstract update(id: string, object: Partial<EditableData<Data>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3914
+ abstract updateOrThrow(id: string, object: Partial<EditableData<Data>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3297
3915
  /**
3298
3916
  * Partially updates multiple records.
3299
3917
  * @param objects An array of objects with their ids and columns to be updated.
3300
- * @returns Array of the persisted records.
3918
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3919
+ * @returns Array of the persisted records in order.
3920
+ * @throws If one or more records could not be found.
3921
+ */
3922
+ abstract updateOrThrow<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Data>> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3923
+ /**
3924
+ * Partially updates multiple records.
3925
+ * @param objects An array of objects with their ids and columns to be updated.
3926
+ * @returns Array of the persisted records in order.
3927
+ * @throws If one or more records could not be found.
3928
+ */
3929
+ abstract updateOrThrow(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3930
+ /**
3931
+ * Creates or updates a single record. If a record exists with the given id,
3932
+ * it will be update, otherwise a new record will be created.
3933
+ * @param object Object containing the column names with their values to be persisted in the table.
3934
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3935
+ * @returns The full persisted record.
3301
3936
  */
3302
- abstract update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3937
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Data> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3303
3938
  /**
3304
3939
  * Creates or updates a single record. If a record exists with the given id,
3305
3940
  * it will be update, otherwise a new record will be created.
@@ -3312,9 +3947,26 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3312
3947
  * it will be update, otherwise a new record will be created.
3313
3948
  * @param id A unique id.
3314
3949
  * @param object The column names and the values to be persisted.
3950
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3315
3951
  * @returns The full persisted record.
3316
3952
  */
3317
- abstract createOrUpdate(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3953
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Data>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3954
+ /**
3955
+ * Creates or updates a single record. If a record exists with the given id,
3956
+ * it will be update, otherwise a new record will be created.
3957
+ * @param id A unique id.
3958
+ * @param object The column names and the values to be persisted.
3959
+ * @returns The full persisted record.
3960
+ */
3961
+ abstract createOrUpdate(id: string, object: Omit<EditableData<Data>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3962
+ /**
3963
+ * Creates or updates a single record. If a record exists with the given id,
3964
+ * it will be update, otherwise a new record will be created.
3965
+ * @param objects Array of objects with the column names and the values to be stored in the table.
3966
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3967
+ * @returns Array of the persisted records.
3968
+ */
3969
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Data> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3318
3970
  /**
3319
3971
  * Creates or updates a single record. If a record exists with the given id,
3320
3972
  * it will be update, otherwise a new record will be created.
@@ -3324,28 +3976,116 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3324
3976
  abstract createOrUpdate(objects: Array<EditableData<Data> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3325
3977
  /**
3326
3978
  * Deletes a record given its unique id.
3979
+ * @param object An object with a unique id.
3980
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3981
+ * @returns The deleted record, null if the record could not be found.
3982
+ */
3983
+ abstract delete<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3984
+ /**
3985
+ * Deletes a record given its unique id.
3986
+ * @param object An object with a unique id.
3987
+ * @returns The deleted record, null if the record could not be found.
3988
+ */
3989
+ abstract delete(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3990
+ /**
3991
+ * Deletes a record given a unique id.
3992
+ * @param id The unique id.
3993
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3994
+ * @returns The deleted record, null if the record could not be found.
3995
+ */
3996
+ abstract delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3997
+ /**
3998
+ * Deletes a record given a unique id.
3327
3999
  * @param id The unique id.
3328
- * @throws If the record could not be found or there was an error while performing the deletion.
4000
+ * @returns The deleted record, null if the record could not be found.
4001
+ */
4002
+ abstract delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4003
+ /**
4004
+ * Deletes multiple records given an array of objects with ids.
4005
+ * @param objects An array of objects with unique ids.
4006
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4007
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4008
+ */
4009
+ abstract delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Data>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4010
+ /**
4011
+ * Deletes multiple records given an array of objects with ids.
4012
+ * @param objects An array of objects with unique ids.
4013
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4014
+ */
4015
+ abstract delete(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4016
+ /**
4017
+ * Deletes multiple records given an array of unique ids.
4018
+ * @param objects An array of ids.
4019
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4020
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4021
+ */
4022
+ abstract delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4023
+ /**
4024
+ * Deletes multiple records given an array of unique ids.
4025
+ * @param objects An array of ids.
4026
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4027
+ */
4028
+ abstract delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4029
+ /**
4030
+ * Deletes a record given its unique id.
4031
+ * @param object An object with a unique id.
4032
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4033
+ * @returns The deleted record, null if the record could not be found.
4034
+ * @throws If the record could not be found.
3329
4035
  */
3330
- abstract delete(id: string): Promise<void>;
4036
+ abstract deleteOrThrow<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3331
4037
  /**
3332
4038
  * Deletes a record given its unique id.
3333
- * @param id An object with a unique id.
3334
- * @throws If the record could not be found or there was an error while performing the deletion.
4039
+ * @param object An object with a unique id.
4040
+ * @returns The deleted record, null if the record could not be found.
4041
+ * @throws If the record could not be found.
3335
4042
  */
3336
- abstract delete(id: Identifiable): Promise<void>;
4043
+ abstract deleteOrThrow(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3337
4044
  /**
3338
- * Deletes a record given a list of unique ids.
3339
- * @param ids The array of unique ids.
3340
- * @throws If the record could not be found or there was an error while performing the deletion.
4045
+ * Deletes a record given a unique id.
4046
+ * @param id The unique id.
4047
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4048
+ * @returns The deleted record, null if the record could not be found.
4049
+ * @throws If the record could not be found.
4050
+ */
4051
+ abstract deleteOrThrow<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4052
+ /**
4053
+ * Deletes a record given a unique id.
4054
+ * @param id The unique id.
4055
+ * @returns The deleted record, null if the record could not be found.
4056
+ * @throws If the record could not be found.
3341
4057
  */
3342
- abstract delete(ids: string[]): Promise<void>;
4058
+ abstract deleteOrThrow(id: string): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3343
4059
  /**
3344
- * Deletes a record given a list of unique ids.
3345
- * @param ids An array of objects with unique ids.
3346
- * @throws If the record could not be found or there was an error while performing the deletion.
4060
+ * Deletes multiple records given an array of objects with ids.
4061
+ * @param objects An array of objects with unique ids.
4062
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4063
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4064
+ * @throws If one or more records could not be found.
3347
4065
  */
3348
- abstract delete(ids: Identifiable[]): Promise<void>;
4066
+ abstract deleteOrThrow<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Data>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
4067
+ /**
4068
+ * Deletes multiple records given an array of objects with ids.
4069
+ * @param objects An array of objects with unique ids.
4070
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4071
+ * @throws If one or more records could not be found.
4072
+ */
4073
+ abstract deleteOrThrow(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
4074
+ /**
4075
+ * Deletes multiple records given an array of unique ids.
4076
+ * @param objects An array of ids.
4077
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
4078
+ * @returns Array of the deleted records in order (if a record could not be found null is returned).
4079
+ * @throws If one or more records could not be found.
4080
+ */
4081
+ abstract deleteOrThrow<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
4082
+ /**
4083
+ * Deletes multiple records given an array of unique ids.
4084
+ * @param objects An array of ids.
4085
+ * @returns Array of the deleted records in order.
4086
+ * @throws If one or more records could not be found.
4087
+ */
4088
+ abstract deleteOrThrow(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3349
4089
  /**
3350
4090
  * Search for records in the table.
3351
4091
  * @param query The query to search for.
@@ -3353,37 +4093,145 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3353
4093
  * @returns The found records.
3354
4094
  */
3355
4095
  abstract search(query: string, options?: {
3356
- fuzziness?: number;
4096
+ fuzziness?: FuzzinessExpression;
4097
+ prefix?: PrefixExpression;
4098
+ highlight?: HighlightExpression;
3357
4099
  filter?: Filter<Record>;
3358
- }): Promise<SelectedPick<Record, ['*']>[]>;
4100
+ boosters?: Boosters<Record>[];
4101
+ }): Promise<SearchXataRecord<SelectedPick<Record, ['*']>>[]>;
3359
4102
  abstract query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3360
4103
  }
3361
4104
  declare class RestRepository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Data, Record> {
3362
4105
  #private;
3363
- db: SchemaPluginResult<any>;
3364
4106
  constructor(options: {
3365
4107
  table: string;
3366
4108
  db: SchemaPluginResult<any>;
3367
4109
  pluginOptions: XataPluginOptions;
4110
+ schemaTables?: Table[];
3368
4111
  });
3369
- create(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3370
- create(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3371
- create(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3372
- read(recordId: string): Promise<SelectedPick<Record, ['*']> | null>;
3373
- update(object: Partial<EditableData<Data>> & Identifiable): Promise<SelectedPick<Record, ['*']>>;
3374
- update(recordId: string, object: Partial<EditableData<Data>>): Promise<SelectedPick<Record, ['*']>>;
3375
- update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<SelectedPick<Record, ['*']>[]>;
3376
- createOrUpdate(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3377
- createOrUpdate(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3378
- createOrUpdate(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3379
- delete(a: string | Identifiable | Array<string | Identifiable>): Promise<void>;
4112
+ create<K extends SelectableColumn<Record>>(object: EditableData<Data> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4113
+ create(object: EditableData<Data> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4114
+ create<K extends SelectableColumn<Record>>(id: string, object: EditableData<Data>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4115
+ create(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4116
+ create<K extends SelectableColumn<Record>>(objects: Array<EditableData<Data> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4117
+ create(objects: Array<EditableData<Data> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4118
+ read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
4119
+ read(id: string): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4120
+ read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4121
+ read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4122
+ read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
4123
+ read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
4124
+ read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4125
+ read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4126
+ readOrThrow<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4127
+ readOrThrow(id: string): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4128
+ readOrThrow<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
4129
+ readOrThrow(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
4130
+ readOrThrow<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4131
+ readOrThrow(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4132
+ readOrThrow<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
4133
+ readOrThrow(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
4134
+ update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Data>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4135
+ update(object: Partial<EditableData<Data>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4136
+ update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Data>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4137
+ update(id: string, object: Partial<EditableData<Data>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4138
+ update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Data>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4139
+ update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4140
+ updateOrThrow<K extends SelectableColumn<Record>>(object: Partial<EditableData<Data>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4141
+ updateOrThrow(object: Partial<EditableData<Data>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4142
+ updateOrThrow<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Data>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4143
+ updateOrThrow(id: string, object: Partial<EditableData<Data>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4144
+ updateOrThrow<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Data>> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4145
+ updateOrThrow(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4146
+ createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Data> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4147
+ createOrUpdate(object: EditableData<Data> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4148
+ createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Data>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4149
+ createOrUpdate(id: string, object: Omit<EditableData<Data>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4150
+ createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Data> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
4151
+ createOrUpdate(objects: Array<EditableData<Data> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
4152
+ delete<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4153
+ delete(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4154
+ delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
4155
+ delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
4156
+ delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Data>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4157
+ delete(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4158
+ delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
4159
+ delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
4160
+ deleteOrThrow<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4161
+ deleteOrThrow(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4162
+ deleteOrThrow<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
4163
+ deleteOrThrow(id: string): Promise<Readonly<SelectedPick<Record, ['*']>>>;
4164
+ deleteOrThrow<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Data>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
4165
+ deleteOrThrow(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
4166
+ deleteOrThrow<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
4167
+ deleteOrThrow(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3380
4168
  search(query: string, options?: {
3381
- fuzziness?: number;
4169
+ fuzziness?: FuzzinessExpression;
4170
+ prefix?: PrefixExpression;
4171
+ highlight?: HighlightExpression;
3382
4172
  filter?: Filter<Record>;
3383
- }): Promise<SelectedPick<Record, ['*']>[]>;
4173
+ boosters?: Boosters<Record>[];
4174
+ }): Promise<any>;
3384
4175
  query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3385
4176
  }
3386
4177
 
4178
+ declare type BaseSchema = {
4179
+ name: string;
4180
+ columns: readonly ({
4181
+ name: string;
4182
+ type: Column['type'];
4183
+ } | {
4184
+ name: string;
4185
+ type: 'link';
4186
+ link: {
4187
+ table: string;
4188
+ };
4189
+ } | {
4190
+ name: string;
4191
+ type: 'object';
4192
+ columns: {
4193
+ name: string;
4194
+ type: string;
4195
+ }[];
4196
+ })[];
4197
+ };
4198
+ declare type SchemaInference<T extends readonly BaseSchema[]> = T extends never[] ? Record<string, Record<string, any>> : T extends readonly unknown[] ? T[number] extends {
4199
+ name: string;
4200
+ columns: readonly unknown[];
4201
+ } ? {
4202
+ [K in T[number]['name']]: TableType<T[number], K>;
4203
+ } : never : never;
4204
+ declare type TableType<Tables, TableName> = Tables & {
4205
+ name: TableName;
4206
+ } extends infer Table ? Table extends {
4207
+ name: string;
4208
+ columns: infer Columns;
4209
+ } ? Columns extends readonly unknown[] ? Columns[number] extends {
4210
+ name: string;
4211
+ type: string;
4212
+ } ? Identifiable & {
4213
+ [K in Columns[number]['name']]?: PropertyType<Tables, Columns[number], K>;
4214
+ } : never : never : never : never;
4215
+ declare type PropertyType<Tables, Properties, PropertyName> = Properties & {
4216
+ name: PropertyName;
4217
+ } extends infer Property ? Property extends {
4218
+ name: string;
4219
+ type: infer Type;
4220
+ link?: {
4221
+ table: infer LinkedTable;
4222
+ };
4223
+ columns?: infer ObjectColumns;
4224
+ } ? (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 {
4225
+ name: string;
4226
+ type: string;
4227
+ } ? {
4228
+ [K in ObjectColumns[number]['name']]?: PropertyType<Tables, ObjectColumns[number], K>;
4229
+ } : never : never : Type extends 'link' ? TableType<Tables, LinkedTable> & XataRecord : never) | null : never : never;
4230
+
4231
+ /**
4232
+ * Operator to restrict results to only values that are greater than the given value.
4233
+ */
4234
+ declare const greaterThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3387
4235
  /**
3388
4236
  * Operator to restrict results to only values that are greater than the given value.
3389
4237
  */
@@ -3391,15 +4239,35 @@ declare const gt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T
3391
4239
  /**
3392
4240
  * Operator to restrict results to only values that are greater than or equal to the given value.
3393
4241
  */
3394
- declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4242
+ declare const greaterThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4243
+ /**
4244
+ * Operator to restrict results to only values that are greater than or equal to the given value.
4245
+ */
4246
+ declare const greaterEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3395
4247
  /**
3396
4248
  * Operator to restrict results to only values that are greater than or equal to the given value.
3397
4249
  */
3398
4250
  declare const gte: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4251
+ /**
4252
+ * Operator to restrict results to only values that are greater than or equal to the given value.
4253
+ */
4254
+ declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4255
+ /**
4256
+ * Operator to restrict results to only values that are lower than the given value.
4257
+ */
4258
+ declare const lessThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3399
4259
  /**
3400
4260
  * Operator to restrict results to only values that are lower than the given value.
3401
4261
  */
3402
4262
  declare const lt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4263
+ /**
4264
+ * Operator to restrict results to only values that are lower than or equal to the given value.
4265
+ */
4266
+ declare const lessThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
4267
+ /**
4268
+ * Operator to restrict results to only values that are lower than or equal to the given value.
4269
+ */
4270
+ declare const lessEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
3403
4271
  /**
3404
4272
  * Operator to restrict results to only values that are lower than or equal to the given value.
3405
4273
  */
@@ -3432,6 +4300,10 @@ declare const pattern: (value: string) => StringTypeFilter;
3432
4300
  * Operator to restrict results to only values that are equal to the given value.
3433
4301
  */
3434
4302
  declare const is: <T>(value: T) => PropertyFilter<T>;
4303
+ /**
4304
+ * Operator to restrict results to only values that are equal to the given value.
4305
+ */
4306
+ declare const equals: <T>(value: T) => PropertyFilter<T>;
3435
4307
  /**
3436
4308
  * Operator to restrict results to only values that are not equal to the given value.
3437
4309
  */
@@ -3467,38 +4339,10 @@ declare type SchemaPluginResult<Schemas extends Record<string, BaseData>> = {
3467
4339
  };
3468
4340
  declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
3469
4341
  #private;
3470
- private tableNames?;
3471
- constructor(tableNames?: string[] | undefined);
4342
+ constructor(schemaTables?: Schemas.Table[]);
3472
4343
  build(pluginOptions: XataPluginOptions): SchemaPluginResult<Schemas>;
3473
4344
  }
3474
4345
 
3475
- declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3476
- fuzziness?: number;
3477
- tables?: Tables[];
3478
- };
3479
- declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3480
- all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3481
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]: {
3482
- table: Model;
3483
- record: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>>;
3484
- };
3485
- }>[]>;
3486
- byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3487
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]?: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>[]>;
3488
- }>;
3489
- };
3490
- declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
3491
- #private;
3492
- private db;
3493
- constructor(db: SchemaPluginResult<Schemas>);
3494
- build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
3495
- }
3496
- declare type SearchXataRecord = XataRecord & {
3497
- xata: {
3498
- table: string;
3499
- };
3500
- };
3501
-
3502
4346
  declare type BranchStrategyValue = string | undefined | null;
3503
4347
  declare type BranchStrategyBuilder = () => BranchStrategyValue | Promise<BranchStrategyValue>;
3504
4348
  declare type BranchStrategy = BranchStrategyValue | BranchStrategyBuilder;
@@ -3510,19 +4354,34 @@ declare type BaseClientOptions = {
3510
4354
  databaseURL?: string;
3511
4355
  branch?: BranchStrategyOption;
3512
4356
  cache?: CacheImpl;
4357
+ trace?: TraceFunction;
3513
4358
  };
3514
4359
  declare const buildClient: <Plugins extends Record<string, XataPlugin> = {}>(plugins?: Plugins | undefined) => ClientConstructor<Plugins>;
3515
4360
  interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
3516
- new <Schemas extends Record<string, BaseData> = {}>(options?: Partial<BaseClientOptions>, tables?: string[]): Omit<{
3517
- db: Awaited<ReturnType<SchemaPlugin<Schemas>['build']>>;
3518
- search: Awaited<ReturnType<SearchPlugin<Schemas>['build']>>;
4361
+ new <T extends readonly BaseSchema[]>(options?: Partial<BaseClientOptions>, schemaTables?: T): Omit<{
4362
+ db: Awaited<ReturnType<SchemaPlugin<SchemaInference<NonNullable<typeof schemaTables>>>['build']>>;
4363
+ search: Awaited<ReturnType<SearchPlugin<SchemaInference<NonNullable<typeof schemaTables>>>['build']>>;
3519
4364
  }, keyof Plugins> & {
3520
4365
  [Key in StringKeys<NonNullable<Plugins>>]: Awaited<ReturnType<NonNullable<Plugins>[Key]['build']>>;
4366
+ } & {
4367
+ getConfig(): Promise<{
4368
+ databaseURL: string;
4369
+ branch: string;
4370
+ }>;
3521
4371
  };
3522
4372
  }
3523
4373
  declare const BaseClient_base: ClientConstructor<{}>;
3524
- declare class BaseClient extends BaseClient_base<Record<string, any>> {
4374
+ declare class BaseClient extends BaseClient_base<[]> {
4375
+ }
4376
+
4377
+ declare class Serializer {
4378
+ classes: Record<string, any>;
4379
+ add(clazz: any): void;
4380
+ toJSON<T>(data: T): string;
4381
+ fromJSON<T>(json: string): T;
3525
4382
  }
4383
+ declare const serialize: <T>(data: T) => string;
4384
+ declare const deserialize: <T>(json: string) => T;
3526
4385
 
3527
4386
  declare type BranchResolutionOptions = {
3528
4387
  databaseURL?: string;
@@ -3535,9 +4394,89 @@ declare function getDatabaseURL(): string | undefined;
3535
4394
 
3536
4395
  declare function getAPIKey(): string | undefined;
3537
4396
 
4397
+ interface Body {
4398
+ arrayBuffer(): Promise<ArrayBuffer>;
4399
+ blob(): Promise<Blob>;
4400
+ formData(): Promise<FormData>;
4401
+ json(): Promise<any>;
4402
+ text(): Promise<string>;
4403
+ }
4404
+ interface Blob {
4405
+ readonly size: number;
4406
+ readonly type: string;
4407
+ arrayBuffer(): Promise<ArrayBuffer>;
4408
+ slice(start?: number, end?: number, contentType?: string): Blob;
4409
+ text(): Promise<string>;
4410
+ }
4411
+ /** Provides information about files and allows JavaScript in a web page to access their content. */
4412
+ interface File extends Blob {
4413
+ readonly lastModified: number;
4414
+ readonly name: string;
4415
+ readonly webkitRelativePath: string;
4416
+ }
4417
+ declare type FormDataEntryValue = File | string;
4418
+ /** 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". */
4419
+ interface FormData {
4420
+ append(name: string, value: string | Blob, fileName?: string): void;
4421
+ delete(name: string): void;
4422
+ get(name: string): FormDataEntryValue | null;
4423
+ getAll(name: string): FormDataEntryValue[];
4424
+ has(name: string): boolean;
4425
+ set(name: string, value: string | Blob, fileName?: string): void;
4426
+ forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void;
4427
+ }
4428
+ /** 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. */
4429
+ interface Headers {
4430
+ append(name: string, value: string): void;
4431
+ delete(name: string): void;
4432
+ get(name: string): string | null;
4433
+ has(name: string): boolean;
4434
+ set(name: string, value: string): void;
4435
+ forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void;
4436
+ }
4437
+ interface Request extends Body {
4438
+ /** Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching. */
4439
+ readonly cache: 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload';
4440
+ /** 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. */
4441
+ readonly credentials: 'include' | 'omit' | 'same-origin';
4442
+ /** Returns the kind of resource requested by request, e.g., "document" or "script". */
4443
+ readonly destination: '' | 'audio' | 'audioworklet' | 'document' | 'embed' | 'font' | 'frame' | 'iframe' | 'image' | 'manifest' | 'object' | 'paintworklet' | 'report' | 'script' | 'sharedworker' | 'style' | 'track' | 'video' | 'worker' | 'xslt';
4444
+ /** 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. */
4445
+ readonly headers: Headers;
4446
+ /** 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] */
4447
+ readonly integrity: string;
4448
+ /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
4449
+ readonly keepalive: boolean;
4450
+ /** Returns request's HTTP method, which is "GET" by default. */
4451
+ readonly method: string;
4452
+ /** 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. */
4453
+ readonly mode: 'cors' | 'navigate' | 'no-cors' | 'same-origin';
4454
+ /** 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. */
4455
+ readonly redirect: 'error' | 'follow' | 'manual';
4456
+ /** 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. */
4457
+ readonly referrer: string;
4458
+ /** Returns the referrer policy associated with request. This is used during fetching to compute the value of the request's referrer. */
4459
+ readonly referrerPolicy: '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
4460
+ /** Returns the URL of request as a string. */
4461
+ readonly url: string;
4462
+ clone(): Request;
4463
+ }
4464
+
4465
+ declare type XataWorkerContext<XataClient> = {
4466
+ xata: XataClient;
4467
+ request: Request;
4468
+ env: Record<string, string | undefined>;
4469
+ };
4470
+ declare type RemoveFirst<T> = T extends [any, ...infer U] ? U : never;
4471
+ declare type WorkerRunnerConfig = {
4472
+ workspace: string;
4473
+ worker: string;
4474
+ };
4475
+ 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>>>;
4476
+
3538
4477
  declare class XataError extends Error {
3539
4478
  readonly status: number;
3540
4479
  constructor(message: string, status: number);
3541
4480
  }
3542
4481
 
3543
- 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, 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 };
4482
+ 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 };