@xata.io/client 0.14.0 → 0.16.1
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/CHANGELOG.md +32 -0
- package/Usage.md +33 -0
- package/dist/index.cjs +244 -160
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +519 -128
- package/dist/index.mjs +239 -161
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -23,7 +23,6 @@ declare type ErrorWrapper<TError> = TError | {
|
|
23
23
|
};
|
24
24
|
|
25
25
|
interface CacheImpl {
|
26
|
-
cacheRecords: boolean;
|
27
26
|
defaultQueryTTL: number;
|
28
27
|
getAll(): Promise<Record<string, unknown>>;
|
29
28
|
get: <T>(key: string) => Promise<T | null>;
|
@@ -33,13 +32,11 @@ interface CacheImpl {
|
|
33
32
|
}
|
34
33
|
interface SimpleCacheOptions {
|
35
34
|
max?: number;
|
36
|
-
cacheRecords?: boolean;
|
37
35
|
defaultQueryTTL?: number;
|
38
36
|
}
|
39
37
|
declare class SimpleCache implements CacheImpl {
|
40
38
|
#private;
|
41
39
|
capacity: number;
|
42
|
-
cacheRecords: boolean;
|
43
40
|
defaultQueryTTL: number;
|
44
41
|
constructor(options?: SimpleCacheOptions);
|
45
42
|
getAll(): Promise<Record<string, unknown>>;
|
@@ -125,16 +122,20 @@ declare type WorkspaceMembers = {
|
|
125
122
|
* @pattern ^ik_[a-zA-Z0-9]+
|
126
123
|
*/
|
127
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
|
+
};
|
128
137
|
declare type ListDatabasesResponse = {
|
129
|
-
databases?:
|
130
|
-
name: string;
|
131
|
-
displayName: string;
|
132
|
-
createdAt: DateTime;
|
133
|
-
numberOfBranches: number;
|
134
|
-
ui?: {
|
135
|
-
color?: string;
|
136
|
-
};
|
137
|
-
}[];
|
138
|
+
databases?: DatabaseMetadata[];
|
138
139
|
};
|
139
140
|
declare type ListBranchesResponse = {
|
140
141
|
databaseName: string;
|
@@ -303,6 +304,44 @@ declare type HighlightExpression = {
|
|
303
304
|
enabled?: boolean;
|
304
305
|
encodeHTML?: boolean;
|
305
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
|
+
};
|
306
345
|
declare type FilterList = FilterExpression | FilterExpression[];
|
307
346
|
declare type FilterColumn = FilterColumnIncludes | FilterPredicate | FilterList;
|
308
347
|
/**
|
@@ -359,7 +398,24 @@ declare type PageConfig = {
|
|
359
398
|
size?: number;
|
360
399
|
offset?: number;
|
361
400
|
};
|
362
|
-
declare type
|
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
|
+
};
|
363
419
|
/**
|
364
420
|
* @pattern [a-zA-Z0-9_-~:]+
|
365
421
|
*/
|
@@ -381,21 +437,9 @@ declare type RecordsMetadata = {
|
|
381
437
|
};
|
382
438
|
};
|
383
439
|
/**
|
384
|
-
* Xata Table Record
|
440
|
+
* Xata Table Record Metadata
|
385
441
|
*/
|
386
|
-
declare type XataRecord$1 = {
|
387
|
-
id: RecordID;
|
388
|
-
xata: {
|
389
|
-
version: number;
|
390
|
-
table?: string;
|
391
|
-
highlight?: {
|
392
|
-
[key: string]: string[] | {
|
393
|
-
[key: string]: any;
|
394
|
-
};
|
395
|
-
};
|
396
|
-
warnings?: string[];
|
397
|
-
};
|
398
|
-
} & {
|
442
|
+
declare type XataRecord$1 = RecordMeta & {
|
399
443
|
[key: string]: any;
|
400
444
|
};
|
401
445
|
|
@@ -413,6 +457,7 @@ type schemas_InviteID = InviteID;
|
|
413
457
|
type schemas_WorkspaceInvite = WorkspaceInvite;
|
414
458
|
type schemas_WorkspaceMembers = WorkspaceMembers;
|
415
459
|
type schemas_InviteKey = InviteKey;
|
460
|
+
type schemas_DatabaseMetadata = DatabaseMetadata;
|
416
461
|
type schemas_ListDatabasesResponse = ListDatabasesResponse;
|
417
462
|
type schemas_ListBranchesResponse = ListBranchesResponse;
|
418
463
|
type schemas_ListGitBranchesResponse = ListGitBranchesResponse;
|
@@ -440,6 +485,7 @@ type schemas_FuzzinessExpression = FuzzinessExpression;
|
|
440
485
|
type schemas_PrefixExpression = PrefixExpression;
|
441
486
|
type schemas_FilterExpression = FilterExpression;
|
442
487
|
type schemas_HighlightExpression = HighlightExpression;
|
488
|
+
type schemas_BoosterExpression = BoosterExpression;
|
443
489
|
type schemas_FilterList = FilterList;
|
444
490
|
type schemas_FilterColumn = FilterColumn;
|
445
491
|
type schemas_FilterColumnIncludes = FilterColumnIncludes;
|
@@ -449,7 +495,8 @@ type schemas_FilterPredicateRangeOp = FilterPredicateRangeOp;
|
|
449
495
|
type schemas_FilterRangeValue = FilterRangeValue;
|
450
496
|
type schemas_FilterValue = FilterValue;
|
451
497
|
type schemas_PageConfig = PageConfig;
|
452
|
-
type
|
498
|
+
type schemas_ColumnsProjection = ColumnsProjection;
|
499
|
+
type schemas_RecordMeta = RecordMeta;
|
453
500
|
type schemas_RecordID = RecordID;
|
454
501
|
type schemas_TableRename = TableRename;
|
455
502
|
type schemas_RecordsMetadata = RecordsMetadata;
|
@@ -469,6 +516,7 @@ declare namespace schemas {
|
|
469
516
|
schemas_WorkspaceInvite as WorkspaceInvite,
|
470
517
|
schemas_WorkspaceMembers as WorkspaceMembers,
|
471
518
|
schemas_InviteKey as InviteKey,
|
519
|
+
schemas_DatabaseMetadata as DatabaseMetadata,
|
472
520
|
schemas_ListDatabasesResponse as ListDatabasesResponse,
|
473
521
|
schemas_ListBranchesResponse as ListBranchesResponse,
|
474
522
|
schemas_ListGitBranchesResponse as ListGitBranchesResponse,
|
@@ -496,6 +544,10 @@ declare namespace schemas {
|
|
496
544
|
schemas_PrefixExpression as PrefixExpression,
|
497
545
|
schemas_FilterExpression as FilterExpression,
|
498
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,
|
499
551
|
schemas_FilterList as FilterList,
|
500
552
|
schemas_FilterColumn as FilterColumn,
|
501
553
|
schemas_FilterColumnIncludes as FilterColumnIncludes,
|
@@ -505,7 +557,8 @@ declare namespace schemas {
|
|
505
557
|
schemas_FilterRangeValue as FilterRangeValue,
|
506
558
|
schemas_FilterValue as FilterValue,
|
507
559
|
schemas_PageConfig as PageConfig,
|
508
|
-
|
560
|
+
schemas_ColumnsProjection as ColumnsProjection,
|
561
|
+
schemas_RecordMeta as RecordMeta,
|
509
562
|
schemas_RecordID as RecordID,
|
510
563
|
schemas_TableRename as TableRename,
|
511
564
|
schemas_RecordsMetadata as RecordsMetadata,
|
@@ -540,11 +593,17 @@ declare type BulkError = {
|
|
540
593
|
status?: number;
|
541
594
|
}[];
|
542
595
|
};
|
596
|
+
declare type BulkInsertResponse = {
|
597
|
+
recordIDs: string[];
|
598
|
+
} | {
|
599
|
+
records: XataRecord$1[];
|
600
|
+
};
|
543
601
|
declare type BranchMigrationPlan = {
|
544
602
|
version: number;
|
545
603
|
migration: BranchMigration;
|
546
604
|
};
|
547
|
-
declare type
|
605
|
+
declare type RecordResponse = XataRecord$1;
|
606
|
+
declare type RecordUpdateResponse = XataRecord$1 | {
|
548
607
|
id: string;
|
549
608
|
xata: {
|
550
609
|
version: number;
|
@@ -568,7 +627,9 @@ type responses_SimpleError = SimpleError;
|
|
568
627
|
type responses_BadRequestError = BadRequestError;
|
569
628
|
type responses_AuthError = AuthError;
|
570
629
|
type responses_BulkError = BulkError;
|
630
|
+
type responses_BulkInsertResponse = BulkInsertResponse;
|
571
631
|
type responses_BranchMigrationPlan = BranchMigrationPlan;
|
632
|
+
type responses_RecordResponse = RecordResponse;
|
572
633
|
type responses_RecordUpdateResponse = RecordUpdateResponse;
|
573
634
|
type responses_QueryResponse = QueryResponse;
|
574
635
|
type responses_SearchResponse = SearchResponse;
|
@@ -579,7 +640,9 @@ declare namespace responses {
|
|
579
640
|
responses_BadRequestError as BadRequestError,
|
580
641
|
responses_AuthError as AuthError,
|
581
642
|
responses_BulkError as BulkError,
|
643
|
+
responses_BulkInsertResponse as BulkInsertResponse,
|
582
644
|
responses_BranchMigrationPlan as BranchMigrationPlan,
|
645
|
+
responses_RecordResponse as RecordResponse,
|
583
646
|
responses_RecordUpdateResponse as RecordUpdateResponse,
|
584
647
|
responses_QueryResponse as QueryResponse,
|
585
648
|
responses_SearchResponse as SearchResponse,
|
@@ -892,7 +955,6 @@ declare type InviteWorkspaceMemberError = ErrorWrapper<{
|
|
892
955
|
declare type InviteWorkspaceMemberRequestBody = {
|
893
956
|
email: string;
|
894
957
|
role: Role;
|
895
|
-
overwrite_old?: boolean;
|
896
958
|
};
|
897
959
|
declare type InviteWorkspaceMemberVariables = {
|
898
960
|
body: InviteWorkspaceMemberRequestBody;
|
@@ -902,6 +964,34 @@ declare type InviteWorkspaceMemberVariables = {
|
|
902
964
|
* Invite some user to join the workspace with the given role
|
903
965
|
*/
|
904
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>;
|
905
995
|
declare type CancelWorkspaceMemberInvitePathParams = {
|
906
996
|
workspaceId: WorkspaceID;
|
907
997
|
inviteId: InviteID;
|
@@ -1055,6 +1145,27 @@ declare type DeleteDatabaseVariables = {
|
|
1055
1145
|
* Delete a database and all of its branches and tables permanently.
|
1056
1146
|
*/
|
1057
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>;
|
1058
1169
|
declare type GetGitBranchesMappingPathParams = {
|
1059
1170
|
dbName: DBName;
|
1060
1171
|
workspace: string;
|
@@ -1247,6 +1358,10 @@ declare type CreateBranchError = ErrorWrapper<{
|
|
1247
1358
|
status: 404;
|
1248
1359
|
payload: SimpleError;
|
1249
1360
|
}>;
|
1361
|
+
declare type CreateBranchResponse = {
|
1362
|
+
databaseName: string;
|
1363
|
+
branchName: string;
|
1364
|
+
};
|
1250
1365
|
declare type CreateBranchRequestBody = {
|
1251
1366
|
from?: string;
|
1252
1367
|
metadata?: BranchMetadata;
|
@@ -1256,7 +1371,7 @@ declare type CreateBranchVariables = {
|
|
1256
1371
|
pathParams: CreateBranchPathParams;
|
1257
1372
|
queryParams?: CreateBranchQueryParams;
|
1258
1373
|
} & FetcherExtraProps;
|
1259
|
-
declare const createBranch: (variables: CreateBranchVariables) => Promise<
|
1374
|
+
declare const createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
|
1260
1375
|
declare type DeleteBranchPathParams = {
|
1261
1376
|
dbBranchName: DBBranchName;
|
1262
1377
|
workspace: string;
|
@@ -1443,13 +1558,17 @@ declare type CreateTableError = ErrorWrapper<{
|
|
1443
1558
|
status: 422;
|
1444
1559
|
payload: SimpleError;
|
1445
1560
|
}>;
|
1561
|
+
declare type CreateTableResponse = {
|
1562
|
+
branchName: string;
|
1563
|
+
tableName: string;
|
1564
|
+
};
|
1446
1565
|
declare type CreateTableVariables = {
|
1447
1566
|
pathParams: CreateTablePathParams;
|
1448
1567
|
} & FetcherExtraProps;
|
1449
1568
|
/**
|
1450
1569
|
* Creates a new table with the given name. Returns 422 if a table with the same name already exists.
|
1451
1570
|
*/
|
1452
|
-
declare const createTable: (variables: CreateTableVariables) => Promise<
|
1571
|
+
declare const createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
|
1453
1572
|
declare type DeleteTablePathParams = {
|
1454
1573
|
dbBranchName: DBBranchName;
|
1455
1574
|
tableName: TableName;
|
@@ -1682,6 +1801,9 @@ declare type InsertRecordPathParams = {
|
|
1682
1801
|
tableName: TableName;
|
1683
1802
|
workspace: string;
|
1684
1803
|
};
|
1804
|
+
declare type InsertRecordQueryParams = {
|
1805
|
+
columns?: ColumnsProjection;
|
1806
|
+
};
|
1685
1807
|
declare type InsertRecordError = ErrorWrapper<{
|
1686
1808
|
status: 400;
|
1687
1809
|
payload: BadRequestError;
|
@@ -1692,20 +1814,15 @@ declare type InsertRecordError = ErrorWrapper<{
|
|
1692
1814
|
status: 404;
|
1693
1815
|
payload: SimpleError;
|
1694
1816
|
}>;
|
1695
|
-
declare type InsertRecordResponse = {
|
1696
|
-
id: string;
|
1697
|
-
xata: {
|
1698
|
-
version: number;
|
1699
|
-
};
|
1700
|
-
};
|
1701
1817
|
declare type InsertRecordVariables = {
|
1702
1818
|
body?: Record<string, any>;
|
1703
1819
|
pathParams: InsertRecordPathParams;
|
1820
|
+
queryParams?: InsertRecordQueryParams;
|
1704
1821
|
} & FetcherExtraProps;
|
1705
1822
|
/**
|
1706
1823
|
* Insert a new Record into the Table
|
1707
1824
|
*/
|
1708
|
-
declare const insertRecord: (variables: InsertRecordVariables) => Promise<
|
1825
|
+
declare const insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
|
1709
1826
|
declare type InsertRecordWithIDPathParams = {
|
1710
1827
|
dbBranchName: DBBranchName;
|
1711
1828
|
tableName: TableName;
|
@@ -1713,6 +1830,7 @@ declare type InsertRecordWithIDPathParams = {
|
|
1713
1830
|
workspace: string;
|
1714
1831
|
};
|
1715
1832
|
declare type InsertRecordWithIDQueryParams = {
|
1833
|
+
columns?: ColumnsProjection;
|
1716
1834
|
createOnly?: boolean;
|
1717
1835
|
ifVersion?: number;
|
1718
1836
|
};
|
@@ -1745,6 +1863,7 @@ declare type UpdateRecordWithIDPathParams = {
|
|
1745
1863
|
workspace: string;
|
1746
1864
|
};
|
1747
1865
|
declare type UpdateRecordWithIDQueryParams = {
|
1866
|
+
columns?: ColumnsProjection;
|
1748
1867
|
ifVersion?: number;
|
1749
1868
|
};
|
1750
1869
|
declare type UpdateRecordWithIDError = ErrorWrapper<{
|
@@ -1773,6 +1892,7 @@ declare type UpsertRecordWithIDPathParams = {
|
|
1773
1892
|
workspace: string;
|
1774
1893
|
};
|
1775
1894
|
declare type UpsertRecordWithIDQueryParams = {
|
1895
|
+
columns?: ColumnsProjection;
|
1776
1896
|
ifVersion?: number;
|
1777
1897
|
};
|
1778
1898
|
declare type UpsertRecordWithIDError = ErrorWrapper<{
|
@@ -1800,6 +1920,9 @@ declare type DeleteRecordPathParams = {
|
|
1800
1920
|
recordId: RecordID;
|
1801
1921
|
workspace: string;
|
1802
1922
|
};
|
1923
|
+
declare type DeleteRecordQueryParams = {
|
1924
|
+
columns?: ColumnsProjection;
|
1925
|
+
};
|
1803
1926
|
declare type DeleteRecordError = ErrorWrapper<{
|
1804
1927
|
status: 400;
|
1805
1928
|
payload: BadRequestError;
|
@@ -1812,14 +1935,18 @@ declare type DeleteRecordError = ErrorWrapper<{
|
|
1812
1935
|
}>;
|
1813
1936
|
declare type DeleteRecordVariables = {
|
1814
1937
|
pathParams: DeleteRecordPathParams;
|
1938
|
+
queryParams?: DeleteRecordQueryParams;
|
1815
1939
|
} & FetcherExtraProps;
|
1816
|
-
declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<
|
1940
|
+
declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
|
1817
1941
|
declare type GetRecordPathParams = {
|
1818
1942
|
dbBranchName: DBBranchName;
|
1819
1943
|
tableName: TableName;
|
1820
1944
|
recordId: RecordID;
|
1821
1945
|
workspace: string;
|
1822
1946
|
};
|
1947
|
+
declare type GetRecordQueryParams = {
|
1948
|
+
columns?: ColumnsProjection;
|
1949
|
+
};
|
1823
1950
|
declare type GetRecordError = ErrorWrapper<{
|
1824
1951
|
status: 400;
|
1825
1952
|
payload: BadRequestError;
|
@@ -1830,12 +1957,9 @@ declare type GetRecordError = ErrorWrapper<{
|
|
1830
1957
|
status: 404;
|
1831
1958
|
payload: SimpleError;
|
1832
1959
|
}>;
|
1833
|
-
declare type GetRecordRequestBody = {
|
1834
|
-
columns?: ColumnsFilter;
|
1835
|
-
};
|
1836
1960
|
declare type GetRecordVariables = {
|
1837
|
-
body?: GetRecordRequestBody;
|
1838
1961
|
pathParams: GetRecordPathParams;
|
1962
|
+
queryParams?: GetRecordQueryParams;
|
1839
1963
|
} & FetcherExtraProps;
|
1840
1964
|
/**
|
1841
1965
|
* Retrieve record by ID
|
@@ -1846,6 +1970,9 @@ declare type BulkInsertTableRecordsPathParams = {
|
|
1846
1970
|
tableName: TableName;
|
1847
1971
|
workspace: string;
|
1848
1972
|
};
|
1973
|
+
declare type BulkInsertTableRecordsQueryParams = {
|
1974
|
+
columns?: ColumnsProjection;
|
1975
|
+
};
|
1849
1976
|
declare type BulkInsertTableRecordsError = ErrorWrapper<{
|
1850
1977
|
status: 400;
|
1851
1978
|
payload: BulkError;
|
@@ -1859,20 +1986,18 @@ declare type BulkInsertTableRecordsError = ErrorWrapper<{
|
|
1859
1986
|
status: 422;
|
1860
1987
|
payload: SimpleError;
|
1861
1988
|
}>;
|
1862
|
-
declare type BulkInsertTableRecordsResponse = {
|
1863
|
-
recordIDs: string[];
|
1864
|
-
};
|
1865
1989
|
declare type BulkInsertTableRecordsRequestBody = {
|
1866
1990
|
records: Record<string, any>[];
|
1867
1991
|
};
|
1868
1992
|
declare type BulkInsertTableRecordsVariables = {
|
1869
1993
|
body: BulkInsertTableRecordsRequestBody;
|
1870
1994
|
pathParams: BulkInsertTableRecordsPathParams;
|
1995
|
+
queryParams?: BulkInsertTableRecordsQueryParams;
|
1871
1996
|
} & FetcherExtraProps;
|
1872
1997
|
/**
|
1873
1998
|
* Bulk insert records
|
1874
1999
|
*/
|
1875
|
-
declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<
|
2000
|
+
declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
|
1876
2001
|
declare type QueryTablePathParams = {
|
1877
2002
|
dbBranchName: DBBranchName;
|
1878
2003
|
tableName: TableName;
|
@@ -1892,7 +2017,7 @@ declare type QueryTableRequestBody = {
|
|
1892
2017
|
filter?: FilterExpression;
|
1893
2018
|
sort?: SortExpression;
|
1894
2019
|
page?: PageConfig;
|
1895
|
-
columns?:
|
2020
|
+
columns?: ColumnsProjection;
|
1896
2021
|
};
|
1897
2022
|
declare type QueryTableVariables = {
|
1898
2023
|
body?: QueryTableRequestBody;
|
@@ -2641,6 +2766,7 @@ declare type SearchTableRequestBody = {
|
|
2641
2766
|
prefix?: PrefixExpression;
|
2642
2767
|
filter?: FilterExpression;
|
2643
2768
|
highlight?: HighlightExpression;
|
2769
|
+
boosters?: BoosterExpression[];
|
2644
2770
|
};
|
2645
2771
|
declare type SearchTableVariables = {
|
2646
2772
|
body: SearchTableRequestBody;
|
@@ -2672,6 +2798,7 @@ declare type SearchBranchRequestBody = {
|
|
2672
2798
|
tables?: (string | {
|
2673
2799
|
table: string;
|
2674
2800
|
filter?: FilterExpression;
|
2801
|
+
boosters?: BoosterExpression[];
|
2675
2802
|
})[];
|
2676
2803
|
query: string;
|
2677
2804
|
fuzziness?: FuzzinessExpression;
|
@@ -2704,6 +2831,7 @@ declare const operationsByTag: {
|
|
2704
2831
|
updateWorkspaceMemberRole: (variables: UpdateWorkspaceMemberRoleVariables) => Promise<undefined>;
|
2705
2832
|
removeWorkspaceMember: (variables: RemoveWorkspaceMemberVariables) => Promise<undefined>;
|
2706
2833
|
inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<WorkspaceInvite>;
|
2834
|
+
updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
|
2707
2835
|
cancelWorkspaceMemberInvite: (variables: CancelWorkspaceMemberInviteVariables) => Promise<undefined>;
|
2708
2836
|
resendWorkspaceMemberInvite: (variables: ResendWorkspaceMemberInviteVariables) => Promise<undefined>;
|
2709
2837
|
acceptWorkspaceMemberInvite: (variables: AcceptWorkspaceMemberInviteVariables) => Promise<undefined>;
|
@@ -2712,6 +2840,7 @@ declare const operationsByTag: {
|
|
2712
2840
|
getDatabaseList: (variables: GetDatabaseListVariables) => Promise<ListDatabasesResponse>;
|
2713
2841
|
createDatabase: (variables: CreateDatabaseVariables) => Promise<CreateDatabaseResponse>;
|
2714
2842
|
deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
|
2843
|
+
getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
|
2715
2844
|
getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
|
2716
2845
|
addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
|
2717
2846
|
removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
|
@@ -2720,7 +2849,7 @@ declare const operationsByTag: {
|
|
2720
2849
|
branch: {
|
2721
2850
|
getBranchList: (variables: GetBranchListVariables) => Promise<ListBranchesResponse>;
|
2722
2851
|
getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
|
2723
|
-
createBranch: (variables: CreateBranchVariables) => Promise<
|
2852
|
+
createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
|
2724
2853
|
deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
|
2725
2854
|
updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
|
2726
2855
|
getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
|
@@ -2730,7 +2859,7 @@ declare const operationsByTag: {
|
|
2730
2859
|
getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
|
2731
2860
|
};
|
2732
2861
|
table: {
|
2733
|
-
createTable: (variables: CreateTableVariables) => Promise<
|
2862
|
+
createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
|
2734
2863
|
deleteTable: (variables: DeleteTableVariables) => Promise<undefined>;
|
2735
2864
|
updateTable: (variables: UpdateTableVariables) => Promise<undefined>;
|
2736
2865
|
getTableSchema: (variables: GetTableSchemaVariables) => Promise<GetTableSchemaResponse>;
|
@@ -2742,13 +2871,13 @@ declare const operationsByTag: {
|
|
2742
2871
|
updateColumn: (variables: UpdateColumnVariables) => Promise<MigrationIdResponse>;
|
2743
2872
|
};
|
2744
2873
|
records: {
|
2745
|
-
insertRecord: (variables: InsertRecordVariables) => Promise<
|
2874
|
+
insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
|
2746
2875
|
insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
|
2747
2876
|
updateRecordWithID: (variables: UpdateRecordWithIDVariables) => Promise<RecordUpdateResponse>;
|
2748
2877
|
upsertRecordWithID: (variables: UpsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
|
2749
|
-
deleteRecord: (variables: DeleteRecordVariables) => Promise<
|
2878
|
+
deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
|
2750
2879
|
getRecord: (variables: GetRecordVariables) => Promise<XataRecord$1>;
|
2751
|
-
bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<
|
2880
|
+
bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
|
2752
2881
|
queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
|
2753
2882
|
searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
|
2754
2883
|
searchBranch: (variables: SearchBranchVariables) => Promise<SearchResponse>;
|
@@ -2802,6 +2931,7 @@ declare class WorkspaceApi {
|
|
2802
2931
|
updateWorkspaceMemberRole(workspaceId: WorkspaceID, userId: UserID, role: Role): Promise<void>;
|
2803
2932
|
removeWorkspaceMember(workspaceId: WorkspaceID, userId: UserID): Promise<void>;
|
2804
2933
|
inviteWorkspaceMember(workspaceId: WorkspaceID, email: string, role: Role): Promise<WorkspaceInvite>;
|
2934
|
+
updateWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID, role: Role): Promise<WorkspaceInvite>;
|
2805
2935
|
cancelWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
|
2806
2936
|
resendWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteId: InviteID): Promise<void>;
|
2807
2937
|
acceptWorkspaceMemberInvite(workspaceId: WorkspaceID, inviteKey: InviteKey): Promise<void>;
|
@@ -2812,6 +2942,7 @@ declare class DatabaseApi {
|
|
2812
2942
|
getDatabaseList(workspace: WorkspaceID): Promise<ListDatabasesResponse>;
|
2813
2943
|
createDatabase(workspace: WorkspaceID, dbName: DBName, options?: CreateDatabaseRequestBody): Promise<CreateDatabaseResponse>;
|
2814
2944
|
deleteDatabase(workspace: WorkspaceID, dbName: DBName): Promise<void>;
|
2945
|
+
getDatabaseMetadata(workspace: WorkspaceID, dbName: DBName): Promise<DatabaseMetadata>;
|
2815
2946
|
getGitBranchesMapping(workspace: WorkspaceID, dbName: DBName): Promise<ListGitBranchesResponse>;
|
2816
2947
|
addGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, body: AddGitBranchesEntryRequestBody): Promise<AddGitBranchesEntryResponse>;
|
2817
2948
|
removeGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<void>;
|
@@ -2822,7 +2953,7 @@ declare class BranchApi {
|
|
2822
2953
|
constructor(extraProps: FetcherExtraProps);
|
2823
2954
|
getBranchList(workspace: WorkspaceID, dbName: DBName): Promise<ListBranchesResponse>;
|
2824
2955
|
getBranchDetails(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<DBBranch>;
|
2825
|
-
createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<
|
2956
|
+
createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<CreateBranchResponse>;
|
2826
2957
|
deleteBranch(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<void>;
|
2827
2958
|
updateBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName, metadata?: BranchMetadata): Promise<void>;
|
2828
2959
|
getBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<BranchMetadata>;
|
@@ -2834,7 +2965,7 @@ declare class BranchApi {
|
|
2834
2965
|
declare class TableApi {
|
2835
2966
|
private extraProps;
|
2836
2967
|
constructor(extraProps: FetcherExtraProps);
|
2837
|
-
createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<
|
2968
|
+
createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<CreateTableResponse>;
|
2838
2969
|
deleteTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
|
2839
2970
|
updateTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, options: UpdateTableRequestBody): Promise<void>;
|
2840
2971
|
getTableSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<GetTableSchemaResponse>;
|
@@ -2848,13 +2979,13 @@ declare class TableApi {
|
|
2848
2979
|
declare class RecordsApi {
|
2849
2980
|
private extraProps;
|
2850
2981
|
constructor(extraProps: FetcherExtraProps);
|
2851
|
-
insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any
|
2982
|
+
insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>, options?: InsertRecordQueryParams): Promise<RecordUpdateResponse>;
|
2852
2983
|
insertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: InsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
|
2853
2984
|
updateRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpdateRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
|
2854
2985
|
upsertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
|
2855
|
-
deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID): Promise<
|
2856
|
-
getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?:
|
2857
|
-
bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[]): Promise<
|
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>;
|
2858
2989
|
queryTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: QueryTableRequestBody): Promise<QueryResponse>;
|
2859
2990
|
searchTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: SearchTableRequestBody): Promise<SearchResponse>;
|
2860
2991
|
searchBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, query: SearchBranchRequestBody): Promise<SearchResponse>;
|
@@ -2870,19 +3001,20 @@ declare type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) ex
|
|
2870
3001
|
declare type If<Condition, Then, Else> = Condition extends true ? Then : Else;
|
2871
3002
|
declare type IsObject<T> = T extends Record<string, any> ? true : false;
|
2872
3003
|
declare type IsArray<T> = T extends Array<any> ? true : false;
|
2873
|
-
declare type NonEmptyArray<T> = T[] & {
|
2874
|
-
0: T;
|
2875
|
-
};
|
2876
3004
|
declare type RequiredBy<T, K extends keyof T> = T & {
|
2877
3005
|
[P in K]-?: NonNullable<T[P]>;
|
2878
3006
|
};
|
2879
3007
|
declare type GetArrayInnerType<T extends readonly any[]> = T[number];
|
2880
3008
|
declare type SingleOrArray<T> = T | T[];
|
2881
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;
|
2882
3014
|
|
2883
3015
|
declare type SelectableColumn<O, RecursivePath extends any[] = []> = '*' | 'id' | DataProps<O> | NestedColumns<O, RecursivePath>;
|
2884
|
-
declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord & UnionToIntersection<Values<{
|
2885
|
-
[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>;
|
2886
3018
|
}>>;
|
2887
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> ? {
|
2888
3020
|
V: ValueAtColumn<Item, V>;
|
@@ -2918,22 +3050,37 @@ interface BaseData {
|
|
2918
3050
|
/**
|
2919
3051
|
* Represents a persisted record from the database.
|
2920
3052
|
*/
|
2921
|
-
interface XataRecord<
|
3053
|
+
interface XataRecord<OriginalRecord extends XataRecord<any> = XataRecord<any>> extends Identifiable {
|
2922
3054
|
/**
|
2923
3055
|
* Get metadata of this record.
|
2924
3056
|
*/
|
2925
|
-
getMetadata(): XataRecordMetadata
|
3057
|
+
getMetadata(): XataRecordMetadata;
|
2926
3058
|
/**
|
2927
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.
|
2928
3062
|
*/
|
2929
|
-
read(): Promise<Readonly<SelectedPick<
|
3063
|
+
read<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
|
3064
|
+
/**
|
3065
|
+
* Retrieves a refreshed copy of the current record from the database.
|
3066
|
+
* @returns The persisted record with all first level properties.
|
3067
|
+
*/
|
3068
|
+
read(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
|
2930
3069
|
/**
|
2931
3070
|
* Performs a partial update of the current record. On success a new object is
|
2932
3071
|
* returned and the current object is not mutated.
|
2933
3072
|
* @param partialUpdate The columns and their values that have to be updated.
|
2934
|
-
* @
|
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.
|
2935
3082
|
*/
|
2936
|
-
update(partialUpdate: Partial<EditableData<Omit<
|
3083
|
+
update(partialUpdate: Partial<EditableData<Omit<OriginalRecord, keyof XataRecord>>>): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>>>;
|
2937
3084
|
/**
|
2938
3085
|
* Performs a deletion of the current record in the database.
|
2939
3086
|
*
|
@@ -2945,14 +3092,20 @@ declare type Link<Record extends XataRecord> = Omit<XataRecord, 'read' | 'update
|
|
2945
3092
|
/**
|
2946
3093
|
* Retrieves a refreshed copy of the current record from the database.
|
2947
3094
|
*/
|
2948
|
-
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>;
|
2949
3096
|
/**
|
2950
3097
|
* Performs a partial update of the current record. On success a new object is
|
2951
3098
|
* returned and the current object is not mutated.
|
2952
3099
|
* @param partialUpdate The columns and their values that have to be updated.
|
2953
3100
|
* @returns A new record containing the latest values for all the columns of the current record.
|
2954
3101
|
*/
|
2955
|
-
update(partialUpdate: Partial<EditableData<Omit<Record, keyof XataRecord
|
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>;
|
2956
3109
|
};
|
2957
3110
|
declare type XataRecordMetadata = {
|
2958
3111
|
/**
|
@@ -3065,6 +3218,84 @@ declare type NestedApiFilter<T> = {
|
|
3065
3218
|
};
|
3066
3219
|
declare type Filter<T> = T extends Record<string, any> ? BaseApiFilter<T> | NestedApiFilter<T> : PropertyFilter<T>;
|
3067
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;
|
3298
|
+
|
3068
3299
|
declare type SortDirection = 'asc' | 'desc';
|
3069
3300
|
declare type SortFilterExtended<T extends XataRecord> = {
|
3070
3301
|
column: SelectableColumn<T>;
|
@@ -3076,7 +3307,7 @@ declare type SortFilterBase<T extends XataRecord> = {
|
|
3076
3307
|
};
|
3077
3308
|
|
3078
3309
|
declare type BaseOptions<T extends XataRecord> = {
|
3079
|
-
columns?:
|
3310
|
+
columns?: SelectableColumn<T>[];
|
3080
3311
|
cache?: number;
|
3081
3312
|
};
|
3082
3313
|
declare type CursorQueryOptions = {
|
@@ -3166,7 +3397,7 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
|
|
3166
3397
|
* @param columns Array of column names to be returned by the query.
|
3167
3398
|
* @returns A new Query object.
|
3168
3399
|
*/
|
3169
|
-
select<K extends SelectableColumn<Record>>(columns:
|
3400
|
+
select<K extends SelectableColumn<Record>>(columns: K[]): Query<Record, SelectedPick<Record, K[]>>;
|
3170
3401
|
/**
|
3171
3402
|
* Get paginated results
|
3172
3403
|
*
|
@@ -3433,7 +3664,16 @@ declare class RecordArray<Result extends XataRecord> extends Array<Result> {
|
|
3433
3664
|
* Common interface for performing operations on a table.
|
3434
3665
|
*/
|
3435
3666
|
declare abstract class Repository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, 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>>>;
|
3436
3668
|
abstract create(object: Omit<EditableData<Data>, 'id'> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
|
3669
|
+
/**
|
3670
|
+
* Creates a single record in the table with a unique id.
|
3671
|
+
* @param id The unique id.
|
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.
|
3674
|
+
* @returns The full persisted record.
|
3675
|
+
*/
|
3676
|
+
abstract create<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Data>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
|
3437
3677
|
/**
|
3438
3678
|
* Creates a single record in the table with a unique id.
|
3439
3679
|
* @param id The unique id.
|
@@ -3444,9 +3684,23 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
|
|
3444
3684
|
/**
|
3445
3685
|
* Creates multiple records in the table.
|
3446
3686
|
* @param objects Array of objects with the column names and the values to be stored in the table.
|
3447
|
-
* @
|
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.
|
3689
|
+
*/
|
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.
|
3448
3695
|
*/
|
3449
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>>;
|
3450
3704
|
/**
|
3451
3705
|
* Queries a single record from the table given its unique id.
|
3452
3706
|
* @param id The unique id.
|
@@ -3456,9 +3710,23 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
|
|
3456
3710
|
/**
|
3457
3711
|
* Queries multiple records from the table given their unique id.
|
3458
3712
|
* @param ids The unique ids array.
|
3459
|
-
* @
|
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).
|
3460
3721
|
*/
|
3461
|
-
abstract read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']
|
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>>;
|
3462
3730
|
/**
|
3463
3731
|
* Queries a single record from the table by the id in the object.
|
3464
3732
|
* @param object Object containing the id of the record.
|
@@ -3468,15 +3736,37 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
|
|
3468
3736
|
/**
|
3469
3737
|
* Queries multiple records from the table by the ids in the objects.
|
3470
3738
|
* @param objects Array of objects containing the ids of the records.
|
3471
|
-
* @
|
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).
|
3472
3741
|
*/
|
3473
|
-
abstract read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record,
|
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>>>;
|
3474
3756
|
/**
|
3475
3757
|
* Partially update a single record.
|
3476
3758
|
* @param object An object with its id and the columns to be updated.
|
3477
3759
|
* @returns The full persisted record.
|
3478
3760
|
*/
|
3479
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>>>;
|
3480
3770
|
/**
|
3481
3771
|
* Partially update a single record given its unique id.
|
3482
3772
|
* @param id The unique id.
|
@@ -3487,9 +3777,24 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
|
|
3487
3777
|
/**
|
3488
3778
|
* Partially updates multiple records.
|
3489
3779
|
* @param objects An array of objects with their ids and columns to be updated.
|
3490
|
-
* @
|
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.
|
3491
3788
|
*/
|
3492
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>>>;
|
3493
3798
|
/**
|
3494
3799
|
* Creates or updates a single record. If a record exists with the given id,
|
3495
3800
|
* it will be update, otherwise a new record will be created.
|
@@ -3497,6 +3802,15 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
|
|
3497
3802
|
* @returns The full persisted record.
|
3498
3803
|
*/
|
3499
3804
|
abstract createOrUpdate(object: EditableData<Data> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
|
3805
|
+
/**
|
3806
|
+
* Creates or updates a single record. If a record exists with the given id,
|
3807
|
+
* it will be update, otherwise a new record will be created.
|
3808
|
+
* @param id A unique id.
|
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.
|
3811
|
+
* @returns The full persisted record.
|
3812
|
+
*/
|
3813
|
+
abstract createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Data>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
|
3500
3814
|
/**
|
3501
3815
|
* Creates or updates a single record. If a record exists with the given id,
|
3502
3816
|
* it will be update, otherwise a new record will be created.
|
@@ -3505,6 +3819,14 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
|
|
3505
3819
|
* @returns The full persisted record.
|
3506
3820
|
*/
|
3507
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>>[]>;
|
3508
3830
|
/**
|
3509
3831
|
* Creates or updates a single record. If a record exists with the given id,
|
3510
3832
|
* it will be update, otherwise a new record will be created.
|
@@ -3544,14 +3866,15 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
|
|
3544
3866
|
*/
|
3545
3867
|
abstract search(query: string, options?: {
|
3546
3868
|
fuzziness?: FuzzinessExpression;
|
3869
|
+
prefix?: PrefixExpression;
|
3547
3870
|
highlight?: HighlightExpression;
|
3548
3871
|
filter?: Filter<Record>;
|
3549
|
-
|
3872
|
+
boosters?: Boosters<Record>[];
|
3873
|
+
}): Promise<SearchXataRecord<SelectedPick<Record, ['*']>>[]>;
|
3550
3874
|
abstract query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
|
3551
3875
|
}
|
3552
3876
|
declare class RestRepository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Data, Record> {
|
3553
3877
|
#private;
|
3554
|
-
db: SchemaPluginResult<any>;
|
3555
3878
|
constructor(options: {
|
3556
3879
|
table: string;
|
3557
3880
|
db: SchemaPluginResult<any>;
|
@@ -3561,22 +3884,37 @@ declare class RestRepository<Data extends BaseData, Record extends XataRecord =
|
|
3561
3884
|
create(object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
|
3562
3885
|
create(recordId: string, object: EditableData<Data>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
|
3563
3886
|
create(objects: EditableData<Data>[]): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
|
3564
|
-
|
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>;
|
3565
3891
|
read(recordIds: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>>>>;
|
3566
|
-
read(object: Identifiable): Promise<SelectedPick<Record, ['*']
|
3892
|
+
read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
|
3567
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>>>>;
|
3568
3898
|
update(object: Partial<EditableData<Data>> & Identifiable): Promise<SelectedPick<Record, ['*']>>;
|
3569
3899
|
update(recordId: string, object: Partial<EditableData<Data>>): Promise<SelectedPick<Record, ['*']>>;
|
3570
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>[]>;
|
3571
3904
|
createOrUpdate(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
|
3572
3905
|
createOrUpdate(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
|
3573
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>[]>;
|
3574
3910
|
delete(a: string | Identifiable | Array<string | Identifiable>): Promise<void>;
|
3575
3911
|
search(query: string, options?: {
|
3576
3912
|
fuzziness?: FuzzinessExpression;
|
3913
|
+
prefix?: PrefixExpression;
|
3577
3914
|
highlight?: HighlightExpression;
|
3578
3915
|
filter?: Filter<Record>;
|
3579
|
-
|
3916
|
+
boosters?: Boosters<Record>[];
|
3917
|
+
}): Promise<any>;
|
3580
3918
|
query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
|
3581
3919
|
}
|
3582
3920
|
|
@@ -3720,47 +4058,6 @@ declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends Xat
|
|
3720
4058
|
build(pluginOptions: XataPluginOptions): SchemaPluginResult<Schemas>;
|
3721
4059
|
}
|
3722
4060
|
|
3723
|
-
declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
|
3724
|
-
fuzziness?: FuzzinessExpression;
|
3725
|
-
highlight?: HighlightExpression;
|
3726
|
-
tables?: Array<Tables | Values<{
|
3727
|
-
[Model in GetArrayInnerType<NonNullable<Tables[]>>]: {
|
3728
|
-
table: Model;
|
3729
|
-
filter?: Filter<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>>;
|
3730
|
-
};
|
3731
|
-
}>>;
|
3732
|
-
};
|
3733
|
-
declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
|
3734
|
-
all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
|
3735
|
-
[Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]: {
|
3736
|
-
table: Model;
|
3737
|
-
record: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>>;
|
3738
|
-
};
|
3739
|
-
}>[]>;
|
3740
|
-
byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
|
3741
|
-
[Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]?: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>[]>;
|
3742
|
-
}>;
|
3743
|
-
};
|
3744
|
-
declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
|
3745
|
-
#private;
|
3746
|
-
private db;
|
3747
|
-
constructor(db: SchemaPluginResult<Schemas>, schemaTables?: Schemas.Table[]);
|
3748
|
-
build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
|
3749
|
-
}
|
3750
|
-
declare type SearchXataRecord = XataRecord<SearchExtraProperties>;
|
3751
|
-
declare type SearchExtraProperties = {
|
3752
|
-
table: string;
|
3753
|
-
highlight?: {
|
3754
|
-
[key: string]: string[] | {
|
3755
|
-
[key: string]: any;
|
3756
|
-
};
|
3757
|
-
};
|
3758
|
-
};
|
3759
|
-
declare type ReturnTable<Table, Tables> = Table extends Tables ? Table : never;
|
3760
|
-
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 {
|
3761
|
-
table: infer Table;
|
3762
|
-
} ? ReturnTable<Table, Tables> : never;
|
3763
|
-
|
3764
4061
|
declare type BranchStrategyValue = string | undefined | null;
|
3765
4062
|
declare type BranchStrategyBuilder = () => BranchStrategyValue | Promise<BranchStrategyValue>;
|
3766
4063
|
declare type BranchStrategy = BranchStrategyValue | BranchStrategyBuilder;
|
@@ -3780,12 +4077,26 @@ interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
|
|
3780
4077
|
search: Awaited<ReturnType<SearchPlugin<SchemaInference<NonNullable<typeof schemaTables>>>['build']>>;
|
3781
4078
|
}, keyof Plugins> & {
|
3782
4079
|
[Key in StringKeys<NonNullable<Plugins>>]: Awaited<ReturnType<NonNullable<Plugins>[Key]['build']>>;
|
4080
|
+
} & {
|
4081
|
+
getConfig(): Promise<{
|
4082
|
+
databaseURL: string;
|
4083
|
+
branch: string;
|
4084
|
+
}>;
|
3783
4085
|
};
|
3784
4086
|
}
|
3785
4087
|
declare const BaseClient_base: ClientConstructor<{}>;
|
3786
4088
|
declare class BaseClient extends BaseClient_base<[]> {
|
3787
4089
|
}
|
3788
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
|
+
|
3789
4100
|
declare type BranchResolutionOptions = {
|
3790
4101
|
databaseURL?: string;
|
3791
4102
|
apiKey?: string;
|
@@ -3797,9 +4108,89 @@ declare function getDatabaseURL(): string | undefined;
|
|
3797
4108
|
|
3798
4109
|
declare function getAPIKey(): string | undefined;
|
3799
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
|
+
|
3800
4191
|
declare class XataError extends Error {
|
3801
4192
|
readonly status: number;
|
3802
4193
|
constructor(message: string, status: number);
|
3803
4194
|
}
|
3804
4195
|
|
3805
|
-
export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, AddGitBranchesEntryError, AddGitBranchesEntryPathParams, AddGitBranchesEntryRequestBody, AddGitBranchesEntryResponse, AddGitBranchesEntryVariables, AddTableColumnError, AddTableColumnPathParams, AddTableColumnVariables, BaseClient, BaseClientOptions, BaseData, BaseSchema, BulkInsertTableRecordsError, BulkInsertTableRecordsPathParams,
|
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 };
|