@xata.io/client 0.0.0-alpha.vf4789c2 → 0.0.0-alpha.vf5ce72f
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 +46 -0
- package/README.md +2 -0
- package/Usage.md +60 -6
- package/dist/index.cjs +510 -312
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +625 -187
- package/dist/index.mjs +499 -313
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
declare type AttributeDictionary = Record<string, string | number | boolean | undefined>;
|
2
|
+
declare type TraceFunction = <T>(name: string, fn: (options: {
|
3
|
+
setAttributes: (attrs: AttributeDictionary) => void;
|
4
|
+
onError: (message: string) => void;
|
5
|
+
}) => T, options?: AttributeDictionary) => Promise<T>;
|
6
|
+
|
1
7
|
declare type FetchImpl = (url: string, init?: {
|
2
8
|
body?: string;
|
3
9
|
headers?: Record<string, string>;
|
@@ -5,6 +11,7 @@ declare type FetchImpl = (url: string, init?: {
|
|
5
11
|
}) => Promise<{
|
6
12
|
ok: boolean;
|
7
13
|
status: number;
|
14
|
+
url: string;
|
8
15
|
json(): Promise<any>;
|
9
16
|
headers?: {
|
10
17
|
get(name: string): string | null;
|
@@ -16,6 +23,7 @@ declare type FetcherExtraProps = {
|
|
16
23
|
workspacesApiUrl: string | WorkspaceApiUrlBuilder;
|
17
24
|
fetchImpl: FetchImpl;
|
18
25
|
apiKey: string;
|
26
|
+
trace: TraceFunction;
|
19
27
|
};
|
20
28
|
declare type ErrorWrapper<TError> = TError | {
|
21
29
|
status: 'unknown';
|
@@ -23,7 +31,6 @@ declare type ErrorWrapper<TError> = TError | {
|
|
23
31
|
};
|
24
32
|
|
25
33
|
interface CacheImpl {
|
26
|
-
cacheRecords: boolean;
|
27
34
|
defaultQueryTTL: number;
|
28
35
|
getAll(): Promise<Record<string, unknown>>;
|
29
36
|
get: <T>(key: string) => Promise<T | null>;
|
@@ -33,13 +40,11 @@ interface CacheImpl {
|
|
33
40
|
}
|
34
41
|
interface SimpleCacheOptions {
|
35
42
|
max?: number;
|
36
|
-
cacheRecords?: boolean;
|
37
43
|
defaultQueryTTL?: number;
|
38
44
|
}
|
39
45
|
declare class SimpleCache implements CacheImpl {
|
40
46
|
#private;
|
41
47
|
capacity: number;
|
42
|
-
cacheRecords: boolean;
|
43
48
|
defaultQueryTTL: number;
|
44
49
|
constructor(options?: SimpleCacheOptions);
|
45
50
|
getAll(): Promise<Record<string, unknown>>;
|
@@ -55,6 +60,7 @@ declare abstract class XataPlugin {
|
|
55
60
|
declare type XataPluginOptions = {
|
56
61
|
getFetchProps: () => Promise<FetcherExtraProps>;
|
57
62
|
cache: CacheImpl;
|
63
|
+
trace?: TraceFunction;
|
58
64
|
};
|
59
65
|
|
60
66
|
/**
|
@@ -125,16 +131,20 @@ declare type WorkspaceMembers = {
|
|
125
131
|
* @pattern ^ik_[a-zA-Z0-9]+
|
126
132
|
*/
|
127
133
|
declare type InviteKey = string;
|
134
|
+
/**
|
135
|
+
* Metadata of databases
|
136
|
+
*/
|
137
|
+
declare type DatabaseMetadata = {
|
138
|
+
name: string;
|
139
|
+
displayName: string;
|
140
|
+
createdAt: DateTime;
|
141
|
+
numberOfBranches: number;
|
142
|
+
ui?: {
|
143
|
+
color?: string;
|
144
|
+
};
|
145
|
+
};
|
128
146
|
declare type ListDatabasesResponse = {
|
129
|
-
databases?:
|
130
|
-
name: string;
|
131
|
-
displayName: string;
|
132
|
-
createdAt: DateTime;
|
133
|
-
numberOfBranches: number;
|
134
|
-
ui?: {
|
135
|
-
color?: string;
|
136
|
-
};
|
137
|
-
}[];
|
147
|
+
databases?: DatabaseMetadata[];
|
138
148
|
};
|
139
149
|
declare type ListBranchesResponse = {
|
140
150
|
databaseName: string;
|
@@ -303,6 +313,44 @@ declare type HighlightExpression = {
|
|
303
313
|
enabled?: boolean;
|
304
314
|
encodeHTML?: boolean;
|
305
315
|
};
|
316
|
+
/**
|
317
|
+
* Booster Expression
|
318
|
+
*
|
319
|
+
* @x-go-type xata.BoosterExpression
|
320
|
+
*/
|
321
|
+
declare type BoosterExpression = {
|
322
|
+
valueBooster?: ValueBooster$1;
|
323
|
+
} | {
|
324
|
+
numericBooster?: NumericBooster$1;
|
325
|
+
} | {
|
326
|
+
dateBooster?: DateBooster$1;
|
327
|
+
};
|
328
|
+
/**
|
329
|
+
* Boost records with a particular value for a column.
|
330
|
+
*/
|
331
|
+
declare type ValueBooster$1 = {
|
332
|
+
column: string;
|
333
|
+
value: string | number | boolean;
|
334
|
+
factor: number;
|
335
|
+
};
|
336
|
+
/**
|
337
|
+
* Boost records based on the value of a numeric column.
|
338
|
+
*/
|
339
|
+
declare type NumericBooster$1 = {
|
340
|
+
column: string;
|
341
|
+
factor: number;
|
342
|
+
};
|
343
|
+
/**
|
344
|
+
* Boost records based on the value of a datetime column. It is configured via "origin", "scale", and "decay". The further away from the "origin",
|
345
|
+
* the more the score is decayed. The decay function uses an exponential function. For example if origin is "now", and scale is 10 days and decay is 0.5, it
|
346
|
+
* should be interpreted as: a record with a date 10 days before/after origin will score 2 times less than a record with the date at origin.
|
347
|
+
*/
|
348
|
+
declare type DateBooster$1 = {
|
349
|
+
column: string;
|
350
|
+
origin?: string;
|
351
|
+
scale: string;
|
352
|
+
decay: number;
|
353
|
+
};
|
306
354
|
declare type FilterList = FilterExpression | FilterExpression[];
|
307
355
|
declare type FilterColumn = FilterColumnIncludes | FilterPredicate | FilterList;
|
308
356
|
/**
|
@@ -359,7 +407,24 @@ declare type PageConfig = {
|
|
359
407
|
size?: number;
|
360
408
|
offset?: number;
|
361
409
|
};
|
362
|
-
declare type
|
410
|
+
declare type ColumnsProjection = string[];
|
411
|
+
/**
|
412
|
+
* Xata Table Record Metadata
|
413
|
+
*/
|
414
|
+
declare type RecordMeta = {
|
415
|
+
id: RecordID;
|
416
|
+
xata: {
|
417
|
+
version: number;
|
418
|
+
table?: string;
|
419
|
+
highlight?: {
|
420
|
+
[key: string]: string[] | {
|
421
|
+
[key: string]: any;
|
422
|
+
};
|
423
|
+
};
|
424
|
+
score?: number;
|
425
|
+
warnings?: string[];
|
426
|
+
};
|
427
|
+
};
|
363
428
|
/**
|
364
429
|
* @pattern [a-zA-Z0-9_-~:]+
|
365
430
|
*/
|
@@ -381,21 +446,9 @@ declare type RecordsMetadata = {
|
|
381
446
|
};
|
382
447
|
};
|
383
448
|
/**
|
384
|
-
* Xata Table Record
|
449
|
+
* Xata Table Record Metadata
|
385
450
|
*/
|
386
|
-
declare type XataRecord$1 = {
|
387
|
-
id: RecordID;
|
388
|
-
xata: {
|
389
|
-
version: number;
|
390
|
-
table?: string;
|
391
|
-
highlight?: {
|
392
|
-
[key: string]: string[] | {
|
393
|
-
[key: string]: any;
|
394
|
-
};
|
395
|
-
};
|
396
|
-
warnings?: string[];
|
397
|
-
};
|
398
|
-
} & {
|
451
|
+
declare type XataRecord$1 = RecordMeta & {
|
399
452
|
[key: string]: any;
|
400
453
|
};
|
401
454
|
|
@@ -413,6 +466,7 @@ type schemas_InviteID = InviteID;
|
|
413
466
|
type schemas_WorkspaceInvite = WorkspaceInvite;
|
414
467
|
type schemas_WorkspaceMembers = WorkspaceMembers;
|
415
468
|
type schemas_InviteKey = InviteKey;
|
469
|
+
type schemas_DatabaseMetadata = DatabaseMetadata;
|
416
470
|
type schemas_ListDatabasesResponse = ListDatabasesResponse;
|
417
471
|
type schemas_ListBranchesResponse = ListBranchesResponse;
|
418
472
|
type schemas_ListGitBranchesResponse = ListGitBranchesResponse;
|
@@ -440,6 +494,7 @@ type schemas_FuzzinessExpression = FuzzinessExpression;
|
|
440
494
|
type schemas_PrefixExpression = PrefixExpression;
|
441
495
|
type schemas_FilterExpression = FilterExpression;
|
442
496
|
type schemas_HighlightExpression = HighlightExpression;
|
497
|
+
type schemas_BoosterExpression = BoosterExpression;
|
443
498
|
type schemas_FilterList = FilterList;
|
444
499
|
type schemas_FilterColumn = FilterColumn;
|
445
500
|
type schemas_FilterColumnIncludes = FilterColumnIncludes;
|
@@ -449,7 +504,8 @@ type schemas_FilterPredicateRangeOp = FilterPredicateRangeOp;
|
|
449
504
|
type schemas_FilterRangeValue = FilterRangeValue;
|
450
505
|
type schemas_FilterValue = FilterValue;
|
451
506
|
type schemas_PageConfig = PageConfig;
|
452
|
-
type
|
507
|
+
type schemas_ColumnsProjection = ColumnsProjection;
|
508
|
+
type schemas_RecordMeta = RecordMeta;
|
453
509
|
type schemas_RecordID = RecordID;
|
454
510
|
type schemas_TableRename = TableRename;
|
455
511
|
type schemas_RecordsMetadata = RecordsMetadata;
|
@@ -469,6 +525,7 @@ declare namespace schemas {
|
|
469
525
|
schemas_WorkspaceInvite as WorkspaceInvite,
|
470
526
|
schemas_WorkspaceMembers as WorkspaceMembers,
|
471
527
|
schemas_InviteKey as InviteKey,
|
528
|
+
schemas_DatabaseMetadata as DatabaseMetadata,
|
472
529
|
schemas_ListDatabasesResponse as ListDatabasesResponse,
|
473
530
|
schemas_ListBranchesResponse as ListBranchesResponse,
|
474
531
|
schemas_ListGitBranchesResponse as ListGitBranchesResponse,
|
@@ -496,6 +553,10 @@ declare namespace schemas {
|
|
496
553
|
schemas_PrefixExpression as PrefixExpression,
|
497
554
|
schemas_FilterExpression as FilterExpression,
|
498
555
|
schemas_HighlightExpression as HighlightExpression,
|
556
|
+
schemas_BoosterExpression as BoosterExpression,
|
557
|
+
ValueBooster$1 as ValueBooster,
|
558
|
+
NumericBooster$1 as NumericBooster,
|
559
|
+
DateBooster$1 as DateBooster,
|
499
560
|
schemas_FilterList as FilterList,
|
500
561
|
schemas_FilterColumn as FilterColumn,
|
501
562
|
schemas_FilterColumnIncludes as FilterColumnIncludes,
|
@@ -505,7 +566,8 @@ declare namespace schemas {
|
|
505
566
|
schemas_FilterRangeValue as FilterRangeValue,
|
506
567
|
schemas_FilterValue as FilterValue,
|
507
568
|
schemas_PageConfig as PageConfig,
|
508
|
-
|
569
|
+
schemas_ColumnsProjection as ColumnsProjection,
|
570
|
+
schemas_RecordMeta as RecordMeta,
|
509
571
|
schemas_RecordID as RecordID,
|
510
572
|
schemas_TableRename as TableRename,
|
511
573
|
schemas_RecordsMetadata as RecordsMetadata,
|
@@ -540,11 +602,17 @@ declare type BulkError = {
|
|
540
602
|
status?: number;
|
541
603
|
}[];
|
542
604
|
};
|
605
|
+
declare type BulkInsertResponse = {
|
606
|
+
recordIDs: string[];
|
607
|
+
} | {
|
608
|
+
records: XataRecord$1[];
|
609
|
+
};
|
543
610
|
declare type BranchMigrationPlan = {
|
544
611
|
version: number;
|
545
612
|
migration: BranchMigration;
|
546
613
|
};
|
547
|
-
declare type
|
614
|
+
declare type RecordResponse = XataRecord$1;
|
615
|
+
declare type RecordUpdateResponse = XataRecord$1 | {
|
548
616
|
id: string;
|
549
617
|
xata: {
|
550
618
|
version: number;
|
@@ -568,7 +636,9 @@ type responses_SimpleError = SimpleError;
|
|
568
636
|
type responses_BadRequestError = BadRequestError;
|
569
637
|
type responses_AuthError = AuthError;
|
570
638
|
type responses_BulkError = BulkError;
|
639
|
+
type responses_BulkInsertResponse = BulkInsertResponse;
|
571
640
|
type responses_BranchMigrationPlan = BranchMigrationPlan;
|
641
|
+
type responses_RecordResponse = RecordResponse;
|
572
642
|
type responses_RecordUpdateResponse = RecordUpdateResponse;
|
573
643
|
type responses_QueryResponse = QueryResponse;
|
574
644
|
type responses_SearchResponse = SearchResponse;
|
@@ -579,7 +649,9 @@ declare namespace responses {
|
|
579
649
|
responses_BadRequestError as BadRequestError,
|
580
650
|
responses_AuthError as AuthError,
|
581
651
|
responses_BulkError as BulkError,
|
652
|
+
responses_BulkInsertResponse as BulkInsertResponse,
|
582
653
|
responses_BranchMigrationPlan as BranchMigrationPlan,
|
654
|
+
responses_RecordResponse as RecordResponse,
|
583
655
|
responses_RecordUpdateResponse as RecordUpdateResponse,
|
584
656
|
responses_QueryResponse as QueryResponse,
|
585
657
|
responses_SearchResponse as SearchResponse,
|
@@ -926,8 +998,7 @@ declare type UpdateWorkspaceMemberInviteVariables = {
|
|
926
998
|
pathParams: UpdateWorkspaceMemberInvitePathParams;
|
927
999
|
} & FetcherExtraProps;
|
928
1000
|
/**
|
929
|
-
* This operation provides a way to update an existing invite. Updates are performed in-place; they do not
|
930
|
-
* change the invite link, the expiry time, nor do they re-notify the recipient of the invite.
|
1001
|
+
* This operation provides a way to update an existing invite. Updates are performed in-place; they do not change the invite link, the expiry time, nor do they re-notify the recipient of the invite.
|
931
1002
|
*/
|
932
1003
|
declare const updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<WorkspaceInvite>;
|
933
1004
|
declare type CancelWorkspaceMemberInvitePathParams = {
|
@@ -1083,6 +1154,27 @@ declare type DeleteDatabaseVariables = {
|
|
1083
1154
|
* Delete a database and all of its branches and tables permanently.
|
1084
1155
|
*/
|
1085
1156
|
declare const deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
|
1157
|
+
declare type GetDatabaseMetadataPathParams = {
|
1158
|
+
dbName: DBName;
|
1159
|
+
workspace: string;
|
1160
|
+
};
|
1161
|
+
declare type GetDatabaseMetadataError = ErrorWrapper<{
|
1162
|
+
status: 400;
|
1163
|
+
payload: BadRequestError;
|
1164
|
+
} | {
|
1165
|
+
status: 401;
|
1166
|
+
payload: AuthError;
|
1167
|
+
} | {
|
1168
|
+
status: 404;
|
1169
|
+
payload: SimpleError;
|
1170
|
+
}>;
|
1171
|
+
declare type GetDatabaseMetadataVariables = {
|
1172
|
+
pathParams: GetDatabaseMetadataPathParams;
|
1173
|
+
} & FetcherExtraProps;
|
1174
|
+
/**
|
1175
|
+
* Retrieve metadata of the given database
|
1176
|
+
*/
|
1177
|
+
declare const getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
|
1086
1178
|
declare type GetGitBranchesMappingPathParams = {
|
1087
1179
|
dbName: DBName;
|
1088
1180
|
workspace: string;
|
@@ -1275,6 +1367,10 @@ declare type CreateBranchError = ErrorWrapper<{
|
|
1275
1367
|
status: 404;
|
1276
1368
|
payload: SimpleError;
|
1277
1369
|
}>;
|
1370
|
+
declare type CreateBranchResponse = {
|
1371
|
+
databaseName: string;
|
1372
|
+
branchName: string;
|
1373
|
+
};
|
1278
1374
|
declare type CreateBranchRequestBody = {
|
1279
1375
|
from?: string;
|
1280
1376
|
metadata?: BranchMetadata;
|
@@ -1284,7 +1380,7 @@ declare type CreateBranchVariables = {
|
|
1284
1380
|
pathParams: CreateBranchPathParams;
|
1285
1381
|
queryParams?: CreateBranchQueryParams;
|
1286
1382
|
} & FetcherExtraProps;
|
1287
|
-
declare const createBranch: (variables: CreateBranchVariables) => Promise<
|
1383
|
+
declare const createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
|
1288
1384
|
declare type DeleteBranchPathParams = {
|
1289
1385
|
dbBranchName: DBBranchName;
|
1290
1386
|
workspace: string;
|
@@ -1471,13 +1567,17 @@ declare type CreateTableError = ErrorWrapper<{
|
|
1471
1567
|
status: 422;
|
1472
1568
|
payload: SimpleError;
|
1473
1569
|
}>;
|
1570
|
+
declare type CreateTableResponse = {
|
1571
|
+
branchName: string;
|
1572
|
+
tableName: string;
|
1573
|
+
};
|
1474
1574
|
declare type CreateTableVariables = {
|
1475
1575
|
pathParams: CreateTablePathParams;
|
1476
1576
|
} & FetcherExtraProps;
|
1477
1577
|
/**
|
1478
1578
|
* Creates a new table with the given name. Returns 422 if a table with the same name already exists.
|
1479
1579
|
*/
|
1480
|
-
declare const createTable: (variables: CreateTableVariables) => Promise<
|
1580
|
+
declare const createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
|
1481
1581
|
declare type DeleteTablePathParams = {
|
1482
1582
|
dbBranchName: DBBranchName;
|
1483
1583
|
tableName: TableName;
|
@@ -1710,6 +1810,9 @@ declare type InsertRecordPathParams = {
|
|
1710
1810
|
tableName: TableName;
|
1711
1811
|
workspace: string;
|
1712
1812
|
};
|
1813
|
+
declare type InsertRecordQueryParams = {
|
1814
|
+
columns?: ColumnsProjection;
|
1815
|
+
};
|
1713
1816
|
declare type InsertRecordError = ErrorWrapper<{
|
1714
1817
|
status: 400;
|
1715
1818
|
payload: BadRequestError;
|
@@ -1720,20 +1823,15 @@ declare type InsertRecordError = ErrorWrapper<{
|
|
1720
1823
|
status: 404;
|
1721
1824
|
payload: SimpleError;
|
1722
1825
|
}>;
|
1723
|
-
declare type InsertRecordResponse = {
|
1724
|
-
id: string;
|
1725
|
-
xata: {
|
1726
|
-
version: number;
|
1727
|
-
};
|
1728
|
-
};
|
1729
1826
|
declare type InsertRecordVariables = {
|
1730
1827
|
body?: Record<string, any>;
|
1731
1828
|
pathParams: InsertRecordPathParams;
|
1829
|
+
queryParams?: InsertRecordQueryParams;
|
1732
1830
|
} & FetcherExtraProps;
|
1733
1831
|
/**
|
1734
1832
|
* Insert a new Record into the Table
|
1735
1833
|
*/
|
1736
|
-
declare const insertRecord: (variables: InsertRecordVariables) => Promise<
|
1834
|
+
declare const insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
|
1737
1835
|
declare type InsertRecordWithIDPathParams = {
|
1738
1836
|
dbBranchName: DBBranchName;
|
1739
1837
|
tableName: TableName;
|
@@ -1741,6 +1839,7 @@ declare type InsertRecordWithIDPathParams = {
|
|
1741
1839
|
workspace: string;
|
1742
1840
|
};
|
1743
1841
|
declare type InsertRecordWithIDQueryParams = {
|
1842
|
+
columns?: ColumnsProjection;
|
1744
1843
|
createOnly?: boolean;
|
1745
1844
|
ifVersion?: number;
|
1746
1845
|
};
|
@@ -1773,6 +1872,7 @@ declare type UpdateRecordWithIDPathParams = {
|
|
1773
1872
|
workspace: string;
|
1774
1873
|
};
|
1775
1874
|
declare type UpdateRecordWithIDQueryParams = {
|
1875
|
+
columns?: ColumnsProjection;
|
1776
1876
|
ifVersion?: number;
|
1777
1877
|
};
|
1778
1878
|
declare type UpdateRecordWithIDError = ErrorWrapper<{
|
@@ -1801,6 +1901,7 @@ declare type UpsertRecordWithIDPathParams = {
|
|
1801
1901
|
workspace: string;
|
1802
1902
|
};
|
1803
1903
|
declare type UpsertRecordWithIDQueryParams = {
|
1904
|
+
columns?: ColumnsProjection;
|
1804
1905
|
ifVersion?: number;
|
1805
1906
|
};
|
1806
1907
|
declare type UpsertRecordWithIDError = ErrorWrapper<{
|
@@ -1828,6 +1929,9 @@ declare type DeleteRecordPathParams = {
|
|
1828
1929
|
recordId: RecordID;
|
1829
1930
|
workspace: string;
|
1830
1931
|
};
|
1932
|
+
declare type DeleteRecordQueryParams = {
|
1933
|
+
columns?: ColumnsProjection;
|
1934
|
+
};
|
1831
1935
|
declare type DeleteRecordError = ErrorWrapper<{
|
1832
1936
|
status: 400;
|
1833
1937
|
payload: BadRequestError;
|
@@ -1840,14 +1944,18 @@ declare type DeleteRecordError = ErrorWrapper<{
|
|
1840
1944
|
}>;
|
1841
1945
|
declare type DeleteRecordVariables = {
|
1842
1946
|
pathParams: DeleteRecordPathParams;
|
1947
|
+
queryParams?: DeleteRecordQueryParams;
|
1843
1948
|
} & FetcherExtraProps;
|
1844
|
-
declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<
|
1949
|
+
declare const deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
|
1845
1950
|
declare type GetRecordPathParams = {
|
1846
1951
|
dbBranchName: DBBranchName;
|
1847
1952
|
tableName: TableName;
|
1848
1953
|
recordId: RecordID;
|
1849
1954
|
workspace: string;
|
1850
1955
|
};
|
1956
|
+
declare type GetRecordQueryParams = {
|
1957
|
+
columns?: ColumnsProjection;
|
1958
|
+
};
|
1851
1959
|
declare type GetRecordError = ErrorWrapper<{
|
1852
1960
|
status: 400;
|
1853
1961
|
payload: BadRequestError;
|
@@ -1858,12 +1966,9 @@ declare type GetRecordError = ErrorWrapper<{
|
|
1858
1966
|
status: 404;
|
1859
1967
|
payload: SimpleError;
|
1860
1968
|
}>;
|
1861
|
-
declare type GetRecordRequestBody = {
|
1862
|
-
columns?: ColumnsFilter;
|
1863
|
-
};
|
1864
1969
|
declare type GetRecordVariables = {
|
1865
|
-
body?: GetRecordRequestBody;
|
1866
1970
|
pathParams: GetRecordPathParams;
|
1971
|
+
queryParams?: GetRecordQueryParams;
|
1867
1972
|
} & FetcherExtraProps;
|
1868
1973
|
/**
|
1869
1974
|
* Retrieve record by ID
|
@@ -1874,6 +1979,9 @@ declare type BulkInsertTableRecordsPathParams = {
|
|
1874
1979
|
tableName: TableName;
|
1875
1980
|
workspace: string;
|
1876
1981
|
};
|
1982
|
+
declare type BulkInsertTableRecordsQueryParams = {
|
1983
|
+
columns?: ColumnsProjection;
|
1984
|
+
};
|
1877
1985
|
declare type BulkInsertTableRecordsError = ErrorWrapper<{
|
1878
1986
|
status: 400;
|
1879
1987
|
payload: BulkError;
|
@@ -1887,20 +1995,18 @@ declare type BulkInsertTableRecordsError = ErrorWrapper<{
|
|
1887
1995
|
status: 422;
|
1888
1996
|
payload: SimpleError;
|
1889
1997
|
}>;
|
1890
|
-
declare type BulkInsertTableRecordsResponse = {
|
1891
|
-
recordIDs: string[];
|
1892
|
-
};
|
1893
1998
|
declare type BulkInsertTableRecordsRequestBody = {
|
1894
1999
|
records: Record<string, any>[];
|
1895
2000
|
};
|
1896
2001
|
declare type BulkInsertTableRecordsVariables = {
|
1897
2002
|
body: BulkInsertTableRecordsRequestBody;
|
1898
2003
|
pathParams: BulkInsertTableRecordsPathParams;
|
2004
|
+
queryParams?: BulkInsertTableRecordsQueryParams;
|
1899
2005
|
} & FetcherExtraProps;
|
1900
2006
|
/**
|
1901
2007
|
* Bulk insert records
|
1902
2008
|
*/
|
1903
|
-
declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<
|
2009
|
+
declare const bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
|
1904
2010
|
declare type QueryTablePathParams = {
|
1905
2011
|
dbBranchName: DBBranchName;
|
1906
2012
|
tableName: TableName;
|
@@ -1920,7 +2026,7 @@ declare type QueryTableRequestBody = {
|
|
1920
2026
|
filter?: FilterExpression;
|
1921
2027
|
sort?: SortExpression;
|
1922
2028
|
page?: PageConfig;
|
1923
|
-
columns?:
|
2029
|
+
columns?: ColumnsProjection;
|
1924
2030
|
};
|
1925
2031
|
declare type QueryTableVariables = {
|
1926
2032
|
body?: QueryTableRequestBody;
|
@@ -2669,6 +2775,7 @@ declare type SearchTableRequestBody = {
|
|
2669
2775
|
prefix?: PrefixExpression;
|
2670
2776
|
filter?: FilterExpression;
|
2671
2777
|
highlight?: HighlightExpression;
|
2778
|
+
boosters?: BoosterExpression[];
|
2672
2779
|
};
|
2673
2780
|
declare type SearchTableVariables = {
|
2674
2781
|
body: SearchTableRequestBody;
|
@@ -2700,6 +2807,7 @@ declare type SearchBranchRequestBody = {
|
|
2700
2807
|
tables?: (string | {
|
2701
2808
|
table: string;
|
2702
2809
|
filter?: FilterExpression;
|
2810
|
+
boosters?: BoosterExpression[];
|
2703
2811
|
})[];
|
2704
2812
|
query: string;
|
2705
2813
|
fuzziness?: FuzzinessExpression;
|
@@ -2741,6 +2849,7 @@ declare const operationsByTag: {
|
|
2741
2849
|
getDatabaseList: (variables: GetDatabaseListVariables) => Promise<ListDatabasesResponse>;
|
2742
2850
|
createDatabase: (variables: CreateDatabaseVariables) => Promise<CreateDatabaseResponse>;
|
2743
2851
|
deleteDatabase: (variables: DeleteDatabaseVariables) => Promise<undefined>;
|
2852
|
+
getDatabaseMetadata: (variables: GetDatabaseMetadataVariables) => Promise<DatabaseMetadata>;
|
2744
2853
|
getGitBranchesMapping: (variables: GetGitBranchesMappingVariables) => Promise<ListGitBranchesResponse>;
|
2745
2854
|
addGitBranchesEntry: (variables: AddGitBranchesEntryVariables) => Promise<AddGitBranchesEntryResponse>;
|
2746
2855
|
removeGitBranchesEntry: (variables: RemoveGitBranchesEntryVariables) => Promise<undefined>;
|
@@ -2749,7 +2858,7 @@ declare const operationsByTag: {
|
|
2749
2858
|
branch: {
|
2750
2859
|
getBranchList: (variables: GetBranchListVariables) => Promise<ListBranchesResponse>;
|
2751
2860
|
getBranchDetails: (variables: GetBranchDetailsVariables) => Promise<DBBranch>;
|
2752
|
-
createBranch: (variables: CreateBranchVariables) => Promise<
|
2861
|
+
createBranch: (variables: CreateBranchVariables) => Promise<CreateBranchResponse>;
|
2753
2862
|
deleteBranch: (variables: DeleteBranchVariables) => Promise<undefined>;
|
2754
2863
|
updateBranchMetadata: (variables: UpdateBranchMetadataVariables) => Promise<undefined>;
|
2755
2864
|
getBranchMetadata: (variables: GetBranchMetadataVariables) => Promise<BranchMetadata>;
|
@@ -2759,7 +2868,7 @@ declare const operationsByTag: {
|
|
2759
2868
|
getBranchStats: (variables: GetBranchStatsVariables) => Promise<GetBranchStatsResponse>;
|
2760
2869
|
};
|
2761
2870
|
table: {
|
2762
|
-
createTable: (variables: CreateTableVariables) => Promise<
|
2871
|
+
createTable: (variables: CreateTableVariables) => Promise<CreateTableResponse>;
|
2763
2872
|
deleteTable: (variables: DeleteTableVariables) => Promise<undefined>;
|
2764
2873
|
updateTable: (variables: UpdateTableVariables) => Promise<undefined>;
|
2765
2874
|
getTableSchema: (variables: GetTableSchemaVariables) => Promise<GetTableSchemaResponse>;
|
@@ -2771,13 +2880,13 @@ declare const operationsByTag: {
|
|
2771
2880
|
updateColumn: (variables: UpdateColumnVariables) => Promise<MigrationIdResponse>;
|
2772
2881
|
};
|
2773
2882
|
records: {
|
2774
|
-
insertRecord: (variables: InsertRecordVariables) => Promise<
|
2883
|
+
insertRecord: (variables: InsertRecordVariables) => Promise<RecordUpdateResponse>;
|
2775
2884
|
insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
|
2776
2885
|
updateRecordWithID: (variables: UpdateRecordWithIDVariables) => Promise<RecordUpdateResponse>;
|
2777
2886
|
upsertRecordWithID: (variables: UpsertRecordWithIDVariables) => Promise<RecordUpdateResponse>;
|
2778
|
-
deleteRecord: (variables: DeleteRecordVariables) => Promise<
|
2887
|
+
deleteRecord: (variables: DeleteRecordVariables) => Promise<XataRecord$1>;
|
2779
2888
|
getRecord: (variables: GetRecordVariables) => Promise<XataRecord$1>;
|
2780
|
-
bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<
|
2889
|
+
bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertResponse>;
|
2781
2890
|
queryTable: (variables: QueryTableVariables) => Promise<QueryResponse>;
|
2782
2891
|
searchTable: (variables: SearchTableVariables) => Promise<SearchResponse>;
|
2783
2892
|
searchBranch: (variables: SearchBranchVariables) => Promise<SearchResponse>;
|
@@ -2795,10 +2904,8 @@ interface XataApiClientOptions {
|
|
2795
2904
|
fetch?: FetchImpl;
|
2796
2905
|
apiKey?: string;
|
2797
2906
|
host?: HostProvider;
|
2907
|
+
trace?: TraceFunction;
|
2798
2908
|
}
|
2799
|
-
/**
|
2800
|
-
* @deprecated Use XataApiPlugin instead
|
2801
|
-
*/
|
2802
2909
|
declare class XataApiClient {
|
2803
2910
|
#private;
|
2804
2911
|
constructor(options?: XataApiClientOptions);
|
@@ -2842,6 +2949,7 @@ declare class DatabaseApi {
|
|
2842
2949
|
getDatabaseList(workspace: WorkspaceID): Promise<ListDatabasesResponse>;
|
2843
2950
|
createDatabase(workspace: WorkspaceID, dbName: DBName, options?: CreateDatabaseRequestBody): Promise<CreateDatabaseResponse>;
|
2844
2951
|
deleteDatabase(workspace: WorkspaceID, dbName: DBName): Promise<void>;
|
2952
|
+
getDatabaseMetadata(workspace: WorkspaceID, dbName: DBName): Promise<DatabaseMetadata>;
|
2845
2953
|
getGitBranchesMapping(workspace: WorkspaceID, dbName: DBName): Promise<ListGitBranchesResponse>;
|
2846
2954
|
addGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, body: AddGitBranchesEntryRequestBody): Promise<AddGitBranchesEntryResponse>;
|
2847
2955
|
removeGitBranchesEntry(workspace: WorkspaceID, dbName: DBName, gitBranch: string): Promise<void>;
|
@@ -2852,7 +2960,7 @@ declare class BranchApi {
|
|
2852
2960
|
constructor(extraProps: FetcherExtraProps);
|
2853
2961
|
getBranchList(workspace: WorkspaceID, dbName: DBName): Promise<ListBranchesResponse>;
|
2854
2962
|
getBranchDetails(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<DBBranch>;
|
2855
|
-
createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<
|
2963
|
+
createBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, from?: string, options?: CreateBranchRequestBody): Promise<CreateBranchResponse>;
|
2856
2964
|
deleteBranch(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<void>;
|
2857
2965
|
updateBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName, metadata?: BranchMetadata): Promise<void>;
|
2858
2966
|
getBranchMetadata(workspace: WorkspaceID, database: DBName, branch: BranchName): Promise<BranchMetadata>;
|
@@ -2864,7 +2972,7 @@ declare class BranchApi {
|
|
2864
2972
|
declare class TableApi {
|
2865
2973
|
private extraProps;
|
2866
2974
|
constructor(extraProps: FetcherExtraProps);
|
2867
|
-
createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<
|
2975
|
+
createTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<CreateTableResponse>;
|
2868
2976
|
deleteTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<void>;
|
2869
2977
|
updateTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, options: UpdateTableRequestBody): Promise<void>;
|
2870
2978
|
getTableSchema(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName): Promise<GetTableSchemaResponse>;
|
@@ -2878,13 +2986,13 @@ declare class TableApi {
|
|
2878
2986
|
declare class RecordsApi {
|
2879
2987
|
private extraProps;
|
2880
2988
|
constructor(extraProps: FetcherExtraProps);
|
2881
|
-
insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any
|
2989
|
+
insertRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, record: Record<string, any>, options?: InsertRecordQueryParams): Promise<RecordUpdateResponse>;
|
2882
2990
|
insertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: InsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
|
2883
2991
|
updateRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpdateRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
|
2884
2992
|
upsertRecordWithID(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, record: Record<string, any>, options?: UpsertRecordWithIDQueryParams): Promise<RecordUpdateResponse>;
|
2885
|
-
deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID): Promise<
|
2886
|
-
getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?:
|
2887
|
-
bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[]): Promise<
|
2993
|
+
deleteRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: DeleteRecordQueryParams): Promise<RecordUpdateResponse>;
|
2994
|
+
getRecord(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, recordId: RecordID, options?: GetRecordQueryParams): Promise<XataRecord$1>;
|
2995
|
+
bulkInsertTableRecords(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, records: Record<string, any>[], options?: BulkInsertTableRecordsQueryParams): Promise<BulkInsertResponse>;
|
2888
2996
|
queryTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: QueryTableRequestBody): Promise<QueryResponse>;
|
2889
2997
|
searchTable(workspace: WorkspaceID, database: DBName, branch: BranchName, tableName: TableName, query: SearchTableRequestBody): Promise<SearchResponse>;
|
2890
2998
|
searchBranch(workspace: WorkspaceID, database: DBName, branch: BranchName, query: SearchBranchRequestBody): Promise<SearchResponse>;
|
@@ -2900,19 +3008,20 @@ declare type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) ex
|
|
2900
3008
|
declare type If<Condition, Then, Else> = Condition extends true ? Then : Else;
|
2901
3009
|
declare type IsObject<T> = T extends Record<string, any> ? true : false;
|
2902
3010
|
declare type IsArray<T> = T extends Array<any> ? true : false;
|
2903
|
-
declare type NonEmptyArray<T> = T[] & {
|
2904
|
-
0: T;
|
2905
|
-
};
|
2906
3011
|
declare type RequiredBy<T, K extends keyof T> = T & {
|
2907
3012
|
[P in K]-?: NonNullable<T[P]>;
|
2908
3013
|
};
|
2909
3014
|
declare type GetArrayInnerType<T extends readonly any[]> = T[number];
|
2910
3015
|
declare type SingleOrArray<T> = T | T[];
|
2911
3016
|
declare type OmitBy<T, K extends keyof T> = T extends any ? Omit<T, K> : never;
|
3017
|
+
declare type Without<T, U> = {
|
3018
|
+
[P in Exclude<keyof T, keyof U>]?: never;
|
3019
|
+
};
|
3020
|
+
declare type ExclusiveOr<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
|
2912
3021
|
|
2913
3022
|
declare type SelectableColumn<O, RecursivePath extends any[] = []> = '*' | 'id' | DataProps<O> | NestedColumns<O, RecursivePath>;
|
2914
|
-
declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord & UnionToIntersection<Values<{
|
2915
|
-
[K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord
|
3023
|
+
declare type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = XataRecord<O> & UnionToIntersection<Values<{
|
3024
|
+
[K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord<O>;
|
2916
3025
|
}>>;
|
2917
3026
|
declare type ValueAtColumn<O, P extends SelectableColumn<O>> = P extends '*' ? Values<O> : P extends 'id' ? string : P extends keyof O ? O[P] : P extends `${infer K}.${infer V}` ? K extends keyof O ? Values<NonNullable<O[K]> extends infer Item ? Item extends Record<string, any> ? V extends SelectableColumn<Item> ? {
|
2918
3027
|
V: ValueAtColumn<Item, V>;
|
@@ -2948,41 +3057,68 @@ interface BaseData {
|
|
2948
3057
|
/**
|
2949
3058
|
* Represents a persisted record from the database.
|
2950
3059
|
*/
|
2951
|
-
interface XataRecord<
|
3060
|
+
interface XataRecord<OriginalRecord extends XataRecord<any> = XataRecord<any>> extends Identifiable {
|
2952
3061
|
/**
|
2953
3062
|
* Get metadata of this record.
|
2954
3063
|
*/
|
2955
|
-
getMetadata(): XataRecordMetadata
|
3064
|
+
getMetadata(): XataRecordMetadata;
|
3065
|
+
/**
|
3066
|
+
* Retrieves a refreshed copy of the current record from the database.
|
3067
|
+
* @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
|
3068
|
+
* @returns The persisted record with the selected columns, null if not found.
|
3069
|
+
*/
|
3070
|
+
read<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
|
2956
3071
|
/**
|
2957
3072
|
* Retrieves a refreshed copy of the current record from the database.
|
3073
|
+
* @returns The persisted record with all first level properties, null if not found.
|
2958
3074
|
*/
|
2959
|
-
read(): Promise<Readonly<SelectedPick<
|
3075
|
+
read(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
|
2960
3076
|
/**
|
2961
3077
|
* Performs a partial update of the current record. On success a new object is
|
2962
3078
|
* returned and the current object is not mutated.
|
2963
3079
|
* @param partialUpdate The columns and their values that have to be updated.
|
2964
|
-
* @
|
3080
|
+
* @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
|
3081
|
+
* @returns The persisted record with the selected columns, null if not found.
|
3082
|
+
*/
|
3083
|
+
update<K extends SelectableColumn<OriginalRecord>>(partialUpdate: Partial<EditableData<OriginalRecord>>, columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
|
3084
|
+
/**
|
3085
|
+
* Performs a partial update of the current record. On success a new object is
|
3086
|
+
* returned and the current object is not mutated.
|
3087
|
+
* @param partialUpdate The columns and their values that have to be updated.
|
3088
|
+
* @returns The persisted record with all first level properties, null if not found.
|
2965
3089
|
*/
|
2966
|
-
update(partialUpdate: Partial<EditableData<
|
3090
|
+
update(partialUpdate: Partial<EditableData<OriginalRecord>>): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
|
2967
3091
|
/**
|
2968
3092
|
* Performs a deletion of the current record in the database.
|
2969
|
-
*
|
2970
|
-
* @
|
3093
|
+
* @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
|
3094
|
+
* @returns The deleted record, null if not found.
|
2971
3095
|
*/
|
2972
|
-
delete(): Promise<
|
3096
|
+
delete<K extends SelectableColumn<OriginalRecord>>(columns: K[]): Promise<Readonly<SelectedPick<OriginalRecord, typeof columns>> | null>;
|
3097
|
+
/**
|
3098
|
+
* Performs a deletion of the current record in the database.
|
3099
|
+
* @returns The deleted record, null if not found.
|
3100
|
+
|
3101
|
+
*/
|
3102
|
+
delete(): Promise<Readonly<SelectedPick<OriginalRecord, ['*']>> | null>;
|
2973
3103
|
}
|
2974
3104
|
declare type Link<Record extends XataRecord> = Omit<XataRecord, 'read' | 'update'> & {
|
2975
3105
|
/**
|
2976
3106
|
* Retrieves a refreshed copy of the current record from the database.
|
2977
3107
|
*/
|
2978
|
-
read(): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
|
3108
|
+
read<K extends SelectableColumn<Record>>(columns?: K[]): Promise<Readonly<SelectedPick<Record, typeof columns extends SelectableColumn<Record>[] ? typeof columns : ['*']>> | null>;
|
2979
3109
|
/**
|
2980
3110
|
* Performs a partial update of the current record. On success a new object is
|
2981
3111
|
* returned and the current object is not mutated.
|
2982
3112
|
* @param partialUpdate The columns and their values that have to be updated.
|
2983
3113
|
* @returns A new record containing the latest values for all the columns of the current record.
|
2984
3114
|
*/
|
2985
|
-
update(partialUpdate: Partial<EditableData<
|
3115
|
+
update<K extends SelectableColumn<Record>>(partialUpdate: Partial<EditableData<Record>>, columns?: K[]): Promise<Readonly<SelectedPick<Record, typeof columns extends SelectableColumn<Record>[] ? typeof columns : ['*']>>>;
|
3116
|
+
/**
|
3117
|
+
* Performs a deletion of the current record in the database.
|
3118
|
+
*
|
3119
|
+
* @throws If the record was already deleted or if an error happened while performing the deletion.
|
3120
|
+
*/
|
3121
|
+
delete(): Promise<void>;
|
2986
3122
|
};
|
2987
3123
|
declare type XataRecordMetadata = {
|
2988
3124
|
/**
|
@@ -2993,13 +3129,13 @@ declare type XataRecordMetadata = {
|
|
2993
3129
|
};
|
2994
3130
|
declare function isIdentifiable(x: any): x is Identifiable & Record<string, unknown>;
|
2995
3131
|
declare function isXataRecord(x: any): x is XataRecord & Record<string, unknown>;
|
2996
|
-
declare type EditableData<O extends
|
3132
|
+
declare type EditableData<O extends XataRecord> = Identifiable & Omit<{
|
2997
3133
|
[K in keyof O]: O[K] extends XataRecord ? {
|
2998
3134
|
id: string;
|
2999
3135
|
} | string : NonNullable<O[K]> extends XataRecord ? {
|
3000
3136
|
id: string;
|
3001
3137
|
} | string | null | undefined : O[K];
|
3002
|
-
}
|
3138
|
+
}, keyof XataRecord>;
|
3003
3139
|
|
3004
3140
|
/**
|
3005
3141
|
* PropertyMatchFilter
|
@@ -3093,7 +3229,85 @@ declare type BaseApiFilter<Record> = PropertyAccessFilter<Record> | AggregatorFi
|
|
3093
3229
|
declare type NestedApiFilter<T> = {
|
3094
3230
|
[key in keyof T]?: T[key] extends Record<string, any> ? SingleOrArray<Filter<T[key]>> : PropertyFilter<T[key]>;
|
3095
3231
|
};
|
3096
|
-
declare type Filter<T> = T extends Record<string, any> ? BaseApiFilter<T> | NestedApiFilter<T> : PropertyFilter<T>;
|
3232
|
+
declare type Filter<T> = T extends Record<string, any> ? T extends Date ? PropertyFilter<T> : BaseApiFilter<T> | NestedApiFilter<T> : PropertyFilter<T>;
|
3233
|
+
|
3234
|
+
declare type DateBooster = {
|
3235
|
+
origin?: string;
|
3236
|
+
scale: string;
|
3237
|
+
decay: number;
|
3238
|
+
};
|
3239
|
+
declare type NumericBooster = {
|
3240
|
+
factor: number;
|
3241
|
+
};
|
3242
|
+
declare type ValueBooster<T extends string | number | boolean> = {
|
3243
|
+
value: T;
|
3244
|
+
factor: number;
|
3245
|
+
};
|
3246
|
+
declare type Boosters<O extends XataRecord> = Values<{
|
3247
|
+
[K in SelectableColumn<O>]: NonNullable<ValueAtColumn<O, K>> extends Date ? {
|
3248
|
+
dateBooster: {
|
3249
|
+
column: K;
|
3250
|
+
} & DateBooster;
|
3251
|
+
} : NonNullable<ValueAtColumn<O, K>> extends number ? ExclusiveOr<{
|
3252
|
+
numericBooster?: {
|
3253
|
+
column: K;
|
3254
|
+
} & NumericBooster;
|
3255
|
+
}, {
|
3256
|
+
valueBooster?: {
|
3257
|
+
column: K;
|
3258
|
+
} & ValueBooster<number>;
|
3259
|
+
}> : NonNullable<ValueAtColumn<O, K>> extends string | boolean ? {
|
3260
|
+
valueBooster: {
|
3261
|
+
column: K;
|
3262
|
+
} & ValueBooster<NonNullable<ValueAtColumn<O, K>>>;
|
3263
|
+
} : never;
|
3264
|
+
}>;
|
3265
|
+
|
3266
|
+
declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
|
3267
|
+
fuzziness?: FuzzinessExpression;
|
3268
|
+
prefix?: PrefixExpression;
|
3269
|
+
highlight?: HighlightExpression;
|
3270
|
+
tables?: Array<Tables | Values<{
|
3271
|
+
[Model in GetArrayInnerType<NonNullable<Tables[]>>]: {
|
3272
|
+
table: Model;
|
3273
|
+
filter?: Filter<SelectedPick<Schemas[Model] & XataRecord, ['*']>>;
|
3274
|
+
boosters?: Boosters<Schemas[Model] & XataRecord>[];
|
3275
|
+
};
|
3276
|
+
}>>;
|
3277
|
+
};
|
3278
|
+
declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
|
3279
|
+
all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
|
3280
|
+
[Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]: {
|
3281
|
+
table: Model;
|
3282
|
+
record: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>>;
|
3283
|
+
};
|
3284
|
+
}>[]>;
|
3285
|
+
byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
|
3286
|
+
[Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]?: Awaited<SearchXataRecord<SelectedPick<Schemas[Model] & XataRecord, ['*']>>[]>;
|
3287
|
+
}>;
|
3288
|
+
};
|
3289
|
+
declare class SearchPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin {
|
3290
|
+
#private;
|
3291
|
+
private db;
|
3292
|
+
constructor(db: SchemaPluginResult<Schemas>, schemaTables?: Schemas.Table[]);
|
3293
|
+
build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
|
3294
|
+
}
|
3295
|
+
declare type SearchXataRecord<Record extends XataRecord> = Omit<Record, 'getMetadata'> & {
|
3296
|
+
getMetadata: () => XataRecordMetadata & SearchExtraProperties;
|
3297
|
+
};
|
3298
|
+
declare type SearchExtraProperties = {
|
3299
|
+
table: string;
|
3300
|
+
highlight?: {
|
3301
|
+
[key: string]: string[] | {
|
3302
|
+
[key: string]: any;
|
3303
|
+
};
|
3304
|
+
};
|
3305
|
+
score?: number;
|
3306
|
+
};
|
3307
|
+
declare type ReturnTable<Table, Tables> = Table extends Tables ? Table : never;
|
3308
|
+
declare type ExtractTables<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>, TableOptions extends GetArrayInnerType<NonNullable<NonNullable<SearchOptions<Schemas, Tables>>['tables']>>> = TableOptions extends `${infer Table}` ? ReturnTable<Table, Tables> : TableOptions extends {
|
3309
|
+
table: infer Table;
|
3310
|
+
} ? ReturnTable<Table, Tables> : never;
|
3097
3311
|
|
3098
3312
|
declare type SortDirection = 'asc' | 'desc';
|
3099
3313
|
declare type SortFilterExtended<T extends XataRecord> = {
|
@@ -3106,7 +3320,7 @@ declare type SortFilterBase<T extends XataRecord> = {
|
|
3106
3320
|
};
|
3107
3321
|
|
3108
3322
|
declare type BaseOptions<T extends XataRecord> = {
|
3109
|
-
columns?:
|
3323
|
+
columns?: SelectableColumn<T>[];
|
3110
3324
|
cache?: number;
|
3111
3325
|
};
|
3112
3326
|
declare type CursorQueryOptions = {
|
@@ -3169,7 +3383,7 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
|
|
3169
3383
|
* @param value The value to filter.
|
3170
3384
|
* @returns A new Query object.
|
3171
3385
|
*/
|
3172
|
-
filter<F extends SelectableColumn<Record>>(column: F, value: Filter<ValueAtColumn<Record, F
|
3386
|
+
filter<F extends SelectableColumn<Record>>(column: F, value: Filter<NonNullable<ValueAtColumn<Record, F>>>): Query<Record, Result>;
|
3173
3387
|
/**
|
3174
3388
|
* Builds a new query object adding one or more constraints. Examples:
|
3175
3389
|
*
|
@@ -3190,13 +3404,13 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
|
|
3190
3404
|
* @param direction The direction. Either ascending or descending.
|
3191
3405
|
* @returns A new Query object.
|
3192
3406
|
*/
|
3193
|
-
sort<F extends SelectableColumn<Record>>(column: F, direction
|
3407
|
+
sort<F extends SelectableColumn<Record>>(column: F, direction?: SortDirection): Query<Record, Result>;
|
3194
3408
|
/**
|
3195
3409
|
* Builds a new query specifying the set of columns to be returned in the query response.
|
3196
3410
|
* @param columns Array of column names to be returned by the query.
|
3197
3411
|
* @returns A new Query object.
|
3198
3412
|
*/
|
3199
|
-
select<K extends SelectableColumn<Record>>(columns:
|
3413
|
+
select<K extends SelectableColumn<Record>>(columns: K[]): Query<Record, SelectedPick<Record, K[]>>;
|
3200
3414
|
/**
|
3201
3415
|
* Get paginated results
|
3202
3416
|
*
|
@@ -3462,21 +3676,44 @@ declare class RecordArray<Result extends XataRecord> extends Array<Result> {
|
|
3462
3676
|
/**
|
3463
3677
|
* Common interface for performing operations on a table.
|
3464
3678
|
*/
|
3465
|
-
declare abstract class Repository<
|
3466
|
-
abstract create(object: Omit<EditableData<
|
3679
|
+
declare abstract class Repository<Record extends XataRecord> extends Query<Record, Readonly<SelectedPick<Record, ['*']>>> {
|
3680
|
+
abstract create<K extends SelectableColumn<Record>>(object: Omit<EditableData<Record>, 'id'> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
|
3681
|
+
abstract create(object: Omit<EditableData<Record>, 'id'> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
|
3682
|
+
/**
|
3683
|
+
* Creates a single record in the table with a unique id.
|
3684
|
+
* @param id The unique id.
|
3685
|
+
* @param object Object containing the column names with their values to be stored in the table.
|
3686
|
+
* @param columns Array of columns to be returned. If not specified, first level columns will be returned.
|
3687
|
+
* @returns The full persisted record.
|
3688
|
+
*/
|
3689
|
+
abstract create<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
|
3467
3690
|
/**
|
3468
3691
|
* Creates a single record in the table with a unique id.
|
3469
3692
|
* @param id The unique id.
|
3470
3693
|
* @param object Object containing the column names with their values to be stored in the table.
|
3471
3694
|
* @returns The full persisted record.
|
3472
3695
|
*/
|
3473
|
-
abstract create(id: string, object: Omit<EditableData<
|
3696
|
+
abstract create(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
|
3474
3697
|
/**
|
3475
3698
|
* Creates multiple records in the table.
|
3476
3699
|
* @param objects Array of objects with the column names and the values to be stored in the table.
|
3477
|
-
* @
|
3700
|
+
* @param columns Array of columns to be returned. If not specified, first level columns will be returned.
|
3701
|
+
* @returns Array of the persisted records in order.
|
3702
|
+
*/
|
3703
|
+
abstract create<K extends SelectableColumn<Record>>(objects: Array<Omit<EditableData<Record>, 'id'> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
|
3704
|
+
/**
|
3705
|
+
* Creates multiple records in the table.
|
3706
|
+
* @param objects Array of objects with the column names and the values to be stored in the table.
|
3707
|
+
* @returns Array of the persisted records in order.
|
3708
|
+
*/
|
3709
|
+
abstract create(objects: Array<Omit<EditableData<Record>, 'id'> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
|
3710
|
+
/**
|
3711
|
+
* Queries a single record from the table given its unique id.
|
3712
|
+
* @param id The unique id.
|
3713
|
+
* @param columns Array of columns to be returned. If not specified, first level columns will be returned.
|
3714
|
+
* @returns The persisted record for the given id or null if the record could not be found.
|
3478
3715
|
*/
|
3479
|
-
abstract
|
3716
|
+
abstract read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
|
3480
3717
|
/**
|
3481
3718
|
* Queries a single record from the table given its unique id.
|
3482
3719
|
* @param id The unique id.
|
@@ -3486,9 +3723,23 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
|
|
3486
3723
|
/**
|
3487
3724
|
* Queries multiple records from the table given their unique id.
|
3488
3725
|
* @param ids The unique ids array.
|
3489
|
-
* @
|
3726
|
+
* @param columns Array of columns to be returned. If not specified, first level columns will be returned.
|
3727
|
+
* @returns The persisted records for the given ids in order (if a record could not be found null is returned).
|
3490
3728
|
*/
|
3491
|
-
abstract read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record,
|
3729
|
+
abstract read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
|
3730
|
+
/**
|
3731
|
+
* Queries multiple records from the table given their unique id.
|
3732
|
+
* @param ids The unique ids array.
|
3733
|
+
* @returns The persisted records for the given ids in order (if a record could not be found null is returned).
|
3734
|
+
*/
|
3735
|
+
abstract read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
|
3736
|
+
/**
|
3737
|
+
* Queries a single record from the table by the id in the object.
|
3738
|
+
* @param object Object containing the id of the record.
|
3739
|
+
* @param columns Array of columns to be returned. If not specified, first level columns will be returned.
|
3740
|
+
* @returns The persisted record for the given id or null if the record could not be found.
|
3741
|
+
*/
|
3742
|
+
abstract read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
|
3492
3743
|
/**
|
3493
3744
|
* Queries a single record from the table by the id in the object.
|
3494
3745
|
* @param object Object containing the id of the record.
|
@@ -3498,35 +3749,81 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
|
|
3498
3749
|
/**
|
3499
3750
|
* Queries multiple records from the table by the ids in the objects.
|
3500
3751
|
* @param objects Array of objects containing the ids of the records.
|
3501
|
-
* @
|
3752
|
+
* @param columns Array of columns to be returned. If not specified, first level columns will be returned.
|
3753
|
+
* @returns The persisted records for the given ids in order (if a record could not be found null is returned).
|
3502
3754
|
*/
|
3503
|
-
abstract read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record,
|
3755
|
+
abstract read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
|
3756
|
+
/**
|
3757
|
+
* Queries multiple records from the table by the ids in the objects.
|
3758
|
+
* @param objects Array of objects containing the ids of the records.
|
3759
|
+
* @returns The persisted records for the given ids in order (if a record could not be found null is returned).
|
3760
|
+
*/
|
3761
|
+
abstract read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
|
3504
3762
|
/**
|
3505
3763
|
* Partially update a single record.
|
3506
3764
|
* @param object An object with its id and the columns to be updated.
|
3507
|
-
* @
|
3765
|
+
* @param columns Array of columns to be returned. If not specified, first level columns will be returned.
|
3766
|
+
* @returns The full persisted record, null if the record could not be found.
|
3508
3767
|
*/
|
3509
|
-
abstract update(object: Partial<EditableData<
|
3768
|
+
abstract update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
|
3769
|
+
/**
|
3770
|
+
* Partially update a single record.
|
3771
|
+
* @param object An object with its id and the columns to be updated.
|
3772
|
+
* @returns The full persisted record, null if the record could not be found.
|
3773
|
+
*/
|
3774
|
+
abstract update(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
|
3510
3775
|
/**
|
3511
3776
|
* Partially update a single record given its unique id.
|
3512
3777
|
* @param id The unique id.
|
3513
3778
|
* @param object The column names and their values that have to be updated.
|
3514
|
-
* @
|
3779
|
+
* @param columns Array of columns to be returned. If not specified, first level columns will be returned.
|
3780
|
+
* @returns The full persisted record, null if the record could not be found.
|
3515
3781
|
*/
|
3516
|
-
abstract update(id: string, object: Partial<EditableData<
|
3782
|
+
abstract update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
|
3783
|
+
/**
|
3784
|
+
* Partially update a single record given its unique id.
|
3785
|
+
* @param id The unique id.
|
3786
|
+
* @param object The column names and their values that have to be updated.
|
3787
|
+
* @returns The full persisted record, null if the record could not be found.
|
3788
|
+
*/
|
3789
|
+
abstract update(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
|
3517
3790
|
/**
|
3518
3791
|
* Partially updates multiple records.
|
3519
3792
|
* @param objects An array of objects with their ids and columns to be updated.
|
3520
|
-
* @
|
3793
|
+
* @param columns Array of columns to be returned. If not specified, first level columns will be returned.
|
3794
|
+
* @returns Array of the persisted records in order (if a record could not be found null is returned).
|
3795
|
+
*/
|
3796
|
+
abstract update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
|
3797
|
+
/**
|
3798
|
+
* Partially updates multiple records.
|
3799
|
+
* @param objects An array of objects with their ids and columns to be updated.
|
3800
|
+
* @returns Array of the persisted records in order (if a record could not be found null is returned).
|
3521
3801
|
*/
|
3522
|
-
abstract update(objects: Array<Partial<EditableData<
|
3802
|
+
abstract update(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
|
3523
3803
|
/**
|
3524
3804
|
* Creates or updates a single record. If a record exists with the given id,
|
3525
3805
|
* it will be update, otherwise a new record will be created.
|
3526
3806
|
* @param object Object containing the column names with their values to be persisted in the table.
|
3807
|
+
* @param columns Array of columns to be returned. If not specified, first level columns will be returned.
|
3808
|
+
* @returns The full persisted record.
|
3809
|
+
*/
|
3810
|
+
abstract createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Record> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
|
3811
|
+
/**
|
3812
|
+
* Creates or updates a single record. If a record exists with the given id,
|
3813
|
+
* it will be update, otherwise a new record will be created.
|
3814
|
+
* @param object Object containing the column names with their values to be persisted in the table.
|
3815
|
+
* @returns The full persisted record.
|
3816
|
+
*/
|
3817
|
+
abstract createOrUpdate(object: EditableData<Record> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
|
3818
|
+
/**
|
3819
|
+
* Creates or updates a single record. If a record exists with the given id,
|
3820
|
+
* it will be update, otherwise a new record will be created.
|
3821
|
+
* @param id A unique id.
|
3822
|
+
* @param object The column names and the values to be persisted.
|
3823
|
+
* @param columns Array of columns to be returned. If not specified, first level columns will be returned.
|
3527
3824
|
* @returns The full persisted record.
|
3528
3825
|
*/
|
3529
|
-
abstract createOrUpdate(object: EditableData<
|
3826
|
+
abstract createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
|
3530
3827
|
/**
|
3531
3828
|
* Creates or updates a single record. If a record exists with the given id,
|
3532
3829
|
* it will be update, otherwise a new record will be created.
|
@@ -3534,38 +3831,74 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
|
|
3534
3831
|
* @param object The column names and the values to be persisted.
|
3535
3832
|
* @returns The full persisted record.
|
3536
3833
|
*/
|
3537
|
-
abstract createOrUpdate(id: string, object: Omit<EditableData<
|
3834
|
+
abstract createOrUpdate(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
|
3835
|
+
/**
|
3836
|
+
* Creates or updates a single record. If a record exists with the given id,
|
3837
|
+
* it will be update, otherwise a new record will be created.
|
3838
|
+
* @param objects Array of objects with the column names and the values to be stored in the table.
|
3839
|
+
* @param columns Array of columns to be returned. If not specified, first level columns will be returned.
|
3840
|
+
* @returns Array of the persisted records.
|
3841
|
+
*/
|
3842
|
+
abstract createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
|
3538
3843
|
/**
|
3539
3844
|
* Creates or updates a single record. If a record exists with the given id,
|
3540
3845
|
* it will be update, otherwise a new record will be created.
|
3541
3846
|
* @param objects Array of objects with the column names and the values to be stored in the table.
|
3542
3847
|
* @returns Array of the persisted records.
|
3543
3848
|
*/
|
3544
|
-
abstract createOrUpdate(objects: Array<EditableData<
|
3849
|
+
abstract createOrUpdate(objects: Array<EditableData<Record> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
|
3545
3850
|
/**
|
3546
3851
|
* Deletes a record given its unique id.
|
3547
|
-
* @param
|
3548
|
-
* @
|
3852
|
+
* @param object An object with a unique id.
|
3853
|
+
* @param columns Array of columns to be returned. If not specified, first level columns will be returned.
|
3854
|
+
* @returns The deleted record, null if the record could not be found.
|
3549
3855
|
*/
|
3550
|
-
abstract delete(
|
3856
|
+
abstract delete<K extends SelectableColumn<Record>>(object: Identifiable & Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
|
3551
3857
|
/**
|
3552
3858
|
* Deletes a record given its unique id.
|
3553
|
-
* @param
|
3554
|
-
* @
|
3859
|
+
* @param object An object with a unique id.
|
3860
|
+
* @returns The deleted record, null if the record could not be found.
|
3861
|
+
*/
|
3862
|
+
abstract delete(object: Identifiable & Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
|
3863
|
+
/**
|
3864
|
+
* Deletes a record given a unique id.
|
3865
|
+
* @param id The unique id.
|
3866
|
+
* @param columns Array of columns to be returned. If not specified, first level columns will be returned.
|
3867
|
+
* @returns The deleted record, null if the record could not be found.
|
3868
|
+
*/
|
3869
|
+
abstract delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
|
3870
|
+
/**
|
3871
|
+
* Deletes a record given a unique id.
|
3872
|
+
* @param id The unique id.
|
3873
|
+
* @returns The deleted record, null if the record could not be found.
|
3874
|
+
*/
|
3875
|
+
abstract delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
|
3876
|
+
/**
|
3877
|
+
* Deletes multiple records given an array of objects with ids.
|
3878
|
+
* @param objects An array of objects with unique ids.
|
3879
|
+
* @param columns Array of columns to be returned. If not specified, first level columns will be returned.
|
3880
|
+
* @returns Array of the deleted records in order (if a record could not be found null is returned).
|
3555
3881
|
*/
|
3556
|
-
abstract delete(
|
3882
|
+
abstract delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
|
3557
3883
|
/**
|
3558
|
-
* Deletes
|
3559
|
-
* @param
|
3560
|
-
* @
|
3884
|
+
* Deletes multiple records given an array of objects with ids.
|
3885
|
+
* @param objects An array of objects with unique ids.
|
3886
|
+
* @returns Array of the deleted records in order (if a record could not be found null is returned).
|
3561
3887
|
*/
|
3562
|
-
abstract delete(
|
3888
|
+
abstract delete(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
|
3563
3889
|
/**
|
3564
|
-
* Deletes
|
3565
|
-
* @param
|
3566
|
-
* @
|
3890
|
+
* Deletes multiple records given an array of unique ids.
|
3891
|
+
* @param objects An array of ids.
|
3892
|
+
* @param columns Array of columns to be returned. If not specified, first level columns will be returned.
|
3893
|
+
* @returns Array of the deleted records in order (if a record could not be found null is returned).
|
3567
3894
|
*/
|
3568
|
-
abstract delete(
|
3895
|
+
abstract delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
|
3896
|
+
/**
|
3897
|
+
* Deletes multiple records given an array of unique ids.
|
3898
|
+
* @param objects An array of ids.
|
3899
|
+
* @returns Array of the deleted records in order (if a record could not be found null is returned).
|
3900
|
+
*/
|
3901
|
+
abstract delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
|
3569
3902
|
/**
|
3570
3903
|
* Search for records in the table.
|
3571
3904
|
* @param query The query to search for.
|
@@ -3574,39 +3907,62 @@ declare abstract class Repository<Data extends BaseData, Record extends XataReco
|
|
3574
3907
|
*/
|
3575
3908
|
abstract search(query: string, options?: {
|
3576
3909
|
fuzziness?: FuzzinessExpression;
|
3910
|
+
prefix?: PrefixExpression;
|
3577
3911
|
highlight?: HighlightExpression;
|
3578
3912
|
filter?: Filter<Record>;
|
3579
|
-
|
3913
|
+
boosters?: Boosters<Record>[];
|
3914
|
+
}): Promise<SearchXataRecord<SelectedPick<Record, ['*']>>[]>;
|
3580
3915
|
abstract query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
|
3581
3916
|
}
|
3582
|
-
declare class RestRepository<
|
3917
|
+
declare class RestRepository<Record extends XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Record> {
|
3583
3918
|
#private;
|
3584
|
-
db: SchemaPluginResult<any>;
|
3585
3919
|
constructor(options: {
|
3586
3920
|
table: string;
|
3587
3921
|
db: SchemaPluginResult<any>;
|
3588
3922
|
pluginOptions: XataPluginOptions;
|
3589
3923
|
schemaTables?: Table[];
|
3590
3924
|
});
|
3591
|
-
create(object: EditableData<
|
3592
|
-
create(
|
3593
|
-
create(
|
3594
|
-
|
3595
|
-
|
3596
|
-
|
3597
|
-
read(
|
3598
|
-
|
3599
|
-
|
3600
|
-
|
3601
|
-
|
3602
|
-
|
3603
|
-
|
3604
|
-
|
3925
|
+
create<K extends SelectableColumn<Record>>(object: EditableData<Record> & Partial<Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
|
3926
|
+
create(object: EditableData<Record> & Partial<Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
|
3927
|
+
create<K extends SelectableColumn<Record>>(id: string, object: EditableData<Record>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
|
3928
|
+
create(id: string, object: EditableData<Record>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
|
3929
|
+
create<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Partial<Identifiable>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
|
3930
|
+
create(objects: Array<EditableData<Record> & Partial<Identifiable>>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
|
3931
|
+
read<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
|
3932
|
+
read(id: string): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
|
3933
|
+
read<K extends SelectableColumn<Record>>(ids: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
|
3934
|
+
read(ids: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
|
3935
|
+
read<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns> | null>>;
|
3936
|
+
read(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']> | null>>;
|
3937
|
+
read<K extends SelectableColumn<Record>>(objects: Identifiable[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
|
3938
|
+
read(objects: Identifiable[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
|
3939
|
+
update<K extends SelectableColumn<Record>>(object: Partial<EditableData<Record>> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
|
3940
|
+
update(object: Partial<EditableData<Record>> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
|
3941
|
+
update<K extends SelectableColumn<Record>>(id: string, object: Partial<EditableData<Record>>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
|
3942
|
+
update(id: string, object: Partial<EditableData<Record>>): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
|
3943
|
+
update<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
|
3944
|
+
update(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
|
3945
|
+
createOrUpdate<K extends SelectableColumn<Record>>(object: EditableData<Record> & Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
|
3946
|
+
createOrUpdate(object: EditableData<Record> & Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>>>;
|
3947
|
+
createOrUpdate<K extends SelectableColumn<Record>>(id: string, object: Omit<EditableData<Record>, 'id'>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>>;
|
3948
|
+
createOrUpdate(id: string, object: Omit<EditableData<Record>, 'id'>): Promise<Readonly<SelectedPick<Record, ['*']>>>;
|
3949
|
+
createOrUpdate<K extends SelectableColumn<Record>>(objects: Array<EditableData<Record> & Identifiable>, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>>[]>;
|
3950
|
+
createOrUpdate(objects: Array<EditableData<Record> & Identifiable>): Promise<Readonly<SelectedPick<Record, ['*']>>[]>;
|
3951
|
+
delete<K extends SelectableColumn<Record>>(object: Identifiable, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
|
3952
|
+
delete(object: Identifiable): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
|
3953
|
+
delete<K extends SelectableColumn<Record>>(id: string, columns: K[]): Promise<Readonly<SelectedPick<Record, typeof columns>> | null>;
|
3954
|
+
delete(id: string): Promise<Readonly<SelectedPick<Record, ['*']>> | null>;
|
3955
|
+
delete<K extends SelectableColumn<Record>>(objects: Array<Partial<EditableData<Record>> & Identifiable>, columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
|
3956
|
+
delete(objects: Array<Partial<EditableData<Record>> & Identifiable>): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
|
3957
|
+
delete<K extends SelectableColumn<Record>>(objects: string[], columns: K[]): Promise<Array<Readonly<SelectedPick<Record, typeof columns>> | null>>;
|
3958
|
+
delete(objects: string[]): Promise<Array<Readonly<SelectedPick<Record, ['*']>> | null>>;
|
3605
3959
|
search(query: string, options?: {
|
3606
3960
|
fuzziness?: FuzzinessExpression;
|
3961
|
+
prefix?: PrefixExpression;
|
3607
3962
|
highlight?: HighlightExpression;
|
3608
3963
|
filter?: Filter<Record>;
|
3609
|
-
|
3964
|
+
boosters?: Boosters<Record>[];
|
3965
|
+
}): Promise<any>;
|
3610
3966
|
query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
|
3611
3967
|
}
|
3612
3968
|
|
@@ -3663,6 +4019,10 @@ declare type PropertyType<Tables, Properties, PropertyName> = Properties & {
|
|
3663
4019
|
[K in ObjectColumns[number]['name']]?: PropertyType<Tables, ObjectColumns[number], K>;
|
3664
4020
|
} : never : never : Type extends 'link' ? TableType<Tables, LinkedTable> & XataRecord : never) | null : never : never;
|
3665
4021
|
|
4022
|
+
/**
|
4023
|
+
* Operator to restrict results to only values that are greater than the given value.
|
4024
|
+
*/
|
4025
|
+
declare const greaterThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
|
3666
4026
|
/**
|
3667
4027
|
* Operator to restrict results to only values that are greater than the given value.
|
3668
4028
|
*/
|
@@ -3670,15 +4030,35 @@ declare const gt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T
|
|
3670
4030
|
/**
|
3671
4031
|
* Operator to restrict results to only values that are greater than or equal to the given value.
|
3672
4032
|
*/
|
3673
|
-
declare const
|
4033
|
+
declare const greaterThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
|
4034
|
+
/**
|
4035
|
+
* Operator to restrict results to only values that are greater than or equal to the given value.
|
4036
|
+
*/
|
4037
|
+
declare const greaterEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
|
3674
4038
|
/**
|
3675
4039
|
* Operator to restrict results to only values that are greater than or equal to the given value.
|
3676
4040
|
*/
|
3677
4041
|
declare const gte: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
|
4042
|
+
/**
|
4043
|
+
* Operator to restrict results to only values that are greater than or equal to the given value.
|
4044
|
+
*/
|
4045
|
+
declare const ge: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
|
4046
|
+
/**
|
4047
|
+
* Operator to restrict results to only values that are lower than the given value.
|
4048
|
+
*/
|
4049
|
+
declare const lessThan: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
|
3678
4050
|
/**
|
3679
4051
|
* Operator to restrict results to only values that are lower than the given value.
|
3680
4052
|
*/
|
3681
4053
|
declare const lt: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
|
4054
|
+
/**
|
4055
|
+
* Operator to restrict results to only values that are lower than or equal to the given value.
|
4056
|
+
*/
|
4057
|
+
declare const lessThanEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
|
4058
|
+
/**
|
4059
|
+
* Operator to restrict results to only values that are lower than or equal to the given value.
|
4060
|
+
*/
|
4061
|
+
declare const lessEquals: <T extends ComparableType>(value: T) => ComparableTypeFilter<T>;
|
3682
4062
|
/**
|
3683
4063
|
* Operator to restrict results to only values that are lower than or equal to the given value.
|
3684
4064
|
*/
|
@@ -3711,6 +4091,10 @@ declare const pattern: (value: string) => StringTypeFilter;
|
|
3711
4091
|
* Operator to restrict results to only values that are equal to the given value.
|
3712
4092
|
*/
|
3713
4093
|
declare const is: <T>(value: T) => PropertyFilter<T>;
|
4094
|
+
/**
|
4095
|
+
* Operator to restrict results to only values that are equal to the given value.
|
4096
|
+
*/
|
4097
|
+
declare const equals: <T>(value: T) => PropertyFilter<T>;
|
3714
4098
|
/**
|
3715
4099
|
* Operator to restrict results to only values that are not equal to the given value.
|
3716
4100
|
*/
|
@@ -3739,58 +4123,17 @@ declare const includesAny: <T>(value: T) => ArrayFilter<T>;
|
|
3739
4123
|
declare type SchemaDefinition = {
|
3740
4124
|
table: string;
|
3741
4125
|
};
|
3742
|
-
declare type SchemaPluginResult<Schemas extends Record<string,
|
4126
|
+
declare type SchemaPluginResult<Schemas extends Record<string, XataRecord>> = {
|
3743
4127
|
[Key in keyof Schemas]: Repository<Schemas[Key]>;
|
3744
4128
|
} & {
|
3745
|
-
[key: string]: Repository<XataRecord
|
4129
|
+
[key: string]: Repository<XataRecord>;
|
3746
4130
|
};
|
3747
|
-
declare class SchemaPlugin<Schemas extends Record<string,
|
4131
|
+
declare class SchemaPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin {
|
3748
4132
|
#private;
|
3749
4133
|
constructor(schemaTables?: Schemas.Table[]);
|
3750
4134
|
build(pluginOptions: XataPluginOptions): SchemaPluginResult<Schemas>;
|
3751
4135
|
}
|
3752
4136
|
|
3753
|
-
declare type SearchOptions<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>> = {
|
3754
|
-
fuzziness?: FuzzinessExpression;
|
3755
|
-
highlight?: HighlightExpression;
|
3756
|
-
tables?: Array<Tables | Values<{
|
3757
|
-
[Model in GetArrayInnerType<NonNullable<Tables[]>>]: {
|
3758
|
-
table: Model;
|
3759
|
-
filter?: Filter<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>>;
|
3760
|
-
};
|
3761
|
-
}>>;
|
3762
|
-
};
|
3763
|
-
declare type SearchPluginResult<Schemas extends Record<string, BaseData>> = {
|
3764
|
-
all: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<Values<{
|
3765
|
-
[Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]: {
|
3766
|
-
table: Model;
|
3767
|
-
record: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>>;
|
3768
|
-
};
|
3769
|
-
}>[]>;
|
3770
|
-
byTable: <Tables extends StringKeys<Schemas>>(query: string, options?: SearchOptions<Schemas, Tables>) => Promise<{
|
3771
|
-
[Model in ExtractTables<Schemas, Tables, GetArrayInnerType<NonNullable<NonNullable<typeof options>['tables']>>>]?: Awaited<SelectedPick<Schemas[Model] & SearchXataRecord, ['*']>[]>;
|
3772
|
-
}>;
|
3773
|
-
};
|
3774
|
-
declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
|
3775
|
-
#private;
|
3776
|
-
private db;
|
3777
|
-
constructor(db: SchemaPluginResult<Schemas>, schemaTables?: Schemas.Table[]);
|
3778
|
-
build({ getFetchProps }: XataPluginOptions): SearchPluginResult<Schemas>;
|
3779
|
-
}
|
3780
|
-
declare type SearchXataRecord = XataRecord<SearchExtraProperties>;
|
3781
|
-
declare type SearchExtraProperties = {
|
3782
|
-
table: string;
|
3783
|
-
highlight?: {
|
3784
|
-
[key: string]: string[] | {
|
3785
|
-
[key: string]: any;
|
3786
|
-
};
|
3787
|
-
};
|
3788
|
-
};
|
3789
|
-
declare type ReturnTable<Table, Tables> = Table extends Tables ? Table : never;
|
3790
|
-
declare type ExtractTables<Schemas extends Record<string, BaseData>, Tables extends StringKeys<Schemas>, TableOptions extends GetArrayInnerType<NonNullable<NonNullable<SearchOptions<Schemas, Tables>>['tables']>>> = TableOptions extends `${infer Table}` ? ReturnTable<Table, Tables> : TableOptions extends {
|
3791
|
-
table: infer Table;
|
3792
|
-
} ? ReturnTable<Table, Tables> : never;
|
3793
|
-
|
3794
4137
|
declare type BranchStrategyValue = string | undefined | null;
|
3795
4138
|
declare type BranchStrategyBuilder = () => BranchStrategyValue | Promise<BranchStrategyValue>;
|
3796
4139
|
declare type BranchStrategy = BranchStrategyValue | BranchStrategyBuilder;
|
@@ -3802,20 +4145,35 @@ declare type BaseClientOptions = {
|
|
3802
4145
|
databaseURL?: string;
|
3803
4146
|
branch?: BranchStrategyOption;
|
3804
4147
|
cache?: CacheImpl;
|
4148
|
+
trace?: TraceFunction;
|
3805
4149
|
};
|
3806
4150
|
declare const buildClient: <Plugins extends Record<string, XataPlugin> = {}>(plugins?: Plugins | undefined) => ClientConstructor<Plugins>;
|
3807
4151
|
interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
|
3808
|
-
new <
|
3809
|
-
db: Awaited<ReturnType<SchemaPlugin<
|
3810
|
-
search: Awaited<ReturnType<SearchPlugin<
|
4152
|
+
new <Schemas extends Record<string, XataRecord> = {}>(options?: Partial<BaseClientOptions>, schemaTables?: readonly BaseSchema[]): Omit<{
|
4153
|
+
db: Awaited<ReturnType<SchemaPlugin<Schemas>['build']>>;
|
4154
|
+
search: Awaited<ReturnType<SearchPlugin<Schemas>['build']>>;
|
3811
4155
|
}, keyof Plugins> & {
|
3812
4156
|
[Key in StringKeys<NonNullable<Plugins>>]: Awaited<ReturnType<NonNullable<Plugins>[Key]['build']>>;
|
4157
|
+
} & {
|
4158
|
+
getConfig(): Promise<{
|
4159
|
+
databaseURL: string;
|
4160
|
+
branch: string;
|
4161
|
+
}>;
|
3813
4162
|
};
|
3814
4163
|
}
|
3815
4164
|
declare const BaseClient_base: ClientConstructor<{}>;
|
3816
|
-
declare class BaseClient extends BaseClient_base<
|
4165
|
+
declare class BaseClient extends BaseClient_base<Record<string, any>> {
|
3817
4166
|
}
|
3818
4167
|
|
4168
|
+
declare class Serializer {
|
4169
|
+
classes: Record<string, any>;
|
4170
|
+
add(clazz: any): void;
|
4171
|
+
toJSON<T>(data: T): string;
|
4172
|
+
fromJSON<T>(json: string): T;
|
4173
|
+
}
|
4174
|
+
declare const serialize: <T>(data: T) => string;
|
4175
|
+
declare const deserialize: <T>(json: string) => T;
|
4176
|
+
|
3819
4177
|
declare type BranchResolutionOptions = {
|
3820
4178
|
databaseURL?: string;
|
3821
4179
|
apiKey?: string;
|
@@ -3827,9 +4185,89 @@ declare function getDatabaseURL(): string | undefined;
|
|
3827
4185
|
|
3828
4186
|
declare function getAPIKey(): string | undefined;
|
3829
4187
|
|
4188
|
+
interface Body {
|
4189
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
4190
|
+
blob(): Promise<Blob>;
|
4191
|
+
formData(): Promise<FormData>;
|
4192
|
+
json(): Promise<any>;
|
4193
|
+
text(): Promise<string>;
|
4194
|
+
}
|
4195
|
+
interface Blob {
|
4196
|
+
readonly size: number;
|
4197
|
+
readonly type: string;
|
4198
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
4199
|
+
slice(start?: number, end?: number, contentType?: string): Blob;
|
4200
|
+
text(): Promise<string>;
|
4201
|
+
}
|
4202
|
+
/** Provides information about files and allows JavaScript in a web page to access their content. */
|
4203
|
+
interface File extends Blob {
|
4204
|
+
readonly lastModified: number;
|
4205
|
+
readonly name: string;
|
4206
|
+
readonly webkitRelativePath: string;
|
4207
|
+
}
|
4208
|
+
declare type FormDataEntryValue = File | string;
|
4209
|
+
/** Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data". */
|
4210
|
+
interface FormData {
|
4211
|
+
append(name: string, value: string | Blob, fileName?: string): void;
|
4212
|
+
delete(name: string): void;
|
4213
|
+
get(name: string): FormDataEntryValue | null;
|
4214
|
+
getAll(name: string): FormDataEntryValue[];
|
4215
|
+
has(name: string): boolean;
|
4216
|
+
set(name: string, value: string | Blob, fileName?: string): void;
|
4217
|
+
forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void;
|
4218
|
+
}
|
4219
|
+
/** This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs. You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence. */
|
4220
|
+
interface Headers {
|
4221
|
+
append(name: string, value: string): void;
|
4222
|
+
delete(name: string): void;
|
4223
|
+
get(name: string): string | null;
|
4224
|
+
has(name: string): boolean;
|
4225
|
+
set(name: string, value: string): void;
|
4226
|
+
forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void;
|
4227
|
+
}
|
4228
|
+
interface Request extends Body {
|
4229
|
+
/** Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching. */
|
4230
|
+
readonly cache: 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload';
|
4231
|
+
/** Returns the credentials mode associated with request, which is a string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. */
|
4232
|
+
readonly credentials: 'include' | 'omit' | 'same-origin';
|
4233
|
+
/** Returns the kind of resource requested by request, e.g., "document" or "script". */
|
4234
|
+
readonly destination: '' | 'audio' | 'audioworklet' | 'document' | 'embed' | 'font' | 'frame' | 'iframe' | 'image' | 'manifest' | 'object' | 'paintworklet' | 'report' | 'script' | 'sharedworker' | 'style' | 'track' | 'video' | 'worker' | 'xslt';
|
4235
|
+
/** Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header. */
|
4236
|
+
readonly headers: Headers;
|
4237
|
+
/** Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI] */
|
4238
|
+
readonly integrity: string;
|
4239
|
+
/** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
|
4240
|
+
readonly keepalive: boolean;
|
4241
|
+
/** Returns request's HTTP method, which is "GET" by default. */
|
4242
|
+
readonly method: string;
|
4243
|
+
/** Returns the mode associated with request, which is a string indicating whether the request will use CORS, or will be restricted to same-origin URLs. */
|
4244
|
+
readonly mode: 'cors' | 'navigate' | 'no-cors' | 'same-origin';
|
4245
|
+
/** Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default. */
|
4246
|
+
readonly redirect: 'error' | 'follow' | 'manual';
|
4247
|
+
/** Returns the referrer of request. Its value can be a same-origin URL if explicitly set in init, the empty string to indicate no referrer, and "about:client" when defaulting to the global's default. This is used during fetching to determine the value of the `Referer` header of the request being made. */
|
4248
|
+
readonly referrer: string;
|
4249
|
+
/** Returns the referrer policy associated with request. This is used during fetching to compute the value of the request's referrer. */
|
4250
|
+
readonly referrerPolicy: '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
|
4251
|
+
/** Returns the URL of request as a string. */
|
4252
|
+
readonly url: string;
|
4253
|
+
clone(): Request;
|
4254
|
+
}
|
4255
|
+
|
4256
|
+
declare type XataWorkerContext<XataClient> = {
|
4257
|
+
xata: XataClient;
|
4258
|
+
request: Request;
|
4259
|
+
env: Record<string, string | undefined>;
|
4260
|
+
};
|
4261
|
+
declare type RemoveFirst<T> = T extends [any, ...infer U] ? U : never;
|
4262
|
+
declare type WorkerRunnerConfig = {
|
4263
|
+
workspace: string;
|
4264
|
+
worker: string;
|
4265
|
+
};
|
4266
|
+
declare function buildWorkerRunner<XataClient>(config: WorkerRunnerConfig): <WorkerFunction extends (ctx: XataWorkerContext<XataClient>, ...args: any[]) => any>(name: string, _worker: WorkerFunction) => (...args: RemoveFirst<Parameters<WorkerFunction>>) => Promise<Awaited<ReturnType<WorkerFunction>>>;
|
4267
|
+
|
3830
4268
|
declare class XataError extends Error {
|
3831
4269
|
readonly status: number;
|
3832
4270
|
constructor(message: string, status: number);
|
3833
4271
|
}
|
3834
4272
|
|
3835
|
-
export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, AddGitBranchesEntryError, AddGitBranchesEntryPathParams, AddGitBranchesEntryRequestBody, AddGitBranchesEntryResponse, AddGitBranchesEntryVariables, AddTableColumnError, AddTableColumnPathParams, AddTableColumnVariables, BaseClient, BaseClientOptions, BaseData, BaseSchema, BulkInsertTableRecordsError, BulkInsertTableRecordsPathParams,
|
4273
|
+
export { AcceptWorkspaceMemberInviteError, AcceptWorkspaceMemberInvitePathParams, AcceptWorkspaceMemberInviteVariables, AddGitBranchesEntryError, AddGitBranchesEntryPathParams, AddGitBranchesEntryRequestBody, AddGitBranchesEntryResponse, AddGitBranchesEntryVariables, AddTableColumnError, AddTableColumnPathParams, AddTableColumnVariables, BaseClient, BaseClientOptions, BaseData, BaseSchema, BulkInsertTableRecordsError, BulkInsertTableRecordsPathParams, BulkInsertTableRecordsQueryParams, BulkInsertTableRecordsRequestBody, BulkInsertTableRecordsVariables, CacheImpl, CancelWorkspaceMemberInviteError, CancelWorkspaceMemberInvitePathParams, CancelWorkspaceMemberInviteVariables, ClientConstructor, CreateBranchError, CreateBranchPathParams, CreateBranchQueryParams, CreateBranchRequestBody, CreateBranchResponse, CreateBranchVariables, CreateDatabaseError, CreateDatabasePathParams, CreateDatabaseRequestBody, CreateDatabaseResponse, CreateDatabaseVariables, CreateTableError, CreateTablePathParams, CreateTableResponse, CreateTableVariables, CreateUserAPIKeyError, CreateUserAPIKeyPathParams, CreateUserAPIKeyResponse, CreateUserAPIKeyVariables, CreateWorkspaceError, CreateWorkspaceVariables, CursorNavigationOptions, DeleteBranchError, DeleteBranchPathParams, DeleteBranchVariables, DeleteColumnError, DeleteColumnPathParams, DeleteColumnVariables, DeleteDatabaseError, DeleteDatabasePathParams, DeleteDatabaseVariables, DeleteRecordError, DeleteRecordPathParams, DeleteRecordQueryParams, DeleteRecordVariables, DeleteTableError, DeleteTablePathParams, DeleteTableVariables, DeleteUserAPIKeyError, DeleteUserAPIKeyPathParams, DeleteUserAPIKeyVariables, DeleteUserError, DeleteUserVariables, DeleteWorkspaceError, DeleteWorkspacePathParams, DeleteWorkspaceVariables, EditableData, ExecuteBranchMigrationPlanError, ExecuteBranchMigrationPlanPathParams, ExecuteBranchMigrationPlanRequestBody, ExecuteBranchMigrationPlanVariables, FetchImpl, FetcherExtraProps, GetBranchDetailsError, GetBranchDetailsPathParams, GetBranchDetailsVariables, GetBranchListError, GetBranchListPathParams, GetBranchListVariables, GetBranchMetadataError, GetBranchMetadataPathParams, GetBranchMetadataVariables, GetBranchMigrationHistoryError, GetBranchMigrationHistoryPathParams, GetBranchMigrationHistoryRequestBody, GetBranchMigrationHistoryResponse, GetBranchMigrationHistoryVariables, GetBranchMigrationPlanError, GetBranchMigrationPlanPathParams, GetBranchMigrationPlanVariables, GetBranchStatsError, GetBranchStatsPathParams, GetBranchStatsResponse, GetBranchStatsVariables, GetColumnError, GetColumnPathParams, GetColumnVariables, GetDatabaseListError, GetDatabaseListPathParams, GetDatabaseListVariables, GetDatabaseMetadataError, GetDatabaseMetadataPathParams, GetDatabaseMetadataVariables, GetGitBranchesMappingError, GetGitBranchesMappingPathParams, GetGitBranchesMappingVariables, GetRecordError, GetRecordPathParams, GetRecordQueryParams, GetRecordVariables, GetTableColumnsError, GetTableColumnsPathParams, GetTableColumnsResponse, GetTableColumnsVariables, GetTableSchemaError, GetTableSchemaPathParams, GetTableSchemaResponse, GetTableSchemaVariables, GetUserAPIKeysError, GetUserAPIKeysResponse, GetUserAPIKeysVariables, GetUserError, GetUserVariables, GetWorkspaceError, GetWorkspaceMembersListError, GetWorkspaceMembersListPathParams, GetWorkspaceMembersListVariables, GetWorkspacePathParams, GetWorkspaceVariables, GetWorkspacesListError, GetWorkspacesListResponse, GetWorkspacesListVariables, Identifiable, InsertRecordError, InsertRecordPathParams, InsertRecordQueryParams, InsertRecordVariables, InsertRecordWithIDError, InsertRecordWithIDPathParams, InsertRecordWithIDQueryParams, InsertRecordWithIDVariables, InviteWorkspaceMemberError, InviteWorkspaceMemberPathParams, InviteWorkspaceMemberRequestBody, InviteWorkspaceMemberVariables, Link, OffsetNavigationOptions, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Paginable, PaginationQueryMeta, Query, QueryTableError, QueryTablePathParams, QueryTableRequestBody, QueryTableVariables, RecordArray, RemoveGitBranchesEntryError, RemoveGitBranchesEntryPathParams, RemoveGitBranchesEntryQueryParams, RemoveGitBranchesEntryVariables, RemoveWorkspaceMemberError, RemoveWorkspaceMemberPathParams, RemoveWorkspaceMemberVariables, Repository, ResendWorkspaceMemberInviteError, ResendWorkspaceMemberInvitePathParams, ResendWorkspaceMemberInviteVariables, ResolveBranchError, ResolveBranchPathParams, ResolveBranchQueryParams, ResolveBranchResponse, ResolveBranchVariables, responses as Responses, RestRepository, SchemaDefinition, SchemaInference, SchemaPlugin, SchemaPluginResult, schemas as Schemas, SearchBranchError, SearchBranchPathParams, SearchBranchRequestBody, SearchBranchVariables, SearchOptions, SearchPlugin, SearchPluginResult, SearchTableError, SearchTablePathParams, SearchTableRequestBody, SearchTableVariables, SearchXataRecord, SelectableColumn, SelectedPick, Serializer, SetTableSchemaError, SetTableSchemaPathParams, SetTableSchemaRequestBody, SetTableSchemaVariables, SimpleCache, SimpleCacheOptions, UpdateBranchMetadataError, UpdateBranchMetadataPathParams, UpdateBranchMetadataVariables, UpdateColumnError, UpdateColumnPathParams, UpdateColumnRequestBody, UpdateColumnVariables, UpdateRecordWithIDError, UpdateRecordWithIDPathParams, UpdateRecordWithIDQueryParams, UpdateRecordWithIDVariables, UpdateTableError, UpdateTablePathParams, UpdateTableRequestBody, UpdateTableVariables, UpdateUserError, UpdateUserVariables, UpdateWorkspaceError, UpdateWorkspaceMemberInviteError, UpdateWorkspaceMemberInvitePathParams, UpdateWorkspaceMemberInviteRequestBody, UpdateWorkspaceMemberInviteVariables, UpdateWorkspaceMemberRoleError, UpdateWorkspaceMemberRolePathParams, UpdateWorkspaceMemberRoleRequestBody, UpdateWorkspaceMemberRoleVariables, UpdateWorkspacePathParams, UpdateWorkspaceVariables, UpsertRecordWithIDError, UpsertRecordWithIDPathParams, UpsertRecordWithIDQueryParams, UpsertRecordWithIDVariables, ValueAtColumn, XataApiClient, XataApiClientOptions, XataApiPlugin, XataError, XataPlugin, XataPluginOptions, XataRecord, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, buildClient, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, contains, createBranch, createDatabase, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getGitBranchesMapping, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isIdentifiable, isNot, isXataRecord, le, lessEquals, lessThan, lessThanEquals, lt, lte, notExists, operationsByTag, pattern, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };
|