@xata.io/client 0.0.0-alpha.vf6d8daa → 0.0.0-alpha.vf73045e

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
@@ -6,6 +6,9 @@ declare type FetchImpl = (url: string, init?: {
6
6
  ok: boolean;
7
7
  status: number;
8
8
  json(): Promise<any>;
9
+ headers?: {
10
+ get(name: string): string | null;
11
+ };
9
12
  }>;
10
13
  declare type WorkspaceApiUrlBuilder = (path: string, pathParams: Record<string, string>) => string;
11
14
  declare type FetcherExtraProps = {
@@ -20,15 +23,22 @@ declare type ErrorWrapper<TError> = TError | {
20
23
  };
21
24
 
22
25
  interface CacheImpl {
26
+ defaultQueryTTL: number;
23
27
  getAll(): Promise<Record<string, unknown>>;
24
28
  get: <T>(key: string) => Promise<T | null>;
25
29
  set: <T>(key: string, value: T) => Promise<void>;
26
30
  delete: (key: string) => Promise<void>;
27
31
  clear: () => Promise<void>;
28
32
  }
33
+ interface SimpleCacheOptions {
34
+ max?: number;
35
+ defaultQueryTTL?: number;
36
+ }
29
37
  declare class SimpleCache implements CacheImpl {
30
38
  #private;
31
- constructor();
39
+ capacity: number;
40
+ defaultQueryTTL: number;
41
+ constructor(options?: SimpleCacheOptions);
32
42
  getAll(): Promise<Record<string, unknown>>;
33
43
  get<T>(key: string): Promise<T | null>;
34
44
  set<T>(key: string, value: T): Promise<void>;
@@ -112,22 +122,32 @@ declare type WorkspaceMembers = {
112
122
  * @pattern ^ik_[a-zA-Z0-9]+
113
123
  */
114
124
  declare type InviteKey = string;
125
+ /**
126
+ * Metadata of databases
127
+ */
128
+ declare type DatabaseMetadata = {
129
+ name: string;
130
+ displayName: string;
131
+ createdAt: DateTime;
132
+ numberOfBranches: number;
133
+ ui?: {
134
+ color?: string;
135
+ };
136
+ };
115
137
  declare type ListDatabasesResponse = {
116
- databases?: {
117
- name: string;
118
- displayName: string;
119
- createdAt: DateTime;
120
- numberOfBranches: number;
121
- ui?: {
122
- color?: string;
123
- };
124
- }[];
138
+ databases?: DatabaseMetadata[];
125
139
  };
126
140
  declare type ListBranchesResponse = {
127
141
  databaseName: string;
128
142
  displayName: string;
129
143
  branches: Branch[];
130
144
  };
145
+ declare type ListGitBranchesResponse = {
146
+ mapping: {
147
+ gitBranch: string;
148
+ xataBranch: string;
149
+ }[];
150
+ };
131
151
  declare type Branch = {
132
152
  name: string;
133
153
  createdAt: DateTime;
@@ -176,7 +196,7 @@ declare type Table = {
176
196
  */
177
197
  declare type Column = {
178
198
  name: string;
179
- type: 'bool' | 'int' | 'float' | 'string' | 'text' | 'email' | 'multiple' | 'link' | 'object';
199
+ type: 'bool' | 'int' | 'float' | 'string' | 'text' | 'email' | 'multiple' | 'link' | 'object' | 'datetime';
180
200
  link?: {
181
201
  table: string;
182
202
  };
@@ -252,6 +272,21 @@ declare type SortExpression = string[] | {
252
272
  [key: string]: SortOrder;
253
273
  }[];
254
274
  declare type SortOrder = 'asc' | 'desc';
275
+ /**
276
+ * Maximum [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) for the search terms. The Levenshtein
277
+ * distance is the number of one charcter changes needed to make two strings equal. The default is 1, meaning that single
278
+ * character typos per word are tollerated by search. You can set it to 0 to remove the typo tollerance or set it to 2
279
+ * to allow two typos in a word.
280
+ *
281
+ * @default 1
282
+ * @maximum 2
283
+ * @minimum 0
284
+ */
285
+ declare type FuzzinessExpression = number;
286
+ /**
287
+ * 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.
288
+ */
289
+ declare type PrefixExpression = 'phrase' | 'disabled';
255
290
  /**
256
291
  * @minProperties 1
257
292
  */
@@ -265,6 +300,48 @@ declare type FilterExpression = {
265
300
  } & {
266
301
  [key: string]: FilterColumn;
267
302
  };
303
+ declare type HighlightExpression = {
304
+ enabled?: boolean;
305
+ encodeHTML?: boolean;
306
+ };
307
+ /**
308
+ * Booster Expression
309
+ *
310
+ * @x-go-type xata.BoosterExpression
311
+ */
312
+ declare type BoosterExpression = {
313
+ valueBooster?: ValueBooster$1;
314
+ } | {
315
+ numericBooster?: NumericBooster$1;
316
+ } | {
317
+ dateBooster?: DateBooster$1;
318
+ };
319
+ /**
320
+ * Boost records with a particular value for a column.
321
+ */
322
+ declare type ValueBooster$1 = {
323
+ column: string;
324
+ value: string | number | boolean;
325
+ factor: number;
326
+ };
327
+ /**
328
+ * Boost records based on the value of a numeric column.
329
+ */
330
+ declare type NumericBooster$1 = {
331
+ column: string;
332
+ factor: number;
333
+ };
334
+ /**
335
+ * Boost records based on the value of a datetime column. It is configured via "origin", "scale", and "decay". The further away from the "origin",
336
+ * 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
337
+ * 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.
338
+ */
339
+ declare type DateBooster$1 = {
340
+ column: string;
341
+ origin?: string;
342
+ scale: string;
343
+ decay: number;
344
+ };
268
345
  declare type FilterList = FilterExpression | FilterExpression[];
269
346
  declare type FilterColumn = FilterColumnIncludes | FilterPredicate | FilterList;
270
347
  /**
@@ -321,7 +398,24 @@ declare type PageConfig = {
321
398
  size?: number;
322
399
  offset?: number;
323
400
  };
324
- declare type ColumnsFilter = string[];
401
+ declare type ColumnsProjection = string[];
402
+ /**
403
+ * Xata Table Record Metadata
404
+ */
405
+ declare type RecordMeta = {
406
+ id: RecordID;
407
+ xata: {
408
+ version: number;
409
+ table?: string;
410
+ highlight?: {
411
+ [key: string]: string[] | {
412
+ [key: string]: any;
413
+ };
414
+ };
415
+ score?: number;
416
+ warnings?: string[];
417
+ };
418
+ };
325
419
  /**
326
420
  * @pattern [a-zA-Z0-9_-~:]+
327
421
  */
@@ -343,16 +437,9 @@ declare type RecordsMetadata = {
343
437
  };
344
438
  };
345
439
  /**
346
- * Xata Table Record
440
+ * Xata Table Record Metadata
347
441
  */
348
- declare type XataRecord$1 = {
349
- id: RecordID;
350
- xata: {
351
- version: number;
352
- table?: string;
353
- warnings?: string[];
354
- };
355
- } & {
442
+ declare type XataRecord$1 = RecordMeta & {
356
443
  [key: string]: any;
357
444
  };
358
445
 
@@ -370,8 +457,10 @@ type schemas_InviteID = InviteID;
370
457
  type schemas_WorkspaceInvite = WorkspaceInvite;
371
458
  type schemas_WorkspaceMembers = WorkspaceMembers;
372
459
  type schemas_InviteKey = InviteKey;
460
+ type schemas_DatabaseMetadata = DatabaseMetadata;
373
461
  type schemas_ListDatabasesResponse = ListDatabasesResponse;
374
462
  type schemas_ListBranchesResponse = ListBranchesResponse;
463
+ type schemas_ListGitBranchesResponse = ListGitBranchesResponse;
375
464
  type schemas_Branch = Branch;
376
465
  type schemas_BranchMetadata = BranchMetadata;
377
466
  type schemas_DBBranch = DBBranch;
@@ -392,7 +481,11 @@ type schemas_TableMigration = TableMigration;
392
481
  type schemas_ColumnMigration = ColumnMigration;
393
482
  type schemas_SortExpression = SortExpression;
394
483
  type schemas_SortOrder = SortOrder;
484
+ type schemas_FuzzinessExpression = FuzzinessExpression;
485
+ type schemas_PrefixExpression = PrefixExpression;
395
486
  type schemas_FilterExpression = FilterExpression;
487
+ type schemas_HighlightExpression = HighlightExpression;
488
+ type schemas_BoosterExpression = BoosterExpression;
396
489
  type schemas_FilterList = FilterList;
397
490
  type schemas_FilterColumn = FilterColumn;
398
491
  type schemas_FilterColumnIncludes = FilterColumnIncludes;
@@ -402,7 +495,8 @@ type schemas_FilterPredicateRangeOp = FilterPredicateRangeOp;
402
495
  type schemas_FilterRangeValue = FilterRangeValue;
403
496
  type schemas_FilterValue = FilterValue;
404
497
  type schemas_PageConfig = PageConfig;
405
- type schemas_ColumnsFilter = ColumnsFilter;
498
+ type schemas_ColumnsProjection = ColumnsProjection;
499
+ type schemas_RecordMeta = RecordMeta;
406
500
  type schemas_RecordID = RecordID;
407
501
  type schemas_TableRename = TableRename;
408
502
  type schemas_RecordsMetadata = RecordsMetadata;
@@ -422,8 +516,10 @@ declare namespace schemas {
422
516
  schemas_WorkspaceInvite as WorkspaceInvite,
423
517
  schemas_WorkspaceMembers as WorkspaceMembers,
424
518
  schemas_InviteKey as InviteKey,
519
+ schemas_DatabaseMetadata as DatabaseMetadata,
425
520
  schemas_ListDatabasesResponse as ListDatabasesResponse,
426
521
  schemas_ListBranchesResponse as ListBranchesResponse,
522
+ schemas_ListGitBranchesResponse as ListGitBranchesResponse,
427
523
  schemas_Branch as Branch,
428
524
  schemas_BranchMetadata as BranchMetadata,
429
525
  schemas_DBBranch as DBBranch,
@@ -444,7 +540,14 @@ declare namespace schemas {
444
540
  schemas_ColumnMigration as ColumnMigration,
445
541
  schemas_SortExpression as SortExpression,
446
542
  schemas_SortOrder as SortOrder,
543
+ schemas_FuzzinessExpression as FuzzinessExpression,
544
+ schemas_PrefixExpression as PrefixExpression,
447
545
  schemas_FilterExpression as FilterExpression,
546
+ schemas_HighlightExpression as HighlightExpression,
547
+ schemas_BoosterExpression as BoosterExpression,
548
+ ValueBooster$1 as ValueBooster,
549
+ NumericBooster$1 as NumericBooster,
550
+ DateBooster$1 as DateBooster,
448
551
  schemas_FilterList as FilterList,
449
552
  schemas_FilterColumn as FilterColumn,
450
553
  schemas_FilterColumnIncludes as FilterColumnIncludes,
@@ -454,7 +557,8 @@ declare namespace schemas {
454
557
  schemas_FilterRangeValue as FilterRangeValue,
455
558
  schemas_FilterValue as FilterValue,
456
559
  schemas_PageConfig as PageConfig,
457
- schemas_ColumnsFilter as ColumnsFilter,
560
+ schemas_ColumnsProjection as ColumnsProjection,
561
+ schemas_RecordMeta as RecordMeta,
458
562
  schemas_RecordID as RecordID,
459
563
  schemas_TableRename as TableRename,
460
564
  schemas_RecordsMetadata as RecordsMetadata,
@@ -489,11 +593,17 @@ declare type BulkError = {
489
593
  status?: number;
490
594
  }[];
491
595
  };
596
+ declare type BulkInsertResponse = {
597
+ recordIDs: string[];
598
+ } | {
599
+ records: XataRecord$1[];
600
+ };
492
601
  declare type BranchMigrationPlan = {
493
602
  version: number;
494
603
  migration: BranchMigration;
495
604
  };
496
- declare type RecordUpdateResponse = {
605
+ declare type RecordResponse = XataRecord$1;
606
+ declare type RecordUpdateResponse = XataRecord$1 | {
497
607
  id: string;
498
608
  xata: {
499
609
  version: number;
@@ -517,7 +627,9 @@ type responses_SimpleError = SimpleError;
517
627
  type responses_BadRequestError = BadRequestError;
518
628
  type responses_AuthError = AuthError;
519
629
  type responses_BulkError = BulkError;
630
+ type responses_BulkInsertResponse = BulkInsertResponse;
520
631
  type responses_BranchMigrationPlan = BranchMigrationPlan;
632
+ type responses_RecordResponse = RecordResponse;
521
633
  type responses_RecordUpdateResponse = RecordUpdateResponse;
522
634
  type responses_QueryResponse = QueryResponse;
523
635
  type responses_SearchResponse = SearchResponse;
@@ -528,7 +640,9 @@ declare namespace responses {
528
640
  responses_BadRequestError as BadRequestError,
529
641
  responses_AuthError as AuthError,
530
642
  responses_BulkError as BulkError,
643
+ responses_BulkInsertResponse as BulkInsertResponse,
531
644
  responses_BranchMigrationPlan as BranchMigrationPlan,
645
+ responses_RecordResponse as RecordResponse,
532
646
  responses_RecordUpdateResponse as RecordUpdateResponse,
533
647
  responses_QueryResponse as QueryResponse,
534
648
  responses_SearchResponse as SearchResponse,
@@ -834,6 +948,9 @@ declare type InviteWorkspaceMemberError = ErrorWrapper<{
834
948
  } | {
835
949
  status: 404;
836
950
  payload: SimpleError;
951
+ } | {
952
+ status: 409;
953
+ payload: SimpleError;
837
954
  }>;
838
955
  declare type InviteWorkspaceMemberRequestBody = {
839
956
  email: string;
@@ -847,6 +964,34 @@ declare type InviteWorkspaceMemberVariables = {
847
964
  * Invite some user to join the workspace with the given role
848
965
  */
849
966
  declare const inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<WorkspaceInvite>;
967
+ declare type UpdateWorkspaceMemberInvitePathParams = {
968
+ workspaceId: WorkspaceID;
969
+ inviteId: InviteID;
970
+ };
971
+ declare type UpdateWorkspaceMemberInviteError = ErrorWrapper<{
972
+ status: 400;
973
+ payload: BadRequestError;
974
+ } | {
975
+ status: 401;
976
+ payload: AuthError;
977
+ } | {
978
+ status: 404;
979
+ payload: SimpleError;
980
+ } | {
981
+ status: 422;
982
+ payload: SimpleError;
983
+ }>;
984
+ declare type UpdateWorkspaceMemberInviteRequestBody = {
985
+ role: Role;
986
+ };
987
+ declare type UpdateWorkspaceMemberInviteVariables = {
988
+ body: UpdateWorkspaceMemberInviteRequestBody;
989
+ pathParams: UpdateWorkspaceMemberInvitePathParams;
990
+ } & FetcherExtraProps;
991
+ /**
992
+ * 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.
993
+ */
994
+ declare const updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
850
995
  declare type CancelWorkspaceMemberInvitePathParams = {
851
996
  workspaceId: WorkspaceID;
852
997
  inviteId: InviteID;
@@ -1000,6 +1145,184 @@ declare type DeleteDatabaseVariables = {
1000
1145
  * Delete a database and all of its branches and tables permanently.
1001
1146
  */
1002
1147
  declare const deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
1148
+ declare type GetDatabaseMetadataPathParams = {
1149
+ dbName: DBName;
1150
+ workspace: string;
1151
+ };
1152
+ declare type GetDatabaseMetadataError = ErrorWrapper<{
1153
+ status: 400;
1154
+ payload: BadRequestError;
1155
+ } | {
1156
+ status: 401;
1157
+ payload: AuthError;
1158
+ } | {
1159
+ status: 404;
1160
+ payload: SimpleError;
1161
+ }>;
1162
+ declare type GetDatabaseMetadataVariables = {
1163
+ pathParams: GetDatabaseMetadataPathParams;
1164
+ } & FetcherExtraProps;
1165
+ /**
1166
+ * Retrieve metadata of the given database
1167
+ */
1168
+ declare const getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
1169
+ declare type GetGitBranchesMappingPathParams = {
1170
+ dbName: DBName;
1171
+ workspace: string;
1172
+ };
1173
+ declare type GetGitBranchesMappingError = ErrorWrapper<{
1174
+ status: 400;
1175
+ payload: BadRequestError;
1176
+ } | {
1177
+ status: 401;
1178
+ payload: AuthError;
1179
+ }>;
1180
+ declare type GetGitBranchesMappingVariables = {
1181
+ pathParams: GetGitBranchesMappingPathParams;
1182
+ } & FetcherExtraProps;
1183
+ /**
1184
+ * Lists all the git branches in the mapping, and their associated Xata branches.
1185
+ *
1186
+ * Example response:
1187
+ *
1188
+ * ```json
1189
+ * {
1190
+ * "mappings": [
1191
+ * {
1192
+ * "gitBranch": "main",
1193
+ * "xataBranch": "main"
1194
+ * },
1195
+ * {
1196
+ * "gitBranch": "gitBranch1",
1197
+ * "xataBranch": "xataBranch1"
1198
+ * }
1199
+ * {
1200
+ * "gitBranch": "xataBranch2",
1201
+ * "xataBranch": "xataBranch2"
1202
+ * }
1203
+ * ]
1204
+ * }
1205
+ * ```
1206
+ */
1207
+ declare const getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
1208
+ declare type AddGitBranchesEntryPathParams = {
1209
+ dbName: DBName;
1210
+ workspace: string;
1211
+ };
1212
+ declare type AddGitBranchesEntryError = ErrorWrapper<{
1213
+ status: 400;
1214
+ payload: BadRequestError;
1215
+ } | {
1216
+ status: 401;
1217
+ payload: AuthError;
1218
+ }>;
1219
+ declare type AddGitBranchesEntryResponse = {
1220
+ warning?: string;
1221
+ };
1222
+ declare type AddGitBranchesEntryRequestBody = {
1223
+ gitBranch: string;
1224
+ xataBranch: BranchName;
1225
+ };
1226
+ declare type AddGitBranchesEntryVariables = {
1227
+ body: AddGitBranchesEntryRequestBody;
1228
+ pathParams: AddGitBranchesEntryPathParams;
1229
+ } & FetcherExtraProps;
1230
+ /**
1231
+ * Adds an entry to the mapping of git branches to Xata branches. The git branch and the Xata branch must be present in the body of the request. If the Xata branch doesn't exist, a 400 error is returned.
1232
+ *
1233
+ * If the git branch is already present in the mapping, the old entry is overwritten, and a warning message is included in the response. If the git branch is added and didn't exist before, the response code is 204. If the git branch existed and it was overwritten, the response code is 201.
1234
+ *
1235
+ * Example request:
1236
+ *
1237
+ * ```json
1238
+ * // POST https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches
1239
+ * {
1240
+ * "gitBranch": "fix/bug123",
1241
+ * "xataBranch": "fix_bug"
1242
+ * }
1243
+ * ```
1244
+ */
1245
+ declare const addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
1246
+ declare type RemoveGitBranchesEntryPathParams = {
1247
+ dbName: DBName;
1248
+ workspace: string;
1249
+ };
1250
+ declare type RemoveGitBranchesEntryQueryParams = {
1251
+ gitBranch: string;
1252
+ };
1253
+ declare type RemoveGitBranchesEntryError = ErrorWrapper<{
1254
+ status: 400;
1255
+ payload: BadRequestError;
1256
+ } | {
1257
+ status: 401;
1258
+ payload: AuthError;
1259
+ }>;
1260
+ declare type RemoveGitBranchesEntryVariables = {
1261
+ pathParams: RemoveGitBranchesEntryPathParams;
1262
+ queryParams: RemoveGitBranchesEntryQueryParams;
1263
+ } & FetcherExtraProps;
1264
+ /**
1265
+ * Removes an entry from the mapping of git branches to Xata branches. The name of the git branch must be passed as a query parameter. If the git branch is not found, the endpoint returns a 404 status code.
1266
+ *
1267
+ * Example request:
1268
+ *
1269
+ * ```json
1270
+ * // DELETE https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches?gitBranch=fix%2Fbug123
1271
+ * ```
1272
+ */
1273
+ declare const removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
1274
+ declare type ResolveBranchPathParams = {
1275
+ dbName: DBName;
1276
+ workspace: string;
1277
+ };
1278
+ declare type ResolveBranchQueryParams = {
1279
+ gitBranch?: string;
1280
+ fallbackBranch?: string;
1281
+ };
1282
+ declare type ResolveBranchError = ErrorWrapper<{
1283
+ status: 400;
1284
+ payload: BadRequestError;
1285
+ } | {
1286
+ status: 401;
1287
+ payload: AuthError;
1288
+ }>;
1289
+ declare type ResolveBranchResponse = {
1290
+ branch: string;
1291
+ reason: {
1292
+ code: 'FOUND_IN_MAPPING' | 'BRANCH_EXISTS' | 'FALLBACK_BRANCH' | 'DEFAULT_BRANCH';
1293
+ message: string;
1294
+ };
1295
+ };
1296
+ declare type ResolveBranchVariables = {
1297
+ pathParams: ResolveBranchPathParams;
1298
+ queryParams?: ResolveBranchQueryParams;
1299
+ } & FetcherExtraProps;
1300
+ /**
1301
+ * In order to resolve the database branch, the following algorithm is used:
1302
+ * * if the `gitBranch` was provided and is found in the [git branches mapping](/api-reference/dbs/db_name/gitBranches), the associated Xata branch is returned
1303
+ * * else, if a Xata branch with the exact same name as `gitBranch` exists, return it
1304
+ * * else, if `fallbackBranch` is provided and a branch with that name exists, return it
1305
+ * * else, return the default branch of the DB (`main` or the first branch)
1306
+ *
1307
+ * Example call:
1308
+ *
1309
+ * ```json
1310
+ * // GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test&fallbackBranch=tsg
1311
+ * ```
1312
+ *
1313
+ * Example response:
1314
+ *
1315
+ * ```json
1316
+ * {
1317
+ * "branch": "main",
1318
+ * "reason": {
1319
+ * "code": "DEFAULT_BRANCH",
1320
+ * "message": "Default branch for this database (main)"
1321
+ * }
1322
+ * }
1323
+ * ```
1324
+ */
1325
+ declare const resolveBranch: (variables: ResolveBranchVariables) => Promise<ResolveBranchResponse>;
1003
1326
  declare type GetBranchDetailsPathParams = {
1004
1327
  dbBranchName: DBBranchName;
1005
1328
  workspace: string;
@@ -1035,6 +1358,10 @@ declare type CreateBranchError = ErrorWrapper<{
1035
1358
  status: 404;
1036
1359
  payload: SimpleError;
1037
1360
  }>;
1361
+ declare type CreateBranchResponse = {
1362
+ databaseName: string;
1363
+ branchName: string;
1364
+ };
1038
1365
  declare type CreateBranchRequestBody = {
1039
1366
  from?: string;
1040
1367
  metadata?: BranchMetadata;
@@ -1044,7 +1371,7 @@ declare type CreateBranchVariables = {
1044
1371
  pathParams: CreateBranchPathParams;
1045
1372
  queryParams?: CreateBranchQueryParams;
1046
1373
  } & FetcherExtraProps;
1047
- declare const createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
1374
+ declare const createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
1048
1375
  declare type DeleteBranchPathParams = {
1049
1376
  dbBranchName: DBBranchName;
1050
1377
  workspace: string;
@@ -1231,13 +1558,17 @@ declare type CreateTableError = ErrorWrapper<{
1231
1558
  status: 422;
1232
1559
  payload: SimpleError;
1233
1560
  }>;
1561
+ declare type CreateTableResponse = {
1562
+ branchName: string;
1563
+ tableName: string;
1564
+ };
1234
1565
  declare type CreateTableVariables = {
1235
1566
  pathParams: CreateTablePathParams;
1236
1567
  } & FetcherExtraProps;
1237
1568
  /**
1238
1569
  * Creates a new table with the given name. Returns 422 if a table with the same name already exists.
1239
1570
  */
1240
- declare const createTable: (variables: CreateTableVariables) => Promise<undefined>;
1571
+ declare const createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
1241
1572
  declare type DeleteTablePathParams = {
1242
1573
  dbBranchName: DBBranchName;
1243
1574
  tableName: TableName;
@@ -1284,8 +1615,9 @@ declare type UpdateTableVariables = {
1284
1615
  *
1285
1616
  * In the example below, we rename a table from “users” to “people”:
1286
1617
  *
1287
- * ```jsx
1288
- * PATCH /db/test:main/tables/users
1618
+ * ```json
1619
+ * // PATCH /db/test:main/tables/users
1620
+ *
1289
1621
  * {
1290
1622
  * "name": "people"
1291
1623
  * }
@@ -1469,6 +1801,9 @@ declare type InsertRecordPathParams = {
1469
1801
  tableName: TableName;
1470
1802
  workspace: string;
1471
1803
  };
1804
+ declare type InsertRecordQueryParams = {
1805
+ columns?: ColumnsProjection;
1806
+ };
1472
1807
  declare type InsertRecordError = ErrorWrapper<{
1473
1808
  status: 400;
1474
1809
  payload: BadRequestError;
@@ -1479,20 +1814,15 @@ declare type InsertRecordError = ErrorWrapper<{
1479
1814
  status: 404;
1480
1815
  payload: SimpleError;
1481
1816
  }>;
1482
- declare type InsertRecordResponse = {
1483
- id: string;
1484
- xata: {
1485
- version: number;
1486
- };
1487
- };
1488
1817
  declare type InsertRecordVariables = {
1489
1818
  body?: Record<string, any>;
1490
1819
  pathParams: InsertRecordPathParams;
1820
+ queryParams?: InsertRecordQueryParams;
1491
1821
  } & FetcherExtraProps;
1492
1822
  /**
1493
1823
  * Insert a new Record into the Table
1494
1824
  */
1495
- declare const insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
1825
+ declare const insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
1496
1826
  declare type InsertRecordWithIDPathParams = {
1497
1827
  dbBranchName: DBBranchName;
1498
1828
  tableName: TableName;
@@ -1500,6 +1830,7 @@ declare type InsertRecordWithIDPathParams = {
1500
1830
  workspace: string;
1501
1831
  };
1502
1832
  declare type InsertRecordWithIDQueryParams = {
1833
+ columns?: ColumnsProjection;
1503
1834
  createOnly?: boolean;
1504
1835
  ifVersion?: number;
1505
1836
  };
@@ -1532,6 +1863,7 @@ declare type UpdateRecordWithIDPathParams = {
1532
1863
  workspace: string;
1533
1864
  };
1534
1865
  declare type UpdateRecordWithIDQueryParams = {
1866
+ columns?: ColumnsProjection;
1535
1867
  ifVersion?: number;
1536
1868
  };
1537
1869
  declare type UpdateRecordWithIDError = ErrorWrapper<{
@@ -1560,6 +1892,7 @@ declare type UpsertRecordWithIDPathParams = {
1560
1892
  workspace: string;
1561
1893
  };
1562
1894
  declare type UpsertRecordWithIDQueryParams = {
1895
+ columns?: ColumnsProjection;
1563
1896
  ifVersion?: number;
1564
1897
  };
1565
1898
  declare type UpsertRecordWithIDError = ErrorWrapper<{
@@ -1587,6 +1920,9 @@ declare type DeleteRecordPathParams = {
1587
1920
  recordId: RecordID;
1588
1921
  workspace: string;
1589
1922
  };
1923
+ declare type DeleteRecordQueryParams = {
1924
+ columns?: ColumnsProjection;
1925
+ };
1590
1926
  declare type DeleteRecordError = ErrorWrapper<{
1591
1927
  status: 400;
1592
1928
  payload: BadRequestError;
@@ -1599,14 +1935,18 @@ declare type DeleteRecordError = ErrorWrapper<{
1599
1935
  }>;
1600
1936
  declare type DeleteRecordVariables = {
1601
1937
  pathParams: DeleteRecordPathParams;
1938
+ queryParams?: DeleteRecordQueryParams;
1602
1939
  } & FetcherExtraProps;
1603
- declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
1940
+ declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
1604
1941
  declare type GetRecordPathParams = {
1605
1942
  dbBranchName: DBBranchName;
1606
1943
  tableName: TableName;
1607
1944
  recordId: RecordID;
1608
1945
  workspace: string;
1609
1946
  };
1947
+ declare type GetRecordQueryParams = {
1948
+ columns?: ColumnsProjection;
1949
+ };
1610
1950
  declare type GetRecordError = ErrorWrapper<{
1611
1951
  status: 400;
1612
1952
  payload: BadRequestError;
@@ -1617,12 +1957,9 @@ declare type GetRecordError = ErrorWrapper<{
1617
1957
  status: 404;
1618
1958
  payload: SimpleError;
1619
1959
  }>;
1620
- declare type GetRecordRequestBody = {
1621
- columns?: ColumnsFilter;
1622
- };
1623
1960
  declare type GetRecordVariables = {
1624
- body?: GetRecordRequestBody;
1625
1961
  pathParams: GetRecordPathParams;
1962
+ queryParams?: GetRecordQueryParams;
1626
1963
  } & FetcherExtraProps;
1627
1964
  /**
1628
1965
  * Retrieve record by ID
@@ -1633,6 +1970,9 @@ declare type BulkInsertTableRecordsPathParams = {
1633
1970
  tableName: TableName;
1634
1971
  workspace: string;
1635
1972
  };
1973
+ declare type BulkInsertTableRecordsQueryParams = {
1974
+ columns?: ColumnsProjection;
1975
+ };
1636
1976
  declare type BulkInsertTableRecordsError = ErrorWrapper<{
1637
1977
  status: 400;
1638
1978
  payload: BulkError;
@@ -1642,21 +1982,22 @@ declare type BulkInsertTableRecordsError = ErrorWrapper<{
1642
1982
  } | {
1643
1983
  status: 404;
1644
1984
  payload: SimpleError;
1985
+ } | {
1986
+ status: 422;
1987
+ payload: SimpleError;
1645
1988
  }>;
1646
- declare type BulkInsertTableRecordsResponse = {
1647
- recordIDs: string[];
1648
- };
1649
1989
  declare type BulkInsertTableRecordsRequestBody = {
1650
1990
  records: Record<string, any>[];
1651
1991
  };
1652
1992
  declare type BulkInsertTableRecordsVariables = {
1653
1993
  body: BulkInsertTableRecordsRequestBody;
1654
1994
  pathParams: BulkInsertTableRecordsPathParams;
1995
+ queryParams?: BulkInsertTableRecordsQueryParams;
1655
1996
  } & FetcherExtraProps;
1656
1997
  /**
1657
1998
  * Bulk insert records
1658
1999
  */
1659
- declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
2000
+ declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
1660
2001
  declare type QueryTablePathParams = {
1661
2002
  dbBranchName: DBBranchName;
1662
2003
  tableName: TableName;
@@ -1676,7 +2017,7 @@ declare type QueryTableRequestBody = {
1676
2017
  filter?: FilterExpression;
1677
2018
  sort?: SortExpression;
1678
2019
  page?: PageConfig;
1679
- columns?: ColumnsFilter;
2020
+ columns?: ColumnsProjection;
1680
2021
  };
1681
2022
  declare type QueryTableVariables = {
1682
2023
  body?: QueryTableRequestBody;
@@ -1693,7 +2034,7 @@ declare type QueryTableVariables = {
1693
2034
  * {
1694
2035
  * "columns": [...],
1695
2036
  * "filter": {
1696
- * "$all": [...]
2037
+ * "$all": [...],
1697
2038
  * "$any": [...]
1698
2039
  * ...
1699
2040
  * },
@@ -1739,7 +2080,11 @@ declare type QueryTableVariables = {
1739
2080
  * "link": {
1740
2081
  * "table": "users"
1741
2082
  * }
1742
- * }
2083
+ * },
2084
+ * {
2085
+ * "name": "foundedDate",
2086
+ * "type": "datetime"
2087
+ * },
1743
2088
  * ]
1744
2089
  * },
1745
2090
  * {
@@ -1827,7 +2172,7 @@ declare type QueryTableVariables = {
1827
2172
  * {
1828
2173
  * "name": "Kilian",
1829
2174
  * "address": {
1830
- * "street": "New street",
2175
+ * "street": "New street"
1831
2176
  * }
1832
2177
  * }
1833
2178
  * ```
@@ -1836,10 +2181,7 @@ declare type QueryTableVariables = {
1836
2181
  *
1837
2182
  * ```json
1838
2183
  * {
1839
- * "columns": [
1840
- * "*",
1841
- * "team.name"
1842
- * ]
2184
+ * "columns": ["*", "team.name"]
1843
2185
  * }
1844
2186
  * ```
1845
2187
  *
@@ -1857,7 +2199,7 @@ declare type QueryTableVariables = {
1857
2199
  * "team": {
1858
2200
  * "id": "XX",
1859
2201
  * "xata": {
1860
- * "version": 0,
2202
+ * "version": 0
1861
2203
  * },
1862
2204
  * "name": "first team"
1863
2205
  * }
@@ -1868,10 +2210,7 @@ declare type QueryTableVariables = {
1868
2210
  *
1869
2211
  * ```json
1870
2212
  * {
1871
- * "columns": [
1872
- * "*",
1873
- * "team.*"
1874
- * ]
2213
+ * "columns": ["*", "team.*"]
1875
2214
  * }
1876
2215
  * ```
1877
2216
  *
@@ -1889,10 +2228,11 @@ declare type QueryTableVariables = {
1889
2228
  * "team": {
1890
2229
  * "id": "XX",
1891
2230
  * "xata": {
1892
- * "version": 0,
2231
+ * "version": 0
1893
2232
  * },
1894
2233
  * "name": "first team",
1895
- * "code": "A1"
2234
+ * "code": "A1",
2235
+ * "foundedDate": "2020-03-04T10:43:54.32Z"
1896
2236
  * }
1897
2237
  * }
1898
2238
  * ```
@@ -1907,7 +2247,7 @@ declare type QueryTableVariables = {
1907
2247
  * `$none`, etc.
1908
2248
  *
1909
2249
  * All operators start with an `$` to differentiate them from column names
1910
- * (which are not allowed to start with an dollar sign).
2250
+ * (which are not allowed to start with a dollar sign).
1911
2251
  *
1912
2252
  * #### Exact matching and control operators
1913
2253
  *
@@ -1938,7 +2278,7 @@ declare type QueryTableVariables = {
1938
2278
  * ```json
1939
2279
  * {
1940
2280
  * "filter": {
1941
- * "name": "r2",
2281
+ * "name": "r2"
1942
2282
  * }
1943
2283
  * }
1944
2284
  * ```
@@ -1960,7 +2300,7 @@ declare type QueryTableVariables = {
1960
2300
  * ```json
1961
2301
  * {
1962
2302
  * "filter": {
1963
- * "settings.plan": "free",
2303
+ * "settings.plan": "free"
1964
2304
  * }
1965
2305
  * }
1966
2306
  * ```
@@ -1970,8 +2310,8 @@ declare type QueryTableVariables = {
1970
2310
  * "filter": {
1971
2311
  * "settings": {
1972
2312
  * "plan": "free"
1973
- * },
1974
- * },
2313
+ * }
2314
+ * }
1975
2315
  * }
1976
2316
  * ```
1977
2317
  *
@@ -1980,8 +2320,8 @@ declare type QueryTableVariables = {
1980
2320
  * ```json
1981
2321
  * {
1982
2322
  * "filter": {
1983
- * "settings.plan": {"$any": ["free", "paid"]}
1984
- * },
2323
+ * "settings.plan": { "$any": ["free", "paid"] }
2324
+ * }
1985
2325
  * }
1986
2326
  * ```
1987
2327
  *
@@ -1990,9 +2330,9 @@ declare type QueryTableVariables = {
1990
2330
  * ```json
1991
2331
  * {
1992
2332
  * "filter": {
1993
- * "settings.dark": true,
1994
- * "settings.plan": "free",
1995
- * },
2333
+ * "settings.dark": true,
2334
+ * "settings.plan": "free"
2335
+ * }
1996
2336
  * }
1997
2337
  * ```
1998
2338
  *
@@ -2003,11 +2343,11 @@ declare type QueryTableVariables = {
2003
2343
  * ```json
2004
2344
  * {
2005
2345
  * "filter": {
2006
- * "$any": {
2007
- * "settings.dark": true,
2008
- * "settings.plan": "free"
2009
- * }
2010
- * },
2346
+ * "$any": {
2347
+ * "settings.dark": true,
2348
+ * "settings.plan": "free"
2349
+ * }
2350
+ * }
2011
2351
  * }
2012
2352
  * ```
2013
2353
  *
@@ -2018,10 +2358,10 @@ declare type QueryTableVariables = {
2018
2358
  * "filter": {
2019
2359
  * "$any": [
2020
2360
  * {
2021
- * "name": "r1",
2361
+ * "name": "r1"
2022
2362
  * },
2023
2363
  * {
2024
- * "name": "r2",
2364
+ * "name": "r2"
2025
2365
  * }
2026
2366
  * ]
2027
2367
  * }
@@ -2033,7 +2373,7 @@ declare type QueryTableVariables = {
2033
2373
  * ```json
2034
2374
  * {
2035
2375
  * "filter": {
2036
- * "$exists": "settings",
2376
+ * "$exists": "settings"
2037
2377
  * }
2038
2378
  * }
2039
2379
  * ```
@@ -2045,10 +2385,10 @@ declare type QueryTableVariables = {
2045
2385
  * "filter": {
2046
2386
  * "$all": [
2047
2387
  * {
2048
- * "$exists": "settings",
2388
+ * "$exists": "settings"
2049
2389
  * },
2050
2390
  * {
2051
- * "$exists": "name",
2391
+ * "$exists": "name"
2052
2392
  * }
2053
2393
  * ]
2054
2394
  * }
@@ -2060,7 +2400,7 @@ declare type QueryTableVariables = {
2060
2400
  * ```json
2061
2401
  * {
2062
2402
  * "filter": {
2063
- * "$notExists": "settings",
2403
+ * "$notExists": "settings"
2064
2404
  * }
2065
2405
  * }
2066
2406
  * ```
@@ -2087,43 +2427,59 @@ declare type QueryTableVariables = {
2087
2427
  * {
2088
2428
  * "filter": {
2089
2429
  * "<column_name>": {
2090
- * "$pattern": "v*alue*"
2430
+ * "$pattern": "v*alu?"
2091
2431
  * }
2092
2432
  * }
2093
2433
  * }
2094
2434
  * ```
2095
2435
  *
2436
+ * The `$pattern` operator accepts two wildcard characters:
2437
+ * * `*` matches zero or more characters
2438
+ * * `?` matches exactly one character
2439
+ *
2440
+ * If you want to match a string that contains a wildcard character, you can escape them using a backslash (`\`). You can escape a backslash by usign another backslash.
2441
+ *
2096
2442
  * We could also have `$endsWith` and `$startsWith` operators:
2097
2443
  *
2098
2444
  * ```json
2099
2445
  * {
2100
2446
  * "filter": {
2101
2447
  * "<column_name>": {
2102
- * "$endsWith": ".gz"
2448
+ * "$endsWith": ".gz"
2103
2449
  * },
2104
2450
  * "<column_name>": {
2105
- * "$startsWith": "tmp-"
2451
+ * "$startsWith": "tmp-"
2106
2452
  * }
2107
2453
  * }
2108
2454
  * }
2109
2455
  * ```
2110
2456
  *
2111
- * #### Numeric ranges
2457
+ * #### Numeric or datetime ranges
2112
2458
  *
2113
2459
  * ```json
2114
2460
  * {
2115
2461
  * "filter": {
2116
- * "<column_name>": {
2117
- * "$ge": 0,
2118
- * "$lt": 100
2119
- * }
2462
+ * "<column_name>": {
2463
+ * "$ge": 0,
2464
+ * "$lt": 100
2465
+ * }
2466
+ * }
2467
+ * }
2468
+ * ```
2469
+ * Date ranges support the same operators, with the date using the format defined in
2470
+ * [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339):
2471
+ * ```json
2472
+ * {
2473
+ * "filter": {
2474
+ * "<column_name>": {
2475
+ * "$gt": "2019-10-12T07:20:50.52Z",
2476
+ * "$lt": "2021-10-12T07:20:50.52Z"
2477
+ * }
2120
2478
  * }
2121
2479
  * }
2122
2480
  * ```
2123
- *
2124
2481
  * The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
2125
2482
  *
2126
- *
2127
2483
  * #### Negations
2128
2484
  *
2129
2485
  * A general `$not` operator can inverse any operation.
@@ -2148,15 +2504,21 @@ declare type QueryTableVariables = {
2148
2504
  * {
2149
2505
  * "filter": {
2150
2506
  * "$not": {
2151
- * "$any": [{
2152
- * "<column_name1>": "value1"
2153
- * }, {
2154
- * "$all": [{
2155
- * "<column_name2>": "value2"
2156
- * }, {
2157
- * "<column_name3>": "value3"
2158
- * }]
2159
- * }]
2507
+ * "$any": [
2508
+ * {
2509
+ * "<column_name1>": "value1"
2510
+ * },
2511
+ * {
2512
+ * "$all": [
2513
+ * {
2514
+ * "<column_name2>": "value2"
2515
+ * },
2516
+ * {
2517
+ * "<column_name3>": "value3"
2518
+ * }
2519
+ * ]
2520
+ * }
2521
+ * ]
2160
2522
  * }
2161
2523
  * }
2162
2524
  * }
@@ -2211,8 +2573,8 @@ declare type QueryTableVariables = {
2211
2573
  * "<array name>": {
2212
2574
  * "$includes": {
2213
2575
  * "$all": [
2214
- * {"$contains": "label"},
2215
- * {"$not": {"$endsWith": "-debug"}}
2576
+ * { "$contains": "label" },
2577
+ * { "$not": { "$endsWith": "-debug" } }
2216
2578
  * ]
2217
2579
  * }
2218
2580
  * }
@@ -2232,9 +2594,7 @@ declare type QueryTableVariables = {
2232
2594
  * {
2233
2595
  * "filter": {
2234
2596
  * "settings.labels": {
2235
- * "$includesAll": [
2236
- * {"$contains": "label"},
2237
- * ]
2597
+ * "$includesAll": [{ "$contains": "label" }]
2238
2598
  * }
2239
2599
  * }
2240
2600
  * }
@@ -2282,7 +2642,6 @@ declare type QueryTableVariables = {
2282
2642
  * }
2283
2643
  * ```
2284
2644
  *
2285
- *
2286
2645
  * ### Pagination
2287
2646
  *
2288
2647
  * We offer cursor pagination and offset pagination. The offset pagination is limited
@@ -2348,8 +2707,8 @@ declare type QueryTableVariables = {
2348
2707
  * can be queried by update `page.after` to the returned cursor while keeping the
2349
2708
  * `page.before` cursor from the first range query.
2350
2709
  *
2351
- * The `filter` , `columns`, `sort` , and `page.size` configuration will be
2352
- * encoded with the cursor. The pagination request will be invalid if
2710
+ * The `filter` , `columns`, `sort` , and `page.size` configuration will be
2711
+ * encoded with the cursor. The pagination request will be invalid if
2353
2712
  * `filter` or `sort` is set. The columns returned and page size can be changed
2354
2713
  * anytime by passing the `columns` or `page.size` settings to the next query.
2355
2714
  *
@@ -2386,6 +2745,41 @@ declare type QueryTableVariables = {
2386
2745
  * ```
2387
2746
  */
2388
2747
  declare const queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
2748
+ declare type SearchTablePathParams = {
2749
+ dbBranchName: DBBranchName;
2750
+ tableName: TableName;
2751
+ workspace: string;
2752
+ };
2753
+ declare type SearchTableError = ErrorWrapper<{
2754
+ status: 400;
2755
+ payload: BadRequestError;
2756
+ } | {
2757
+ status: 401;
2758
+ payload: AuthError;
2759
+ } | {
2760
+ status: 404;
2761
+ payload: SimpleError;
2762
+ }>;
2763
+ declare type SearchTableRequestBody = {
2764
+ query: string;
2765
+ fuzziness?: FuzzinessExpression;
2766
+ prefix?: PrefixExpression;
2767
+ filter?: FilterExpression;
2768
+ highlight?: HighlightExpression;
2769
+ boosters?: BoosterExpression[];
2770
+ };
2771
+ declare type SearchTableVariables = {
2772
+ body: SearchTableRequestBody;
2773
+ pathParams: SearchTablePathParams;
2774
+ } & FetcherExtraProps;
2775
+ /**
2776
+ * Run a free text search operation in a particular table.
2777
+ *
2778
+ * The endpoint accepts a `query` parameter that is used for the free text search and a set of structured filters (via the `filter` parameter) that are applied before the search. The `filter` parameter uses the same syntax as the [query endpoint](/api-reference/db/db_branch_name/tables/table_name/) with the following exceptions:
2779
+ * * filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of type `text`
2780
+ * * filtering on columns of type `multiple` is currently unsupported
2781
+ */
2782
+ declare const searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2389
2783
  declare type SearchBranchPathParams = {
2390
2784
  dbBranchName: DBBranchName;
2391
2785
  workspace: string;
@@ -2401,9 +2795,14 @@ declare type SearchBranchError = ErrorWrapper<{
2401
2795
  payload: SimpleError;
2402
2796
  }>;
2403
2797
  declare type SearchBranchRequestBody = {
2404
- tables?: string[];
2798
+ tables?: (string | {
2799
+ table: string;
2800
+ filter?: FilterExpression;
2801
+ boosters?: BoosterExpression[];
2802
+ })[];
2405
2803
  query: string;
2406
- fuzziness?: number;
2804
+ fuzziness?: FuzzinessExpression;
2805
+ highlight?: HighlightExpression;
2407
2806
  };
2408
2807
  declare type SearchBranchVariables = {
2409
2808
  body: SearchBranchRequestBody;
@@ -2432,6 +2831,7 @@ declare const operationsByTag: {
2432
2831
  updateWorkspaceMemberRole: (variables: UpdateWorkspaceMemberRoleVariables) => Promise<undefined>;
2433
2832
  removeWorkspaceMember: (variables: RemoveWorkspaceMemberVariables) => Promise<undefined>;
2434
2833
  inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<WorkspaceInvite>;
2834
+ updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
2435
2835
  cancelWorkspaceMemberInvite: (variables: CancelWorkspaceMemberInviteVariables) => Promise<undefined>;
2436
2836
  resendWorkspaceMemberInvite: (variables: ResendWorkspaceMemberInviteVariables) => Promise<undefined>;
2437
2837
  acceptWorkspaceMemberInvite: (variables: AcceptWorkspaceMemberInviteVariables) => Promise<undefined>;
@@ -2440,11 +2840,16 @@ declare const operationsByTag: {
2440
2840
  getDatabaseList: (variables: GetDatabaseListVariables) => Promise<ListDatabasesResponse>;
2441
2841
  createDatabase: (variables: CreateDatabaseVariables) => Promise<CreateDatabaseResponse>;
2442
2842
  deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
2843
+ getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
2844
+ getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
2845
+ addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
2846
+ removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
2847
+ resolveBranch: (variables: ResolveBranchVariables) => Promise<ResolveBranchResponse>;
2443
2848
  };
2444
2849
  branch: {
2445
2850
  getBranchList: (variables: GetBranchListVariables) => Promise<ListBranchesResponse>;
2446
2851
  getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
2447
- createBranch: (variables: CreateBranchVariables) => Promise<undefined>;
2852
+ createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
2448
2853
  deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
2449
2854
  updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
2450
2855
  getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
@@ -2454,7 +2859,7 @@ declare const operationsByTag: {
2454
2859
  getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
2455
2860
  };
2456
2861
  table: {
2457
- createTable: (variables: CreateTableVariables) => Promise<undefined>;
2862
+ createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
2458
2863
  deleteTable: (variables: DeleteTableVariables) => Promise<undefined>;
2459
2864
  updateTable: (variables: UpdateTableVariables) => Promise<undefined>;
2460
2865
  getTableSchema: (variables: GetTableSchemaVariables) => Promise<GetTableSchemaResponse>;
@@ -2466,14 +2871,15 @@ declare const operationsByTag: {
2466
2871
  updateColumn: (variables: UpdateColumnVariables) => Promise<MigrationIdResponse>;
2467
2872
  };
2468
2873
  records: {
2469
- insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
2874
+ insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
2470
2875
  insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2471
2876
  updateRecordWithID: (variables: UpdateRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2472
2877
  upsertRecordWithID: (variables: UpsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
2473
- deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
2878
+ deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
2474
2879
  getRecord: (variables: GetRecordVariables) => Promise<XataRecord$1>;
2475
- bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
2880
+ bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
2476
2881
  queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
2882
+ searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
2477
2883
  searchBranch: (variables: SearchBranchVariables) => Promise<SearchResponse>;
2478
2884
  };
2479
2885
  };
@@ -2490,6 +2896,9 @@ interface XataApiClientOptions {
2490
2896
  apiKey?: string;
2491
2897
  host?: HostProvider;
2492
2898
  }
2899
+ /**
2900
+ * @deprecated Use XataApiPlugin instead
2901
+ */
2493
2902
  declare class XataApiClient {
2494
2903
  #private;
2495
2904
  constructor(options?: XataApiClientOptions);
@@ -2522,6 +2931,7 @@ declare class WorkspaceApi {
2522
2931
  updateWorkspaceMemberRole(workspaceId: WorkspaceID, userId: UserID, role: Role): Promise<void>;
2523
2932
  removeWorkspaceMember(workspaceId: WorkspaceID, userId: UserID): Promise<void>;
2524
2933
  inviteWorkspaceMember(workspaceId: WorkspaceID, email: string, role: Role): Promise<WorkspaceInvite>;
2934
+ updateWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID, role: Role): Promise<WorkspaceInvite>;
2525
2935
  cancelWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2526
2936
  resendWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
2527
2937
  acceptWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteKey: InviteKey): Promise<void>;
@@ -2532,13 +2942,18 @@ declare class DatabaseApi {
2532
2942
  getDatabaseList(workspace: WorkspaceID): Promise<ListDatabasesResponse>;
2533
2943
  createDatabase(workspace: WorkspaceID, dbName: DBName, options?: CreateDatabaseRequestBody): Promise<CreateDatabaseResponse>;
2534
2944
  deleteDatabase(workspace: WorkspaceID, dbName: DBName): Promise<void>;
2945
+ getDatabaseMetadata(workspace: WorkspaceID, dbName: DBName): Promise<DatabaseMetadata>;
2946
+ getGitBranchesMapping(workspace: WorkspaceID, dbName: DBName): Promise<ListGitBranchesResponse>;
2947
+ addGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, body: AddGitBranchesEntryRequestBody): Promise<AddGitBranchesEntryResponse>;
2948
+ removeGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<void>;
2949
+ resolveBranch(workspace: WorkspaceID, dbName: DBName, gitBranch?: string, fallbackBranch?: string): Promise<ResolveBranchResponse>;
2535
2950
  }
2536
2951
  declare class BranchApi {
2537
2952
  private extraProps;
2538
2953
  constructor(extraProps: FetcherExtraProps);
2539
2954
  getBranchList(workspace: WorkspaceID, dbName: DBName): Promise<ListBranchesResponse>;
2540
2955
  getBranchDetails(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<DBBranch>;
2541
- createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<void>;
2956
+ createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<CreateBranchResponse>;
2542
2957
  deleteBranch(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<void>;
2543
2958
  updateBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName, metadata?: BranchMetadata): Promise<void>;
2544
2959
  getBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<BranchMetadata>;
@@ -2550,7 +2965,7 @@ declare class BranchApi {
2550
2965
  declare class TableApi {
2551
2966
  private extraProps;
2552
2967
  constructor(extraProps: FetcherExtraProps);
2553
- createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
2968
+ createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<CreateTableResponse>;
2554
2969
  deleteTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
2555
2970
  updateTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, options: UpdateTableRequestBody): Promise<void>;
2556
2971
  getTableSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<GetTableSchemaResponse>;
@@ -2564,14 +2979,15 @@ declare class TableApi {
2564
2979
  declare class RecordsApi {
2565
2980
  private extraProps;
2566
2981
  constructor(extraProps: FetcherExtraProps);
2567
- insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>): Promise<InsertRecordResponse>;
2982
+ insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>, options?: InsertRecordQueryParams): Promise<RecordUpdateResponse>;
2568
2983
  insertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: InsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2569
2984
  updateRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpdateRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2570
2985
  upsertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
2571
- deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID): Promise<void>;
2572
- getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordRequestBody): Promise<XataRecord$1>;
2573
- bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[]): Promise<BulkInsertTableRecordsResponse>;
2986
+ deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: DeleteRecordQueryParams): Promise<RecordUpdateResponse>;
2987
+ getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordQueryParams): Promise<XataRecord$1>;
2988
+ bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[], options?: BulkInsertTableRecordsQueryParams): Promise<BulkInsertResponse>;
2574
2989
  queryTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: QueryTableRequestBody): Promise<QueryResponse>;
2990
+ searchTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: SearchTableRequestBody): Promise<SearchResponse>;
2575
2991
  searchBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, query: SearchBranchRequestBody): Promise<SearchResponse>;
2576
2992
  }
2577
2993
 
@@ -2585,28 +3001,29 @@ declare type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) ex
2585
3001
  declare type If<Condition, Then, Else> = Condition extends true ? Then : Else;
2586
3002
  declare type IsObject<T> = T extends Record<string, any> ? true : false;
2587
3003
  declare type IsArray<T> = T extends Array<any> ? true : false;
2588
- declare type NonEmptyArray<T> = T[] & {
2589
- 0: T;
2590
- };
2591
3004
  declare type RequiredBy<T, K extends keyof T> = T & {
2592
3005
  [P in K]-?: NonNullable<T[P]>;
2593
3006
  };
2594
3007
  declare type GetArrayInnerType<T extends readonly any[]> = T[number];
2595
3008
  declare type SingleOrArray<T> = T | T[];
2596
- declare type Dictionary<T> = Record<string, T>;
3009
+ declare type OmitBy<T, K extends keyof T> = T extends any ? Omit<T, K> : never;
3010
+ declare type Without<T, U> = {
3011
+ [P in Exclude<keyof T, keyof U>]?: never;
3012
+ };
3013
+ declare type ExclusiveOr<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
2597
3014
 
2598
3015
  declare type SelectableColumn<O, RecursivePath extends any[] = []> = '*' | 'id' | DataProps<O> | NestedColumns<O, RecursivePath>;
2599
- declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord & UnionToIntersection<Values<{
2600
- [K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord;
3016
+ declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord<O> & UnionToIntersection<Values<{
3017
+ [K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord<O>;
2601
3018
  }>>;
2602
- 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]> ? {
2603
- V: ValueAtColumn<O[K], V>;
2604
- } : never) : O[K]> : never : never;
3019
+ 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> ? {
3020
+ V: ValueAtColumn<Item, V>;
3021
+ } : never : O[K] : never> : never : never;
2605
3022
  declare type MAX_RECURSION = 5;
2606
3023
  declare type NestedColumns<O, RecursivePath extends any[]> = RecursivePath['length'] extends MAX_RECURSION ? never : If<IsObject<O>, Values<{
2607
- [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
2608
- 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
2609
- K>>;
3024
+ [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
3025
+ 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
3026
+ K>> : never;
2610
3027
  }>, never>;
2611
3028
  declare type DataProps<O> = Exclude<StringKeys<O>, StringKeys<XataRecord>>;
2612
3029
  declare type NestedValueAtColumn<O, Key extends SelectableColumn<O>> = Key extends `${infer N}.${infer M}` ? N extends DataProps<O> ? {
@@ -2633,27 +3050,37 @@ interface BaseData {
2633
3050
  /**
2634
3051
  * Represents a persisted record from the database.
2635
3052
  */
2636
- interface XataRecord extends Identifiable {
3053
+ interface XataRecord<OriginalRecord extends XataRecord<any> = XataRecord<any>> extends Identifiable {
2637
3054
  /**
2638
- * Metadata of this record.
3055
+ * Get metadata of this record.
2639
3056
  */
2640
- xata: {
2641
- /**
2642
- * Number that is increased every time the record is updated.
2643
- */
2644
- version: number;
2645
- };
3057
+ getMetadata(): XataRecordMetadata;
3058
+ /**
3059
+ * Retrieves a refreshed copy of the current record from the database.
3060
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3061
+ * @returns The persisted record with the selected columns.
3062
+ */
3063
+ read<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
2646
3064
  /**
2647
3065
  * Retrieves a refreshed copy of the current record from the database.
3066
+ * @returns The persisted record with all first level properties.
2648
3067
  */
2649
- read(): Promise<Readonly<SelectedPick<this, ['*']>> | null>;
3068
+ read(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
2650
3069
  /**
2651
3070
  * Performs a partial update of the current record. On success a new object is
2652
3071
  * returned and the current object is not mutated.
2653
- * @param data The columns and their values that have to be updated.
2654
- * @returns A new record containing the latest values for all the columns of the current record.
3072
+ * @param partialUpdate The columns and their values that have to be updated.
3073
+ * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
3074
+ * @returns The persisted record with the selected columns.
3075
+ */
3076
+ update<K extends SelectableColumn<OriginalRecord>>(partialUpdate: Partial<EditableData<Omit<OriginalRecord, keyof XataRecord>>>, columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>>>;
3077
+ /**
3078
+ * Performs a partial update of the current record. On success a new object is
3079
+ * returned and the current object is not mutated.
3080
+ * @param partialUpdate The columns and their values that have to be updated.
3081
+ * @returns The persisted record with all first level properties.
2655
3082
  */
2656
- update(partialUpdate: Partial<EditableData<Omit<this, keyof XataRecord>>>): Promise<Readonly<SelectedPick<this, ['*']>>>;
3083
+ update(partialUpdate: Partial<EditableData<Omit<OriginalRecord, keyof XataRecord>>>): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>>>;
2657
3084
  /**
2658
3085
  * Performs a deletion of the current record in the database.
2659
3086
  *
@@ -2665,23 +3092,36 @@ declare type Link<Record extends XataRecord> = Omit<XataRecord, 'read' | 'update
2665
3092
  /**
2666
3093
  * Retrieves a refreshed copy of the current record from the database.
2667
3094
  */
2668
- read(): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3095
+ read<K extends SelectableColumn<Record>>(columns?: K[]): Promise<Readonly<SelectedPick<Record, typeof columns extends SelectableColumn<Record>[] ? typeof columns : ['*']>> | null>;
2669
3096
  /**
2670
3097
  * Performs a partial update of the current record. On success a new object is
2671
3098
  * returned and the current object is not mutated.
2672
- * @param data The columns and their values that have to be updated.
3099
+ * @param partialUpdate The columns and their values that have to be updated.
2673
3100
  * @returns A new record containing the latest values for all the columns of the current record.
2674
3101
  */
2675
- update(partialUpdate: Partial<EditableData<Omit<Record, keyof XataRecord>>>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3102
+ 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 : ['*']>>>;
3103
+ /**
3104
+ * Performs a deletion of the current record in the database.
3105
+ *
3106
+ * @throws If the record was already deleted or if an error happened while performing the deletion.
3107
+ */
3108
+ delete(): Promise<void>;
3109
+ };
3110
+ declare type XataRecordMetadata = {
3111
+ /**
3112
+ * Number that is increased every time the record is updated.
3113
+ */
3114
+ version: number;
3115
+ warnings?: string[];
2676
3116
  };
2677
3117
  declare function isIdentifiable(x: any): x is Identifiable & Record<string, unknown>;
2678
3118
  declare function isXataRecord(x: any): x is XataRecord & Record<string, unknown>;
2679
3119
  declare type EditableData<O extends BaseData> = {
2680
3120
  [K in keyof O]: O[K] extends XataRecord ? {
2681
3121
  id: string;
2682
- } : NonNullable<O[K]> extends XataRecord ? {
3122
+ } | string : NonNullable<O[K]> extends XataRecord ? {
2683
3123
  id: string;
2684
- } | null | undefined : O[K];
3124
+ } | string | null | undefined : O[K];
2685
3125
  };
2686
3126
 
2687
3127
  /**
@@ -2757,8 +3197,8 @@ declare type ValueTypeFilters<T> = T | T extends string ? StringTypeFilter : T e
2757
3197
  ],
2758
3198
  }
2759
3199
  */
2760
- declare type AggregatorFilter<Record> = {
2761
- [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<Record>>;
3200
+ declare type AggregatorFilter<T> = {
3201
+ [key in '$all' | '$any' | '$not' | '$none']?: SingleOrArray<Filter<T>>;
2762
3202
  };
2763
3203
  /**
2764
3204
  * Existance filter
@@ -2773,10 +3213,88 @@ declare type BaseApiFilter<Record> = PropertyAccessFilter<Record> | AggregatorFi
2773
3213
  * Injects the Api filters on nested properties
2774
3214
  * Example: { filter: { settings: { plan: { $any: ['free', 'trial'] } } } }
2775
3215
  */
2776
- declare type NestedApiFilter<T> = T extends Record<string, any> ? {
3216
+ declare type NestedApiFilter<T> = {
2777
3217
  [key in keyof T]?: T[key] extends Record<string, any> ? SingleOrArray<Filter<T[key]>> : PropertyFilter<T[key]>;
2778
- } : PropertyFilter<T>;
2779
- declare type Filter<Record> = BaseApiFilter<Record> | NestedApiFilter<Record>;
3218
+ };
3219
+ declare type Filter<T> = T extends Record<string, any> ? BaseApiFilter<T> | NestedApiFilter<T> : PropertyFilter<T>;
3220
+
3221
+ declare type DateBooster = {
3222
+ origin?: string;
3223
+ scale: string;
3224
+ decay: number;
3225
+ };
3226
+ declare type NumericBooster = {
3227
+ factor: number;
3228
+ };
3229
+ declare type ValueBooster<T extends string | number | boolean> = {
3230
+ value: T;
3231
+ factor: number;
3232
+ };
3233
+ declare type Boosters<O extends XataRecord> = Values<{
3234
+ [K in SelectableColumn<O>]: NonNullable<ValueAtColumn<O, K>> extends Date ? {
3235
+ dateBooster: {
3236
+ column: K;
3237
+ } & DateBooster;
3238
+ } : NonNullable<ValueAtColumn<O, K>> extends number ? ExclusiveOr<{
3239
+ numericBooster?: {
3240
+ column: K;
3241
+ } & NumericBooster;
3242
+ }, {
3243
+ valueBooster?: {
3244
+ column: K;
3245
+ } & ValueBooster<number>;
3246
+ }> : NonNullable<ValueAtColumn<O, K>> extends string | boolean ? {
3247
+ valueBooster: {
3248
+ column: K;
3249
+ } & ValueBooster<NonNullable<ValueAtColumn<O, K>>>;
3250
+ } : never;
3251
+ }>;
3252
+
3253
+ declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3254
+ fuzziness?: FuzzinessExpression;
3255
+ prefix?: PrefixExpression;
3256
+ highlight?: HighlightExpression;
3257
+ tables?: Array<Tables | Values<{
3258
+ [Model in GetArrayInnerType<NonNullable<Tables[]>>]: {
3259
+ table: Model;
3260
+ filter?: Filter<SelectedPick<Schemas[Model] & XataRecord, ['*']>>;
3261
+ boosters?: Boosters<Schemas[Model] & XataRecord>[];
3262
+ };
3263
+ }>>;
3264
+ };
3265
+ declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3266
+ all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3267
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]: {
3268
+ table: Model;
3269
+ record: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>>;
3270
+ };
3271
+ }>[]>;
3272
+ byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3273
+ [Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]?: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>[]>;
3274
+ }>;
3275
+ };
3276
+ declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
3277
+ #private;
3278
+ private db;
3279
+ constructor(db: SchemaPluginResult<Schemas>, schemaTables?: Schemas.Table[]);
3280
+ build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
3281
+ }
3282
+ declare type SearchXataRecord<Record extends XataRecord> = Omit<Record, 'getMetadata'> & {
3283
+ getMetadata: () => XataRecordMetadata & SearchExtraProperties;
3284
+ };
3285
+ declare type SearchExtraProperties = {
3286
+ table: string;
3287
+ highlight?: {
3288
+ [key: string]: string[] | {
3289
+ [key: string]: any;
3290
+ };
3291
+ };
3292
+ score?: number;
3293
+ };
3294
+ declare type ReturnTable<Table, Tables> = Table extends Tables ? Table : never;
3295
+ 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 {
3296
+ table: infer Table;
3297
+ } ? ReturnTable<Table, Tables> : never;
2780
3298
 
2781
3299
  declare type SortDirection = 'asc' | 'desc';
2782
3300
  declare type SortFilterExtended<T extends XataRecord> = {
@@ -2788,13 +3306,21 @@ declare type SortFilterBase<T extends XataRecord> = {
2788
3306
  [Key in StringKeys<T>]: SortDirection;
2789
3307
  };
2790
3308
 
2791
- declare type QueryOptions<T extends XataRecord> = {
2792
- page?: PaginationOptions;
2793
- columns?: NonEmptyArray<SelectableColumn<T>>;
3309
+ declare type BaseOptions<T extends XataRecord> = {
3310
+ columns?: SelectableColumn<T>[];
3311
+ cache?: number;
3312
+ };
3313
+ declare type CursorQueryOptions = {
3314
+ pagination?: CursorNavigationOptions & OffsetNavigationOptions;
3315
+ filter?: never;
3316
+ sort?: never;
3317
+ };
3318
+ declare type OffsetQueryOptions<T extends XataRecord> = {
3319
+ pagination?: OffsetNavigationOptions;
2794
3320
  filter?: FilterExpression;
2795
3321
  sort?: SortFilter<T> | SortFilter<T>[];
2796
- ttl?: number;
2797
3322
  };
3323
+ declare type QueryOptions<T extends XataRecord> = BaseOptions<T> & (CursorQueryOptions | OffsetQueryOptions<T>);
2798
3324
  /**
2799
3325
  * Query objects contain the information of all filters, sorting, etc. to be included in the database query.
2800
3326
  *
@@ -2804,8 +3330,8 @@ declare type QueryOptions<T extends XataRecord> = {
2804
3330
  declare class Query<Record extends XataRecord, Result extends XataRecord = Record> implements Paginable<Record, Result> {
2805
3331
  #private;
2806
3332
  readonly meta: PaginationQueryMeta;
2807
- readonly records: Result[];
2808
- constructor(repository: Repository<Record> | null, table: string, data: Partial<QueryOptions<Record>>, parent?: Partial<QueryOptions<Record>>);
3333
+ readonly records: RecordArray<Result>;
3334
+ constructor(repository: Repository<Record> | null, table: string, data: Partial<QueryOptions<Record>>, rawParent?: Partial<QueryOptions<Record>>);
2809
3335
  getQueryOptions(): QueryOptions<Record>;
2810
3336
  key(): string;
2811
3337
  /**
@@ -2837,67 +3363,183 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
2837
3363
  *
2838
3364
  * ```
2839
3365
  * query.filter("columnName", columnValue)
2840
- * query.filter({
2841
- * "columnName": columnValue
2842
- * })
3366
+ * query.filter("columnName", operator(columnValue)) // Use gt, gte, lt, lte, startsWith,...
3367
+ * ```
3368
+ *
3369
+ * @param column The name of the column to filter.
3370
+ * @param value The value to filter.
3371
+ * @returns A new Query object.
3372
+ */
3373
+ filter<F extends SelectableColumn<Record>>(column: F, value: Filter<ValueAtColumn<Record, F>>): Query<Record, Result>;
3374
+ /**
3375
+ * Builds a new query object adding one or more constraints. Examples:
3376
+ *
3377
+ * ```
3378
+ * query.filter({ "columnName": columnValue })
2843
3379
  * query.filter({
2844
3380
  * "columnName": operator(columnValue) // Use gt, gte, lt, lte, startsWith,...
2845
3381
  * })
2846
3382
  * ```
2847
3383
  *
3384
+ * @param filters A filter object
2848
3385
  * @returns A new Query object.
2849
3386
  */
2850
3387
  filter(filters: Filter<Record>): Query<Record, Result>;
2851
- filter<F extends SelectableColumn<Record>>(column: F, value: Filter<ValueAtColumn<Record, F>>): Query<Record, Result>;
2852
3388
  /**
2853
3389
  * Builds a new query with a new sort option.
2854
3390
  * @param column The column name.
2855
3391
  * @param direction The direction. Either ascending or descending.
2856
3392
  * @returns A new Query object.
2857
3393
  */
2858
- sort<F extends SelectableColumn<Record>>(column: F, direction: SortDirection): Query<Record, Result>;
3394
+ sort<F extends SelectableColumn<Record>>(column: F, direction?: SortDirection): Query<Record, Result>;
2859
3395
  /**
2860
3396
  * Builds a new query specifying the set of columns to be returned in the query response.
2861
3397
  * @param columns Array of column names to be returned by the query.
2862
3398
  * @returns A new Query object.
2863
3399
  */
2864
- select<K extends SelectableColumn<Record>>(columns: NonEmptyArray<K>): Query<Record, SelectedPick<Record, NonEmptyArray<K>>>;
3400
+ select<K extends SelectableColumn<Record>>(columns: K[]): Query<Record, SelectedPick<Record, K[]>>;
3401
+ /**
3402
+ * Get paginated results
3403
+ *
3404
+ * @returns A page of results
3405
+ */
2865
3406
  getPaginated(): Promise<Page<Record, Result>>;
2866
- getPaginated(options: Omit<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
3407
+ /**
3408
+ * Get paginated results
3409
+ *
3410
+ * @param options Pagination options
3411
+ * @returns A page of results
3412
+ */
3413
+ getPaginated(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<Page<Record, Result>>;
3414
+ /**
3415
+ * Get paginated results
3416
+ *
3417
+ * @param options Pagination options
3418
+ * @returns A page of results
3419
+ */
2867
3420
  getPaginated<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<Page<Record, SelectedPick<Record, typeof options['columns']>>>;
3421
+ /**
3422
+ * Get results in an iterator
3423
+ *
3424
+ * @async
3425
+ * @returns Async interable of results
3426
+ */
2868
3427
  [Symbol.asyncIterator](): AsyncIterableIterator<Result>;
2869
- getIterator(chunk: number): AsyncGenerator<Result[]>;
2870
- getIterator(chunk: number, options: Omit<QueryOptions<Record>, 'columns' | 'page'>): AsyncGenerator<Result[]>;
2871
- getIterator<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(chunk: number, options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
3428
+ /**
3429
+ * Build an iterator of results
3430
+ *
3431
+ * @returns Async generator of results array
3432
+ */
3433
+ getIterator(): AsyncGenerator<Result[]>;
3434
+ /**
3435
+ * Build an iterator of results
3436
+ *
3437
+ * @param options Pagination options with batchSize
3438
+ * @returns Async generator of results array
3439
+ */
3440
+ getIterator(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
3441
+ batchSize?: number;
3442
+ }): AsyncGenerator<Result[]>;
3443
+ /**
3444
+ * Build an iterator of results
3445
+ *
3446
+ * @param options Pagination options with batchSize
3447
+ * @returns Async generator of results array
3448
+ */
3449
+ getIterator<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
3450
+ batchSize?: number;
3451
+ }>(options: Options): AsyncGenerator<SelectedPick<Record, typeof options['columns']>[]>;
3452
+ /**
3453
+ * Performs the query in the database and returns a set of results.
3454
+ * @returns An array of records from the database.
3455
+ */
3456
+ getMany(): Promise<RecordArray<Result>>;
3457
+ /**
3458
+ * Performs the query in the database and returns a set of results.
3459
+ * @param options Additional options to be used when performing the query.
3460
+ * @returns An array of records from the database.
3461
+ */
3462
+ getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<RecordArray<SelectedPick<Record, typeof options['columns']>>>;
2872
3463
  /**
2873
3464
  * Performs the query in the database and returns a set of results.
2874
3465
  * @param options Additional options to be used when performing the query.
2875
3466
  * @returns An array of records from the database.
2876
3467
  */
2877
- getMany(): Promise<Result[]>;
2878
- getMany(options: Omit<QueryOptions<Record>, 'columns'>): Promise<Result[]>;
2879
- getMany<Options extends RequiredBy<QueryOptions<Record>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
3468
+ getMany(options: OmitBy<QueryOptions<Record>, 'columns'>): Promise<RecordArray<Result>>;
3469
+ /**
3470
+ * Performs the query in the database and returns all the results.
3471
+ * Warning: If there are a large number of results, this method can have performance implications.
3472
+ * @returns An array of records from the database.
3473
+ */
3474
+ getAll(): Promise<Result[]>;
2880
3475
  /**
2881
3476
  * Performs the query in the database and returns all the results.
2882
3477
  * Warning: If there are a large number of results, this method can have performance implications.
2883
3478
  * @param options Additional options to be used when performing the query.
2884
3479
  * @returns An array of records from the database.
2885
3480
  */
2886
- getAll(chunk?: number): Promise<Result[]>;
2887
- getAll(chunk: number | undefined, options: Omit<QueryOptions<Record>, 'columns' | 'page'>): Promise<Result[]>;
2888
- getAll<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(chunk: number | undefined, options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
3481
+ getAll<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'> & {
3482
+ batchSize?: number;
3483
+ }>(options: Options): Promise<SelectedPick<Record, typeof options['columns']>[]>;
2889
3484
  /**
2890
- * Performs the query in the database and returns the first result.
3485
+ * Performs the query in the database and returns all the results.
3486
+ * Warning: If there are a large number of results, this method can have performance implications.
2891
3487
  * @param options Additional options to be used when performing the query.
3488
+ * @returns An array of records from the database.
3489
+ */
3490
+ getAll(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'> & {
3491
+ batchSize?: number;
3492
+ }): Promise<Result[]>;
3493
+ /**
3494
+ * Performs the query in the database and returns the first result.
2892
3495
  * @returns The first record that matches the query, or null if no record matched the query.
2893
3496
  */
2894
3497
  getFirst(): Promise<Result | null>;
2895
- getFirst(options: Omit<QueryOptions<Record>, 'columns' | 'page'>): Promise<Result | null>;
2896
- getFirst<Options extends RequiredBy<Omit<QueryOptions<Record>, 'page'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
3498
+ /**
3499
+ * Performs the query in the database and returns the first result.
3500
+ * @param options Additional options to be used when performing the query.
3501
+ * @returns The first record that matches the query, or null if no record matched the query.
3502
+ */
3503
+ getFirst<Options extends RequiredBy<OmitBy<QueryOptions<Record>, 'pagination'>, 'columns'>>(options: Options): Promise<SelectedPick<Record, typeof options['columns']> | null>;
3504
+ /**
3505
+ * Performs the query in the database and returns the first result.
3506
+ * @param options Additional options to be used when performing the query.
3507
+ * @returns The first record that matches the query, or null if no record matched the query.
3508
+ */
3509
+ getFirst(options: OmitBy<QueryOptions<Record>, 'columns' | 'pagination'>): Promise<Result | null>;
3510
+ /**
3511
+ * Builds a new query object adding a cache TTL in milliseconds.
3512
+ * @param ttl The cache TTL in milliseconds.
3513
+ * @returns A new Query object.
3514
+ */
3515
+ cache(ttl: number): Query<Record, Result>;
3516
+ /**
3517
+ * Retrieve next page of records
3518
+ *
3519
+ * @returns A new page object.
3520
+ */
2897
3521
  nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
3522
+ /**
3523
+ * Retrieve previous page of records
3524
+ *
3525
+ * @returns A new page object
3526
+ */
2898
3527
  previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
3528
+ /**
3529
+ * Retrieve first page of records
3530
+ *
3531
+ * @returns A new page object
3532
+ */
2899
3533
  firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
3534
+ /**
3535
+ * Retrieve last page of records
3536
+ *
3537
+ * @returns A new page object
3538
+ */
2900
3539
  lastPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
3540
+ /**
3541
+ * @returns Boolean indicating if there is a next page
3542
+ */
2901
3543
  hasNextPage(): boolean;
2902
3544
  }
2903
3545
 
@@ -2909,7 +3551,7 @@ declare type PaginationQueryMeta = {
2909
3551
  };
2910
3552
  interface Paginable<Record extends XataRecord, Result extends XataRecord = Record> {
2911
3553
  meta: PaginationQueryMeta;
2912
- records: Result[];
3554
+ records: RecordArray<Result>;
2913
3555
  nextPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
2914
3556
  previousPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
2915
3557
  firstPage(size?: number, offset?: number): Promise<Page<Record, Result>>;
@@ -2929,7 +3571,7 @@ declare class Page<Record extends XataRecord, Result extends XataRecord = Record
2929
3571
  /**
2930
3572
  * The set of results for this page.
2931
3573
  */
2932
- readonly records: Result[];
3574
+ readonly records: RecordArray<Result>;
2933
3575
  constructor(query: Query<Record, Result>, meta: PaginationQueryMeta, records?: Result[]);
2934
3576
  /**
2935
3577
  * Retrieves the next page of results.
@@ -2977,44 +3619,154 @@ declare type OffsetNavigationOptions = {
2977
3619
  size?: number;
2978
3620
  offset?: number;
2979
3621
  };
2980
- declare type PaginationOptions = CursorNavigationOptions & OffsetNavigationOptions;
2981
3622
  declare const PAGINATION_MAX_SIZE = 200;
2982
- declare const PAGINATION_DEFAULT_SIZE = 200;
3623
+ declare const PAGINATION_DEFAULT_SIZE = 20;
2983
3624
  declare const PAGINATION_MAX_OFFSET = 800;
2984
3625
  declare const PAGINATION_DEFAULT_OFFSET = 0;
3626
+ declare function isCursorPaginationOptions(options: Record<string, unknown> | undefined | null): options is CursorNavigationOptions;
3627
+ declare class RecordArray<Result extends XataRecord> extends Array<Result> {
3628
+ #private;
3629
+ constructor(page: Paginable<any, Result>, overrideRecords?: Result[]);
3630
+ static parseConstructorParams(...args: any[]): any[];
3631
+ toArray(): Result[];
3632
+ map<U>(callbackfn: (value: Result, index: number, array: Result[]) => U, thisArg?: any): U[];
3633
+ /**
3634
+ * Retrieve next page of records
3635
+ *
3636
+ * @returns A new array of objects
3637
+ */
3638
+ nextPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
3639
+ /**
3640
+ * Retrieve previous page of records
3641
+ *
3642
+ * @returns A new array of objects
3643
+ */
3644
+ previousPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
3645
+ /**
3646
+ * Retrieve first page of records
3647
+ *
3648
+ * @returns A new array of objects
3649
+ */
3650
+ firstPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
3651
+ /**
3652
+ * Retrieve last page of records
3653
+ *
3654
+ * @returns A new array of objects
3655
+ */
3656
+ lastPage(size?: number, offset?: number): Promise<RecordArray<Result>>;
3657
+ /**
3658
+ * @returns Boolean indicating if there is a next page
3659
+ */
3660
+ hasNextPage(): boolean;
3661
+ }
2985
3662
 
2986
- declare type TableLink = string[];
2987
- declare type LinkDictionary = Dictionary<TableLink[]>;
2988
3663
  /**
2989
3664
  * Common interface for performing operations on a table.
2990
3665
  */
2991
3666
  declare abstract class Repository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
2992
- abstract create(object: EditableData<Data> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3667
+ abstract create<K extends SelectableColumn<Record>>(object: Omit<EditableData<Data>, 'id'> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3668
+ abstract create(object: Omit<EditableData<Data>, 'id'> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
2993
3669
  /**
2994
3670
  * Creates a single record in the table with a unique id.
2995
3671
  * @param id The unique id.
2996
3672
  * @param object Object containing the column names with their values to be stored in the table.
3673
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
2997
3674
  * @returns The full persisted record.
2998
3675
  */
2999
- abstract create(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3676
+ abstract create<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Data>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3677
+ /**
3678
+ * Creates a single record in the table with a unique id.
3679
+ * @param id The unique id.
3680
+ * @param object Object containing the column names with their values to be stored in the table.
3681
+ * @returns The full persisted record.
3682
+ */
3683
+ abstract create(id: string, object: Omit<EditableData<Data>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3000
3684
  /**
3001
3685
  * Creates multiple records in the table.
3002
3686
  * @param objects Array of objects with the column names and the values to be stored in the table.
3003
- * @returns Array of the persisted records.
3687
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3688
+ * @returns Array of the persisted records in order.
3004
3689
  */
3005
- abstract create(objects: Array<EditableData<Data> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3690
+ abstract create<K extends SelectableColumn<Record>>(objects: Array<Omit<EditableData<Data>, 'id'> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3691
+ /**
3692
+ * Creates multiple records in the table.
3693
+ * @param objects Array of objects with the column names and the values to be stored in the table.
3694
+ * @returns Array of the persisted records in order.
3695
+ */
3696
+ abstract create(objects: Array<Omit<EditableData<Data>, 'id'> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3697
+ /**
3698
+ * Queries a single record from the table given its unique id.
3699
+ * @param id The unique id.
3700
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3701
+ * @returns The persisted record for the given id or null if the record could not be found.
3702
+ */
3703
+ abstract read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
3006
3704
  /**
3007
3705
  * Queries a single record from the table given its unique id.
3008
3706
  * @param id The unique id.
3009
3707
  * @returns The persisted record for the given id or null if the record could not be found.
3010
3708
  */
3011
3709
  abstract read(id: string): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
3710
+ /**
3711
+ * Queries multiple records from the table given their unique id.
3712
+ * @param ids The unique ids array.
3713
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3714
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
3715
+ */
3716
+ abstract read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3717
+ /**
3718
+ * Queries multiple records from the table given their unique id.
3719
+ * @param ids The unique ids array.
3720
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
3721
+ */
3722
+ abstract read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3723
+ /**
3724
+ * Queries a single record from the table by the id in the object.
3725
+ * @param object Object containing the id of the record.
3726
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3727
+ * @returns The persisted record for the given id or null if the record could not be found.
3728
+ */
3729
+ abstract read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
3730
+ /**
3731
+ * Queries a single record from the table by the id in the object.
3732
+ * @param object Object containing the id of the record.
3733
+ * @returns The persisted record for the given id or null if the record could not be found.
3734
+ */
3735
+ abstract read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
3736
+ /**
3737
+ * Queries multiple records from the table by the ids in the objects.
3738
+ * @param objects Array of objects containing the ids of the records.
3739
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3740
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
3741
+ */
3742
+ abstract read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
3743
+ /**
3744
+ * Queries multiple records from the table by the ids in the objects.
3745
+ * @param objects Array of objects containing the ids of the records.
3746
+ * @returns The persisted records for the given ids in order (if a record could not be found null is returned).
3747
+ */
3748
+ abstract read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
3749
+ /**
3750
+ * Partially update a single record.
3751
+ * @param object An object with its id and the columns to be updated.
3752
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3753
+ * @returns The full persisted record.
3754
+ */
3755
+ abstract update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Data>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3012
3756
  /**
3013
3757
  * Partially update a single record.
3014
3758
  * @param object An object with its id and the columns to be updated.
3015
3759
  * @returns The full persisted record.
3016
3760
  */
3017
3761
  abstract update(object: Partial<EditableData<Data>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3762
+ /**
3763
+ * Partially update a single record given its unique id.
3764
+ * @param id The unique id.
3765
+ * @param object The column names and their values that have to be updated.
3766
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3767
+ * @returns The full persisted record.
3768
+ */
3769
+ abstract update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Data>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3018
3770
  /**
3019
3771
  * Partially update a single record given its unique id.
3020
3772
  * @param id The unique id.
@@ -3025,9 +3777,24 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3025
3777
  /**
3026
3778
  * Partially updates multiple records.
3027
3779
  * @param objects An array of objects with their ids and columns to be updated.
3028
- * @returns Array of the persisted records.
3780
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3781
+ * @returns Array of the persisted records in order.
3782
+ */
3783
+ abstract update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Data>> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3784
+ /**
3785
+ * Partially updates multiple records.
3786
+ * @param objects An array of objects with their ids and columns to be updated.
3787
+ * @returns Array of the persisted records in order.
3029
3788
  */
3030
3789
  abstract update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3790
+ /**
3791
+ * Creates or updates a single record. If a record exists with the given id,
3792
+ * it will be update, otherwise a new record will be created.
3793
+ * @param object Object containing the column names with their values to be persisted in the table.
3794
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3795
+ * @returns The full persisted record.
3796
+ */
3797
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Data> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3031
3798
  /**
3032
3799
  * Creates or updates a single record. If a record exists with the given id,
3033
3800
  * it will be update, otherwise a new record will be created.
@@ -3040,9 +3807,26 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3040
3807
  * it will be update, otherwise a new record will be created.
3041
3808
  * @param id A unique id.
3042
3809
  * @param object The column names and the values to be persisted.
3810
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3043
3811
  * @returns The full persisted record.
3044
3812
  */
3045
- abstract createOrUpdate(id: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3813
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Data>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3814
+ /**
3815
+ * Creates or updates a single record. If a record exists with the given id,
3816
+ * it will be update, otherwise a new record will be created.
3817
+ * @param id A unique id.
3818
+ * @param object The column names and the values to be persisted.
3819
+ * @returns The full persisted record.
3820
+ */
3821
+ abstract createOrUpdate(id: string, object: Omit<EditableData<Data>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3822
+ /**
3823
+ * Creates or updates a single record. If a record exists with the given id,
3824
+ * it will be update, otherwise a new record will be created.
3825
+ * @param objects Array of objects with the column names and the values to be stored in the table.
3826
+ * @param columns Array of columns to be returned. If not specified, first level columns will be returned.
3827
+ * @returns Array of the persisted records.
3828
+ */
3829
+ abstract createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Data> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3046
3830
  /**
3047
3831
  * Creates or updates a single record. If a record exists with the given id,
3048
3832
  * it will be update, otherwise a new record will be created.
@@ -3081,37 +3865,112 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
3081
3865
  * @returns The found records.
3082
3866
  */
3083
3867
  abstract search(query: string, options?: {
3084
- fuzziness?: number;
3085
- }): Promise<SelectedPick<Record, ['*']>[]>;
3868
+ fuzziness?: FuzzinessExpression;
3869
+ prefix?: PrefixExpression;
3870
+ highlight?: HighlightExpression;
3871
+ filter?: Filter<Record>;
3872
+ boosters?: Boosters<Record>[];
3873
+ }): Promise<SearchXataRecord<SelectedPick<Record, ['*']>>[]>;
3086
3874
  abstract query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3087
3875
  }
3088
3876
  declare class RestRepository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Data, Record> {
3089
3877
  #private;
3090
- db: SchemaPluginResult<any>;
3091
- cache: CacheImpl;
3092
3878
  constructor(options: {
3093
3879
  table: string;
3094
- links?: LinkDictionary;
3095
3880
  db: SchemaPluginResult<any>;
3096
3881
  pluginOptions: XataPluginOptions;
3882
+ schemaTables?: Table[];
3097
3883
  });
3098
- create(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3099
- create(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3100
- create(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3101
- read(recordId: string): Promise<SelectedPick<Record, ['*']> | null>;
3884
+ create(object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3885
+ create(recordId: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
3886
+ create(objects: EditableData<Data>[]): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
3887
+ create<K extends SelectableColumn<Record>>(object: EditableData<Data>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3888
+ create<K extends SelectableColumn<Record>>(recordId: string, object: EditableData<Data>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
3889
+ create<K extends SelectableColumn<Record>>(objects: EditableData<Data>[], columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
3890
+ read(recordId: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3891
+ read(recordIds: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3892
+ read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
3893
+ read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
3894
+ read<K extends SelectableColumn<Record>>(recordId: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3895
+ read<K extends SelectableColumn<Record>>(recordIds: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
3896
+ read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
3897
+ read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>>>>;
3102
3898
  update(object: Partial<EditableData<Data>> & Identifiable): Promise<SelectedPick<Record, ['*']>>;
3103
3899
  update(recordId: string, object: Partial<EditableData<Data>>): Promise<SelectedPick<Record, ['*']>>;
3104
3900
  update(objects: Array<Partial<EditableData<Data>> & Identifiable>): Promise<SelectedPick<Record, ['*']>[]>;
3901
+ update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Data>> & Identifiable, columns: K[]): Promise<SelectedPick<Record, typeof columns>>;
3902
+ update<K extends SelectableColumn<Record>>(recordId: string, object: Partial<EditableData<Data>>, columns: K[]): Promise<SelectedPick<Record, typeof columns>>;
3903
+ update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Data>> & Identifiable>, columns: K[]): Promise<SelectedPick<Record, typeof columns>[]>;
3105
3904
  createOrUpdate(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3106
3905
  createOrUpdate(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
3107
3906
  createOrUpdate(objects: EditableData<Data>[]): Promise<SelectedPick<Record, ['*']>[]>;
3907
+ createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Data>, columns: K[]): Promise<SelectedPick<Record, typeof columns>>;
3908
+ createOrUpdate<K extends SelectableColumn<Record>>(recordId: string, object: EditableData<Data>, columns: K[]): Promise<SelectedPick<Record, typeof columns>>;
3909
+ createOrUpdate<K extends SelectableColumn<Record>>(objects: EditableData<Data>[], columns: K[]): Promise<SelectedPick<Record, typeof columns>[]>;
3108
3910
  delete(a: string | Identifiable | Array<string | Identifiable>): Promise<void>;
3109
3911
  search(query: string, options?: {
3110
- fuzziness?: number;
3111
- }): Promise<SelectedPick<Record, ['*']>[]>;
3912
+ fuzziness?: FuzzinessExpression;
3913
+ prefix?: PrefixExpression;
3914
+ highlight?: HighlightExpression;
3915
+ filter?: Filter<Record>;
3916
+ boosters?: Boosters<Record>[];
3917
+ }): Promise<any>;
3112
3918
  query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
3113
3919
  }
3114
3920
 
3921
+ declare type BaseSchema = {
3922
+ name: string;
3923
+ columns: readonly ({
3924
+ name: string;
3925
+ type: Column['type'];
3926
+ } | {
3927
+ name: string;
3928
+ type: 'link';
3929
+ link: {
3930
+ table: string;
3931
+ };
3932
+ } | {
3933
+ name: string;
3934
+ type: 'object';
3935
+ columns: {
3936
+ name: string;
3937
+ type: string;
3938
+ }[];
3939
+ })[];
3940
+ };
3941
+ declare type SchemaInference<T extends readonly BaseSchema[]> = T extends never[] ? Record<string, Record<string, any>> : T extends readonly unknown[] ? T[number] extends {
3942
+ name: string;
3943
+ columns: readonly unknown[];
3944
+ } ? {
3945
+ [K in T[number]['name']]: TableType<T[number], K>;
3946
+ } : never : never;
3947
+ declare type TableType<Tables, TableName> = Tables & {
3948
+ name: TableName;
3949
+ } extends infer Table ? Table extends {
3950
+ name: string;
3951
+ columns: infer Columns;
3952
+ } ? Columns extends readonly unknown[] ? Columns[number] extends {
3953
+ name: string;
3954
+ type: string;
3955
+ } ? Identifiable & {
3956
+ [K in Columns[number]['name']]?: PropertyType<Tables, Columns[number], K>;
3957
+ } : never : never : never : never;
3958
+ declare type PropertyType<Tables, Properties, PropertyName> = Properties & {
3959
+ name: PropertyName;
3960
+ } extends infer Property ? Property extends {
3961
+ name: string;
3962
+ type: infer Type;
3963
+ link?: {
3964
+ table: infer LinkedTable;
3965
+ };
3966
+ columns?: infer ObjectColumns;
3967
+ } ? (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 {
3968
+ name: string;
3969
+ type: string;
3970
+ } ? {
3971
+ [K in ObjectColumns[number]['name']]?: PropertyType<Tables, ObjectColumns[number], K>;
3972
+ } : never : never : Type extends 'link' ? TableType<Tables, LinkedTable> & XataRecord : never) | null : never : never;
3973
+
3115
3974
  /**
3116
3975
  * Operator to restrict results to only values that are greater than the given value.
3117
3976
  */
@@ -3187,47 +4046,18 @@ declare const includesAny: <T>(value: T) => ArrayFilter<T>;
3187
4046
 
3188
4047
  declare type SchemaDefinition = {
3189
4048
  table: string;
3190
- links?: LinkDictionary;
3191
4049
  };
3192
4050
  declare type SchemaPluginResult<Schemas extends Record<string, BaseData>> = {
3193
4051
  [Key in keyof Schemas]: Repository<Schemas[Key]>;
4052
+ } & {
4053
+ [key: string]: Repository<XataRecord$1>;
3194
4054
  };
3195
4055
  declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
3196
4056
  #private;
3197
- private links?;
3198
- private tableNames?;
3199
- constructor(links?: LinkDictionary | undefined, tableNames?: string[] | undefined);
4057
+ constructor(schemaTables?: Schemas.Table[]);
3200
4058
  build(pluginOptions: XataPluginOptions): SchemaPluginResult<Schemas>;
3201
4059
  }
3202
4060
 
3203
- declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
3204
- fuzziness?: number;
3205
- tables?: Tables[];
3206
- };
3207
- declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
3208
- all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
3209
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]: {
3210
- table: Model;
3211
- record: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>>;
3212
- };
3213
- }>[]>;
3214
- byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
3215
- [Model in GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>]?: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>[]>;
3216
- }>;
3217
- };
3218
- declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
3219
- #private;
3220
- private db;
3221
- private links;
3222
- constructor(db: SchemaPluginResult<Schemas>, links: LinkDictionary);
3223
- build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
3224
- }
3225
- declare type SearchXataRecord = XataRecord & {
3226
- xata: {
3227
- table: string;
3228
- };
3229
- };
3230
-
3231
4061
  declare type BranchStrategyValue = string | undefined | null;
3232
4062
  declare type BranchStrategyBuilder = () => BranchStrategyValue | Promise<BranchStrategyValue>;
3233
4063
  declare type BranchStrategy = BranchStrategyValue | BranchStrategyBuilder;
@@ -3242,31 +4072,125 @@ declare type BaseClientOptions = {
3242
4072
  };
3243
4073
  declare const buildClient: <Plugins extends Record<string, XataPlugin> = {}>(plugins?: Plugins | undefined) => ClientConstructor<Plugins>;
3244
4074
  interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
3245
- new <Schemas extends Record<string, BaseData>>(options?: Partial<BaseClientOptions>, links?: LinkDictionary): Omit<{
3246
- db: Awaited<ReturnType<SchemaPlugin<Schemas>['build']>>;
3247
- search: Awaited<ReturnType<SearchPlugin<Schemas>['build']>>;
4075
+ new <T extends readonly BaseSchema[]>(options?: Partial<BaseClientOptions>, schemaTables?: T): Omit<{
4076
+ db: Awaited<ReturnType<SchemaPlugin<SchemaInference<NonNullable<typeof schemaTables>>>['build']>>;
4077
+ search: Awaited<ReturnType<SearchPlugin<SchemaInference<NonNullable<typeof schemaTables>>>['build']>>;
3248
4078
  }, keyof Plugins> & {
3249
4079
  [Key in StringKeys<NonNullable<Plugins>>]: Awaited<ReturnType<NonNullable<Plugins>[Key]['build']>>;
4080
+ } & {
4081
+ getConfig(): Promise<{
4082
+ databaseURL: string;
4083
+ branch: string;
4084
+ }>;
3250
4085
  };
3251
4086
  }
3252
4087
  declare const BaseClient_base: ClientConstructor<{}>;
3253
- declare class BaseClient extends BaseClient_base<Record<string, any>> {
4088
+ declare class BaseClient extends BaseClient_base<[]> {
3254
4089
  }
3255
4090
 
4091
+ declare class Serializer {
4092
+ classes: Record<string, any>;
4093
+ add(clazz: any): void;
4094
+ toJSON<T>(data: T): string;
4095
+ fromJSON<T>(json: string): T;
4096
+ }
4097
+ declare const serialize: <T>(data: T) => string;
4098
+ declare const deserialize: <T>(json: string) => T;
4099
+
3256
4100
  declare type BranchResolutionOptions = {
3257
4101
  databaseURL?: string;
3258
4102
  apiKey?: string;
3259
4103
  fetchImpl?: FetchImpl;
3260
4104
  };
3261
- declare function getCurrentBranchName(options?: BranchResolutionOptions): Promise<string | undefined>;
4105
+ declare function getCurrentBranchName(options?: BranchResolutionOptions): Promise<string>;
3262
4106
  declare function getCurrentBranchDetails(options?: BranchResolutionOptions): Promise<DBBranch | null>;
3263
4107
  declare function getDatabaseURL(): string | undefined;
3264
4108
 
3265
4109
  declare function getAPIKey(): string | undefined;
3266
4110
 
4111
+ interface Body {
4112
+ arrayBuffer(): Promise<ArrayBuffer>;
4113
+ blob(): Promise<Blob>;
4114
+ formData(): Promise<FormData>;
4115
+ json(): Promise<any>;
4116
+ text(): Promise<string>;
4117
+ }
4118
+ interface Blob {
4119
+ readonly size: number;
4120
+ readonly type: string;
4121
+ arrayBuffer(): Promise<ArrayBuffer>;
4122
+ slice(start?: number, end?: number, contentType?: string): Blob;
4123
+ text(): Promise<string>;
4124
+ }
4125
+ /** Provides information about files and allows JavaScript in a web page to access their content. */
4126
+ interface File extends Blob {
4127
+ readonly lastModified: number;
4128
+ readonly name: string;
4129
+ readonly webkitRelativePath: string;
4130
+ }
4131
+ declare type FormDataEntryValue = File | string;
4132
+ /** 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". */
4133
+ interface FormData {
4134
+ append(name: string, value: string | Blob, fileName?: string): void;
4135
+ delete(name: string): void;
4136
+ get(name: string): FormDataEntryValue | null;
4137
+ getAll(name: string): FormDataEntryValue[];
4138
+ has(name: string): boolean;
4139
+ set(name: string, value: string | Blob, fileName?: string): void;
4140
+ forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void;
4141
+ }
4142
+ /** 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. */
4143
+ interface Headers {
4144
+ append(name: string, value: string): void;
4145
+ delete(name: string): void;
4146
+ get(name: string): string | null;
4147
+ has(name: string): boolean;
4148
+ set(name: string, value: string): void;
4149
+ forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void;
4150
+ }
4151
+ interface Request extends Body {
4152
+ /** Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching. */
4153
+ readonly cache: 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload';
4154
+ /** 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. */
4155
+ readonly credentials: 'include' | 'omit' | 'same-origin';
4156
+ /** Returns the kind of resource requested by request, e.g., "document" or "script". */
4157
+ readonly destination: '' | 'audio' | 'audioworklet' | 'document' | 'embed' | 'font' | 'frame' | 'iframe' | 'image' | 'manifest' | 'object' | 'paintworklet' | 'report' | 'script' | 'sharedworker' | 'style' | 'track' | 'video' | 'worker' | 'xslt';
4158
+ /** 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. */
4159
+ readonly headers: Headers;
4160
+ /** 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] */
4161
+ readonly integrity: string;
4162
+ /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
4163
+ readonly keepalive: boolean;
4164
+ /** Returns request's HTTP method, which is "GET" by default. */
4165
+ readonly method: string;
4166
+ /** 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. */
4167
+ readonly mode: 'cors' | 'navigate' | 'no-cors' | 'same-origin';
4168
+ /** 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. */
4169
+ readonly redirect: 'error' | 'follow' | 'manual';
4170
+ /** 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. */
4171
+ readonly referrer: string;
4172
+ /** Returns the referrer policy associated with request. This is used during fetching to compute the value of the request's referrer. */
4173
+ readonly referrerPolicy: '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
4174
+ /** Returns the URL of request as a string. */
4175
+ readonly url: string;
4176
+ clone(): Request;
4177
+ }
4178
+
4179
+ declare type XataWorkerContext<XataClient> = {
4180
+ xata: XataClient;
4181
+ request: Request;
4182
+ env: Record<string, string | undefined>;
4183
+ };
4184
+ declare type RemoveFirst<T> = T extends [any, ...infer U] ? U : never;
4185
+ declare type WorkerRunnerConfig = {
4186
+ workspace: string;
4187
+ worker: string;
4188
+ };
4189
+ 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>>>;
4190
+
3267
4191
  declare class XataError extends Error {
3268
4192
  readonly status: number;
3269
4193
  constructor(message: string, status: number);
3270
4194
  }
3271
4195
 
3272
- export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, 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, GetRecordError, GetRecordPathParams, GetRecordRequestBody, GetRecordVariables, GetTableColumnsError, GetTableColumnsPathParams, GetTableColumnsResponse, GetTableColumnsVariables, GetTableSchemaError, GetTableSchemaPathParams, GetTableSchemaResponse, GetTableSchemaVariables, GetUserAPIKeysError, GetUserAPIKeysResponse, GetUserAPIKeysVariables, GetUserError, GetUserVariables, GetWorkspaceError, GetWorkspaceMembersListError, GetWorkspaceMembersListPathParams, GetWorkspaceMembersListVariables, GetWorkspacePathParams, GetWorkspaceVariables, GetWorkspacesListError, GetWorkspacesListResponse, GetWorkspacesListVariables, Identifiable, InsertRecordError, InsertRecordPathParams, InsertRecordResponse, InsertRecordVariables, InsertRecordWithIDError, InsertRecordWithIDPathParams, InsertRecordWithIDQueryParams, InsertRecordWithIDVariables, InviteWorkspaceMemberError, InviteWorkspaceMemberPathParams, InviteWorkspaceMemberRequestBody, InviteWorkspaceMemberVariables, LinkDictionary, OffsetNavigationOptions, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Paginable, PaginationOptions, PaginationQueryMeta, Query, QueryTableError, QueryTablePathParams, QueryTableRequestBody, QueryTableVariables, RemoveWorkspaceMemberError, RemoveWorkspaceMemberPathParams, RemoveWorkspaceMemberVariables, Repository, ResendWorkspaceMemberInviteError, ResendWorkspaceMemberInvitePathParams, ResendWorkspaceMemberInviteVariables, responses as Responses, RestRepository, SchemaDefinition, SchemaPlugin, SchemaPluginResult, schemas as Schemas, SearchBranchError, SearchBranchPathParams, SearchBranchRequestBody, SearchBranchVariables, SearchOptions, SearchPlugin, SearchPluginResult, SelectableColumn, SelectedPick, SetTableSchemaError, SetTableSchemaPathParams, SetTableSchemaRequestBody, SetTableSchemaVariables, SimpleCache, 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, 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, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isIdentifiable, isNot, isXataRecord, le, lt, lte, notExists, operationsByTag, pattern, queryTable, removeWorkspaceMember, resendWorkspaceMemberInvite, searchBranch, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberRole, upsertRecordWithID };
4196
+ 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, 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, 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, serialize, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };